@react-md/core 6.3.4 → 6.5.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 (477) hide show
  1. package/dist/CoreProviders.d.ts +1 -0
  2. package/dist/CoreProviders.js.map +1 -1
  3. package/dist/_a11y.scss +3 -1
  4. package/dist/_base.scss +3 -0
  5. package/dist/_box-shadows.scss +20 -12
  6. package/dist/_core.scss +2 -1
  7. package/dist/_utils.scss +32 -10
  8. package/dist/app-bar/AppBar.js.map +1 -1
  9. package/dist/app-bar/AppBarTitle.js.map +1 -1
  10. package/dist/app-bar/_app-bar.scss +3 -3
  11. package/dist/autocomplete/AutocompleteListboxChildren.js.map +1 -1
  12. package/dist/autocomplete/_autocomplete.scss +20 -16
  13. package/dist/autocomplete/types.js.map +1 -1
  14. package/dist/autocomplete/utils.js.map +1 -1
  15. package/dist/avatar/Avatar.js.map +1 -1
  16. package/dist/avatar/_avatar.scss +2 -1
  17. package/dist/button/Button.js.map +1 -1
  18. package/dist/button/FloatingActionButton.js.map +1 -1
  19. package/dist/button/_button.scss +9 -5
  20. package/dist/card/Card.js.map +1 -1
  21. package/dist/card/CardContent.js.map +1 -1
  22. package/dist/card/ClickableCard.js.map +1 -1
  23. package/dist/card/_card.scss +6 -6
  24. package/dist/chip/Chip.js.map +1 -1
  25. package/dist/chip/_chip.scss +6 -6
  26. package/dist/datetime/NativeDateField.js.map +1 -1
  27. package/dist/datetime/NativeTimeField.js.map +1 -1
  28. package/dist/datetime/useDateField.js.map +1 -1
  29. package/dist/datetime/useTimeField.js.map +1 -1
  30. package/dist/dialog/Dialog.js.map +1 -1
  31. package/dist/dialog/DialogContainer.js.map +1 -1
  32. package/dist/dialog/DialogContent.js.map +1 -1
  33. package/dist/dialog/DialogFooter.js.map +1 -1
  34. package/dist/dialog/_dialog.scss +6 -6
  35. package/dist/divider/Divider.js.map +1 -1
  36. package/dist/divider/_divider.scss +6 -2
  37. package/dist/draggable/useDraggable.js.map +1 -1
  38. package/dist/draggable/utils.js.map +1 -1
  39. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
  40. package/dist/files/FileInput.js.map +1 -1
  41. package/dist/files/useFileUpload.js.map +1 -1
  42. package/dist/files/validation.js.map +1 -1
  43. package/dist/focus/useFocusContainer.js.map +1 -1
  44. package/dist/form/Fieldset.d.ts +19 -0
  45. package/dist/form/Fieldset.js +22 -2
  46. package/dist/form/Fieldset.js.map +1 -1
  47. package/dist/form/FormMessageContainer.js.map +1 -1
  48. package/dist/form/FormMessageCounter.js.map +1 -1
  49. package/dist/form/InputToggle.js.map +1 -1
  50. package/dist/form/Legend.d.ts +27 -5
  51. package/dist/form/Legend.js +39 -6
  52. package/dist/form/Legend.js.map +1 -1
  53. package/dist/form/Listbox.js.map +1 -1
  54. package/dist/form/ListboxProvider.js.map +1 -1
  55. package/dist/form/NativeSelect.js.map +1 -1
  56. package/dist/form/Password.js.map +1 -1
  57. package/dist/form/ResizingTextAreaWrapper.js.map +1 -1
  58. package/dist/form/Select.d.ts +24 -0
  59. package/dist/form/Select.js +14 -3
  60. package/dist/form/Select.js.map +1 -1
  61. package/dist/form/SelectedOption.d.ts +1 -2
  62. package/dist/form/SelectedOption.js +2 -2
  63. package/dist/form/SelectedOption.js.map +1 -1
  64. package/dist/form/Slider.js.map +1 -1
  65. package/dist/form/SliderContainer.js.map +1 -1
  66. package/dist/form/SliderThumb.js.map +1 -1
  67. package/dist/form/SliderTrack.js.map +1 -1
  68. package/dist/form/SliderValueMarks.js.map +1 -1
  69. package/dist/form/Switch.js.map +1 -1
  70. package/dist/form/TextArea.js.map +1 -1
  71. package/dist/form/TextField.js.map +1 -1
  72. package/dist/form/TextFieldContainer.js.map +1 -1
  73. package/dist/form/_fieldset.scss +7 -0
  74. package/dist/form/_input-toggle.scss +6 -5
  75. package/dist/form/_label.scss +2 -2
  76. package/dist/form/_legend.scss +77 -0
  77. package/dist/form/_slider.scss +7 -5
  78. package/dist/form/_switch.scss +7 -5
  79. package/dist/form/_text-field.scss +52 -15
  80. package/dist/form/defaultGetSelectedOptionChildren.d.ts +1 -0
  81. package/dist/form/fieldsetStyles.d.ts +6 -1
  82. package/dist/form/fieldsetStyles.js +3 -2
  83. package/dist/form/fieldsetStyles.js.map +1 -1
  84. package/dist/form/getSelectedOptionChildren.d.ts +1 -0
  85. package/dist/form/inputToggleStyles.js.map +1 -1
  86. package/dist/form/labelStyles.d.ts +1 -1
  87. package/dist/form/labelStyles.js +1 -1
  88. package/dist/form/labelStyles.js.map +1 -1
  89. package/dist/form/legendStyles.d.ts +83 -0
  90. package/dist/form/legendStyles.js +25 -0
  91. package/dist/form/legendStyles.js.map +1 -0
  92. package/dist/form/selectUtils.js.map +1 -1
  93. package/dist/form/textFieldContainerStyles.js.map +1 -1
  94. package/dist/form/types.d.ts +28 -6
  95. package/dist/form/types.js.map +1 -1
  96. package/dist/form/useCheckboxGroup.js.map +1 -1
  97. package/dist/form/useCombobox.js.map +1 -1
  98. package/dist/form/useNumberField.js +16 -19
  99. package/dist/form/useNumberField.js.map +1 -1
  100. package/dist/form/useRangeSlider.js.map +1 -1
  101. package/dist/form/useSlider.js.map +1 -1
  102. package/dist/form/useTextField.js.map +1 -1
  103. package/dist/hoverMode/useHoverMode.js.map +1 -1
  104. package/dist/icon/FontIcon.js.map +1 -1
  105. package/dist/icon/IconRotator.js.map +1 -1
  106. package/dist/icon/MaterialIcon.js.map +1 -1
  107. package/dist/icon/MaterialSymbol.js.map +1 -1
  108. package/dist/icon/SVGIcon.js.map +1 -1
  109. package/dist/icon/config.d.ts +0 -1
  110. package/dist/icon/config.js +10 -7
  111. package/dist/icon/config.js.map +1 -1
  112. package/dist/icon/materialConfig.js.map +1 -1
  113. package/dist/icon/styles.js.map +1 -1
  114. package/dist/interaction/UserInteractionModeProvider.js +6 -4
  115. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  116. package/dist/interaction/_interaction.scss +5 -3
  117. package/dist/interaction/types.js.map +1 -1
  118. package/dist/interaction/useElementInteraction.js.map +1 -1
  119. package/dist/layout/LayoutAppBar.d.ts +6 -6
  120. package/dist/layout/LayoutAppBar.js +6 -6
  121. package/dist/layout/LayoutAppBar.js.map +1 -1
  122. package/dist/layout/LayoutNav.js.map +1 -1
  123. package/dist/layout/LayoutWindowSplitter.js.map +1 -1
  124. package/dist/layout/Main.js.map +1 -1
  125. package/dist/layout/useExpandableLayout.js +43 -0
  126. package/dist/layout/useExpandableLayout.js.map +1 -1
  127. package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
  128. package/dist/layout/useLayoutTree.js.map +1 -1
  129. package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
  130. package/dist/layout/useResizableLayout.js.map +1 -1
  131. package/dist/link/Link.js.map +1 -1
  132. package/dist/link/SkipToMainContent.js +19 -21
  133. package/dist/link/SkipToMainContent.js.map +1 -1
  134. package/dist/list/List.js.map +1 -1
  135. package/dist/list/ListItem.js.map +1 -1
  136. package/dist/list/ListItemAddon.js.map +1 -1
  137. package/dist/list/ListItemLink.js.map +1 -1
  138. package/dist/list/ListSubheader.js.map +1 -1
  139. package/dist/list/getListItemHeight.js.map +1 -1
  140. package/dist/list/listItemStyles.js.map +1 -1
  141. package/dist/list/types.js.map +1 -1
  142. package/dist/media-queries/AppSizeProvider.d.ts +2 -0
  143. package/dist/media-queries/AppSizeProvider.js +3 -2
  144. package/dist/media-queries/AppSizeProvider.js.map +1 -1
  145. package/dist/media-queries/appSize.d.ts +3 -0
  146. package/dist/media-queries/appSize.js +3 -1
  147. package/dist/media-queries/appSize.js.map +1 -1
  148. package/dist/media-queries/config.d.ts +11 -0
  149. package/dist/media-queries/config.js +26 -0
  150. package/dist/media-queries/config.js.map +1 -0
  151. package/dist/menu/DropdownMenu.js.map +1 -1
  152. package/dist/menu/Menu.js.map +1 -1
  153. package/dist/menu/MenuItemButton.js.map +1 -1
  154. package/dist/menu/MenuItemFileInput.js.map +1 -1
  155. package/dist/menu/MenuItemInputToggle.js.map +1 -1
  156. package/dist/menu/MenuItemSeparator.js.map +1 -1
  157. package/dist/menu/MenuVisibilityProvider.js.map +1 -1
  158. package/dist/menu/MenuWidget.js.map +1 -1
  159. package/dist/menu/useContextMenu.js.map +1 -1
  160. package/dist/movement/types.d.ts +28 -3
  161. package/dist/movement/types.js.map +1 -1
  162. package/dist/movement/useKeyboardMovementProvider.js +96 -47
  163. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  164. package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
  165. package/dist/navigation/NavItem.js.map +1 -1
  166. package/dist/navigation/NavItemButton.js.map +1 -1
  167. package/dist/navigation/NavItemLink.js.map +1 -1
  168. package/dist/navigation/getTableOfContentsHeadings.js.map +1 -1
  169. package/dist/navigation/types.js.map +1 -1
  170. package/dist/overlay/Overlay.js.map +1 -1
  171. package/dist/positioning/createHorizontalPosition.js.map +1 -1
  172. package/dist/positioning/createVerticalPosition.js.map +1 -1
  173. package/dist/positioning/useFixedPositioning.js.map +1 -1
  174. package/dist/progress/CircularProgress.js.map +1 -1
  175. package/dist/progress/LinearProgress.js.map +1 -1
  176. package/dist/progress/linearProgressStyles.js.map +1 -1
  177. package/dist/responsive-item/ResponsiveItem.js.map +1 -1
  178. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
  179. package/dist/searching/caseInsensitive.js.map +1 -1
  180. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  181. package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
  182. package/dist/segmented-button/segmentedButtonStyles.js.map +1 -1
  183. package/dist/sheet/Sheet.js.map +1 -1
  184. package/dist/snackbar/Toast.js.map +1 -1
  185. package/dist/snackbar/_snackbar.scss +3 -3
  186. package/dist/spinbutton/SpinButton.d.ts +16 -0
  187. package/dist/spinbutton/SpinButton.js +55 -0
  188. package/dist/spinbutton/SpinButton.js.map +1 -0
  189. package/dist/spinbutton/SpinButtonGroupProvider.d.ts +17 -0
  190. package/dist/spinbutton/SpinButtonGroupProvider.js +19 -0
  191. package/dist/spinbutton/SpinButtonGroupProvider.js.map +1 -0
  192. package/dist/spinbutton/defaults.d.ts +9 -0
  193. package/dist/spinbutton/defaults.js +25 -0
  194. package/dist/spinbutton/defaults.js.map +1 -0
  195. package/dist/spinbutton/types.d.ts +324 -0
  196. package/dist/spinbutton/types.js +5 -0
  197. package/dist/spinbutton/types.js.map +1 -0
  198. package/dist/spinbutton/useSpinButton.d.ts +5 -0
  199. package/dist/spinbutton/useSpinButton.js +260 -0
  200. package/dist/spinbutton/useSpinButton.js.map +1 -0
  201. package/dist/spinbutton/useSpinButtonGroupProvider.d.ts +27 -0
  202. package/dist/spinbutton/useSpinButtonGroupProvider.js +49 -0
  203. package/dist/spinbutton/useSpinButtonGroupProvider.js.map +1 -0
  204. package/dist/spinbutton/utils/deselectNode.d.ts +5 -0
  205. package/dist/spinbutton/utils/deselectNode.js +17 -0
  206. package/dist/spinbutton/utils/deselectNode.js.map +1 -0
  207. package/dist/spinbutton/utils/resolveInputEvent.d.ts +30 -0
  208. package/dist/spinbutton/utils/resolveInputEvent.js +53 -0
  209. package/dist/spinbutton/utils/resolveInputEvent.js.map +1 -0
  210. package/dist/spinbutton/utils/selectNode.d.ts +5 -0
  211. package/dist/spinbutton/utils/selectNode.js +15 -0
  212. package/dist/spinbutton/utils/selectNode.js.map +1 -0
  213. package/dist/table/StickyTableSection.js.map +1 -1
  214. package/dist/table/Table.js.map +1 -1
  215. package/dist/table/TableBody.js.map +1 -1
  216. package/dist/table/TableCellContent.js.map +1 -1
  217. package/dist/table/TableCheckbox.js.map +1 -1
  218. package/dist/table/TableFooter.js.map +1 -1
  219. package/dist/table/TableHeader.js.map +1 -1
  220. package/dist/table/TableRadio.js.map +1 -1
  221. package/dist/table/TableRow.js.map +1 -1
  222. package/dist/table/useStickyTableSection.js.map +1 -1
  223. package/dist/tabs/SimpleTabPanel.js.map +1 -1
  224. package/dist/tabs/SimpleTabPanels.js.map +1 -1
  225. package/dist/tabs/Tab.js.map +1 -1
  226. package/dist/tabs/TabList.js.map +1 -1
  227. package/dist/tabs/TabListScrollButton.js.map +1 -1
  228. package/dist/tabs/_tabs.scss +5 -6
  229. package/dist/tabs/useMaxTabPanelHeight.js.map +1 -1
  230. package/dist/test-utils/data-testid.js.map +1 -1
  231. package/dist/test-utils/mocks/match-media.js +5 -5
  232. package/dist/test-utils/mocks/match-media.js.map +1 -1
  233. package/dist/test-utils/vitest/timers.d.ts +1 -1
  234. package/dist/test-utils/vitest/timers.js +1 -1
  235. package/dist/test-utils/vitest/timers.js.map +1 -1
  236. package/dist/theme/_a11y.scss +3 -1
  237. package/dist/theme/_theme.scss +16 -12
  238. package/dist/tooltip/Tooltip.js.map +1 -1
  239. package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
  240. package/dist/tooltip/useTooltip.js.map +1 -1
  241. package/dist/transition/CSSTransition.js.map +1 -1
  242. package/dist/transition/Collapse.js.map +1 -1
  243. package/dist/transition/CrossFade.js.map +1 -1
  244. package/dist/transition/ScaleTransition.js.map +1 -1
  245. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  246. package/dist/transition/Slide.js.map +1 -1
  247. package/dist/transition/SlideContainer.js.map +1 -1
  248. package/dist/transition/types.js.map +1 -1
  249. package/dist/transition/useCollapseTransition.js.map +1 -1
  250. package/dist/transition/useCrossFadeTransition.js.map +1 -1
  251. package/dist/transition/useMaxWidthTransition.js.map +1 -1
  252. package/dist/transition/useScaleTransition.js.map +1 -1
  253. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  254. package/dist/tree/Tree.js.map +1 -1
  255. package/dist/tree/TreeItem.js.map +1 -1
  256. package/dist/tree/TreeProvider.js.map +1 -1
  257. package/dist/tree/styles.js.map +1 -1
  258. package/dist/tree/types.js.map +1 -1
  259. package/dist/tree/useTreeMovement.js.map +1 -1
  260. package/dist/typography/HighlightTextMark.js.map +1 -1
  261. package/dist/typography/Mark.js.map +1 -1
  262. package/dist/typography/TextContainer.js.map +1 -1
  263. package/dist/typography/Typography.js.map +1 -1
  264. package/dist/typography/_typography.scss +0 -1
  265. package/dist/useElementSize.js.map +1 -1
  266. package/dist/useIntersectionObserver.js.map +1 -1
  267. package/dist/useMutationObserver.js.map +1 -1
  268. package/dist/useWindowSize.js.map +1 -1
  269. package/dist/utils/getNumberOfDigits.d.ts +7 -0
  270. package/dist/utils/getNumberOfDigits.js +11 -0
  271. package/dist/utils/getNumberOfDigits.js.map +1 -0
  272. package/dist/utils/nearest.js +2 -1
  273. package/dist/utils/nearest.js.map +1 -1
  274. package/dist/utils/useDevEffect.d.ts +7 -0
  275. package/dist/utils/useDevEffect.js +8 -0
  276. package/dist/utils/useDevEffect.js.map +1 -0
  277. package/dist/window-splitter/WindowSplitter.js +3 -2
  278. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  279. package/dist/window-splitter/_window-splitter.scss +65 -19
  280. package/dist/window-splitter/styles.d.ts +9 -0
  281. package/dist/window-splitter/styles.js +3 -2
  282. package/dist/window-splitter/styles.js.map +1 -1
  283. package/dist/window-splitter/useWindowSplitter.js.map +1 -1
  284. package/package.json +38 -30
  285. package/src/CoreProviders.tsx +1 -0
  286. package/src/app-bar/AppBar.tsx +1 -2
  287. package/src/app-bar/AppBarTitle.tsx +1 -2
  288. package/src/autocomplete/AutocompleteListboxChildren.tsx +3 -1
  289. package/src/autocomplete/types.ts +24 -19
  290. package/src/autocomplete/utils.ts +9 -6
  291. package/src/avatar/Avatar.tsx +2 -1
  292. package/src/button/Button.tsx +2 -1
  293. package/src/button/FloatingActionButton.tsx +2 -1
  294. package/src/card/Card.tsx +2 -1
  295. package/src/card/CardContent.tsx +1 -2
  296. package/src/card/ClickableCard.tsx +1 -2
  297. package/src/chip/Chip.tsx +2 -1
  298. package/src/datetime/NativeDateField.tsx +2 -1
  299. package/src/datetime/NativeTimeField.tsx +2 -1
  300. package/src/datetime/useDateField.ts +13 -8
  301. package/src/datetime/useTimeField.ts +13 -8
  302. package/src/dialog/Dialog.tsx +2 -1
  303. package/src/dialog/DialogContainer.tsx +1 -2
  304. package/src/dialog/DialogContent.tsx +1 -2
  305. package/src/dialog/DialogFooter.tsx +1 -2
  306. package/src/divider/Divider.tsx +1 -2
  307. package/src/draggable/useDraggable.ts +4 -4
  308. package/src/draggable/utils.ts +4 -2
  309. package/src/expansion-panel/ExpansionPanelHeader.tsx +1 -2
  310. package/src/files/FileInput.tsx +2 -1
  311. package/src/files/useFileUpload.ts +6 -6
  312. package/src/files/validation.ts +1 -2
  313. package/src/focus/useFocusContainer.ts +4 -4
  314. package/src/form/Fieldset.tsx +25 -3
  315. package/src/form/FormMessageContainer.tsx +1 -2
  316. package/src/form/FormMessageCounter.tsx +1 -2
  317. package/src/form/InputToggle.tsx +3 -3
  318. package/src/form/Legend.tsx +55 -10
  319. package/src/form/Listbox.tsx +1 -2
  320. package/src/form/ListboxProvider.ts +3 -2
  321. package/src/form/NativeSelect.tsx +2 -1
  322. package/src/form/Password.tsx +4 -2
  323. package/src/form/ResizingTextAreaWrapper.tsx +1 -2
  324. package/src/form/Select.tsx +55 -3
  325. package/src/form/SelectedOption.tsx +2 -4
  326. package/src/form/Slider.tsx +2 -1
  327. package/src/form/SliderContainer.tsx +1 -2
  328. package/src/form/SliderThumb.tsx +6 -3
  329. package/src/form/SliderTrack.tsx +2 -1
  330. package/src/form/SliderValueMarks.tsx +1 -2
  331. package/src/form/Switch.tsx +2 -1
  332. package/src/form/TextArea.tsx +1 -2
  333. package/src/form/TextField.tsx +2 -1
  334. package/src/form/TextFieldContainer.tsx +1 -2
  335. package/src/form/fieldsetStyles.ts +18 -3
  336. package/src/form/inputToggleStyles.ts +4 -2
  337. package/src/form/labelStyles.ts +1 -1
  338. package/src/form/legendStyles.ts +132 -0
  339. package/src/form/selectUtils.ts +3 -2
  340. package/src/form/textFieldContainerStyles.ts +1 -2
  341. package/src/form/types.ts +35 -17
  342. package/src/form/useCheckboxGroup.ts +3 -2
  343. package/src/form/useCombobox.ts +8 -3
  344. package/src/form/useNumberField.ts +36 -35
  345. package/src/form/useRangeSlider.ts +1 -2
  346. package/src/form/useSlider.ts +1 -2
  347. package/src/form/useTextField.ts +8 -3
  348. package/src/hoverMode/useHoverMode.ts +4 -8
  349. package/src/icon/FontIcon.tsx +1 -2
  350. package/src/icon/IconRotator.tsx +1 -2
  351. package/src/icon/MaterialIcon.tsx +2 -1
  352. package/src/icon/MaterialSymbol.tsx +2 -1
  353. package/src/icon/SVGIcon.tsx +1 -2
  354. package/src/icon/config.tsx +10 -7
  355. package/src/icon/materialConfig.ts +1 -2
  356. package/src/icon/styles.ts +1 -2
  357. package/src/interaction/UserInteractionModeProvider.tsx +9 -4
  358. package/src/interaction/types.ts +1 -2
  359. package/src/interaction/useElementInteraction.tsx +3 -2
  360. package/src/layout/LayoutAppBar.tsx +6 -6
  361. package/src/layout/LayoutNav.tsx +2 -1
  362. package/src/layout/LayoutWindowSplitter.tsx +2 -1
  363. package/src/layout/Main.tsx +1 -2
  364. package/src/layout/useExpandableLayout.ts +63 -5
  365. package/src/layout/useHorizontalLayoutTransition.ts +1 -2
  366. package/src/layout/useLayoutTree.ts +2 -2
  367. package/src/layout/useLayoutWindowSplitter.ts +6 -6
  368. package/src/layout/useResizableLayout.ts +3 -6
  369. package/src/link/Link.tsx +1 -2
  370. package/src/link/SkipToMainContent.tsx +20 -23
  371. package/src/list/List.tsx +1 -2
  372. package/src/list/ListItem.tsx +2 -1
  373. package/src/list/ListItemAddon.tsx +2 -1
  374. package/src/list/ListItemLink.tsx +2 -1
  375. package/src/list/ListSubheader.tsx +1 -2
  376. package/src/list/getListItemHeight.ts +8 -9
  377. package/src/list/listItemStyles.ts +1 -2
  378. package/src/list/types.ts +1 -2
  379. package/src/media-queries/AppSizeProvider.tsx +8 -10
  380. package/src/media-queries/appSize.ts +3 -0
  381. package/src/media-queries/config.ts +41 -0
  382. package/src/menu/DropdownMenu.tsx +4 -5
  383. package/src/menu/Menu.tsx +2 -1
  384. package/src/menu/MenuItemButton.tsx +1 -2
  385. package/src/menu/MenuItemFileInput.tsx +2 -1
  386. package/src/menu/MenuItemInputToggle.tsx +3 -3
  387. package/src/menu/MenuItemSeparator.tsx +2 -1
  388. package/src/menu/MenuVisibilityProvider.tsx +4 -2
  389. package/src/menu/MenuWidget.tsx +1 -2
  390. package/src/menu/useContextMenu.ts +4 -2
  391. package/src/movement/types.ts +52 -13
  392. package/src/movement/useKeyboardMovementProvider.ts +77 -38
  393. package/src/navigation/CollapsibleNavGroup.tsx +1 -2
  394. package/src/navigation/NavItem.tsx +1 -2
  395. package/src/navigation/NavItemButton.tsx +2 -1
  396. package/src/navigation/NavItemLink.tsx +2 -1
  397. package/src/navigation/getTableOfContentsHeadings.ts +1 -2
  398. package/src/navigation/types.ts +1 -2
  399. package/src/overlay/Overlay.tsx +2 -1
  400. package/src/positioning/createHorizontalPosition.ts +10 -12
  401. package/src/positioning/createVerticalPosition.ts +10 -11
  402. package/src/positioning/useFixedPositioning.ts +6 -3
  403. package/src/progress/CircularProgress.tsx +2 -1
  404. package/src/progress/LinearProgress.tsx +2 -1
  405. package/src/progress/linearProgressStyles.ts +1 -2
  406. package/src/responsive-item/ResponsiveItem.tsx +1 -2
  407. package/src/responsive-item/ResponsiveItemOverlay.tsx +2 -1
  408. package/src/searching/caseInsensitive.ts +2 -4
  409. package/src/segmented-button/SegmentedButton.tsx +2 -1
  410. package/src/segmented-button/SegmentedButtonContainer.tsx +2 -1
  411. package/src/segmented-button/segmentedButtonStyles.ts +1 -2
  412. package/src/sheet/Sheet.tsx +1 -2
  413. package/src/snackbar/Toast.tsx +2 -1
  414. package/src/spinbutton/SpinButton.tsx +98 -0
  415. package/src/spinbutton/SpinButtonGroupProvider.tsx +32 -0
  416. package/src/spinbutton/defaults.ts +45 -0
  417. package/src/spinbutton/types.ts +413 -0
  418. package/src/spinbutton/useSpinButton.ts +311 -0
  419. package/src/spinbutton/useSpinButtonGroupProvider.ts +104 -0
  420. package/src/spinbutton/utils/deselectNode.ts +17 -0
  421. package/src/spinbutton/utils/resolveInputEvent.ts +112 -0
  422. package/src/spinbutton/utils/selectNode.ts +15 -0
  423. package/src/table/StickyTableSection.tsx +2 -1
  424. package/src/table/Table.tsx +1 -2
  425. package/src/table/TableBody.tsx +2 -1
  426. package/src/table/TableCellContent.tsx +1 -2
  427. package/src/table/TableCheckbox.tsx +1 -2
  428. package/src/table/TableFooter.tsx +1 -2
  429. package/src/table/TableHeader.tsx +1 -2
  430. package/src/table/TableRadio.tsx +1 -2
  431. package/src/table/TableRow.tsx +1 -2
  432. package/src/table/useStickyTableSection.tsx +1 -2
  433. package/src/tabs/SimpleTabPanel.tsx +2 -1
  434. package/src/tabs/SimpleTabPanels.tsx +2 -1
  435. package/src/tabs/Tab.tsx +3 -6
  436. package/src/tabs/TabList.tsx +2 -1
  437. package/src/tabs/TabListScrollButton.tsx +1 -2
  438. package/src/tabs/useMaxTabPanelHeight.ts +7 -4
  439. package/src/test-utils/data-testid.ts +1 -2
  440. package/src/test-utils/mocks/match-media.ts +5 -10
  441. package/src/test-utils/vitest/timers.ts +1 -1
  442. package/src/tooltip/Tooltip.tsx +2 -1
  443. package/src/tooltip/TooltipHoverModeProvider.tsx +1 -2
  444. package/src/tooltip/useTooltip.ts +9 -5
  445. package/src/transition/CSSTransition.tsx +2 -1
  446. package/src/transition/Collapse.tsx +4 -2
  447. package/src/transition/CrossFade.tsx +2 -1
  448. package/src/transition/ScaleTransition.tsx +2 -1
  449. package/src/transition/SkeletonPlaceholder.tsx +1 -2
  450. package/src/transition/Slide.tsx +2 -1
  451. package/src/transition/SlideContainer.tsx +1 -2
  452. package/src/transition/types.ts +15 -16
  453. package/src/transition/useCollapseTransition.ts +6 -5
  454. package/src/transition/useCrossFadeTransition.ts +3 -2
  455. package/src/transition/useMaxWidthTransition.ts +1 -2
  456. package/src/transition/useScaleTransition.ts +3 -2
  457. package/src/transition/useSkeletonPlaceholder.ts +1 -2
  458. package/src/tree/Tree.tsx +2 -1
  459. package/src/tree/TreeItem.tsx +2 -1
  460. package/src/tree/TreeProvider.tsx +4 -4
  461. package/src/tree/styles.ts +1 -2
  462. package/src/tree/types.ts +1 -2
  463. package/src/tree/useTreeMovement.ts +1 -2
  464. package/src/typography/HighlightTextMark.tsx +1 -2
  465. package/src/typography/Mark.tsx +1 -2
  466. package/src/typography/TextContainer.tsx +1 -2
  467. package/src/typography/Typography.tsx +1 -2
  468. package/src/useElementSize.ts +7 -4
  469. package/src/useIntersectionObserver.ts +3 -2
  470. package/src/useMutationObserver.ts +3 -2
  471. package/src/useWindowSize.ts +4 -2
  472. package/src/utils/getNumberOfDigits.ts +18 -0
  473. package/src/utils/nearest.ts +2 -1
  474. package/src/utils/useDevEffect.ts +9 -0
  475. package/src/window-splitter/WindowSplitter.tsx +5 -2
  476. package/src/window-splitter/styles.ts +13 -2
  477. package/src/window-splitter/useWindowSplitter.ts +3 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/SelectedOption.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type ReactElement, type ReactNode } from \"react\";\n\nimport { Box, type BoxProps } from \"../box/Box.js\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport { type OptionProps } from \"./Option.js\";\nimport { textField } from \"./textFieldStyles.js\";\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport interface SelectedOptionProps extends BoxProps {\n option: OptionProps | undefined;\n placeholder?: ReactNode;\n disableAddon: boolean;\n}\n\n/**\n * This component is used to render the current option.\n *\n * @since 6.0.0\n * @internal\n */\nexport function SelectedOption(props: SelectedOptionProps): ReactElement {\n const {\n disableAddon,\n option,\n className,\n disableWrap = true,\n disablePadding = true,\n placeholder,\n ...remaining\n } = props;\n\n let children = option?.children || placeholder;\n // when the children are a string or number, wrap it in additional span so\n // that overflow can be ellipsis-ed\n if (typeof children === \"string\" || typeof children === \"number\") {\n children = (\n <span className={cssUtils({ textOverflow: \"ellipsis\" })}>{children}</span>\n );\n }\n\n return (\n <Box\n {...remaining}\n className={cnb(\"rmd-selected-option\", textField(), className)}\n disableWrap={disableWrap}\n disablePadding={disablePadding}\n >\n {!disableAddon && option?.leftAddon}\n {children}\n </Box>\n );\n}\n"],"names":["cnb","Box","cssUtils","textField","SelectedOption","props","disableAddon","option","className","disableWrap","disablePadding","placeholder","remaining","children","span","textOverflow","leftAddon"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAGhC,SAASC,GAAG,QAAuB,gBAAgB;AACnD,SAASC,QAAQ,QAAQ,iBAAiB;AAE1C,SAASC,SAAS,QAAQ,uBAAuB;AAYjD;;;;;CAKC,GACD,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EACJC,YAAY,EACZC,MAAM,EACNC,SAAS,EACTC,cAAc,IAAI,EAClBC,iBAAiB,IAAI,EACrBC,WAAW,EACX,GAAGC,WACJ,GAAGP;IAEJ,IAAIQ,WAAWN,QAAQM,YAAYF;IACnC,0EAA0E;IAC1E,mCAAmC;IACnC,IAAI,OAAOE,aAAa,YAAY,OAAOA,aAAa,UAAU;QAChEA,yBACE,KAACC;YAAKN,WAAWN,SAAS;gBAAEa,cAAc;YAAW;sBAAKF;;IAE9D;IAEA,qBACE,MAACZ;QACE,GAAGW,SAAS;QACbJ,WAAWR,IAAI,uBAAuBG,aAAaK;QACnDC,aAAaA;QACbC,gBAAgBA;;YAEf,CAACJ,gBAAgBC,QAAQS;YACzBH;;;AAGP"}
1
+ {"version":3,"sources":["../../src/form/SelectedOption.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type ReactElement } from \"react\";\n\nimport { Box, type BoxProps } from \"../box/Box.js\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport { type OptionProps } from \"./Option.js\";\nimport { textField } from \"./textFieldStyles.js\";\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport interface SelectedOptionProps extends BoxProps {\n option: OptionProps | undefined;\n disableAddon: boolean;\n}\n\n/**\n * This component is used to render the current option.\n *\n * @since 6.0.0\n * @internal\n */\nexport function SelectedOption(props: SelectedOptionProps): ReactElement {\n const {\n disableAddon,\n option,\n className,\n disableWrap = true,\n disablePadding = true,\n ...remaining\n } = props;\n\n let { children } = remaining;\n // when the children are a string or number, wrap it in additional span so\n // that overflow can be ellipsis-ed\n if (typeof children === \"string\" || typeof children === \"number\") {\n children = (\n <span className={cssUtils({ textOverflow: \"ellipsis\" })}>{children}</span>\n );\n }\n\n return (\n <Box\n {...remaining}\n className={cnb(\"rmd-selected-option\", textField(), className)}\n disableWrap={disableWrap}\n disablePadding={disablePadding}\n >\n {!disableAddon && option?.leftAddon}\n {children}\n </Box>\n );\n}\n"],"names":["cnb","Box","cssUtils","textField","SelectedOption","props","disableAddon","option","className","disableWrap","disablePadding","remaining","children","span","textOverflow","leftAddon"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAGhC,SAASC,GAAG,QAAuB,gBAAgB;AACnD,SAASC,QAAQ,QAAQ,iBAAiB;AAE1C,SAASC,SAAS,QAAQ,uBAAuB;AAWjD;;;;;CAKC,GACD,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EACJC,YAAY,EACZC,MAAM,EACNC,SAAS,EACTC,cAAc,IAAI,EAClBC,iBAAiB,IAAI,EACrB,GAAGC,WACJ,GAAGN;IAEJ,IAAI,EAAEO,QAAQ,EAAE,GAAGD;IACnB,0EAA0E;IAC1E,mCAAmC;IACnC,IAAI,OAAOC,aAAa,YAAY,OAAOA,aAAa,UAAU;QAChEA,yBACE,KAACC;YAAKL,WAAWN,SAAS;gBAAEY,cAAc;YAAW;sBAAKF;;IAE9D;IAEA,qBACE,MAACX;QACE,GAAGU,SAAS;QACbH,WAAWR,IAAI,uBAAuBG,aAAaK;QACnDC,aAAaA;QACbC,gBAAgBA;;YAEf,CAACJ,gBAAgBC,QAAQQ;YACzBH;;;AAGP"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/Slider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n useRef,\n} from \"react\";\n\nimport { type TooltipProps } from \"../tooltip/Tooltip.js\";\nimport {\n type LabelRequiredForA11y,\n type PropsWithRef,\n type UseStateSetter,\n} from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { identity } from \"../utils/identity.js\";\nimport { type SliderAddonProps, SliderContainer } from \"./SliderContainer.js\";\nimport {\n type ConfigurableSliderThumbProps,\n SliderThumb,\n type SliderThumbPresentation,\n type SliderThumbProps,\n} from \"./SliderThumb.js\";\nimport { SliderTrack } from \"./SliderTrack.js\";\nimport {\n type SliderMarksOptions,\n SliderValueMarks,\n} from \"./SliderValueMarks.js\";\nimport { getJumpValue, getSliderInputName } from \"./sliderUtils.js\";\nimport { type RangeSliderState } from \"./useRangeSlider.js\";\nimport { type SliderState, type SliderValueOptions } from \"./useSlider.js\";\nimport { useSliderDraggable } from \"./useSliderDraggable.js\";\n\n// NOTE: The augmentation appears in this file since no type definitions are\n// ever imported from the `sliderStyles` file.\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-slider-color\"?: string;\n \"--rmd-slider-active-color\"?: string;\n \"--rmd-slider-inactive-color\"?: string;\n \"--rmd-slider-size\"?: string | number;\n \"--rmd-slider-active-size\"?: string | number;\n \"--rmd-slider-inactive-size\"?: string | number;\n \"--rmd-slider-vertical-size\"?: string | number;\n \"--rmd-slider-offset-1\"?: string;\n \"--rmd-slider-offset-2\"?: string;\n \"--rmd-slider-tooltip-scale\"?: string | number;\n \"--rmd-slider-tooltip-translate\"?: string | number;\n \"--rmd-slider-mark-offset\"?: string;\n \"--rmd-slider-mark-active-color\"?: string;\n \"--rmd-slider-mark-active-opacity\"?: string | number;\n \"--rmd-slider-mark-inactive-color\"?: string;\n \"--rmd-slider-mark-inactive-opacity\"?: string | number;\n }\n}\n\nconst emptyString = (): string => \"\";\nconst noop = (): undefined => {\n // do nothing\n};\n\n/**\n * @since 2.5.0\n */\nexport interface BaseSliderProps\n extends HTMLAttributes<HTMLDivElement>,\n SliderThumbPresentation,\n SliderValueOptions,\n SliderAddonProps,\n SliderMarksOptions {\n /**\n * This can be used to apply a ref to the container element since this\n * component does not use `forwardRef`.\n */\n containerRef?: Ref<HTMLDivElement>;\n\n /**\n * The amount to jump the slider's value when the `PageUp` or `PageDown`\n * key is pressed.\n *\n * The default value is 1/10th of the range.\n *\n * @defaultValue `(numberOfSteps / 10) * step`\n */\n jump?: number;\n\n /** @defaultValue `false` */\n disabled?: boolean;\n\n /** @defaultValue `false` */\n vertical?: boolean;\n\n /**\n * This can be used to apply custom styles or a `ref` to the track element if\n * needed.\n */\n trackProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;\n\n /**\n * This can be used to configure any additional tooltip props like the\n * CSS transition `classNames`, styles, etc.\n *\n * This will only be used when {@link discrete} is `true`.\n *\n * Note: The `position` will always be `\"above\"` for horizontal sliders and\n * `\"left\"` for vertical sliders.\n */\n tooltipProps?: Omit<Partial<TooltipProps>, \"position\">;\n}\n\n/**\n * @since 2.5.0\n * @since 6.0.0 Only requires `value` and `setValue` props instead of all the\n * slider controls.\n * @since 6.0.0 The `thumbLabel` and `thumbLabelledBy` props were removed. Use\n * the `aria-label` or `aria-labelledby` props instead.\n * @since 6.0.0 The `baseId` prop was removed in favor of `id` or `*Props.id`\n */\nexport interface SliderProps extends BaseSliderProps, SliderState {\n /**\n * Convenience pass-through prop to {@link ConfigurableSliderThumbProps.name} which\n * will be applied to the hidden `<input type=\"range\" />`\n */\n name?: string;\n\n /**\n * Any additional props that should be provided to the thumb element. This can\n * be useful for applying additional styling.\n */\n thumbProps?: ConfigurableSliderThumbProps;\n\n /**\n * This can be used to update the discrete slider's tooltip props.\n *\n * @example Custom Styles\n * ```tsx\n * <Slider\n * {...slider}\n * discrete\n * getTooltipProps={(value) => ({\n * className: cssUtils({\n * backgroundColor: value < 30 ? \"warning\" : undefined,\n * }),\n * })}\n * />\n * ```\n */\n getTooltipProps?: (value: number) => Partial<TooltipProps> | undefined;\n\n /**\n * This can be used to update the discrete slider's value tooltip.\n *\n * @example More Value Information\n * ```tsx\n * <Slider\n * {...slider}\n * discrete\n * getTooltipChildren={(value) => (\n * <TextIconSpacing icon={<FavoriteIcon />}>\n * {value}\n * </TextIconSpacing>\n * )}\n * />\n * ```\n *\n * This will only be used when {@link discrete} is `true`.\n *\n * @defaultValue `(value) => value`\n */\n getTooltipChildren?: (value: number) => ReactNode;\n}\n\n/**\n * @since 2.5.0\n * @since 6.0.0 Only requires `rangeValue` and `setRangeValue` props instead of\n * all the slider controls.\n * @since 6.0.0 The `thumb1Label`, `thumb1LabelledBy`, `thumb1Props`,\n * `thumb2Label`, `thumb2LabelledBy` and `thumb2Props` were renamed to\n * `minThumbLabel`, `minThumbLabelledBy`, `minThumbProps`, `maxThumbLabel`,\n * `maxThumbLabelledBy`, and `maxThumbProps` respectively.\n */\nexport interface RangeSliderProps extends BaseSliderProps, RangeSliderState {\n /**\n * Convenience pass-through prop for {@link\n * ConfigurableSliderThumbProps.name} for both the {@link minThumbProps} and\n * {@link maxThumbProps}.\n */\n name?: string;\n\n /**\n * Any additional props that should be provided to the min value thumb\n * element. This can be useful for applying additional styling.\n */\n minThumbProps?: ConfigurableSliderThumbProps;\n\n /**\n * Any additional props that should be provided to the max value thumb\n * element. This can be useful for applying additional styling.\n */\n maxThumbProps?: ConfigurableSliderThumbProps;\n\n /**\n * The `aria-label` to apply to the min value.\n *\n * Note: Either this prop or the {@link minThumbLabelledBy} are required for\n * accessibility.\n *\n * @defaultValue `\"Min\"`\n */\n minThumbLabel?: string;\n\n /**\n * Set this to an element's id that labels the min value.\n *\n * Note: Either this prop or the {@link minThumbLabel} are required for\n * accessibility.\n */\n minThumbLabelledBy?: string;\n\n /**\n * The `aria-label` to apply to the max value.\n *\n * Note: Either this prop or the {@link maxThumbLabelledBy} are required for\n * accessibility.\n *\n * @defaultValue `\"Max\"`\n */\n maxThumbLabel?: string;\n\n /**\n * Set this to an element's id that labels the max value.\n *\n * Note: Either this prop or the {@link maxThumbLabel} are required for\n * accessibility.\n */\n maxThumbLabelledBy?: string;\n\n /**\n * This can be used to update the discrete slider's tooltip props.\n *\n * @example Custom Styles\n * ```tsx\n * <Slider\n * {...slider}\n * discrete\n * getTooltipProps={(value, isFirstThumb) => ({\n * className: cssUtils({\n * backgroundColor: value < 30 && isFirstThumb ? \"warning\" : undefined,\n * }),\n * })}\n * />\n * ```\n */\n getTooltipProps?: (\n value: number,\n isFirstThumb: boolean\n ) => Partial<TooltipProps>;\n\n /**\n * This can be used to update the discrete slider's value tooltip.\n *\n * @example More Value Information\n * ```tsx\n * <Slider\n * {...rangeSlider}\n * discrete\n * getTooltipChildren={(value, isFirstThumb) => (\n * <TextIconSpacing\n * icon={isFirstThumb ? <FavoriteIcon /> : <CloseIcon /}\n * iconAfter={!isFirstValue}\n * >\n * {value}\n * </TextIconSpacing>\n * )}\n * />\n * ```\n *\n * This will only be used when {@link discrete} is `true`.\n *\n * @defaultValue `(value) => value`\n */\n getTooltipChildren?: (value: number, isFirstThumb: boolean) => ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { Form } from \"@react-md/core/form/Form\";\n * import { Slider } from \"@react-md/core/form/Slider\";\n * import { useSlider } from \"@react-md/core/form/useSlider\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const slider = useSlider({\n * // these are the defaults and can be changed\n * min: 0,\n * max: 100,\n * step: 1,\n * defaultValue: 50,\n * });\n *\n * // if you need access to the current value or manually change the value\n * // yourself.\n * const { value, setValue } = slider;\n *\n * return (\n * <Form>\n * <Slider {...slider} aria-label=\"Volume\" />\n * </Form>\n * );\n * }\n * ```\n *\n * @example Range Slider Example\n * ```tsx\n * import { Fieldset } from \"@react-md/core/form/Fieldset\";\n * import { Form } from \"@react-md/core/form/Form\";\n * import { Legend } from \"@react-md/core/form/Legend\";\n * import { Slider } from \"@react-md/core/form/Slider\";\n * import { useRangeSlider } from \"@react-md/core/form/useRangeSlider\";\n * import type { ReactElement } from \"react\";\n * import { useId } from \"react\";\n *\n * function Example(): ReactElement {\n * const slider = useRangeSlider({\n * // these are the defaults and can be changed\n * min: 0,\n * max: 100,\n * step: 1,\n * defaultValue: [0, 100],\n * });\n *\n * // if you need access to the current value or manually change the value\n * // yourself.\n * const { rangeValue, setRangeValue } = slider;\n * const [minPrice, maxPrice] = rangeValue;\n *\n * return (\n * <Form>\n * <Fieldset>\n * <Legend>Price Range</Legend>\n * <Slider {...slider} />\n * </Fieldset>\n * </Form>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/slider | Slider Demos}\n * @since 2.5.0\n * @since 6.0.0 The `Slider` and `RangeSlider` have been combined into the\n * single `Slider` component and removed the `label` support.\n * @since 6.0.0 Each thumb includes an invisible `<input type=\"range\">` instead\n * of an `<input type=\"hidden\">`.\n */\nexport function Slider(props: LabelRequiredForA11y<SliderProps>): ReactElement;\nexport function Slider(props: RangeSliderProps): ReactElement;\nexport function Slider(\n props: LabelRequiredForA11y<SliderProps> | RangeSliderProps\n): ReactElement {\n const {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n id: propId,\n name,\n min = 0,\n max = 100,\n step = 1,\n jump: propJump,\n vertical = false,\n discrete = false,\n disabled = false,\n getValueText = emptyString,\n children,\n marks = false,\n value,\n setValue,\n rangeValue,\n setRangeValue,\n trackProps,\n thumbProps,\n minThumbProps,\n minThumbLabel,\n minThumbLabelledBy,\n maxThumbProps,\n maxThumbLabel,\n maxThumbLabelledBy,\n tooltipProps,\n containerRef,\n getMarkProps = noop,\n getMarkLabelProps = noop,\n tooltipVisibility = \"auto\",\n getTooltipProps = noop,\n getTooltipChildren = identity,\n disableSmoothDragging = !!marks,\n ...remaining\n } = props as SliderProps & RangeSliderProps;\n\n const jump = getJumpValue({ min, max, step, jump: propJump });\n const isRangeSlider = typeof value !== \"number\";\n\n const thumb1Id = useEnsuredId(propId, \"slider\");\n const thumb2Id = `${thumb1Id}-2`;\n const thumb1Ref = useRef<HTMLSpanElement>(null);\n const thumb2Ref = useRef<HTMLSpanElement>(null);\n const { thumb1Name, thumb2Name } = getSliderInputName(name, isRangeSlider);\n\n let thumb1Max = max;\n let thumb2Min = min;\n let thumb1Label: string | undefined;\n let thumb1LabelledBy: string | undefined;\n let thumb2Label: string | undefined;\n let thumb2LabelledBy: string | undefined;\n let thumb1Value: number;\n let thumb2Value: number;\n let setThumb1Value: UseStateSetter<number>;\n let setThumb2Value: UseStateSetter<number>;\n if (!isRangeSlider) {\n thumb1Value = value;\n setThumb1Value = setValue;\n thumb2Value = max;\n setThumb2Value = noop;\n thumb1Label = ariaLabel;\n thumb1LabelledBy = ariaLabelledBy;\n } else {\n thumb1LabelledBy = minThumbLabelledBy;\n thumb1Label = minThumbLabel || (minThumbLabelledBy ? undefined : \"Min\");\n thumb2LabelledBy = maxThumbLabelledBy;\n thumb2Label = maxThumbLabel || (maxThumbLabelledBy ? undefined : \"Max\");\n\n [thumb1Value, thumb2Value] = rangeValue;\n\n thumb1Max = thumb2Value - step;\n thumb2Min = thumb1Value + step;\n\n setThumb1Value = (valueOrSetter) => {\n setRangeValue((prevRangeValue) => {\n const value =\n typeof valueOrSetter === \"number\"\n ? valueOrSetter\n : valueOrSetter(prevRangeValue[0]);\n\n return [value, prevRangeValue[1]];\n });\n };\n setThumb2Value = (valueOrSetter) => {\n setRangeValue((prevRangeValue) => {\n const value =\n typeof valueOrSetter === \"number\"\n ? valueOrSetter\n : valueOrSetter(prevRangeValue[1]);\n\n return [prevRangeValue[0], value];\n });\n };\n }\n\n const {\n onKeyDown: thumb1OnKeyDown,\n onMouseUp: thumb1OnMouseUp,\n onMouseDown: thumb1OnMouseDown,\n onMouseMove: thumb1OnMouseMove,\n onTouchStart: thumb1OnTouchStart,\n onTouchMove: thumb1OnTouchMove,\n dragPercentage: thumb1DragPercentage,\n draggableRef: thumb1DraggableRef,\n dragging: thumb1Dragging,\n } = useSliderDraggable({\n jump,\n ref: thumb1Ref,\n min,\n max: thumb1Max,\n rangeMax: max,\n step,\n value: thumb1Value,\n setValue: setThumb1Value,\n disabled,\n vertical,\n });\n\n const {\n onKeyDown: thumb2OnKeyDown,\n onMouseUp: thumb2OnMouseUp,\n onMouseDown: thumb2OnMouseDown,\n onMouseMove: thumb2OnMouseMove,\n onTouchStart: thumb2OnTouchStart,\n onTouchMove: thumb2OnTouchMove,\n dragPercentage: thumb2DragPercentage,\n draggableRef: thumb2DraggableRef,\n dragging: thumb2Dragging,\n } = useSliderDraggable({\n jump,\n ref: thumb2Ref,\n min: thumb2Min,\n max,\n rangeMin: min,\n step,\n value: thumb2Value,\n setValue: setThumb2Value,\n vertical,\n disabled,\n });\n\n const dragging = thumb1Dragging || thumb2Dragging;\n const sharedThumbProps = {\n step,\n animate: !dragging,\n discrete,\n disabled,\n vertical,\n getValueText,\n tooltipProps,\n getTooltipProps,\n getTooltipChildren,\n tooltipVisibility,\n disableSmoothDragging,\n } as const satisfies Partial<SliderThumbProps>;\n\n return (\n <SliderContainer {...remaining} ref={containerRef} vertical={vertical}>\n <SliderTrack\n {...trackProps}\n min={min}\n max={max}\n thumb1Ref={thumb1Ref}\n thumb1Value={thumb1Value}\n thumb1Dragging={!disableSmoothDragging && thumb1Dragging}\n thumb1DragPercentage={thumb1DragPercentage}\n thumb1OnMouseUp={thumb1OnMouseUp}\n thumb1OnMouseDown={thumb1OnMouseDown}\n thumb1OnMouseMove={thumb1OnMouseMove}\n thumb1OnTouchStart={thumb1OnTouchStart}\n thumb1OnTouchMove={thumb1OnTouchMove}\n thumb2Ref={thumb2Ref}\n thumb2Value={thumb2Value}\n thumb2Dragging={!disableSmoothDragging && thumb2Dragging}\n thumb2DragPercentage={thumb2DragPercentage}\n thumb2OnMouseUp={thumb2OnMouseUp}\n thumb2OnMouseDown={thumb2OnMouseDown}\n thumb2OnMouseMove={thumb2OnMouseMove}\n thumb2OnTouchStart={thumb2OnTouchStart}\n thumb2OnTouchMove={thumb2OnTouchMove}\n animate={!disableSmoothDragging && !dragging}\n disabled={disabled}\n vertical={vertical}\n isRangeSlider={isRangeSlider}\n >\n <SliderThumb\n aria-label={thumb1Label as string}\n aria-labelledby={thumb1LabelledBy}\n id={thumb1Id}\n name={thumb1Name}\n {...thumbProps}\n {...minThumbProps}\n {...sharedThumbProps}\n ref={thumb1DraggableRef}\n min={min}\n max={thumb1Max}\n value={thumb1Value}\n index={1}\n active={thumb1Dragging}\n onChange={(event) => {\n setThumb1Value(event.currentTarget.valueAsNumber);\n }}\n onKeyDown={thumb1OnKeyDown}\n />\n {isRangeSlider && (\n <SliderThumb\n aria-label={thumb2Label as string}\n aria-labelledby={thumb2LabelledBy}\n id={thumb2Id}\n name={thumb2Name}\n {...maxThumbProps}\n {...sharedThumbProps}\n ref={thumb2DraggableRef}\n min={thumb2Min}\n max={max}\n value={thumb2Value}\n index={2}\n active={thumb2Dragging}\n onChange={(event) => {\n setThumb2Value(event.currentTarget.valueAsNumber);\n }}\n onKeyDown={thumb2OnKeyDown}\n />\n )}\n {marks && (\n <SliderValueMarks\n min={min}\n max={max}\n step={step}\n marks={marks}\n vertical={vertical}\n thumb1Value={thumb1Value}\n thumb2Value={thumb2Value}\n isRangeSlider={isRangeSlider}\n getMarkProps={getMarkProps}\n getMarkLabelProps={getMarkLabelProps}\n />\n )}\n {children}\n </SliderTrack>\n </SliderContainer>\n );\n}\n"],"names":["useRef","useEnsuredId","identity","SliderContainer","SliderThumb","SliderTrack","SliderValueMarks","getJumpValue","getSliderInputName","useSliderDraggable","emptyString","noop","Slider","props","ariaLabel","ariaLabelledBy","id","propId","name","min","max","step","jump","propJump","vertical","discrete","disabled","getValueText","children","marks","value","setValue","rangeValue","setRangeValue","trackProps","thumbProps","minThumbProps","minThumbLabel","minThumbLabelledBy","maxThumbProps","maxThumbLabel","maxThumbLabelledBy","tooltipProps","containerRef","getMarkProps","getMarkLabelProps","tooltipVisibility","getTooltipProps","getTooltipChildren","disableSmoothDragging","remaining","isRangeSlider","thumb1Id","thumb2Id","thumb1Ref","thumb2Ref","thumb1Name","thumb2Name","thumb1Max","thumb2Min","thumb1Label","thumb1LabelledBy","thumb2Label","thumb2LabelledBy","thumb1Value","thumb2Value","setThumb1Value","setThumb2Value","undefined","valueOrSetter","prevRangeValue","onKeyDown","thumb1OnKeyDown","onMouseUp","thumb1OnMouseUp","onMouseDown","thumb1OnMouseDown","onMouseMove","thumb1OnMouseMove","onTouchStart","thumb1OnTouchStart","onTouchMove","thumb1OnTouchMove","dragPercentage","thumb1DragPercentage","draggableRef","thumb1DraggableRef","dragging","thumb1Dragging","ref","rangeMax","thumb2OnKeyDown","thumb2OnMouseUp","thumb2OnMouseDown","thumb2OnMouseMove","thumb2OnTouchStart","thumb2OnTouchMove","thumb2DragPercentage","thumb2DraggableRef","thumb2Dragging","rangeMin","sharedThumbProps","animate","aria-label","aria-labelledby","index","active","onChange","event","currentTarget","valueAsNumber"],"mappings":"AAAA;;AAEA,SAKEA,MAAM,QACD,QAAQ;AAQf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAAgCC,eAAe,QAAQ,uBAAuB;AAC9E,SAEEC,WAAW,QAGN,mBAAmB;AAC1B,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAEEC,gBAAgB,QACX,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,kBAAkB,QAAQ,mBAAmB;AAGpE,SAASC,kBAAkB,QAAQ,0BAA0B;AAyB7D,MAAMC,cAAc,IAAc;AAClC,MAAMC,OAAO;AACX,aAAa;AACf;AA4SA,OAAO,SAASC,OACdC,KAA2D;IAE3D,MAAM,EACJ,cAAcC,SAAS,EACvB,mBAAmBC,cAAc,EACjCC,IAAIC,MAAM,EACVC,IAAI,EACJC,MAAM,CAAC,EACPC,MAAM,GAAG,EACTC,OAAO,CAAC,EACRC,MAAMC,QAAQ,EACdC,WAAW,KAAK,EAChBC,WAAW,KAAK,EAChBC,WAAW,KAAK,EAChBC,eAAejB,WAAW,EAC1Bk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Gd9D,uBACC,KAACvB;oBACCa,KAAKA;oBACLC,KAAKA;oBACLC,MAAMA;oBACNQ,OAAOA;oBACPL,UAAUA;oBACVwC,aAAaA;oBACbC,aAAaA;oBACbd,eAAeA;oBACfP,cAAcA;oBACdC,mBAAmBA;;gBAGtBjB;;;;AAIT"}
1
+ {"version":3,"sources":["../../src/form/Slider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n useRef,\n} from \"react\";\n\nimport { type TooltipProps } from \"../tooltip/Tooltip.js\";\nimport {\n type LabelRequiredForA11y,\n type PropsWithRef,\n type UseStateSetter,\n} from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { identity } from \"../utils/identity.js\";\nimport { type SliderAddonProps, SliderContainer } from \"./SliderContainer.js\";\nimport {\n type ConfigurableSliderThumbProps,\n SliderThumb,\n type SliderThumbPresentation,\n type SliderThumbProps,\n} from \"./SliderThumb.js\";\nimport { SliderTrack } from \"./SliderTrack.js\";\nimport {\n type SliderMarksOptions,\n SliderValueMarks,\n} from \"./SliderValueMarks.js\";\nimport { getJumpValue, getSliderInputName } from \"./sliderUtils.js\";\nimport { type RangeSliderState } from \"./useRangeSlider.js\";\nimport { type SliderState, type SliderValueOptions } from \"./useSlider.js\";\nimport { useSliderDraggable } from \"./useSliderDraggable.js\";\n\n// NOTE: The augmentation appears in this file since no type definitions are\n// ever imported from the `sliderStyles` file.\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-slider-color\"?: string;\n \"--rmd-slider-active-color\"?: string;\n \"--rmd-slider-inactive-color\"?: string;\n \"--rmd-slider-size\"?: string | number;\n \"--rmd-slider-active-size\"?: string | number;\n \"--rmd-slider-inactive-size\"?: string | number;\n \"--rmd-slider-vertical-size\"?: string | number;\n \"--rmd-slider-offset-1\"?: string;\n \"--rmd-slider-offset-2\"?: string;\n \"--rmd-slider-tooltip-scale\"?: string | number;\n \"--rmd-slider-tooltip-translate\"?: string | number;\n \"--rmd-slider-mark-offset\"?: string;\n \"--rmd-slider-mark-active-color\"?: string;\n \"--rmd-slider-mark-active-opacity\"?: string | number;\n \"--rmd-slider-mark-inactive-color\"?: string;\n \"--rmd-slider-mark-inactive-opacity\"?: string | number;\n }\n}\n\nconst emptyString = (): string => \"\";\nconst noop = (): undefined => {\n // do nothing\n};\n\n/**\n * @since 2.5.0\n */\nexport interface BaseSliderProps\n extends\n HTMLAttributes<HTMLDivElement>,\n SliderThumbPresentation,\n SliderValueOptions,\n SliderAddonProps,\n SliderMarksOptions {\n /**\n * This can be used to apply a ref to the container element since this\n * component does not use `forwardRef`.\n */\n containerRef?: Ref<HTMLDivElement>;\n\n /**\n * The amount to jump the slider's value when the `PageUp` or `PageDown`\n * key is pressed.\n *\n * The default value is 1/10th of the range.\n *\n * @defaultValue `(numberOfSteps / 10) * step`\n */\n jump?: number;\n\n /** @defaultValue `false` */\n disabled?: boolean;\n\n /** @defaultValue `false` */\n vertical?: boolean;\n\n /**\n * This can be used to apply custom styles or a `ref` to the track element if\n * needed.\n */\n trackProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;\n\n /**\n * This can be used to configure any additional tooltip props like the\n * CSS transition `classNames`, styles, etc.\n *\n * This will only be used when {@link discrete} is `true`.\n *\n * Note: The `position` will always be `\"above\"` for horizontal sliders and\n * `\"left\"` for vertical sliders.\n */\n tooltipProps?: Omit<Partial<TooltipProps>, \"position\">;\n}\n\n/**\n * @since 2.5.0\n * @since 6.0.0 Only requires `value` and `setValue` props instead of all the\n * slider controls.\n * @since 6.0.0 The `thumbLabel` and `thumbLabelledBy` props were removed. Use\n * the `aria-label` or `aria-labelledby` props instead.\n * @since 6.0.0 The `baseId` prop was removed in favor of `id` or `*Props.id`\n */\nexport interface SliderProps extends BaseSliderProps, SliderState {\n /**\n * Convenience pass-through prop to {@link ConfigurableSliderThumbProps.name} which\n * will be applied to the hidden `<input type=\"range\" />`\n */\n name?: string;\n\n /**\n * Any additional props that should be provided to the thumb element. This can\n * be useful for applying additional styling.\n */\n thumbProps?: ConfigurableSliderThumbProps;\n\n /**\n * This can be used to update the discrete slider's tooltip props.\n *\n * @example Custom Styles\n * ```tsx\n * <Slider\n * {...slider}\n * discrete\n * getTooltipProps={(value) => ({\n * className: cssUtils({\n * backgroundColor: value < 30 ? \"warning\" : undefined,\n * }),\n * })}\n * />\n * ```\n */\n getTooltipProps?: (value: number) => Partial<TooltipProps> | undefined;\n\n /**\n * This can be used to update the discrete slider's value tooltip.\n *\n * @example More Value Information\n * ```tsx\n * <Slider\n * {...slider}\n * discrete\n * getTooltipChildren={(value) => (\n * <TextIconSpacing icon={<FavoriteIcon />}>\n * {value}\n * </TextIconSpacing>\n * )}\n * />\n * ```\n *\n * This will only be used when {@link discrete} is `true`.\n *\n * @defaultValue `(value) => value`\n */\n getTooltipChildren?: (value: number) => ReactNode;\n}\n\n/**\n * @since 2.5.0\n * @since 6.0.0 Only requires `rangeValue` and `setRangeValue` props instead of\n * all the slider controls.\n * @since 6.0.0 The `thumb1Label`, `thumb1LabelledBy`, `thumb1Props`,\n * `thumb2Label`, `thumb2LabelledBy` and `thumb2Props` were renamed to\n * `minThumbLabel`, `minThumbLabelledBy`, `minThumbProps`, `maxThumbLabel`,\n * `maxThumbLabelledBy`, and `maxThumbProps` respectively.\n */\nexport interface RangeSliderProps extends BaseSliderProps, RangeSliderState {\n /**\n * Convenience pass-through prop for {@link\n * ConfigurableSliderThumbProps.name} for both the {@link minThumbProps} and\n * {@link maxThumbProps}.\n */\n name?: string;\n\n /**\n * Any additional props that should be provided to the min value thumb\n * element. This can be useful for applying additional styling.\n */\n minThumbProps?: ConfigurableSliderThumbProps;\n\n /**\n * Any additional props that should be provided to the max value thumb\n * element. This can be useful for applying additional styling.\n */\n maxThumbProps?: ConfigurableSliderThumbProps;\n\n /**\n * The `aria-label` to apply to the min value.\n *\n * Note: Either this prop or the {@link minThumbLabelledBy} are required for\n * accessibility.\n *\n * @defaultValue `\"Min\"`\n */\n minThumbLabel?: string;\n\n /**\n * Set this to an element's id that labels the min value.\n *\n * Note: Either this prop or the {@link minThumbLabel} are required for\n * accessibility.\n */\n minThumbLabelledBy?: string;\n\n /**\n * The `aria-label` to apply to the max value.\n *\n * Note: Either this prop or the {@link maxThumbLabelledBy} are required for\n * accessibility.\n *\n * @defaultValue `\"Max\"`\n */\n maxThumbLabel?: string;\n\n /**\n * Set this to an element's id that labels the max value.\n *\n * Note: Either this prop or the {@link maxThumbLabel} are required for\n * accessibility.\n */\n maxThumbLabelledBy?: string;\n\n /**\n * This can be used to update the discrete slider's tooltip props.\n *\n * @example Custom Styles\n * ```tsx\n * <Slider\n * {...slider}\n * discrete\n * getTooltipProps={(value, isFirstThumb) => ({\n * className: cssUtils({\n * backgroundColor: value < 30 && isFirstThumb ? \"warning\" : undefined,\n * }),\n * })}\n * />\n * ```\n */\n getTooltipProps?: (\n value: number,\n isFirstThumb: boolean\n ) => Partial<TooltipProps>;\n\n /**\n * This can be used to update the discrete slider's value tooltip.\n *\n * @example More Value Information\n * ```tsx\n * <Slider\n * {...rangeSlider}\n * discrete\n * getTooltipChildren={(value, isFirstThumb) => (\n * <TextIconSpacing\n * icon={isFirstThumb ? <FavoriteIcon /> : <CloseIcon /}\n * iconAfter={!isFirstValue}\n * >\n * {value}\n * </TextIconSpacing>\n * )}\n * />\n * ```\n *\n * This will only be used when {@link discrete} is `true`.\n *\n * @defaultValue `(value) => value`\n */\n getTooltipChildren?: (value: number, isFirstThumb: boolean) => ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { Form } from \"@react-md/core/form/Form\";\n * import { Slider } from \"@react-md/core/form/Slider\";\n * import { useSlider } from \"@react-md/core/form/useSlider\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const slider = useSlider({\n * // these are the defaults and can be changed\n * min: 0,\n * max: 100,\n * step: 1,\n * defaultValue: 50,\n * });\n *\n * // if you need access to the current value or manually change the value\n * // yourself.\n * const { value, setValue } = slider;\n *\n * return (\n * <Form>\n * <Slider {...slider} aria-label=\"Volume\" />\n * </Form>\n * );\n * }\n * ```\n *\n * @example Range Slider Example\n * ```tsx\n * import { Fieldset } from \"@react-md/core/form/Fieldset\";\n * import { Form } from \"@react-md/core/form/Form\";\n * import { Legend } from \"@react-md/core/form/Legend\";\n * import { Slider } from \"@react-md/core/form/Slider\";\n * import { useRangeSlider } from \"@react-md/core/form/useRangeSlider\";\n * import type { ReactElement } from \"react\";\n * import { useId } from \"react\";\n *\n * function Example(): ReactElement {\n * const slider = useRangeSlider({\n * // these are the defaults and can be changed\n * min: 0,\n * max: 100,\n * step: 1,\n * defaultValue: [0, 100],\n * });\n *\n * // if you need access to the current value or manually change the value\n * // yourself.\n * const { rangeValue, setRangeValue } = slider;\n * const [minPrice, maxPrice] = rangeValue;\n *\n * return (\n * <Form>\n * <Fieldset>\n * <Legend>Price Range</Legend>\n * <Slider {...slider} />\n * </Fieldset>\n * </Form>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/slider | Slider Demos}\n * @since 2.5.0\n * @since 6.0.0 The `Slider` and `RangeSlider` have been combined into the\n * single `Slider` component and removed the `label` support.\n * @since 6.0.0 Each thumb includes an invisible `<input type=\"range\">` instead\n * of an `<input type=\"hidden\">`.\n */\nexport function Slider(props: LabelRequiredForA11y<SliderProps>): ReactElement;\nexport function Slider(props: RangeSliderProps): ReactElement;\nexport function Slider(\n props: LabelRequiredForA11y<SliderProps> | RangeSliderProps\n): ReactElement {\n const {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n id: propId,\n name,\n min = 0,\n max = 100,\n step = 1,\n jump: propJump,\n vertical = false,\n discrete = false,\n disabled = false,\n getValueText = emptyString,\n children,\n marks = false,\n value,\n setValue,\n rangeValue,\n setRangeValue,\n trackProps,\n thumbProps,\n minThumbProps,\n minThumbLabel,\n minThumbLabelledBy,\n maxThumbProps,\n maxThumbLabel,\n maxThumbLabelledBy,\n tooltipProps,\n containerRef,\n getMarkProps = noop,\n getMarkLabelProps = noop,\n tooltipVisibility = \"auto\",\n getTooltipProps = noop,\n getTooltipChildren = identity,\n disableSmoothDragging = !!marks,\n ...remaining\n } = props as SliderProps & RangeSliderProps;\n\n const jump = getJumpValue({ min, max, step, jump: propJump });\n const isRangeSlider = typeof value !== \"number\";\n\n const thumb1Id = useEnsuredId(propId, \"slider\");\n const thumb2Id = `${thumb1Id}-2`;\n const thumb1Ref = useRef<HTMLSpanElement>(null);\n const thumb2Ref = useRef<HTMLSpanElement>(null);\n const { thumb1Name, thumb2Name } = getSliderInputName(name, isRangeSlider);\n\n let thumb1Max = max;\n let thumb2Min = min;\n let thumb1Label: string | undefined;\n let thumb1LabelledBy: string | undefined;\n let thumb2Label: string | undefined;\n let thumb2LabelledBy: string | undefined;\n let thumb1Value: number;\n let thumb2Value: number;\n let setThumb1Value: UseStateSetter<number>;\n let setThumb2Value: UseStateSetter<number>;\n if (!isRangeSlider) {\n thumb1Value = value;\n setThumb1Value = setValue;\n thumb2Value = max;\n setThumb2Value = noop;\n thumb1Label = ariaLabel;\n thumb1LabelledBy = ariaLabelledBy;\n } else {\n thumb1LabelledBy = minThumbLabelledBy;\n thumb1Label = minThumbLabel || (minThumbLabelledBy ? undefined : \"Min\");\n thumb2LabelledBy = maxThumbLabelledBy;\n thumb2Label = maxThumbLabel || (maxThumbLabelledBy ? undefined : \"Max\");\n\n [thumb1Value, thumb2Value] = rangeValue;\n\n thumb1Max = thumb2Value - step;\n thumb2Min = thumb1Value + step;\n\n setThumb1Value = (valueOrSetter) => {\n setRangeValue((prevRangeValue) => {\n const value =\n typeof valueOrSetter === \"number\"\n ? valueOrSetter\n : valueOrSetter(prevRangeValue[0]);\n\n return [value, prevRangeValue[1]];\n });\n };\n setThumb2Value = (valueOrSetter) => {\n setRangeValue((prevRangeValue) => {\n const value =\n typeof valueOrSetter === \"number\"\n ? valueOrSetter\n : valueOrSetter(prevRangeValue[1]);\n\n return [prevRangeValue[0], value];\n });\n };\n }\n\n const {\n onKeyDown: thumb1OnKeyDown,\n onMouseUp: thumb1OnMouseUp,\n onMouseDown: thumb1OnMouseDown,\n onMouseMove: thumb1OnMouseMove,\n onTouchStart: thumb1OnTouchStart,\n onTouchMove: thumb1OnTouchMove,\n dragPercentage: thumb1DragPercentage,\n draggableRef: thumb1DraggableRef,\n dragging: thumb1Dragging,\n } = useSliderDraggable({\n jump,\n ref: thumb1Ref,\n min,\n max: thumb1Max,\n rangeMax: max,\n step,\n value: thumb1Value,\n setValue: setThumb1Value,\n disabled,\n vertical,\n });\n\n const {\n onKeyDown: thumb2OnKeyDown,\n onMouseUp: thumb2OnMouseUp,\n onMouseDown: thumb2OnMouseDown,\n onMouseMove: thumb2OnMouseMove,\n onTouchStart: thumb2OnTouchStart,\n onTouchMove: thumb2OnTouchMove,\n dragPercentage: thumb2DragPercentage,\n draggableRef: thumb2DraggableRef,\n dragging: thumb2Dragging,\n } = useSliderDraggable({\n jump,\n ref: thumb2Ref,\n min: thumb2Min,\n max,\n rangeMin: min,\n step,\n value: thumb2Value,\n setValue: setThumb2Value,\n vertical,\n disabled,\n });\n\n const dragging = thumb1Dragging || thumb2Dragging;\n const sharedThumbProps = {\n step,\n animate: !dragging,\n discrete,\n disabled,\n vertical,\n getValueText,\n tooltipProps,\n getTooltipProps,\n getTooltipChildren,\n tooltipVisibility,\n disableSmoothDragging,\n } as const satisfies Partial<SliderThumbProps>;\n\n return (\n <SliderContainer {...remaining} ref={containerRef} vertical={vertical}>\n <SliderTrack\n {...trackProps}\n min={min}\n max={max}\n thumb1Ref={thumb1Ref}\n thumb1Value={thumb1Value}\n thumb1Dragging={!disableSmoothDragging && thumb1Dragging}\n thumb1DragPercentage={thumb1DragPercentage}\n thumb1OnMouseUp={thumb1OnMouseUp}\n thumb1OnMouseDown={thumb1OnMouseDown}\n thumb1OnMouseMove={thumb1OnMouseMove}\n thumb1OnTouchStart={thumb1OnTouchStart}\n thumb1OnTouchMove={thumb1OnTouchMove}\n thumb2Ref={thumb2Ref}\n thumb2Value={thumb2Value}\n thumb2Dragging={!disableSmoothDragging && thumb2Dragging}\n thumb2DragPercentage={thumb2DragPercentage}\n thumb2OnMouseUp={thumb2OnMouseUp}\n thumb2OnMouseDown={thumb2OnMouseDown}\n thumb2OnMouseMove={thumb2OnMouseMove}\n thumb2OnTouchStart={thumb2OnTouchStart}\n thumb2OnTouchMove={thumb2OnTouchMove}\n animate={!disableSmoothDragging && !dragging}\n disabled={disabled}\n vertical={vertical}\n isRangeSlider={isRangeSlider}\n >\n <SliderThumb\n aria-label={thumb1Label as string}\n aria-labelledby={thumb1LabelledBy}\n id={thumb1Id}\n name={thumb1Name}\n {...thumbProps}\n {...minThumbProps}\n {...sharedThumbProps}\n ref={thumb1DraggableRef}\n min={min}\n max={thumb1Max}\n value={thumb1Value}\n index={1}\n active={thumb1Dragging}\n onChange={(event) => {\n setThumb1Value(event.currentTarget.valueAsNumber);\n }}\n onKeyDown={thumb1OnKeyDown}\n />\n {isRangeSlider && (\n <SliderThumb\n aria-label={thumb2Label as string}\n aria-labelledby={thumb2LabelledBy}\n id={thumb2Id}\n name={thumb2Name}\n {...maxThumbProps}\n {...sharedThumbProps}\n ref={thumb2DraggableRef}\n min={thumb2Min}\n max={max}\n value={thumb2Value}\n index={2}\n active={thumb2Dragging}\n onChange={(event) => {\n setThumb2Value(event.currentTarget.valueAsNumber);\n }}\n onKeyDown={thumb2OnKeyDown}\n />\n )}\n {marks && (\n <SliderValueMarks\n min={min}\n max={max}\n step={step}\n marks={marks}\n vertical={vertical}\n thumb1Value={thumb1Value}\n thumb2Value={thumb2Value}\n isRangeSlider={isRangeSlider}\n getMarkProps={getMarkProps}\n getMarkLabelProps={getMarkLabelProps}\n />\n )}\n {children}\n </SliderTrack>\n </SliderContainer>\n );\n}\n"],"names":["useRef","useEnsuredId","identity","SliderContainer","SliderThumb","SliderTrack","SliderValueMarks","getJumpValue","getSliderInputName","useSliderDraggable","emptyString","noop","Slider","props","ariaLabel","ariaLabelledBy","id","propId","name","min","max","step","jump","propJump","vertical","discrete","disabled","getValueText","children","marks","value","setValue","rangeValue","setRangeValue","trackProps","thumbProps","minThumbProps","minThumbLabel","minThumbLabelledBy","maxThumbProps","maxThumbLabel","maxThumbLabelledBy","tooltipProps","containerRef","getMarkProps","getMarkLabelProps","tooltipVisibility","getTooltipProps","getTooltipChildren","disableSmoothDragging","remaining","isRangeSlider","thumb1Id","thumb2Id","thumb1Ref","thumb2Ref","thumb1Name","thumb2Name","thumb1Max","thumb2Min","thumb1Label","thumb1LabelledBy","thumb2Label","thumb2LabelledBy","thumb1Value","thumb2Value","setThumb1Value","setThumb2Value","undefined","valueOrSetter","prevRangeValue","onKeyDown","thumb1OnKeyDown","onMouseUp","thumb1OnMouseUp","onMouseDown","thumb1OnMouseDown","onMouseMove","thumb1OnMouseMove","onTouchStart","thumb1OnTouchStart","onTouchMove","thumb1OnTouchMove","dragPercentage","thumb1DragPercentage","draggableRef","thumb1DraggableRef","dragging","thumb1Dragging","ref","rangeMax","thumb2OnKeyDown","thumb2OnMouseUp","thumb2OnMouseDown","thumb2OnMouseMove","thumb2OnTouchStart","thumb2OnTouchMove","thumb2DragPercentage","thumb2DraggableRef","thumb2Dragging","rangeMin","sharedThumbProps","animate","aria-label","aria-labelledby","index","active","onChange","event","currentTarget","valueAsNumber"],"mappings":"AAAA;;AAEA,SAKEA,MAAM,QACD,QAAQ;AAQf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAAgCC,eAAe,QAAQ,uBAAuB;AAC9E,SAEEC,WAAW,QAGN,mBAAmB;AAC1B,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAEEC,gBAAgB,QACX,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,kBAAkB,QAAQ,mBAAmB;AAGpE,SAASC,kBAAkB,QAAQ,0BAA0B;AAyB7D,MAAMC,cAAc,IAAc;AAClC,MAAMC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BACCmG,cAAYzC;oBACZ0C,mBAAiBzC;oBACjB/C,IAAIqC;oBACJnC,MAAMuC;oBACL,GAAGlB,aAAa;oBAChB,GAAG8D,gBAAgB;oBACpBZ,KAAKS;oBACL/E,KAAKwC;oBACLvC,KAAKA;oBACLU,OAAOmC;oBACPwC,OAAO;oBACPC,QAAQP;oBACRQ,UAAU,CAACC;wBACTzC,eAAeyC,MAAMC,aAAa,CAACC,aAAa;oBAClD;oBACAvC,WAAWoB;;gBAGd9D,uBACC,KAACvB;oBACCa,KAAKA;oBACLC,KAAKA;oBACLC,MAAMA;oBACNQ,OAAOA;oBACPL,UAAUA;oBACVwC,aAAaA;oBACbC,aAAaA;oBACbd,eAAeA;oBACfP,cAAcA;oBACdC,mBAAmBA;;gBAGtBjB;;;;AAIT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/SliderContainer.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactNode, forwardRef } from \"react\";\n\nimport { sliderContainer } from \"./sliderStyles.js\";\n\n/**\n * @since 2.5.0\n * @since 6.0.0 Renamed from `SliderAddons` to `SliderContainerAddonProps`\n */\nexport interface SliderAddonProps {\n /**\n * An optional addon to render before the slider's track. This can be anything\n * and will be wrapped in the `TextIconSpacing` component.\n *\n * When the `vertical` prop is enabled, the addon will appear underneath the\n * track.\n */\n beforeAddon?: ReactNode;\n\n /**\n * An optional addon to render after the slider's track. This can be anything\n * and will be wrapped in the `TextIconSpacing` component.\n *\n * When the `vertical` prop is enabled, the addon will appear above the track.\n */\n afterAddon?: ReactNode;\n}\n\n/**\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Removed the `label` support since you'll generally want to use\n * a `Fieldset` instead.\n */\nexport interface SliderContainerProps\n extends HTMLAttributes<HTMLDivElement>,\n SliderAddonProps {\n vertical: boolean;\n}\n\n/**\n * The `SliderContainer` component is mostly an internal component that is\n * built-in to the `Slider` and `RangeSlider` components to add addons to the\n * left or right of the `SliderTrack`. When vertical, it will add addons to the\n * bottom or top instead.\n *\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Removed the `label` support since you'll generally want to use\n * a `Fieldset` instead.\n */\nexport const SliderContainer = forwardRef<HTMLDivElement, SliderContainerProps>(\n function SliderContainer(props, ref) {\n const {\n className,\n children,\n beforeAddon,\n afterAddon,\n vertical,\n ...remaining\n } = props;\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={sliderContainer({\n className,\n vertical,\n beforeAddon: !!beforeAddon,\n afterAddon: !!afterAddon,\n })}\n >\n {beforeAddon}\n {children}\n {afterAddon}\n </div>\n );\n }\n);\n"],"names":["forwardRef","sliderContainer","SliderContainer","props","ref","className","children","beforeAddon","afterAddon","vertical","remaining","div"],"mappings":";AAAA,SAA8CA,UAAU,QAAQ,QAAQ;AAExE,SAASC,eAAe,QAAQ,oBAAoB;AAqCpD;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,gCAAkBF,WAC7B,SAASE,gBAAgBC,KAAK,EAAEC,GAAG;IACjC,MAAM,EACJC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,QAAQ,EACR,GAAGC,WACJ,GAAGP;IAEJ,qBACE,MAACQ;QACE,GAAGD,SAAS;QACbN,KAAKA;QACLC,WAAWJ,gBAAgB;YACzBI;YACAI;YACAF,aAAa,CAAC,CAACA;YACfC,YAAY,CAAC,CAACA;QAChB;;YAECD;YACAD;YACAE;;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/form/SliderContainer.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactNode, forwardRef } from \"react\";\n\nimport { sliderContainer } from \"./sliderStyles.js\";\n\n/**\n * @since 2.5.0\n * @since 6.0.0 Renamed from `SliderAddons` to `SliderContainerAddonProps`\n */\nexport interface SliderAddonProps {\n /**\n * An optional addon to render before the slider's track. This can be anything\n * and will be wrapped in the `TextIconSpacing` component.\n *\n * When the `vertical` prop is enabled, the addon will appear underneath the\n * track.\n */\n beforeAddon?: ReactNode;\n\n /**\n * An optional addon to render after the slider's track. This can be anything\n * and will be wrapped in the `TextIconSpacing` component.\n *\n * When the `vertical` prop is enabled, the addon will appear above the track.\n */\n afterAddon?: ReactNode;\n}\n\n/**\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Removed the `label` support since you'll generally want to use\n * a `Fieldset` instead.\n */\nexport interface SliderContainerProps\n extends HTMLAttributes<HTMLDivElement>, SliderAddonProps {\n vertical: boolean;\n}\n\n/**\n * The `SliderContainer` component is mostly an internal component that is\n * built-in to the `Slider` and `RangeSlider` components to add addons to the\n * left or right of the `SliderTrack`. When vertical, it will add addons to the\n * bottom or top instead.\n *\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Removed the `label` support since you'll generally want to use\n * a `Fieldset` instead.\n */\nexport const SliderContainer = forwardRef<HTMLDivElement, SliderContainerProps>(\n function SliderContainer(props, ref) {\n const {\n className,\n children,\n beforeAddon,\n afterAddon,\n vertical,\n ...remaining\n } = props;\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={sliderContainer({\n className,\n vertical,\n beforeAddon: !!beforeAddon,\n afterAddon: !!afterAddon,\n })}\n >\n {beforeAddon}\n {children}\n {afterAddon}\n </div>\n );\n }\n);\n"],"names":["forwardRef","sliderContainer","SliderContainer","props","ref","className","children","beforeAddon","afterAddon","vertical","remaining","div"],"mappings":";AAAA,SAA8CA,UAAU,QAAQ,QAAQ;AAExE,SAASC,eAAe,QAAQ,oBAAoB;AAoCpD;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,gCAAkBF,WAC7B,SAASE,gBAAgBC,KAAK,EAAEC,GAAG;IACjC,MAAM,EACJC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,QAAQ,EACR,GAAGC,WACJ,GAAGP;IAEJ,qBACE,MAACQ;QACE,GAAGD,SAAS;QACbN,KAAKA;QACLC,WAAWJ,gBAAgB;YACzBI;YACAI;YACAF,aAAa,CAAC,CAACA;YACfC,YAAY,CAAC,CAACA;QAChB;;YAECD;YACAD;YACAE;;;AAGP,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/SliderThumb.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ChangeEventHandler,\n type HTMLAttributes,\n type ReactNode,\n forwardRef,\n useEffect,\n useState,\n} from \"react\";\n\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { type TooltipProps } from \"../tooltip/Tooltip.js\";\nimport { type LabelRequiredForA11y } from \"../types.js\";\nimport { SliderValueTooltip } from \"./SliderValueTooltip.js\";\nimport { sliderThumb, sliderThumbInput } from \"./sliderStyles.js\";\nimport { type SliderValueOptions } from \"./useSlider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @since 6.0.0\n */\nexport type SliderTooltipVisibility = \"auto\" | \"hover\" | \"always\";\n\n/**\n * @since 2.5.0\n */\nexport interface SliderThumbPresentation {\n /**\n * Boolean if the slider should act as a discrete slider which will render a\n * tooltip above the thumb while dragging to visualize the current value for\n * the slider.\n *\n * @defaultValue `false`\n */\n discrete?: boolean;\n\n /**\n * A function that is used to help with accessibility by creating a better\n * value string if just a number isn't representative enough of your range.\n *\n * Example:\n *\n * ```tsx\n * const [value, controls] = useSlider(0, {\n * // format to be `$100`, etc\n * getValueText: value => `$${value}`,\n * });\n *\n * return <Slider baseId=\"price-slider\" label=\"Price\" {...controls} />;\n * ```\n *\n * @defaultValue `() => \"\"`\n */\n getValueText?: (value: number) => string;\n\n /**\n * Set this to `true` if the slider's thumb position should only update when\n * the user has dragged to the next value instead of with the mouse.\n *\n * @see {@link marks}\n * @defaultValue `!!marks`\n */\n disableSmoothDragging?: boolean;\n\n /**\n * The discrete slider's value tooltip will only become visible when:\n *\n * - `\"auto\"` - the user is dragging with touch/mouse or focused with a keyboard\n * - `\"hover\"` - the behavior of `\"auto\"` plus while hovering the thumb with a mouse\n * - `\"always\"` - ... always\n *\n * This only applies when the {@link discrete} prop is `true`.\n *\n * @defaultValue `\"auto\"`\n */\n tooltipVisibility?: SliderTooltipVisibility;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ConfigurableSliderThumbProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"onChange\"> {\n name?: string;\n}\n\n/**\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Internal only component.\n */\nexport interface SliderThumbProps\n extends ConfigurableSliderThumbProps,\n Required<SliderValueOptions>,\n Required<SliderThumbPresentation> {\n id: string;\n value: number;\n index: 1 | 2;\n active: boolean;\n animate: boolean;\n disabled: boolean;\n vertical: boolean;\n onChange: ChangeEventHandler<HTMLInputElement>;\n tooltipProps?: Partial<TooltipProps>;\n getTooltipProps: (\n value: number,\n isFirstThumb: boolean\n ) => Partial<TooltipProps> | undefined;\n getTooltipChildren: (value: number, isFirstThumb: boolean) => ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Internal only component.\n */\nexport const SliderThumb = forwardRef<\n HTMLSpanElement,\n LabelRequiredForA11y<SliderThumbProps>\n>(function SliderThumb(props, ref) {\n const {\n id,\n min,\n max,\n name,\n value,\n onChange,\n index,\n getValueText,\n step,\n active,\n animate,\n disabled,\n vertical,\n discrete,\n tabIndex = disabled ? -1 : 0,\n className,\n onFocus = noop,\n onKeyDown = noop,\n onMouseEnter = noop,\n onMouseLeave = noop,\n tooltipProps,\n getTooltipProps,\n getTooltipChildren,\n disableSmoothDragging,\n tooltipVisibility = \"auto\",\n ...remaining\n } = props;\n const { \"aria-label\": ariaLabel, \"aria-labelledby\": ariaLabelledBy } = props;\n\n const isFirstThumb = index === 1;\n const mode = useUserInteractionMode();\n const keyboard = mode === \"keyboard\";\n const touch = mode === \"touch\";\n const [mouseVisible, setMouseVisible] = useState(false);\n const [keyboardVisible, setKeyboardVisible] = useState(false);\n useEffect(() => {\n if (disabled || !discrete) {\n setKeyboardVisible(false);\n return;\n }\n\n // if the mode changes away from keyboard, need to disable the keyboard\n // state\n setKeyboardVisible((prevVisible) => prevVisible && mode === \"keyboard\");\n }, [disabled, discrete, mode]);\n useEffect(() => {\n if (disabled || !discrete) {\n setMouseVisible(false);\n return;\n }\n\n setMouseVisible((prevVisible) => prevVisible && mode !== \"touch\");\n }, [disabled, discrete, mode]);\n useEffect(() => {\n if (!keyboardVisible) {\n return;\n }\n\n const callback = (): void => {\n setKeyboardVisible(false);\n };\n\n window.addEventListener(\"blur\", callback, true);\n return () => {\n window.removeEventListener(\"blur\", callback);\n };\n }, [keyboardVisible]);\n\n const classNameOptions = {\n index,\n active,\n animate: !disableSmoothDragging && animate,\n disabled,\n vertical,\n className,\n } as const;\n\n return (\n <>\n {disabled && (\n <span\n className={sliderThumb({\n ...classNameOptions,\n mask: true,\n })}\n />\n )}\n <span\n {...remaining}\n id={id}\n ref={ref}\n role=\"slider\"\n aria-disabled={disabled || undefined}\n aria-orientation={vertical ? \"vertical\" : undefined}\n aria-valuemax={max}\n aria-valuemin={min}\n aria-valuenow={value}\n aria-valuetext={getValueText(value) || undefined}\n tabIndex={tabIndex}\n className={sliderThumb(classNameOptions)}\n onFocus={(event) => {\n onFocus(event);\n\n if (discrete && keyboard) {\n setKeyboardVisible(true);\n }\n }}\n onKeyDown={(event) => {\n onKeyDown(event);\n\n // this allows the tooltip to be visible when switching from mouse to\n // keyboard\n if (discrete && event.key !== \"Tab\") {\n setKeyboardVisible(true);\n }\n }}\n onMouseEnter={(event) => {\n onMouseEnter(event);\n if (discrete && tooltipVisibility === \"hover\" && !touch) {\n setMouseVisible(true);\n }\n }}\n onMouseLeave={(event) => {\n onMouseLeave(event);\n if (discrete && tooltipVisibility === \"hover\" && !touch) {\n setMouseVisible(false);\n }\n }}\n />\n <input\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-hidden\n id={`${id}-value`}\n type=\"range\"\n name={name}\n min={min}\n max={max}\n step={step}\n value={value}\n disabled={disabled}\n tabIndex={-1}\n onChange={onChange}\n className={sliderThumbInput()}\n />\n {discrete && (\n <SliderValueTooltip\n position={vertical ? \"left\" : \"above\"}\n vertical={vertical}\n animate={!disableSmoothDragging && !active}\n visible={\n tooltipVisibility === \"always\" ||\n active ||\n keyboardVisible ||\n mouseVisible\n }\n {...tooltipProps}\n {...getTooltipProps(value, isFirstThumb)}\n index={index}\n >\n {getTooltipChildren(value, isFirstThumb)}\n </SliderValueTooltip>\n )}\n </>\n );\n});\n"],"names":["forwardRef","useEffect","useState","useUserInteractionMode","SliderValueTooltip","sliderThumb","sliderThumbInput","noop","SliderThumb","props","ref","id","min","max","name","value","onChange","index","getValueText","step","active","animate","disabled","vertical","discrete","tabIndex","className","onFocus","onKeyDown","onMouseEnter","onMouseLeave","tooltipProps","getTooltipProps","getTooltipChildren","disableSmoothDragging","tooltipVisibility","remaining","ariaLabel","ariaLabelledBy","isFirstThumb","mode","keyboard","touch","mouseVisible","setMouseVisible","keyboardVisible","setKeyboardVisible","prevVisible","callback","window","addEventListener","removeEventListener","classNameOptions","span","mask","role","aria-disabled","undefined","aria-orientation","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","event","key","input","aria-label","aria-labelledby","aria-hidden","type","position","visible"],"mappings":"AAAA;;AAEA,SAIEA,UAAU,EACVC,SAAS,EACTC,QAAQ,QACH,QAAQ;AAEf,SAASC,sBAAsB,QAAQ,gDAAgD;AAGvF,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,oBAAoB;AAGlE,MAAMC,OAAO;AACX,aAAa;AACf;AA+FA;;;;;;CAMC,GACD,OAAO,MAAMC,4BAAcR,WAGzB,SAASQ,YAAYC,KAAK,EAAEC,GAAG;IAC/B,MAAM,EACJC,EAAE,EACFC,GAAG,EACHC,GAAG,EACHC,IAAI,EACJC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACLC,YAAY,EACZC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,WAAWH,WAAW,CAAC,IAAI,CAAC,E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B,mBAAmBlB,OAAOwB;;;;AAKrC,GAAG"}
1
+ {"version":3,"sources":["../../src/form/SliderThumb.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ChangeEventHandler,\n type HTMLAttributes,\n type ReactNode,\n forwardRef,\n useEffect,\n useState,\n} from \"react\";\n\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { type TooltipProps } from \"../tooltip/Tooltip.js\";\nimport { type LabelRequiredForA11y } from \"../types.js\";\nimport { SliderValueTooltip } from \"./SliderValueTooltip.js\";\nimport { sliderThumb, sliderThumbInput } from \"./sliderStyles.js\";\nimport { type SliderValueOptions } from \"./useSlider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @since 6.0.0\n */\nexport type SliderTooltipVisibility = \"auto\" | \"hover\" | \"always\";\n\n/**\n * @since 2.5.0\n */\nexport interface SliderThumbPresentation {\n /**\n * Boolean if the slider should act as a discrete slider which will render a\n * tooltip above the thumb while dragging to visualize the current value for\n * the slider.\n *\n * @defaultValue `false`\n */\n discrete?: boolean;\n\n /**\n * A function that is used to help with accessibility by creating a better\n * value string if just a number isn't representative enough of your range.\n *\n * Example:\n *\n * ```tsx\n * const [value, controls] = useSlider(0, {\n * // format to be `$100`, etc\n * getValueText: value => `$${value}`,\n * });\n *\n * return <Slider baseId=\"price-slider\" label=\"Price\" {...controls} />;\n * ```\n *\n * @defaultValue `() => \"\"`\n */\n getValueText?: (value: number) => string;\n\n /**\n * Set this to `true` if the slider's thumb position should only update when\n * the user has dragged to the next value instead of with the mouse.\n *\n * @see {@link marks}\n * @defaultValue `!!marks`\n */\n disableSmoothDragging?: boolean;\n\n /**\n * The discrete slider's value tooltip will only become visible when:\n *\n * - `\"auto\"` - the user is dragging with touch/mouse or focused with a keyboard\n * - `\"hover\"` - the behavior of `\"auto\"` plus while hovering the thumb with a mouse\n * - `\"always\"` - ... always\n *\n * This only applies when the {@link discrete} prop is `true`.\n *\n * @defaultValue `\"auto\"`\n */\n tooltipVisibility?: SliderTooltipVisibility;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ConfigurableSliderThumbProps extends Omit<\n HTMLAttributes<HTMLSpanElement>,\n \"onChange\"\n> {\n name?: string;\n}\n\n/**\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Internal only component.\n */\nexport interface SliderThumbProps\n extends\n ConfigurableSliderThumbProps,\n Required<SliderValueOptions>,\n Required<SliderThumbPresentation> {\n id: string;\n value: number;\n index: 1 | 2;\n active: boolean;\n animate: boolean;\n disabled: boolean;\n vertical: boolean;\n onChange: ChangeEventHandler<HTMLInputElement>;\n tooltipProps?: Partial<TooltipProps>;\n getTooltipProps: (\n value: number,\n isFirstThumb: boolean\n ) => Partial<TooltipProps> | undefined;\n getTooltipChildren: (value: number, isFirstThumb: boolean) => ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Internal only component.\n */\nexport const SliderThumb = forwardRef<\n HTMLSpanElement,\n LabelRequiredForA11y<SliderThumbProps>\n>(function SliderThumb(props, ref) {\n const {\n id,\n min,\n max,\n name,\n value,\n onChange,\n index,\n getValueText,\n step,\n active,\n animate,\n disabled,\n vertical,\n discrete,\n tabIndex = disabled ? -1 : 0,\n className,\n onFocus = noop,\n onKeyDown = noop,\n onMouseEnter = noop,\n onMouseLeave = noop,\n tooltipProps,\n getTooltipProps,\n getTooltipChildren,\n disableSmoothDragging,\n tooltipVisibility = \"auto\",\n ...remaining\n } = props;\n const { \"aria-label\": ariaLabel, \"aria-labelledby\": ariaLabelledBy } = props;\n\n const isFirstThumb = index === 1;\n const mode = useUserInteractionMode();\n const keyboard = mode === \"keyboard\";\n const touch = mode === \"touch\";\n const [mouseVisible, setMouseVisible] = useState(false);\n const [keyboardVisible, setKeyboardVisible] = useState(false);\n useEffect(() => {\n if (disabled || !discrete) {\n setKeyboardVisible(false);\n return;\n }\n\n // if the mode changes away from keyboard, need to disable the keyboard\n // state\n setKeyboardVisible((prevVisible) => prevVisible && mode === \"keyboard\");\n }, [disabled, discrete, mode]);\n useEffect(() => {\n if (disabled || !discrete) {\n setMouseVisible(false);\n return;\n }\n\n setMouseVisible((prevVisible) => prevVisible && mode !== \"touch\");\n }, [disabled, discrete, mode]);\n useEffect(() => {\n if (!keyboardVisible) {\n return;\n }\n\n const callback = (): void => {\n setKeyboardVisible(false);\n };\n\n window.addEventListener(\"blur\", callback, true);\n return () => {\n window.removeEventListener(\"blur\", callback);\n };\n }, [keyboardVisible]);\n\n const classNameOptions = {\n index,\n active,\n animate: !disableSmoothDragging && animate,\n disabled,\n vertical,\n className,\n } as const;\n\n return (\n <>\n {disabled && (\n <span\n className={sliderThumb({\n ...classNameOptions,\n mask: true,\n })}\n />\n )}\n <span\n {...remaining}\n id={id}\n ref={ref}\n role=\"slider\"\n aria-disabled={disabled || undefined}\n aria-orientation={vertical ? \"vertical\" : undefined}\n aria-valuemax={max}\n aria-valuemin={min}\n aria-valuenow={value}\n aria-valuetext={getValueText(value) || undefined}\n tabIndex={tabIndex}\n className={sliderThumb(classNameOptions)}\n onFocus={(event) => {\n onFocus(event);\n\n if (discrete && keyboard) {\n setKeyboardVisible(true);\n }\n }}\n onKeyDown={(event) => {\n onKeyDown(event);\n\n // this allows the tooltip to be visible when switching from mouse to\n // keyboard\n if (discrete && event.key !== \"Tab\") {\n setKeyboardVisible(true);\n }\n }}\n onMouseEnter={(event) => {\n onMouseEnter(event);\n if (discrete && tooltipVisibility === \"hover\" && !touch) {\n setMouseVisible(true);\n }\n }}\n onMouseLeave={(event) => {\n onMouseLeave(event);\n if (discrete && tooltipVisibility === \"hover\" && !touch) {\n setMouseVisible(false);\n }\n }}\n />\n <input\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-hidden\n id={`${id}-value`}\n type=\"range\"\n name={name}\n min={min}\n max={max}\n step={step}\n value={value}\n disabled={disabled}\n tabIndex={-1}\n onChange={onChange}\n className={sliderThumbInput()}\n />\n {discrete && (\n <SliderValueTooltip\n position={vertical ? \"left\" : \"above\"}\n vertical={vertical}\n animate={!disableSmoothDragging && !active}\n visible={\n tooltipVisibility === \"always\" ||\n active ||\n keyboardVisible ||\n mouseVisible\n }\n {...tooltipProps}\n {...getTooltipProps(value, isFirstThumb)}\n index={index}\n >\n {getTooltipChildren(value, isFirstThumb)}\n </SliderValueTooltip>\n )}\n </>\n );\n});\n"],"names":["forwardRef","useEffect","useState","useUserInteractionMode","SliderValueTooltip","sliderThumb","sliderThumbInput","noop","SliderThumb","props","ref","id","min","max","name","value","onChange","index","getValueText","step","active","animate","disabled","vertical","discrete","tabIndex","className","onFocus","onKeyDown","onMouseEnter","onMouseLeave","tooltipProps","getTooltipProps","getTooltipChildren","disableSmoothDragging","tooltipVisibility","remaining","ariaLabel","ariaLabelledBy","isFirstThumb","mode","keyboard","touch","mouseVisible","setMouseVisible","keyboardVisible","setKeyboardVisible","prevVisible","callback","window","addEventListener","removeEventListener","classNameOptions","span","mask","role","aria-disabled","undefined","aria-orientation","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","event","key","input","aria-label","aria-labelledby","aria-hidden","type","position","visible"],"mappings":"AAAA;;AAEA,SAIEA,UAAU,EACVC,SAAS,EACTC,QAAQ,QACH,QAAQ;AAEf,SAASC,sBAAsB,QAAQ,gDAAgD;AAGvF,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,oBAAoB;AAGlE,MAAMC,OAAO;AACX,aAAa;AACf;AAkGA;;;;;;CAMC,GACD,OAAO,MAAMC,4BAAcR,WAGzB,SAASQ,YAAYC,KAAK,EAAEC,GAAG;IAC/B,MAAM,EACJC,EAAE,EACFC,GAAG,EACHC,GAAG,EACHC,IAAI,EACJC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACLC,YAAY,EACZC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,WAAWH,WAAW,CAAC,I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AAOA;0BAENgB,mBAAmBlB,OAAOwB;;;;AAKrC,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/SliderTrack.tsx"],"sourcesContent":["import { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { sliderTrack } from \"./sliderStyles.js\";\nimport {\n type ClosestThumbEventHandlersOptions,\n type ThumbOffsetsOptions,\n getClosestThumbEventHandlers,\n getThumbOffsets,\n} from \"./sliderUtils.js\";\n\n/**\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Updated to be internal only.\n */\nexport interface SliderTrackProps\n extends HTMLAttributes<HTMLSpanElement>,\n ClosestThumbEventHandlersOptions,\n ThumbOffsetsOptions {\n animate: boolean;\n disabled: boolean;\n}\n\n/**\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Updated to be internal only.\n */\nexport const SliderTrack = forwardRef<HTMLSpanElement, SliderTrackProps>(\n function SliderTrack(props, ref) {\n const {\n style,\n className,\n animate,\n vertical,\n disabled,\n min,\n max,\n thumb1Ref,\n thumb1Value,\n thumb1Dragging,\n thumb1DragPercentage,\n thumb1OnMouseUp,\n thumb1OnMouseDown,\n thumb1OnMouseMove,\n thumb1OnTouchStart,\n thumb1OnTouchMove,\n thumb2Ref,\n thumb2Value,\n thumb2Dragging,\n thumb2DragPercentage,\n thumb2OnMouseUp,\n thumb2OnMouseDown,\n thumb2OnMouseMove,\n thumb2OnTouchStart,\n thumb2OnTouchMove,\n isRangeSlider,\n children,\n ...remaining\n } = props;\n\n return (\n <span\n {...remaining}\n ref={ref}\n style={{\n ...style,\n ...getThumbOffsets({\n min,\n max,\n thumb1Value,\n thumb1Dragging,\n thumb1DragPercentage,\n thumb2Value,\n thumb2Dragging,\n thumb2DragPercentage,\n isRangeSlider,\n }),\n }}\n className={sliderTrack({\n className,\n animate,\n disabled,\n vertical,\n isRangeSlider,\n })}\n {...getClosestThumbEventHandlers({\n vertical,\n isRangeSlider,\n thumb1Ref,\n thumb1Dragging,\n thumb1OnMouseUp,\n thumb1OnMouseDown,\n thumb1OnMouseMove,\n thumb1OnTouchStart,\n thumb1OnTouchMove,\n thumb2Ref,\n thumb2Dragging,\n thumb2OnMouseUp,\n thumb2OnMouseDown,\n thumb2OnMouseMove,\n thumb2OnTouchStart,\n thumb2OnTouchMove,\n })}\n >\n {children}\n </span>\n );\n }\n);\n"],"names":["forwardRef","sliderTrack","getClosestThumbEventHandlers","getThumbOffsets","SliderTrack","props","ref","style","className","animate","vertical","disabled","min","max","thumb1Ref","thumb1Value","thumb1Dragging","thumb1DragPercentage","thumb1OnMouseUp","thumb1OnMouseDown","thumb1OnMouseMove","thumb1OnTouchStart","thumb1OnTouchMove","thumb2Ref","thumb2Value","thumb2Dragging","thumb2DragPercentage","thumb2OnMouseUp","thumb2OnMouseDown","thumb2OnMouseMove","thumb2OnTouchStart","thumb2OnTouchMove","isRangeSlider","children","remaining","span"],"mappings":";AAAA,SAA8BA,UAAU,QAAQ,QAAQ;AAExD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAGEC,4BAA4B,EAC5BC,eAAe,QACV,mBAAmB;AAe1B;;;;CAIC,GACD,OAAO,MAAMC,4BAAcJ,WACzB,SAASI,YAAYC,KAAK,EAAEC,GAAG;IAC7B,MAAM,EACJC,KAAK,EACLC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,GAAG,EACHC,GAAG,EACHC,SAAS,EACTC,WAAW,EACXC,cAAc,EACdC,oBAAoB,EACpBC,eAAe,EACfC,iBAAiB,EACjBC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,EACjBC,SAAS,EACTC,WAAW,EACXC,cAAc,EACdC,oBAAoB,EACpBC,eAAe,EACfC,iBAAiB,EACjBC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,EACjBC,aAAa,EACbC,QAAQ,EACR,GAAGC,WACJ,GAAG7B;IAEJ,qBACE,KAAC8B;QACE,GAAGD,SAAS;QACb5B,KAAKA;QACLC,OAAO;YACL,GAAGA,KAAK;YACR,GAAGJ,gBAAgB;gBACjBS;gBACAC;gBACAE;gBACAC;gBACAC;gBACAO;gBACAC;gBACAC;gBACAM;YACF,EAAE;QACJ;QACAxB,WAAWP,YAAY;YACrBO;YACAC;YACAE;YACAD;YACAsB;QACF;QACC,GAAG9B,6BAA6B;YAC/BQ;YACAsB;YACAlB;YACAE;YACAE;YACAC;YACAC;YACAC;YACAC;YACAC;YACAE;YACAE;YACAC;YACAC;YACAC;YACAC;QACF,EAAE;kBAEDE;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/form/SliderTrack.tsx"],"sourcesContent":["import { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { sliderTrack } from \"./sliderStyles.js\";\nimport {\n type ClosestThumbEventHandlersOptions,\n type ThumbOffsetsOptions,\n getClosestThumbEventHandlers,\n getThumbOffsets,\n} from \"./sliderUtils.js\";\n\n/**\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Updated to be internal only.\n */\nexport interface SliderTrackProps\n extends\n HTMLAttributes<HTMLSpanElement>,\n ClosestThumbEventHandlersOptions,\n ThumbOffsetsOptions {\n animate: boolean;\n disabled: boolean;\n}\n\n/**\n * @internal\n * @since 2.5.0\n * @since 6.0.0 Updated to be internal only.\n */\nexport const SliderTrack = forwardRef<HTMLSpanElement, SliderTrackProps>(\n function SliderTrack(props, ref) {\n const {\n style,\n className,\n animate,\n vertical,\n disabled,\n min,\n max,\n thumb1Ref,\n thumb1Value,\n thumb1Dragging,\n thumb1DragPercentage,\n thumb1OnMouseUp,\n thumb1OnMouseDown,\n thumb1OnMouseMove,\n thumb1OnTouchStart,\n thumb1OnTouchMove,\n thumb2Ref,\n thumb2Value,\n thumb2Dragging,\n thumb2DragPercentage,\n thumb2OnMouseUp,\n thumb2OnMouseDown,\n thumb2OnMouseMove,\n thumb2OnTouchStart,\n thumb2OnTouchMove,\n isRangeSlider,\n children,\n ...remaining\n } = props;\n\n return (\n <span\n {...remaining}\n ref={ref}\n style={{\n ...style,\n ...getThumbOffsets({\n min,\n max,\n thumb1Value,\n thumb1Dragging,\n thumb1DragPercentage,\n thumb2Value,\n thumb2Dragging,\n thumb2DragPercentage,\n isRangeSlider,\n }),\n }}\n className={sliderTrack({\n className,\n animate,\n disabled,\n vertical,\n isRangeSlider,\n })}\n {...getClosestThumbEventHandlers({\n vertical,\n isRangeSlider,\n thumb1Ref,\n thumb1Dragging,\n thumb1OnMouseUp,\n thumb1OnMouseDown,\n thumb1OnMouseMove,\n thumb1OnTouchStart,\n thumb1OnTouchMove,\n thumb2Ref,\n thumb2Dragging,\n thumb2OnMouseUp,\n thumb2OnMouseDown,\n thumb2OnMouseMove,\n thumb2OnTouchStart,\n thumb2OnTouchMove,\n })}\n >\n {children}\n </span>\n );\n }\n);\n"],"names":["forwardRef","sliderTrack","getClosestThumbEventHandlers","getThumbOffsets","SliderTrack","props","ref","style","className","animate","vertical","disabled","min","max","thumb1Ref","thumb1Value","thumb1Dragging","thumb1DragPercentage","thumb1OnMouseUp","thumb1OnMouseDown","thumb1OnMouseMove","thumb1OnTouchStart","thumb1OnTouchMove","thumb2Ref","thumb2Value","thumb2Dragging","thumb2DragPercentage","thumb2OnMouseUp","thumb2OnMouseDown","thumb2OnMouseMove","thumb2OnTouchStart","thumb2OnTouchMove","isRangeSlider","children","remaining","span"],"mappings":";AAAA,SAA8BA,UAAU,QAAQ,QAAQ;AAExD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAGEC,4BAA4B,EAC5BC,eAAe,QACV,mBAAmB;AAgB1B;;;;CAIC,GACD,OAAO,MAAMC,4BAAcJ,WACzB,SAASI,YAAYC,KAAK,EAAEC,GAAG;IAC7B,MAAM,EACJC,KAAK,EACLC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,GAAG,EACHC,GAAG,EACHC,SAAS,EACTC,WAAW,EACXC,cAAc,EACdC,oBAAoB,EACpBC,eAAe,EACfC,iBAAiB,EACjBC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,EACjBC,SAAS,EACTC,WAAW,EACXC,cAAc,EACdC,oBAAoB,EACpBC,eAAe,EACfC,iBAAiB,EACjBC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,EACjBC,aAAa,EACbC,QAAQ,EACR,GAAGC,WACJ,GAAG7B;IAEJ,qBACE,KAAC8B;QACE,GAAGD,SAAS;QACb5B,KAAKA;QACLC,OAAO;YACL,GAAGA,KAAK;YACR,GAAGJ,gBAAgB;gBACjBS;gBACAC;gBACAE;gBACAC;gBACAC;gBACAO;gBACAC;gBACAC;gBACAM;YACF,EAAE;QACJ;QACAxB,WAAWP,YAAY;YACrBO;YACAC;YACAE;YACAD;YACAsB;QACF;QACC,GAAG9B,6BAA6B;YAC/BQ;YACAsB;YACAlB;YACAE;YACAE;YACAC;YACAC;YACAC;YACAC;YACAC;YACAE;YACAE;YACAC;YACAC;YACAC;YACAC;QACF,EAAE;kBAEDE;;AAGP,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/SliderValueMarks.tsx"],"sourcesContent":["import {\n Fragment,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from \"react\";\n\nimport { getPercentage } from \"../utils/getPercentage.js\";\nimport {\n type RangeStepsOptions,\n getRangeSteps,\n} from \"../utils/getRangeSteps.js\";\nimport { SliderMark } from \"./SliderMark.js\";\nimport {\n type CustomizableSliderMarkLabelProps,\n SliderMarkLabel,\n} from \"./SliderMarkLabel.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface SliderValueMark {\n /**\n * An optional label to display alongside the current mark. This will be\n * positioned below the mark for horizontal sliders and to the right for\n * vertical sliders.\n */\n label?: ReactNode;\n\n /**\n * The value of the mark that should be a valid step within the slider.\n */\n value: number;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface SliderValueMarkState {\n /** The {@link SliderValueMark.value} */\n value: number;\n\n /**\n * No idea if this is actually useful (maybe custom styles?), but it is the\n * current percentage the mark is offset and is what is set as the\n * `left`/`top` values for the mark.\n */\n offset: string;\n\n /**\n * This will be `true` when the mark is being covered by the slider track's\n * active state.\n */\n active: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface SliderMarksOptions {\n /**\n * Set this to `true` to display a mark for each step within the slider. This\n * can be used alongside the {@link getMarkProps} and\n * {@link getMarkLabelProps} to customize the styles or display a label for\n * the mark.\n *\n * @example Custom Marks\n * ```tsx\n * const slider = useSlider({ step: 10 });\n *\n * <Slider\n * {...slider}\n * marks={[\n * { value: 0, label: \"Minimum\" },\n * { value: 10 },\n * { value: 20 },\n * { value: 30 },\n * { value: 40 },\n * { value: 50, label: \"Medium\" },\n * { value: 60 },\n * { value: 70 },\n * { value: 80 },\n * { value: 90 },\n * { value: 100, label: \"Maximum\" },\n * ]}\n * />\n * ```\n */\n marks?: boolean | readonly SliderValueMark[];\n\n /**\n * This can be used to override any styles for the specific mark.\n */\n getMarkProps?: (\n options: SliderValueMarkState\n ) => HTMLAttributes<HTMLSpanElement> | undefined;\n\n /**\n * This can be used to override any styles for a specific mark's label or\n * display a label dynamically.\n *\n * @example Dynamic Labels\n * ```tsx\n * <Slider\n * {...slider}\n * marks\n * getMarkLabelProps={({ active, value }) => {\n * if (value % 10 !== 0) {\n * return;\n * }\n *\n * return {\n * children: `${value} degrees`,\n * className: cnb(active && styles.somethingCustom),\n * };\n * }}\n * />\n * ```\n */\n getMarkLabelProps?: (\n options: SliderValueMarkState\n ) => Partial<CustomizableSliderMarkLabelProps> | undefined;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport interface SliderValueMarksProps\n extends RangeStepsOptions,\n Required<SliderMarksOptions> {\n vertical: boolean;\n thumb1Value: number;\n thumb2Value: number;\n isRangeSlider: boolean;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport function SliderValueMarks(props: SliderValueMarksProps): ReactElement {\n const {\n min,\n max,\n step,\n marks: propMarks,\n vertical,\n thumb1Value,\n thumb2Value,\n isRangeSlider,\n getMarkProps,\n getMarkLabelProps,\n } = props;\n\n let marks: readonly SliderValueMark[];\n if (typeof propMarks === \"boolean\") {\n const steps = getRangeSteps({ min, max, step }) + 1;\n marks = Array.from({ length: steps }, (_, i) => ({\n value: min + i * step,\n }));\n } else {\n marks = propMarks;\n }\n\n return (\n <>\n {marks.map(({ value, label: markLabel }) => {\n // I can't think of a good name, but this is when the slider's track's\n // active color is covering the mark which requires different styles\n let active: boolean;\n let percentage = getPercentage({ min, max, value }) * 100;\n let markValue = value;\n if (vertical) {\n // need to reverse the percentage since it uses `top` for positioning\n // where the max value is at the top instead of bottom\n percentage = 100 - percentage;\n\n // need to reverse the mark's value as well for the same reason as\n // above\n markValue = max - value;\n }\n\n if (isRangeSlider) {\n active = markValue > thumb1Value && markValue < thumb2Value;\n } else {\n active = markValue < thumb1Value;\n }\n\n const offset = `${percentage}%`;\n const markProps = getMarkProps({ value, active, offset });\n const labelProps = getMarkLabelProps({ value, active, offset });\n const label = markLabel ?? labelProps?.children ?? null;\n\n return (\n <Fragment key={value}>\n <SliderMark\n {...markProps}\n offset={offset}\n active={active}\n vertical={vertical}\n />\n {label !== null && (\n <SliderMarkLabel\n {...labelProps}\n offset={offset}\n vertical={vertical}\n >\n {label}\n </SliderMarkLabel>\n )}\n </Fragment>\n );\n })}\n </>\n );\n}\n"],"names":["Fragment","getPercentage","getRangeSteps","SliderMark","SliderMarkLabel","SliderValueMarks","props","min","max","step","marks","propMarks","vertical","thumb1Value","thumb2Value","isRangeSlider","getMarkProps","getMarkLabelProps","steps","Array","from","length","_","i","value","map","label","markLabel","active","percentage","markValue","offset","markProps","labelProps","children"],"mappings":";AAAA,SACEA,QAAQ,QAIH,QAAQ;AAEf,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAEEC,aAAa,QACR,4BAA4B;AACnC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAEEC,eAAe,QACV,uBAAuB;AAyH9B;;;CAGC,GACD,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAC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UAAUA;kCAETc;;;eAbQF;QAkBnB;;AAGN"}
1
+ {"version":3,"sources":["../../src/form/SliderValueMarks.tsx"],"sourcesContent":["import {\n Fragment,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from \"react\";\n\nimport { getPercentage } from \"../utils/getPercentage.js\";\nimport {\n type RangeStepsOptions,\n getRangeSteps,\n} from \"../utils/getRangeSteps.js\";\nimport { SliderMark } from \"./SliderMark.js\";\nimport {\n type CustomizableSliderMarkLabelProps,\n SliderMarkLabel,\n} from \"./SliderMarkLabel.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface SliderValueMark {\n /**\n * An optional label to display alongside the current mark. This will be\n * positioned below the mark for horizontal sliders and to the right for\n * vertical sliders.\n */\n label?: ReactNode;\n\n /**\n * The value of the mark that should be a valid step within the slider.\n */\n value: number;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface SliderValueMarkState {\n /** The {@link SliderValueMark.value} */\n value: number;\n\n /**\n * No idea if this is actually useful (maybe custom styles?), but it is the\n * current percentage the mark is offset and is what is set as the\n * `left`/`top` values for the mark.\n */\n offset: string;\n\n /**\n * This will be `true` when the mark is being covered by the slider track's\n * active state.\n */\n active: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface SliderMarksOptions {\n /**\n * Set this to `true` to display a mark for each step within the slider. This\n * can be used alongside the {@link getMarkProps} and\n * {@link getMarkLabelProps} to customize the styles or display a label for\n * the mark.\n *\n * @example Custom Marks\n * ```tsx\n * const slider = useSlider({ step: 10 });\n *\n * <Slider\n * {...slider}\n * marks={[\n * { value: 0, label: \"Minimum\" },\n * { value: 10 },\n * { value: 20 },\n * { value: 30 },\n * { value: 40 },\n * { value: 50, label: \"Medium\" },\n * { value: 60 },\n * { value: 70 },\n * { value: 80 },\n * { value: 90 },\n * { value: 100, label: \"Maximum\" },\n * ]}\n * />\n * ```\n */\n marks?: boolean | readonly SliderValueMark[];\n\n /**\n * This can be used to override any styles for the specific mark.\n */\n getMarkProps?: (\n options: SliderValueMarkState\n ) => HTMLAttributes<HTMLSpanElement> | undefined;\n\n /**\n * This can be used to override any styles for a specific mark's label or\n * display a label dynamically.\n *\n * @example Dynamic Labels\n * ```tsx\n * <Slider\n * {...slider}\n * marks\n * getMarkLabelProps={({ active, value }) => {\n * if (value % 10 !== 0) {\n * return;\n * }\n *\n * return {\n * children: `${value} degrees`,\n * className: cnb(active && styles.somethingCustom),\n * };\n * }}\n * />\n * ```\n */\n getMarkLabelProps?: (\n options: SliderValueMarkState\n ) => Partial<CustomizableSliderMarkLabelProps> | undefined;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport interface SliderValueMarksProps\n extends RangeStepsOptions, Required<SliderMarksOptions> {\n vertical: boolean;\n thumb1Value: number;\n thumb2Value: number;\n isRangeSlider: boolean;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport function SliderValueMarks(props: SliderValueMarksProps): ReactElement {\n const {\n min,\n max,\n step,\n marks: propMarks,\n vertical,\n thumb1Value,\n thumb2Value,\n isRangeSlider,\n getMarkProps,\n getMarkLabelProps,\n } = props;\n\n let marks: readonly SliderValueMark[];\n if (typeof propMarks === \"boolean\") {\n const steps = getRangeSteps({ min, max, step }) + 1;\n marks = Array.from({ length: steps }, (_, i) => ({\n value: min + i * step,\n }));\n } else {\n marks = propMarks;\n }\n\n return (\n <>\n {marks.map(({ value, label: markLabel }) => {\n // I can't think of a good name, but this is when the slider's track's\n // active color is covering the mark which requires different styles\n let active: boolean;\n let percentage = getPercentage({ min, max, value }) * 100;\n let markValue = value;\n if (vertical) {\n // need to reverse the percentage since it uses `top` for positioning\n // where the max value is at the top instead of bottom\n percentage = 100 - percentage;\n\n // need to reverse the mark's value as well for the same reason as\n // above\n markValue = max - value;\n }\n\n if (isRangeSlider) {\n active = markValue > thumb1Value && markValue < thumb2Value;\n } else {\n active = markValue < thumb1Value;\n }\n\n const offset = `${percentage}%`;\n const markProps = getMarkProps({ value, active, offset });\n const labelProps = getMarkLabelProps({ value, active, offset });\n const label = markLabel ?? labelProps?.children ?? null;\n\n return (\n <Fragment key={value}>\n <SliderMark\n {...markProps}\n offset={offset}\n active={active}\n vertical={vertical}\n />\n {label !== null && (\n <SliderMarkLabel\n {...labelProps}\n offset={offset}\n vertical={vertical}\n >\n {label}\n </SliderMarkLabel>\n )}\n </Fragment>\n );\n })}\n </>\n );\n}\n"],"names":["Fragment","getPercentage","getRangeSteps","SliderMark","SliderMarkLabel","SliderValueMarks","props","min","max","step","marks","propMarks","vertical","thumb1Value","thumb2Value","isRangeSlider","getMarkProps","getMarkLabelProps","steps","Array","from","length","_","i","value","map","label","markLabel","active","percentage","markValue","offset","markProps","labelProps","children"],"mappings":";AAAA,SACEA,QAAQ,QAIH,QAAQ;AAEf,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAEEC,aAAa,QACR,4BAA4B;AACnC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAEEC,eAAe,QACV,uBAAuB;AAwH9B;;;CAGC,GACD,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EACJC,GAAG,EACHC,GAAG,EACHC,IAAI,EACJC,OAAOC,SAAS,EAChBC,QAAQ,EACRC,WAAW,EACXC,WAAW,EACXC,aAAa,EACbC,YAAY,EACZC,iBAAiB,EAClB,GAAGX;IAEJ,IAAII;IACJ,IAAI,OAAOC,cAAc,WAAW;QAClC,MAAMO,QAAQhB,cAAc;YAAEK;YAAKC;YAAKC;QAAK,KAAK;QAClDC,QAAQS,MAAMC,IAAI,CAAC;YAAEC,QAAQH;QAAM,GAAG,CAACI,GAAGC,IAAO,CAAA;gBAC/CC,OAAOjB,MAAMgB,IAAId;YACnB,CAAA;IACF,OAAO;QACLC,QAAQC;IACV;IAEA,qBACE;kBACGD,MAAMe,GAAG,CAAC,CAAC,EAAED,KAAK,EAAEE,OAAOC,SAAS,EAAE;YACrC,sEAAsE;YACtE,oEAAoE;YACpE,IAAIC;YACJ,IAAIC,aAAa5B,cAAc;gBAAEM;gBAAKC;gBAAKgB;YAAM,KAAK;YACtD,IAAIM,YAAYN;YAChB,IAAIZ,UAAU;gBACZ,qEAAqE;gBACrE,sDAAsD;gBACtDiB,aAAa,MAAMA;gBAEnB,kEAAkE;gBAClE,QAAQ;gBACRC,YAAYtB,MAAMgB;YACpB;YAEA,IAAIT,eAAe;gBACjBa,SAASE,YAAYjB,eAAeiB,YAAYhB;YAClD,OAAO;gBACLc,SAASE,YAAYjB;YACvB;YAEA,MAAMkB,SAAS,GAAGF,WAAW,CAAC,CAAC;YAC/B,MAAMG,YAAYhB,aAAa;gBAAEQ;gBAAOI;gBAAQG;YAAO;YACvD,MAAME,aAAahB,kBAAkB;gBAAEO;gBAAOI;gBAAQG;YAAO;YAC7D,MAAML,QAAQC,aAAaM,YAAYC,YAAY;YAEnD,qBACE,MAAClC;;kCACC,KAACG;wBACE,GAAG6B,SAAS;wBACbD,QAAQA;wBACRH,QAAQA;wBACRhB,UAAUA;;oBAEXc,UAAU,sBACT,KAACtB;wBACE,GAAG6B,UAAU;wBACdF,QAAQA;wBACRnB,UAAUA;kCAETc;;;eAbQF;QAkBnB;;AAGN"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/Switch.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { type InputToggleLabelProps } from \"./InputToggle.js\";\nimport { Label } from \"./Label.js\";\nimport { SwitchTrack } from \"./SwitchTrack.js\";\nimport { switchStyles } from \"./switchStyles.js\";\nimport {\n type FormComponentStates,\n type FormMessageContainerExtension,\n} from \"./types.js\";\n\n// NOTE: The augmentation appears in this file since no type definitions are\n// ever imported from the `switchStyles` file.\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-switch-track-background-color\"?: string;\n \"--rmd-switch-ball-background-color\"?: string;\n }\n}\n\n/**\n * @since 6.0.0 Added `containerProps` and support for the\n * `FormMessage` behavior.\n */\nexport interface SwitchProps\n extends InputHTMLAttributes<HTMLInputElement>,\n InputToggleLabelProps,\n FormMessageContainerExtension,\n FormComponentStates {\n containerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n trackProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n trackStyle?: CSSProperties;\n trackClassName?: string;\n ballAddon?: ReactNode;\n ballProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;\n ballStyle?: CSSProperties;\n ballClassName?: string;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * import { Form } from \"@react-md/core/form/Form\";\n * import { Switch } from \"@react-md/core/form/Switch\";\n * import type { ReactElement } from \"react\";\n * import { useState } from \"react\";\n *\n * function Example(): ReactElement {\n * const [checked, setChecked] = useState(false);\n *\n * return (\n * <Form>\n * <Switch\n * label=\"Label\"\n * name=\"enabled\"\n * checked={checked}\n * onChange={(event) => setChecked(event.currentTarget.checked)}\n * />\n * </Form>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/switch | Switch Demos}\n * @since 6.0.0 Added support for `FormMessage` behavior.\n */\nexport const Switch = forwardRef<HTMLInputElement, SwitchProps>(\n function Switch(props, ref) {\n const {\n id: propId,\n label,\n labelProps,\n style,\n className,\n containerProps,\n ballProps,\n ballStyle,\n ballClassName,\n ballAddon,\n trackProps,\n trackStyle,\n trackClassName,\n messageProps,\n messageContainerProps,\n disableLabelGap = false,\n error = false,\n active = false,\n stacked = false,\n iconAfter = false,\n disabled = false,\n readOnly = false,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"switch\");\n\n return (\n <FormMessageContainer\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <Label\n style={style}\n {...labelProps}\n className={cnb(className, labelProps?.className)}\n gap={!disableLabelGap}\n stacked={stacked}\n reversed={!iconAfter}\n active={active}\n error={error}\n disabled={disabled}\n >\n {label}\n <div\n {...containerProps}\n className={switchStyles({\n clickable: !disabled && !readOnly,\n className: containerProps?.className,\n currentColor: active || error,\n })}\n >\n <SwitchTrack\n style={trackStyle}\n {...trackProps}\n className={cnb(trackClassName, trackProps?.className)}\n disabled={disabled}\n ballAddon={ballAddon}\n ballProps={ballProps}\n ballStyle={ballStyle}\n ballClassName={ballClassName}\n >\n <input\n {...remaining}\n id={id}\n ref={ref}\n role=\"switch\"\n type=\"checkbox\"\n className={cnb(\n \"rmd-switch__input rmd-hidden-input\",\n disabled && \"rmd-hidden-input--disabled\"\n )}\n disabled={disabled}\n />\n </SwitchTrack>\n </div>\n </Label>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["cnb","forwardRef","useEnsuredId","FormMessageContainer","Label","SwitchTrack","switchStyles","Switch","props","ref","id","propId","label","labelProps","style","className","containerProps","ballProps","ballStyle","ballClassName","ballAddon","trackProps","trackStyle","trackClassName","messageProps","messageContainerProps","disableLabelGap","error","active","stacked","iconAfter","disabled","readOnly","remaining","gap","reversed","div","clickable","currentColor","input","role","type"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAKEC,UAAU,QACL,QAAQ;AAGf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,4BAA4B;AAEjE,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,YAAY,QAAQ,oBAAoB;AAkCjD;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BC,GACD,OAAO,MAAMC,uBAASN,WACpB,SAASM,OAAOC,KAAK,EAAEC,GAAG;IACxB,MAAM,EACJC,IAAIC,MAAM,EACVC,KAAK,EACLC,UAAU,EACVC,KAAK,EACLC,SAAS,EACTC,cAAc,EACdC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,cAAc,EACdC,YAAY,EACZC,qBAAqB,EACrBC,kBAAkB,KAAK,EACvBC,QAAQ,KAAK,EACbC,SAAS,KAAK,EACdC,UAAU,KAAK,EACfC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,WAAW,KAAK,EAChB,GAAGC,WACJ,GAAGzB;IACJ,MAAME,KAAKR,aAAaS,QAAQ;IAEhC,qBACE,KAACR;QACE,GAAGsB,qBAAqB;QACzBD,cAAcA;kBAEd,cAAA,MAACpB;YACCU,OAAOA;YACN,GAAGD,UAAU;YACdE,WAAWf,IAAIe,WAAWF,YAAYE;YACtCmB,KAAK,CAACR;YACNG,SAASA;YACTM,UAAU,CAACL;YACXF,QAAQA;YACRD,OAAOA;YACPI,UAAUA;;gBAETnB;8BACD,KAACwB;oBACE,GAAGpB,cAAc;oBAClBD,WAAWT,aAAa;wBACtB+B,WAAW,CAACN,YAAY,CAACC;wBACzBjB,WAAWC,gBAAgBD;wBAC3BuB,cAAcV,UAAUD;oBAC1B;8BAEA,cAAA,KAACtB;wBACCS,OAAOQ;wBACN,GAAGD,UAAU;wBACdN,WAAWf,IAAIuB,gBAAgBF,YAAYN;wBAC3CgB,UAAUA;wBACVX,WAAWA;wBACXH,WAAWA;wBACXC,WAAWA;wBACXC,eAAeA;kCAEf,cAAA,KAACoB;4BACE,GAAGN,SAAS;4BACbvB,IAAIA;4BACJD,KAAKA;4BACL+B,MAAK;4BACLC,MAAK;4BACL1B,WAAWf,IACT,sCACA+B,YAAY;4BAEdA,UAAUA;;;;;;;AAOxB,GACA"}
1
+ {"version":3,"sources":["../../src/form/Switch.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { type InputToggleLabelProps } from \"./InputToggle.js\";\nimport { Label } from \"./Label.js\";\nimport { SwitchTrack } from \"./SwitchTrack.js\";\nimport { switchStyles } from \"./switchStyles.js\";\nimport {\n type FormComponentStates,\n type FormMessageContainerExtension,\n} from \"./types.js\";\n\n// NOTE: The augmentation appears in this file since no type definitions are\n// ever imported from the `switchStyles` file.\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-switch-track-background-color\"?: string;\n \"--rmd-switch-ball-background-color\"?: string;\n }\n}\n\n/**\n * @since 6.0.0 Added `containerProps` and support for the\n * `FormMessage` behavior.\n */\nexport interface SwitchProps\n extends\n InputHTMLAttributes<HTMLInputElement>,\n InputToggleLabelProps,\n FormMessageContainerExtension,\n FormComponentStates {\n containerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n trackProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n trackStyle?: CSSProperties;\n trackClassName?: string;\n ballAddon?: ReactNode;\n ballProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;\n ballStyle?: CSSProperties;\n ballClassName?: string;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * import { Form } from \"@react-md/core/form/Form\";\n * import { Switch } from \"@react-md/core/form/Switch\";\n * import type { ReactElement } from \"react\";\n * import { useState } from \"react\";\n *\n * function Example(): ReactElement {\n * const [checked, setChecked] = useState(false);\n *\n * return (\n * <Form>\n * <Switch\n * label=\"Label\"\n * name=\"enabled\"\n * checked={checked}\n * onChange={(event) => setChecked(event.currentTarget.checked)}\n * />\n * </Form>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/switch | Switch Demos}\n * @since 6.0.0 Added support for `FormMessage` behavior.\n */\nexport const Switch = forwardRef<HTMLInputElement, SwitchProps>(\n function Switch(props, ref) {\n const {\n id: propId,\n label,\n labelProps,\n style,\n className,\n containerProps,\n ballProps,\n ballStyle,\n ballClassName,\n ballAddon,\n trackProps,\n trackStyle,\n trackClassName,\n messageProps,\n messageContainerProps,\n disableLabelGap = false,\n error = false,\n active = false,\n stacked = false,\n iconAfter = false,\n disabled = false,\n readOnly = false,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"switch\");\n\n return (\n <FormMessageContainer\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <Label\n style={style}\n {...labelProps}\n className={cnb(className, labelProps?.className)}\n gap={!disableLabelGap}\n stacked={stacked}\n reversed={!iconAfter}\n active={active}\n error={error}\n disabled={disabled}\n >\n {label}\n <div\n {...containerProps}\n className={switchStyles({\n clickable: !disabled && !readOnly,\n className: containerProps?.className,\n currentColor: active || error,\n })}\n >\n <SwitchTrack\n style={trackStyle}\n {...trackProps}\n className={cnb(trackClassName, trackProps?.className)}\n disabled={disabled}\n ballAddon={ballAddon}\n ballProps={ballProps}\n ballStyle={ballStyle}\n ballClassName={ballClassName}\n >\n <input\n {...remaining}\n id={id}\n ref={ref}\n role=\"switch\"\n type=\"checkbox\"\n className={cnb(\n \"rmd-switch__input rmd-hidden-input\",\n disabled && \"rmd-hidden-input--disabled\"\n )}\n disabled={disabled}\n />\n </SwitchTrack>\n </div>\n </Label>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["cnb","forwardRef","useEnsuredId","FormMessageContainer","Label","SwitchTrack","switchStyles","Switch","props","ref","id","propId","label","labelProps","style","className","containerProps","ballProps","ballStyle","ballClassName","ballAddon","trackProps","trackStyle","trackClassName","messageProps","messageContainerProps","disableLabelGap","error","active","stacked","iconAfter","disabled","readOnly","remaining","gap","reversed","div","clickable","currentColor","input","role","type"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAKEC,UAAU,QACL,QAAQ;AAGf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,4BAA4B;AAEjE,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,YAAY,QAAQ,oBAAoB;AAmCjD;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BC,GACD,OAAO,MAAMC,uBAASN,WACpB,SAASM,OAAOC,KAAK,EAAEC,GAAG;IACxB,MAAM,EACJC,IAAIC,MAAM,EACVC,KAAK,EACLC,UAAU,EACVC,KAAK,EACLC,SAAS,EACTC,cAAc,EACdC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,cAAc,EACdC,YAAY,EACZC,qBAAqB,EACrBC,kBAAkB,KAAK,EACvBC,QAAQ,KAAK,EACbC,SAAS,KAAK,EACdC,UAAU,KAAK,EACfC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,WAAW,KAAK,EAChB,GAAGC,WACJ,GAAGzB;IACJ,MAAME,KAAKR,aAAaS,QAAQ;IAEhC,qBACE,KAACR;QACE,GAAGsB,qBAAqB;QACzBD,cAAcA;kBAEd,cAAA,MAACpB;YACCU,OAAOA;YACN,GAAGD,UAAU;YACdE,WAAWf,IAAIe,WAAWF,YAAYE;YACtCmB,KAAK,CAACR;YACNG,SAASA;YACTM,UAAU,CAACL;YACXF,QAAQA;YACRD,OAAOA;YACPI,UAAUA;;gBAETnB;8BACD,KAACwB;oBACE,GAAGpB,cAAc;oBAClBD,WAAWT,aAAa;wBACtB+B,WAAW,CAACN,YAAY,CAACC;wBACzBjB,WAAWC,gBAAgBD;wBAC3BuB,cAAcV,UAAUD;oBAC1B;8BAEA,cAAA,KAACtB;wBACCS,OAAOQ;wBACN,GAAGD,UAAU;wBACdN,WAAWf,IAAIuB,gBAAgBF,YAAYN;wBAC3CgB,UAAUA;wBACVX,WAAWA;wBACXH,WAAWA;wBACXC,WAAWA;wBACXC,eAAeA;kCAEf,cAAA,KAACoB;4BACE,GAAGN,SAAS;4BACbvB,IAAIA;4BACJD,KAAKA;4BACL+B,MAAK;4BACLC,MAAK;4BACL1B,WAAWf,IACT,sCACA+B,YAAY;4BAEdA,UAAUA;;;;;;;AAOxB,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/TextArea.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n type HTMLAttributes,\n type TextareaHTMLAttributes,\n forwardRef,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { Label } from \"./Label.js\";\nimport { ResizingTextAreaWrapper } from \"./ResizingTextAreaWrapper.js\";\nimport { TextFieldContainer } from \"./TextFieldContainer.js\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { textArea, textAreaContainer } from \"./textAreaStyles.js\";\nimport { type FormFieldOptions } from \"./types.js\";\nimport {\n type TextAreaResize,\n useResizingTextArea,\n} from \"./useResizingTextArea.js\";\n\n// NOTE: The augmentation appears in this file since no type definitions are\n// ever imported from the `textAreaStylesStyles` file.\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-text-area-height\"?: string | number;\n \"--rmd-text-area-padding\"?: string | number;\n }\n}\n\n/**\n * @since 6.0.0 Added `containerProps`.\n */\nexport interface TextAreaProps\n extends FormFieldOptions,\n TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** @defaultValue `\"text-area-\" + useId()` */\n id?: string;\n\n /**\n * Optional placeholder text to display in the text field.\n *\n * @defaultValue `label ? \" \" : \"\"`\n */\n placeholder?: string;\n\n /**\n * Set this to `true` if the auto resizing textarea should not animate for new\n * height changes.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * An optional style to apply to the textarea element. The base `style` prop\n * is applied to the surrounding `div` instead.\n */\n areaStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the textarea element. The base `style`\n * prop is applied to the surrounding `div` instead.\n */\n areaClassName?: string;\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n * @defaultValue `2`\n */\n rows?: number;\n\n /**\n * The maximum number of rows a textarea can expand to before showing a\n * scrollbar. When this is set to `-1`, there will be no limit.\n *\n * @defaultValue `-1`\n */\n maxRows?: number;\n\n /**\n * @see {@link TextAreaResize}\n * @defaultValue `\"auto\"`\n */\n resize?: TextAreaResize;\n\n /**\n * When the {@link resize} prop is set to `\"auto\"`, an additional `<div>` is\n * added along with a hidden `<textarea>` mask. This prop can be used to add\n * any additional styling or props to that div.\n *\n * This will only be applied when {@link resize} is set to `\"auto\"`.\n */\n resizeContainerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n\n /**\n * Optional props to provide to the {@link TextFieldContainer} component.\n * There probably isn't any real use for this prop other than if you need to\n * add a `ref` for some DOM behavior.\n */\n containerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { TextArea } from \"@react-md/core/form/TextArea\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <TextArea\n * label=\"Label\"\n * placeholder=\"Placeholder\"\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/text-field#simple-textarea | TextArea Demos}\n */\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(props, ref) {\n const {\n id: propId,\n style,\n className,\n label,\n labelProps,\n labelStyle,\n labelClassName,\n areaStyle,\n areaClassName,\n resizeContainerProps,\n resize = \"auto\",\n dense,\n error,\n active,\n inline: propInline,\n leftAddon,\n rightAddon,\n disableLeftAddonStyles,\n disableRightAddonStyles,\n theme: propTheme,\n underlineDirection: propUnderlineDirection,\n messageProps,\n messageContainerProps,\n containerProps,\n rows = 2,\n maxRows = -1,\n onChange: propOnChange,\n disableTransition: propDisableTransition,\n ...remaining\n } = props;\n const { disabled = false, readOnly = false, value, defaultValue } = props;\n const id = useEnsuredId(propId, \"text-area\");\n const theme = getFormConfig(\"theme\", propTheme);\n const underlineDirection = getFormConfig(\n \"underlineDirection\",\n propUnderlineDirection\n );\n const [areaRef, areaRefCallback] = useEnsuredRef(ref);\n\n const {\n maskRef,\n containerRef,\n height,\n onChange,\n scrollable,\n disableTransition,\n } = useResizingTextArea({\n maxRows,\n resize,\n onChange: propOnChange,\n containerRef: containerProps?.ref,\n disableTransition: propDisableTransition,\n });\n\n let { placeholder = \"\" } = props;\n if (label && !placeholder) {\n // See the placeholder type definition comments for information\n placeholder = \" \";\n }\n\n // have to force it inline or else you won't be able to resize\n // it horizontally.\n const inline = resize === \"horizontal\" || resize === \"both\" || propInline;\n\n const area = (\n <textarea\n {...remaining}\n id={id}\n ref={areaRefCallback}\n rows={rows}\n disabled={disabled}\n onChange={onChange}\n placeholder={placeholder}\n style={areaStyle}\n className={textArea({\n resize,\n scrollable,\n className: areaClassName,\n placeholderHidden: !!label && !active,\n })}\n />\n );\n\n const labelNode = label && (\n <Label\n {...labelProps}\n htmlFor={id}\n style={labelProps?.style ?? labelStyle}\n className={labelProps?.className ?? labelClassName}\n floating\n dense={dense}\n error={error}\n active={active}\n disabled={disabled}\n >\n {label}\n </Label>\n );\n\n let children = (\n <>\n {area}\n {labelNode}\n </>\n );\n\n if (resize === \"auto\") {\n children = (\n <ResizingTextAreaWrapper\n {...resizeContainerProps}\n maskId={`${id}-mask`}\n maskRef={maskRef}\n rows={rows}\n areaStyle={areaStyle}\n areaClassName={areaClassName}\n defaultValue={value ?? defaultValue}\n disableTransition={disableTransition}\n >\n {children}\n </ResizingTextAreaWrapper>\n );\n }\n\n return (\n <FormMessageContainer\n inline={inline}\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <TextFieldContainer\n {...containerProps}\n ref={containerRef}\n style={{\n ...style,\n \"--rmd-text-area-height\": height,\n }}\n className={textAreaContainer({\n animate: !disableTransition && resize === \"auto\",\n disabled,\n height: !!height,\n underlineLabelled:\n !!label && (theme === \"underline\" || theme === \"filled\"),\n className,\n })}\n theme={theme}\n label={!!label}\n error={error}\n dense={dense}\n inline={inline}\n active={active}\n readOnly={readOnly}\n disabled={disabled}\n leftAddon={leftAddon}\n rightAddon={rightAddon}\n underlineDirection={underlineDirection}\n disableLeftAddonStyles={disableLeftAddonStyles}\n disableRightAddonStyles={disableRightAddonStyles}\n onClick={(event) => {\n // The textarea container adds padding-top when there is a label so\n // that the label does not cover the text so this makes it so you\n // can still click anywhere in the \"box\" to focus the textarea.\n if (!disabled && event.target === event.currentTarget) {\n areaRef.current?.focus();\n }\n }}\n >\n {children}\n </TextFieldContainer>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["forwardRef","useEnsuredId","useEnsuredRef","FormMessageContainer","Label","ResizingTextAreaWrapper","TextFieldContainer","getFormConfig","textArea","textAreaContainer","useResizingTextArea","TextArea","props","ref","id","propId","style","className","label","labelProps","labelStyle","labelClassName","areaStyle","areaClassName","resizeContainerProps","resize","dense","error","active","inline","propInline","leftAddon","rightAddon","disableLeftAddonStyles","disableRightAddonStyles","theme","propTheme","underlineDirection","propUnderlineDirection","messageProps","messageContainerProps","containerProps","rows","maxRows","onChange","propOnChange","disableTransition","propDisableTransition","remaining","disabled","readOnly","value","defaultValue","areaRef","areaRefCallback","maskRef","containerRef","height","scrollable","placeholder","area","textarea","placeholderHidden","labelNode","htmlFor","floating","children","maskId","animate","underlineLabelled","onClick","event","target","currentTarget","current","focus"],"mappings":"AAAA;;AAEA,SAIEA,UAAU,QACL,QAAQ;AAGf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,uBAAuB,QAAQ,+BAA+B;AACvE,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,QAAQ,EAAEC,iBAAiB,QAAQ,sBAAsB;AAElE,SAEEC,mBAAmB,QACd,2BAA2B;AAoFlC;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,MAAMC,yBAAWX,WACtB,SAASW,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJC,IAAI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,MAAM,KAAKD,MAAME,aAAa,EAAE;oBACrDpB,QAAQqB,OAAO,EAAEC;gBACnB;YACF;sBAECT;;;AAIT,GACA"}
1
+ {"version":3,"sources":["../../src/form/TextArea.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n type HTMLAttributes,\n type TextareaHTMLAttributes,\n forwardRef,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { Label } from \"./Label.js\";\nimport { ResizingTextAreaWrapper } from \"./ResizingTextAreaWrapper.js\";\nimport { TextFieldContainer } from \"./TextFieldContainer.js\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { textArea, textAreaContainer } from \"./textAreaStyles.js\";\nimport { type FormFieldOptions } from \"./types.js\";\nimport {\n type TextAreaResize,\n useResizingTextArea,\n} from \"./useResizingTextArea.js\";\n\n// NOTE: The augmentation appears in this file since no type definitions are\n// ever imported from the `textAreaStylesStyles` file.\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-text-area-height\"?: string | number;\n \"--rmd-text-area-padding\"?: string | number;\n }\n}\n\n/**\n * @since 6.0.0 Added `containerProps`.\n */\nexport interface TextAreaProps\n extends FormFieldOptions, TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** @defaultValue `\"text-area-\" + useId()` */\n id?: string;\n\n /**\n * Optional placeholder text to display in the text field.\n *\n * @defaultValue `label ? \" \" : \"\"`\n */\n placeholder?: string;\n\n /**\n * Set this to `true` if the auto resizing textarea should not animate for new\n * height changes.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * An optional style to apply to the textarea element. The base `style` prop\n * is applied to the surrounding `div` instead.\n */\n areaStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the textarea element. The base `style`\n * prop is applied to the surrounding `div` instead.\n */\n areaClassName?: string;\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n * @defaultValue `2`\n */\n rows?: number;\n\n /**\n * The maximum number of rows a textarea can expand to before showing a\n * scrollbar. When this is set to `-1`, there will be no limit.\n *\n * @defaultValue `-1`\n */\n maxRows?: number;\n\n /**\n * @see {@link TextAreaResize}\n * @defaultValue `\"auto\"`\n */\n resize?: TextAreaResize;\n\n /**\n * When the {@link resize} prop is set to `\"auto\"`, an additional `<div>` is\n * added along with a hidden `<textarea>` mask. This prop can be used to add\n * any additional styling or props to that div.\n *\n * This will only be applied when {@link resize} is set to `\"auto\"`.\n */\n resizeContainerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n\n /**\n * Optional props to provide to the {@link TextFieldContainer} component.\n * There probably isn't any real use for this prop other than if you need to\n * add a `ref` for some DOM behavior.\n */\n containerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { TextArea } from \"@react-md/core/form/TextArea\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <TextArea\n * label=\"Label\"\n * placeholder=\"Placeholder\"\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/text-field#simple-textarea | TextArea Demos}\n */\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(props, ref) {\n const {\n id: propId,\n style,\n className,\n label,\n labelProps,\n labelStyle,\n labelClassName,\n areaStyle,\n areaClassName,\n resizeContainerProps,\n resize = \"auto\",\n dense,\n error,\n active,\n inline: propInline,\n leftAddon,\n rightAddon,\n disableLeftAddonStyles,\n disableRightAddonStyles,\n theme: propTheme,\n underlineDirection: propUnderlineDirection,\n messageProps,\n messageContainerProps,\n containerProps,\n rows = 2,\n maxRows = -1,\n onChange: propOnChange,\n disableTransition: propDisableTransition,\n ...remaining\n } = props;\n const { disabled = false, readOnly = false, value, defaultValue } = props;\n const id = useEnsuredId(propId, \"text-area\");\n const theme = getFormConfig(\"theme\", propTheme);\n const underlineDirection = getFormConfig(\n \"underlineDirection\",\n propUnderlineDirection\n );\n const [areaRef, areaRefCallback] = useEnsuredRef(ref);\n\n const {\n maskRef,\n containerRef,\n height,\n onChange,\n scrollable,\n disableTransition,\n } = useResizingTextArea({\n maxRows,\n resize,\n onChange: propOnChange,\n containerRef: containerProps?.ref,\n disableTransition: propDisableTransition,\n });\n\n let { placeholder = \"\" } = props;\n if (label && !placeholder) {\n // See the placeholder type definition comments for information\n placeholder = \" \";\n }\n\n // have to force it inline or else you won't be able to resize\n // it horizontally.\n const inline = resize === \"horizontal\" || resize === \"both\" || propInline;\n\n const area = (\n <textarea\n {...remaining}\n id={id}\n ref={areaRefCallback}\n rows={rows}\n disabled={disabled}\n onChange={onChange}\n placeholder={placeholder}\n style={areaStyle}\n className={textArea({\n resize,\n scrollable,\n className: areaClassName,\n placeholderHidden: !!label && !active,\n })}\n />\n );\n\n const labelNode = label && (\n <Label\n {...labelProps}\n htmlFor={id}\n style={labelProps?.style ?? labelStyle}\n className={labelProps?.className ?? labelClassName}\n floating\n dense={dense}\n error={error}\n active={active}\n disabled={disabled}\n >\n {label}\n </Label>\n );\n\n let children = (\n <>\n {area}\n {labelNode}\n </>\n );\n\n if (resize === \"auto\") {\n children = (\n <ResizingTextAreaWrapper\n {...resizeContainerProps}\n maskId={`${id}-mask`}\n maskRef={maskRef}\n rows={rows}\n areaStyle={areaStyle}\n areaClassName={areaClassName}\n defaultValue={value ?? defaultValue}\n disableTransition={disableTransition}\n >\n {children}\n </ResizingTextAreaWrapper>\n );\n }\n\n return (\n <FormMessageContainer\n inline={inline}\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <TextFieldContainer\n {...containerProps}\n ref={containerRef}\n style={{\n ...style,\n \"--rmd-text-area-height\": height,\n }}\n className={textAreaContainer({\n animate: !disableTransition && resize === \"auto\",\n disabled,\n height: !!height,\n underlineLabelled:\n !!label && (theme === \"underline\" || theme === \"filled\"),\n className,\n })}\n theme={theme}\n label={!!label}\n error={error}\n dense={dense}\n inline={inline}\n active={active}\n readOnly={readOnly}\n disabled={disabled}\n leftAddon={leftAddon}\n rightAddon={rightAddon}\n underlineDirection={underlineDirection}\n disableLeftAddonStyles={disableLeftAddonStyles}\n disableRightAddonStyles={disableRightAddonStyles}\n onClick={(event) => {\n // The textarea container adds padding-top when there is a label so\n // that the label does not cover the text so this makes it so you\n // can still click anywhere in the \"box\" to focus the textarea.\n if (!disabled && event.target === event.currentTarget) {\n areaRef.current?.focus();\n }\n }}\n >\n {children}\n </TextFieldContainer>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["forwardRef","useEnsuredId","useEnsuredRef","FormMessageContainer","Label","ResizingTextAreaWrapper","TextFieldContainer","getFormConfig","textArea","textAreaContainer","useResizingTextArea","TextArea","props","ref","id","propId","style","className","label","labelProps","labelStyle","labelClassName","areaStyle","areaClassName","resizeContainerProps","resize","dense","error","active","inline","propInline","leftAddon","rightAddon","disableLeftAddonStyles","disableRightAddonStyles","theme","propTheme","underlineDirection","propUnderlineDirection","messageProps","messageContainerProps","containerProps","rows","maxRows","onChange","propOnChange","disableTransition","propDisableTransition","remaining","disabled","readOnly","value","defaultValue","areaRef","areaRefCallback","maskRef","containerRef","height","scrollable","placeholder","area","textarea","placeholderHidden","labelNode","htmlFor","floating","children","maskId","animate","underlineLabelled","onClick","event","target","currentTarget","current","focus"],"mappings":"AAAA;;AAEA,SAIEA,UAAU,QACL,QAAQ;AAGf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,uBAAuB,QAAQ,+BAA+B;AACvE,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,QAAQ,EAAEC,iBAAiB,QAAQ,sBAAsB;AAElE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A;YACZK,oBAAoBA;YACpBJ,wBAAwBA;YACxBC,yBAAyBA;YACzBoC,SAAS,CAACC;gBACR,mEAAmE;gBACnE,iEAAiE;gBACjE,+DAA+D;gBAC/D,IAAI,CAACtB,YAAYsB,MAAMC,MAAM,KAAKD,MAAME,aAAa,EAAE;oBACrDpB,QAAQqB,OAAO,EAAEC;gBACnB;YACF;sBAECT;;;AAIT,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/TextField.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n forwardRef,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { Label } from \"./Label.js\";\nimport { TextFieldContainer } from \"./TextFieldContainer.js\";\nimport { textField } from \"./textFieldStyles.js\";\nimport {\n type FormFieldOptions,\n type UserAgentAutocompleteProps,\n} from \"./types.js\";\n\n/**\n * These are all the \"supported\" input types for react-md so that they at least\n * render reasonably well by default. There is no built-in validation or\n * anything adding onto existing browser functionality for these types.\n *\n * @since 2.5.0 - `\"search\"` was added\n * @since 6.0.0 Dropped support for `\"week\"` and `\"month\"` input types since\n * they are not available in Firefox and Safari at this time.\n */\nexport type SupportedInputTypes =\n | \"text\"\n | \"password\"\n | \"number\"\n | \"tel\"\n | \"email\"\n | \"date\"\n | \"time\"\n | \"datetime-local\"\n | \"url\"\n | \"color\"\n | \"search\";\n\n/**\n * @since 6.0.0 Renamed from `TextFieldAttributes` to\n * `TextFieldInputAttributes`\n */\nexport type TextFieldInputAttributes = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\"\n>;\n\n/**\n * @since 6.0.0 Removed the `containerRef` prop.\n */\nexport interface TextFieldProps\n extends TextFieldInputAttributes,\n UserAgentAutocompleteProps,\n FormFieldOptions {\n /**\n * @defaultValue `\"text-field-\" + useId()`\n */\n id?: string;\n\n /**\n * Optional placeholder text to display in the text field.\n *\n * @defaultValue `label ? \" \" : \"\"`\n */\n placeholder?: string;\n\n /**\n * Any optional inline styles to set on the input.\n */\n inputStyle?: CSSProperties;\n\n /**\n * An optional `className` to add to the input.\n */\n inputClassName?: string;\n\n /**\n * The text field type.\n *\n * @defaultValue `\"text\"`\n */\n type?: SupportedInputTypes;\n\n /**\n * Optional props to provide to the {@link TextFieldContainer} component.\n * There probably isn't any real use for this prop other than if you need to\n * add a `ref` for some DOM behavior.\n */\n containerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n}\n\n/**\n * The structure for this component is:\n * @example Component Structure\n * ```tsx\n * <FormMessageContainer {...messageContainerProps}>\n * <TextFieldContainer {...containerProps}>\n * <input {...props} />\n * <Label {...labelProps} />\n * </TextFieldContainer>\n * </FormMessageContainer>\n * ```\n *\n * @example Simple Example\n * ```tsx\n * import { TextField } from \"@react-md/core/form/TextField\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <TextField\n * label=\"Name\"\n * placeholder=\"Bob\"\n * defaultValue=\"\"\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/textfield | TextField Demos}\n */\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n function TextField(props, ref) {\n const {\n id: propId,\n style,\n className,\n type = \"text\",\n label,\n labelProps,\n labelStyle,\n labelClassName,\n autoCompleteValue,\n autoComplete = autoCompleteValue,\n name = autoCompleteValue,\n dense,\n error,\n active,\n inline,\n leftAddon,\n leftAddonProps,\n rightAddon,\n rightAddonProps,\n disableLeftAddonStyles,\n disableRightAddonStyles,\n inputStyle,\n inputClassName,\n theme,\n underlineDirection,\n messageProps,\n messageContainerProps,\n containerProps,\n ...remaining\n } = props;\n const { disabled, readOnly } = props;\n const id = useEnsuredId(propId, \"text-field\");\n\n let { placeholder = \"\" } = props;\n if (label && !placeholder) {\n // See the placeholder type definition comments for information\n placeholder = \" \";\n }\n\n return (\n <FormMessageContainer\n inline={inline}\n {...messageContainerProps}\n messageProps={\n messageProps && {\n error,\n theme,\n ...messageProps,\n }\n }\n >\n <TextFieldContainer\n {...containerProps}\n style={style}\n className={className}\n theme={theme}\n label={!!label}\n error={error}\n dense={dense}\n inline={inline}\n active={active}\n readOnly={readOnly}\n disabled={disabled}\n leftAddon={leftAddon}\n leftAddonProps={leftAddonProps}\n rightAddon={rightAddon}\n rightAddonProps={rightAddonProps}\n underlineDirection={underlineDirection}\n disableLeftAddonStyles={disableLeftAddonStyles}\n disableRightAddonStyles={disableRightAddonStyles}\n >\n <input\n {...remaining}\n id={id}\n ref={ref}\n type={type}\n name={name}\n disabled={disabled}\n placeholder={placeholder}\n autoComplete={autoComplete}\n style={inputStyle}\n className={textField({\n className: inputClassName,\n placeholderHidden: !!label && !active,\n })}\n />\n {label && (\n <Label\n floating\n dense={dense}\n error={error}\n active={active}\n disabled={disabled}\n {...labelProps}\n htmlFor={id}\n style={labelProps?.style ?? labelStyle}\n className={labelProps?.className ?? labelClassName}\n >\n {label}\n </Label>\n )}\n </TextFieldContainer>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["forwardRef","useEnsuredId","FormMessageContainer","Label","TextFieldContainer","textField","TextField","props","ref","id","propId","style","className","type","label","labelProps","labelStyle","labelClassName","autoCompleteValue","autoComplete","name","dense","error","active","inline","leftAddon","leftAddonProps","rightAddon","rightAddonProps","disableLeftAddonStyles","disableRightAddonStyles","inputStyle","inputClassName","theme","underlineDirection","messageProps","messageContainerProps","containerProps","remaining","disabled","readOnly","placeholder","input","placeholderHidden","floating","htmlFor"],"mappings":";AAAA,SAIEA,UAAU,QACL,QAAQ;AAGf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,SAAS,QAAQ,uBAAuB;AAiFjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;C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;oBACVE,aAAaA;oBACbtB,cAAcA;oBACdR,OAAOoB;oBACPnB,WAAWP,UAAU;wBACnBO,WAAWoB;wBACXW,mBAAmB,CAAC,CAAC7B,SAAS,CAACS;oBACjC;;gBAEDT,uBACC,KAACX;oBACCyC,QAAQ;oBACRvB,OAAOA;oBACPC,OAAOA;oBACPC,QAAQA;oBACRgB,UAAUA;oBACT,GAAGxB,UAAU;oBACd8B,SAASpC;oBACTE,OAAOI,YAAYJ,SAASK;oBAC5BJ,WAAWG,YAAYH,aAAaK;8BAEnCH;;;;;AAMb,GACA"}
1
+ {"version":3,"sources":["../../src/form/TextField.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n forwardRef,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { Label } from \"./Label.js\";\nimport { TextFieldContainer } from \"./TextFieldContainer.js\";\nimport { textField } from \"./textFieldStyles.js\";\nimport {\n type FormFieldOptions,\n type UserAgentAutocompleteProps,\n} from \"./types.js\";\n\n/**\n * These are all the \"supported\" input types for react-md so that they at least\n * render reasonably well by default. There is no built-in validation or\n * anything adding onto existing browser functionality for these types.\n *\n * @since 2.5.0 - `\"search\"` was added\n * @since 6.0.0 Dropped support for `\"week\"` and `\"month\"` input types since\n * they are not available in Firefox and Safari at this time.\n */\nexport type SupportedInputTypes =\n | \"text\"\n | \"password\"\n | \"number\"\n | \"tel\"\n | \"email\"\n | \"date\"\n | \"time\"\n | \"datetime-local\"\n | \"url\"\n | \"color\"\n | \"search\";\n\n/**\n * @since 6.0.0 Renamed from `TextFieldAttributes` to\n * `TextFieldInputAttributes`\n */\nexport type TextFieldInputAttributes = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\"\n>;\n\n/**\n * @since 6.0.0 Removed the `containerRef` prop.\n */\nexport interface TextFieldProps\n extends\n TextFieldInputAttributes,\n UserAgentAutocompleteProps,\n FormFieldOptions {\n /**\n * @defaultValue `\"text-field-\" + useId()`\n */\n id?: string;\n\n /**\n * Optional placeholder text to display in the text field.\n *\n * @defaultValue `label ? \" \" : \"\"`\n */\n placeholder?: string;\n\n /**\n * Any optional inline styles to set on the input.\n */\n inputStyle?: CSSProperties;\n\n /**\n * An optional `className` to add to the input.\n */\n inputClassName?: string;\n\n /**\n * The text field type.\n *\n * @defaultValue `\"text\"`\n */\n type?: SupportedInputTypes;\n\n /**\n * Optional props to provide to the {@link TextFieldContainer} component.\n * There probably isn't any real use for this prop other than if you need to\n * add a `ref` for some DOM behavior.\n */\n containerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n}\n\n/**\n * The structure for this component is:\n * @example Component Structure\n * ```tsx\n * <FormMessageContainer {...messageContainerProps}>\n * <TextFieldContainer {...containerProps}>\n * <input {...props} />\n * <Label {...labelProps} />\n * </TextFieldContainer>\n * </FormMessageContainer>\n * ```\n *\n * @example Simple Example\n * ```tsx\n * import { TextField } from \"@react-md/core/form/TextField\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <TextField\n * label=\"Name\"\n * placeholder=\"Bob\"\n * defaultValue=\"\"\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/textfield | TextField Demos}\n */\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n function TextField(props, ref) {\n const {\n id: propId,\n style,\n className,\n type = \"text\",\n label,\n labelProps,\n labelStyle,\n labelClassName,\n autoCompleteValue,\n autoComplete = autoCompleteValue,\n name = autoCompleteValue,\n dense,\n error,\n active,\n inline,\n leftAddon,\n leftAddonProps,\n rightAddon,\n rightAddonProps,\n disableLeftAddonStyles,\n disableRightAddonStyles,\n inputStyle,\n inputClassName,\n theme,\n underlineDirection,\n messageProps,\n messageContainerProps,\n containerProps,\n ...remaining\n } = props;\n const { disabled, readOnly } = props;\n const id = useEnsuredId(propId, \"text-field\");\n\n let { placeholder = \"\" } = props;\n if (label && !placeholder) {\n // See the placeholder type definition comments for information\n placeholder = \" \";\n }\n\n return (\n <FormMessageContainer\n inline={inline}\n {...messageContainerProps}\n messageProps={\n messageProps && {\n error,\n theme,\n ...messageProps,\n }\n }\n >\n <TextFieldContainer\n {...containerProps}\n style={style}\n className={className}\n theme={theme}\n label={!!label}\n error={error}\n dense={dense}\n inline={inline}\n active={active}\n readOnly={readOnly}\n disabled={disabled}\n leftAddon={leftAddon}\n leftAddonProps={leftAddonProps}\n rightAddon={rightAddon}\n rightAddonProps={rightAddonProps}\n underlineDirection={underlineDirection}\n disableLeftAddonStyles={disableLeftAddonStyles}\n disableRightAddonStyles={disableRightAddonStyles}\n >\n <input\n {...remaining}\n id={id}\n ref={ref}\n type={type}\n name={name}\n disabled={disabled}\n placeholder={placeholder}\n autoComplete={autoComplete}\n style={inputStyle}\n className={textField({\n className: inputClassName,\n placeholderHidden: !!label && !active,\n })}\n />\n {label && (\n <Label\n floating\n dense={dense}\n error={error}\n active={active}\n disabled={disabled}\n {...labelProps}\n htmlFor={id}\n style={labelProps?.style ?? labelStyle}\n className={labelProps?.className ?? labelClassName}\n >\n {label}\n </Label>\n )}\n </TextFieldContainer>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["forwardRef","useEnsuredId","FormMessageContainer","Label","TextFieldContainer","textField","TextField","props","ref","id","propId","style","className","type","label","labelProps","labelStyle","labelClassName","autoCompleteValue","autoComplete","name","dense","error","active","inline","leftAddon","leftAddonProps","rightAddon","rightAddonProps","disableLeftAddonStyles","disableRightAddonStyles","inputStyle","inputClassName","theme","underlineDirection","messageProps","messageContainerProps","containerProps","remaining","disabled","readOnly","placeholder","input","placeholderHidden","floating","htmlFor"],"mappings":";AAAA,SAIEA,UAAU,QACL,QAAQ;AAGf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,kBAAkB,Q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BACE,GAAGJ,SAAS;oBACb7B,IAAIA;oBACJD,KAAKA;oBACLK,MAAMA;oBACNO,MAAMA;oBACNmB,UAAUA;oBACVE,aAAaA;oBACbtB,cAAcA;oBACdR,OAAOoB;oBACPnB,WAAWP,UAAU;wBACnBO,WAAWoB;wBACXW,mBAAmB,CAAC,CAAC7B,SAAS,CAACS;oBACjC;;gBAEDT,uBACC,KAACX;oBACCyC,QAAQ;oBACRvB,OAAOA;oBACPC,OAAOA;oBACPC,QAAQA;oBACRgB,UAAUA;oBACT,GAAGxB,UAAU;oBACd8B,SAASpC;oBACTE,OAAOI,YAAYJ,SAASK;oBAC5BJ,WAAWG,YAAYH,aAAaK;8BAEnCH;;;;;AAMb,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/TextFieldContainer.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { TextFieldAddon } from \"./TextFieldAddon.js\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { textFieldContainer } from \"./textFieldContainerStyles.js\";\nimport { type TextFieldContainerOptions } from \"./types.js\";\n\nexport interface TextFieldContainerProps\n extends HTMLAttributes<HTMLDivElement>,\n TextFieldContainerOptions {\n /**\n * Set this to `true` if there is a floating label with the `TextField` or\n * `TextArea`.\n *\n * @defaultValue `false`\n */\n label?: boolean;\n}\n\n/**\n * **Client Component**\n * This might be able to become a server component if I remove the useFormTheme hook\n *\n * This component is used to add the additional `TextField`, `TextArea`, and\n * `Select` theme styles.\n *\n * @internal\n */\nexport const TextFieldContainer = forwardRef<\n HTMLDivElement,\n TextFieldContainerProps\n>(function TextFieldContainer(props, ref) {\n const {\n children,\n className,\n dense,\n error,\n label,\n active,\n inline,\n readOnly,\n disabled,\n leftAddon,\n leftAddonProps,\n disableLeftAddonStyles,\n rightAddon,\n rightAddonProps,\n disableRightAddonStyles,\n theme: propTheme,\n underlineDirection: propUnderlineDirection,\n ...remaining\n } = props;\n const theme = getFormConfig(\"theme\", propTheme);\n const underlineDirection = getFormConfig(\n \"underlineDirection\",\n propUnderlineDirection\n );\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={textFieldContainer({\n theme,\n dense,\n error,\n label,\n inline,\n active,\n readOnly,\n disabled,\n className,\n leftAddon: !!leftAddon && !disableLeftAddonStyles,\n rightAddon: !!rightAddon && !disableRightAddonStyles,\n underlineDirection,\n })}\n >\n <TextFieldAddon {...leftAddonProps} disabled={disableLeftAddonStyles}>\n {leftAddon}\n </TextFieldAddon>\n {children}\n <TextFieldAddon\n {...rightAddonProps}\n disabled={disableRightAddonStyles}\n after\n >\n {rightAddon}\n </TextFieldAddon>\n </div>\n );\n});\n"],"names":["forwardRef","TextFieldAddon","getFormConfig","textFieldContainer","TextFieldContainer","props","ref","children","className","dense","error","label","active","inline","readOnly","disabled","leftAddon","leftAddonProps","disableLeftAddonStyles","rightAddon","rightAddonProps","disableRightAddonStyles","theme","propTheme","underlineDirection","propUnderlineDirection","remaining","div","after"],"mappings":"AAAA;;AAEA,SAA8BA,UAAU,QAAQ,QAAQ;AAExD,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,kBAAkB,QAAQ,gCAAgC;AAenE;;;;;;;;CAQC,GACD,OAAO,MAAMC,mCAAqBJ,WAGhC,SAASI,mBAAmBC,KAAK,EAAEC,GAAG;IACtC,MAAM,EACJC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,MAAM,EACNC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTC,cAAc,EACdC,sBAAsB,EACtBC,UAAU,EACVC,eAAe,EACfC,uBAAuB,EACvBC,OAAOC,SAAS,EAChBC,oBAAoBC,sBAAsB,EAC1C,GAAGC,WACJ,GAAGrB;IACJ,MAAMiB,QAAQpB,cAAc,SAASqB;IACrC,MAAMC,qBAAqBtB,cACzB,sBACAuB;IAGF,qBACE,MAACE;QACE,GAAGD,SAAS;QACbpB,KAAKA;QACLE,WAAWL,mBAAmB;YAC5BmB;YACAb;YACAC;YACAC;YACAE;YACAD;YACAE;YACAC;YACAP;YACAQ,WAAW,CAAC,CAACA,aAAa,CAACE;YAC3BC,YAAY,CAAC,CAACA,cAAc,CAACE;YAC7BG;QACF;;0BAEA,KAACvB;gBAAgB,GAAGgB,cAAc;gBAAEF,UAAUG;0BAC3CF;;YAEFT;0BACD,KAACN;gBACE,GAAGmB,eAAe;gBACnBL,UAAUM;gBACVO,KAAK;0BAEJT;;;;AAIT,GAAG"}
1
+ {"version":3,"sources":["../../src/form/TextFieldContainer.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { TextFieldAddon } from \"./TextFieldAddon.js\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { textFieldContainer } from \"./textFieldContainerStyles.js\";\nimport { type TextFieldContainerOptions } from \"./types.js\";\n\nexport interface TextFieldContainerProps\n extends HTMLAttributes<HTMLDivElement>, TextFieldContainerOptions {\n /**\n * Set this to `true` if there is a floating label with the `TextField` or\n * `TextArea`.\n *\n * @defaultValue `false`\n */\n label?: boolean;\n}\n\n/**\n * **Client Component**\n * This might be able to become a server component if I remove the useFormTheme hook\n *\n * This component is used to add the additional `TextField`, `TextArea`, and\n * `Select` theme styles.\n *\n * @internal\n */\nexport const TextFieldContainer = forwardRef<\n HTMLDivElement,\n TextFieldContainerProps\n>(function TextFieldContainer(props, ref) {\n const {\n children,\n className,\n dense,\n error,\n label,\n active,\n inline,\n readOnly,\n disabled,\n leftAddon,\n leftAddonProps,\n disableLeftAddonStyles,\n rightAddon,\n rightAddonProps,\n disableRightAddonStyles,\n theme: propTheme,\n underlineDirection: propUnderlineDirection,\n ...remaining\n } = props;\n const theme = getFormConfig(\"theme\", propTheme);\n const underlineDirection = getFormConfig(\n \"underlineDirection\",\n propUnderlineDirection\n );\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={textFieldContainer({\n theme,\n dense,\n error,\n label,\n inline,\n active,\n readOnly,\n disabled,\n className,\n leftAddon: !!leftAddon && !disableLeftAddonStyles,\n rightAddon: !!rightAddon && !disableRightAddonStyles,\n underlineDirection,\n })}\n >\n <TextFieldAddon {...leftAddonProps} disabled={disableLeftAddonStyles}>\n {leftAddon}\n </TextFieldAddon>\n {children}\n <TextFieldAddon\n {...rightAddonProps}\n disabled={disableRightAddonStyles}\n after\n >\n {rightAddon}\n </TextFieldAddon>\n </div>\n );\n});\n"],"names":["forwardRef","TextFieldAddon","getFormConfig","textFieldContainer","TextFieldContainer","props","ref","children","className","dense","error","label","active","inline","readOnly","disabled","leftAddon","leftAddonProps","disableLeftAddonStyles","rightAddon","rightAddonProps","disableRightAddonStyles","theme","propTheme","underlineDirection","propUnderlineDirection","remaining","div","after"],"mappings":"AAAA;;AAEA,SAA8BA,UAAU,QAAQ,QAAQ;AAExD,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,kBAAkB,QAAQ,gCAAgC;AAcnE;;;;;;;;CAQC,GACD,OAAO,MAAMC,mCAAqBJ,WAGhC,SAASI,mBAAmBC,KAAK,EAAEC,GAAG;IACtC,MAAM,EACJC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,MAAM,EACNC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTC,cAAc,EACdC,sBAAsB,EACtBC,UAAU,EACVC,eAAe,EACfC,uBAAuB,EACvBC,OAAOC,SAAS,EAChBC,oBAAoBC,sBAAsB,EAC1C,GAAGC,WACJ,GAAGrB;IACJ,MAAMiB,QAAQpB,cAAc,SAASqB;IACrC,MAAMC,qBAAqBtB,cACzB,sBACAuB;IAGF,qBACE,MAACE;QACE,GAAGD,SAAS;QACbpB,KAAKA;QACLE,WAAWL,mBAAmB;YAC5BmB;YACAb;YACAC;YACAC;YACAE;YACAD;YACAE;YACAC;YACAP;YACAQ,WAAW,CAAC,CAACA,aAAa,CAACE;YAC3BC,YAAY,CAAC,CAACA,cAAc,CAACE;YAC7BG;QACF;;0BAEA,KAACvB;gBAAgB,GAAGgB,cAAc;gBAAEF,UAAUG;0BAC3CF;;YAEFT;0BACD,KAACN;gBACE,GAAGmB,eAAe;gBACnBL,UAAUM;gBACVO,KAAK;0BAEJT;;;;AAIT,GAAG"}
@@ -4,6 +4,7 @@
4
4
 
5
5
  @use "../utils";
6
6
  @use "base";
7
+ @use "legend";
7
8
 
8
9
  /// Set to `true` to disable the `Formset` component styles
9
10
  /// @type Boolean
@@ -28,6 +29,12 @@ $disable-everything: base.$form-disable-everything !default;
28
29
  flex: 1 1 auto;
29
30
  width: 100%;
30
31
  }
32
+
33
+ @if not legend.$disable-floating {
34
+ &--floating-legend {
35
+ position: relative;
36
+ }
37
+ }
31
38
  }
32
39
  }
33
40
  }
