@hyphen/hyphen-components 7.3.2 → 7.3.4

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.
Files changed (221) hide show
  1. package/dist/css/utilities.css +1 -1
  2. package/dist/css/variables.css +18 -28
  3. package/dist/hyphen-components.cjs.development.js +5873 -5019
  4. package/dist/hyphen-components.cjs.development.js.map +1 -1
  5. package/dist/hyphen-components.cjs.production.min.js +18 -2
  6. package/dist/hyphen-components.cjs.production.min.js.map +1 -1
  7. package/dist/hyphen-components.esm.js +5731 -4844
  8. package/dist/hyphen-components.esm.js.map +1 -1
  9. package/dist/index.d.ts +2799 -57
  10. package/dist/index.js +0 -1
  11. package/package.json +18 -19
  12. package/src/components/Badge/Badge.module.scss +6 -0
  13. package/src/components/Badge/Badge.stories.tsx +1 -0
  14. package/src/components/Badge/Badge.test.tsx +3 -2
  15. package/src/components/Badge/Badge.tsx +5 -3
  16. package/src/components/Box/Box.tsx +5 -2
  17. package/src/components/Button/Button.module.scss +1 -1
  18. package/src/components/Button/Button.test.tsx +2 -2
  19. package/src/components/Calendar/Calendar.test.tsx +262 -0
  20. package/src/components/Card/Card.tsx +2 -0
  21. package/src/components/CheckboxInput/components/Checkbox.module.scss +1 -1
  22. package/src/components/CheckboxInput/components/Checkbox.tsx +2 -0
  23. package/src/components/Details/Details.module.scss +2 -2
  24. package/src/components/Details/Details.tsx +2 -0
  25. package/src/components/Drawer/Drawer.stories.tsx +1 -1
  26. package/src/components/Drawer/Drawer.test.tsx +494 -56
  27. package/src/components/Drawer/Drawer.tsx +7 -1
  28. package/src/components/DropdownMenu/DropdownMenu.test.tsx +532 -12
  29. package/src/components/FormControl/FormControl.tsx +2 -0
  30. package/src/components/Formik/Formik.stories.tsx +30 -7
  31. package/src/components/Formik/FormikSelectInput/FormikSelectInput.tsx +6 -5
  32. package/src/components/Formik/FormikToggleGroup/FormikToggleGroup.tsx +1 -1
  33. package/src/components/HelpText/HelpText.tsx +2 -0
  34. package/src/components/Icon/Icon.stories.tsx +1 -1
  35. package/src/components/Icon/Icon.tsx +2 -0
  36. package/src/components/Modal/Modal.test.tsx +630 -81
  37. package/src/components/Modal/Modal.tsx +2 -0
  38. package/src/components/Modal/components/ModalFooter/ModalFooter.test.tsx +2 -2
  39. package/src/components/Popover/Popover.tsx +2 -0
  40. package/src/components/RadioGroup/RadioInput/RadioInput.tsx +2 -0
  41. package/src/components/SelectInput/SelectInput.stories.tsx +22 -22
  42. package/src/components/SelectInput/SelectInput.tsx +13 -9
  43. package/src/components/SelectInputInset/SelectInputInset.tsx +2 -0
  44. package/src/components/Sidebar/Sidebar.module.scss +4 -0
  45. package/src/components/Sidebar/Sidebar.stories.tsx +8 -4
  46. package/src/components/Sidebar/Sidebar.test.tsx +7 -4
  47. package/src/components/Sidebar/Sidebar.tsx +7 -4
  48. package/src/components/Table/Table.stories.tsx +102 -52
  49. package/src/components/TextInput/TextInput.tsx +2 -0
  50. package/src/components/TextInputInset/TextInputInset.tsx +2 -0
  51. package/src/components/TextareaInputInset/TextareaInputInset.tsx +2 -0
  52. package/src/components/TimePickerNative/TimePickerNative.stories.tsx +0 -1
  53. package/src/components/Toast/Toast.store.ts +1 -1
  54. package/src/components/Toast/Toast.stories.tsx +3 -2
  55. package/src/components/Toast/Toast.test.tsx +8 -6
  56. package/src/components/Toggle/Toggle.tsx +2 -0
  57. package/src/components/ToggleGroup/ToggleGroup.tsx +2 -0
  58. package/src/docs/Colors.mdx +0 -13
  59. package/src/index.ts +2 -0
  60. package/src/lib/getColumnKeys.ts +3 -3
  61. package/src/lib/mergeRefs.ts +1 -1
  62. package/src/lib/tokens.ts +4 -4
  63. package/dist/components/Alert/Alert.constants.d.ts +0 -8
  64. package/dist/components/Alert/Alert.d.ts +0 -42
  65. package/dist/components/Alert/Alert.stories.d.ts +0 -12
  66. package/dist/components/Alert/Alert.types.d.ts +0 -7
  67. package/dist/components/AspectRatio/AspectRatio.d.ts +0 -3
  68. package/dist/components/AspectRatio/AspectRatio.stories.d.ts +0 -6
  69. package/dist/components/Badge/Badge.d.ts +0 -24
  70. package/dist/components/Badge/Badge.stories.d.ts +0 -8
  71. package/dist/components/Box/Box.d.ts +0 -247
  72. package/dist/components/Box/Box.stories.d.ts +0 -46
  73. package/dist/components/Button/Button.constants.d.ts +0 -3
  74. package/dist/components/Button/Button.d.ts +0 -53
  75. package/dist/components/Button/Button.stories.d.ts +0 -16
  76. package/dist/components/Calendar/Calendar.d.ts +0 -7
  77. package/dist/components/Calendar/Calendar.stories.d.ts +0 -12
  78. package/dist/components/Card/Card.d.ts +0 -17
  79. package/dist/components/Card/Card.stories.d.ts +0 -8
  80. package/dist/components/Card/components/CardFooter/CardFooter.d.ts +0 -13
  81. package/dist/components/Card/components/CardHeader/CardHeader.d.ts +0 -13
  82. package/dist/components/Card/components/CardSection/CardSection.d.ts +0 -46
  83. package/dist/components/Card/components/index.d.ts +0 -3
  84. package/dist/components/CheckboxInput/CheckboxInput.d.ts +0 -72
  85. package/dist/components/CheckboxInput/CheckboxInput.stories.d.ts +0 -18
  86. package/dist/components/CheckboxInput/components/Checkbox.d.ts +0 -71
  87. package/dist/components/CheckboxInput/components/CheckboxIcon.d.ts +0 -27
  88. package/dist/components/Collapsible/Collapsible.d.ts +0 -5
  89. package/dist/components/Collapsible/Collapsible.stories.d.ts +0 -9
  90. package/dist/components/Details/Details.d.ts +0 -15
  91. package/dist/components/Details/Details.stories.d.ts +0 -6
  92. package/dist/components/Details/DetailsSummary.d.ts +0 -7
  93. package/dist/components/Drawer/Drawer.d.ts +0 -105
  94. package/dist/components/Drawer/Drawer.stories.d.ts +0 -62
  95. package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -25
  96. package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +0 -9
  97. package/dist/components/FormControl/FormControl.d.ts +0 -38
  98. package/dist/components/FormLabel/FormLabel.d.ts +0 -41
  99. package/dist/components/FormLabel/FormLabel.stories.d.ts +0 -6
  100. package/dist/components/Formik/Formik.stories.d.ts +0 -18
  101. package/dist/components/Formik/FormikCheckboxInput/FormikCheckboxInput.d.ts +0 -12
  102. package/dist/components/Formik/FormikRadioGroup/FormikRadioGroup.d.ts +0 -12
  103. package/dist/components/Formik/FormikSelectInput/FormikSelectInput.d.ts +0 -13
  104. package/dist/components/Formik/FormikSelectInputInset/FormikSelectInputInset.d.ts +0 -12
  105. package/dist/components/Formik/FormikSelectInputNative/FormikSelectInputNative.d.ts +0 -12
  106. package/dist/components/Formik/FormikSwitch/FormikSwitch.d.ts +0 -12
  107. package/dist/components/Formik/FormikTextInput/FormikTextInput.d.ts +0 -12
  108. package/dist/components/Formik/FormikTextInputInset/FormikTextInputInset.d.ts +0 -12
  109. package/dist/components/Formik/FormikTextareaInput/FormikTextareaInput.d.ts +0 -12
  110. package/dist/components/Formik/FormikTextareaInputInset/FormikTextareaInputInset.d.ts +0 -12
  111. package/dist/components/Formik/FormikTimePicker/FormikTimePicker.d.ts +0 -12
  112. package/dist/components/Formik/FormikTimePickerNative/FormikTimePickerNative.d.ts +0 -12
  113. package/dist/components/Formik/FormikToggleGroup/FormikToggleGroup.d.ts +0 -20
  114. package/dist/components/Formik/FormikToggleGroupMulti/FormikToggleGroupMulti.d.ts +0 -18
  115. package/dist/components/Heading/Heading.constants.d.ts +0 -10
  116. package/dist/components/Heading/Heading.d.ts +0 -35
  117. package/dist/components/Heading/Heading.stories.d.ts +0 -9
  118. package/dist/components/HelpText/HelpText.d.ts +0 -12
  119. package/dist/components/Icon/Icon.d.ts +0 -22
  120. package/dist/components/Icon/Icon.stories.d.ts +0 -10
  121. package/dist/components/InputValidationMessage/InputValidationMessage.d.ts +0 -9
  122. package/dist/components/Modal/Modal.d.ts +0 -83
  123. package/dist/components/Modal/Modal.stories.d.ts +0 -13
  124. package/dist/components/Modal/components/ModalBody/ModalBody.d.ts +0 -4
  125. package/dist/components/Modal/components/ModalFooter/ModalFooter.d.ts +0 -4
  126. package/dist/components/Modal/components/ModalHeader/ModalHeader.d.ts +0 -21
  127. package/dist/components/Modal/components/index.d.ts +0 -4
  128. package/dist/components/Pagination/Pagination.d.ts +0 -51
  129. package/dist/components/Pagination/Pagination.stories.d.ts +0 -8
  130. package/dist/components/Pagination/Pagination.utilities.d.ts +0 -10
  131. package/dist/components/Popover/Popover.d.ts +0 -8
  132. package/dist/components/Popover/Popover.stories.d.ts +0 -7
  133. package/dist/components/RadioGroup/RadioGroup.d.ts +0 -75
  134. package/dist/components/RadioGroup/RadioGroup.stories.d.ts +0 -16
  135. package/dist/components/RadioGroup/RadioInput/RadioInput.d.ts +0 -57
  136. package/dist/components/RadioGroup/RadioInput/RadioInputIcon.d.ts +0 -27
  137. package/dist/components/RangeInput/RangeInput.d.ts +0 -29
  138. package/dist/components/RangeInput/RangeInput.stories.d.ts +0 -7
  139. package/dist/components/ResponsiveProvider/ResponsiveProvider.d.ts +0 -17
  140. package/dist/components/ResponsiveProvider/ResponsiveProvider.stories.d.ts +0 -7
  141. package/dist/components/SelectInput/SelectInput.d.ts +0 -148
  142. package/dist/components/SelectInput/SelectInput.stories.d.ts +0 -24
  143. package/dist/components/SelectInputInset/SelectInputInset.d.ts +0 -92
  144. package/dist/components/SelectInputInset/SelectInputInset.stories.d.ts +0 -12
  145. package/dist/components/SelectInputNative/SelectInputNative.d.ts +0 -45
  146. package/dist/components/SelectInputNative/SelectInputNative.stories.d.ts +0 -19
  147. package/dist/components/Sidebar/Sidebar.d.ts +0 -57
  148. package/dist/components/Sidebar/Sidebar.stories.d.ts +0 -9
  149. package/dist/components/Spinner/Spinner.d.ts +0 -12
  150. package/dist/components/Spinner/Spinner.stories.d.ts +0 -8
  151. package/dist/components/Switch/Switch.d.ts +0 -64
  152. package/dist/components/Switch/Switch.stories.d.ts +0 -12
  153. package/dist/components/Table/Table.d.ts +0 -86
  154. package/dist/components/Table/Table.stories.d.ts +0 -31
  155. package/dist/components/Table/TableBody/TableBody.d.ts +0 -52
  156. package/dist/components/Table/TableBody/TableBodyCell/TableBodyCell.d.ts +0 -45
  157. package/dist/components/Table/TableHead/TableHead.d.ts +0 -46
  158. package/dist/components/Table/TableHead/TableHeaderCell/TableHeaderCell.d.ts +0 -65
  159. package/dist/components/Table/common/TableRow/TableRow.d.ts +0 -67
  160. package/dist/components/TextInput/TextInput.d.ts +0 -106
  161. package/dist/components/TextInput/TextInput.stories.d.ts +0 -19
  162. package/dist/components/TextInputInset/TextInputInset.d.ts +0 -102
  163. package/dist/components/TextInputInset/TextInputInset.stories.d.ts +0 -13
  164. package/dist/components/TextareaInput/TextareaInput.d.ts +0 -97
  165. package/dist/components/TextareaInput/TextareaInput.stories.d.ts +0 -23
  166. package/dist/components/TextareaInputInset/TextareaInputInset.d.ts +0 -105
  167. package/dist/components/TextareaInputInset/TextareaInputInset.stories.d.ts +0 -12
  168. package/dist/components/ThemeProvider/ThemeProvider.d.ts +0 -15
  169. package/dist/components/ThemeProvider/ThemeProvider.stories.d.ts +0 -6
  170. package/dist/components/TimePicker/TimePicker.d.ts +0 -35
  171. package/dist/components/TimePicker/TimePicker.stories.d.ts +0 -12
  172. package/dist/components/TimePickerNative/TimePickerNative.d.ts +0 -39
  173. package/dist/components/TimePickerNative/TimePickerNative.stories.d.ts +0 -11
  174. package/dist/components/Toast/Toast.store.d.ts +0 -36
  175. package/dist/components/Toast/Toast.stories.d.ts +0 -14
  176. package/dist/components/Toast/Toast.types.d.ts +0 -75
  177. package/dist/components/Toast/ToastContainer.d.ts +0 -43
  178. package/dist/components/Toast/ToastNotification.d.ts +0 -28
  179. package/dist/components/Toast/index.d.ts +0 -4
  180. package/dist/components/Toast/toast.d.ts +0 -20
  181. package/dist/components/Toast/useToasts.d.ts +0 -14
  182. package/dist/components/Toggle/Toggle.d.ts +0 -7
  183. package/dist/components/Toggle/Toggle.stories.d.ts +0 -11
  184. package/dist/components/ToggleGroup/ToggleGroup.d.ts +0 -19
  185. package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +0 -12
  186. package/dist/components/Tooltip/Tooltip.d.ts +0 -8
  187. package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -8
  188. package/dist/constants/keyCodes.d.ts +0 -2
  189. package/dist/css/index.css +0 -36
  190. package/dist/hooks/index.d.ts +0 -6
  191. package/dist/hooks/useBreakpoint/useBreakpoint.d.ts +0 -9
  192. package/dist/hooks/useBreakpoint/useBreakpoint.stories.d.ts +0 -6
  193. package/dist/hooks/useIsMobile/useIsMobile.d.ts +0 -1
  194. package/dist/hooks/useIsMobile/useIsMobile.stories.d.ts +0 -6
  195. package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +0 -2
  196. package/dist/hooks/useOpenClose/useOpenClose.d.ts +0 -39
  197. package/dist/hooks/useOpenClose/useOpenClose.stories.d.ts +0 -6
  198. package/dist/hooks/useTheme/useTheme.d.ts +0 -5
  199. package/dist/hooks/useTheme/useTheme.stories.d.ts +0 -6
  200. package/dist/hooks/useWindowSize/useWindowSize.d.ts +0 -7
  201. package/dist/hooks/useWindowSize/useWindowSize.stories.d.ts +0 -6
  202. package/dist/lib/cssShorthandToClasses.d.ts +0 -4
  203. package/dist/lib/doesStringIncludeCssUnit.d.ts +0 -1
  204. package/dist/lib/generateResponsiveClasses.d.ts +0 -2
  205. package/dist/lib/getAutoCompleteValue.d.ts +0 -1
  206. package/dist/lib/getColumnKeys.d.ts +0 -3
  207. package/dist/lib/getDimensionCss.d.ts +0 -12
  208. package/dist/lib/getElementType.d.ts +0 -14
  209. package/dist/lib/getFlexCss.d.ts +0 -9
  210. package/dist/lib/index.d.ts +0 -15
  211. package/dist/lib/isFunction.d.ts +0 -3
  212. package/dist/lib/mergeRefs.d.ts +0 -2
  213. package/dist/lib/prefersReducedMotion.d.ts +0 -1
  214. package/dist/lib/react-children-utilities/filter.d.ts +0 -3
  215. package/dist/lib/react-children-utilities/index.d.ts +0 -1
  216. package/dist/lib/reactRouterClickHandler.d.ts +0 -12
  217. package/dist/lib/resolveValue.d.ts +0 -3
  218. package/dist/lib/tokens.d.ts +0 -22
  219. package/dist/modes.d.ts +0 -8
  220. package/dist/types/index.d.ts +0 -103
  221. package/dist/types/lib.types.d.ts +0 -3
