@carbon/react 1.40.0 → 1.41.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 (260) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1564 -872
  2. package/es/components/Accordion/Accordion.Skeleton.d.ts +0 -5
  3. package/es/components/Accordion/Accordion.Skeleton.js +0 -5
  4. package/es/components/Breadcrumb/BreadcrumbItem.js +3 -1
  5. package/es/components/Checkbox/Checkbox.js +3 -6
  6. package/es/components/CodeSnippet/CodeSnippet.js +5 -12
  7. package/es/components/ComboBox/ComboBox.d.ts +1 -5
  8. package/es/components/ComboBox/ComboBox.js +6 -20
  9. package/es/components/ComposedModal/ComposedModal.js +1 -5
  10. package/es/components/ComposedModal/ModalFooter.js +4 -9
  11. package/es/components/ComposedModal/ModalHeader.js +1 -4
  12. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +3 -8
  13. package/es/components/ContentSwitcher/ContentSwitcher.js +7 -11
  14. package/es/components/Copy/Copy.js +4 -8
  15. package/es/components/CopyButton/CopyButton.js +8 -7
  16. package/es/components/DataTable/DataTable.d.ts +3 -39
  17. package/es/components/DataTable/DataTable.js +10 -18
  18. package/es/components/DataTable/Table.d.ts +0 -4
  19. package/es/components/DataTable/Table.js +4 -7
  20. package/es/components/DataTable/TableBatchAction.js +12 -5
  21. package/es/components/DataTable/TableBatchActions.js +1 -6
  22. package/es/components/DataTable/TableBody.d.ts +0 -3
  23. package/es/components/DataTable/TableBody.js +1 -3
  24. package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
  25. package/es/components/DataTable/TableHeader.js +3 -8
  26. package/es/components/DataTable/TableSelectAll.d.ts +0 -3
  27. package/es/components/DataTable/TableSelectAll.js +1 -4
  28. package/es/components/DataTable/TableToolbar.d.ts +10 -0
  29. package/es/components/DataTable/TableToolbar.js +15 -7
  30. package/es/components/DataTable/TableToolbarMenu.js +2 -6
  31. package/es/components/DataTable/TableToolbarSearch.d.ts +2 -8
  32. package/es/components/DataTable/TableToolbarSearch.js +6 -11
  33. package/es/components/DataTable/tools/sorting.js +2 -2
  34. package/es/components/DatePicker/DatePicker.d.ts +4 -4
  35. package/es/components/DatePicker/DatePicker.js +9 -4
  36. package/es/components/DatePicker/plugins/fixEventsPlugin.js +6 -0
  37. package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  38. package/es/components/DatePickerInput/DatePickerInput.js +12 -6
  39. package/es/components/Dropdown/Dropdown.js +6 -15
  40. package/es/components/FileUploader/FileUploader.d.ts +2 -11
  41. package/es/components/FileUploader/FileUploader.js +15 -19
  42. package/es/components/FileUploader/FileUploaderButton.js +2 -2
  43. package/es/components/FileUploader/FileUploaderDropContainer.d.ts +0 -7
  44. package/es/components/FileUploader/FileUploaderDropContainer.js +2 -8
  45. package/es/components/FileUploader/FileUploaderItem.d.ts +0 -4
  46. package/es/components/FileUploader/FileUploaderItem.js +12 -9
  47. package/es/components/FileUploader/Filename.d.ts +6 -10
  48. package/es/components/FileUploader/Filename.js +7 -11
  49. package/es/components/FormGroup/FormGroup.d.ts +0 -5
  50. package/es/components/FormGroup/FormGroup.js +3 -8
  51. package/es/components/FormItem/FormItem.d.ts +32 -0
  52. package/es/components/FormItem/index.d.ts +9 -0
  53. package/es/components/FormLabel/FormLabel.js +4 -1
  54. package/es/components/ListBox/ListBox.js +4 -8
  55. package/es/components/ListBox/ListBoxMenuIcon.js +1 -4
  56. package/es/components/ListBox/ListBoxMenuItem.js +4 -8
  57. package/es/components/ListBox/ListBoxSelection.d.ts +5 -5
  58. package/es/components/ListBox/ListBoxSelection.js +12 -13
  59. package/es/components/ListBox/next/ListBoxSelection.js +12 -13
  60. package/es/components/ListBox/next/ListBoxTrigger.js +3 -5
  61. package/es/components/ListItem/ListItem.d.ts +1 -1
  62. package/es/components/ListItem/ListItem.js +6 -2
  63. package/es/components/Menu/MenuItem.js +4 -1
  64. package/es/components/Modal/Modal.d.ts +137 -0
  65. package/es/components/Modal/Modal.js +39 -45
  66. package/es/components/Modal/index.d.ts +9 -0
  67. package/es/components/ModalWrapper/ModalWrapper.js +13 -19
  68. package/es/components/MultiSelect/FilterableMultiSelect.js +14 -28
  69. package/es/components/MultiSelect/MultiSelect.js +17 -33
  70. package/es/components/MultiSelect/MultiSelectPropTypes.js +2 -2
  71. package/es/components/MultiSelect/tools/sorting.js +2 -2
  72. package/es/components/Notification/Notification.d.ts +11 -29
  73. package/es/components/Notification/Notification.js +38 -57
  74. package/es/components/NumberInput/NumberInput.js +6 -2
  75. package/es/components/OverflowMenu/OverflowMenu.js +27 -33
  76. package/es/components/OverflowMenuItem/OverflowMenuItem.js +4 -1
  77. package/es/components/Pagination/experimental/PageSelector.js +3 -8
  78. package/es/components/Pagination/experimental/Pagination.js +16 -34
  79. package/es/components/ProgressIndicator/ProgressIndicator.js +7 -6
  80. package/es/components/RadioTile/RadioTile.js +6 -7
  81. package/es/components/Search/Search.Skeleton.d.ts +0 -3
  82. package/es/components/Search/Search.Skeleton.js +1 -4
  83. package/es/components/Select/Select.d.ts +2 -2
  84. package/es/components/Select/Select.js +13 -16
  85. package/es/components/SelectItem/SelectItem.d.ts +0 -6
  86. package/es/components/SelectItem/SelectItem.js +4 -10
  87. package/es/components/SelectItemGroup/SelectItemGroup.d.ts +0 -3
  88. package/es/components/SelectItemGroup/SelectItemGroup.js +1 -4
  89. package/es/components/SkeletonIcon/SkeletonIcon.d.ts +13 -0
  90. package/es/components/SkeletonIcon/SkeletonIcon.js +2 -3
  91. package/es/components/SkeletonText/SkeletonText.d.ts +0 -6
  92. package/es/components/SkeletonText/SkeletonText.js +0 -6
  93. package/es/components/Slider/Slider.Skeleton.d.ts +9 -1
  94. package/es/components/Slider/Slider.Skeleton.js +20 -4
  95. package/es/components/Slider/Slider.d.ts +137 -25
  96. package/es/components/Slider/Slider.js +779 -186
  97. package/es/components/StructuredList/StructuredList.js +5 -2
  98. package/es/components/Switch/Switch.js +3 -7
  99. package/es/components/Tabs/Tabs.js +5 -2
  100. package/es/components/Tag/Tag.js +4 -2
  101. package/es/components/Text/Text.js +1 -1
  102. package/es/components/Text/TextDirection.d.ts +1 -1
  103. package/es/components/TextArea/TextArea.js +30 -34
  104. package/es/components/TextInput/ControlledPasswordInput.js +12 -19
  105. package/es/components/TextInput/TextInput.js +8 -3
  106. package/es/components/Tile/Tile.js +5 -3
  107. package/es/components/TileGroup/TileGroup.js +5 -4
  108. package/es/components/Toggle/Toggle.js +4 -2
  109. package/es/components/Toggletip/index.d.ts +6 -1
  110. package/es/components/Toggletip/index.js +7 -1
  111. package/es/components/UIShell/Content.js +1 -4
  112. package/es/components/UIShell/SideNav.d.ts +1 -1
  113. package/es/components/UIShell/SideNavDetails.d.ts +32 -0
  114. package/es/components/UIShell/SideNavDetails.js +1 -2
  115. package/es/components/UIShell/SideNavDivider.d.ts +15 -0
  116. package/es/components/UIShell/SideNavDivider.js +2 -2
  117. package/es/components/UIShell/SideNavFooter.js +2 -5
  118. package/es/components/UIShell/SideNavIcon.d.ts +25 -0
  119. package/es/components/UIShell/SideNavIcon.js +4 -7
  120. package/es/components/UIShell/SideNavSwitcher.d.ts +31 -0
  121. package/es/components/UIShell/SideNavSwitcher.js +6 -5
  122. package/es/index.js +2 -2
  123. package/es/internal/FloatingMenu.js +2 -7
  124. package/es/internal/Selection.js +0 -3
  125. package/es/internal/noopFn.d.ts +7 -0
  126. package/es/internal/noopFn.js +10 -0
  127. package/es/internal/useNormalizedInputProps.js +6 -2
  128. package/es/internal/wrapFocus.js +5 -5
  129. package/es/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
  130. package/lib/components/Accordion/Accordion.Skeleton.d.ts +0 -5
  131. package/lib/components/Accordion/Accordion.Skeleton.js +0 -5
  132. package/lib/components/Breadcrumb/BreadcrumbItem.js +3 -1
  133. package/lib/components/Checkbox/Checkbox.js +3 -6
  134. package/lib/components/CodeSnippet/CodeSnippet.js +5 -12
  135. package/lib/components/ComboBox/ComboBox.d.ts +1 -5
  136. package/lib/components/ComboBox/ComboBox.js +5 -19
  137. package/lib/components/ComposedModal/ComposedModal.js +1 -5
  138. package/lib/components/ComposedModal/ModalFooter.js +4 -9
  139. package/lib/components/ComposedModal/ModalHeader.js +1 -4
  140. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +3 -8
  141. package/lib/components/ContentSwitcher/ContentSwitcher.js +7 -11
  142. package/lib/components/Copy/Copy.js +4 -8
  143. package/lib/components/CopyButton/CopyButton.js +8 -7
  144. package/lib/components/DataTable/DataTable.d.ts +3 -39
  145. package/lib/components/DataTable/DataTable.js +13 -21
  146. package/lib/components/DataTable/Table.d.ts +0 -4
  147. package/lib/components/DataTable/Table.js +3 -6
  148. package/lib/components/DataTable/TableBatchAction.js +12 -5
  149. package/lib/components/DataTable/TableBatchActions.js +1 -6
  150. package/lib/components/DataTable/TableBody.d.ts +0 -3
  151. package/lib/components/DataTable/TableBody.js +1 -3
  152. package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
  153. package/lib/components/DataTable/TableHeader.js +3 -8
  154. package/lib/components/DataTable/TableSelectAll.d.ts +0 -3
  155. package/lib/components/DataTable/TableSelectAll.js +1 -4
  156. package/lib/components/DataTable/TableToolbar.d.ts +10 -0
  157. package/lib/components/DataTable/TableToolbar.js +15 -7
  158. package/lib/components/DataTable/TableToolbarMenu.js +2 -6
  159. package/lib/components/DataTable/TableToolbarSearch.d.ts +2 -8
  160. package/lib/components/DataTable/TableToolbarSearch.js +6 -11
  161. package/lib/components/DataTable/tools/sorting.js +2 -2
  162. package/lib/components/DatePicker/DatePicker.d.ts +4 -4
  163. package/lib/components/DatePicker/DatePicker.js +9 -4
  164. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +6 -0
  165. package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  166. package/lib/components/DatePickerInput/DatePickerInput.js +12 -6
  167. package/lib/components/Dropdown/Dropdown.js +6 -15
  168. package/lib/components/FileUploader/FileUploader.d.ts +2 -11
  169. package/lib/components/FileUploader/FileUploader.js +15 -19
  170. package/lib/components/FileUploader/FileUploaderButton.js +2 -2
  171. package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +0 -7
  172. package/lib/components/FileUploader/FileUploaderDropContainer.js +2 -8
  173. package/lib/components/FileUploader/FileUploaderItem.d.ts +0 -4
  174. package/lib/components/FileUploader/FileUploaderItem.js +12 -9
  175. package/lib/components/FileUploader/Filename.d.ts +6 -10
  176. package/lib/components/FileUploader/Filename.js +7 -11
  177. package/lib/components/FormGroup/FormGroup.d.ts +0 -5
  178. package/lib/components/FormGroup/FormGroup.js +3 -8
  179. package/lib/components/FormItem/FormItem.d.ts +32 -0
  180. package/lib/components/FormItem/index.d.ts +9 -0
  181. package/lib/components/FormLabel/FormLabel.js +4 -1
  182. package/lib/components/ListBox/ListBox.js +4 -8
  183. package/lib/components/ListBox/ListBoxMenuIcon.js +1 -4
  184. package/lib/components/ListBox/ListBoxMenuItem.js +4 -8
  185. package/lib/components/ListBox/ListBoxSelection.d.ts +5 -5
  186. package/lib/components/ListBox/ListBoxSelection.js +12 -13
  187. package/lib/components/ListBox/next/ListBoxSelection.js +12 -13
  188. package/lib/components/ListBox/next/ListBoxTrigger.js +3 -5
  189. package/lib/components/ListItem/ListItem.d.ts +1 -1
  190. package/lib/components/ListItem/ListItem.js +6 -2
  191. package/lib/components/Menu/MenuItem.js +4 -1
  192. package/lib/components/Modal/Modal.d.ts +137 -0
  193. package/lib/components/Modal/Modal.js +40 -45
  194. package/lib/components/Modal/index.d.ts +9 -0
  195. package/lib/components/ModalWrapper/ModalWrapper.js +13 -19
  196. package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -32
  197. package/lib/components/MultiSelect/MultiSelect.js +16 -32
  198. package/lib/components/MultiSelect/MultiSelectPropTypes.js +2 -2
  199. package/lib/components/MultiSelect/tools/sorting.js +2 -2
  200. package/lib/components/Notification/Notification.d.ts +11 -29
  201. package/lib/components/Notification/Notification.js +38 -57
  202. package/lib/components/NumberInput/NumberInput.js +6 -2
  203. package/lib/components/OverflowMenu/OverflowMenu.js +27 -33
  204. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -1
  205. package/lib/components/Pagination/experimental/PageSelector.js +3 -8
  206. package/lib/components/Pagination/experimental/Pagination.js +16 -34
  207. package/lib/components/ProgressIndicator/ProgressIndicator.js +7 -6
  208. package/lib/components/RadioTile/RadioTile.js +6 -7
  209. package/lib/components/Search/Search.Skeleton.d.ts +0 -3
  210. package/lib/components/Search/Search.Skeleton.js +1 -4
  211. package/lib/components/Select/Select.d.ts +2 -2
  212. package/lib/components/Select/Select.js +13 -16
  213. package/lib/components/SelectItem/SelectItem.d.ts +0 -6
  214. package/lib/components/SelectItem/SelectItem.js +4 -10
  215. package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +0 -3
  216. package/lib/components/SelectItemGroup/SelectItemGroup.js +1 -4
  217. package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +13 -0
  218. package/lib/components/SkeletonIcon/SkeletonIcon.js +2 -3
  219. package/lib/components/SkeletonText/SkeletonText.d.ts +0 -6
  220. package/lib/components/SkeletonText/SkeletonText.js +0 -6
  221. package/lib/components/Slider/Slider.Skeleton.d.ts +9 -1
  222. package/lib/components/Slider/Slider.Skeleton.js +20 -4
  223. package/lib/components/Slider/Slider.d.ts +137 -25
  224. package/lib/components/Slider/Slider.js +778 -185
  225. package/lib/components/StructuredList/StructuredList.js +5 -2
  226. package/lib/components/Switch/Switch.js +3 -7
  227. package/lib/components/Tabs/Tabs.js +5 -2
  228. package/lib/components/Tag/Tag.js +4 -2
  229. package/lib/components/Text/Text.js +1 -1
  230. package/lib/components/Text/TextDirection.d.ts +1 -1
  231. package/lib/components/TextArea/TextArea.js +30 -34
  232. package/lib/components/TextInput/ControlledPasswordInput.js +12 -19
  233. package/lib/components/TextInput/TextInput.js +8 -3
  234. package/lib/components/Tile/Tile.js +5 -3
  235. package/lib/components/TileGroup/TileGroup.js +5 -4
  236. package/lib/components/Toggle/Toggle.js +4 -2
  237. package/lib/components/Toggletip/index.d.ts +6 -1
  238. package/lib/components/Toggletip/index.js +7 -1
  239. package/lib/components/UIShell/Content.js +1 -4
  240. package/lib/components/UIShell/SideNav.d.ts +1 -1
  241. package/lib/components/UIShell/SideNavDetails.d.ts +32 -0
  242. package/lib/components/UIShell/SideNavDetails.js +1 -2
  243. package/lib/components/UIShell/SideNavDivider.d.ts +15 -0
  244. package/lib/components/UIShell/SideNavDivider.js +2 -2
  245. package/lib/components/UIShell/SideNavFooter.js +2 -5
  246. package/lib/components/UIShell/SideNavIcon.d.ts +25 -0
  247. package/lib/components/UIShell/SideNavIcon.js +4 -7
  248. package/lib/components/UIShell/SideNavSwitcher.d.ts +31 -0
  249. package/lib/components/UIShell/SideNavSwitcher.js +5 -4
  250. package/lib/index.js +4 -4
  251. package/lib/internal/FloatingMenu.js +2 -7
  252. package/lib/internal/Selection.js +0 -3
  253. package/lib/internal/noopFn.d.ts +7 -0
  254. package/lib/internal/noopFn.js +14 -0
  255. package/lib/internal/useNormalizedInputProps.js +6 -2
  256. package/lib/internal/wrapFocus.js +5 -5
  257. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
  258. package/package.json +9 -9
  259. package/scss/components/slug/_index.scss +9 -0
  260. package/scss/components/slug/_slug.scss +9 -0
