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