@@ -170,6 +170,8 @@ export const ModalBaseComponent: React.FC<ModalProps> = forwardRef<
170
170
  }
171
171
  );
172
172
 
173
+ ModalBaseComponent.displayName = 'Modal';
174
+
173
175
  export interface ModalStatic {
174
176
  Body: typeof ModalBody;
175
177
  Header: typeof ModalHeader;
@@ -59,10 +59,10 @@ describe('ModalFooter', () => {
59
59
  });
60
60
 
61
61
  test('applies custom styles', () => {
62
- const customStyle = { backgroundColor: 'red' };
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: red');
66
+ expect(container.firstChild).toHaveStyle('background-color: #cacaca');
67
67
  });
68
68
  });
@@ -26,6 +26,8 @@ const PopoverContent = forwardRef<
26
26
  );
27
27
  });
28
28
 
29
+ PopoverContent.displayName = 'PopoverContent';
30
+
29
31
  export {
30
32
  Popover,
31
33
  PopoverTrigger,
@@ -146,3 +146,5 @@ export const RadioInput = React.forwardRef<HTMLDivElement, RadioInputProps>(
146
146
  );
147
147
  }
148
148
  );
149
+
150
+ RadioInput.displayName = 'RadioInput';
@@ -25,7 +25,7 @@ export const Default = () => {
25
25
  <SelectInput
26
26
  id="singleSelectWithLabel"
27
27
  label="Label"
28
- // @ts-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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-ignore - TS is not recognizing the value as a valid option
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 SelectOptions = any;
22
- type SelectGroupOptions = GroupBase<SelectOptions>;
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
- SelectOptions,
28
+ SelectOption,
25
29
  SelectGroupOptions
26
30
  >;
27
31
 
28
32
  export type SimulatedEventPayloadType = {
29
33
  target: {
30
34
  name: string;
31
- value: OnChangeValue<SelectInputOptions, boolean>;
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 = (inputValue: string) => Promise<SelectInputOptions>;
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<SelectInputOptions, boolean>) => {
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" />
@@ -233,3 +233,5 @@ export const SelectInputInset: ForwardRefExoticComponent<SelectInputInsetProps>
233
233
  );
234
234
  }
235
235
  );
