Skip to content

Commit cdad5a2

Browse files
authored
Merge branch 'main' into ar/LG-5666-mcpui-app
2 parents f6f64cd + 8434842 commit cdad5a2

File tree

11 files changed

+100
-22
lines changed

11 files changed

+100
-22
lines changed

.github/CODEOWNERS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
# project:chat
22
chat/ @mongodb/lg-chat
33

4+
# project:deletion
5+
packages/wizard @mongodb/lg-deletion
6+
7+
# project:mcp-ui
8+
apps/mcp-ui-app @mongodb/lg-mcp-ui
9+
mcp-ui @mongodb/lg-mcp-ui
10+
411
# project:time-input
512
packages/date-picker @mongodb/lg-time-input
613
packages/date-utils @mongodb/lg-time-input
714
packages/time-input @mongodb/lg-time-input
15+
16+
# catch-all rule: any file not matching a more specific rule below
17+
# will be assigned to @leafygreen-ui-maintainers
18+
* @mongodb/leafygreen-ui-maintainers

packages/code-editor/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @leafygreen-ui/code-editor
22

3+
## 1.0.1
4+
5+
### Patch Changes
6+
7+
- a7fc5a8: - Fixes stuck loading state
8+
- Includes minor small visual improvements
9+
- Updated dependencies [d8c4e35]
10+
- @leafygreen-ui/typography@22.2.1
11+
312
## 1.0.0
413

514
### Major Changes

packages/code-editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@leafygreen-ui/code-editor",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "LeafyGreen UI Kit Code Editor",
55
"main": "./dist/umd/index.js",
66
"module": "./dist/esm/index.js",