@@ -10,13 +10,80 @@ import React__default, { PureComponent } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
12
  import throttle from 'lodash.throttle';
13
- import { ArrowDown, ArrowLeft, ArrowUp, ArrowRight } from '../../internal/keyboard/keys.js';
14
- import { matches } from '../../internal/keyboard/match.js';
13
+ import { ArrowDown, ArrowLeft, ArrowUp, ArrowRight, Enter } from '../../internal/keyboard/keys.js';
15
14
  import { PrefixContext } from '../../internal/usePrefix.js';
16
15
  import deprecate from '../../prop-types/deprecate.js';
17
16
  import { FeatureFlagContext } from '../FeatureFlags/index.js';
18
17
  import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
18
+ import '../Text/index.js';
19
+ import { matches } from '../../internal/keyboard/match.js';
20
+ import { Text } from '../Text/Text.js';
19
21
 
22
+ var _path, _path2, _path3, _path4, _path5, _path6, _path7, _path8, _path9, _path10, _path11, _path12, _path13, _path14, _LowerHandle, _LowerHandleFocus, _UpperHandle, _UpperHandleFocus, _UpperHandle2, _UpperHandleFocus2, _LowerHandle2, _LowerHandleFocus2;
23
+ const LowerHandle = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
24
+ xmlns: "http://www.w3.org/2000/svg",
25
+ viewBox: "0 0 16 24",
26
+ className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--lower`
27
+ }, _path || (_path = /*#__PURE__*/React__default.createElement("path", {
28
+ d: "M15.08 6.46H16v11.08h-.92zM4.46 17.54c-.25 0-.46-.21-.46-.46V6.92a.465.465 0 0 1 .69-.4l8.77 5.08a.46.46 0 0 1 0 .8l-8.77 5.08c-.07.04-.15.06-.23.06Z"
29
+ })), _path2 || (_path2 = /*#__PURE__*/React__default.createElement("path", {
30
+ fill: "none",
31
+ d: "M-4 0h24v24H-4z"
32
+ }))));
33
+ const LowerHandleFocus = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
34
+ xmlns: "http://www.w3.org/2000/svg",
35
+ viewBox: "0 0 16 24",
36
+ className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--lower ${prefix}--slider__thumb-icon--focus`
37
+ }, _path3 || (_path3 = /*#__PURE__*/React__default.createElement("path", {
38
+ d: "M15.08 6.46H16v11.08h-.92zM4.46 17.54c-.25 0-.46-.21-.46-.46V6.92a.465.465 0 0 1 .69-.4l8.77 5.08a.46.46 0 0 1 0 .8l-8.77 5.08c-.07.04-.15.06-.23.06Z"
39
+ })), _path4 || (_path4 = /*#__PURE__*/React__default.createElement("path", {
40
+ fill: "none",
41
+ d: "M-4 0h24v24H-4z"
42
+ })), _path5 || (_path5 = /*#__PURE__*/React__default.createElement("path", {
43
+ d: "M15.08 0H16v6.46h-.92z"
44
+ })), _path6 || (_path6 = /*#__PURE__*/React__default.createElement("path", {
45
+ d: "M0 0h.92v24H0zM15.08 0H16v24h-.92z"
46
+ })), _path7 || (_path7 = /*#__PURE__*/React__default.createElement("path", {
47
+ d: "M0 .92V0h16v.92zM0 24v-.92h16V24z"
48
+ }))));
49
+ const UpperHandle = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
50
+ xmlns: "http://www.w3.org/2000/svg",
51
+ viewBox: "0 0 16 24",
52
+ className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--upper`
53
+ }, _path8 || (_path8 = /*#__PURE__*/React__default.createElement("path", {
54
+ d: "M0 6.46h.92v11.08H0zM11.54 6.46c.25 0 .46.21.46.46v10.15a.465.465 0 0 1-.69.4L2.54 12.4a.46.46 0 0 1 0-.8l8.77-5.08c.07-.04.15-.06.23-.06Z"
55
+ })), _path9 || (_path9 = /*#__PURE__*/React__default.createElement("path", {
56
+ fill: "none",
57
+ d: "M-4 0h24v24H-4z"
58
+ }))));
59
+ const UpperHandleFocus = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
60
+ xmlns: "http://www.w3.org/2000/svg",
61
+ viewBox: "0 0 16 24",
62
+ className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--upper ${prefix}--slider__thumb-icon--focus`
63
+ }, _path10 || (_path10 = /*#__PURE__*/React__default.createElement("path", {
64
+ d: "M0 6.46h.92v11.08H0zM11.54 6.46c.25 0 .46.21.46.46v10.15a.465.465 0 0 1-.69.4L2.54 12.4a.46.46 0 0 1 0-.8l8.77-5.08c.07-.04.15-.06.23-.06Z"
65
+ })), _path11 || (_path11 = /*#__PURE__*/React__default.createElement("path", {
66
+ fill: "none",
67
+ d: "M-4 0h24v24H-4z"
68
+ })), _path12 || (_path12 = /*#__PURE__*/React__default.createElement("path", {
69
+ d: "M.92 24H0v-6.46h.92z"
70
+ })), _path13 || (_path13 = /*#__PURE__*/React__default.createElement("path", {
71
+ d: "M16 24h-.92V0H16zM.92 24H0V0h.92z"
72
+ })), _path14 || (_path14 = /*#__PURE__*/React__default.createElement("path", {
73
+ d: "M16 23.08V24H0v-.92zM16 0v.92H0V0z"
74
+ }))));
75
+ const translationIds = {
76
+ autoCorrectAnnouncement: 'carbon.slider.auto-correct-announcement'
77
+ };
78
+ function translateWithId(translationId, translationState) {
79
+ if (translationId === translationIds.autoCorrectAnnouncement && translationState?.correctedValue) {
80
+ const {
81
+ correctedValue
82
+ } = translationState;
83
+ return `The inputted value "${correctedValue}" was corrected to the nearest allowed digit.`;
84
+ }
85
+ return '';
86
+ }
20
87
  const defaultFormatLabel = (value, label) => {
21
88
  return typeof label === 'function' ? label(value) : `${value}${label}`;
22
89
  };