236
+
237
+ SelectInputInset.displayName = 'SelectInputInset';
@@ -4,6 +4,10 @@
4
4
  border-right: 2px solid transparent;
5
5
  }
6
6
 
7
+ .rail:focus:not(:focus-visible) {
8
+ outline: none;
9
+ }
10
+
7
11
  .rail:hover {
8
12
  border-right: 2px solid var(--color-border-sidebar-rail-hover);
9
13
  }
@@ -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: any;
348
- setActiveTeam: (team: any) => void;
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: any;
649
- setActiveTeam: (team: any) => void;
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
- ['contenteditable', <div aria-label="editable-field" contentEditable />],
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>
@@ -198,8 +198,12 @@ const useSidebarSideState = ({
198
198
 
199
199
  const toggleSidebar = useCallback(() => {
200
200
  lastToggledSideRef.current = side;
201
- isMobile ? setOpenMobile((value) => !value) : setOpen((value) => !value);
202
- }, [isMobile, setOpen, side, lastToggledSideRef]);
201
+ if (isMobile) {
202
+ setOpenMobile((value) => !value);
203
+ } else {
204
+ setOpen((value) => !value);
205
+ }
206
+ }, [isMobile, setOpen, side, setOpenMobile, lastToggledSideRef]);
203
207
 