@@ -91,13 +91,14 @@ $large-size: 2rem !default;
91
91
  @include hidden-input-styles(true);
92
92
 
93
93
  .rmd-input-toggle {
94
+ $focus-selector: "&:has(:focus-visible)";
95
+ @if utils.$disable-has-selectors or utils.$disable-focus-visible {
96
+ $focus-selector: "&:focus-within";
97
+ }
98
+
94
99
  @include icon.set-var(color, currentcolor);
95
100
  @include interaction.surface(
96
- $focus-selector: if(
97
- utils.$disable-has-selectors or utils.$disable-focus-visible,
98
- "&:focus-within",
99
- "&:has(:focus-visible)"
100
- ),
101
+ $focus-selector: $focus-selector,
101
102
  $keyboard-only-focus: utils.$disable-has-selectors or
102
103
  utils.$disable-focus-visible,
103
104
  $disabled-selector: "&--disabled",
@@ -151,8 +151,8 @@ $variables: (
151
151
  @include use-var(background-color, active-background-color);
152
152
  @include use-var(padding, active-padding);
153
153
 
154
- transform: scale($floating-scale)
155
- translate(get-var(floating-active-x), get-var(floating-active-y));
154
+ transform: translate(get-var(floating-active-x), get-var(floating-active-y))
155
+ scale($floating-scale);
156
156
  // need to add the `transform-origin` because of the scaling applied.
157
157
  // it'll change the position based on the size of the label otherwise
158
158
  transform-origin: 0 0;
@@ -0,0 +1,77 @@
1
+ ////
2
+ /// @group legend
3
+ /// @since 6.4.0
4
+ ////
5
+
6
+ @use "../utils";
7
+ @use "../theme/theme";
8
+ @use "base";
9
+ @use "label";
10
+ @use "text-field";
11
+
12
+ /// Set to `true` to disable all form styles.
13
+ /// @type Boolean
14
+ $disable-everything: false !default;
15
+
16
+ /// Set to `true` to disable all form styles.
17
+ /// @type Boolean
18
+ $disable-floating: false !default;
19
+
20
+ /// Generates all the styles based on feature flags.
21
+ ///
22
+ /// @param {Boolean} disable-layer [false] - Set this to `true` to disable the
23
+ /// layer behavior
24
+ @mixin styles($disable-layer: false) {
25
+ @if not $disable-everything {
26
+ @include utils.optional-layer(legend, $disable-layer) {
27
+ .rmd-legend {
28
+ @if not $disable-floating {
29
+ &--floating {
30
+ @include label.set-var(floating-active-y, -50%);
31
+ @include label.set-var(
32
+ floating-active-x,
33
+ text-field.get-var(padding-left)
34
+ );
35
+
36
+ .rmd-fieldset:has(:focus-within) & {
37
+ @include label.active-styles;
38
+ }
39
+ }
40
+
41
+ @if not base.$form-disable-filled-theme {
42
+ &--floating-filled {
43
+ @include text-field.set-var(
44
+ padding-left,
45
+ text-field.get-var(filled-padding)
46
+ );
47
+ @include label.set-var(floating-active-y, -100%);
48
+ }
49
+ }
50
+
51
+ @if not base.$form-disable-underlined-theme {
52
+ &--floating-underline {
53
+ @include text-field.set-var(
54
+ padding-left,
55
+ text-field.get-var(underlined-padding)
56
+ );
57
+ }
58
+ }
59
+
60
+ @if not base.$form-disable-outlined-theme {
61
+ &--floating-outline {
62
+ @include label.set-var(active-padding, 0 label.$floating-padding);
63
+ @include label.set-var(
64
+ active-background-color,
65
+ theme.theme-get-var(background-color)
66
+ );
67
+ @include text-field.set-var(
68
+ padding-left,
69
+ text-field.get-var(outlined-padding)
70
+ );
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }