Skip to content

Commit 67a6999

Browse files
committed
remove comboxbox and install LG one
1 parent dfb2847 commit 67a6999

23 files changed

+437
-4009
lines changed

package-lock.json

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

packages/compass-components/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@
4040
"@leafygreen-ui/card": "^11.0.0",
4141
"@leafygreen-ui/checkbox": "^13.1.2",
4242
"@leafygreen-ui/code": "^14.4.0",
43+
"@leafygreen-ui/combobox": "^10.0.0",
4344
"@leafygreen-ui/confirmation-modal": "^5.2.1",
4445
"@leafygreen-ui/emotion": "^4.0.8",
4546
"@leafygreen-ui/guide-cue": "^5.1.0",
4647
"@leafygreen-ui/hooks": "^8.3.0",
4748
"@leafygreen-ui/icon": "^12.8.0",
4849
"@leafygreen-ui/icon-button": "^15.0.23",
4950
"@leafygreen-ui/info-sprinkle": "^2.1.0",
50-
"@leafygreen-ui/inline-definition": "^6.0.15",
5151
"@leafygreen-ui/leafygreen-provider": "^3.2.0",
52-
"@leafygreen-ui/lib": "^13.8.2",
5352
"@leafygreen-ui/logo": "^9.2.0",
5453
"@leafygreen-ui/marketing-modal": "^4.2.3",
5554
"@leafygreen-ui/menu": "^26.0.0",
@@ -84,7 +83,6 @@
8483
"is-electron-renderer": "^2.0.1",
8584
"lodash": "^4.17.21",
8685
"polished": "^4.2.2",
87-
"prop-types": "^15.7.2",
8886
"react": "^17.0.2",
8987
"react-hotkeys-hook": "^4.3.7",
9088
"react-intersection-observer": "^8.34.0",

packages/compass-components/src/components/combobox-with-custom-option.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import React, { useState, useMemo } from 'react';
2-
import { Combobox } from './combobox';
3-
import type {
4-
ComboboxProps,
5-
onChangeType,
6-
SelectValueType,
7-
} from './combobox/Combobox.types';
2+
import { Combobox } from './leafygreen';
3+
import type { ComboboxProps } from '@leafygreen-ui/combobox';
4+
5+
// TODO: Make this required
6+
type SelectValueType<T extends boolean> = NonNullable<
7+
ComboboxProps<T>['value']
8+
>;
9+
type OnChangeType<T extends boolean> = NonNullable<
10+
ComboboxProps<T>['onChange']
11+
>;
812

913
type ComboboxWithCustomOptionProps<T extends boolean, K> = ComboboxProps<T> & {
14+
onChange: OnChangeType<T>;
1015
options: K[];
1116
renderOption: (option: K, index: number, isCustom: boolean) => JSX.Element;
1217
};
@@ -36,7 +41,7 @@ export const ComboboxWithCustomOption = <
3641
);
3742
}
3843
return _opts;
39-
}, [userOptions, customOptions, search]);
44+
}, [userOptions, customOptions, search, renderOption]);
4045

4146
const selectValueAndRunOnChange = (value: string[] | string | null) => {
4247
if (!onChange || !value) return;
@@ -47,13 +52,13 @@ export const ComboboxWithCustomOption = <
4752
.filter((value) => !userOptions.find((x) => x.value === value))
4853
.map((x) => ({ value: x })) as K[];
4954
setCustomOptions(customOptions);
50-
(onChange as onChangeType<true>)(multiSelectValues);
55+
(onChange as OnChangeType<true>)(multiSelectValues);
5156
} else {
5257
const selectValue = value as SelectValueType<false>;
5358
if (selectValue && !userOptions.find((x) => x.value === selectValue)) {
5459
setCustomOptions([{ value: selectValue } as K]);
5560
}
56-
(onChange as onChangeType<false>)(selectValue);
61+
(onChange as OnChangeType<false>)(selectValue);
5762
}
5863
};
5964

packages/compass-components/src/components/combobox-with-custom-options.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '@mongodb-js/testing-library-compass';
1010

1111
import { ComboboxWithCustomOption } from './combobox-with-custom-option';
12-
import { ComboboxOption } from './combobox/ComboboxOption';
12+
import { ComboboxOption } from './leafygreen';
1313

1414
const renderCombobox = (
1515
props: Partial<ComponentProps<typeof ComboboxWithCustomOption>> = {}
@@ -21,6 +21,7 @@ const renderCombobox = (
2121
renderOption={(o, i) => {
2222
return <ComboboxOption key={i} value={o.value} />;
2323
}}
24+
onChange={() => {}}
2425
{...props}
2526
/>
2627
);

packages/compass-components/src/components/combobox/Chip.tsx

Lines changed: 0 additions & 283 deletions
This file was deleted.

0 commit comments

Comments
 (0)