Skip to content

Commit e213e29

Browse files
committed
wip
1 parent 21f35ff commit e213e29

File tree

11 files changed

+15704
-9901
lines changed

11 files changed

+15704
-9901
lines changed

package-lock.json

Lines changed: 15580 additions & 9839 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"scripts"
9191
],
9292
"overrides": {
93-
"@types/react": "^17.0.83",
93+
"@types/react": "^17.0.87",
9494
"@types/react-dom": "^17.0.25",
9595
"react": "^17.0.2",
9696
"react-dom": "^17.0.2",

packages/compass-components/package.json

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -34,47 +34,48 @@
3434
"@dnd-kit/core": "^6.0.7",
3535
"@dnd-kit/sortable": "^7.0.2",
3636
"@dnd-kit/utilities": "^3.2.1",
37-
"@leafygreen-ui/badge": "^9.0.2",
38-
"@leafygreen-ui/banner": "^9.0.2",
39-
"@leafygreen-ui/button": "^22.0.2",
40-
"@leafygreen-ui/card": "^12.0.2",
41-
"@leafygreen-ui/checkbox": "^14.0.2",
42-
"@leafygreen-ui/chip": "^3.0.12",
37+
"@leafygreen-ui/badge": "^10.0.2",
38+
"@leafygreen-ui/banner": "^10.0.2",
39+
"@leafygreen-ui/button": "^24.0.2",
40+
"@leafygreen-ui/card": "^13.0.2",
41+
"@leafygreen-ui/checkbox": "^18.0.0",
42+
"@leafygreen-ui/chip": "^4.0.2",
4343
"@leafygreen-ui/code": "^16.0.2",
44-
"@leafygreen-ui/combobox": "^11.0.2",
45-
"@leafygreen-ui/confirmation-modal": "^6.0.2",
46-
"@leafygreen-ui/emotion": "^4.0.9",
47-
"@leafygreen-ui/guide-cue": "^7.0.2",
48-
"@leafygreen-ui/hooks": "^8.3.4",
49-
"@leafygreen-ui/icon": "^13.1.2",
50-
"@leafygreen-ui/icon-button": "16.0.2",
51-
"@leafygreen-ui/info-sprinkle": "^4.0.2",
52-
"@leafygreen-ui/leafygreen-provider": "^4.0.2",
53-
"@leafygreen-ui/logo": "^10.0.2",
54-
"@leafygreen-ui/marketing-modal": "^5.0.2",
55-
"@leafygreen-ui/menu": "^29.0.5",
56-
"@leafygreen-ui/modal": "^17.0.2",
57-
"@leafygreen-ui/palette": "^4.1.3",
58-
"@leafygreen-ui/pipeline": "^7.0.2",
59-
"@leafygreen-ui/polymorphic": "^2.0.5",
60-
"@leafygreen-ui/popover": "^13.0.11",
61-
"@leafygreen-ui/portal": "^6.0.2",
62-
"@leafygreen-ui/radio-box-group": "^14.0.2",
63-
"@leafygreen-ui/radio-group": "^12.0.2",
64-
"@leafygreen-ui/search-input": "^5.0.2",
65-
"@leafygreen-ui/segmented-control": "^10.0.2",
66-
"@leafygreen-ui/select": "^14.0.2",
67-
"@leafygreen-ui/skeleton-loader": "^2.0.11",
68-
"@leafygreen-ui/split-button": "^4.1.5",
69-
"@leafygreen-ui/table": "^13.0.1",
70-
"@leafygreen-ui/tabs": "^14.0.2",
71-
"@leafygreen-ui/text-area": "^10.0.2",
72-
"@leafygreen-ui/text-input": "^14.0.2",
73-
"@leafygreen-ui/toast": "^7.0.2",
74-
"@leafygreen-ui/toggle": "^11.0.2",
75-
"@leafygreen-ui/tokens": "^2.11.3",
76-
"@leafygreen-ui/tooltip": "^13.0.13",
77-
"@leafygreen-ui/typography": "^20.0.2",
44+
"@leafygreen-ui/combobox": "^12.0.2",
45+
"@leafygreen-ui/confirmation-modal": "^9.0.0",
46+
"@leafygreen-ui/drawer": "^4.0.1",
47+
"@leafygreen-ui/emotion": "^5.0.0",
48+
"@leafygreen-ui/guide-cue": "^8.0.2",
49+
"@leafygreen-ui/hooks": "^9.1.0",
50+
"@leafygreen-ui/icon": "^14.1.0",
51+
"@leafygreen-ui/icon-button": "^17.0.2",
52+
"@leafygreen-ui/info-sprinkle": "^5.0.2",
53+
"@leafygreen-ui/leafygreen-provider": "^5.0.1",
54+
"@leafygreen-ui/logo": "^11.0.1",
55+
"@leafygreen-ui/marketing-modal": "^6.0.2",
56+
"@leafygreen-ui/menu": "^31.0.0",
57+
"@leafygreen-ui/modal": "^19.0.0",
58+
"@leafygreen-ui/palette": "^5.0.0",
59+
"@leafygreen-ui/pipeline": "^8.0.2",
60+
"@leafygreen-ui/polymorphic": "^3.0.2",
61+
"@leafygreen-ui/popover": "^14.0.2",
62+
"@leafygreen-ui/portal": "^7.0.1",
63+
"@leafygreen-ui/radio-box-group": "^15.0.2",
64+
"@leafygreen-ui/radio-group": "^13.0.2",
65+
"@leafygreen-ui/search-input": "^6.0.2",
66+
"@leafygreen-ui/segmented-control": "^11.0.2",
67+
"@leafygreen-ui/select": "^16.0.0",
68+
"@leafygreen-ui/skeleton-loader": "^3.0.2",
69+
"@leafygreen-ui/split-button": "^6.0.0",
70+
"@leafygreen-ui/table": "^15.0.0",
71+
"@leafygreen-ui/tabs": "^16.0.0",
72+
"@leafygreen-ui/text-area": "^12.0.0",
73+
"@leafygreen-ui/text-input": "^16.0.0",
74+
"@leafygreen-ui/toast": "^8.0.2",
75+
"@leafygreen-ui/toggle": "^12.0.2",
76+
"@leafygreen-ui/tokens": "^3.1.1",
77+
"@leafygreen-ui/tooltip": "^14.1.0",
78+
"@leafygreen-ui/typography": "^21.0.0",
7879
"@mongodb-js/compass-context-menu": "^0.1.1",
7980
"@react-aria/interactions": "^3.9.1",
8081
"@react-aria/utils": "^3.13.1",

packages/compass-components/src/components/actions/dropdown-menu-button.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ export function DropdownMenuButton<Action extends string>({
9191
<Button
9292
ref={menuTriggerRef}
9393
data-testid={dataTestId ? `${dataTestId}-show-actions` : undefined}
94-
onClick={(evt) => {
95-
evt.stopPropagation();
96-
onClick?.(evt);
94+
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
95+
e.stopPropagation();
96+
onClick?.(e);
9797
}}
9898
rightGlyph={<Icon glyph={'CaretDown'} />}
9999
title={buttonText}

packages/compass-components/src/components/actions/small-icon-button.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ export const SmallIconButton = forwardRef<
4848
) {
4949
return (
5050
<IconButton
51-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
52-
// @ts-expect-error leafygreen confuses TS a lot here
51+
// eslint-disable-next-line @typescript-eslint/ban-ts-comments
5352
ref={ref}
5453
className={cx(buttonSizeStyle[size], className)}
5554
aria-label={label}

packages/compass-components/src/components/document-list/document-actions-group.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ function ActionButton({
8383
tooltipText,
8484
tooltipEnabled,
8585
...props
86-
}: Partial<React.ComponentProps<typeof Button>> & {
86+
}: // @ts-expect-error - LG Polymorphic wrapper confuses TS 5
87+
Partial<React.ComponentProps<typeof Button>> & {
8788
tooltipText: string;
8889
tooltipEnabled: boolean;
8990
}) {

packages/compass-components/src/components/interactive-popover.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ function InteractivePopover<TriggerElement extends HTMLElement>({
202202
<IconButton
203203
className={cx(closeButtonStyles, closeButtonClassName)}
204204
data-testid="interactive-popover-close-button"
205-
onClick={(evt) => {
206-
evt.stopPropagation();
205+
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
206+
e.stopPropagation();
207207
onClose();
208208
}}
209209
aria-label="Close"

packages/compass-components/src/components/leafygreen.tsx

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,48 @@ export { usePrevious, useMergeRefs } from '@leafygreen-ui/hooks';
7474
import Toggle from '@leafygreen-ui/toggle';
7575
import Tooltip from '@leafygreen-ui/tooltip';
7676
import {
77-
H1,
78-
H2,
79-
H3,
80-
Subtitle,
81-
Body,
77+
H1 as LGH1,
78+
H2 as LGH2,
79+
H3 as LGH3,
80+
Subtitle as LGSubtitle,
81+
Body as LGBody,
8282
InlineCode,
8383
InlineKeyCode,
8484
Disclaimer,
85-
Overline,
86-
Label,
87-
Description,
85+
Overline as LGOverline,
86+
Label as LGLabel,
87+
Description as LGDescription,
8888
} from '@leafygreen-ui/typography';
89+
90+
function createPolymorphicWrapper<T extends React.ElementType = any>(
91+
Component: React.ComponentType<any>,
92+
displayName?: string
93+
) {
94+
const WrappedComponent = React.forwardRef((props: any, ref: any) => {
95+
return React.createElement(Component, { ...props, ref }) as JSX.Element;
96+
});
97+
98+
WrappedComponent.displayName = displayName;
99+
100+
return WrappedComponent as typeof Component;
101+
}
102+
// @ts-expect-error sorry, LG needs to fix it's types
103+
const H1 = createPolymorphicWrapper(LGH1, 'H1');
104+
// @ts-expect-error sorry, LG needs to fix it's types
105+
const H2 = createPolymorphicWrapper(LGH2, 'H2');
106+
// @ts-expect-error sorry, LG needs to fix it's types
107+
const H3 = createPolymorphicWrapper(LGH3, 'H3');
108+
// @ts-expect-error sorry, LG needs to fix it's types
109+
const Subtitle = createPolymorphicWrapper(LGSubtitle, 'Subtitle');
110+
// @ts-expect-error sorry, LG needs to fix it's types
111+
const Body = createPolymorphicWrapper(LGBody, 'Body');
112+
// @ts-expect-error sorry, LG needs to fix it's types
113+
const Overline = createPolymorphicWrapper(LGOverline, 'Overline');
114+
// @ts-expect-error sorry, LG needs to fix it's types
115+
const Label = createPolymorphicWrapper(LGLabel, 'Label');
116+
// @ts-expect-error sorry, LG needs to fix it's types
117+
const Description = createPolymorphicWrapper(LGDescription, 'Description');
118+
89119
import {
90120
Combobox,
91121
ComboboxOption,

packages/compass-components/src/components/signal-popover.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ const SignalCard: React.FunctionComponent<
233233
<Icon glyph={primaryActionButtonIcon}></Icon>
234234
) : undefined
235235
}
236-
onClick={(evt) => {
236+
onClick={(e: React.MouseEvent) => {
237237
hooks.onSignalPrimaryActionClick(id);
238-
onPrimaryActionButtonClick?.(evt);
238+
onPrimaryActionButtonClick?.(e);
239239
}}
240240
>
241241
{primaryActionButtonLabel}
@@ -295,7 +295,7 @@ const MultiSignalHeader: React.FunctionComponent<{
295295
data-testid="insight-signal-show-prev-button"
296296
aria-label="Show previous insight"
297297
title="Show previous insight"
298-
onClick={(e) => {
298+
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
299299
e.stopPropagation();
300300
onIndexChange(currentIndex - 1);
301301
}}
@@ -310,7 +310,7 @@ const MultiSignalHeader: React.FunctionComponent<{
310310
data-testid="insight-signal-show-next-button"
311311
aria-label="Show next insight"
312312
title="Show next insight"
313-
onClick={(e) => {
313+
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
314314
e.stopPropagation();
315315
onIndexChange(currentIndex + 1);
316316
}}

packages/compass-components/src/components/workspace-tabs/tab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function Tab({
335335

336336
<IconButton
337337
className={cx(closeButtonStyles, 'workspace-tab-close-button')}
338-
onClick={(e) => {
338+
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
339339
e.stopPropagation();
340340
onClose();
341341
}}

0 commit comments

Comments
 (0)