@carbon/react 1.29.1 → 1.30.0

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 (580) hide show
  1. package/es/_virtual/_rollupPluginBabelHelpers.js +16 -5
  2. package/es/components/Accordion/Accordion.Skeleton.js +0 -7
  3. package/es/components/Accordion/Accordion.js +1 -8
  4. package/es/components/Accordion/AccordionItem.js +5 -19
  5. package/es/components/AspectRatio/AspectRatio.js +0 -5
  6. package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +0 -3
  7. package/es/components/Breadcrumb/Breadcrumb.js +0 -3
  8. package/es/components/Breadcrumb/BreadcrumbItem.js +0 -7
  9. package/es/components/Button/Button.Skeleton.js +2 -7
  10. package/es/components/Button/Button.js +2 -36
  11. package/es/components/ButtonSet/ButtonSet.js +0 -2
  12. package/es/components/Checkbox/Checkbox.Skeleton.js +0 -1
  13. package/es/components/Checkbox/Checkbox.js +4 -20
  14. package/es/components/CheckboxGroup/CheckboxGroup.js +0 -11
  15. package/es/components/ClassPrefix/index.d.ts +26 -0
  16. package/es/components/ClassPrefix/index.js +0 -2
  17. package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +0 -5
  18. package/es/components/CodeSnippet/CodeSnippet.js +6 -45
  19. package/es/components/ComboBox/ComboBox.js +12 -79
  20. package/es/components/ComboBox/tools/filter.js +0 -1
  21. package/es/components/ComboButton/index.js +0 -14
  22. package/es/components/ComposedModal/ComposedModal.js +2 -32
  23. package/es/components/ComposedModal/ModalFooter.js +0 -21
  24. package/es/components/ComposedModal/ModalHeader.js +0 -12
  25. package/es/components/ContainedList/ContainedList.js +5 -32
  26. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -6
  27. package/es/components/ContentSwitcher/ContentSwitcher.js +11 -23
  28. package/es/components/ContextMenu/useContextMenu.js +1 -6
  29. package/es/components/Copy/Copy.js +8 -31
  30. package/es/components/CopyButton/CopyButton.js +0 -4
  31. package/es/components/DangerButton/DangerButton.js +0 -1
  32. package/es/components/DataTable/DataTable.js +171 -91
  33. package/es/components/DataTable/Table.js +0 -6
  34. package/es/components/DataTable/TableBatchAction.js +0 -4
  35. package/es/components/DataTable/TableBatchActions.js +0 -8
  36. package/es/components/DataTable/TableBody.js +0 -1
  37. package/es/components/DataTable/TableContainer.js +0 -5
  38. package/es/components/DataTable/TableExpandHeader.js +0 -7
  39. package/es/components/DataTable/TableExpandRow.js +0 -6
  40. package/es/components/DataTable/TableExpandedRow.js +0 -6
  41. package/es/components/DataTable/TableHeader.d.ts +1 -1
  42. package/es/components/DataTable/TableHeader.js +3 -19
  43. package/es/components/DataTable/TableRow.js +4 -5
  44. package/es/components/DataTable/TableSelectAll.js +0 -8
  45. package/es/components/DataTable/TableSelectRow.js +2 -10
  46. package/es/components/DataTable/TableToolbar.js +0 -3
  47. package/es/components/DataTable/TableToolbarMenu.d.ts +1 -1
  48. package/es/components/DataTable/TableToolbarMenu.js +3 -6
  49. package/es/components/DataTable/TableToolbarSearch.js +2 -30
  50. package/es/components/DataTable/state/getDerivedStateFromProps.js +0 -4
  51. package/es/components/DataTable/state/sorting.js +5 -8
  52. package/es/components/DataTable/tools/denormalize.js +2 -2
  53. package/es/components/DataTable/tools/filter.js +0 -2
  54. package/es/components/DataTable/tools/instanceId.js +0 -1
  55. package/es/components/DataTable/tools/normalize.js +10 -10
  56. package/es/components/DataTable/tools/sorting.js +5 -13
  57. package/es/components/DataTableSkeleton/DataTableSkeleton.js +5 -20
  58. package/es/components/DatePicker/DatePicker.Skeleton.js +0 -6
  59. package/es/components/DatePicker/DatePicker.js +153 -175
  60. package/es/components/DatePicker/plugins/appendToPlugin.js +3 -7
  61. package/es/components/DatePicker/plugins/fixEventsPlugin.js +14 -25
  62. package/es/components/DatePicker/plugins/rangePlugin.js +2 -7
  63. package/es/components/DatePickerInput/DatePickerInput.js +2 -28
  64. package/es/components/Dropdown/Dropdown.Skeleton.js +0 -2
  65. package/es/components/Dropdown/Dropdown.js +43 -52
  66. package/es/components/ErrorBoundary/ErrorBoundary.js +0 -10
  67. package/es/components/ErrorBoundary/ErrorBoundaryContext.js +0 -1
  68. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -10
  69. package/es/components/FeatureFlags/index.js +8 -20
  70. package/es/components/FileUploader/FileUploader.Skeleton.js +0 -2
  71. package/es/components/FileUploader/FileUploader.js +3 -38
  72. package/es/components/FileUploader/FileUploaderButton.js +3 -24
  73. package/es/components/FileUploader/FileUploaderDropContainer.js +1 -28
  74. package/es/components/FileUploader/FileUploaderItem.js +5 -12
  75. package/es/components/FileUploader/Filename.js +6 -10
  76. package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +0 -1
  77. package/es/components/FluidComboBox/FluidComboBox.js +0 -18
  78. package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +0 -2
  79. package/es/components/FluidDatePicker/FluidDatePicker.js +0 -6
  80. package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +2 -1
  81. package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +0 -1
  82. package/es/components/FluidDropdown/FluidDropdown.js +0 -18
  83. package/es/components/FluidForm/FluidForm.js +0 -2
  84. package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +0 -1
  85. package/es/components/FluidMultiSelect/FluidMultiSelect.js +0 -19
  86. package/es/components/FluidSelect/FluidSelect.Skeleton.js +0 -1
  87. package/es/components/FluidSelect/FluidSelect.js +0 -10
  88. package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +0 -1
  89. package/es/components/FluidTextArea/FluidTextArea.js +0 -20
  90. package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +0 -1
  91. package/es/components/FluidTextInput/FluidTextInput.js +0 -14
  92. package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +0 -3
  93. package/es/components/FluidTimePicker/FluidTimePicker.js +1 -11
  94. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +0 -6
  95. package/es/components/Form/Form.d.ts +23 -0
  96. package/es/components/Form/Form.js +3 -6
  97. package/es/components/Form/index.d.ts +7 -0
  98. package/es/components/FormGroup/FormGroup.js +0 -7
  99. package/es/components/FormItem/FormItem.js +0 -2
  100. package/es/components/FormLabel/FormLabel.js +1 -7
  101. package/es/components/Grid/CSSGrid.js +2 -15
  102. package/es/components/Grid/Column.js +18 -59
  103. package/es/components/Grid/ColumnHang.js +2 -5
  104. package/es/components/Grid/FlexGrid.js +2 -8
  105. package/es/components/Grid/Grid.js +0 -8
  106. package/es/components/Grid/GridContext.js +1 -3
  107. package/es/components/Grid/Row.js +2 -7
  108. package/es/components/Heading/index.js +0 -4
  109. package/es/components/Icon/Icon.Skeleton.js +2 -2
  110. package/es/components/IconButton/index.js +0 -10
  111. package/es/components/IdPrefix/index.js +0 -2
  112. package/es/components/InlineCheckbox/InlineCheckbox.js +0 -14
  113. package/es/components/InlineLoading/InlineLoading.js +0 -12
  114. package/es/components/Layer/index.js +3 -6
  115. package/es/components/Layout/LayoutDirection.js +0 -3
  116. package/es/components/Layout/useLayoutDirection.js +0 -1
  117. package/es/components/Link/Link.js +3 -10
  118. package/es/components/ListBox/ListBox.js +2 -13
  119. package/es/components/ListBox/ListBoxField.js +0 -5
  120. package/es/components/ListBox/ListBoxMenuIcon.js +0 -4
  121. package/es/components/ListBox/ListBoxMenuItem.js +2 -6
  122. package/es/components/ListBox/ListBoxPropTypes.d.ts +2 -2
  123. package/es/components/ListBox/ListBoxSelection.js +1 -13
  124. package/es/components/ListBox/next/ListBoxSelection.js +1 -14
  125. package/es/components/ListBox/next/ListBoxTrigger.js +1 -3
  126. package/es/components/ListItem/ListItem.d.ts +23 -0
  127. package/es/components/ListItem/ListItem.js +4 -8
  128. package/es/components/ListItem/index.d.ts +7 -0
  129. package/es/components/Loading/Loading.js +0 -6
  130. package/es/components/Menu/Menu.js +22 -40
  131. package/es/components/Menu/MenuContext.js +4 -5
  132. package/es/components/Menu/MenuItem.js +5 -39
  133. package/es/components/MenuButton/index.js +0 -9
  134. package/es/components/Modal/Modal.js +1 -46
  135. package/es/components/ModalWrapper/ModalWrapper.js +2 -15
  136. package/es/components/MultiSelect/FilterableMultiSelect.js +2 -60
  137. package/es/components/MultiSelect/MultiSelect.js +22 -70
  138. package/es/components/MultiSelect/MultiSelectPropTypes.js +0 -1
  139. package/es/components/MultiSelect/index.js +0 -1
  140. package/es/components/MultiSelect/tools/itemToString.js +0 -2
  141. package/es/components/MultiSelect/tools/sorting.js +3 -4
  142. package/es/components/Notification/Notification.js +0 -78
  143. package/es/components/NumberInput/NumberInput.Skeleton.js +0 -2
  144. package/es/components/NumberInput/NumberInput.js +3 -60
  145. package/es/components/OrderedList/OrderedList.d.ts +39 -0
  146. package/es/components/OrderedList/OrderedList.js +7 -19
  147. package/es/components/{Form/index.js → OrderedList/index.d.ts} +1 -3
  148. package/es/components/OverflowMenu/OverflowMenu.js +65 -86
  149. package/es/components/OverflowMenuItem/OverflowMenuItem.js +6 -23
  150. package/es/components/OverflowMenuV2/index.js +0 -5
  151. package/es/components/Pagination/Pagination.Skeleton.js +0 -2
  152. package/es/components/Pagination/Pagination.js +11 -47
  153. package/es/components/Pagination/experimental/PageSelector.js +0 -10
  154. package/es/components/Pagination/experimental/Pagination.js +2 -48
  155. package/es/components/PaginationNav/PaginationNav.js +15 -59
  156. package/es/components/Popover/index.d.ts +14 -8
  157. package/es/components/Popover/index.js +44 -48
  158. package/es/components/PrimaryButton/PrimaryButton.js +0 -1
  159. package/es/components/ProgressBar/ProgressBar.js +0 -15
  160. package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +0 -4
  161. package/es/components/ProgressIndicator/ProgressIndicator.js +2 -40
  162. package/es/components/RadioButton/RadioButton.Skeleton.js +0 -1
  163. package/es/components/RadioButton/RadioButton.js +0 -13
  164. package/es/components/RadioButtonGroup/RadioButtonGroup.js +3 -23
  165. package/es/components/RadioTile/RadioTile.js +0 -12
  166. package/es/components/Search/Search.Skeleton.js +0 -2
  167. package/es/components/Search/Search.js +1 -28
  168. package/es/components/SecondaryButton/SecondaryButton.js +0 -1
  169. package/es/components/Select/Select.Skeleton.js +0 -2
  170. package/es/components/Select/Select.d.ts +1 -1
  171. package/es/components/Select/Select.js +6 -33
  172. package/es/components/SelectItem/SelectItem.js +0 -5
  173. package/es/components/SelectItemGroup/SelectItemGroup.d.ts +0 -1
  174. package/es/components/SelectItemGroup/SelectItemGroup.js +1 -7
  175. package/es/components/SkeletonIcon/SkeletonIcon.js +0 -2
  176. package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +0 -1
  177. package/es/components/SkeletonText/SkeletonText.js +0 -12
  178. package/es/components/Slider/Slider.Skeleton.js +0 -2
  179. package/es/components/Slider/Slider.d.ts +0 -1
  180. package/es/components/Slider/Slider.js +112 -135
  181. package/es/components/Stack/Stack.js +1 -8
  182. package/es/components/StructuredList/StructuredList.Skeleton.js +0 -5
  183. package/es/components/StructuredList/StructuredList.js +1 -25
  184. package/es/components/Switch/IconSwitch.js +0 -18
  185. package/es/components/Switch/Switch.js +0 -11
  186. package/es/components/TabContent/TabContent.js +2 -6
  187. package/es/components/Tabs/Tabs.Skeleton.js +0 -4
  188. package/es/components/Tabs/Tabs.js +135 -104
  189. package/es/components/Tabs/usePressable.js +18 -31
  190. package/es/components/Tag/Tag.Skeleton.js +0 -2
  191. package/es/components/Tag/Tag.js +0 -15
  192. package/es/components/Text/Text.js +5 -18
  193. package/es/components/Text/TextDirection.js +0 -3
  194. package/es/components/Text/TextDirectionContext.js +0 -1
  195. package/es/components/Text/createTextComponent.js +0 -3
  196. package/es/components/TextArea/TextArea.Skeleton.js +0 -2
  197. package/es/components/TextArea/TextArea.js +11 -33
  198. package/es/components/TextInput/ControlledPasswordInput.js +0 -20
  199. package/es/components/TextInput/PasswordInput.js +0 -25
  200. package/es/components/TextInput/TextInput.Skeleton.js +0 -2
  201. package/es/components/TextInput/TextInput.d.ts +1 -1
  202. package/es/components/TextInput/TextInput.js +5 -33
  203. package/es/components/TextInput/util.js +3 -5
  204. package/es/components/Theme/index.js +1 -6
  205. package/es/components/Tile/Tile.js +32 -59
  206. package/es/components/TileGroup/TileGroup.js +1 -22
  207. package/es/components/TimePicker/TimePicker.js +6 -32
  208. package/es/components/TimePickerSelect/TimePickerSelect.js +2 -5
  209. package/es/components/Toggle/Toggle.Skeleton.js +0 -8
  210. package/es/components/Toggle/Toggle.js +0 -16
  211. package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +0 -7
  212. package/es/components/Toggletip/index.d.ts +148 -0
  213. package/es/components/Toggletip/index.js +20 -44
  214. package/es/components/Tooltip/DefinitionTooltip.js +0 -11
  215. package/es/components/Tooltip/Tooltip.d.ts +1 -1
  216. package/es/components/Tooltip/Tooltip.js +4 -21
  217. package/es/components/TreeView/TreeNode.js +21 -66
  218. package/es/components/TreeView/TreeView.js +11 -67
  219. package/es/components/UIShell/Content.js +2 -4
  220. package/es/components/UIShell/Header.js +0 -2
  221. package/es/components/UIShell/HeaderContainer.d.ts +33 -0
  222. package/es/components/UIShell/HeaderContainer.js +13 -11
  223. package/es/components/UIShell/HeaderGlobalAction.js +0 -6
  224. package/es/components/UIShell/HeaderGlobalBar.js +0 -1
  225. package/es/components/UIShell/HeaderMenu.js +32 -31
  226. package/es/components/UIShell/HeaderMenuButton.js +2 -4
  227. package/es/components/UIShell/HeaderMenuItem.js +0 -8
  228. package/es/components/UIShell/HeaderName.js +0 -5
  229. package/es/components/UIShell/HeaderNavigation.js +0 -2
  230. package/es/components/UIShell/HeaderPanel.js +0 -2
  231. package/es/components/UIShell/HeaderSideNavItems.js +0 -2
  232. package/es/components/UIShell/Link.js +2 -3
  233. package/es/components/UIShell/SideNav.d.ts +3 -1
  234. package/es/components/UIShell/SideNav.js +44 -36
  235. package/es/components/UIShell/SideNavDetails.js +0 -3
  236. package/es/components/UIShell/SideNavDivider.js +0 -1
  237. package/es/components/UIShell/SideNavFooter.js +1 -4
  238. package/es/components/UIShell/SideNavHeader.js +0 -4
  239. package/es/components/UIShell/SideNavIcon.js +0 -3
  240. package/es/components/UIShell/SideNavItem.js +0 -3
  241. package/es/components/UIShell/SideNavItems.js +2 -6
  242. package/es/components/UIShell/SideNavLink.js +3 -7
  243. package/es/components/UIShell/SideNavLinkText.js +0 -2
  244. package/es/components/UIShell/SideNavMenu.js +0 -16
  245. package/es/components/UIShell/SideNavMenuItem.js +0 -2
  246. package/es/components/UIShell/SideNavSwitcher.js +2 -5
  247. package/es/components/UIShell/SkipToContent.d.ts +32 -0
  248. package/es/components/UIShell/SkipToContent.js +8 -15
  249. package/es/components/UIShell/Switcher.js +0 -2
  250. package/es/components/UIShell/SwitcherDivider.js +0 -1
  251. package/es/components/UIShell/SwitcherItem.js +0 -3
  252. package/es/components/UnorderedList/UnorderedList.d.ts +34 -0
  253. package/es/components/UnorderedList/UnorderedList.js +6 -16
  254. package/es/components/UnorderedList/index.d.ts +7 -0
  255. package/es/index.js +7 -8
  256. package/es/internal/ClickListener.js +3 -13
  257. package/es/internal/FloatingMenu.js +57 -63
  258. package/es/internal/OptimizedResize.js +6 -12
  259. package/es/internal/Selection.js +2 -25
  260. package/es/internal/createClassWrapper.js +0 -2
  261. package/es/internal/deprecateFieldOnObject.js +0 -4
  262. package/es/internal/focus/index.js +0 -1
  263. package/es/internal/keyboard/keys.js +2 -1
  264. package/es/internal/keyboard/match.js +1 -6
  265. package/es/internal/keyboard/navigation.js +8 -7
  266. package/es/internal/useAnnouncer.js +0 -1
  267. package/es/internal/useAttachedMenu.js +1 -9
  268. package/es/internal/useControllableState.js +6 -13
  269. package/es/internal/useDelayedState.js +2 -4
  270. package/es/internal/useEffectOnce.js +0 -1
  271. package/es/internal/useEvent.js +61 -3
  272. package/es/internal/useId.js +2 -5
  273. package/es/internal/useIsomorphicEffect.js +1 -0
  274. package/es/internal/useMergedRefs.js +2 -2
  275. package/es/internal/useNoInteractiveChildren.js +2 -13
  276. package/es/internal/useNormalizedInputProps.js +0 -3
  277. package/es/internal/useSavedCallback.js +0 -1
  278. package/es/internal/warning.js +0 -3
  279. package/es/internal/wrapFocus.js +1 -8
  280. package/es/prop-types/deprecate.js +2 -5
  281. package/es/prop-types/isRequiredOneOf.js +2 -5
  282. package/es/prop-types/requiredIfGivenPropIsTruthy.js +0 -2
  283. package/es/tools/array.js +0 -3
  284. package/es/tools/events.js +0 -3
  285. package/es/tools/mergeRefs.js +0 -2
  286. package/es/tools/wrapComponent.js +2 -5
  287. package/lib/_virtual/_rollupPluginBabelHelpers.js +17 -4
  288. package/lib/components/Accordion/Accordion.Skeleton.js +0 -7
  289. package/lib/components/Accordion/Accordion.js +1 -27
  290. package/lib/components/Accordion/AccordionItem.js +5 -19
  291. package/lib/components/AspectRatio/AspectRatio.js +0 -5
  292. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +0 -3
  293. package/lib/components/Breadcrumb/Breadcrumb.js +0 -3
  294. package/lib/components/Breadcrumb/BreadcrumbItem.js +0 -7
  295. package/lib/components/Button/Button.Skeleton.js +2 -26
  296. package/lib/components/Button/Button.js +2 -36
  297. package/lib/components/ButtonSet/ButtonSet.js +0 -2
  298. package/lib/components/Checkbox/Checkbox.Skeleton.js +0 -1
  299. package/lib/components/Checkbox/Checkbox.js +4 -20
  300. package/lib/components/CheckboxGroup/CheckboxGroup.js +0 -11
  301. package/lib/components/ClassPrefix/index.d.ts +26 -0
  302. package/lib/components/ClassPrefix/index.js +0 -2
  303. package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +0 -5
  304. package/lib/components/CodeSnippet/CodeSnippet.js +6 -45
  305. package/lib/components/ComboBox/ComboBox.js +19 -86
  306. package/lib/components/ComboBox/tools/filter.js +0 -1
  307. package/lib/components/ComboButton/index.js +0 -14
  308. package/lib/components/ComposedModal/ComposedModal.js +2 -32
  309. package/lib/components/ComposedModal/ModalFooter.js +0 -21
  310. package/lib/components/ComposedModal/ModalHeader.js +0 -12
  311. package/lib/components/ContainedList/ContainedList.js +5 -32
  312. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -6
  313. package/lib/components/ContentSwitcher/ContentSwitcher.js +11 -23
  314. package/lib/components/ContextMenu/useContextMenu.js +1 -6
  315. package/lib/components/Copy/Copy.js +8 -50
  316. package/lib/components/CopyButton/CopyButton.js +0 -4
  317. package/lib/components/DangerButton/DangerButton.js +0 -1
  318. package/lib/components/DataTable/DataTable.js +171 -91
  319. package/lib/components/DataTable/Table.js +0 -6
  320. package/lib/components/DataTable/TableBatchAction.js +0 -4
  321. package/lib/components/DataTable/TableBatchActions.js +0 -8
  322. package/lib/components/DataTable/TableBody.js +0 -1
  323. package/lib/components/DataTable/TableContainer.js +0 -5
  324. package/lib/components/DataTable/TableExpandHeader.js +0 -7
  325. package/lib/components/DataTable/TableExpandRow.js +0 -6
  326. package/lib/components/DataTable/TableExpandedRow.js +0 -6
  327. package/lib/components/DataTable/TableHeader.d.ts +1 -1
  328. package/lib/components/DataTable/TableHeader.js +3 -19
  329. package/lib/components/DataTable/TableRow.js +4 -5
  330. package/lib/components/DataTable/TableSelectAll.js +0 -8
  331. package/lib/components/DataTable/TableSelectRow.js +2 -10
  332. package/lib/components/DataTable/TableToolbar.js +0 -3
  333. package/lib/components/DataTable/TableToolbarMenu.d.ts +1 -1
  334. package/lib/components/DataTable/TableToolbarMenu.js +3 -6
  335. package/lib/components/DataTable/TableToolbarSearch.js +2 -30
  336. package/lib/components/DataTable/state/getDerivedStateFromProps.js +0 -4
  337. package/lib/components/DataTable/state/sorting.js +5 -8
  338. package/lib/components/DataTable/tools/denormalize.js +2 -2
  339. package/lib/components/DataTable/tools/filter.js +0 -2
  340. package/lib/components/DataTable/tools/instanceId.js +0 -1
  341. package/lib/components/DataTable/tools/normalize.js +10 -10
  342. package/lib/components/DataTable/tools/sorting.js +5 -13
  343. package/lib/components/DataTableSkeleton/DataTableSkeleton.js +5 -20
  344. package/lib/components/DatePicker/DatePicker.Skeleton.js +0 -6
  345. package/lib/components/DatePicker/DatePicker.js +153 -175
  346. package/lib/components/DatePicker/plugins/appendToPlugin.js +3 -7
  347. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +14 -25
  348. package/lib/components/DatePicker/plugins/rangePlugin.js +2 -7
  349. package/lib/components/DatePickerInput/DatePickerInput.js +2 -28
  350. package/lib/components/Dropdown/Dropdown.Skeleton.js +0 -2
  351. package/lib/components/Dropdown/Dropdown.js +50 -59
  352. package/lib/components/ErrorBoundary/ErrorBoundary.js +0 -10
  353. package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +0 -1
  354. package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -10
  355. package/lib/components/FeatureFlags/index.js +8 -20
  356. package/lib/components/FileUploader/FileUploader.Skeleton.js +0 -2
  357. package/lib/components/FileUploader/FileUploader.js +3 -57
  358. package/lib/components/FileUploader/FileUploaderButton.js +3 -43
  359. package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -28
  360. package/lib/components/FileUploader/FileUploaderItem.js +5 -31
  361. package/lib/components/FileUploader/Filename.js +6 -10
  362. package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +0 -1
  363. package/lib/components/FluidComboBox/FluidComboBox.js +0 -18
  364. package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +0 -2
  365. package/lib/components/FluidDatePicker/FluidDatePicker.js +0 -6
  366. package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +2 -1
  367. package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +0 -1
  368. package/lib/components/FluidDropdown/FluidDropdown.js +0 -18
  369. package/lib/components/FluidForm/FluidForm.js +0 -2
  370. package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +0 -1
  371. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +0 -19
  372. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +0 -1
  373. package/lib/components/FluidSelect/FluidSelect.js +0 -10
  374. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +0 -1
  375. package/lib/components/FluidTextArea/FluidTextArea.js +0 -20
  376. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +0 -1
  377. package/lib/components/FluidTextInput/FluidTextInput.js +0 -14
  378. package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +0 -3
  379. package/lib/components/FluidTimePicker/FluidTimePicker.js +1 -11
  380. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +0 -6
  381. package/lib/components/Form/Form.d.ts +23 -0
  382. package/lib/components/Form/Form.js +3 -6
  383. package/lib/components/Form/index.d.ts +7 -0
  384. package/lib/components/FormGroup/FormGroup.js +0 -7
  385. package/lib/components/FormItem/FormItem.js +0 -2
  386. package/lib/components/FormLabel/FormLabel.js +1 -26
  387. package/lib/components/Grid/CSSGrid.js +2 -15
  388. package/lib/components/Grid/Column.js +18 -59
  389. package/lib/components/Grid/ColumnHang.js +2 -5
  390. package/lib/components/Grid/FlexGrid.js +2 -8
  391. package/lib/components/Grid/Grid.js +0 -8
  392. package/lib/components/Grid/GridContext.js +1 -3
  393. package/lib/components/Grid/Row.js +2 -7
  394. package/lib/components/Heading/index.js +0 -4
  395. package/lib/components/Icon/Icon.Skeleton.js +2 -2
  396. package/lib/components/IconButton/index.js +0 -10
  397. package/lib/components/IdPrefix/index.js +0 -2
  398. package/lib/components/InlineCheckbox/InlineCheckbox.js +0 -14
  399. package/lib/components/InlineLoading/InlineLoading.js +0 -12
  400. package/lib/components/Layer/index.js +3 -6
  401. package/lib/components/Layout/LayoutDirection.js +0 -3
  402. package/lib/components/Layout/useLayoutDirection.js +0 -1
  403. package/lib/components/Link/Link.js +3 -10
  404. package/lib/components/ListBox/ListBox.js +2 -13
  405. package/lib/components/ListBox/ListBoxField.js +0 -5
  406. package/lib/components/ListBox/ListBoxMenuIcon.js +0 -4
  407. package/lib/components/ListBox/ListBoxMenuItem.js +2 -6
  408. package/lib/components/ListBox/ListBoxPropTypes.d.ts +2 -2
  409. package/lib/components/ListBox/ListBoxSelection.js +1 -13
  410. package/lib/components/ListBox/next/ListBoxSelection.js +1 -14
  411. package/lib/components/ListBox/next/ListBoxTrigger.js +1 -3
  412. package/lib/components/ListItem/ListItem.d.ts +23 -0
  413. package/lib/components/ListItem/ListItem.js +4 -8
  414. package/lib/components/ListItem/index.d.ts +7 -0
  415. package/lib/components/Loading/Loading.js +0 -6
  416. package/lib/components/Menu/Menu.js +22 -40
  417. package/lib/components/Menu/MenuContext.js +4 -5
  418. package/lib/components/Menu/MenuItem.js +5 -39
  419. package/lib/components/MenuButton/index.js +0 -9
  420. package/lib/components/Modal/Modal.js +1 -46
  421. package/lib/components/ModalWrapper/ModalWrapper.js +2 -15
  422. package/lib/components/MultiSelect/FilterableMultiSelect.js +8 -66
  423. package/lib/components/MultiSelect/MultiSelect.js +30 -78
  424. package/lib/components/MultiSelect/MultiSelectPropTypes.js +0 -1
  425. package/lib/components/MultiSelect/index.js +0 -1
  426. package/lib/components/MultiSelect/tools/itemToString.js +0 -2
  427. package/lib/components/MultiSelect/tools/sorting.js +3 -4
  428. package/lib/components/Notification/Notification.js +0 -78
  429. package/lib/components/NumberInput/NumberInput.Skeleton.js +0 -2
  430. package/lib/components/NumberInput/NumberInput.js +3 -60
  431. package/lib/components/OrderedList/OrderedList.d.ts +39 -0
  432. package/lib/components/OrderedList/OrderedList.js +7 -19
  433. package/lib/components/OrderedList/index.d.ts +7 -0
  434. package/lib/components/OverflowMenu/OverflowMenu.js +65 -86
  435. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +6 -23
  436. package/lib/components/OverflowMenuV2/index.js +0 -5
  437. package/lib/components/Pagination/Pagination.Skeleton.js +0 -2
  438. package/lib/components/Pagination/Pagination.js +11 -47
  439. package/lib/components/Pagination/experimental/PageSelector.js +0 -10
  440. package/lib/components/Pagination/experimental/Pagination.js +2 -67
  441. package/lib/components/PaginationNav/PaginationNav.js +15 -78
  442. package/lib/components/Popover/index.d.ts +14 -8
  443. package/lib/components/Popover/index.js +44 -48
  444. package/lib/components/PrimaryButton/PrimaryButton.js +0 -1
  445. package/lib/components/ProgressBar/ProgressBar.js +0 -15
  446. package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +0 -4
  447. package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -40
  448. package/lib/components/RadioButton/RadioButton.Skeleton.js +0 -1
  449. package/lib/components/RadioButton/RadioButton.js +0 -13
  450. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +3 -23
  451. package/lib/components/RadioTile/RadioTile.js +0 -12
  452. package/lib/components/Search/Search.Skeleton.js +0 -2
  453. package/lib/components/Search/Search.js +1 -28
  454. package/lib/components/SecondaryButton/SecondaryButton.js +0 -1
  455. package/lib/components/Select/Select.Skeleton.js +0 -2
  456. package/lib/components/Select/Select.d.ts +1 -1
  457. package/lib/components/Select/Select.js +6 -33
  458. package/lib/components/SelectItem/SelectItem.js +0 -5
  459. package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +0 -1
  460. package/lib/components/SelectItemGroup/SelectItemGroup.js +1 -26
  461. package/lib/components/SkeletonIcon/SkeletonIcon.js +0 -2
  462. package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +0 -1
  463. package/lib/components/SkeletonText/SkeletonText.js +0 -12
  464. package/lib/components/Slider/Slider.Skeleton.js +0 -2
  465. package/lib/components/Slider/Slider.d.ts +0 -1
  466. package/lib/components/Slider/Slider.js +112 -154
  467. package/lib/components/Stack/Stack.js +1 -8
  468. package/lib/components/StructuredList/StructuredList.Skeleton.js +0 -5
  469. package/lib/components/StructuredList/StructuredList.js +1 -25
  470. package/lib/components/Switch/IconSwitch.js +0 -18
  471. package/lib/components/Switch/Switch.js +0 -11
  472. package/lib/components/TabContent/TabContent.js +2 -6
  473. package/lib/components/Tabs/Tabs.Skeleton.js +0 -4
  474. package/lib/components/Tabs/Tabs.js +133 -102
  475. package/lib/components/Tabs/usePressable.js +18 -31
  476. package/lib/components/Tag/Tag.Skeleton.js +0 -2
  477. package/lib/components/Tag/Tag.js +0 -15
  478. package/lib/components/Text/Text.js +5 -18
  479. package/lib/components/Text/TextDirection.js +0 -3
  480. package/lib/components/Text/TextDirectionContext.js +0 -1
  481. package/lib/components/Text/createTextComponent.js +0 -3
  482. package/lib/components/TextArea/TextArea.Skeleton.js +0 -2
  483. package/lib/components/TextArea/TextArea.js +10 -32
  484. package/lib/components/TextInput/ControlledPasswordInput.js +0 -20
  485. package/lib/components/TextInput/PasswordInput.js +0 -25
  486. package/lib/components/TextInput/TextInput.Skeleton.js +0 -2
  487. package/lib/components/TextInput/TextInput.d.ts +1 -1
  488. package/lib/components/TextInput/TextInput.js +5 -52
  489. package/lib/components/TextInput/util.js +3 -5
  490. package/lib/components/Theme/index.js +1 -6
  491. package/lib/components/Tile/Tile.js +31 -58
  492. package/lib/components/TileGroup/TileGroup.js +1 -22
  493. package/lib/components/TimePicker/TimePicker.js +6 -32
  494. package/lib/components/TimePickerSelect/TimePickerSelect.js +2 -5
  495. package/lib/components/Toggle/Toggle.Skeleton.js +0 -8
  496. package/lib/components/Toggle/Toggle.js +0 -16
  497. package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +0 -7
  498. package/lib/components/Toggletip/index.d.ts +148 -0
  499. package/lib/components/Toggletip/index.js +20 -44
  500. package/lib/components/Tooltip/DefinitionTooltip.js +0 -11
  501. package/lib/components/Tooltip/Tooltip.d.ts +1 -1
  502. package/lib/components/Tooltip/Tooltip.js +4 -21
  503. package/lib/components/TreeView/TreeNode.js +21 -66
  504. package/lib/components/TreeView/TreeView.js +11 -67
  505. package/lib/components/UIShell/Content.js +2 -4
  506. package/lib/components/UIShell/Header.js +0 -2
  507. package/lib/components/UIShell/HeaderContainer.d.ts +33 -0
  508. package/lib/components/UIShell/HeaderContainer.js +13 -11
  509. package/lib/components/UIShell/HeaderGlobalAction.js +0 -6
  510. package/lib/components/UIShell/HeaderGlobalBar.js +0 -1
  511. package/lib/components/UIShell/HeaderMenu.js +32 -31
  512. package/lib/components/UIShell/HeaderMenuButton.js +2 -4
  513. package/lib/components/UIShell/HeaderMenuItem.js +0 -8
  514. package/lib/components/UIShell/HeaderName.js +0 -5
  515. package/lib/components/UIShell/HeaderNavigation.js +0 -2
  516. package/lib/components/UIShell/HeaderPanel.js +0 -2
  517. package/lib/components/UIShell/HeaderSideNavItems.js +0 -2
  518. package/lib/components/UIShell/Link.js +2 -3
  519. package/lib/components/UIShell/SideNav.d.ts +3 -1
  520. package/lib/components/UIShell/SideNav.js +43 -35
  521. package/lib/components/UIShell/SideNavDetails.js +0 -3
  522. package/lib/components/UIShell/SideNavDivider.js +0 -1
  523. package/lib/components/UIShell/SideNavFooter.js +1 -4
  524. package/lib/components/UIShell/SideNavHeader.js +0 -4
  525. package/lib/components/UIShell/SideNavIcon.js +0 -3
  526. package/lib/components/UIShell/SideNavItem.js +0 -3
  527. package/lib/components/UIShell/SideNavItems.js +2 -6
  528. package/lib/components/UIShell/SideNavLink.js +3 -7
  529. package/lib/components/UIShell/SideNavLinkText.js +0 -2
  530. package/lib/components/UIShell/SideNavMenu.js +0 -16
  531. package/lib/components/UIShell/SideNavMenuItem.js +0 -2
  532. package/lib/components/UIShell/SideNavSwitcher.js +2 -5
  533. package/lib/components/UIShell/SkipToContent.d.ts +32 -0
  534. package/lib/components/UIShell/SkipToContent.js +8 -15
  535. package/lib/components/UIShell/Switcher.js +0 -2
  536. package/lib/components/UIShell/SwitcherDivider.js +0 -1
  537. package/lib/components/UIShell/SwitcherItem.js +0 -3
  538. package/lib/components/UnorderedList/UnorderedList.d.ts +34 -0
  539. package/lib/components/UnorderedList/UnorderedList.js +6 -16
  540. package/lib/components/UnorderedList/index.d.ts +7 -0
  541. package/lib/index.js +42 -43
  542. package/lib/internal/ClickListener.js +3 -13
  543. package/lib/internal/FloatingMenu.js +57 -63
  544. package/lib/internal/OptimizedResize.js +6 -12
  545. package/lib/internal/Selection.js +2 -25
  546. package/lib/internal/createClassWrapper.js +0 -2
  547. package/lib/internal/deprecateFieldOnObject.js +0 -4
  548. package/lib/internal/focus/index.js +0 -1
  549. package/lib/internal/keyboard/keys.js +2 -1
  550. package/lib/internal/keyboard/match.js +1 -6
  551. package/lib/internal/keyboard/navigation.js +8 -7
  552. package/lib/internal/useAnnouncer.js +0 -1
  553. package/lib/internal/useAttachedMenu.js +1 -9
  554. package/lib/internal/useControllableState.js +6 -13
  555. package/lib/internal/useDelayedState.js +2 -4
  556. package/lib/internal/useEffectOnce.js +0 -1
  557. package/lib/internal/useEvent.js +61 -2
  558. package/lib/internal/useId.js +2 -5
  559. package/lib/internal/useIsomorphicEffect.js +1 -0
  560. package/lib/internal/useMergedRefs.js +2 -2
  561. package/lib/internal/useNoInteractiveChildren.js +2 -13
  562. package/lib/internal/useNormalizedInputProps.js +0 -3
  563. package/lib/internal/useSavedCallback.js +0 -1
  564. package/lib/internal/warning.js +0 -3
  565. package/lib/internal/wrapFocus.js +1 -8
  566. package/lib/prop-types/deprecate.js +2 -5
  567. package/lib/prop-types/isRequiredOneOf.js +2 -5
  568. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +0 -2
  569. package/lib/tools/array.js +0 -3
  570. package/lib/tools/events.js +0 -3
  571. package/lib/tools/mergeRefs.js +0 -2
  572. package/lib/tools/wrapComponent.js +2 -5
  573. package/package.json +9 -9
  574. package/es/components/Tab/Tab.js +0 -185
  575. package/es/components/Tab/index.js +0 -14
  576. package/es/components/TimePickerSelect/index.js +0 -13
  577. package/lib/components/Form/index.js +0 -17
  578. package/lib/components/Tab/Tab.js +0 -214
  579. package/lib/components/Tab/index.js +0 -39
  580. package/lib/components/TimePickerSelect/index.js +0 -38