@@ -35,17 +102,35 @@ const DRAG_EVENT_TYPES = new Set(['mousemove', 'touchmove']);
35
102
  * Event types that trigger a "drag" to stop.
36
103
  */
37
104
  const DRAG_STOP_EVENT_TYPES = new Set(['mouseup', 'touchend', 'touchcancel']);
105
+
106
+ /**
107
+ * Distinguish two handles by lower and upper positions.
108
+ */
109
+ var HandlePosition = /*#__PURE__*/function (HandlePosition) {
110
+ HandlePosition["LOWER"] = "lower";
111
+ HandlePosition["UPPER"] = "upper";
112
+ return HandlePosition;
113
+ }(HandlePosition || {});
38
114
  class Slider extends PureComponent {
39
115
  constructor(props) {
116
+ var _this;
40
117
  super(props);
118
+ _this = this;
41
119
  _defineProperty(this, "state", {
42
120
  value: this.props.value,
121
+ valueUpper: this.props.unstable_valueUpper,
43
122
  left: 0,
123
+ leftUpper: 0,
44
124
  needsOnRelease: false,
45
125
  isValid: true,
126
+ isValidUpper: true,
127
+ activeHandle: null,
128
+ correctedValue: null,
129
+ correctedPosition: null,
46
130
  isRtl: false
47
131
  });
48
132
  _defineProperty(this, "thumbRef", void 0);
133
+ _defineProperty(this, "thumbRefUpper", void 0);
49
134
  _defineProperty(this, "filledTrackRef", void 0);
50
135
  _defineProperty(this, "element", null);
51
136
  _defineProperty(this, "inputId", '');
@@ -72,10 +157,24 @@ class Slider extends PureComponent {
72
157
  DRAG_EVENT_TYPES.forEach(element => {
73
158
  this.element?.ownerDocument.addEventListener(element, this.onDrag);
74
159
  });
160
+ const clientX = this.getClientXFromEvent(evt);
161
+ let activeHandle;
162
+ if (this.hasTwoHandles()) {
163
+ const distanceToLower = this.calcDistanceToHandle(HandlePosition.LOWER, clientX);
164
+ const distanceToUpper = this.calcDistanceToHandle(HandlePosition.UPPER, clientX);
165
+ if (distanceToLower <= distanceToUpper) {
166
+ activeHandle = HandlePosition.LOWER;
167
+ } else {
168
+ activeHandle = HandlePosition.UPPER;
169
+ }
170
+ }
171
+ this.setState({
172
+ activeHandle
173
+ });
75
174
 
76
175
  // Perform first recalculation since we probably didn't click exactly in the
77
- // middle of the thumb
78
- this.onDrag(evt);
176
+ // middle of the thumb.
177
+ this.onDrag(evt, activeHandle);
79
178
  });
80
179
  /**
81
180
  * Unregisters "drag" and "drag stop" event handlers and calls sets the flag
@@ -97,10 +196,11 @@ class Slider extends PureComponent {
97
196
  this.element?.ownerDocument.removeEventListener(element, this.onDrag);
98
197
  });
99
198
 
100
- // Set needsOnRelease flag so event fires on next update
199
+ // Set needsOnRelease flag so event fires on next update.
101
200
  this.setState({
102
201
  needsOnRelease: true,
103
- isValid: true
202
+ isValid: true,
203
+ isValidUpper: true
104
204
  });
105
205
  });
106
206
  /**
@@ -108,31 +208,42 @@ class Slider extends PureComponent {
108
208
  * accordingly.
109
209
  *
110
210
  * @param {Event} evt The event.
211
+ * @param activeHandle
212
+ * The first drag event call, we may have an explicit activeHandle value,
213
+ * which is to be used before state is used.
111
214
  */
112
- _defineProperty(this, "_onDrag", evt => {
113
- // Do nothing if component is disabled or we have no event
114
- if (this.props.disabled || this.props.readOnly || !evt) {
115
- return;
116
- }
117
- let clientX;
118
- if ('clientX' in evt) {
119
- clientX = evt.clientX;
120
- } else if ('touches' in evt && 0 in evt.touches && 'clientX' in evt.touches[0]) {
121
- clientX = evt.touches[0].clientX;
122
- } else {
123
- // Do nothing if we have no valid clientX
215
+ _defineProperty(this, "_onDrag", function (evt) {
216
+ let activeHandle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
217
+ activeHandle = activeHandle ?? _this.state.activeHandle;
218
+ // Do nothing if component is disabled, or we have no event.
219
+ if (_this.props.disabled || _this.props.readOnly || !evt) {
124
220
  return;
125
221
  }
222
+ const clientX = _this.getClientXFromEvent(evt);
126
223
  const {
127
224
  value,
128
225
  left
129
- } = this.calcValue({
130
- clientX
226
+ } = _this.calcValue({
227
+ clientX,
228
+ value: _this.state.value
131
229
  });
132
- this.setState({
133
- value: this.nearestStepValue(value),
134
- left,
135
- isValid: true
230
+ // If we're set to two handles, negotiate which drag handle is closest to
231
+ // the users' interaction.
232
+ if (_this.hasTwoHandles() && activeHandle) {
233
+ _this.setValueLeftForHandle(activeHandle, {
234
+ value: _this.nearestStepValue(value),
235
+ left
236
+ });
237
+ } else {
238
+ _this.setState({
239
+ value: _this.nearestStepValue(value),
240
+ left,
241
+ isValid: true
242
+ });
243
+ }
244
+ _this.setState({
245
+ correctedValue: null,
246
+ correctedPosition: null
136
247
  });
137
248
  });
138
249
  /**
@@ -150,15 +261,19 @@ class Slider extends PureComponent {
150
261
  * @param {Event} evt The event.
151
262
  */
152
263
  _defineProperty(this, "onKeyDown", evt => {
153
- // Do nothing if component is disabled or we don't have a valid event
154
- if (this.props.disabled || this.props.readOnly || !('which' in evt)) {
264
+ // Do nothing if component is disabled, or we don't have a valid event
265
+ if (this.props.disabled || this.props.readOnly) {
155
266
  return;
156
267
  }
268
+ const {
269
+ step = 1,
270
+ stepMultiplier = 4
271
+ } = this.props;
157
272
  let delta = 0;
158
- if (matches(evt.which, [ArrowDown, ArrowLeft])) {
159
- delta = -(this.props.step ?? Slider.defaultProps.step);
160
- } else if (matches(evt.which, [ArrowUp, ArrowRight])) {
161
- delta = this.props.step ?? Slider.defaultProps.step;
273
+ if (matches(evt, [ArrowDown, ArrowLeft])) {
274
+ delta = -step;
275
+ } else if (matches(evt, [ArrowUp, ArrowRight])) {
276
+ delta = step;
162
277
  } else {
163
278
  // Ignore keys we don't want to handle
164
279
  return;
@@ -166,22 +281,40 @@ class Slider extends PureComponent {
166
281
 
167
282
  // If shift was held, account for the stepMultiplier
168
283
  if (evt.shiftKey) {
169
- const stepMultiplier = this.props.stepMultiplier;
170
- delta *= stepMultiplier ?? Slider.defaultProps.stepMultiplier;
284
+ delta *= stepMultiplier;
285
+ }
286
+ if (this.hasTwoHandles() && this.state.activeHandle) {
287
+ const currentValue = this.state.activeHandle === HandlePosition.LOWER ? this.state.value : this.state.valueUpper;
288
+ const {
289
+ value,
290
+ left
291
+ } = this.calcValue({
292
+ value: this.calcValueForDelta(currentValue, delta, this.props.step)
293
+ });
294
+ this.setValueLeftForHandle(this.state.activeHandle, {
295
+ value: this.nearestStepValue(value),
296
+ left
297
+ });
298
+ } else {
299
+ const {
300
+ value,
301
+ left
302
+ } = this.calcValue({
303
+ // Ensures custom value from `<input>` won't cause skipping next stepping
304
+ // point with right arrow key, e.g. Typing 51 in `<input>`, moving focus
305
+ // onto the thumb and the hitting right arrow key should yield 52 instead
306
+ // of 54.
307
+ value: this.calcValueForDelta(this.state.value, delta, this.props.step)
308
+ });
309
+ this.setState({
310
+ value: this.nearestStepValue(value),
311
+ left,
312
+ isValid: true
313
+ });
171
314
  }
172
- Math.floor(this.state.value / (this.props.step ?? Slider.defaultProps.step)) * (this.props.step ?? Slider.defaultProps.step);
173
- const {
174
- value,
175
- left
176
- } = this.calcValue({
177
- // Ensures custom value from `<input>` won't cause skipping next stepping point with right arrow key,
178
- // e.g. Typing 51 in `<input>`, moving focus onto the thumb and the hitting right arrow key should yield 52 instead of 54
179
- value: (delta > 0 ? Math.floor(this.state.value / (this.props.step ?? Slider.defaultProps.step)) * (this.props.step ?? Slider.defaultProps.step) : this.state.value) + delta
180
- });
181
315
  this.setState({
182
- value: this.nearestStepValue(value),
183
- left,
184
- isValid: true
316
+ correctedValue: null,
317
+ correctedPosition: null
185
318
  });
186
319
  });
187
320
  /**
@@ -201,25 +334,39 @@ class Slider extends PureComponent {
201
334
  if (!evt || !('target' in evt) || typeof evt.target.value !== 'string') {
202
335
  return;
203
336
  }
204
- const targetValue = Number.parseFloat(evt.target.value);
205
337
 
206
- // Avoid calling calcValue for invalid numbers, but still update the state
207
- if (isNaN(targetValue)) {
208
- this.setState({
209
- value: evt.target.value
210
- });
338
+ // Avoid calling calcValue for invalid numbers, but still update the state.
339
+ const activeHandle = evt.target.dataset.handlePosition ?? HandlePosition.LOWER;
340
+ const targetValue = Number.parseFloat(evt.target.value);
341
+ if (this.hasTwoHandles()) {
342
+ if (isNaN(targetValue)) {
343
+ this.setValueForHandle(activeHandle, evt.target.value);
344
+ } else if (this.isValidValueForPosition({
345
+ handle: activeHandle,
346
+ value: targetValue,
347
+ min: this.props.min,
348
+ max: this.props.max
349
+ })) {
350
+ this.processNewInputValue(evt.target);
351
+ } else {
352
+ this.setValueForHandle(activeHandle, targetValue);
353
+ }
211
354
  } else {
212
- const {
213
- value,
214
- left
215
- } = this.calcValue({
355
+ if (isNaN(targetValue)) {
356
+ this.setState({
357
+ value: evt.target.value
358
+ });
359
+ } else if (this.isValidValue({
216
360
  value: targetValue,
217
- useRawValue: true
218
- });
219
- this.setState({
220
- value,
221
- left
222
- });
361
+ min: this.props.min,
362
+ max: this.props.max
363
+ })) {
364
+ this.processNewInputValue(evt.target);
365
+ } else {
366
+ this.setState({
367
+ value: targetValue
368
+ });
369
+ }
223
370
  }
224
371
  });
225
372
  /**
@@ -233,18 +380,131 @@ class Slider extends PureComponent {
233
380
  if (!evt || !('target' in evt) || typeof evt.target.value !== 'string') {
234
381
  return;
235
382
  }
236
-
237
- // determine validity of input change after clicking out of input
238
- const validity = evt.target.checkValidity();
239
383
  const {
240
- value
384
+ value: targetValue
241
385
  } = evt.target;
386
+ this.processNewInputValue(evt.target);
387
+ this.props.onBlur?.({
388
+ value: targetValue,
389
+ handlePosition: evt.target?.dataset?.handlePosition
390
+ });
391
+ });
392
+ _defineProperty(this, "onInputKeyDown", evt => {
393
+ // Do nothing if component is disabled, or we don't have a valid event.
394
+ if (this.props.disabled || this.props.readOnly) {
395
+ return;
396
+ }
397
+
398
+ // Do nothing if we have no valid event, target, or value.
399
+ if (!evt || !('target' in evt) || typeof evt.target.value !== 'string') {
400
+ return;
401
+ }
402
+ if (matches(evt, [Enter])) {
403
+ this.processNewInputValue(evt.target);
404
+ }
405
+ });
406
+ _defineProperty(this, "processNewInputValue", input => {
407
+ const targetValue = Number.parseFloat(input.value);
408
+ const validity = !isNaN(targetValue);
409
+
410
+ // When there are two handles, we'll also have the data-handle-position
411
+ // attribute to consider the other value before settling on the validity to
412
+ // set.
413
+ const handlePosition = input?.dataset?.handlePosition;
414
+ if (handlePosition === HandlePosition.LOWER) {
415
+ this.setState({
416
+ isValid: validity
417
+ });
418
+ } else if (handlePosition === HandlePosition.UPPER) {
419
+ this.setState({
420
+ isValidUpper: validity
421
+ });
422
+ }
242
423
  this.setState({
243
424
  isValid: validity
244
425
  });
245
- this.props.onBlur?.({
246
- value
247
- });
426
+ if (validity) {
427
+ const adjustedValue = handlePosition ? this.getAdjustedValueForPosition({
428
+ handle: handlePosition,
429
+ value: targetValue,
430
+ min: this.props.min,
431
+ max: this.props.max
432
+ }) : this.getAdjustedValue({
433
+ value: targetValue,
434
+ min: this.props.min,
435
+ max: this.props.max
436
+ });
437
+ if (adjustedValue !== targetValue) {
438
+ this.setState({
439
+ correctedValue: targetValue,
440
+ correctedPosition: handlePosition
441
+ });
442
+ } else {
443
+ this.setState({
444
+ correctedValue: null,
445
+ correctedPosition: null
446
+ });
447
+ }
448
+ const {
449
+ value,
450
+ left
451
+ } = this.calcValue({
452
+ value: adjustedValue,
453
+ useRawValue: true
454
+ });
455
+ if (handlePosition) {
456
+ this.setValueLeftForHandle(handlePosition, {
457
+ value,
458
+ left
459
+ });
460
+ } else {
461
+ this.setState({
462
+ value,
463
+ left
464
+ });
465
+ }
466
+ }
467
+ });
468
+ _defineProperty(this, "calcLeftPercent", _ref => {
469
+ let {
470
+ clientX,
471
+ value,
472
+ range
473
+ } = _ref;
474
+ const boundingRect = this.element?.getBoundingClientRect?.();
475
+ let width = boundingRect ? boundingRect.right - boundingRect.left : 0;
476
+
477
+ // Enforce a minimum width of at least 1 for calculations
478
+ if (width <= 0) {
479
+ width = 1;
480
+ }
481
+
482
+ // If a clientX is specified, use it to calculate the leftPercent. If not,
483
+ // use the provided value to calculate it instead.
484
+ if (clientX) {
485
+ const leftOffset = this.state.isRtl ? (boundingRect?.right ?? 0) - clientX : clientX - (boundingRect?.left ?? 0);
486
+ return leftOffset / width;
487
+ } else if (value && range) {
488
+ // Prevent NaN calculation if the range is 0.
489
+ return range === 0 ? 0 : (value - this.props.min) / range;
490
+ }
491
+ // We should never end up in this scenario, but in case we do, and to
492
+ // re-assure Typescript, return 0.
493
+ return 0;
494
+ });
495
+ _defineProperty(this, "calcSteppedValuePercent", _ref2 => {
496
+ let {
497
+ leftPercent,
498
+ range
499
+ } = _ref2;
500
+ const {
501
+ step = 1
502
+ } = this.props;
503
+ const totalSteps = range / step;
504
+ let steppedValue = Math.round(leftPercent * totalSteps) * step;
505
+ const steppedPercent = this.clamp(steppedValue / range, 0, 1);
506
+ steppedValue = this.clamp(steppedValue + this.props.min, this.props.min, this.props.max);
507
+ return [steppedValue, steppedPercent];
248
508
  });
249
509
  /**
250
510
  * Calculates a new Slider `value` and `left` (thumb offset) given a `clientX`,
@@ -265,35 +525,20 @@ class Slider extends PureComponent {
265
525
  * clientX is not provided.
266
526
  * @param {boolean} [params.useRawValue=false] `true` to use the given value as-is.
267
527
  */
268
- _defineProperty(this, "calcValue", _ref => {
528
+ _defineProperty(this, "calcValue", _ref3 => {
269
529
  let {
270
530
  clientX,
271
531
  value,
272
532
  useRawValue = false
273
- } = _ref;
533
+ } = _ref3;
274
534
  const range = this.props.max - this.props.min;
275
- const boundingRect = this.element?.getBoundingClientRect?.();
276
- const totalSteps = range / (this.props.step ?? Slider.defaultProps.step);
277
- let width = boundingRect ? boundingRect.right - boundingRect.left : 0;
278
535
 
279
- // Enforce a minimum width of at least 1 for calculations
280
- if (width <= 0) {
281
- width = 1;
282
- }
283
-
284
- // If a clientX is specified, use it to calculate the leftPercent. If not,
285
- // use the provided value or state's value to calculate it instead.
286
- let leftPercent;
287
- if (clientX != null) {
288
- const leftOffset = this.state.isRtl ? (boundingRect?.right ?? 0) - clientX : clientX - (boundingRect?.left ?? 0);
289
- leftPercent = leftOffset / width;
290
- } else {
291
- if (value == null) {
292
- value = this.state.value;
293
- }
294
- // prevent NaN calculation if the range is 0
295
- leftPercent = range === 0 ? 0 : (value - this.props.min) / range;
296
- }
536
+ // @todo solve for rtl.
537
+ const leftPercent = this.calcLeftPercent({
538
+ clientX,
539
+ value,
540
+ range
541
+ });
297
542
  if (useRawValue) {
298
543
  // Adjusts only for min/max of thumb position
299
544
  return {
@@ -301,15 +546,168 @@ class Slider extends PureComponent {
301
546
  left: Math.min(1, Math.max(0, leftPercent)) * 100
302
547
  };
303
548
  }
304
- let steppedValue = Math.round(leftPercent * totalSteps) * (this.props.step ?? Slider.defaultProps.step);
305
- const steppedPercent = this.clamp(steppedValue / range, 0, 1);
306
- steppedValue = this.clamp(steppedValue + this.props.min, this.props.min, this.props.max);
549
+ const [steppedValue, steppedPercent] = this.calcSteppedValuePercent({
550
+ leftPercent,
551
+ range
552
+ });
307
553
  return {
308
554
  value: steppedValue,
309
555
  left: steppedPercent * 100
310
556
  };
311
557
  });
558
+ _defineProperty(this, "calcDistanceToHandle", (handle, clientX) => {
559
+ const handleBoundingRect = this.getHandleBoundingRect(handle);
560
+ // x co-ordinate of the midpoint.
561
+ const handleX = handleBoundingRect.left + handleBoundingRect.width / 2;
562
+ return Math.abs(handleX - clientX);
563
+ });
564
+ /**
565
+ * Given the current value, delta and step, calculate the new value.
566
+ *
567
+ * @param {number} currentValue
568
+ * Current value user is moving from.
569
+ * @param {number} delta
570
+ * Movement from the current value. Can be positive or negative.
571
+ * @param {number} step
572
+ * A value determining how much the value should increase/decrease by moving
573
+ * the thumb by mouse.
574
+ */
575
+ _defineProperty(this, "calcValueForDelta", function (currentValue, delta) {
576
+ let step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
577
+ return (delta > 0 ? Math.floor(currentValue / step) * step : currentValue) + delta;
578
+ });
579
+ /**
580
+ * Sets state relevant to the given handle position.
581
+ *
582
+ * Guards against setting either lower or upper values beyond its counterpart.
583
+ */
584
+ _defineProperty(this, "setValueLeftForHandle", (handle, _ref4) => {
585
+ let {
586
+ value: newValue,
587
+ left: newLeft
588
+ } = _ref4;
589
+ const {
590
+ value,
591
+ valueUpper,
592
+ left,
593
+ leftUpper
594
+ } = this.state;
595
+ if (handle === HandlePosition.LOWER) {
596
+ // Don't allow higher than the upper handle.
597
+ this.setState({
598
+ value: valueUpper && newValue > valueUpper ? valueUpper : newValue,
599
+ left: valueUpper && newValue > valueUpper ? leftUpper : newLeft,
600
+ isValid: true
601
+ });
602
+ } else {
603
+ this.setState({
604
+ valueUpper: value && newValue < value ? value : newValue,
605
+ leftUpper: value && newValue < value ? left : newLeft,
606
+ isValidUpper: true
607
+ });
608
+ }
609
+ });
610
+ _defineProperty(this, "setValueForHandle", (handle, value) => {
611
+ if (handle === HandlePosition.LOWER) {
612
+ this.setState({
613
+ value,
614
+ isValid: true
615
+ });
616
+ } else {
617
+ this.setState({
618
+ valueUpper: value,
619
+ isValidUpper: true
620
+ });
621
+ }
622
+ });
623
+ _defineProperty(this, "isValidValueForPosition", _ref5 => {
624
+ let {
625
+ handle,
626
+ value: newValue,
627
+ min,
628
+ max
629
+ } = _ref5;
630
+ const {
631
+ value,
632
+ valueUpper
633
+ } = this.state;
634
+ if (!this.isValidValue({
635
+ value: newValue,
636
+ min,
637
+ max
638
+ })) {
639
+ return false;
640
+ }
641
+ if (handle === HandlePosition.LOWER) {
642
+ return !valueUpper || newValue <= valueUpper;
643
+ } else if (handle === HandlePosition.UPPER) {
644
+ return !value || newValue >= value;
645
+ }
646
+ return false;
647
+ });
648
+ _defineProperty(this, "isValidValue", _ref6 => {
649
+ let {
650
+ value,
651
+ min,
652
+ max
653
+ } = _ref6;
654
+ return !(value < min || value > max);
655
+ });
656
+ _defineProperty(this, "getAdjustedValueForPosition", _ref7 => {
657
+ let {
658
+ handle,
659
+ value: newValue,
660
+ min,
661
+ max
662
+ } = _ref7;
663
+ const {
664
+ value,
665
+ valueUpper
666
+ } = this.state;
667
+ newValue = this.getAdjustedValue({
668
+ value: newValue,
669
+ min,
670
+ max
671
+ });
672
+
673
+ // Next adjust to the opposite handle.
674
+ if (handle === HandlePosition.LOWER && valueUpper) {
675
+ newValue = newValue > valueUpper ? valueUpper : newValue;
676
+ } else if (handle === HandlePosition.UPPER && value) {
677
+ newValue = newValue < value ? value : newValue;
678
+ }
679
+ return newValue;
680
+ });
681
+ _defineProperty(this, "getAdjustedValue", _ref8 => {
682
+ let {
683
+ value,
684
+ min,
685
+ max
686
+ } = _ref8;
687
+ if (value < min) {
688
+ value = min;
689
+ }
690
+ if (value > max) {
691
+ value = max;
692
+ }
693
+ return value;
694
+ });
695
+ /**
696
+ * Get the bounding rect for the requested handles' DOM element.
697
+ *
698
+ * If the bounding rect is not available, a new, empty DOMRect is returned.
699
+ */
700
+ _defineProperty(this, "getHandleBoundingRect", handle => {
701
+ let boundingRect;
702
+ if (handle === HandlePosition.LOWER) {
703
+ boundingRect = this?.thumbRef?.current?.getBoundingClientRect();
704
+ } else {
705
+ boundingRect = this?.thumbRefUpper?.current?.getBoundingClientRect();
706
+ }
707
+ return boundingRect ?? new DOMRect();
708
+ });
312
709
  this.thumbRef = /*#__PURE__*/React__default.createRef();
710
+ this.thumbRefUpper = /*#__PURE__*/React__default.createRef();
313
711
  this.filledTrackRef = /*#__PURE__*/React__default.createRef();
314
712
  }
315
713
 
@@ -318,17 +716,43 @@ class Slider extends PureComponent {
318
716
  */
319
717
  componentDidMount() {
320
718
  if (this.element) {
321
- const {
322
- value,
323
- left
324
- } = this.calcValue({
325
- useRawValue: true
326
- });
327
- this.setState({
328
- value,
329
- left,
330
- isRtl: document?.dir === 'rtl'
331
- });
719
+ const isRtl = document?.dir === 'rtl';
720
+ if (this.hasTwoHandles()) {
721
+ const {
722
+ value,
723
+ left
724
+ } = this.calcValue({
725
+ value: this.state.value,
726
+ useRawValue: true
727
+ });
728
+ const {
729
+ value: valueUpper,
730
+ left: leftUpper
731
+ } = this.calcValue({
732
+ value: this.state.valueUpper,
733
+ useRawValue: true
734
+ });
735
+ this.setState({
736
+ isRtl,
737
+ value,
738
+ left,
739
+ valueUpper,
740
+ leftUpper
741
+ });
742
+ } else {
743
+ const {
744
+ value,
745
+ left
746
+ } = this.calcValue({
747
+ value: this.state.value,
748
+ useRawValue: true
749
+ });
750
+ this.setState({
751
+ isRtl,
752
+ value,
753
+ left
754
+ });
755
+ }
332
756
  }
333
757
  }
334
758
 
@@ -343,32 +767,39 @@ class Slider extends PureComponent {
343
767
  componentDidUpdate(prevProps, prevState) {
344
768
  // Fire onChange event handler if present, if there's a usable value, and
345
769
  // if the value is different from the last one
346
-
347
- // Set alternative positioning if direction is 'rtl'
348
- if (this.thumbRef.current) {
349
- if (this.state.isRtl) {
350
- this.thumbRef.current.style.insetInlineStart = `calc(${this.state.left}% - 14px)`;
351
- } else {
770
+ if (this.hasTwoHandles()) {
771
+ if (this.thumbRef.current) {
352
772
  this.thumbRef.current.style.insetInlineStart = `${this.state.left}%`;
773
+ if (this.state.isRtl) {
774
+ this.thumbRef.current.style.transform = `translate(100%, -50%)`;
775
+ }
353
776
  }
354
- }
355
- if (this.filledTrackRef.current) {
356
- if (this.state.isRtl) {
357
- this.filledTrackRef.current.style.transform = `translate(100%, -50%) scaleX(-${this.state.left / 100})`;
358
- } else {
359
- this.filledTrackRef.current.style.transform = `translate(0%, -50%) scaleX(${this.state.left / 100})`;
777
+ if (this.thumbRefUpper.current) {
778
+ this.thumbRefUpper.current.style.insetInlineStart = `${this.state.leftUpper}%`;
779
+ }
780
+ if (this.filledTrackRef.current) {
781
+ this.filledTrackRef.current.style.transform = this.state.isRtl ? `translate(${100 - this.state.leftUpper}%, -50%) scaleX(${(this.state.leftUpper - this.state.left) / 100})` : `translate(${this.state.left}%, -50%) scaleX(${(this.state.leftUpper - this.state.left) / 100})`;
782
+ }
783
+ } else {
784
+ if (this.thumbRef.current) {
785
+ this.thumbRef.current.style.insetInlineStart = this.state.isRtl ? `calc(${this.state.left}% - 14px)` : `${this.state.left}%`;
786
+ }
787
+ if (this.filledTrackRef.current) {
788
+ this.filledTrackRef.current.style.transform = this.state.isRtl ? `translate(100%, -50%) scaleX(-${this.state.left / 100})` : `translate(0%, -50%) scaleX(${this.state.left / 100})`;
360
789
  }
361
790
  }
362
- if (prevState.value !== this.state.value && typeof this.props.onChange === 'function') {
791
+ if ((prevState.value !== this.state.value || prevState.valueUpper !== this.state.valueUpper) && typeof this.props.onChange === 'function') {
363
792
  this.props.onChange({
364
- value: this.state.value
793
+ value: this.state.value,
794
+ valueUpper: this.state.valueUpper
365
795
  });
366
796
  }
367
797
 
368
798
  // Fire onRelease event handler if present and if needed
369
799
  if (this.state.needsOnRelease && typeof this.props.onRelease === 'function') {
370
800
  this.props.onRelease({
371
- value: this.state.value
801
+ value: this.state.value,
802
+ valueUpper: this.state.valueUpper
372
803
  });
373
804
  // Reset the flag
374
805
  this.setState({
@@ -378,13 +809,31 @@ class Slider extends PureComponent {
378
809
 
379
810
  // If value from props does not change, do nothing here.
380
811
  // Otherwise, do prop -> state sync without "value capping".
381
- if (prevProps.value === this.props.value && prevProps.max === this.props.max && prevProps.min === this.props.min) {
812
+ if (prevProps.value === this.props.value && prevProps.unstable_valueUpper === this.props.unstable_valueUpper && prevProps.max === this.props.max && prevProps.min === this.props.min) {
382
813
  return;
383
814
  }
384
815
  this.setState(this.calcValue({
385
816
  value: this.props.value,
386
817
  useRawValue: true
387
818
  }));
819
+ if (this.props.unstable_valueUpper !== undefined) {
820
+ const {
821
+ value: valueUpper,
822
+ left: leftUpper
823
+ } = this.calcValue({
824
+ value: this.props.unstable_valueUpper,
825
+ useRawValue: true
826
+ });
827
+ this.setState({
828
+ valueUpper,
829
+ leftUpper
830
+ });
831
+ } else {
832
+ this.setState({
833
+ valueUpper: undefined,
834
+ leftUpper: undefined
835
+ });
836
+ }
388
837
  }
389
838
 
390
839
  /**
@@ -414,81 +863,187 @@ class Slider extends PureComponent {
414
863
  tempInput.value = `${value}`;
415
864
  return parseFloat(tempInput.value);
416
865
  }
866
+ getClientXFromEvent(event) {
867
+ let clientX;
868
+ if ('clientX' in event) {
869
+ clientX = event.clientX;
870
+ } else if ('touches' in event && 0 in event.touches && 'clientX' in event.touches[0]) {
871
+ clientX = event.touches[0].clientX;
872
+ }
873
+ return clientX;
874
+ }
875
+ hasTwoHandles() {
876
+ return this.state.valueUpper !== undefined;
877
+ }
878
+
417
879
  // syncs invalid state and prop
418
880
  static getDerivedStateFromProps(props, state) {
419
881
  const {
420
- isValid
882
+ isValid,
883
+ isValidUpper
421
884
  } = state;
422
- // will override state in favor of invalid prop
423
- if (props.invalid === true && isValid === true) {
424
- return {
425
- isValid: false
426
- };
427
- }
428
- if (props.invalid === false && isValid === false) {
429
- return {
430
- isValid: true
431
- };
885
+ let derivedState = {};
886
+
887
+ // Will override state in favor of invalid prop
888
+ if (props.invalid === true) {
889
+ if (isValid === true) {
890
+ derivedState = {
891
+ ...derivedState,
892
+ isValid: false
893
+ };
894
+ }
895
+ if (isValid === true) {
896
+ derivedState = {
897
+ ...derivedState,
898
+ isValid: false
899
+ };
900
+ }
901
+ if (isValidUpper === true) {
902
+ derivedState = {
903
+ ...derivedState,
904
+ isValidUpper: false
905
+ };
906
+ }
907
+ } else if (props.invalid === false) {
908
+ if (isValid === false) {
909
+ derivedState = {
910
+ ...derivedState,
911
+ isValid: true
912
+ };
913
+ }
914
+ if (isValid === false) {
915
+ derivedState = {
916
+ ...derivedState,
917
+ isValid: true
918
+ };
919
+ }
920
+ if (isValidUpper === false) {
921
+ derivedState = {
922
+ ...derivedState,
923
+ isValidUpper: true
924
+ };
925
+ }
432
926
  }
433
- //if invalid prop is not provided, state will remain the same
434
- return null;
927
+ return Object.entries(derivedState).length > 0 ? derivedState : null;
435
928
  }
436
929
  render() {
437
930
  const {
438
931
  ariaLabelInput,
932
+ unstable_ariaLabelInputUpper: ariaLabelInputUpper,
439
933
  className,
440
- hideTextInput,
934
+ hideTextInput = false,
441
935
  id = this.inputId = this.inputId || `__carbon-slider_${Math.random().toString(36).substr(2)}`,
442
936
  min,
443
- minLabel,
937
+ minLabel = '',
444
938
  max,
445
- maxLabel,
939
+ maxLabel = '',
446
940
  formatLabel = defaultFormatLabel,
447
941
  labelText,
448
- step,
942
+ step = 1,
449
943
  stepMultiplier: _stepMultiplier,
450
- inputType,
944
+ inputType = 'number',
451
945
  invalidText,
452
946
  required,
453
- disabled,
947
+ disabled = false,
454
948
  name,
949
+ unstable_nameUpper: nameUpper,
455
950
  light,
456
- readOnly,
951
+ readOnly = false,
457
952
  warn,
458
953
  warnText,
954
+ translateWithId: t = translateWithId,
459
955
  ...other
460
956
  } = this.props;
957
+ const twoHandles = this.hasTwoHandles();
461
958
  delete other.onRelease;
462
959
  delete other.invalid;
960
+ delete other.unstable_valueUpper;
463
961
  const {
464
962
  value,
465
- isValid
963
+ valueUpper,
964
+ isValid,
965
+ isValidUpper,
966
+ correctedValue,
967
+ correctedPosition,
968
+ isRtl
466
969
  } = this.state;
970
+ const showWarning = !readOnly && warn && isValid || typeof correctedValue !== null && correctedPosition === HandlePosition.LOWER;
971
+ const showWarningUpper = !readOnly && warn && (twoHandles ? isValidUpper : isValid) || typeof correctedValue !== null && correctedPosition === (twoHandles ? HandlePosition.UPPER : HandlePosition.LOWER);
467
972
  return /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => {
468
973
  const labelId = `${id}-label`;
469
974
  const labelClasses = cx(`${prefix}--label`, {
470
975
  [`${prefix}--label--disabled`]: disabled
471
976
  });
977
+ const containerClasses = cx(`${prefix}--slider-container`, {
978
+ [`${prefix}--slider-container--two-handles`]: twoHandles,
979
+ [`${prefix}--slider-container--disabled`]: disabled,
980
+ [`${prefix}--slider-container--readonly`]: readOnly
981
+ });
472
982
  const sliderClasses = cx(`${prefix}--slider`, {
473
- [`${prefix}--slider--disabled`]: disabled
474
- }, {
983
+ [`${prefix}--slider--disabled`]: disabled,
475
984
  [`${prefix}--slider--readonly`]: readOnly
476
985
  });
477
- const inputClasses = cx(`${prefix}--text-input`, `${prefix}--slider-text-input`, {
986
+ const fixedInputClasses = [`${prefix}--text-input`, `${prefix}--slider-text-input`];
987
+ const conditionalInputClasses = {
478
988
  [`${prefix}--text-input--light`]: light,
479
- [`${prefix}--text-input--invalid`]: !readOnly && isValid === false,
480
- [`${prefix}--slider-text-input--hidden`]: hideTextInput,
481
- [`${prefix}--slider-text-input--warn`]: !readOnly && warn
989
+ [`${prefix}--slider-text-input--hidden`]: hideTextInput
990
+ };
991
+ const lowerInputClasses = cx([...fixedInputClasses, `${prefix}--slider-text-input--lower`, conditionalInputClasses, {
992
+ [`${prefix}--text-input--invalid`]: !readOnly && !isValid,
993
+ [`${prefix}--slider-text-input--warn`]: showWarning
994
+ }]);
995
+ const upperInputClasses = cx([...fixedInputClasses, `${prefix}--slider-text-input--upper`, conditionalInputClasses, {
996
+ [`${prefix}--text-input--invalid`]: !readOnly && (twoHandles ? !isValidUpper : !isValid),
997
+ [`${prefix}--slider-text-input--warn`]: showWarningUpper
998
+ }]);
999
+ const lowerInputWrapperClasses = cx([`${prefix}--text-input-wrapper`, `${prefix}--slider-text-input-wrapper`, `${prefix}--slider-text-input-wrapper--lower`, {
1000
+ [`${prefix}--text-input-wrapper--readonly`]: readOnly
1001
+ }]);
1002
+ const upperInputWrapperClasses = cx([`${prefix}--text-input-wrapper`, `${prefix}--slider-text-input-wrapper`, `${prefix}--slider-text-input-wrapper--upper`, {
1003
+ [`${prefix}--text-input-wrapper--readonly`]: readOnly
1004
+ }]);
1005
+ const lowerThumbClasses = cx(`${prefix}--slider__thumb`, {
1006
+ [`${prefix}--slider__thumb--lower`]: twoHandles
1007
+ });
1008
+ const upperThumbClasses = cx(`${prefix}--slider__thumb`, {
1009
+ [`${prefix}--slider__thumb--upper`]: twoHandles
482
1010
  });
483
1011
  return /*#__PURE__*/React__default.createElement("div", {
484
1012
  className: cx(`${prefix}--form-item`, className)
485
- }, /*#__PURE__*/React__default.createElement("label", {
486
- htmlFor: id,
1013
+ }, /*#__PURE__*/React__default.createElement(Text, {
1014
+ as: "label",
1015
+ htmlFor: twoHandles ? undefined : id,
487
1016
  className: labelClasses,
488
1017
  id: labelId
489
1018
  }, labelText), /*#__PURE__*/React__default.createElement("div", {
490
- className: `${prefix}--slider-container`
491
- }, /*#__PURE__*/React__default.createElement("span", {
1019
+ className: containerClasses
1020
+ }, twoHandles ? /*#__PURE__*/React__default.createElement("div", {
1021
+ className: lowerInputWrapperClasses
1022
+ }, /*#__PURE__*/React__default.createElement("input", {
1023
+ type: hideTextInput ? 'hidden' : inputType,
1024
+ id: `${id}-lower-input-for-slider`,
1025
+ name: name,
1026
+ className: lowerInputClasses,
1027
+ value: value,
1028
+ "aria-label": ariaLabelInput,
1029
+ disabled: disabled,
1030
+ required: required,
1031
+ min: min,
1032
+ max: max,
1033
+ step: step,
1034
+ onChange: this.onChange,
1035
+ onBlur: this.onBlur,
1036
+ onKeyUp: this.props.onInputKeyUp,
1037
+ onKeyDown: this.onInputKeyDown,
1038
+ "data-invalid": !isValid && !readOnly ? true : null,
1039
+ "data-handle-position": HandlePosition.LOWER,
1040
+ "aria-invalid": !isValid && !readOnly ? true : undefined,
1041
+ readOnly: readOnly
1042
+ }), !readOnly && !isValid && /*#__PURE__*/React__default.createElement(WarningFilled, {
1043
+ className: `${prefix}--slider__invalid-icon`
1044
+ }), showWarning && /*#__PURE__*/React__default.createElement(WarningAltFilled, {
1045
+ className: `${prefix}--slider__invalid-icon ${prefix}--slider__invalid-icon--warning`
1046
+ })) : null, /*#__PURE__*/React__default.createElement(Text, {
492
1047
  className: `${prefix}--slider__range-label`
493
1048
  }, formatLabel(min, minLabel)), /*#__PURE__*/React__default.createElement("div", _extends({
494
1049
  className: sliderClasses,
@@ -500,18 +1055,34 @@ class Slider extends PureComponent {
500
1055
  onKeyDown: this.onKeyDown,
501
1056
  role: "presentation",
502
1057
  tabIndex: -1,
503
- "data-invalid": !isValid && !readOnly ? true : null
1058
+ "data-invalid": (twoHandles ? !isValid || !isValidUpper : !isValid) && !readOnly ? true : null
504
1059
  }, other), /*#__PURE__*/React__default.createElement("div", {
505
- className: `${prefix}--slider__thumb`,
1060
+ className: lowerThumbClasses,
506
1061
  role: "slider",
507
- id: id,
1062
+ id: twoHandles ? undefined : id,
508
1063
  tabIndex: !readOnly ? 0 : -1,
509
- "aria-valuemax": max,
1064
+ "aria-valuemax": twoHandles ? valueUpper : max,
510
1065
  "aria-valuemin": min,
511
1066
  "aria-valuenow": value,
512
- "aria-labelledby": labelId,
513
- ref: this.thumbRef
514
- }), /*#__PURE__*/React__default.createElement("div", {
1067
+ "aria-labelledby": twoHandles ? undefined : labelId,
1068
+ "aria-label": twoHandles ? ariaLabelInput : undefined,
1069
+ ref: this.thumbRef,
1070
+ onFocus: () => this.setState({
1071
+ activeHandle: HandlePosition.LOWER
1072
+ })
1073
+ }, twoHandles && !isRtl && (_LowerHandle || (_LowerHandle = /*#__PURE__*/React__default.createElement(LowerHandle, null))), twoHandles && !isRtl && (_LowerHandleFocus || (_LowerHandleFocus = /*#__PURE__*/React__default.createElement(LowerHandleFocus, null))), twoHandles && isRtl && (_UpperHandle || (_UpperHandle = /*#__PURE__*/React__default.createElement(UpperHandle, null))), twoHandles && isRtl && (_UpperHandleFocus || (_UpperHandleFocus = /*#__PURE__*/React__default.createElement(UpperHandleFocus, null)))), twoHandles ? /*#__PURE__*/React__default.createElement("div", {
1074
+ className: upperThumbClasses,
1075
+ role: "slider",
1076
+ tabIndex: !readOnly ? 0 : -1,
1077
+ "aria-valuemax": max,
1078
+ "aria-valuemin": value,
1079
+ "aria-valuenow": valueUpper,
1080
+ "aria-label": ariaLabelInputUpper,
1081
+ ref: this.thumbRefUpper,
1082
+ onFocus: () => this.setState({
1083
+ activeHandle: HandlePosition.UPPER
1084
+ })
1085
+ }, twoHandles && !isRtl && (_UpperHandle2 || (_UpperHandle2 = /*#__PURE__*/React__default.createElement(UpperHandle, null))), twoHandles && !isRtl && (_UpperHandleFocus2 || (_UpperHandleFocus2 = /*#__PURE__*/React__default.createElement(UpperHandleFocus, null))), twoHandles && isRtl && (_LowerHandle2 || (_LowerHandle2 = /*#__PURE__*/React__default.createElement(LowerHandle, null))), twoHandles && isRtl && (_LowerHandleFocus2 || (_LowerHandleFocus2 = /*#__PURE__*/React__default.createElement(LowerHandleFocus, null)))) : null, /*#__PURE__*/React__default.createElement("div", {
515
1086
  className: `${prefix}--slider__track`,
516
1087
  ref: node => {
517
1088
  this.track = node;
@@ -519,16 +1090,18 @@ class Slider extends PureComponent {
519
1090
  }), /*#__PURE__*/React__default.createElement("div", {
520
1091
  className: `${prefix}--slider__filled-track`,
521
1092
  ref: this.filledTrackRef
522
- })), /*#__PURE__*/React__default.createElement("span", {
1093
+ })), /*#__PURE__*/React__default.createElement(Text, {
523
1094
  className: `${prefix}--slider__range-label`
524
- }, formatLabel(max, maxLabel)), /*#__PURE__*/React__default.createElement("input", {
1095
+ }, formatLabel(max, maxLabel)), /*#__PURE__*/React__default.createElement("div", {
1096
+ className: upperInputWrapperClasses
1097
+ }, /*#__PURE__*/React__default.createElement("input", {
525
1098
  type: hideTextInput ? 'hidden' : inputType,
526
- id: `${id}-input-for-slider`,
527
- name: name,
528
- className: inputClasses,
529
- value: value,
530
- "aria-labelledby": !ariaLabelInput ? labelId : undefined,
531
- "aria-label": ariaLabelInput ? ariaLabelInput : undefined,
1099
+ id: `${id}-${twoHandles ? 'upper-' : ''}input-for-slider`,
1100
+ name: twoHandles ? nameUpper : name,
1101
+ className: upperInputClasses,
1102
+ value: twoHandles ? valueUpper : value,
1103
+ "aria-labelledby": !ariaLabelInput && !twoHandles ? labelId : undefined,
1104
+ "aria-label": twoHandles ? ariaLabelInputUpper : ariaLabelInput ? ariaLabelInput : undefined,
532
1105
  disabled: disabled,
533
1106
  required: required,
534
1107
  min: min,
@@ -536,19 +1109,29 @@ class Slider extends PureComponent {
536
1109
  step: step,
537
1110
  onChange: this.onChange,
538
1111
  onBlur: this.onBlur,
1112
+ onKeyDown: this.onInputKeyDown,
539
1113
  onKeyUp: this.props.onInputKeyUp,
540
- "data-invalid": !isValid && !readOnly ? true : null,
541
- "aria-invalid": !isValid && !readOnly ? true : undefined,
1114
+ "data-invalid": (twoHandles ? !isValidUpper : !isValid) && !readOnly ? true : null,
1115
+ "data-handle-position": twoHandles ? HandlePosition.UPPER : null,
1116
+ "aria-invalid": (twoHandles ? !isValidUpper : !isValid) && !readOnly ? true : undefined,
542
1117
  readOnly: readOnly
543
- }), !readOnly && isValid === false && /*#__PURE__*/React__default.createElement(WarningFilled, {
1118
+ }), !readOnly && (twoHandles ? !isValidUpper : !isValid) && /*#__PURE__*/React__default.createElement(WarningFilled, {
544
1119
  className: `${prefix}--slider__invalid-icon`
545
- }), !readOnly && warn && isValid && /*#__PURE__*/React__default.createElement(WarningAltFilled, {
1120
+ }), showWarningUpper && /*#__PURE__*/React__default.createElement(WarningAltFilled, {
546
1121
  className: `${prefix}--slider__invalid-icon ${prefix}--slider__invalid-icon--warning`
547
- })), !readOnly && isValid === false && /*#__PURE__*/React__default.createElement("div", {
1122
+ }))), !readOnly && (!isValid || !isValidUpper) && /*#__PURE__*/React__default.createElement(Text, {
1123
+ as: "div",
548
1124
  className: cx(`${prefix}--slider__validation-msg`, `${prefix}--slider__validation-msg--invalid`, `${prefix}--form-requirement`)
549
- }, invalidText), !readOnly && warn && isValid && /*#__PURE__*/React__default.createElement("div", {
1125
+ }, invalidText), !readOnly && warn && isValid && isValidUpper && /*#__PURE__*/React__default.createElement(Text, {
1126
+ as: "div",
550
1127
  className: cx(`${prefix}--slider__validation-msg`, `${prefix}--form-requirement`)
551
- }, warnText));
1128
+ }, warnText), correctedValue && /*#__PURE__*/React__default.createElement(Text, {
1129
+ as: "div",
1130
+ role: "alert",
1131
+ className: cx(`${prefix}--slider__status-msg`, `${prefix}--form-requirement`)
1132
+ }, t(translationIds.autoCorrectAnnouncement, {
1133
+ correctedValue
1134
+ })));
552
1135
  });
553
1136
  }
554
1137
  }
@@ -647,7 +1230,7 @@ _defineProperty(Slider, "propTypes", {
647
1230
  */
648
1231
  required: PropTypes.bool,
649
1232
  /**
650
- * A value determining how much the value should increase/decrease by moving the thumb by mouse. If a value other than 1 is provided and the input is *not* hidden, the new step requirement should be added to a visible label. Values outside of the `step` increment will be considered invalid.
1233
+ * A value determining how much the value should increase/decrease by moving the thumb by mouse. If a value other than 1 is provided and the input is *not* hidden, the new step requirement should be added to a visible label. Values outside the `step` increment will be considered invalid.
651
1234
  */
652
1235
  step: PropTypes.number,
653
1236
  /**
@@ -656,7 +1239,26 @@ _defineProperty(Slider, "propTypes", {
656
1239
  */
657
1240
  stepMultiplier: PropTypes.number,
658
1241
  /**
659
- * The value.
1242
+ * Supply a method to translate internal strings with your i18n tool of
1243
+ * choice. Translation keys are available on the `translationIds` field for
1244
+ * this component.
1245
+ */
1246
+ translateWithId: PropTypes.func,
1247
+ /**
1248
+ * The `ariaLabel` for the upper bound `<input>` when there are two handles.
1249
+ */
1250
+ unstable_ariaLabelInputUpper: PropTypes.string,
1251
+ /**
1252
+ * The `name` attribute of the upper bound `<input>` when there are two handles.
1253
+ */
1254
+ unstable_nameUpper: PropTypes.string,
1255
+ /**
1256
+ * The upper bound when there are two handles.
1257
+ */
1258
+ unstable_valueUpper: PropTypes.number,
1259
+ /**
1260
+ * The value of the slider. When there are two handles, value is the lower
1261
+ * bound.
660
1262
  */
661
1263
  value: PropTypes.number.isRequired,
662
1264
  /**
@@ -664,20 +1266,11 @@ _defineProperty(Slider, "propTypes", {
664
1266
  */
665
1267
  warn: PropTypes.bool,
666
1268
  /**
667
- * Provide the text that is displayed when the Slider is in an warn state
1269
+ * Provide the text that is displayed when the Slider is in a warn state
668
1270
  */
669
1271
  warnText: PropTypes.node
670
1272
  });
671
- _defineProperty(Slider, "defaultProps", {
672
- hideTextInput: false,
673
- step: 1,
674
- stepMultiplier: 4,
675
- disabled: false,
676
- minLabel: '',
677
- maxLabel: '',
678
- inputType: 'number',
679
- readOnly: false
680
- });
681
1273
  _defineProperty(Slider, "contextType", FeatureFlagContext);
1274
+ Slider.translationIds = Object.values(translationIds);
682
1275
 
683
1276
  export { Slider as default };