@leafygreen-ui/combobox 5.0.2 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/Chip.d.ts.map +1 -1
- package/dist/Combobox.d.ts.map +1 -1
- package/dist/Combobox.styles.d.ts.map +1 -1
- package/dist/Combobox.types.d.ts.map +1 -1
- package/dist/ComboboxContext.d.ts.map +1 -1
- package/dist/ComboboxGroup.d.ts.map +1 -1
- package/dist/ComboboxMenu/ComboboxMenu.d.ts.map +1 -1
- package/dist/ComboboxMenu/Menu.styles.d.ts.map +1 -1
- package/dist/ComboboxOption.d.ts.map +1 -1
- package/dist/ComboboxTestUtils.d.ts.map +1 -1
- package/dist/Menu.styles.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/flattenChildren.d.ts.map +1 -1
- package/dist/utils/getNameAndValue.d.ts.map +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +11 -10
- package/src/Chip.tsx +6 -4
- package/src/Combobox.spec.tsx +11 -9
- package/src/Combobox.story.tsx +5 -3
- package/src/Combobox.styles.ts +1 -0
- package/src/Combobox.tsx +45 -43
- package/src/Combobox.types.ts +1 -0
- package/src/ComboboxContext.tsx +3 -1
- package/src/ComboboxGroup.tsx +5 -3
- package/src/ComboboxMenu/ComboboxMenu.tsx +11 -8
- package/src/ComboboxMenu/Menu.styles.ts +3 -1
- package/src/ComboboxOption.tsx +8 -6
- package/src/ComboboxTestUtils.tsx +10 -8
- package/src/Menu.styles.ts +1 -0
- package/src/index.ts +1 -1
- package/src/utils/ComboboxUtils.spec.tsx +6 -3
- package/src/utils/flattenChildren.tsx +3 -0
- package/src/utils/getNameAndValue.ts +1 -0
- package/src/utils/index.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flattenChildren.d.ts","sourceRoot":"","sources":["../../src/utils/flattenChildren.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"flattenChildren.d.ts","sourceRoot":"","sources":["../../src/utils/flattenChildren.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,cACf,MAAM,SAAS,KACzB,MAAM,YAAY,CAgCpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNameAndValue.d.ts","sourceRoot":"","sources":["../../src/utils/getNameAndValue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getNameAndValue.d.ts","sourceRoot":"","sources":["../../src/utils/getNameAndValue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,+CAGzB,mBAAmB,KAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CAMrB,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { wrapJSX } from './wrapJSX';
|
|
2
|
-
export { getNameAndValue } from './getNameAndValue';
|
|
3
|
-
export { getOptionObjectFromValue, getDisplayNameForValue, getValueForDisplayName, } from './OptionObjectUtils';
|
|
4
1
|
export { flattenChildren } from './flattenChildren';
|
|
2
|
+
export { getNameAndValue } from './getNameAndValue';
|
|
3
|
+
export { getDisplayNameForValue, getOptionObjectFromValue, getValueForDisplayName, } from './OptionObjectUtils';
|
|
4
|
+
export { wrapJSX } from './wrapJSX';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafygreen-ui/combobox",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "leafyGreen UI Kit Combobox",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -20,17 +20,18 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@leafygreen-ui/checkbox": "^12.0.
|
|
23
|
+
"@leafygreen-ui/checkbox": "^12.0.3",
|
|
24
24
|
"@leafygreen-ui/emotion": "^4.0.3",
|
|
25
25
|
"@leafygreen-ui/hooks": "^7.3.3",
|
|
26
|
-
"@leafygreen-ui/icon": "^11.12.
|
|
27
|
-
"@leafygreen-ui/icon-button": "^15.0.
|
|
28
|
-
"@leafygreen-ui/inline-definition": "^6.0.
|
|
26
|
+
"@leafygreen-ui/icon": "^11.12.2",
|
|
27
|
+
"@leafygreen-ui/icon-button": "^15.0.2",
|
|
28
|
+
"@leafygreen-ui/inline-definition": "^6.0.1",
|
|
29
29
|
"@leafygreen-ui/lib": "^10.0.0",
|
|
30
|
-
"@leafygreen-ui/palette": "^3.4.
|
|
31
|
-
"@leafygreen-ui/popover": "^11.0.
|
|
32
|
-
"@leafygreen-ui/tokens": "^1.4.
|
|
33
|
-
"@leafygreen-ui/typography": "^15.1.
|
|
30
|
+
"@leafygreen-ui/palette": "^3.4.5",
|
|
31
|
+
"@leafygreen-ui/popover": "^11.0.2",
|
|
32
|
+
"@leafygreen-ui/tokens": "^1.4.1",
|
|
33
|
+
"@leafygreen-ui/typography": "^15.1.1",
|
|
34
|
+
"chalk": "^5.1.2",
|
|
34
35
|
"lodash": "^4.17.21",
|
|
35
36
|
"polished": "^4.2.2"
|
|
36
37
|
},
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
"@leafygreen-ui/leafygreen-provider": "^3.1.0"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"
|
|
42
|
+
"@leafygreen-ui/button": "^19.0.2"
|
|
42
43
|
},
|
|
43
44
|
"homepage": "https://github.com/mongodb/leafygreen-ui/tree/main/packages/combobox",
|
|
44
45
|
"repository": {
|
package/src/Chip.tsx
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useMemo, useRef } from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { css, cx } from '@leafygreen-ui/emotion';
|
|
4
|
-
import
|
|
4
|
+
import Icon from '@leafygreen-ui/icon';
|
|
5
5
|
import InlineDefinition from '@leafygreen-ui/inline-definition';
|
|
6
6
|
import { keyMap, Theme } from '@leafygreen-ui/lib';
|
|
7
|
+
import { palette } from '@leafygreen-ui/palette';
|
|
7
8
|
import { transitionDuration, typeScales } from '@leafygreen-ui/tokens';
|
|
8
|
-
|
|
9
|
-
import { ComboboxContext } from './ComboboxContext';
|
|
9
|
+
|
|
10
10
|
import {
|
|
11
11
|
chipClassName,
|
|
12
12
|
chipWrapperPaddingY,
|
|
13
13
|
inputHeight,
|
|
14
14
|
} from './Combobox.styles';
|
|
15
|
+
import { ChipProps, ComboboxSize as Size } from './Combobox.types';
|
|
16
|
+
import { ComboboxContext } from './ComboboxContext';
|
|
15
17
|
|
|
16
18
|
const chipWrapperBaseStyle = css`
|
|
17
19
|
display: inline-flex;
|
package/src/Combobox.spec.tsx
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
/* eslint-disable jest/no-standalone-expect */
|
|
2
2
|
/* eslint jest/expect-expect: ["error", { "assertFunctionNames": ["expect", "expectSelection"] }] */
|
|
3
|
-
import flatten from 'lodash/flatten';
|
|
4
|
-
import isUndefined from 'lodash/isUndefined';
|
|
5
|
-
import startCase from 'lodash/startCase';
|
|
6
3
|
import React from 'react';
|
|
7
4
|
import {
|
|
8
|
-
waitForElementToBeRemoved,
|
|
9
5
|
act,
|
|
10
|
-
|
|
6
|
+
fireEvent,
|
|
11
7
|
queryByText,
|
|
12
8
|
render,
|
|
13
|
-
|
|
9
|
+
waitFor,
|
|
10
|
+
waitForElementToBeRemoved,
|
|
14
11
|
} from '@testing-library/react';
|
|
15
12
|
import userEvent from '@testing-library/user-event';
|
|
16
13
|
import { axe } from 'jest-axe';
|
|
14
|
+
import flatten from 'lodash/flatten';
|
|
15
|
+
import isUndefined from 'lodash/isUndefined';
|
|
16
|
+
import startCase from 'lodash/startCase';
|
|
17
|
+
|
|
18
|
+
import Button from '@leafygreen-ui/button';
|
|
19
|
+
import { keyMap } from '@leafygreen-ui/lib';
|
|
20
|
+
|
|
21
|
+
import { OptionObject } from './Combobox.types';
|
|
17
22
|
import {
|
|
18
23
|
defaultOptions,
|
|
19
24
|
getComboboxJSX,
|
|
@@ -23,9 +28,6 @@ import {
|
|
|
23
28
|
Select,
|
|
24
29
|
testif,
|
|
25
30
|
} from './ComboboxTestUtils';
|
|
26
|
-
import { OptionObject } from './Combobox.types';
|
|
27
|
-
import Button from '@leafygreen-ui/button';
|
|
28
|
-
import { keyMap } from '@leafygreen-ui/lib';
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* Tests
|
package/src/Combobox.story.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
+
|
|
3
4
|
import Button from '@leafygreen-ui/button';
|
|
4
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
5
5
|
import { css } from '@leafygreen-ui/emotion';
|
|
6
|
-
import
|
|
6
|
+
import Icon from '@leafygreen-ui/icon';
|
|
7
|
+
|
|
7
8
|
import {
|
|
8
9
|
ComboboxSize,
|
|
9
10
|
Overflow,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
State,
|
|
12
13
|
TruncationLocation,
|
|
13
14
|
} from './Combobox.types';
|
|
15
|
+
import { Combobox, ComboboxGroup, ComboboxOption } from '.';
|
|
14
16
|
|
|
15
17
|
const wrapperStyle = css`
|
|
16
18
|
width: 256px;
|
package/src/Combobox.styles.ts
CHANGED
package/src/Combobox.tsx
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import clone from 'lodash/clone';
|
|
2
|
-
import isArray from 'lodash/isArray';
|
|
3
|
-
import isEqual from 'lodash/isEqual';
|
|
4
|
-
import isNull from 'lodash/isNull';
|
|
5
|
-
import isString from 'lodash/isString';
|
|
6
|
-
import isUndefined from 'lodash/isUndefined';
|
|
7
1
|
import React, {
|
|
8
2
|
useCallback,
|
|
9
3
|
useEffect,
|
|
@@ -11,8 +5,15 @@ import React, {
|
|
|
11
5
|
useRef,
|
|
12
6
|
useState,
|
|
13
7
|
} from 'react';
|
|
8
|
+
import clone from 'lodash/clone';
|
|
9
|
+
import isArray from 'lodash/isArray';
|
|
10
|
+
import isEqual from 'lodash/isEqual';
|
|
11
|
+
import isNull from 'lodash/isNull';
|
|
12
|
+
import isString from 'lodash/isString';
|
|
13
|
+
import isUndefined from 'lodash/isUndefined';
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
import { cx } from '@leafygreen-ui/emotion';
|
|
16
17
|
import {
|
|
17
18
|
useDynamicRefs,
|
|
18
19
|
useEventListener,
|
|
@@ -21,56 +22,57 @@ import {
|
|
|
21
22
|
} from '@leafygreen-ui/hooks';
|
|
22
23
|
import Icon from '@leafygreen-ui/icon';
|
|
23
24
|
import IconButton from '@leafygreen-ui/icon-button';
|
|
24
|
-
import { cx } from '@leafygreen-ui/emotion';
|
|
25
|
-
import { palette } from '@leafygreen-ui/palette';
|
|
26
|
-
import { consoleOnce, isComponentType, keyMap } from '@leafygreen-ui/lib';
|
|
27
25
|
import { useDarkMode } from '@leafygreen-ui/leafygreen-provider';
|
|
26
|
+
import { consoleOnce, isComponentType, keyMap } from '@leafygreen-ui/lib';
|
|
27
|
+
import { palette } from '@leafygreen-ui/palette';
|
|
28
|
+
import { Description, Label } from '@leafygreen-ui/typography';
|
|
29
|
+
|
|
30
|
+
import { ComboboxMenu } from './ComboboxMenu/ComboboxMenu';
|
|
31
|
+
import { Chip } from './Chip';
|
|
32
|
+
import {
|
|
33
|
+
baseComboboxStyles,
|
|
34
|
+
baseInputElementStyle,
|
|
35
|
+
clearButtonStyle,
|
|
36
|
+
comboboxDisabledStyles,
|
|
37
|
+
comboboxErrorStyles,
|
|
38
|
+
comboboxFocusStyle,
|
|
39
|
+
comboboxParentStyle,
|
|
40
|
+
comboboxSelectionStyles,
|
|
41
|
+
comboboxSizeStyles,
|
|
42
|
+
comboboxThemeStyles,
|
|
43
|
+
endIconStyle,
|
|
44
|
+
errorMessageSizeStyle,
|
|
45
|
+
errorMessageThemeStyle,
|
|
46
|
+
inputElementSizeStyle,
|
|
47
|
+
inputElementThemeStyle,
|
|
48
|
+
inputElementTransitionStyles,
|
|
49
|
+
inputWrapperStyle,
|
|
50
|
+
labelDescriptionContainerStyle,
|
|
51
|
+
multiselectInputElementStyle,
|
|
52
|
+
} from './Combobox.styles';
|
|
28
53
|
import {
|
|
54
|
+
ComboboxElement,
|
|
29
55
|
ComboboxProps,
|
|
56
|
+
ComboboxSize,
|
|
30
57
|
getNullSelection,
|
|
31
58
|
onChangeType,
|
|
32
|
-
SelectValueType,
|
|
33
59
|
OptionObject,
|
|
34
|
-
ComboboxElement,
|
|
35
|
-
ComboboxSize,
|
|
36
|
-
State,
|
|
37
60
|
Overflow,
|
|
38
|
-
TruncationLocation,
|
|
39
61
|
SearchState,
|
|
62
|
+
SelectValueType,
|
|
63
|
+
State,
|
|
64
|
+
TruncationLocation,
|
|
40
65
|
} from './Combobox.types';
|
|
66
|
+
import { ComboboxContext } from './ComboboxContext';
|
|
67
|
+
import { InternalComboboxGroup } from './ComboboxGroup';
|
|
68
|
+
import { InternalComboboxOption } from './ComboboxOption';
|
|
41
69
|
import {
|
|
42
70
|
flattenChildren,
|
|
43
|
-
getOptionObjectFromValue,
|
|
44
71
|
getDisplayNameForValue,
|
|
45
|
-
getValueForDisplayName,
|
|
46
72
|
getNameAndValue,
|
|
73
|
+
getOptionObjectFromValue,
|
|
74
|
+
getValueForDisplayName,
|
|
47
75
|
} from './utils';
|
|
48
|
-
import { ComboboxContext } from './ComboboxContext';
|
|
49
|
-
import { InternalComboboxGroup } from './ComboboxGroup';
|
|
50
|
-
import { InternalComboboxOption } from './ComboboxOption';
|
|
51
|
-
import { Chip } from './Chip';
|
|
52
|
-
import {
|
|
53
|
-
comboboxFocusStyle,
|
|
54
|
-
inputWrapperStyle,
|
|
55
|
-
baseComboboxStyles,
|
|
56
|
-
comboboxThemeStyles,
|
|
57
|
-
comboboxSizeStyles,
|
|
58
|
-
comboboxDisabledStyles,
|
|
59
|
-
comboboxErrorStyles,
|
|
60
|
-
comboboxParentStyle,
|
|
61
|
-
baseInputElementStyle,
|
|
62
|
-
inputElementSizeStyle,
|
|
63
|
-
inputElementTransitionStyles,
|
|
64
|
-
multiselectInputElementStyle,
|
|
65
|
-
clearButtonStyle,
|
|
66
|
-
endIconStyle,
|
|
67
|
-
errorMessageThemeStyle,
|
|
68
|
-
errorMessageSizeStyle,
|
|
69
|
-
labelDescriptionContainerStyle,
|
|
70
|
-
inputElementThemeStyle,
|
|
71
|
-
comboboxSelectionStyles,
|
|
72
|
-
} from './Combobox.styles';
|
|
73
|
-
import { ComboboxMenu } from './ComboboxMenu/ComboboxMenu';
|
|
74
76
|
|
|
75
77
|
/**
|
|
76
78
|
* Combobox is a combination of a Select and TextInput,
|
package/src/Combobox.types.ts
CHANGED
package/src/ComboboxContext.tsx
CHANGED
package/src/ComboboxGroup.tsx
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
1
4
|
import { css, cx } from '@leafygreen-ui/emotion';
|
|
2
5
|
import { useIdAllocator } from '@leafygreen-ui/hooks';
|
|
6
|
+
import { Theme } from '@leafygreen-ui/lib';
|
|
3
7
|
import { palette } from '@leafygreen-ui/palette';
|
|
4
|
-
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
6
9
|
import { ComboboxGroupProps } from './Combobox.types';
|
|
7
10
|
import { ComboboxContext } from './ComboboxContext';
|
|
8
|
-
import { Theme } from '@leafygreen-ui/lib';
|
|
9
11
|
|
|
10
12
|
const comboboxGroupStyle: Record<Theme, string> = {
|
|
11
13
|
[Theme.Light]: css`
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import React, { useContext, useMemo } from 'react';
|
|
2
|
+
import isUndefined from 'lodash/isUndefined';
|
|
3
|
+
|
|
4
|
+
import { css, cx } from '@leafygreen-ui/emotion';
|
|
5
|
+
import { useAvailableSpace, useForwardedRef } from '@leafygreen-ui/hooks';
|
|
6
|
+
import Icon from '@leafygreen-ui/icon';
|
|
7
|
+
import { palette } from '@leafygreen-ui/palette';
|
|
2
8
|
import Popover from '@leafygreen-ui/popover';
|
|
9
|
+
|
|
10
|
+
import { ComboboxProps } from '../Combobox.types';
|
|
3
11
|
import { ComboboxContext } from '../ComboboxContext';
|
|
4
|
-
|
|
12
|
+
|
|
5
13
|
import {
|
|
14
|
+
loadingIconStyle,
|
|
6
15
|
menuBaseStyle,
|
|
7
16
|
menuList,
|
|
8
17
|
menuMessageBaseStyle,
|
|
9
|
-
menuMessageThemeStyle,
|
|
10
18
|
menuMessageSizeStyle,
|
|
19
|
+
menuMessageThemeStyle,
|
|
11
20
|
menuThemeStyle,
|
|
12
21
|
popoverStyle,
|
|
13
|
-
loadingIconStyle,
|
|
14
22
|
popoverThemeStyle,
|
|
15
23
|
} from './Menu.styles';
|
|
16
|
-
import { css, cx } from '@leafygreen-ui/emotion';
|
|
17
|
-
import Icon from '@leafygreen-ui/icon';
|
|
18
|
-
import { ComboboxProps } from '../Combobox.types';
|
|
19
|
-
import { palette } from '@leafygreen-ui/palette';
|
|
20
|
-
import isUndefined from 'lodash/isUndefined';
|
|
21
24
|
|
|
22
25
|
type ComboboxMenuProps = {
|
|
23
26
|
children?: React.ReactNode;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { transparentize } from 'polished';
|
|
2
|
+
|
|
1
3
|
import { css, keyframes } from '@leafygreen-ui/emotion';
|
|
2
4
|
import { Theme } from '@leafygreen-ui/lib';
|
|
3
5
|
import { palette } from '@leafygreen-ui/palette';
|
|
4
6
|
import { fontFamilies, spacing, typeScales } from '@leafygreen-ui/tokens';
|
|
5
|
-
|
|
7
|
+
|
|
6
8
|
import { ComboboxSize as Size } from '../Combobox.types';
|
|
7
9
|
|
|
8
10
|
export const menuItemPadding: Record<Size, { x: number; y: number }> = {
|
package/src/ComboboxOption.tsx
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import React, { useCallback, useContext, useMemo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import Checkbox from '@leafygreen-ui/checkbox';
|
|
3
5
|
import { css, cx } from '@leafygreen-ui/emotion';
|
|
4
|
-
import { palette } from '@leafygreen-ui/palette';
|
|
5
|
-
import { Theme } from '@leafygreen-ui/lib';
|
|
6
6
|
import { useForwardedRef, useIdAllocator } from '@leafygreen-ui/hooks';
|
|
7
|
-
import Checkbox from '@leafygreen-ui/checkbox';
|
|
8
7
|
import Icon, { isComponentGlyph } from '@leafygreen-ui/icon';
|
|
8
|
+
import { Theme } from '@leafygreen-ui/lib';
|
|
9
|
+
import { palette } from '@leafygreen-ui/palette';
|
|
10
|
+
import { fontFamilies, spacing, typeScales } from '@leafygreen-ui/tokens';
|
|
11
|
+
|
|
12
|
+
import { menuItemHeight, menuItemPadding } from './ComboboxMenu/Menu.styles';
|
|
9
13
|
import {
|
|
10
14
|
ComboboxOptionProps,
|
|
11
|
-
InternalComboboxOptionProps,
|
|
12
15
|
ComboboxSize as Size,
|
|
16
|
+
InternalComboboxOptionProps,
|
|
13
17
|
} from './Combobox.types';
|
|
14
18
|
import { ComboboxContext } from './ComboboxContext';
|
|
15
19
|
import { wrapJSX } from './utils';
|
|
16
|
-
import { fontFamilies, spacing, typeScales } from '@leafygreen-ui/tokens';
|
|
17
|
-
import { menuItemHeight, menuItemPadding } from './ComboboxMenu/Menu.styles';
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* Styles
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import isArray from 'lodash/isArray';
|
|
2
|
-
import isNull from 'lodash/isNull';
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import {
|
|
5
|
-
render,
|
|
6
3
|
configure,
|
|
7
|
-
queryByText,
|
|
8
|
-
queryByAttribute,
|
|
9
|
-
queryAllByTestId,
|
|
10
4
|
queryAllByAttribute,
|
|
5
|
+
queryAllByTestId,
|
|
6
|
+
queryByAttribute,
|
|
7
|
+
queryByText,
|
|
8
|
+
render,
|
|
11
9
|
} from '@testing-library/react';
|
|
12
|
-
import chalk from 'chalk';
|
|
13
10
|
import userEvent from '@testing-library/user-event';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import isArray from 'lodash/isArray';
|
|
13
|
+
import isNull from 'lodash/isNull';
|
|
14
|
+
|
|
14
15
|
import LeafyGreenProvider from '@leafygreen-ui/leafygreen-provider';
|
|
15
|
-
|
|
16
|
+
|
|
16
17
|
import {
|
|
17
18
|
BaseComboboxProps,
|
|
18
19
|
ComboboxMultiselectProps,
|
|
19
20
|
OptionObject,
|
|
20
21
|
} from './Combobox.types';
|
|
22
|
+
import { Combobox, ComboboxGroup, ComboboxOption } from '.';
|
|
21
23
|
|
|
22
24
|
export interface NestedObject {
|
|
23
25
|
label: string;
|
package/src/Menu.styles.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { css, keyframes } from '@leafygreen-ui/emotion';
|
|
|
2
2
|
import { Theme } from '@leafygreen-ui/lib';
|
|
3
3
|
import { uiColors } from '@leafygreen-ui/palette';
|
|
4
4
|
import { fontFamilies, typeScales } from '@leafygreen-ui/tokens';
|
|
5
|
+
|
|
5
6
|
import { ComboboxSize } from './Combobox.types';
|
|
6
7
|
|
|
7
8
|
/** Height of a menu item (in px) */
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
|
|
3
4
|
import Icon from '@leafygreen-ui/icon';
|
|
4
|
-
|
|
5
|
-
import {
|
|
5
|
+
|
|
6
|
+
import { ComboboxGroup, ComboboxOption } from '..';
|
|
7
|
+
|
|
8
|
+
import { flattenChildren, getNameAndValue, wrapJSX } from '.';
|
|
6
9
|
|
|
7
10
|
describe('packages/combobox/utils', () => {
|
|
8
11
|
describe('wrapJSX', () => {
|
package/src/utils/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { flattenChildren } from './flattenChildren';
|
|
2
2
|
export { getNameAndValue } from './getNameAndValue';
|
|
3
3
|
export {
|
|
4
|
-
getOptionObjectFromValue,
|
|
5
4
|
getDisplayNameForValue,
|
|
5
|
+
getOptionObjectFromValue,
|
|
6
6
|
getValueForDisplayName,
|
|
7
7
|
} from './OptionObjectUtils';
|
|
8
|
-
export {
|
|
8
|
+
export { wrapJSX } from './wrapJSX';
|