@@ -8,59 +8,53 @@
8
8
  import window from 'window-or-global';
9
9
 
10
10
  // mdn resize function
11
-
12
11
  const OptimizedResize = function optimizedResize() {
13
12
  const callbacks = [];
14
- let running = false; // run the actual callbacks
13
+ let running = false;
15
14
 
15
+ // run the actual callbacks
16
16
  function runCallbacks() {
17
17
  callbacks.forEach(callback => {
18
18
  callback();
19
19
  });
20
20
  running = false;
21
- } // fired on resize event
22
-
21
+ }
23
22
 
23
+ // fired on resize event
24
24
  function resize() {
25
25
  if (!running) {
26
26
  running = true;
27
27
  window.requestAnimationFrame(runCallbacks);
28
28
  }
29
- } // adds callback to loop
30
-
29
+ }
31
30
 
31
+ // adds callback to loop
32
32
  function addCallback(callback) {
33
33
  if (callback) {
34
34
  const index = callbacks.indexOf(callback);
35
-
36
35
  if (index < 0) {
37
36
  callbacks.push(callback);
38
37
  }
39
38
  }
40
39
  }
41
-
42
40
  return {
43
41
  // public method to add additional callback
44
42
  add: callback => {
45
43
  if (!callbacks.length) {
46
44
  window.addEventListener('resize', resize);
47
45
  }
48
-
49
46
  addCallback(callback);
50
47
  return {
51
48
  release() {
52
49
  const index = callbacks.indexOf(callback);
53
-
54
50
  if (index >= 0) {
55
51
  callbacks.splice(index, 1);
56
52
  }
57
53
  }
58
-
59
54
  };
60
55
  }
61
56
  };