packages/code-editor/src/CodeEditor.stories.tsx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ const meta: StoryMetaType<typeof CodeEditor> = {
4343
controls: {
4444
exclude: [...storybookExcludedControlParams, 'extensions'],
4545
},
46+
generate: {
47+
args: {
48+
width: '100%',
49+
},
50+
combineArgs: {
51+
darkMode: [false, true],
52+
baseFontSize: Object.values(BaseFontSize),
53+
copyButtonAppearance: Object.values(CopyButtonAppearance),
54+
enableLineNumbers: [true, false],
55+
},
56+
},
4657
},
4758
decorators: [
4859
(Story: StoryFn, context) => (
@@ -251,6 +262,35 @@ LiveExample.args = {
251262
),
252263
};
253264

265+
/** This asserts that the editor loads correctly when no defaults are provided. */
266+
export const NoDefaults = Template.bind({});
267+
NoDefaults.args = {
268+
copyButtonAppearance: undefined,
269+
customContextMenuItems: undefined,
270+
enableClickableUrls: undefined,
271+
enableCodeFolding: undefined,
272+
enableLineNumbers: undefined,
273+
enableLineWrapping: undefined,
274+
enableSearchPanel: undefined,
275+
baseFontSize: undefined,
276+
forceParsing: undefined,
277+
placeholder: undefined,
278+
readOnly: undefined,
279+
indentSize: undefined,
280+
indentUnit: undefined,
281+
isLoading: undefined,
282+
defaultValue: undefined,
283+
tooltips: undefined,
284+
darkMode: undefined,
285+
height: undefined,
286+
maxHeight: '',
287+
maxWidth: undefined,
288+
minHeight: undefined,
289+
minWidth: undefined,
290+
preLoadedModules: undefined,
291+
width: undefined,
292+
};
293+
254294
export const Minimal = Template.bind({});
255295
Minimal.args = {
256296
enableLineNumbers: false,
@@ -416,3 +456,5 @@ export const WithPreLoadedModules: StoryObj<typeof CodeEditor> = {
416456
/>
417457
),
418458
};
459+
460+
export const Generated = () => {};

packages/code-editor/src/CodeEditor/CodeEditor.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,22 @@ const BaseCodeEditor = forwardRef<CodeEditorHandle, CodeEditorProps>(
9090
const [undoDepth, setUndoDepth] = useState(0);
9191
const [redoDepth, setRedoDepth] = useState(0);
9292

93-
const { modules, isLoading } = useModules(props);
93+
// Create normalized props object with all defaults applied
94+
// This ensures that when we spread props, all default values are included
95+
// Note: We spread props first, then override with destructured values (which have defaults applied)
96+
// This ensures that if a prop is undefined in props, the default value is used
97+
const normalizedProps: CodeEditorProps = {
98+
...props,
99+
copyButtonAppearance,
100+
enableSearchPanel,
101+
extensions: consumerExtensions,
102+
forceParsing: forceParsingProp,
103+
isLoading: isLoadingProp,
104+
};
105+
106+
const { modules, isLoading } = useModules({
107+
...normalizedProps,
108+
});
94109

95110
// Get formatting functionality
96111
const { formatCode, isFormattingAvailable } = useCodeFormatter({
@@ -102,11 +117,8 @@ const BaseCodeEditor = forwardRef<CodeEditorHandle, CodeEditorProps>(
102117
const customExtensions = useExtensions({
103118
editorViewInstance: editorViewRef.current,
104119
props: {
105-
...props,
106-
forceParsing: forceParsingProp,
120+
...normalizedProps,
107121
onChange: onChangeProp,
108-
isLoading: isLoadingProp,
109-
extensions: consumerExtensions,
110122
baseFontSize,
111123
/**
112124
* CodeEditorTooltip in particular renders outside of the LeafyGreenProvider
@@ -283,7 +295,7 @@ const BaseCodeEditor = forwardRef<CodeEditorHandle, CodeEditorProps>(
283295

284296
const searchPanelExtension = useSearchPanelExtension({
285297
props: {
286-
...props,
298+
...normalizedProps,
287299
darkMode,
288300
baseFontSize,
289301
},
@@ -335,7 +347,6 @@ const BaseCodeEditor = forwardRef<CodeEditorHandle, CodeEditorProps>(
335347
!EditorView ||
336348
!Prec ||
337349
!commands ||
338-
!searchModule ||
339350
!StateEffect
340351
) {
341352
return;

packages/code-editor/src/SearchPanel/SearchPanel.styles.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export const findSectionStyles = css`
8888
display: flex;
8989
align-items: center;
9090
padding: ${spacing[200]}px;
91-
height: 100%;
9291
`;
9392

9493
export const replaceSectionStyles = css`
@@ -162,7 +161,3 @@ export const replaceInputContainerStyles = css`
162161
export const replaceButtonStyles = css`
163162
margin-left: ${spacing[100]}px;
164163
`;
165-
166-
export const findInputStyles = css`
167-
width: 100%;
168-
`;

packages/code-editor/src/SearchPanel/SearchPanel.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import { Body, useUpdatedBaseFontSize } from '@leafygreen-ui/typography';
3232
import {
3333
closeButtonStyles,
3434
findInputContainerStyles,
35-
findInputStyles,
3635
findOptionsContainerStyles,
3736
findSectionStyles,
3837
getContainerStyles,
@@ -294,7 +293,6 @@ export function SearchPanel({
294293
aria-labelledby="find"
295294
onChange={handleSearchQueryChange}
296295
onKeyDown={handleFindInputKeyDown}
297-
className={findInputStyles}
298296
value={searchString}
299297
// CodeMirror looks for this attribute to refocus when CMD+F is pressed and the panel is already open
300298
main-field="true"

packages/typography/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @leafygreen-ui/typography
22

3+
## 22.2.1
4+
5+
### Patch Changes
6+
7+
- d8c4e35: [LG-5691](https://jira.mongodb.org/browse/LG-5691): in `Link` component, vertically align text and icons
8+
39
## 22.2.0
410

511
### Minor Changes

packages/typography/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@leafygreen-ui/typography",
3-
"version": "22.2.0",
3+
"version": "22.2.1",
44
"description": "leafyGreen UI Kit Typography",
55
"main": "./dist/umd/index.js",
66
"module": "./dist/esm/index.js",

packages/typography/src/Link/Link/Link.styles.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import { css } from '@leafygreen-ui/emotion';
22

33
import { anchorClassName } from '../shared.styles';
44

5+
const ICON_TOP_OFFSET = 1;
6+
const NEW_TAB_ICON_LEFT_OFFSET = 2;
7+
58
export const arrowRightIconPersist = css`
69
transform: translate3d(3px, 0, 0);
7-
top: 1px;
10+
top: ${ICON_TOP_OFFSET}px;
811
position: relative;
912
`;
1013

@@ -13,7 +16,7 @@ export const arrowRightIconHover = css`
1316
transform: translate3d(-3px, 0, 0);
1417
transition: 100ms ease-in;
1518
transition-property: opacity, transform;
16-
top: 1px;
19+
top: ${ICON_TOP_OFFSET}px;
1720
position: relative;
1821
1922
.${anchorClassName}:hover &, .${anchorClassName}[data-hover='true'] & {
@@ -24,7 +27,6 @@ export const arrowRightIconHover = css`
2427

2528
export const openInNewTabStyles = css`
2629
position: relative;
27-
bottom: 2px;
28-
left: -1px;
29-
height: 12px;
30+
top: ${ICON_TOP_OFFSET}px;
31+
left: ${NEW_TAB_ICON_LEFT_OFFSET}px;
3032
`;

0 commit comments

Comments
 (0)