204
208
  const state = open ? 'expanded' : 'collapsed';
205
209
 
@@ -640,12 +644,11 @@ const SidebarMenuButton = React.forwardRef<
640
644
  React.ComponentProps<'button'> & {
641
645
  asChild?: boolean;
642
646
  isActive?: boolean;
643
- icon?: IconName;
644
647
  tooltip?: string | React.ComponentProps<typeof TooltipContent>;
645
648
  }
646
649
  >(
647
650
  (
648
- { asChild = false, isActive = false, icon, tooltip, className, ...props },
651
+ { asChild = false, isActive = false, tooltip, className, ...props },
649
652
  ref
650
653
  ) => {
651
654
  const Comp = asChild ? Slot : 'button';
@@ -3,7 +3,12 @@ import React, { useEffect, useState } from 'react';
3
3
  import { Table } from './Table';
4
4
  import { Button } from '../Button/Button';
5
5
  import { Badge } from '../Badge/Badge';
6
- import type { Column as ColumnType } from '../../types';
6
+ import type {
7
+ Column as ColumnType,
8
+ Cell,
9
+ Row,
10
+ EventWithColumnKey,
11
+ } from '../../types';
7
12
 
8
13
  const meta: Meta<typeof Table> = {
9
14
  title: 'Components/Table',
@@ -12,6 +17,13 @@ const meta: Meta<typeof Table> = {
12
17
 
13
18
  export default meta;
14
19
 
20
+ type SortDirection = 'ascending' | 'descending';
21
+ type SortedColumn = {
22
+ dataKey?: string;
23
+ sortDirection?: SortDirection;
24
+ };
25
+ type SortableRow = Record<string, string | number>;
26
+
15
27
  export const Column = () =>
16
28
  (() => {
17
29
  const codePreviewStyle = {
@@ -94,7 +106,7 @@ export const Column = () =>
94
106
  {
95
107
  heading: 'Type',
96
108
  dataKey: 'type',
97
- render: (cell: any) => <code style={codePreviewStyle}>{cell}</code>,
109
+ render: (cell: string) => <code style={codePreviewStyle}>{cell}</code>,
98
110
  },
99
111
  { heading: 'Description', dataKey: 'description' },
100
112
  ];
@@ -109,12 +121,15 @@ export const CommonExample = () =>
109
121
  {
110
122
  heading: 'Customer',
111
123
  dataKey: 'customerInfo',
112
- render: (_cell: any, row: any) => (
113
- <div>
114
- <div>{row.name}</div>
115
- <div className="font-color-base">{row.email}</div>
116
- </div>
117
- ),
124
+ render: (_cell?: Cell, row?: Row) => {
125
+ const customerRow = row as { name?: string; email?: string } | undefined;
126
+ return (
127
+ <div>
128
+ <div>{customerRow?.name}</div>
129
+ <div className="font-color-base">{customerRow?.email}</div>
130
+ </div>
131
+ );
132
+ },
118
133
  },
119
134
  { heading: 'Phone', dataKey: 'phone', width: 125 },
120
135
  { heading: 'Plan', dataKey: 'plan', width: 125 },
@@ -164,31 +179,37 @@ export const Loading = () =>
164
179
  })();
165
180
 
166
181
  export const Sortable = () => {
167
- // @ts-ignore
168
- const sortDescending = (arrOfObj, key) =>
182
+ const sortDescending = (arrOfObj: SortableRow[], key: string) =>
169
183
  [...arrOfObj].sort((a, b) => (b[key] > a[key] ? 1 : -1));
170
- // @ts-ignore
171
- const sortAscending = (arrOfObj, key) =>
184
+ const sortAscending = (arrOfObj: SortableRow[], key: string) =>
172
185
  [...arrOfObj].sort((a, b) => (a[key] > b[key] ? 1 : -1));
173
- const getNewSortDirection = (event: any, currentSortedColumn: any) => {
186
+ const getNewSortDirection = (
187
+ sortedKey: string,
188
+ currentSortedColumn: SortedColumn
189
+ ) => {
174
190
  if (
175
- event.sortedKey === currentSortedColumn.dataKey &&
191
+ sortedKey === currentSortedColumn.dataKey &&
176
192
  currentSortedColumn.sortDirection === 'ascending'
177
193
  )
178
194
  return 'descending';
179
195
  return 'ascending';
180
196
  };
181
- const initialData = [
197
+ const initialData: SortableRow[] = [
182
198
  { id: 1, color: 'red', flavor: 'vanilla' },
183
199
  { id: 2, color: 'green', flavor: 'strawberry' },
184
200
  { id: 3, color: 'blue', flavor: 'chocolate' },
185
201
  ];
186
- const [sortedColumn, setSortedColumn] = useState<any>({});
187
- const [tableData, setTableData] = useState(initialData);
188
- const handleSort = (event: any) => {
189
- const newSortDirection = getNewSortDirection(event, sortedColumn);
202
+ const [sortedColumn, setSortedColumn] = useState<SortedColumn>({});
203
+ const [tableData, setTableData] = useState<SortableRow[]>(initialData);
204
+ const handleSort = (event: EventWithColumnKey) => {
205
+ const sortedKey =
206
+ typeof event.sortedKey === 'string' ? event.sortedKey : undefined;
207
+ if (!sortedKey) {
208
+ return;
209
+ }
210
+ const newSortDirection = getNewSortDirection(sortedKey, sortedColumn);
190
211
  setSortedColumn({
191
- dataKey: event.sortedKey,
212
+ dataKey: sortedKey,
192
213
  sortDirection: newSortDirection,
193
214
  });
194
215
  };
@@ -218,38 +239,45 @@ export const Sortable = () => {
218
239
  };
219
240
 
220
241
  export const SortablewithDefaultSortedColumn = () => {
221
- // @ts-ignore
222
- const sortDescending = (arrOfObj, key) =>
242
+ const sortDescending = (arrOfObj: SortableRow[], key: string) =>
223
243
  [...arrOfObj].sort((a, b) => (b[key] > a[key] ? 1 : -1));
224
- // @ts-ignore
225
- const sortAscending = (arrOfObj, key) =>
244
+ const sortAscending = (arrOfObj: SortableRow[], key: string) =>
226
245
  [...arrOfObj].sort((a, b) => (a[key] > b[key] ? 1 : -1));
227
- const getNewSortDirection = (event: any, currentSortedColumn: any) => {
246
+ const getNewSortDirection = (
247
+ sortedKey: string,
248
+ currentSortedColumn: SortedColumn
249
+ ) => {
228
250
  if (
229
- event.sortedKey === currentSortedColumn.dataKey &&
251
+ sortedKey === currentSortedColumn.dataKey &&
230
252
  currentSortedColumn.sortDirection === 'ascending'
231
253
  )
232
254
  return 'descending';
233
255
  return 'ascending';
234
256
  };
235
- const initialData = [
257
+ const initialData: SortableRow[] = [
236
258
  { id: 1, color: 'red', flavor: 'vanilla' },
237
259
  { id: 2, color: 'green', flavor: 'strawberry' },
238
260
  { id: 3, color: 'blue', flavor: 'chocolate' },
239
261
  ];
240
- const [sortedColumn, setSortedColumn] = useState<any>({
262
+ const [sortedColumn, setSortedColumn] = useState<SortedColumn>({
241
263
  dataKey: 'color',
242
264
  sortDirection: 'descending',
243
265
  });
244
- const [tableData, setTableData] = useState([
245
- ...(sortedColumn.sortDirecton === 'ascending'
246
- ? sortAscending(initialData, sortedColumn.dataKey)
247
- : sortDescending(initialData, sortedColumn.dataKey)),
266
+ const initialSortKey = sortedColumn.dataKey ?? 'color';
267
+ const [tableData, setTableData] = useState<SortableRow[]>([
268
+ ...(sortedColumn.sortDirection === 'ascending'
269
+ ? sortAscending(initialData, initialSortKey)
270
+ : sortDescending(initialData, initialSortKey)),
248
271
  ]);
249
- const handleSort = (event: any) => {
250
- const newSortDirection = getNewSortDirection(event, sortedColumn);
272
+ const handleSort = (event: EventWithColumnKey) => {
273
+ const sortedKey =
274
+ typeof event.sortedKey === 'string' ? event.sortedKey : undefined;
275
+ if (!sortedKey) {
276
+ return;
277
+ }
278
+ const newSortDirection = getNewSortDirection(sortedKey, sortedColumn);
251
279
  setSortedColumn({
252
- dataKey: event.sortedKey,
280
+ dataKey: sortedKey,
253
281
  sortDirection: newSortDirection,
254
282
  });
255
283
  };
@@ -279,31 +307,37 @@ export const SortablewithDefaultSortedColumn = () => {
279
307
  };
280
308
 
281
309
  export const SortableAndLoading = () => {
282
- // @ts-ignore
283
- const sortDescending = (arrOfObj, key) =>
310
+ const sortDescending = (arrOfObj: SortableRow[], key: string) =>
284
311
  [...arrOfObj].sort((a, b) => (b[key] > a[key] ? 1 : -1));
285
- // @ts-ignore
286
- const sortAscending = (arrOfObj, key) =>
312
+ const sortAscending = (arrOfObj: SortableRow[], key: string) =>
287
313
  [...arrOfObj].sort((a, b) => (a[key] > b[key] ? 1 : -1));
288
- const getNewSortDirection = (event: any, currentSortedColumn: any) => {
314
+ const getNewSortDirection = (
315
+ sortedKey: string,
316
+ currentSortedColumn: SortedColumn
317
+ ) => {
289
318
  if (
290
- event.sortedKey === currentSortedColumn.dataKey &&
319
+ sortedKey === currentSortedColumn.dataKey &&
291
320
  currentSortedColumn.sortDirection === 'ascending'
292
321
  )
293
322
  return 'descending';
294
323
  return 'ascending';
295
324
  };
296
- const initialData = [
325
+ const initialData: SortableRow[] = [
297
326
  { id: 1, color: 'red', flavor: 'vanilla' },
298
327
  { id: 2, color: 'green', flavor: 'strawberry' },
299
328
  { id: 3, color: 'blue', flavor: 'chocolate' },
300
329
  ];
301
- const [sortedColumn, setSortedColumn] = useState<any>({});
302
- const [tableData, setTableData] = useState(initialData);
303
- const handleSort = (event: any) => {
304
- const newSortDirection = getNewSortDirection(event, sortedColumn);
330
+ const [sortedColumn, setSortedColumn] = useState<SortedColumn>({});
331
+ const [tableData, setTableData] = useState<SortableRow[]>(initialData);
332
+ const handleSort = (event: EventWithColumnKey) => {
333
+ const sortedKey =
334
+ typeof event.sortedKey === 'string' ? event.sortedKey : undefined;
335
+ if (!sortedKey) {
336
+ return;
337
+ }
338
+ const newSortDirection = getNewSortDirection(sortedKey, sortedColumn);
305
339
  setSortedColumn({
306
- dataKey: event.sortedKey,
340
+ dataKey: sortedKey,
307
341
  sortDirection: newSortDirection,
308
342
  });
309
343
  };
@@ -652,13 +686,25 @@ export const TruncateOverflow = () =>
652
686
 
653
687
  export const CustomActions = () =>
654
688
  (() => {
655
- const renderFlavor = (cell: any, row: any, index: number) => {
656
- const rows = [{ href: cell.href, name: cell.name, id: row.id, index }];
689
+ const renderFlavor = (cell?: Cell, row?: Row, index?: number) => {
690
+ const flavorCell = cell as { href?: string; name?: string } | undefined;
691
+ const flavorRow = row as { id?: number } | undefined;
692
+ const rows = [
693
+ {
694
+ href: flavorCell?.href ?? '',
695
+ name: flavorCell?.name ?? '',
696
+ id: flavorRow?.id ?? 0,
697
+ index,
698
+ },
699
+ ];
657
700
  const columns = [
658
701
  {
659
702
  heading: 'Url',
660
703
  dataKey: 'href',
661
- render: (cell: any) => <a href={cell}>{cell}</a>,
704
+ render: (cell?: Cell) => {
705
+ const href = typeof cell === 'string' ? cell : '';
706
+ return <a href={href}>{href}</a>;
707
+ },
662
708
  },
663
709
  { heading: 'Name', dataKey: 'name' },
664
710
  { heading: 'ID', dataKey: 'id' },
@@ -672,7 +718,6 @@ export const CustomActions = () =>
672
718
  {
673
719
  heading: 'Based on the cell/row',
674
720
  dataKey: 'flavor',
675
- // @ts-ignore
676
721
  render: renderFlavor,
677
722
  },
678
723
  { heading: 'Any custom JSX', render: () => <Button>Do anything</Button> },
@@ -706,7 +751,12 @@ export const EmptyCellPlaceholder = () =>
706
751
  {
707
752
  heading: 'Price',
708
753
  dataKey: 'price',
709
- render: (cell: any) => (cell ? `$${cell}` : null),
754
+ render: (cell?: Cell) => {
755
+ if (typeof cell === 'number' || typeof cell === 'string') {
756
+ return cell ? `$${cell}` : null;
757
+ }
758
+ return null;
759
+ },
710
760
  emptyCellPlaceholder: '$0.00',
711
761
  },
712
762
  ];
@@ -261,3 +261,5 @@ export const TextInput: ForwardRefExoticComponent<TextInputProps> = forwardRef<
261
261
  );
262
262
  }
263
263
  );
264
+
265
+ TextInput.displayName = 'TextInput';
@@ -259,3 +259,5 @@ export const TextInputInset: ForwardRefExoticComponent<TextInputInsetProps> =
259
259
  );
260
260
  }
261
261
  );
262
+
263
+ TextInputInset.displayName = 'TextInputInset';