@carbon/react 1.83.0 → 1.84.0-rc.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 (510) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +980 -945
  2. package/README.md +1 -1
  3. package/es/components/AILabel/index.js +27 -30
  4. package/es/components/AISkeleton/AISkeletonIcon.js +4 -5
  5. package/es/components/AISkeleton/AISkeletonPlaceholder.js +4 -5
  6. package/es/components/AISkeleton/AISkeletonText.js +4 -5
  7. package/es/components/Accordion/Accordion.Skeleton.js +9 -10
  8. package/es/components/Accordion/Accordion.js +10 -11
  9. package/es/components/Accordion/AccordionItem.js +13 -14
  10. package/es/components/Accordion/AccordionProvider.js +4 -5
  11. package/es/components/AspectRatio/AspectRatio.js +7 -8
  12. package/es/components/BadgeIndicator/index.js +5 -6
  13. package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +4 -5
  14. package/es/components/Button/Button.Skeleton.js +7 -8
  15. package/es/components/Button/ButtonBase.js +23 -24
  16. package/es/components/ChatButton/ChatButton.Skeleton.js +5 -6
  17. package/es/components/ChatButton/ChatButton.js +11 -12
  18. package/es/components/Checkbox/Checkbox.Skeleton.js +4 -5
  19. package/es/components/Checkbox/Checkbox.js +19 -20
  20. package/es/components/CheckboxGroup/CheckboxGroup.js +16 -17
  21. package/es/components/ClassPrefix/index.js +4 -5
  22. package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +5 -6
  23. package/es/components/CodeSnippet/CodeSnippet.js +25 -26
  24. package/es/components/ComboBox/ComboBox.js +24 -30
  25. package/es/components/ComboBox/tools/filter.js +9 -12
  26. package/es/components/ComboButton/index.js +16 -18
  27. package/es/components/ComposedModal/ComposedModal.js +31 -34
  28. package/es/components/ComposedModal/ModalFooter.js +37 -42
  29. package/es/components/ComposedModal/ModalHeader.js +14 -15
  30. package/es/components/ContainedList/ContainedList.js +10 -11
  31. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +9 -10
  32. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +9 -29
  33. package/es/components/ContentSwitcher/ContentSwitcher.js +96 -128
  34. package/es/components/ContentSwitcher/index.d.ts +3 -4
  35. package/es/components/ContextMenu/useContextMenu.js +1 -2
  36. package/es/components/Copy/Copy.js +11 -12
  37. package/es/components/CopyButton/CopyButton.js +10 -11
  38. package/es/components/DataTable/DataTable.js +45 -53
  39. package/es/components/DataTable/Table.js +15 -18
  40. package/es/components/DataTable/TableBatchAction.js +8 -11
  41. package/es/components/DataTable/TableBatchActions.js +18 -20
  42. package/es/components/DataTable/TableBody.js +8 -11
  43. package/es/components/DataTable/TableContainer.js +9 -10
  44. package/es/components/DataTable/TableDecoratorRow.js +4 -5
  45. package/es/components/DataTable/TableExpandHeader.js +14 -15
  46. package/es/components/DataTable/TableExpandRow.js +13 -14
  47. package/es/components/DataTable/TableExpandedRow.js +6 -7
  48. package/es/components/DataTable/TableHeader.js +15 -16
  49. package/es/components/DataTable/TableSelectAll.js +11 -12
  50. package/es/components/DataTable/TableSelectRow.js +12 -13
  51. package/es/components/DataTable/TableSlugRow.js +4 -5
  52. package/es/components/DataTable/TableToolbar.js +7 -8
  53. package/es/components/DataTable/TableToolbarMenu.js +8 -9
  54. package/es/components/DataTable/TableToolbarSearch.js +22 -24
  55. package/es/components/DataTable/state/sorting.js +3 -4
  56. package/es/components/DataTable/tools/filter.js +10 -12
  57. package/es/components/DataTable/tools/normalize.js +6 -8
  58. package/es/components/DataTable/tools/sorting.js +24 -30
  59. package/es/components/DataTableSkeleton/DataTableSkeleton.js +11 -12
  60. package/es/components/DatePicker/DatePicker.Skeleton.js +7 -8
  61. package/es/components/DatePicker/DatePicker.js +88 -65
  62. package/es/components/DatePickerInput/DatePickerInput.js +5 -6
  63. package/es/components/Dialog/index.d.ts +193 -8
  64. package/es/components/Dialog/index.js +454 -35
  65. package/es/components/Dropdown/Dropdown.Skeleton.js +6 -7
  66. package/es/components/Dropdown/Dropdown.js +40 -43
  67. package/es/components/ErrorBoundary/ErrorBoundary.js +2 -2
  68. package/es/components/ExpandableSearch/ExpandableSearch.js +9 -10
  69. package/es/components/FeatureFlags/index.js +11 -12
  70. package/es/components/FileUploader/FileUploader.Skeleton.js +4 -5
  71. package/es/components/FileUploader/FileUploader.js +22 -24
  72. package/es/components/FileUploader/FileUploaderButton.js +16 -17
  73. package/es/components/FileUploader/FileUploaderDropContainer.js +15 -16
  74. package/es/components/FileUploader/FileUploaderItem.js +13 -14
  75. package/es/components/FileUploader/Filename.js +9 -10
  76. package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +4 -5
  77. package/es/components/FluidComboBox/FluidComboBox.js +5 -6
  78. package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +5 -6
  79. package/es/components/FluidDatePicker/FluidDatePicker.js +10 -11
  80. package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +4 -5
  81. package/es/components/FluidDropdown/FluidDropdown.js +5 -6
  82. package/es/components/FluidForm/FluidForm.js +5 -6
  83. package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +4 -5
  84. package/es/components/FluidMultiSelect/FluidMultiSelect.js +6 -7
  85. package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +4 -5
  86. package/es/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
  87. package/es/components/FluidNumberInput/FluidNumberInput.js +38 -5
  88. package/es/components/FluidSearch/FluidSearch.Skeleton.js +4 -5
  89. package/es/components/FluidSearch/FluidSearch.js +4 -5
  90. package/es/components/FluidSelect/FluidSelect.Skeleton.js +4 -5
  91. package/es/components/FluidSelect/FluidSelect.js +5 -6
  92. package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +4 -5
  93. package/es/components/FluidTextArea/FluidTextArea.js +4 -5
  94. package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +4 -5
  95. package/es/components/FluidTextInput/FluidTextInput.js +5 -6
  96. package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +5 -6
  97. package/es/components/FluidTimePicker/FluidTimePicker.js +11 -12
  98. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +5 -6
  99. package/es/components/Form/Form.js +5 -6
  100. package/es/components/FormGroup/FormGroup.js +11 -12
  101. package/es/components/FormItem/FormItem.js +5 -6
  102. package/es/components/FormLabel/FormLabel.js +6 -7
  103. package/es/components/Grid/CSSGrid.js +17 -19
  104. package/es/components/Grid/Column.js +28 -27
  105. package/es/components/Grid/ColumnHang.js +6 -7
  106. package/es/components/Grid/FlexGrid.js +9 -10
  107. package/es/components/Grid/GridContext.js +5 -6
  108. package/es/components/Grid/Row.js +8 -9
  109. package/es/components/Heading/index.js +5 -6
  110. package/es/components/Icon/Icon.Skeleton.js +4 -5
  111. package/es/components/IconButton/index.js +20 -21
  112. package/es/components/IconIndicator/index.js +7 -8
  113. package/es/components/IdPrefix/index.js +4 -5
  114. package/es/components/InlineLoading/InlineLoading.js +9 -10
  115. package/es/components/Layer/index.js +8 -9
  116. package/es/components/Layout/index.js +21 -26
  117. package/es/components/LayoutDirection/LayoutDirection.js +6 -7
  118. package/es/components/Link/Link.d.ts +1 -1
  119. package/es/components/Link/Link.js +14 -15
  120. package/es/components/ListBox/ListBoxField.js +6 -7
  121. package/es/components/ListBox/ListBoxMenu.js +5 -6
  122. package/es/components/ListBox/ListBoxMenuIcon.js +4 -5
  123. package/es/components/ListBox/ListBoxMenuItem.js +8 -10
  124. package/es/components/ListBox/ListBoxSelection.js +8 -9
  125. package/es/components/ListBox/next/ListBoxSelection.js +9 -10
  126. package/es/components/ListBox/next/ListBoxTrigger.js +5 -6
  127. package/es/components/ListItem/ListItem.js +5 -6
  128. package/es/components/Loading/Loading.js +8 -9
  129. package/es/components/Menu/Menu.js +23 -24
  130. package/es/components/Menu/MenuItem.js +39 -44
  131. package/es/components/MenuButton/index.js +16 -18
  132. package/es/components/Modal/Modal.js +55 -63
  133. package/es/components/ModalWrapper/ModalWrapper.js +2 -2
  134. package/es/components/MultiSelect/FilterableMultiSelect.js +46 -48
  135. package/es/components/MultiSelect/MultiSelect.js +43 -45
  136. package/es/components/MultiSelect/tools/sorting.js +11 -15
  137. package/es/components/Notification/Notification.js +96 -105
  138. package/es/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
  139. package/es/components/NumberInput/NumberFormatPropTypes.js +40 -0
  140. package/es/components/NumberInput/NumberInput.Skeleton.js +6 -7
  141. package/es/components/NumberInput/NumberInput.d.ts +39 -3
  142. package/es/components/NumberInput/NumberInput.js +174 -44
  143. package/es/components/OrderedList/OrderedList.js +7 -8
  144. package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
  145. package/es/components/OverflowMenu/OverflowMenu.js +35 -41
  146. package/es/components/OverflowMenu/next/index.js +12 -13
  147. package/es/components/PageHeader/PageHeader.d.ts +29 -5
  148. package/es/components/PageHeader/PageHeader.js +119 -73
  149. package/es/components/Pagination/Pagination.Skeleton.js +4 -5
  150. package/es/components/Pagination/Pagination.js +24 -25
  151. package/es/components/Pagination/experimental/PageSelector.js +8 -9
  152. package/es/components/Pagination/experimental/Pagination.js +20 -21
  153. package/es/components/PaginationNav/PaginationNav.js +33 -38
  154. package/es/components/Popover/index.js +26 -28
  155. package/es/components/ProgressBar/ProgressBar.js +11 -12
  156. package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +5 -6
  157. package/es/components/ProgressIndicator/ProgressIndicator.js +29 -32
  158. package/es/components/RadioTile/RadioTile.js +17 -18
  159. package/es/components/Search/Search.Skeleton.js +5 -6
  160. package/es/components/Search/Search.js +26 -28
  161. package/es/components/Select/Select.Skeleton.js +5 -6
  162. package/es/components/Select/Select.js +24 -25
  163. package/es/components/SelectItem/SelectItem.js +8 -9
  164. package/es/components/SelectItemGroup/SelectItemGroup.js +7 -8
  165. package/es/components/ShapeIndicator/index.js +7 -8
  166. package/es/components/SkeletonIcon/SkeletonIcon.js +4 -5
  167. package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +4 -5
  168. package/es/components/SkeletonText/SkeletonText.js +8 -9
  169. package/es/components/Slider/Slider.Skeleton.js +8 -9
  170. package/es/components/Slider/Slider.js +69 -83
  171. package/es/components/Slider/SliderHandles.js +6 -6
  172. package/es/components/StructuredList/StructuredList.Skeleton.js +5 -6
  173. package/es/components/Tabs/Tabs.Skeleton.js +5 -6
  174. package/es/components/Tabs/Tabs.js +83 -98
  175. package/es/components/Tabs/usePressable.js +7 -8
  176. package/es/components/Tag/DismissibleTag.js +16 -17
  177. package/es/components/Tag/OperationalTag.js +10 -11
  178. package/es/components/Tag/SelectableTag.js +13 -14
  179. package/es/components/Tag/Tag.Skeleton.js +5 -6
  180. package/es/components/Tag/Tag.js +19 -20
  181. package/es/components/Text/Text.js +6 -7
  182. package/es/components/Text/TextDirection.js +5 -6
  183. package/es/components/TextArea/TextArea.js +3 -3
  184. package/es/components/TextInput/ControlledPasswordInput.js +24 -25
  185. package/es/components/TextInput/PasswordInput.js +26 -27
  186. package/es/components/TextInput/TextInput.Skeleton.js +5 -6
  187. package/es/components/TextInput/TextInput.js +27 -28
  188. package/es/components/TextInput/util.js +14 -17
  189. package/es/components/Theme/index.js +10 -12
  190. package/es/components/Tile/Tile.js +68 -74
  191. package/es/components/Toggle/Toggle.Skeleton.js +4 -5
  192. package/es/components/Toggle/Toggle.js +17 -18
  193. package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +6 -7
  194. package/es/components/Toggletip/index.js +33 -39
  195. package/es/components/Tooltip/DefinitionTooltip.js +13 -14
  196. package/es/components/Tooltip/Tooltip.js +15 -16
  197. package/es/components/TreeView/TreeNode.js +20 -21
  198. package/es/components/TreeView/TreeView.js +14 -16
  199. package/es/components/UIShell/Content.js +6 -7
  200. package/es/components/UIShell/Header.js +5 -6
  201. package/es/components/UIShell/HeaderContainer.js +5 -6
  202. package/es/components/UIShell/HeaderGlobalAction.js +12 -13
  203. package/es/components/UIShell/HeaderMenu.d.ts +10 -112
  204. package/es/components/UIShell/HeaderMenu.js +154 -201
  205. package/es/components/UIShell/HeaderMenuButton.js +10 -11
  206. package/es/components/UIShell/HeaderMenuItem.js +10 -11
  207. package/es/components/UIShell/HeaderName.js +6 -7
  208. package/es/components/UIShell/HeaderNavigation.js +7 -8
  209. package/es/components/UIShell/HeaderPanel.js +9 -10
  210. package/es/components/UIShell/HeaderSideNavItems.js +5 -6
  211. package/es/components/UIShell/Link.js +8 -9
  212. package/es/components/UIShell/SideNav.js +23 -25
  213. package/es/components/UIShell/SideNavDetails.js +6 -7
  214. package/es/components/UIShell/SideNavDivider.js +3 -4
  215. package/es/components/UIShell/SideNavFooter.js +6 -7
  216. package/es/components/UIShell/SideNavHeader.js +5 -6
  217. package/es/components/UIShell/SideNavIcon.js +5 -6
  218. package/es/components/UIShell/SideNavItem.js +5 -6
  219. package/es/components/UIShell/SideNavItems.js +5 -6
  220. package/es/components/UIShell/SideNavLink.js +10 -11
  221. package/es/components/UIShell/SideNavLinkText.js +5 -6
  222. package/es/components/UIShell/SideNavMenu.js +11 -12
  223. package/es/components/UIShell/SkipToContent.js +7 -8
  224. package/es/components/UIShell/Switcher.js +4 -5
  225. package/es/components/UIShell/SwitcherDivider.js +4 -5
  226. package/es/components/UnorderedList/UnorderedList.js +6 -7
  227. package/es/index.js +2 -2
  228. package/es/internal/FloatingMenu.js +26 -28
  229. package/es/internal/Selection.js +15 -17
  230. package/es/internal/getAnnouncement.d.ts +8 -0
  231. package/es/internal/getAnnouncement.js +22 -0
  232. package/es/internal/keyboard/match.js +6 -7
  233. package/es/internal/useControllableState.d.ts +1 -1
  234. package/es/internal/useControllableState.js +8 -9
  235. package/es/internal/useDelayedState.js +1 -2
  236. package/es/internal/useDocumentLang.d.ts +12 -0
  237. package/es/internal/useId.js +2 -4
  238. package/es/internal/useMatchMedia.js +1 -2
  239. package/es/internal/useMergedRefs.d.ts +1 -1
  240. package/es/internal/useNoInteractiveChildren.js +2 -4
  241. package/es/internal/useNormalizedInputProps.js +9 -10
  242. package/es/internal/useResizeObserver.js +4 -5
  243. package/es/internal/useSavedCallback.js +1 -3
  244. package/es/internal/wrapFocus.js +20 -29
  245. package/es/prop-types/deprecate.js +1 -4
  246. package/es/prop-types/deprecateValuesWithin.js +1 -4
  247. package/es/prop-types/isRequiredOneOf.js +1 -4
  248. package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -4
  249. package/es/tools/events.js +1 -4
  250. package/es/tools/mergeRefs.js +9 -14
  251. package/es/tools/uniqueId.js +1 -2
  252. package/es/tools/wrapComponent.js +9 -11
  253. package/lib/components/AILabel/index.js +27 -30
  254. package/lib/components/AISkeleton/AISkeletonIcon.js +4 -5
  255. package/lib/components/AISkeleton/AISkeletonPlaceholder.js +4 -5
  256. package/lib/components/AISkeleton/AISkeletonText.js +4 -5
  257. package/lib/components/Accordion/Accordion.Skeleton.js +9 -10
  258. package/lib/components/Accordion/Accordion.js +10 -11
  259. package/lib/components/Accordion/AccordionItem.js +13 -14
  260. package/lib/components/Accordion/AccordionProvider.js +4 -5
  261. package/lib/components/AspectRatio/AspectRatio.js +7 -8
  262. package/lib/components/BadgeIndicator/index.js +5 -6
  263. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +4 -5
  264. package/lib/components/Button/Button.Skeleton.js +7 -8
  265. package/lib/components/Button/ButtonBase.js +23 -24
  266. package/lib/components/ChatButton/ChatButton.Skeleton.js +5 -6
  267. package/lib/components/ChatButton/ChatButton.js +11 -12
  268. package/lib/components/Checkbox/Checkbox.Skeleton.js +4 -5
  269. package/lib/components/Checkbox/Checkbox.js +19 -20
  270. package/lib/components/CheckboxGroup/CheckboxGroup.js +16 -17
  271. package/lib/components/ClassPrefix/index.js +4 -5
  272. package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +5 -6
  273. package/lib/components/CodeSnippet/CodeSnippet.js +25 -26
  274. package/lib/components/ComboBox/ComboBox.js +24 -30
  275. package/lib/components/ComboBox/tools/filter.js +9 -12
  276. package/lib/components/ComboButton/index.js +16 -18
  277. package/lib/components/ComposedModal/ComposedModal.js +31 -34
  278. package/lib/components/ComposedModal/ModalFooter.js +37 -42
  279. package/lib/components/ComposedModal/ModalHeader.js +14 -15
  280. package/lib/components/ContainedList/ContainedList.js +10 -11
  281. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +9 -10
  282. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +9 -29
  283. package/lib/components/ContentSwitcher/ContentSwitcher.js +94 -126
  284. package/lib/components/ContentSwitcher/index.d.ts +3 -4
  285. package/lib/components/ContextMenu/useContextMenu.js +1 -2
  286. package/lib/components/Copy/Copy.js +11 -12
  287. package/lib/components/CopyButton/CopyButton.js +10 -11
  288. package/lib/components/DataTable/DataTable.js +45 -53
  289. package/lib/components/DataTable/Table.js +15 -18
  290. package/lib/components/DataTable/TableBatchAction.js +8 -11
  291. package/lib/components/DataTable/TableBatchActions.js +18 -20
  292. package/lib/components/DataTable/TableBody.js +8 -11
  293. package/lib/components/DataTable/TableContainer.js +9 -10
  294. package/lib/components/DataTable/TableDecoratorRow.js +4 -5
  295. package/lib/components/DataTable/TableExpandHeader.js +14 -15
  296. package/lib/components/DataTable/TableExpandRow.js +13 -14
  297. package/lib/components/DataTable/TableExpandedRow.js +6 -7
  298. package/lib/components/DataTable/TableHeader.js +15 -16
  299. package/lib/components/DataTable/TableSelectAll.js +11 -12
  300. package/lib/components/DataTable/TableSelectRow.js +12 -13
  301. package/lib/components/DataTable/TableSlugRow.js +4 -5
  302. package/lib/components/DataTable/TableToolbar.js +7 -8
  303. package/lib/components/DataTable/TableToolbarMenu.js +8 -9
  304. package/lib/components/DataTable/TableToolbarSearch.js +22 -24
  305. package/lib/components/DataTable/state/sorting.js +3 -4
  306. package/lib/components/DataTable/tools/filter.js +10 -12
  307. package/lib/components/DataTable/tools/normalize.js +6 -8
  308. package/lib/components/DataTable/tools/sorting.js +24 -30
  309. package/lib/components/DataTableSkeleton/DataTableSkeleton.js +11 -12
  310. package/lib/components/DatePicker/DatePicker.Skeleton.js +7 -8
  311. package/lib/components/DatePicker/DatePicker.js +87 -64
  312. package/lib/components/DatePickerInput/DatePickerInput.js +5 -6
  313. package/lib/components/Dialog/index.d.ts +193 -8
  314. package/lib/components/Dialog/index.js +457 -33
  315. package/lib/components/Dropdown/Dropdown.Skeleton.js +6 -7
  316. package/lib/components/Dropdown/Dropdown.js +40 -43
  317. package/lib/components/ErrorBoundary/ErrorBoundary.js +2 -2
  318. package/lib/components/ExpandableSearch/ExpandableSearch.js +9 -10
  319. package/lib/components/FeatureFlags/index.js +11 -12
  320. package/lib/components/FileUploader/FileUploader.Skeleton.js +4 -5
  321. package/lib/components/FileUploader/FileUploader.js +22 -24
  322. package/lib/components/FileUploader/FileUploaderButton.js +16 -17
  323. package/lib/components/FileUploader/FileUploaderDropContainer.js +15 -16
  324. package/lib/components/FileUploader/FileUploaderItem.js +13 -14
  325. package/lib/components/FileUploader/Filename.js +9 -10
  326. package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +4 -5
  327. package/lib/components/FluidComboBox/FluidComboBox.js +5 -6
  328. package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +5 -6
  329. package/lib/components/FluidDatePicker/FluidDatePicker.js +10 -11
  330. package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +4 -5
  331. package/lib/components/FluidDropdown/FluidDropdown.js +5 -6
  332. package/lib/components/FluidForm/FluidForm.js +5 -6
  333. package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +4 -5
  334. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +6 -7
  335. package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +4 -5
  336. package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
  337. package/lib/components/FluidNumberInput/FluidNumberInput.js +38 -5
  338. package/lib/components/FluidSearch/FluidSearch.Skeleton.js +4 -5
  339. package/lib/components/FluidSearch/FluidSearch.js +4 -5
  340. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +4 -5
  341. package/lib/components/FluidSelect/FluidSelect.js +5 -6
  342. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +4 -5
  343. package/lib/components/FluidTextArea/FluidTextArea.js +4 -5
  344. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +4 -5
  345. package/lib/components/FluidTextInput/FluidTextInput.js +5 -6
  346. package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +5 -6
  347. package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -12
  348. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +5 -6
  349. package/lib/components/Form/Form.js +5 -6
  350. package/lib/components/FormGroup/FormGroup.js +11 -12
  351. package/lib/components/FormItem/FormItem.js +5 -6
  352. package/lib/components/FormLabel/FormLabel.js +6 -7
  353. package/lib/components/Grid/CSSGrid.js +17 -19
  354. package/lib/components/Grid/Column.js +28 -27
  355. package/lib/components/Grid/ColumnHang.js +6 -7
  356. package/lib/components/Grid/FlexGrid.js +9 -10
  357. package/lib/components/Grid/GridContext.js +5 -6
  358. package/lib/components/Grid/Row.js +8 -9
  359. package/lib/components/Heading/index.js +5 -6
  360. package/lib/components/Icon/Icon.Skeleton.js +4 -5
  361. package/lib/components/IconButton/index.js +20 -21
  362. package/lib/components/IconIndicator/index.js +7 -8
  363. package/lib/components/IdPrefix/index.js +4 -5
  364. package/lib/components/InlineLoading/InlineLoading.js +9 -10
  365. package/lib/components/Layer/index.js +8 -9
  366. package/lib/components/Layout/index.js +21 -26
  367. package/lib/components/LayoutDirection/LayoutDirection.js +6 -7
  368. package/lib/components/Link/Link.d.ts +1 -1
  369. package/lib/components/Link/Link.js +14 -15
  370. package/lib/components/ListBox/ListBoxField.js +6 -7
  371. package/lib/components/ListBox/ListBoxMenu.js +5 -6
  372. package/lib/components/ListBox/ListBoxMenuIcon.js +4 -5
  373. package/lib/components/ListBox/ListBoxMenuItem.js +8 -10
  374. package/lib/components/ListBox/ListBoxSelection.js +8 -9
  375. package/lib/components/ListBox/next/ListBoxSelection.js +9 -10
  376. package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
  377. package/lib/components/ListItem/ListItem.js +5 -6
  378. package/lib/components/Loading/Loading.js +8 -9
  379. package/lib/components/Menu/Menu.js +23 -24
  380. package/lib/components/Menu/MenuItem.js +39 -44
  381. package/lib/components/MenuButton/index.js +16 -18
  382. package/lib/components/Modal/Modal.js +55 -63
  383. package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
  384. package/lib/components/MultiSelect/FilterableMultiSelect.js +45 -47
  385. package/lib/components/MultiSelect/MultiSelect.js +43 -45
  386. package/lib/components/MultiSelect/tools/sorting.js +11 -15
  387. package/lib/components/Notification/Notification.js +96 -105
  388. package/lib/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
  389. package/lib/components/NumberInput/NumberFormatPropTypes.js +48 -0
  390. package/lib/components/NumberInput/NumberInput.Skeleton.js +6 -7
  391. package/lib/components/NumberInput/NumberInput.d.ts +39 -3
  392. package/lib/components/NumberInput/NumberInput.js +173 -43
  393. package/lib/components/OrderedList/OrderedList.js +7 -8
  394. package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
  395. package/lib/components/OverflowMenu/OverflowMenu.js +35 -41
  396. package/lib/components/OverflowMenu/next/index.js +12 -13
  397. package/lib/components/PageHeader/PageHeader.d.ts +29 -5
  398. package/lib/components/PageHeader/PageHeader.js +119 -73
  399. package/lib/components/Pagination/Pagination.Skeleton.js +4 -5
  400. package/lib/components/Pagination/Pagination.js +24 -25
  401. package/lib/components/Pagination/experimental/PageSelector.js +8 -9
  402. package/lib/components/Pagination/experimental/Pagination.js +20 -21
  403. package/lib/components/PaginationNav/PaginationNav.js +33 -38
  404. package/lib/components/Popover/index.js +26 -28
  405. package/lib/components/ProgressBar/ProgressBar.js +11 -12
  406. package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +5 -6
  407. package/lib/components/ProgressIndicator/ProgressIndicator.js +29 -32
  408. package/lib/components/RadioTile/RadioTile.js +17 -18
  409. package/lib/components/Search/Search.Skeleton.js +5 -6
  410. package/lib/components/Search/Search.js +26 -28
  411. package/lib/components/Select/Select.Skeleton.js +5 -6
  412. package/lib/components/Select/Select.js +24 -25
  413. package/lib/components/SelectItem/SelectItem.js +8 -9
  414. package/lib/components/SelectItemGroup/SelectItemGroup.js +7 -8
  415. package/lib/components/ShapeIndicator/index.js +7 -8
  416. package/lib/components/SkeletonIcon/SkeletonIcon.js +4 -5
  417. package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +4 -5
  418. package/lib/components/SkeletonText/SkeletonText.js +8 -9
  419. package/lib/components/Slider/Slider.Skeleton.js +8 -9
  420. package/lib/components/Slider/Slider.js +69 -83
  421. package/lib/components/Slider/SliderHandles.js +6 -6
  422. package/lib/components/StructuredList/StructuredList.Skeleton.js +5 -6
  423. package/lib/components/Tabs/Tabs.Skeleton.js +5 -6
  424. package/lib/components/Tabs/Tabs.js +83 -98
  425. package/lib/components/Tabs/usePressable.js +7 -8
  426. package/lib/components/Tag/DismissibleTag.js +16 -17
  427. package/lib/components/Tag/OperationalTag.js +10 -11
  428. package/lib/components/Tag/SelectableTag.js +13 -14
  429. package/lib/components/Tag/Tag.Skeleton.js +5 -6
  430. package/lib/components/Tag/Tag.js +19 -20
  431. package/lib/components/Text/Text.js +6 -7
  432. package/lib/components/Text/TextDirection.js +5 -6
  433. package/lib/components/TextArea/TextArea.js +3 -3
  434. package/lib/components/TextInput/ControlledPasswordInput.js +24 -25
  435. package/lib/components/TextInput/PasswordInput.js +26 -27
  436. package/lib/components/TextInput/TextInput.Skeleton.js +5 -6
  437. package/lib/components/TextInput/TextInput.js +27 -28
  438. package/lib/components/TextInput/util.js +14 -17
  439. package/lib/components/Theme/index.js +10 -12
  440. package/lib/components/Tile/Tile.js +68 -74
  441. package/lib/components/Toggle/Toggle.Skeleton.js +4 -5
  442. package/lib/components/Toggle/Toggle.js +17 -18
  443. package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +6 -7
  444. package/lib/components/Toggletip/index.js +33 -39
  445. package/lib/components/Tooltip/DefinitionTooltip.js +13 -14
  446. package/lib/components/Tooltip/Tooltip.js +15 -16
  447. package/lib/components/TreeView/TreeNode.js +20 -21
  448. package/lib/components/TreeView/TreeView.js +14 -16
  449. package/lib/components/UIShell/Content.js +6 -7
  450. package/lib/components/UIShell/Header.js +5 -6
  451. package/lib/components/UIShell/HeaderContainer.js +5 -6
  452. package/lib/components/UIShell/HeaderGlobalAction.js +12 -13
  453. package/lib/components/UIShell/HeaderMenu.d.ts +10 -112
  454. package/lib/components/UIShell/HeaderMenu.js +152 -199
  455. package/lib/components/UIShell/HeaderMenuButton.js +10 -11
  456. package/lib/components/UIShell/HeaderMenuItem.js +10 -11
  457. package/lib/components/UIShell/HeaderName.js +6 -7
  458. package/lib/components/UIShell/HeaderNavigation.js +7 -8
  459. package/lib/components/UIShell/HeaderPanel.js +9 -10
  460. package/lib/components/UIShell/HeaderSideNavItems.js +5 -6
  461. package/lib/components/UIShell/Link.js +8 -9
  462. package/lib/components/UIShell/SideNav.js +23 -25
  463. package/lib/components/UIShell/SideNavDetails.js +6 -7
  464. package/lib/components/UIShell/SideNavDivider.js +3 -4
  465. package/lib/components/UIShell/SideNavFooter.js +6 -7
  466. package/lib/components/UIShell/SideNavHeader.js +5 -6
  467. package/lib/components/UIShell/SideNavIcon.js +5 -6
  468. package/lib/components/UIShell/SideNavItem.js +5 -6
  469. package/lib/components/UIShell/SideNavItems.js +5 -6
  470. package/lib/components/UIShell/SideNavLink.js +10 -11
  471. package/lib/components/UIShell/SideNavLinkText.js +5 -6
  472. package/lib/components/UIShell/SideNavMenu.js +11 -12
  473. package/lib/components/UIShell/SkipToContent.js +7 -8
  474. package/lib/components/UIShell/Switcher.js +4 -5
  475. package/lib/components/UIShell/SwitcherDivider.js +4 -5
  476. package/lib/components/UnorderedList/UnorderedList.js +6 -7
  477. package/lib/index.js +35 -35
  478. package/lib/internal/FloatingMenu.js +26 -28
  479. package/lib/internal/Selection.js +15 -17
  480. package/lib/internal/getAnnouncement.d.ts +8 -0
  481. package/lib/internal/getAnnouncement.js +26 -0
  482. package/lib/internal/keyboard/match.js +6 -7
  483. package/lib/internal/useControllableState.d.ts +1 -1
  484. package/lib/internal/useControllableState.js +8 -9
  485. package/lib/internal/useDelayedState.js +1 -2
  486. package/lib/internal/useDocumentLang.d.ts +12 -0
  487. package/lib/internal/useId.js +2 -4
  488. package/lib/internal/useMatchMedia.js +1 -2
  489. package/lib/internal/useMergedRefs.d.ts +1 -1
  490. package/lib/internal/useNoInteractiveChildren.js +2 -4
  491. package/lib/internal/useNormalizedInputProps.js +9 -10
  492. package/lib/internal/useResizeObserver.js +4 -5
  493. package/lib/internal/useSavedCallback.js +1 -3
  494. package/lib/internal/wrapFocus.js +20 -29
  495. package/lib/prop-types/deprecate.js +1 -4
  496. package/lib/prop-types/deprecateValuesWithin.js +1 -4
  497. package/lib/prop-types/isRequiredOneOf.js +1 -4
  498. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -4
  499. package/lib/tools/events.js +1 -4
  500. package/lib/tools/mergeRefs.js +9 -14
  501. package/lib/tools/uniqueId.js +1 -2
  502. package/lib/tools/wrapComponent.js +9 -11
  503. package/package.json +21 -19
  504. package/telemetry.yml +23 -1
  505. package/es/components/ContentSwitcher/index.js +0 -13
  506. package/es/feature-flags.d.ts +0 -7
  507. package/es/internal/useAnnouncer.js +0 -21
  508. package/lib/components/ContentSwitcher/index.js +0 -18
  509. package/lib/feature-flags.d.ts +0 -7
  510. package/lib/internal/useAnnouncer.js +0 -25
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes from 'prop-types';
8
+ export declare const NumberFormatOptionsPropType: PropTypes.Requireable<PropTypes.InferProps<{
9
+ localeMatcher: PropTypes.Requireable<string>;
10
+ style: PropTypes.Requireable<string>;
11
+ currency: PropTypes.Requireable<string>;
12
+ currencyDisplay: PropTypes.Requireable<string>;
13
+ currencySign: PropTypes.Requireable<string>;
14
+ unit: PropTypes.Requireable<string>;
15
+ unitDisplay: PropTypes.Requireable<string>;
16
+ notation: PropTypes.Requireable<string>;
17
+ compactDisplay: PropTypes.Requireable<string>;
18
+ signDisplay: PropTypes.Requireable<string>;
19
+ minimumIntegerDigits: PropTypes.Requireable<number>;
20
+ minimumFractionDigits: PropTypes.Requireable<number>;
21
+ maximumFractionDigits: PropTypes.Requireable<number>;
22
+ minimumSignificantDigits: PropTypes.Requireable<number>;
23
+ maximumSignificantDigits: PropTypes.Requireable<number>;
24
+ useGrouping: PropTypes.Requireable<NonNullable<string | boolean | null | undefined>>;
25
+ numberingSystem: PropTypes.Requireable<string>;
26
+ roundingIncrement: PropTypes.Requireable<number>;
27
+ roundingMode: PropTypes.Requireable<string>;
28
+ trailingZeroDisplay: PropTypes.Requireable<string>;
29
+ }>>;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import PropTypes from 'prop-types';
9
+
10
+ const NumberFormatOptionsPropType = PropTypes.shape({
11
+ // Locale Options
12
+ localeMatcher: PropTypes.oneOf(['best fit', 'lookup']),
13
+ // Style Options
14
+ style: PropTypes.oneOf(['decimal', 'currency', 'percent', 'unit']),
15
+ currency: PropTypes.string,
16
+ // e.g., 'USD'
17
+ currencyDisplay: PropTypes.oneOf(['symbol', 'narrowSymbol', 'code', 'name']),
18
+ currencySign: PropTypes.oneOf(['standard', 'accounting']),
19
+ unit: PropTypes.string,
20
+ // e.g., 'liter', 'mile-per-hour'
21
+ unitDisplay: PropTypes.oneOf(['short', 'narrow', 'long']),
22
+ notation: PropTypes.oneOf(['standard', 'scientific', 'engineering', 'compact']),
23
+ compactDisplay: PropTypes.oneOf(['short', 'long']),
24
+ signDisplay: PropTypes.oneOf(['auto', 'never', 'always', 'exceptZero']),
25
+ // Digit Options
26
+ minimumIntegerDigits: PropTypes.number,
27
+ minimumFractionDigits: PropTypes.number,
28
+ maximumFractionDigits: PropTypes.number,
29
+ minimumSignificantDigits: PropTypes.number,
30
+ maximumSignificantDigits: PropTypes.number,
31
+ useGrouping: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['always', 'auto', 'min2'])]),
32
+ // Misc/Other Options
33
+ numberingSystem: PropTypes.string,
34
+ // e.g., 'latn', 'arab'
35
+ roundingIncrement: PropTypes.number,
36
+ roundingMode: PropTypes.oneOf(['ceil', 'floor', 'expand', 'trunc', 'halfCeil', 'halfFloor', 'halfExpand', 'halfTrunc', 'halfEven']),
37
+ trailingZeroDisplay: PropTypes.oneOf(['auto', 'stripIfInteger'])
38
+ });
39
+
40
+ export { NumberFormatOptionsPropType };
@@ -11,13 +11,12 @@ import React from 'react';
11
11
  import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
