@hyphen/hyphen-components 7.3.1 → 7.3.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/dist/css/utilities.css +1 -1
- package/dist/css/variables.css +18 -28
- package/dist/hyphen-components.cjs.development.js +5718 -5018
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +18 -2
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +5619 -4843
- package/dist/hyphen-components.esm.js.map +1 -1
- package/dist/index.d.ts +2693 -57
- package/dist/index.js +0 -1
- package/package.json +18 -19
- package/src/components/Badge/Badge.module.scss +6 -0
- package/src/components/Badge/Badge.stories.tsx +1 -0
- package/src/components/Badge/Badge.test.tsx +3 -2
- package/src/components/Badge/Badge.tsx +5 -3
- package/src/components/Box/Box.tsx +5 -2
- package/src/components/Button/Button.module.scss +1 -1
- package/src/components/Button/Button.test.tsx +2 -2
- package/src/components/Calendar/Calendar.test.tsx +262 -0
- package/src/components/Card/Card.tsx +2 -0
- package/src/components/CheckboxInput/components/Checkbox.module.scss +1 -1
- package/src/components/CheckboxInput/components/Checkbox.tsx +2 -0
- package/src/components/Details/Details.module.scss +2 -2
- package/src/components/Details/Details.tsx +2 -0
- package/src/components/Drawer/Drawer.stories.tsx +1 -1
- package/src/components/Drawer/Drawer.test.tsx +494 -56
- package/src/components/Drawer/Drawer.tsx +7 -1
- package/src/components/DropdownMenu/DropdownMenu.test.tsx +532 -12
- package/src/components/FormControl/FormControl.tsx +2 -0
- package/src/components/Formik/Formik.stories.tsx +30 -7
- package/src/components/Formik/FormikSelectInput/FormikSelectInput.tsx +6 -5
- package/src/components/Formik/FormikToggleGroup/FormikToggleGroup.tsx +1 -1
- package/src/components/HelpText/HelpText.tsx +2 -0
- package/src/components/Icon/Icon.stories.tsx +1 -1
- package/src/components/Icon/Icon.tsx +2 -0
- package/src/components/Modal/Modal.test.tsx +630 -81
- package/src/components/Modal/Modal.tsx +2 -0
- package/src/components/Modal/components/ModalFooter/ModalFooter.test.tsx +2 -2
- package/src/components/Popover/Popover.tsx +2 -0
- package/src/components/RadioGroup/RadioInput/RadioInput.tsx +2 -0
- package/src/components/SelectInput/SelectInput.stories.tsx +22 -22
- package/src/components/SelectInput/SelectInput.tsx +13 -9
- package/src/components/SelectInputInset/SelectInputInset.tsx +2 -0
- package/src/components/Sidebar/Sidebar.module.scss +4 -0
- package/src/components/Sidebar/Sidebar.stories.tsx +8 -4
- package/src/components/Sidebar/Sidebar.test.tsx +7 -4
- package/src/components/Sidebar/Sidebar.tsx +21 -12
- package/src/components/Table/Table.stories.tsx +102 -52
- package/src/components/TextInput/TextInput.tsx +2 -0
- package/src/components/TextInputInset/TextInputInset.tsx +2 -0
- package/src/components/TextareaInputInset/TextareaInputInset.tsx +2 -0
- package/src/components/TimePickerNative/TimePickerNative.stories.tsx +0 -1
- package/src/components/Toast/Toast.store.ts +1 -1
- package/src/components/Toast/Toast.stories.tsx +3 -2
- package/src/components/Toast/Toast.test.tsx +8 -6
- package/src/components/Toggle/Toggle.tsx +2 -0
- package/src/components/ToggleGroup/ToggleGroup.tsx +2 -0
- package/src/docs/Colors.mdx +0 -13
- package/src/lib/getColumnKeys.ts +3 -3
- package/src/lib/mergeRefs.ts +1 -1
- package/src/lib/tokens.ts +4 -4
- package/dist/components/Alert/Alert.constants.d.ts +0 -8
- package/dist/components/Alert/Alert.d.ts +0 -42
- package/dist/components/Alert/Alert.stories.d.ts +0 -12
- package/dist/components/Alert/Alert.types.d.ts +0 -7
- package/dist/components/AspectRatio/AspectRatio.d.ts +0 -3
- package/dist/components/AspectRatio/AspectRatio.stories.d.ts +0 -6
- package/dist/components/Badge/Badge.d.ts +0 -24
- package/dist/components/Badge/Badge.stories.d.ts +0 -8
- package/dist/components/Box/Box.d.ts +0 -247
- package/dist/components/Box/Box.stories.d.ts +0 -46
- package/dist/components/Button/Button.constants.d.ts +0 -3
- package/dist/components/Button/Button.d.ts +0 -53
- package/dist/components/Button/Button.stories.d.ts +0 -16
- package/dist/components/Calendar/Calendar.d.ts +0 -7
- package/dist/components/Calendar/Calendar.stories.d.ts +0 -12
- package/dist/components/Card/Card.d.ts +0 -17
- package/dist/components/Card/Card.stories.d.ts +0 -8
- package/dist/components/Card/components/CardFooter/CardFooter.d.ts +0 -13
- package/dist/components/Card/components/CardHeader/CardHeader.d.ts +0 -13
- package/dist/components/Card/components/CardSection/CardSection.d.ts +0 -46
- package/dist/components/Card/components/index.d.ts +0 -3
- package/dist/components/CheckboxInput/CheckboxInput.d.ts +0 -72
- package/dist/components/CheckboxInput/CheckboxInput.stories.d.ts +0 -18
- package/dist/components/CheckboxInput/components/Checkbox.d.ts +0 -71
- package/dist/components/CheckboxInput/components/CheckboxIcon.d.ts +0 -27
- package/dist/components/Collapsible/Collapsible.d.ts +0 -5
- package/dist/components/Collapsible/Collapsible.stories.d.ts +0 -9
- package/dist/components/Details/Details.d.ts +0 -15
- package/dist/components/Details/Details.stories.d.ts +0 -6
- package/dist/components/Details/DetailsSummary.d.ts +0 -7
- package/dist/components/Drawer/Drawer.d.ts +0 -105
- package/dist/components/Drawer/Drawer.stories.d.ts +0 -62
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -25
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +0 -9
- package/dist/components/FormControl/FormControl.d.ts +0 -38
- package/dist/components/FormLabel/FormLabel.d.ts +0 -41
- package/dist/components/FormLabel/FormLabel.stories.d.ts +0 -6
- package/dist/components/Formik/Formik.stories.d.ts +0 -18
- package/dist/components/Formik/FormikCheckboxInput/FormikCheckboxInput.d.ts +0 -12
- package/dist/components/Formik/FormikRadioGroup/FormikRadioGroup.d.ts +0 -12
- package/dist/components/Formik/FormikSelectInput/FormikSelectInput.d.ts +0 -13
- package/dist/components/Formik/FormikSelectInputInset/FormikSelectInputInset.d.ts +0 -12
- package/dist/components/Formik/FormikSelectInputNative/FormikSelectInputNative.d.ts +0 -12
- package/dist/components/Formik/FormikSwitch/FormikSwitch.d.ts +0 -12
- package/dist/components/Formik/FormikTextInput/FormikTextInput.d.ts +0 -12
- package/dist/components/Formik/FormikTextInputInset/FormikTextInputInset.d.ts +0 -12
- package/dist/components/Formik/FormikTextareaInput/FormikTextareaInput.d.ts +0 -12
- package/dist/components/Formik/FormikTextareaInputInset/FormikTextareaInputInset.d.ts +0 -12
- package/dist/components/Formik/FormikTimePicker/FormikTimePicker.d.ts +0 -12
- package/dist/components/Formik/FormikTimePickerNative/FormikTimePickerNative.d.ts +0 -12
- package/dist/components/Formik/FormikToggleGroup/FormikToggleGroup.d.ts +0 -20
- package/dist/components/Formik/FormikToggleGroupMulti/FormikToggleGroupMulti.d.ts +0 -18
- package/dist/components/Heading/Heading.constants.d.ts +0 -10
- package/dist/components/Heading/Heading.d.ts +0 -35
- package/dist/components/Heading/Heading.stories.d.ts +0 -9
- package/dist/components/HelpText/HelpText.d.ts +0 -12
- package/dist/components/Icon/Icon.d.ts +0 -22
- package/dist/components/Icon/Icon.stories.d.ts +0 -10
- package/dist/components/InputValidationMessage/InputValidationMessage.d.ts +0 -9
- package/dist/components/Modal/Modal.d.ts +0 -83
- package/dist/components/Modal/Modal.stories.d.ts +0 -13
- package/dist/components/Modal/components/ModalBody/ModalBody.d.ts +0 -4
- package/dist/components/Modal/components/ModalFooter/ModalFooter.d.ts +0 -4
- package/dist/components/Modal/components/ModalHeader/ModalHeader.d.ts +0 -21
- package/dist/components/Modal/components/index.d.ts +0 -4
- package/dist/components/Pagination/Pagination.d.ts +0 -51
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -8
- package/dist/components/Pagination/Pagination.utilities.d.ts +0 -10
- package/dist/components/Popover/Popover.d.ts +0 -8
- package/dist/components/Popover/Popover.stories.d.ts +0 -7
- package/dist/components/RadioGroup/RadioGroup.d.ts +0 -75
- package/dist/components/RadioGroup/RadioGroup.stories.d.ts +0 -16
- package/dist/components/RadioGroup/RadioInput/RadioInput.d.ts +0 -57
- package/dist/components/RadioGroup/RadioInput/RadioInputIcon.d.ts +0 -27
- package/dist/components/RangeInput/RangeInput.d.ts +0 -29
- package/dist/components/RangeInput/RangeInput.stories.d.ts +0 -7
- package/dist/components/ResponsiveProvider/ResponsiveProvider.d.ts +0 -17
- package/dist/components/ResponsiveProvider/ResponsiveProvider.stories.d.ts +0 -7
- package/dist/components/SelectInput/SelectInput.d.ts +0 -148
- package/dist/components/SelectInput/SelectInput.stories.d.ts +0 -24
- package/dist/components/SelectInputInset/SelectInputInset.d.ts +0 -92
- package/dist/components/SelectInputInset/SelectInputInset.stories.d.ts +0 -12
- package/dist/components/SelectInputNative/SelectInputNative.d.ts +0 -45
- package/dist/components/SelectInputNative/SelectInputNative.stories.d.ts +0 -19
- package/dist/components/Sidebar/Sidebar.d.ts +0 -57
- package/dist/components/Sidebar/Sidebar.stories.d.ts +0 -9
- package/dist/components/Spinner/Spinner.d.ts +0 -12
- package/dist/components/Spinner/Spinner.stories.d.ts +0 -8
- package/dist/components/Switch/Switch.d.ts +0 -64
- package/dist/components/Switch/Switch.stories.d.ts +0 -12
- package/dist/components/Table/Table.d.ts +0 -86
- package/dist/components/Table/Table.stories.d.ts +0 -31
- package/dist/components/Table/TableBody/TableBody.d.ts +0 -52
- package/dist/components/Table/TableBody/TableBodyCell/TableBodyCell.d.ts +0 -45
- package/dist/components/Table/TableHead/TableHead.d.ts +0 -46
- package/dist/components/Table/TableHead/TableHeaderCell/TableHeaderCell.d.ts +0 -65
- package/dist/components/Table/common/TableRow/TableRow.d.ts +0 -67
- package/dist/components/TextInput/TextInput.d.ts +0 -106
- package/dist/components/TextInput/TextInput.stories.d.ts +0 -19
- package/dist/components/TextInputInset/TextInputInset.d.ts +0 -102
- package/dist/components/TextInputInset/TextInputInset.stories.d.ts +0 -13
- package/dist/components/TextareaInput/TextareaInput.d.ts +0 -97
- package/dist/components/TextareaInput/TextareaInput.stories.d.ts +0 -23
- package/dist/components/TextareaInputInset/TextareaInputInset.d.ts +0 -105
- package/dist/components/TextareaInputInset/TextareaInputInset.stories.d.ts +0 -12
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +0 -15
- package/dist/components/ThemeProvider/ThemeProvider.stories.d.ts +0 -6
- package/dist/components/TimePicker/TimePicker.d.ts +0 -35
- package/dist/components/TimePicker/TimePicker.stories.d.ts +0 -12
- package/dist/components/TimePickerNative/TimePickerNative.d.ts +0 -39
- package/dist/components/TimePickerNative/TimePickerNative.stories.d.ts +0 -11
- package/dist/components/Toast/Toast.store.d.ts +0 -36
- package/dist/components/Toast/Toast.stories.d.ts +0 -14
- package/dist/components/Toast/Toast.types.d.ts +0 -75
- package/dist/components/Toast/ToastContainer.d.ts +0 -43
- package/dist/components/Toast/ToastNotification.d.ts +0 -28
- package/dist/components/Toast/index.d.ts +0 -4
- package/dist/components/Toast/toast.d.ts +0 -20
- package/dist/components/Toast/useToasts.d.ts +0 -14
- package/dist/components/Toggle/Toggle.d.ts +0 -7
- package/dist/components/Toggle/Toggle.stories.d.ts +0 -11
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +0 -19
- package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +0 -12
- package/dist/components/Tooltip/Tooltip.d.ts +0 -8
- package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -8
- package/dist/constants/keyCodes.d.ts +0 -2
- package/dist/css/index.css +0 -36
- package/dist/hooks/index.d.ts +0 -6
- package/dist/hooks/useBreakpoint/useBreakpoint.d.ts +0 -9
- package/dist/hooks/useBreakpoint/useBreakpoint.stories.d.ts +0 -6
- package/dist/hooks/useIsMobile/useIsMobile.d.ts +0 -1
- package/dist/hooks/useIsMobile/useIsMobile.stories.d.ts +0 -6
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +0 -2
- package/dist/hooks/useOpenClose/useOpenClose.d.ts +0 -39
- package/dist/hooks/useOpenClose/useOpenClose.stories.d.ts +0 -6
- package/dist/hooks/useTheme/useTheme.d.ts +0 -5
- package/dist/hooks/useTheme/useTheme.stories.d.ts +0 -6
- package/dist/hooks/useWindowSize/useWindowSize.d.ts +0 -7
- package/dist/hooks/useWindowSize/useWindowSize.stories.d.ts +0 -6
- package/dist/lib/cssShorthandToClasses.d.ts +0 -4
- package/dist/lib/doesStringIncludeCssUnit.d.ts +0 -1
- package/dist/lib/generateResponsiveClasses.d.ts +0 -2
- package/dist/lib/getAutoCompleteValue.d.ts +0 -1
- package/dist/lib/getColumnKeys.d.ts +0 -3
- package/dist/lib/getDimensionCss.d.ts +0 -12
- package/dist/lib/getElementType.d.ts +0 -14
- package/dist/lib/getFlexCss.d.ts +0 -9
- package/dist/lib/index.d.ts +0 -15
- package/dist/lib/isFunction.d.ts +0 -3
- package/dist/lib/mergeRefs.d.ts +0 -2
- package/dist/lib/prefersReducedMotion.d.ts +0 -1
- package/dist/lib/react-children-utilities/filter.d.ts +0 -3
- package/dist/lib/react-children-utilities/index.d.ts +0 -1
- package/dist/lib/reactRouterClickHandler.d.ts +0 -12
- package/dist/lib/resolveValue.d.ts +0 -3
- package/dist/lib/tokens.d.ts +0 -22
- package/dist/modes.d.ts +0 -8
- package/dist/types/index.d.ts +0 -103
- package/dist/types/lib.types.d.ts +0 -3
|
@@ -59,10 +59,10 @@ describe('ModalFooter', () => {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
test('applies custom styles', () => {
|
|
62
|
-
const customStyle = { backgroundColor: '
|
|
62
|
+
const customStyle = { backgroundColor: '#cacaca' };
|
|
63
63
|
const { container } = render(
|
|
64
64
|
<ModalFooter style={customStyle}>test modal</ModalFooter>
|
|
65
65
|
);
|
|
66
|
-
expect(container.firstChild).toHaveStyle('background-color:
|
|
66
|
+
expect(container.firstChild).toHaveStyle('background-color: #cacaca');
|
|
67
67
|
});
|
|
68
68
|
});
|
|
@@ -25,7 +25,7 @@ export const Default = () => {
|
|
|
25
25
|
<SelectInput
|
|
26
26
|
id="singleSelectWithLabel"
|
|
27
27
|
label="Label"
|
|
28
|
-
// @ts-
|
|
28
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
29
29
|
onChange={(event) => setValue(event.target.value)}
|
|
30
30
|
options={options}
|
|
31
31
|
value={value}
|
|
@@ -46,7 +46,7 @@ export const PreSelected = () => {
|
|
|
46
46
|
<SelectInput
|
|
47
47
|
id="preSelected"
|
|
48
48
|
label="Label"
|
|
49
|
-
// @ts-
|
|
49
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
50
50
|
onChange={(event) => setValue(event.target.value)}
|
|
51
51
|
options={options}
|
|
52
52
|
value={value}
|
|
@@ -68,7 +68,7 @@ export const HelpText = () => {
|
|
|
68
68
|
id="helpText"
|
|
69
69
|
label="Flavor"
|
|
70
70
|
helpText="Choose your favorite flavor"
|
|
71
|
-
// @ts-
|
|
71
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
72
72
|
onChange={(event) => setValue(event.target.value)}
|
|
73
73
|
options={options}
|
|
74
74
|
value={value}
|
|
@@ -90,7 +90,7 @@ export const Placeholder = () => {
|
|
|
90
90
|
<SelectInput
|
|
91
91
|
id="customPlaceholder"
|
|
92
92
|
label="Label"
|
|
93
|
-
// @ts-
|
|
93
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
94
94
|
onChange={(event) => setValue(event.target.value)}
|
|
95
95
|
options={options}
|
|
96
96
|
value={value}
|
|
@@ -112,7 +112,7 @@ export const HiddenLabel = () => {
|
|
|
112
112
|
<SelectInput
|
|
113
113
|
id="labelHidden"
|
|
114
114
|
label="My label is hidden"
|
|
115
|
-
// @ts-
|
|
115
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
116
116
|
onChange={(event) => setValue(event.target.value)}
|
|
117
117
|
options={options}
|
|
118
118
|
value={value}
|
|
@@ -134,7 +134,7 @@ export const CreatableSelect = () => {
|
|
|
134
134
|
id="creatableSelect"
|
|
135
135
|
label="Label"
|
|
136
136
|
value={value}
|
|
137
|
-
// @ts-
|
|
137
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
138
138
|
onChange={(event) => setValue(event.target.value)}
|
|
139
139
|
options={options}
|
|
140
140
|
isCreatable
|
|
@@ -182,7 +182,7 @@ export const AsyncSelect = () => {
|
|
|
182
182
|
id="asyncSelect"
|
|
183
183
|
label="Label"
|
|
184
184
|
value={value}
|
|
185
|
-
// @ts-
|
|
185
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
186
186
|
onChange={(event) => setValue(event.target.value)}
|
|
187
187
|
options={loadOptions}
|
|
188
188
|
defaultOptions
|
|
@@ -233,7 +233,7 @@ export const AsyncCreatableSelect = () => {
|
|
|
233
233
|
id="asyncCreateSelect"
|
|
234
234
|
label="Label"
|
|
235
235
|
value={value}
|
|
236
|
-
// @ts-
|
|
236
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
237
237
|
onChange={(event) => setValue(event.target.value)}
|
|
238
238
|
options={loadOptions}
|
|
239
239
|
isCreatable
|
|
@@ -258,7 +258,7 @@ export const MultiSelect = () => {
|
|
|
258
258
|
id="multiSelect"
|
|
259
259
|
label="Label"
|
|
260
260
|
value={value}
|
|
261
|
-
// @ts-
|
|
261
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
262
262
|
onChange={(event) => setValue(event.target.value)}
|
|
263
263
|
options={options}
|
|
264
264
|
isMulti
|
|
@@ -280,7 +280,7 @@ export const MultiSelectAndPreSelected = () => {
|
|
|
280
280
|
id="preSelectMultiSelect"
|
|
281
281
|
label="Label"
|
|
282
282
|
value={value}
|
|
283
|
-
// @ts-
|
|
283
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
284
284
|
onChange={(event) => setValue(event.target.value)}
|
|
285
285
|
options={options}
|
|
286
286
|
isMulti
|
|
@@ -302,7 +302,7 @@ export const MultiSelectCreatable = () => {
|
|
|
302
302
|
id="creatableMultiSelect"
|
|
303
303
|
label="Label"
|
|
304
304
|
value={value}
|
|
305
|
-
// @ts-
|
|
305
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
306
306
|
onChange={(event) => setValue(event.target.value)}
|
|
307
307
|
options={options}
|
|
308
308
|
isMulti
|
|
@@ -325,7 +325,7 @@ export const Autofocus = () => {
|
|
|
325
325
|
id="autoFocus"
|
|
326
326
|
label="Label"
|
|
327
327
|
value={value}
|
|
328
|
-
// @ts-
|
|
328
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
329
329
|
onChange={(event) => setValue(event.target.value)}
|
|
330
330
|
options={options}
|
|
331
331
|
autoFocus
|
|
@@ -347,7 +347,7 @@ export const Required = () => {
|
|
|
347
347
|
id="required"
|
|
348
348
|
label="Label"
|
|
349
349
|
value={value}
|
|
350
|
-
// @ts-
|
|
350
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
351
351
|
onChange={(event) => setValue(event.target.value)}
|
|
352
352
|
options={options}
|
|
353
353
|
isRequired
|
|
@@ -369,7 +369,7 @@ export const Disabled = () => {
|
|
|
369
369
|
id="disabled"
|
|
370
370
|
label="Label"
|
|
371
371
|
value={value}
|
|
372
|
-
// @ts-
|
|
372
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
373
373
|
onChange={(event) => setValue(event.target.value)}
|
|
374
374
|
options={options}
|
|
375
375
|
isDisabled
|
|
@@ -392,7 +392,7 @@ export const Clearable = () => {
|
|
|
392
392
|
label="Label"
|
|
393
393
|
value={value}
|
|
394
394
|
name="myClearableSelect"
|
|
395
|
-
// @ts-
|
|
395
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
396
396
|
onChange={(event) => setValue(event.target.value)}
|
|
397
397
|
options={options}
|
|
398
398
|
isClearable
|
|
@@ -414,7 +414,7 @@ export const Error = () => {
|
|
|
414
414
|
id="error"
|
|
415
415
|
label="Label"
|
|
416
416
|
value={value}
|
|
417
|
-
// @ts-
|
|
417
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
418
418
|
onChange={(event) => setValue(event.target.value)}
|
|
419
419
|
options={options}
|
|
420
420
|
isRequired
|
|
@@ -439,7 +439,7 @@ export const Sizes = () => {
|
|
|
439
439
|
<SelectInput
|
|
440
440
|
id="smallSelect"
|
|
441
441
|
label="Small"
|
|
442
|
-
// @ts-
|
|
442
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
443
443
|
onChange={(event) => setValue(event.target.value)}
|
|
444
444
|
options={options}
|
|
445
445
|
value={value}
|
|
@@ -448,7 +448,7 @@ export const Sizes = () => {
|
|
|
448
448
|
<SelectInput
|
|
449
449
|
id="mediumSelect"
|
|
450
450
|
label="Medium"
|
|
451
|
-
// @ts-
|
|
451
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
452
452
|
onChange={(event) => setValue1(event.target.value)}
|
|
453
453
|
options={options}
|
|
454
454
|
value={value1}
|
|
@@ -457,7 +457,7 @@ export const Sizes = () => {
|
|
|
457
457
|
<SelectInput
|
|
458
458
|
id="largeSelect"
|
|
459
459
|
label="Large"
|
|
460
|
-
// @ts-
|
|
460
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
461
461
|
onChange={(event) => setValue2(event.target.value)}
|
|
462
462
|
options={options}
|
|
463
463
|
value={value2}
|
|
@@ -466,7 +466,7 @@ export const Sizes = () => {
|
|
|
466
466
|
<SelectInput
|
|
467
467
|
id="responsiveSelect"
|
|
468
468
|
label="Responsive"
|
|
469
|
-
// @ts-
|
|
469
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
470
470
|
onChange={(event) => setValue3(event.target.value)}
|
|
471
471
|
options={options}
|
|
472
472
|
value={value3}
|
|
@@ -488,7 +488,7 @@ export const WithPortal = () => {
|
|
|
488
488
|
id="portal"
|
|
489
489
|
label="Flavors"
|
|
490
490
|
value={value}
|
|
491
|
-
// @ts-
|
|
491
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
492
492
|
onChange={(event) => setValue(event.target.value)}
|
|
493
493
|
options={options}
|
|
494
494
|
menuPortalTarget={document.body}
|
|
@@ -509,7 +509,7 @@ export const CustomClasses = () => {
|
|
|
509
509
|
id="customClasses"
|
|
510
510
|
label="Label"
|
|
511
511
|
value={value}
|
|
512
|
-
// @ts-
|
|
512
|
+
// @ts-expect-error - TS is not recognizing the value as a valid option
|
|
513
513
|
onChange={(event) => setValue(event.target.value)}
|
|
514
514
|
options={options}
|
|
515
515
|
className="background-color-primary"
|
|
@@ -18,17 +18,21 @@ import { InputValidationMessage } from '../InputValidationMessage/InputValidatio
|
|
|
18
18
|
import styles from './SelectInput.module.scss';
|
|
19
19
|
import { GroupBase } from 'react-select/dist/declarations/src/types';
|
|
20
20
|
|
|
21
|
-
type
|
|
22
|
-
|
|
21
|
+
type SelectOption = {
|
|
22
|
+
value: string;
|
|
23
|
+
label: ReactNode;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
type SelectGroupOptions = GroupBase<SelectOption>;
|
|
23
27
|
export type SelectInputOptions = OptionsOrGroups<
|
|
24
|
-
|
|
28
|
+
SelectOption,
|
|
25
29
|
SelectGroupOptions
|
|
26
30
|
>;
|
|
27
31
|
|
|
28
32
|
export type SimulatedEventPayloadType = {
|
|
29
33
|
target: {
|
|
30
34
|
name: string;
|
|
31
|
-
value: OnChangeValue<
|
|
35
|
+
value: OnChangeValue<SelectOption, boolean>;
|
|
32
36
|
};
|
|
33
37
|
};
|
|
34
38
|
|
|
@@ -141,7 +145,9 @@ export interface SelectInputProps {
|
|
|
141
145
|
[x: string]: any; // eslint-disable-line
|
|
142
146
|
}
|
|
143
147
|
|
|
144
|
-
type AsyncOptions = (
|
|
148
|
+
type AsyncOptions = (
|
|
149
|
+
inputValue: string
|
|
150
|
+
) => Promise<OptionsOrGroups<SelectOption, SelectGroupOptions>>;
|
|
145
151
|
type AsyncSelectInputProps = SelectInputProps & {
|
|
146
152
|
/**
|
|
147
153
|
* Load the input asynchronously.
|
|
@@ -202,7 +208,7 @@ export function SelectInput(props: SelectInputProps): JSX.Element {
|
|
|
202
208
|
...restProps
|
|
203
209
|
} = props;
|
|
204
210
|
|
|
205
|
-
const handleChange = (values: OnChangeValue<
|
|
211
|
+
const handleChange = (values: OnChangeValue<SelectOption, boolean>) => {
|
|
206
212
|
const simulatedEventPayloadType: SimulatedEventPayloadType = {
|
|
207
213
|
target: {
|
|
208
214
|
name,
|
|
@@ -245,9 +251,7 @@ export function SelectInput(props: SelectInputProps): JSX.Element {
|
|
|
245
251
|
};
|
|
246
252
|
|
|
247
253
|
const ClearIndicator = (
|
|
248
|
-
props: ClearIndicatorProps<
|
|
249
|
-
OptionsOrGroups<SelectOptions, SelectGroupOptions>
|
|
250
|
-
>
|
|
254
|
+
props: ClearIndicatorProps<SelectOption, boolean, SelectGroupOptions>
|
|
251
255
|
) => (
|
|
252
256
|
<components.ClearIndicator {...props}>
|
|
253
257
|
<Icon name="remove" />
|
|
@@ -340,12 +340,16 @@ interface NavItem {
|
|
|
340
340
|
}[];
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
+
type Team = {
|
|
344
|
+
name: string;
|
|
345
|
+
};
|
|
346
|
+
|
|
343
347
|
const NavHeader = ({
|
|
344
348
|
activeTeam,
|
|
345
349
|
setActiveTeam,
|
|
346
350
|
}: {
|
|
347
|
-
activeTeam:
|
|
348
|
-
setActiveTeam: (team:
|
|
351
|
+
activeTeam: Team;
|
|
352
|
+
setActiveTeam: (team: Team) => void;
|
|
349
353
|
}) => {
|
|
350
354
|
const { state, isMobile } = useSidebar();
|
|
351
355
|
|
|
@@ -645,8 +649,8 @@ const OrgSwitcher = ({
|
|
|
645
649
|
activeTeam,
|
|
646
650
|
setActiveTeam,
|
|
647
651
|
}: {
|
|
648
|
-
activeTeam:
|
|
649
|
-
setActiveTeam: (team:
|
|
652
|
+
activeTeam: Team;
|
|
653
|
+
setActiveTeam: (team: Team) => void;
|
|
650
654
|
}) => {
|
|
651
655
|
const { state } = useSidebar();
|
|
652
656
|
|
|
@@ -139,10 +139,13 @@ describe('Sidebar', () => {
|
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
test.each([
|
|
142
|
-
['input', <input aria-label="input-field" />],
|
|
143
|
-
['textarea', <textarea aria-label="textarea-field" />],
|
|
144
|
-
['select', <select aria-label="select-field" />],
|
|
145
|
-
[
|
|
142
|
+
['input', <input aria-label="input-field" key="input" />],
|
|
143
|
+
['textarea', <textarea aria-label="textarea-field" key="textarea" />],
|
|
144
|
+
['select', <select aria-label="select-field" key="select" />],
|
|
145
|
+
[
|
|
146
|
+
'contenteditable',
|
|
147
|
+
<div aria-label="editable-field" contentEditable key="contenteditable" />,
|
|
148
|
+
],
|
|
146
149
|
])('ignores keyboard shortcuts for %s elements', (label, field) => {
|
|
147
150
|
render(
|
|
148
151
|
<SidebarProvider>
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from '../Tooltip/Tooltip';
|
|
23
23
|
|
|
24
24
|
const SIDEBAR_WIDTH = '16rem';
|
|
25
|
+
const SIDEBAR_RIGHT_WIDTH = '24rem';
|
|
25
26
|
const SIDEBAR_WIDTH_ICON = '44px';
|
|
26
27
|
const SIDEBAR_KEYBOARD_SHORTCUT_LEFT = '[';
|
|
27
28
|
const SIDEBAR_KEYBOARD_SHORTCUT_RIGHT = ']';
|
|
@@ -197,8 +198,12 @@ const useSidebarSideState = ({
|
|
|
197
198
|
|
|
198
199
|
const toggleSidebar = useCallback(() => {
|
|
199
200
|
lastToggledSideRef.current = side;
|
|
200
|
-
|
|
201
|
-
|
|
201
|
+
if (isMobile) {
|
|
202
|
+
setOpenMobile((value) => !value);
|
|
203
|
+
} else {
|
|
204
|
+
setOpen((value) => !value);
|
|
205
|
+
}
|
|
206
|
+
}, [isMobile, setOpen, side, setOpenMobile, lastToggledSideRef]);
|
|
202
207
|
|
|
203
208
|
const state = open ? 'expanded' : 'collapsed';
|
|
204
209
|
|
|
@@ -343,7 +348,7 @@ const SidebarProvider = forwardRef<
|
|
|
343
348
|
} as React.CSSProperties
|
|
344
349
|
}
|
|
345
350
|
className={classNames(
|
|
346
|
-
'display-flex w-100 background-color-secondary',
|
|
351
|
+
'display-flex w-100 background-color-secondary overflow-hidden',
|
|
347
352
|
className
|
|
348
353
|
)}
|
|
349
354
|
ref={ref}
|
|
@@ -372,6 +377,7 @@ const Sidebar = React.forwardRef<
|
|
|
372
377
|
ref
|
|
373
378
|
) => {
|
|
374
379
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar(side);
|
|
380
|
+
const sidebarWidth = side === 'right' ? SIDEBAR_RIGHT_WIDTH : SIDEBAR_WIDTH;
|
|
375
381
|
|
|
376
382
|
if (isMobile) {
|
|
377
383
|
return (
|
|
@@ -397,9 +403,12 @@ const Sidebar = React.forwardRef<
|
|
|
397
403
|
'group display-flex h-100 font-size-xs flex-direction-column background-color-secondary font-color-base',
|
|
398
404
|
className
|
|
399
405
|
)}
|
|
400
|
-
style={
|
|
401
|
-
|
|
402
|
-
|
|
406
|
+
style={
|
|
407
|
+
{
|
|
408
|
+
'--sidebar-width': sidebarWidth,
|
|
409
|
+
width: 'var(--sidebar-width)',
|
|
410
|
+
} as React.CSSProperties
|
|
411
|
+
}
|
|
403
412
|
ref={ref}
|
|
404
413
|
{...props}
|
|
405
414
|
>
|
|
@@ -419,9 +428,9 @@ const Sidebar = React.forwardRef<
|
|
|
419
428
|
fontSize="sm"
|
|
420
429
|
position="relative"
|
|
421
430
|
style={
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
431
|
+
{
|
|
432
|
+
'--sidebar-width': sidebarWidth,
|
|
433
|
+
} as React.CSSProperties
|
|
425
434
|
}
|
|
426
435
|
data-state={state}
|
|
427
436
|
data-collapsible={collapsible}
|
|
@@ -635,12 +644,11 @@ const SidebarMenuButton = React.forwardRef<
|
|
|
635
644
|
React.ComponentProps<'button'> & {
|
|
636
645
|
asChild?: boolean;
|
|
637
646
|
isActive?: boolean;
|
|
638
|
-
icon?: IconName;
|
|
639
647
|
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
|
|
640
648
|
}
|
|
641
649
|
>(
|
|
642
650
|
(
|
|
643
|
-
{ asChild = false, isActive = false,
|
|
651
|
+
{ asChild = false, isActive = false, tooltip, className, ...props },
|
|
644
652
|
ref
|
|
645
653
|
) => {
|
|
646
654
|
const Comp = asChild ? Slot : 'button';
|
|
@@ -846,9 +854,10 @@ const SidebarRail = React.forwardRef<
|
|
|
846
854
|
top: '20px',
|
|
847
855
|
bottom: '20px',
|
|
848
856
|
right: side === 'left' ? '-14px' : undefined,
|
|
849
|
-
left: side === 'right' ? '-
|
|
857
|
+
left: side === 'right' ? '-18px' : undefined,
|
|
850
858
|
width: '10px',
|
|
851
859
|
}}
|
|
860
|
+
type="button"
|
|
852
861
|
{...props}
|
|
853
862
|
>
|
|
854
863
|
<Box
|