62
57
  }();
63
-
64
58
  var OptimizedResize$1 = OptimizedResize;
65
59
 
66
60
  export { OptimizedResize$1 as default };
@@ -18,7 +18,6 @@ function callOnChangeHandler(_ref) {
18
18
  onChangeHandlerUncontrolled,
19
19
  selectedItems
20
20
  } = _ref;
21
-
22
21
  if (isControlled) {
23
22
  if (isMounted && onChangeHandlerControlled) {
24
23
  onChangeHandlerControlled({
@@ -29,7 +28,6 @@ function callOnChangeHandler(_ref) {
29
28
  onChangeHandlerUncontrolled(selectedItems);
30
29
  }
31
30
  }
32
-
33
31
  function useSelection(_ref2) {
34
32
  let {
35
33
  disabled,
@@ -46,7 +44,6 @@ function useSelection(_ref2) {
46
44
  if (disabled) {
47
45
  return;
48
46
  }
49
-
50
47
  let selectedIndex;
51
48
  selectedItems.forEach((selectedItem, index) => {
52
49
  if (isEqual(selectedItem, item)) {
@@ -54,7 +51,6 @@ function useSelection(_ref2) {
54
51
  }
55
52
  });
56
53
  let newSelectedItems;
57
-
58
54
  if (selectedIndex === undefined) {
59
55
  newSelectedItems = selectedItems.concat(item);
60
56
  callOnChangeHandler({
@@ -66,7 +62,6 @@ function useSelection(_ref2) {
66
62
  });
67
63
  return;
68
64
  }
69
-
70
65
  newSelectedItems = removeAtIndex(selectedItems, selectedIndex);
71
66
  callOnChangeHandler({
72
67
  isControlled,
@@ -80,7 +75,6 @@ function useSelection(_ref2) {
80
75
  if (disabled) {
81
76
  return;
82
77
  }
83
-
84
78
  callOnChangeHandler({
85
79
  isControlled,
86
80
  isMounted: isMounted.current,
@@ -114,44 +108,36 @@ function useSelection(_ref2) {
114
108
  class Selection extends React__default.Component {
115
109
  constructor(props) {
116
110
  super(props);
117
-
118
111
  _defineProperty(this, "internalSetState", (stateToSet, callback) => this.setState(stateToSet, () => {
119
112
  if (callback) {
120
113
  callback();
121
114
  }
122
-
123
115
  if (this.props.onChange) {
124
116
  this.props.onChange(this.state);
125
117
  }
126
118
  }));
127
-
128
119
  _defineProperty(this, "handleClearSelection", () => {
129
120
  if (this.props.disabled) {
130
121
  return;
131
122
  }
132
-
133
123
  this.internalSetState({
134
124
  selectedItems: []
135
125
  });
136
126
  });
137
-
138
127
  _defineProperty(this, "handleSelectItem", item => {
139
128
  this.internalSetState(state => ({
140
129
  selectedItems: state.selectedItems.concat(item)
141
130
  }));
142
131
  });
143
-
144
132
  _defineProperty(this, "handleRemoveItem", index => {
145
133
  this.internalSetState(state => ({
146
134
  selectedItems: removeAtIndex(state.selectedItems, index)
147
135
  }));
148
136
  });
149
-
150
137
  _defineProperty(this, "handleOnItemChange", item => {
151
138
  if (this.props.disabled) {
152
139
  return;
153
140
  }
154
-
155
141
  const {
156
142
  selectedItems
157
143
  } = this.state;
@@ -161,20 +147,16 @@ class Selection extends React__default.Component {
161
147
  selectedIndex = index;
162
148
  }
163
149
  });
164
-
165
150
  if (selectedIndex === undefined) {
166
151
  this.handleSelectItem(item);
167
152
  return;
168
153
  }
169
-
170
154
  this.handleRemoveItem(selectedIndex);
171
155
  });
172
-
173
156
  this.state = {
174
157
  selectedItems: props.initialSelectedItems
175
158
  };
176
159
  }
177
-
178
160
  render() {
179
161
  const {
180
162
  children,
@@ -188,21 +170,18 @@ class Selection extends React__default.Component {
188
170
  onItemChange: this.handleOnItemChange,
189
171
  clearSelection: this.handleClearSelection
190
172
  };
191
-
192
173
  if (render !== undefined) {
193
174
  return render(renderProps);
194
175
  }
195
-
196
176
  if (children !== undefined) {
197
177
  return children(renderProps);
198
178
  }
199
-
200
179
  return null;
201
180
  }
181
+ }
202
182
 
203
- } // Generic utility for safely removing an element at a given index from an
183
+ // Generic utility for safely removing an element at a given index from an
204
184
  // array.
205
-
206
185
  _defineProperty(Selection, "propTypes", {
207
186
  children: PropTypes.func,
208
187
  disabled: PropTypes.bool,
@@ -210,11 +189,9 @@ _defineProperty(Selection, "propTypes", {
210
189
  onChange: PropTypes.func,
211
190
  render: PropTypes.func
212
191
  });
213
-
214
192
  _defineProperty(Selection, "defaultProps", {
215
193
  initialSelectedItems: []
216
194
  });
217
-
218
195
  const removeAtIndex = (array, index) => {
219
196
  const result = array.slice();
220
197
  result.splice(index, 1);
@@ -14,12 +14,10 @@ import React__default from 'react';
14
14
  * @param {ReactNode} Component
15
15
  * @returns {ReactNode}
16
16
  */
17
-
18
17
  function createClassWrapper(Component) {
19
18
  function ClassWrapper(props) {
20
19
  return /*#__PURE__*/React__default.createElement(Component, props);
21
20
  }
22
-
23
21
  const name = Component.displayName || Component.name;
24
22
  ClassWrapper.displayName = `ClassWrapper(${name})`;
25
23
  return ClassWrapper;
@@ -8,20 +8,16 @@
8
8
  import { warning } from './warning.js';
9
9
 
10
10
  const didWarnAboutDeprecation = {};
11
-
12
11
  function deprecateFieldOnObject(object, field, Component, message) {
13
12
  Object.defineProperty(object, field, {
14
13
  enumerable: true,
15
-
16
14
  get() {
17
15
  if (!didWarnAboutDeprecation[field]) {
18
16
  process.env.NODE_ENV !== "production" ? warning(false, message || `The ${field} field has been deprecated on the ${object.displayName} object. ` + `Please import and use ${Component.displayName || Component.name || 'the field'} directly.`) : void 0;
19
17
  didWarnAboutDeprecation[field] = true;
20
18
  }
21
-
22
19
  return Component;
23
20
  }
24
-
25
21
  });
26
22
  }
27
23
 
@@ -7,7 +7,6 @@
7
7
 
8
8
  function focus(elementOrRef) {
9
9
  const element = elementOrRef.current || elementOrRef;
10
-
11
10
  if (element && element.focus && document.activeElement !== element) {
12
11
  element.focus();
13
12
  }
@@ -18,7 +18,8 @@ const Enter = {
18
18
  code: 'Enter'
19
19
  };
20
20
  const Escape = {
21
- key: ['Escape', // IE11 Escape
21
+ key: ['Escape',
22
+ // IE11 Escape
22
23
  'Esc'],
23
24
  which: 27,
24
25
  keyCode: 27,
@@ -36,9 +36,9 @@ function matches(event, keysToMatch) {
36
36
  return true;
37
37
  }
38
38
  }
39
-
40
39
  return false;
41
40
  }
41
+
42
42
  /**
43
43
  * Check to see if the given key matches the corresponding keyboard event. Also
44
44
  * supports passing in the value directly if you can't used the given event.
@@ -57,7 +57,6 @@ function matches(event, keysToMatch) {
57
57
  * @param {Key} key
58
58
  * @returns {boolean}
59
59
  */
60
-
61
60
  function match(eventOrCode) {
62
61
  let {
63
62
  key,
@@ -65,19 +64,15 @@ function match(eventOrCode) {
65
64
  keyCode,
66
65
  code
67
66
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
68
-
69
67
  if (typeof eventOrCode === 'string') {
70
68
  return eventOrCode === key;
71
69
  }
72
-
73
70
  if (typeof eventOrCode === 'number') {
74
71
  return eventOrCode === which || eventOrCode === keyCode;
75
72
  }
76
-
77
73
  if (eventOrCode.key && Array.isArray(key)) {
78
74
  return key.indexOf(eventOrCode.key) !== -1;
79
75
  }
80
-
81
76
  return eventOrCode.key === key || eventOrCode.which === which || eventOrCode.keyCode === keyCode || eventOrCode.code === code;
82
77
  }
83
78
 
@@ -28,39 +28,40 @@ const getNextIndex = (key, index, arrayLength) => {
28
28
  if (match(key, ArrowRight)) {
29
29
  return (index + 1) % arrayLength;
30
30
  }
31
-
32
31
  if (match(key, ArrowLeft)) {
33
32
  return (index + arrayLength - 1) % arrayLength;
34
33
  }
35
34
  };
35
+
36
36
  /**
37
37
  * A flag `node.compareDocumentPosition(target)` returns,
38
38
  * that indicates `target` is located earlier than `node` in the document or `target` contains `node`.
39
39
  */
40
-
41
- const DOCUMENT_POSITION_BROAD_PRECEDING = // Checks `typeof Node` for `react-docgen`
40
+ const DOCUMENT_POSITION_BROAD_PRECEDING =
41
+ // Checks `typeof Node` for `react-docgen`
42
42
  typeof Node !== 'undefined' && Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINS;
43
+
43
44
  /**
44
45
  * A flag `node.compareDocumentPosition(target)` returns,
45
46
  * that indicates `target` is located later than `node` in the document or `node` contains `target`.
46
47
  */
47
-
48
- const DOCUMENT_POSITION_BROAD_FOLLOWING = // Checks `typeof Node` for `react-docgen`
48
+ const DOCUMENT_POSITION_BROAD_FOLLOWING =
49
+ // Checks `typeof Node` for `react-docgen`
49
50
  typeof Node !== 'undefined' && Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY;
51
+
50
52
  /**
51
53
  * CSS selector that selects major nodes that are sequential-focusable.
52
54
  */
53
-
54
55
  const selectorTabbable = `
55
56
  a[href], area[href], input:not([disabled]):not([tabindex='-1']),
56
57
  button:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']),
57
58
  textarea:not([disabled]):not([tabindex='-1']),
58
59
  iframe, object, embed, *[tabindex]:not([tabindex='-1']):not([disabled]), *[contenteditable=true]
59
60
  `;
61
+
60
62
  /**
61
63
  * CSS selector that selects major nodes that are click focusable
62
64
  */
63
-
64
65
  const selectorFocusable = `
65
66
  a[href], area[href], input:not([disabled]),
66
67
  button:not([disabled]),select:not([disabled]),
@@ -7,7 +7,6 @@
7
7
 
8
8
  function useAnnouncer(textCount, maxCount) {
9
9
  const lastTen = maxCount - 10;
10
-
11
10
  if (textCount >= lastTen) {
12
11
  return `${maxCount - textCount} characters left.`;
13
12
  }
@@ -23,14 +23,11 @@ import { useState } from 'react';
23
23
  * @param {Element|object} anchor The element or ref the menu should visually be attached to.
24
24
  * @returns {useAttachedMenuReturn}
25
25
  */
26
-
27
26
  function useAttachedMenu(anchor) {
28
27
  const [open, setOpen] = useState(false);
29
28
  const [position, setPosition] = useState([[-1, -1], [-1, -1]]);
30
-
31
29
  function openMenu() {
32
- const anchorEl = (anchor === null || anchor === void 0 ? void 0 : anchor.current) || anchor;
33
-
30
+ const anchorEl = anchor?.current || anchor;
34
31
  if (anchorEl) {
35
32
  const {
36
33
  left,
@@ -40,14 +37,11 @@ function useAttachedMenu(anchor) {
40
37
  } = anchorEl.getBoundingClientRect();
41
38
  setPosition([[left, right], [top, bottom]]);
42
39
  }
43
-
44
40
  setOpen(true);
45
41
  }
46
-
47
42
  function closeMenu() {
48
43
  setOpen(false);
49
44
  }
50
-
51
45
  function handleClick() {
52
46
  if (open) {
53
47
  closeMenu();
@@ -55,7 +49,6 @@ function useAttachedMenu(anchor) {
55
49
  openMenu();
56
50
  }
57
51
  }
58
-
59
52
  function handleMousedown(e) {
60
53
  // prevent default for mousedown on trigger element to avoid
61
54
  // the "blur" event from firing on the menu as this would close
@@ -63,7 +56,6 @@ function useAttachedMenu(anchor) {
63
56
  // "blur" event.
64
57
  e.preventDefault();
65
58
  }
66
-
67
59
  return {
68
60
  open,
69
61
  x: position[0],
@@ -29,7 +29,6 @@ import { warning } from './warning.js';
29
29
  * uncontrolled
30
30
  * @returns {[any, Function]}
31
31
  */
32
-
33
32
  function useControllableState(_ref) {
34
33
  let {
35
34
  defaultValue,
@@ -39,42 +38,36 @@ function useControllableState(_ref) {
39
38
  } = _ref;
40
39
  const [state, internalSetState] = useState(value ?? defaultValue);
41
40
  const controlled = useRef(null);
42
-
43
41
  if (controlled.current === null) {
44
42
  controlled.current = value !== undefined;
45
43
  }
46
-
47
44
  function setState(stateOrUpdater) {
48
45
  const value = typeof stateOrUpdater === 'function' ? stateOrUpdater(state) : stateOrUpdater;
49
-
50
46
  if (controlled.current === false) {
51
47
  internalSetState(value);
52
48
  }
53
-
54
49
  if (onChange) {
55
50
  onChange(value);
56
51
  }
57
52
  }
58
-
59
53
  useEffect(() => {
60
- const controlledValue = value !== undefined; // Uncontrolled -> Controlled
61
- // If the component prop is uncontrolled, the prop value should be undefined
54
+ const controlledValue = value !== undefined;
62
55
 
56
+ // Uncontrolled -> Controlled
57
+ // If the component prop is uncontrolled, the prop value should be undefined
63
58
  if (controlled.current === false && controlledValue) {
64
59
  process.env.NODE_ENV !== "production" ? warning(false, 'A component is changing an uncontrolled %s component to be controlled. ' + 'This is likely caused by the value changing to a defined value ' + 'from undefined. Decide between using a controlled or uncontrolled ' + 'value for the lifetime of the component. ' + 'More info: https://reactjs.org/link/controlled-components', name) : void 0;
65
- } // Controlled -> Uncontrolled
66
- // If the component prop is controlled, the prop value should be defined
67
-
60
+ }
68
61
 
62
+ // Controlled -> Uncontrolled
63
+ // If the component prop is controlled, the prop value should be defined
69
64
  if (controlled.current === true && !controlledValue) {
70
65
  process.env.NODE_ENV !== "production" ? warning(false, 'A component is changing a controlled %s component to be uncontrolled. ' + 'This is likely caused by the value changing to an undefined value ' + 'from a defined one. Decide between using a controlled or ' + 'uncontrolled value for the lifetime of the component. ' + 'More info: https://reactjs.org/link/controlled-components', name) : void 0;
71
66
  }
72
67
  }, [name, value]);
73
-
74
68
  if (controlled.current === true) {
75
69
  return [value, setState];
76
70
  }
77
-
78
71
  return [state, setState];
79
72
  }
80
73
 
@@ -20,19 +20,17 @@ import { useState, useRef, useCallback, useEffect } from 'react';
20
20
 
21
21
  function useDelayedState(initialState) {
22
22
  const [state, setState] = useState(initialState);
23
- const timeoutId = useRef(null); // We use `useCallback` to match the signature of React's `useState` which will
23
+ const timeoutId = useRef(null);
24
+ // We use `useCallback` to match the signature of React's `useState` which will
24
25
  // always return the same reference for the `setState` updater
25
-
26
26
  const setStateWithDelay = useCallback(function (stateToSet) {
27
27
  let delayMs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
28
28
  window.clearTimeout(timeoutId.current ?? undefined);
29
29
  timeoutId.current = null;
30
-
31
30
  if (delayMs === 0) {
32
31
  setState(stateToSet);
33
32
  return;
34
33
  }
35
-
36
34
  timeoutId.current = window.setTimeout(() => {
37
35
  setState(stateToSet);
38
36
  timeoutId.current = null;
@@ -13,7 +13,6 @@ import { useRef, useEffect } from 'react';
13
13
  *
14
14
  * @param {Function} callback
15
15
  */
16
-
17
16
  function useEffectOnce(callback) {
18
17
  const savedCallback = useRef(callback);
19
18
  const effectGuard = useRef(false);
@@ -7,18 +7,76 @@
7
7
 
8
8
  import { useRef, useEffect } from 'react';
9
9
 
10
+ /* eslint-disable jsdoc/check-tag-names */
11
+
12
+ /**
13
+ * @template {keyof GlobalEventHandlersEventMap} E
14
+ * @typedef {(event: GlobalEventHandlersEventMap[E]) => void} GlobalEventCallback
15
+ */
16
+
17
+ /**
18
+ * @template T
19
+ * @typedef {import('react').MutableRefObject<T>} MutableRefObject<T>
20
+ */
21
+
22
+ /**
23
+ * @template {keyof GlobalEventHandlersEventMap} E
24
+ * @param {HTMLElement | MutableRefObject<HTMLElement | null>} elementOrRef
25
+ * @param {E} eventName
26
+ * @param {GlobalEventCallback<E>} callback
27
+ */
28
+ function useEvent(elementOrRef, eventName, callback) {
29
+ /**
30
+ * @type {MutableRefObject<GlobalEventCallback<E> | null>}
31
+ */
32
+ const savedCallback = useRef(null);
33
+ useEffect(() => {
34
+ savedCallback.current = callback;
35
+ }, [callback]);
36
+ useEffect(() => {
37
+ /**
38
+ * @type {GlobalEventCallback<E>}
39
+ */
40
+ const handler = event => {
41
+ if (savedCallback.current) {
42
+ savedCallback.current(event);
43
+ }
44
+ };
45
+ const element = 'current' in elementOrRef ? elementOrRef.current : elementOrRef;
46
+ element?.addEventListener?.(eventName, handler);
47
+ return () => {
48
+ element?.removeEventListener?.(eventName, handler);
49
+ };
50
+ }, [elementOrRef, eventName]);
51
+ }
52
+
53
+ /**
54
+ * @template {keyof WindowEventMap} E
55
+ * @typedef {(event: WindowEventMap[E]) => void} WindowEventCallback
56
+ */
57
+
58
+ /**
59
+ * @template {keyof WindowEventMap} E
60
+ * @param {E} eventName
61
+ * @param {WindowEventCallback<E>} callback
62
+ */
10
63
  function useWindowEvent(eventName, callback) {
64
+ /**
65
+ * @type {MutableRefObject<WindowEventCallback<E> | null>}
66
+ */
11
67
  const savedCallback = useRef(null);
12
68
  useEffect(() => {
13
69
  savedCallback.current = callback;
14
- });
70
+ }, [callback]);
15
71
  useEffect(() => {
72
+ /**
73
+ * @type {WindowEventCallback<E>}
74
+ */
16
75
  function handler(event) {
17
76
  if (savedCallback.current) {
18
77
  savedCallback.current(event);
19
78
  }
20
79
  }
21
-
22
80
  window.addEventListener(eventName, handler);
23
81
  return () => {
24
82
  window.removeEventListener(eventName, handler);
@@ -26,4 +84,4 @@ function useWindowEvent(eventName, callback) {
26
84
  }, [eventName]);
27
85
  }
28
86
 
29
- export { useWindowEvent };
87
+ export { useEvent, useWindowEvent };
@@ -14,22 +14,19 @@ import { useIdPrefix } from './useIdPrefix.js';
14
14
  const getId = setupGetInstanceId();
15
15
  const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
16
16
  let serverHandoffCompleted = false;
17
+
17
18
  /**
18
19
  * Generate a unique ID with an optional prefix prepended to it
19
20
  * @param {string} [prefix]
20
21
  * @returns {string}
21
22
  */
22
-
23
23
  function useId() {
24
24
  let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'id';
25
-
26
25
  const _prefix = useIdPrefix();
27
-
28
26
  const [id, setId] = useState(() => {
29
27
  if (serverHandoffCompleted) {
30
28
  return `${_prefix ? `${_prefix}-` : ``}${prefix}-${getId()}`;
31
29
  }
32
-
33
30
  return null;
34
31
  });
35
32
  useIsomorphicLayoutEffect(() => {
@@ -44,12 +41,12 @@ function useId() {
44
41
  }, []);
45
42
  return id;
46
43
  }
44
+
47
45
  /**
48
46
  * Generate a unique id if a given `id` is not provided
49
47
  * @param {string|undefined} id
50
48
  * @returns {string}
51
49
  */
52
-
53
50
  function useFallbackId(id) {
54
51
  const fallback = useId();
55
52
  return id ?? fallback;
@@ -7,6 +7,7 @@
7
7
 
8
8
  import { useLayoutEffect, useEffect } from 'react';
9
9
 
10
+ // useLayoutEffect on the client, useEffect on the server
10
11
  const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
11
12
  var useIsomorphicEffect$1 = useIsomorphicEffect;
12
13
 
@@ -12,7 +12,6 @@ import { useCallback } from 'react';
12
12
  * refs from both `React.forwardRef` and `useRef` that you would like to add to
13
13
  * the same node.
14
14
  */
15
-
16
15
  const useMergedRefs = refs => {
17
16
  return useCallback(node => {
18
17
  refs.forEach(ref => {
@@ -21,7 +20,8 @@ const useMergedRefs = refs => {
21
20
  } else if (ref !== null && ref !== undefined) {
22
21
  ref.current = node;
23
22
  }
24
- }); // eslint-disable-next-line react-hooks/exhaustive-deps
23
+ });
24
+ // eslint-disable-next-line react-hooks/exhaustive-deps
25
25
  }, refs);
26
26
  };
27
27