13
 
14
- function NumberInputSkeleton(_ref) {
15
- let {
16
- hideLabel,
17
- className,
18
- size = 'md',
19
- ...rest
20
- } = _ref;
14
+ function NumberInputSkeleton({
15
+ hideLabel,
16
+ className,
17
+ size = 'md',
18
+ ...rest
19
+ }) {
21
20
  const prefix = usePrefix();
22
21
  return /*#__PURE__*/React.createElement("div", _extends({
23
22
  className: cx(`${prefix}--form-item`, className)
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import React, { ReactNode } from 'react';
8
8
  import { TranslateWithId } from '../../types/common';
9
+ import { type NumberFormatOptions } from '@carbon/utilities';
9
10
  export declare const translationIds: {
10
11
  readonly 'increment.number': "increment.number";
11
12
  readonly 'decrement.number': "decrement.number";
@@ -25,7 +26,8 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
25
26
  */
26
27
  className?: string;
27
28
  /**
28
- * **Experimental**: Provide a `decorator` component to be rendered inside the `TextInput` component
29
+ * **Experimental**: Provide a `decorator` component to be rendered inside the
30
+ * `TextInput` component
29
31
  */
30
32
  decorator?: ReactNode;
31
33
  /**
@@ -40,6 +42,13 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
40
42
  * Specify if the control should be disabled, or not
41
43
  */
42
44
  disabled?: boolean;
45
+ /**
46
+ * **Experimental:** Specify Intl.NumberFormat options applied to internal
47
+ * number parsing and formatting. Use with `type="text"`, has no effect when
48
+ * `type="number"`.
49
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
50
+ */
51
+ formatOptions?: NumberFormatOptions;
43
52
  /**
44
53
  * Provide text that is used alongside the control label for additional help
45
54
  */
@@ -60,6 +69,12 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
60
69
  * Specify a custom `id` for the input
61
70
  */
62
71
  id: string;
72
+ /**
73
+ * Instruct the browser which keyboard to display on mobile devices. Note that
74
+ * standard numeric keyboards vary across devices and operating systems.
75
+ * @see https://css-tricks.com/everything-you-ever-wanted-to-know-about-inputmode/
76
+ */
77
+ inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];
63
78
  /**
64
79
  * Specify if the currently value is invalid.
65
80
  */
@@ -77,9 +92,16 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
77
92
  * `true` to use the light version.
78
93
  *
79
94
  * @deprecated The `light` prop for `NumberInput` is no longer needed and has
80
- * been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.
95
+ * been deprecated in v11 in favor of the new `Layer` component. It will be
96
+ * removed in the next major release.
81
97
  */
82
98
  light?: boolean;
99
+ /**
100
+ * **Experimental:** Specify a [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt)
101
+ * language code for parsing and formatting. Use with `type="text"`, has no
102
+ * effect when `type="number"`.
103
+ */
104
+ locale?: string;
83
105
  /**
84
106
  * The maximum value.
85
107
  */
@@ -91,9 +113,12 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
91
113
  /**
92
114
  * Provide an optional handler that is called when the internal state of
93
115
  * NumberInput changes. This handler is called with event and state info.
116
+ * When type="number", this is called on every change of the input.
117
+ * When type="text", this is only called on blur after the number has been
118
+ * parsed and formatted.
94
119
  * `(event, { value, direction }) => void`
95
120
  */
96
- onChange?: (event: React.MouseEvent<HTMLButtonElement>, state: {
121
+ onChange?: (event: React.MouseEvent<HTMLButtonElement> | React.FocusEvent<HTMLInputElement> | React.KeyboardEvent<HTMLInputElement>, state: {
97
122
  value: number | string;
98
123
  direction: string;
99
124
  }) => void;
@@ -108,6 +133,11 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
108
133
  * Provide an optional function to be called when a key is pressed in the number input
109
134
  */
110
135
  onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;
136
+ /**
137
+ * When type="text", provide an optional pattern to restrict user input. Has
138
+ * no effect when type="number".
139
+ */
140
+ pattern?: string;
111
141
  /**
112
142
  * Specify if the component should be read-only
113
143
  */
@@ -125,6 +155,12 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
125
155
  * Specify how much the values should increase/decrease upon clicking on up/down button
126
156
  */
127
157
  step?: number;
158
+ /**
159
+ * **Experimental**: Specify if the input should be of type text or number.
160
+ * Use type="text" with `locale`, `formatOptions`, and guide user input with
161
+ * `pattern` and `inputMode`.
162
+ */
163
+ type?: 'number' | 'text';
128
164
  /**
129
165
  * Specify the value of the input
130
166
  */
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import { Subtract, Add } from '@carbon/icons-react';
10
10
  import cx from 'classnames';
11
11
  import PropTypes from 'prop-types';
12
- import React, { useContext, useState, useRef, useEffect } from 'react';
12
+ import React, { useContext, useState, useMemo, useCallback, useRef, useEffect } from 'react';
13
13
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
14
14
  import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
15
15
  import { usePrefix } from '../../internal/usePrefix.js';
@@ -18,6 +18,11 @@ import '../FluidForm/FluidForm.js';
18
18
  import { FormContext } from '../FluidForm/FormContext.js';
19
19
  import '../Text/index.js';
20
20
  import { clamp } from '../../internal/clamp.js';
21
+ import { useControllableState } from '../../internal/useControllableState.js';
22
+ import { NumberParser, NumberFormatter } from '@carbon/utilities';
23
+ import { ArrowUp, ArrowDown } from '../../internal/keyboard/keys.js';
24
+ import { match } from '../../internal/keyboard/match.js';
25
+ import { NumberFormatOptionsPropType } from './NumberFormatPropTypes.js';
21
26
  import { Text } from '../Text/Text.js';
22
27
 
23
28
  var _Subtract, _Add;
@@ -42,25 +47,30 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
42
47
  disabled = false,
43
48
  disableWheel: disableWheelProp = false,
44
49
  defaultValue = 0,
50
+ formatOptions,
45
51
  helperText = '',
46
52
  hideLabel = false,
47
53
  hideSteppers,
48
54
  iconDescription,
49
55
  id,
50
- label,
56
+ inputMode,
51
57
  invalid = false,
52
58
  invalidText,
59
+ label,
53
60
  light,
61
+ locale = 'en-US',
54
62
  max,
55
63
  min,
56
64
  onChange,
57
65
  onClick,
58
66
  onKeyUp,
67
+ pattern = '[0-9]*',
59
68
  readOnly,
60
69
  size = 'md',
61
70
  slug,
62
71
  step = 1,
63
72
  translateWithId: t = id => defaultTranslations[id],
73
+ type = 'number',
64
74
  warn = false,
65
75
  warnText = '',
66
76
  value: controlledValue,
@@ -71,6 +81,10 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
71
81
  isFluid
72
82
  } = useContext(FormContext);
73
83
  const [isFocused, setIsFocused] = useState(false);
84
+
85
+ /**
86
+ * The input value, only used when type=number
87
+ */
74
88
  const [value, setValue] = useState(() => {
75
89
  if (controlledValue !== undefined) {
76
90
  return controlledValue;
@@ -84,6 +98,30 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
84
98
  return 0;
85
99
  });
86
100
  const [prevControlledValue, setPrevControlledValue] = useState(controlledValue);
101
+ const numberParser = useMemo(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);
102
+ /**
103
+ * The currently parsed number value.
104
+ * Only used when type=text
105
+ * Updated based on the `value` as the user types.
106
+ */
107
+ const [numberValue, setNumberValue, isControlled] = useControllableState({
108
+ name: 'NumberInput',
109
+ defaultValue: typeof defaultValue === 'string' ? numberParser.parse(defaultValue) : defaultValue,
110
+ value: typeof controlledValue === 'string' ? numberParser.parse(controlledValue) : controlledValue
111
+ });
112
+
113
+ /**
114
+ * The current text value of the input.
115
+ * Only used when type=text
116
+ * Updated as the user types and formatted on blur.
117
+ */
118
+ const [inputValue, setInputValue] = React.useState(() => isNaN(numberValue) ? '' : new NumberFormatter(locale, formatOptions).format(numberValue));
119
+ const numberingSystem = useMemo(() => numberParser.getNumberingSystem(inputValue), [numberParser, inputValue]);
120
+ const numberFormatter = useMemo(() => new NumberFormatter(locale, {
121
+ ...formatOptions,
122
+ numberingSystem
123
+ }), [locale, formatOptions, numberingSystem]);
124
+ const format = useCallback(value => isNaN(value) || value === null ? '' : numberFormatter.format(value), [numberFormatter]);
87
125
  const inputRef = useRef(null);
88
126
  const ref = useMergedRefs([forwardRef, inputRef]);
89
127
  const numberInputClasses = cx({
@@ -98,7 +136,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
98
136
  const isInputValid = getInputValidity({
99
137
  allowEmpty,
100
138
  invalid,
101
- value,
139
+ value: type === 'number' ? value : numberValue,
102
140
  max,
103
141
  min
104
142
  });
@@ -140,13 +178,24 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
140
178
  if (disabled) {
141
179
  return;
142
180
  }
143
- const state = {
144
- value: allowEmpty && event.target.value === '' ? '' : Number(event.target.value),
145
- direction: value < event.target.value ? 'up' : 'down'
146
- };
147
- setValue(state.value);
148
- if (onChange) {
149
- onChange(event, state);
181
+ if (type === 'number') {
182
+ const state = {
183
+ value: allowEmpty && event.target.value === '' ? '' : Number(event.target.value),
184
+ direction: value < event.target.value ? 'up' : 'down'
185
+ };
186
+ setValue(state.value);
187
+ if (onChange) {
188
+ onChange(event, state);
189
+ }
190
+ return;
191
+ }
192
+ if (type === 'text') {
193
+ const _value = allowEmpty && event.target.value === '' ? '' : event.target.value;
194
+ setNumberValue(numberParser.parse(_value));
195
+ setInputValue(_value);
196
+ // The onChange prop isn't called here because it will be called on blur
197
+ // or on click of a stepper, after the number is parsed and formatted
198
+ // according to the locale.
150
199
  }
151
200
  }
152
201
  const handleFocus = evt => {
@@ -168,21 +217,44 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
168
217
  const parts = num.toString().split('.');
169
218
  return parts[1] ? parts[1].length : 0;
170
219
  };
171
- const handleStepperClick = (event, direction) => {
220
+ const handleStep = (event, direction) => {
172
221
  if (inputRef.current) {
173
- const currentValue = Number(inputRef.current.value);
222
+ const currentValue = type === 'number' ? Number(inputRef.current.value) : numberParser.parse(inputRef.current.value);
174
223
  const rawValue = direction === 'up' ? currentValue + step : currentValue - step;
175
224
  const precision = Math.max(getDecimalPlaces(currentValue), getDecimalPlaces(step));
176
225
  const floatValue = parseFloat(rawValue.toFixed(precision));
177
226
  const newValue = clamp(floatValue, min ?? -Infinity, max ?? Infinity);
178
- const state = {
179
- value: allowEmpty && inputRef.current.value === '' && step === 0 ? '' : newValue,
180
- direction
181
- };
182
- setValue(state.value);
227
+ let state;
228
+ if (type === 'number') {
229
+ state = {
230
+ value: allowEmpty && inputRef.current.value === '' && step === 0 ? '' : newValue,
231
+ direction
232
+ };
233
+ setValue(state.value);
234
+ }
235
+ if (type === 'text') {
236
+ const formattedNewValue = format(newValue);
237
+ state = {
238
+ value: allowEmpty && inputRef.current.value === '' && step === 0 ? '' : formattedNewValue,
239
+ direction
240
+ };
241
+
242
+ // newValue does not need to be parsed because it is derived from
243
+ // currentValue, which is parsed at the beginning of this function
244
+ setNumberValue(newValue);
245
+ setInputValue(formattedNewValue);
246
+ }
183
247
  if (onChange) {
184
248
  onChange(event, state);
185
249
  }
250
+ return state;
251
+ }
252
+ };
253
+ const handleStepperClick = (event, direction) => {
254
+ if (inputRef.current) {
255
+ const {
256
+ state
257
+ } = handleStep(event, direction);
186
258
  if (onClick) {
187
259
  onClick(event, state);
188
260
  }
@@ -234,6 +306,15 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
234
306
  onClick: onClick,
235
307
  onChange: handleOnChange,
236
308
  onKeyUp: onKeyUp,
309
+ onKeyDown: e => {
310
+ if (type === 'text') {
311
+ match(e, ArrowUp) && handleStep(e, 'up');
312
+ match(e, ArrowDown) && handleStep(e, 'down');
313
+ }
314
+ if (rest?.onKeyDown) {
315
+ rest?.onKeyDown(e);
316
+ }
317
+ },
237
318
  onFocus: e => {
238
319
  if (disableWheelProp) {
239
320
  e.target.addEventListener('wheel', disableWheel);
@@ -246,15 +327,32 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
246
327
  if (disableWheelProp) {
247
328
  e.target.removeEventListener('wheel', disableWheel);
248
329
  }
330
+ if (type === 'text') {
331
+ // When isControlled, the current inputValue needs re-parsed
332
+ // because the consumer's onChange hasn't been called yet and
333
+ // the `numberValue` we have in state is the (stale) value
334
+ // they've passed in.
335
+ const _numberValue = isControlled ? numberParser.parse(inputValue) : numberValue;
336
+ const formattedValue = isNaN(_numberValue) ? '' : format(_numberValue);
337
+ setInputValue(formattedValue);
338
+ if (onChange) {
339
+ const state = {
340
+ value: formattedValue,
341
+ direction: value < e.target.value ? 'up' : 'down'
342
+ };
343
+ onChange(e, state);
344
+ }
345
+ }
249
346
  if (rest.onBlur) {
250
347
  rest.onBlur(e);
251
348
  }
252
349
  },
253
- pattern: "[0-9]*",
350
+ pattern: pattern,
351
+ inputMode: inputMode,
254
352
  readOnly: readOnly,
255
353
  step: step,
256
- type: "number",
257
- value: value
354
+ type: type,
355
+ value: type === 'number' ? value : inputValue
258
356
  })), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
259
357
  className: `${prefix}--number__input-inner-wrapper--decorator`
260
358
  }, normalizedDecorator) : '', Icon ? /*#__PURE__*/React.createElement(Icon, {
@@ -311,13 +409,20 @@ NumberInput.propTypes = {
311
409
  */
312
410
  defaultValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
313
411
  /**
314
- * Specify if the wheel functionality for the input should be disabled, or not
412
+ * Specify if the wheel functionality for the input should be disabled, or no t
315
413
  */
316
414
  disableWheel: PropTypes.bool,
317
415
  /**
318
416
  * Specify if the control should be disabled, or not
319
417
  */
320
418
  disabled: PropTypes.bool,
419
+ /**
420
+ * **Experimental:** Specify Intl.NumberFormat options applied to internal
421
+ * number parsing and formatting. Use with `type="text"`, has no effect when
422
+ * `type="number"`.
423
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
424
+ */
425
+ formatOptions: NumberFormatOptionsPropType,
321
426
  /**
322
427
  * Provide text that is used alongside the control label for additional help
323
428
  */
@@ -338,6 +443,12 @@ NumberInput.propTypes = {
338
443
  * Specify a custom `id` for the input
339
444
  */
340
445
  id: PropTypes.string.isRequired,
446
+ /**
447
+ * Instruct the browser which keyboard to display on mobile devices. Note that
448
+ * standard numeric keyboards vary across devices and operating systems.
449
+ * @see https://css-tricks.com/everything-you-ever-wanted-to-know-about-inputmode/
450
+ */
451
+ inputMode: PropTypes.oneOf(['none', 'text', 'tel', 'url', 'email', 'numeric', 'decimal', 'search']),
341
452
  /**
342
453
  * Specify if the currently value is invalid.
343
454
  */
@@ -355,6 +466,12 @@ NumberInput.propTypes = {
355
466
  * `true` to use the light version.
356
467
  */
357
468
  light: deprecate(PropTypes.bool, 'The `light` prop for `NumberInput` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
469
+ /**
470
+ * **Experimental:** Specify a [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt)
471
+ * language code for parsing and formatting. Use with `type="text"`, has no
472
+ * effect when `type="number"`.
473
+ */
474
+ locale: PropTypes.string,
358
475
  /**
359
476
  * The maximum value.
360
477
  */
@@ -366,6 +483,9 @@ NumberInput.propTypes = {
366
483
  /**
367
484
  * Provide an optional handler that is called when the internal state of
368
485
  * NumberInput changes. This handler is called with event and state info.
486
+ * When type="number", this is called on every change of the input.
487
+ * When type="text", this is only called on blur after the number has been
488
+ * parsed and formatted.
369
489
  * `(event, { value, direction }) => void`
370
490
  */
371
491
  onChange: PropTypes.func,
@@ -377,6 +497,11 @@ NumberInput.propTypes = {
377
497
  * Provide an optional function to be called when a key is pressed in the number input
378
498
  */
379
499
  onKeyUp: PropTypes.func,
500
+ /**
501
+ * When type="text", provide an optional pattern to restrict user input. Has
502
+ * no effect when type="number".
503
+ */
504
+ pattern: PropTypes.string,
380
505
  /**
381
506
  * Specify if the component should be read-only
382
507
  */
@@ -386,17 +511,25 @@ NumberInput.propTypes = {
386
511
  */
387
512
  size: PropTypes.oneOf(['sm', 'md', 'lg']),
388
513
  /**
389
- * **Experimental**: Provide a `Slug` component to be rendered inside the `NumberInput` component
514
+ * **Experimental**: Provide a `Slug` component to be rendered inside the
515
+ * `NumberInput` component
390
516
  */
391
517
  slug: deprecate(PropTypes.node, 'The `slug` prop for `NumberInput` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `decorator` prop. It will be moved in the next major release.'),
392
518
  /**
393
- * Specify how much the values should increase/decrease upon clicking on up/down button
519
+ * Specify how much the values should increase/decrease upon clicking on
520
+ * up/down button
394
521
  */
395
522
  step: PropTypes.number,
396
523
  /**
397
524
  * Provide custom text for the component for each translation id
398
525
  */
399
526
  translateWithId: PropTypes.func,
527
+ /**
528
+ * **Experimental**: Specify if the input should be of type text or number.
529
+ * Use type="text" with `locale`, `formatOptions`, and guide user input with
530
+ * `pattern` and `inputMode`.
531
+ */
532
+ type: PropTypes.oneOf(['number', 'text']),
400
533
  /**
401
534
  * Specify the value of the input
402
535
  */
@@ -410,13 +543,12 @@ NumberInput.propTypes = {
410
543
  */
411
544
  warnText: PropTypes.node
412
545
  };
413
- const Label = _ref => {
414
- let {
415
- disabled,
416
- id,
417
- hideLabel,
418
- label
419
- } = _ref;
546
+ const Label = ({
547
+ disabled,
548
+ id,
549
+ hideLabel,
550
+ label
551
+ }) => {
420
552
  const prefix = usePrefix();
421
553
  const className = cx({
422
554
  [`${prefix}--label`]: true,
@@ -438,12 +570,11 @@ Label.propTypes = {
438
570
  id: PropTypes.string,
439
571
  label: PropTypes.node
440
572
  };
441
- function HelperText(_ref2) {
442
- let {
443
- disabled,
444
- description,
445
- id
446
- } = _ref2;
573
+ function HelperText({
574
+ disabled,
575
+ description,
576
+ id
577
+ }) {
447
578
  const prefix = usePrefix();
448
579
  const className = cx(`${prefix}--form__helper-text`, {
449
580
  [`${prefix}--form__helper-text--disabled`]: disabled
@@ -476,14 +607,13 @@ HelperText.propTypes = {
476
607
  * @param {number} config.min
477
608
  * @returns {boolean}
478
609
  */
479
- function getInputValidity(_ref3) {
480
- let {
481
- allowEmpty,
482
- invalid,
483
- value,
484
- max,
485
- min
486
- } = _ref3;
610
+ function getInputValidity({
611
+ allowEmpty,
612
+ invalid,
613
+ value,
614
+ max,
615
+ min
616
+ }) {
487
617
  if (invalid) {
488
618
  return false;
489
619
  }
@@ -11,14 +11,13 @@ import React from 'react';
11
11
  import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
13
 
14
- function OrderedList(_ref) {
15
- let {
16
- className,
17
- nested = false,
18
- native = false,
19
- isExpressive = false,
20
- ...other
21
- } = _ref;
14
+ function OrderedList({
15
+ className,
16
+ nested = false,
17
+ native = false,
18
+ isExpressive = false,
19
+ ...other
20
+ }) {
22
21
  const prefix = usePrefix();
23
22
  const classNames = cx({
24
23
  [`${prefix}--list--ordered`]: !native,
@@ -106,7 +106,7 @@ export interface OverflowMenuProps {
106
106
  */
107
107
  selectorPrimaryFocus?: string;
108
108
  /**
109
- * Specify the size of the OverflowMenu. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
109
+ * Specify the size of the OverflowMenu. Currently supports either `sm`, `md` (default) or `lg` as an option.
110
110
  */
111
111
  size?: 'sm' | 'md' | 'lg';
112
112
  /**