@react-md/core 1.0.0-next.4 → 1.0.0-next.5

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 (1110) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/CHANGELOG.md +6 -0
  3. package/dist/CoreProviders.js.map +1 -0
  4. package/dist/NoSsr.js.map +1 -0
  5. package/dist/SsrProvider.js.map +1 -0
  6. package/dist/app-bar/AppBar.js.map +1 -0
  7. package/dist/app-bar/AppBarTitle.js.map +1 -0
  8. package/dist/avatar/Avatar.js.map +1 -0
  9. package/dist/avatar/styles.js.map +1 -0
  10. package/dist/badge/Badge.js.map +1 -0
  11. package/dist/box/Box.js.map +1 -0
  12. package/dist/box/styles.js.map +1 -0
  13. package/dist/button/AsyncButton.js.map +1 -0
  14. package/dist/button/Button.js.map +1 -0
  15. package/dist/button/ButtonUnstyled.js.map +1 -0
  16. package/dist/button/FloatingActionButton.js.map +1 -0
  17. package/dist/button/TooltippedButton.js.map +1 -0
  18. package/dist/button/buttonStyles.js.map +1 -0
  19. package/dist/button/buttonUnstyledStyles.js.map +1 -0
  20. package/dist/card/Card.js.map +1 -0
  21. package/dist/card/CardContent.js.map +1 -0
  22. package/dist/card/CardFooter.js.map +1 -0
  23. package/dist/card/CardHeader.js.map +1 -0
  24. package/dist/card/CardSubtitle.js.map +1 -0
  25. package/dist/card/CardTitle.js.map +1 -0
  26. package/dist/card/ClickableCard.js.map +1 -0
  27. package/dist/card/styles.js.map +1 -0
  28. package/dist/chip/Chip.js.map +1 -0
  29. package/dist/chip/styles.js.map +1 -0
  30. package/dist/cssUtils.js.map +1 -0
  31. package/dist/delegateEvent.js.map +1 -0
  32. package/dist/dialog/Dialog.js.map +1 -0
  33. package/dist/dialog/DialogContainer.js.map +1 -0
  34. package/dist/dialog/DialogContent.js.map +1 -0
  35. package/dist/dialog/DialogFooter.js.map +1 -0
  36. package/dist/dialog/DialogHeader.js.map +1 -0
  37. package/dist/dialog/DialogTitle.js.map +1 -0
  38. package/dist/dialog/FixedDialog.js.map +1 -0
  39. package/dist/dialog/NestedDialogProvider.js.map +1 -0
  40. package/dist/dialog/styles.js.map +1 -0
  41. package/dist/divider/Divider.js.map +1 -0
  42. package/dist/divider/styles.js.map +1 -0
  43. package/dist/draggable/useDraggable.js.map +1 -0
  44. package/dist/draggable/utils.js.map +1 -0
  45. package/dist/expansion-panel/ExpansionList.js.map +1 -0
  46. package/dist/expansion-panel/ExpansionPanel.js.map +1 -0
  47. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -0
  48. package/dist/expansion-panel/useExpansionList.js.map +1 -0
  49. package/dist/expansion-panel/useExpansionPanels.js.map +1 -0
  50. package/dist/focus/useFocusContainer.js.map +1 -0
  51. package/dist/focus/utils.js.map +1 -0
  52. package/dist/form/Checkbox.js.map +1 -0
  53. package/dist/form/Fieldset.js.map +1 -0
  54. package/dist/form/FileInput.js.map +1 -0
  55. package/dist/form/Form.js.map +1 -0
  56. package/dist/form/FormMessage.js.map +1 -0
  57. package/dist/form/FormMessageContainer.js.map +1 -0
  58. package/dist/form/FormMessageCounter.js.map +1 -0
  59. package/dist/form/InputToggle.js.map +1 -0
  60. package/dist/form/InputToggleIcon.js.map +1 -0
  61. package/dist/form/Label.js.map +1 -0
  62. package/dist/form/Legend.js.map +1 -0
  63. package/dist/form/MenuItemCheckbox.js.map +1 -0
  64. package/dist/form/MenuItemFileInput.js.map +1 -0
  65. package/dist/form/MenuItemInputToggle.js.map +1 -0
  66. package/dist/form/MenuItemRadio.js.map +1 -0
  67. package/dist/form/MenuItemSwitch.js.map +1 -0
  68. package/dist/form/MenuItemTextField.js.map +1 -0
  69. package/dist/form/NativeSelect.js.map +1 -0
  70. package/dist/form/OptGroup.js.map +1 -0
  71. package/dist/form/Option.js.map +1 -0
  72. package/dist/form/Password.js.map +1 -0
  73. package/dist/form/Radio.js.map +1 -0
  74. package/dist/form/Select.js.map +1 -0
  75. package/dist/form/SelectValue.js.map +1 -0
  76. package/dist/form/Slider.js.map +1 -0
  77. package/dist/form/SliderContainer.js.map +1 -0
  78. package/dist/form/SliderMark.js.map +1 -0
  79. package/dist/form/SliderMarkLabel.js.map +1 -0
  80. package/dist/form/SliderThumb.js.map +1 -0
  81. package/dist/form/SliderTrack.js.map +1 -0
  82. package/dist/form/SliderValueMarks.js.map +1 -0
  83. package/dist/form/SliderValueTooltip.js.map +1 -0
  84. package/dist/form/Switch.js.map +1 -0
  85. package/dist/form/SwitchTrack.js.map +1 -0
  86. package/dist/form/TextArea.js.map +1 -0
  87. package/dist/form/TextField.js.map +1 -0
  88. package/dist/form/TextFieldAddon.js.map +1 -0
  89. package/dist/form/TextFieldContainer.js.map +1 -0
  90. package/dist/form/TextFieldContainerStyles.js.map +1 -0
  91. package/dist/form/fileUtils.js.map +1 -0
  92. package/dist/form/formConfig.js.map +1 -0
  93. package/dist/form/formMessageStyles.js.map +1 -0
  94. package/dist/form/inputToggleStyles.js.map +1 -0
  95. package/dist/form/nativeSelectStyles.js.map +1 -0
  96. package/dist/form/optionStyles.js.map +1 -0
  97. package/dist/form/passwordStyles.js.map +1 -0
  98. package/dist/form/selectStyles.js.map +1 -0
  99. package/dist/form/selectUtils.js.map +1 -0
  100. package/dist/form/sliderUtils.js.map +1 -0
  101. package/dist/form/switchStyles.js.map +1 -0
  102. package/dist/form/textAreaStyles.js.map +1 -0
  103. package/dist/form/textFieldStyles.js.map +1 -0
  104. package/dist/form/types.js.map +1 -0
  105. package/dist/form/useCheckboxGroup.js.map +1 -0
  106. package/dist/form/useFileUpload.js.map +1 -0
  107. package/dist/form/useListboxProvider.js.map +1 -0
  108. package/dist/form/useNumberField.js.map +1 -0
  109. package/dist/form/useRadioGroup.js.map +1 -0
  110. package/dist/form/useRangeSlider.js.map +1 -0
  111. package/dist/form/useResizingTextArea.js.map +1 -0
  112. package/dist/form/useSlider.js.map +1 -0
  113. package/dist/form/useTextField.js.map +1 -0
  114. package/dist/form/utils.js.map +1 -0
  115. package/dist/form/validation.js.map +1 -0
  116. package/dist/hoverMode/useHoverMode.js.map +1 -0
  117. package/dist/hoverMode/useHoverModeProvider.js.map +1 -0
  118. package/dist/icon/FontIcon.js.map +1 -0
  119. package/dist/icon/IconRotator.js.map +1 -0
  120. package/dist/icon/MaterialIcon.js.map +1 -0
  121. package/dist/icon/MaterialSymbol.js.map +1 -0
  122. package/dist/icon/SVGIcon.js.map +1 -0
  123. package/dist/icon/TextIconSpacing.js.map +1 -0
  124. package/dist/icon/iconConfig.js.map +1 -0
  125. package/dist/icon/material.js.map +1 -0
  126. package/dist/icon/materialConfig.js.map +1 -0
  127. package/dist/icon/styles.js.map +1 -0
  128. package/dist/index.js.map +1 -0
  129. package/dist/interaction/Ripple.js.map +1 -0
  130. package/dist/interaction/RippleContainer.js.map +1 -0
  131. package/dist/interaction/UserInteractionModeProvider.js.map +1 -0
  132. package/dist/interaction/config.js.map +1 -0
  133. package/dist/interaction/types.js.map +1 -0
  134. package/dist/interaction/useElementInteraction.js.map +1 -0
  135. package/dist/interaction/useHigherContrastChildren.js.map +1 -0
  136. package/dist/interaction/utils.js.map +1 -0
  137. package/dist/layout/LayoutAppBar.js.map +1 -0
  138. package/dist/layout/LayoutNav.js.map +1 -0
  139. package/dist/layout/LayoutWindowSplitter.js.map +1 -0
  140. package/dist/layout/Main.js.map +1 -0
  141. package/dist/layout/layoutNavStyles.js.map +1 -0
  142. package/dist/layout/layoutWindowSplitterStyles.js.map +1 -0
  143. package/dist/layout/mainStyles.js.map +1 -0
  144. package/dist/layout/useExpandableLayout.js.map +1 -0
  145. package/dist/layout/useHorizontalLayoutTransition.js.map +1 -0
  146. package/dist/layout/useLayoutAppBarHeight.js.map +1 -0
  147. package/dist/layout/useLayoutTree.js.map +1 -0
  148. package/dist/layout/useLayoutWindowSplitter.js.map +1 -0
  149. package/dist/layout/useMainTabIndex.js.map +1 -0
  150. package/dist/layout/useResizableLayout.js.map +1 -0
  151. package/dist/layout/useTemporaryLayout.js.map +1 -0
  152. package/dist/link/Link.js.map +1 -0
  153. package/dist/link/SkipToMainContent.js.map +1 -0
  154. package/dist/link/styles.js.map +1 -0
  155. package/dist/list/List.js.map +1 -0
  156. package/dist/list/ListItem.js.map +1 -0
  157. package/dist/list/ListItemAddon.js.map +1 -0
  158. package/dist/list/ListItemChildren.js.map +1 -0
  159. package/dist/list/ListItemLink.js.map +1 -0
  160. package/dist/list/ListItemText.js.map +1 -0
  161. package/dist/list/ListSubheader.js.map +1 -0
  162. package/dist/list/getListItemHeight.js.map +1 -0
  163. package/dist/list/listItemStyles.js.map +1 -0
  164. package/dist/list/types.js.map +1 -0
  165. package/dist/media-queries/AppSizeProvider.js.map +1 -0
  166. package/dist/media-queries/appSize.js.map +1 -0
  167. package/dist/media-queries/useMediaQuery.js.map +1 -0
  168. package/dist/menu/DropdownMenu.js.map +1 -0
  169. package/dist/menu/Menu.js.map +1 -0
  170. package/dist/menu/MenuBar.js.map +1 -0
  171. package/dist/menu/MenuButton.js.map +1 -0
  172. package/dist/menu/MenuConfigurationProvider.js.map +1 -0
  173. package/dist/menu/MenuItem.js.map +1 -0
  174. package/dist/menu/MenuItemButton.js.map +1 -0
  175. package/dist/menu/MenuItemGroup.js.map +1 -0
  176. package/dist/menu/MenuItemSeparator.js.map +1 -0
  177. package/dist/menu/MenuSheet.js.map +1 -0
  178. package/dist/menu/MenuVisibilityProvider.js.map +1 -0
  179. package/dist/menu/MenuWidget.js.map +1 -0
  180. package/dist/menu/MenuWidgetKeyboardProvider.js.map +1 -0
  181. package/dist/menu/useContextMenu.js.map +1 -0
  182. package/dist/menu/useMenuBarProvider.js.map +1 -0
  183. package/dist/menu/utils.js.map +1 -0
  184. package/dist/movement/constants.js.map +1 -0
  185. package/dist/movement/findMatchIndex.js.map +1 -0
  186. package/dist/movement/types.js.map +1 -0
  187. package/dist/movement/useKeyboardMovementProvider.js.map +1 -0
  188. package/dist/movement/utils.js.map +1 -0
  189. package/dist/overlay/Overlay.js.map +1 -0
  190. package/dist/overlay/overlayStyles.js.map +1 -0
  191. package/dist/portal/Portal.js.map +1 -0
  192. package/dist/portal/PortalContainerProvider.js.map +1 -0
  193. package/dist/positioning/constants.js.map +1 -0
  194. package/dist/positioning/createHorizontalPosition.js.map +1 -0
  195. package/dist/positioning/createVerticalPosition.js.map +1 -0
  196. package/dist/positioning/getFixedPosition.js.map +1 -0
  197. package/dist/positioning/types.js.map +1 -0
  198. package/dist/positioning/useFixedPositioning.js.map +1 -0
  199. package/dist/positioning/utils.js.map +1 -0
  200. package/dist/progress/CircularProgress.js.map +1 -0
  201. package/dist/progress/LinearProgress.js.map +1 -0
  202. package/dist/progress/getProgressA11y.js.map +1 -0
  203. package/dist/progress/types.js.map +1 -0
  204. package/dist/responsive-item/ResponsiveItemContainer.js.map +1 -0
  205. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -0
  206. package/dist/responsive-item/styles.js.map +1 -0
  207. package/dist/scroll/ScrollLock.js.map +1 -0
  208. package/dist/scroll/getScrollbarWidth.js.map +1 -0
  209. package/dist/scroll/useScrollLock.js.map +1 -0
  210. package/dist/segmented-button/SegmentedButton.js.map +1 -0
  211. package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -0
  212. package/dist/segmented-button/segmentedButtonContainerStyles.js.map +1 -0
  213. package/dist/segmented-button/segmentedButtonStyles.js.map +1 -0
  214. package/dist/sheet/Sheet.js.map +1 -0
  215. package/dist/sheet/styles.js.map +1 -0
  216. package/dist/snackbar/DefaultToastRenderer.js.map +1 -0
  217. package/dist/snackbar/Snackbar.js.map +1 -0
  218. package/dist/snackbar/Toast.js.map +1 -0
  219. package/dist/snackbar/ToastActionButton.js.map +1 -0
  220. package/dist/snackbar/ToastCloseButton.js.map +1 -0
  221. package/dist/snackbar/ToastContent.js.map +1 -0
  222. package/dist/snackbar/ToastManager.js.map +1 -0
  223. package/dist/snackbar/ToastManagerProvider.js.map +1 -0
  224. package/dist/snackbar/snackbarStyles.js.map +1 -0
  225. package/dist/snackbar/toastContentStyles.js.map +1 -0
  226. package/dist/snackbar/toastStyles.js.map +1 -0
  227. package/dist/snackbar/useCurrentToastActions.js.map +1 -0
  228. package/dist/suspense/CircularProgressSuspense.js.map +1 -0
  229. package/dist/suspense/NullSuspense.js.map +1 -0
  230. package/dist/table/Table.js.map +1 -0
  231. package/dist/table/TableBody.js.map +1 -0
  232. package/dist/table/TableCell.js.map +1 -0
  233. package/dist/table/TableCellContent.js.map +1 -0
  234. package/dist/table/TableCheckbox.js.map +1 -0
  235. package/dist/table/TableConfigurationProvider.js.map +1 -0
  236. package/dist/table/TableContainer.js.map +1 -0
  237. package/dist/table/TableContainerProvider.js.map +1 -0
  238. package/dist/table/TableFooter.js.map +1 -0
  239. package/dist/table/TableHeader.js.map +1 -0
  240. package/dist/table/TableRadio.js.map +1 -0
  241. package/dist/table/TableRow.js.map +1 -0
  242. package/dist/table/tableCellStyles.js.map +1 -0
  243. package/dist/table/tableContainerStyles.js.map +1 -0
  244. package/dist/table/tableFooterStyles.js.map +1 -0
  245. package/dist/table/tableHeaderStyles.js.map +1 -0
  246. package/dist/table/tableRowStyles.js.map +1 -0
  247. package/dist/table/tableStyles.js.map +1 -0
  248. package/dist/table/types.js.map +1 -0
  249. package/dist/tabs/Tab.js.map +1 -0
  250. package/dist/tabs/TabList.js.map +1 -0
  251. package/dist/tabs/TabListScrollButton.js.map +1 -0
  252. package/dist/tabs/tabIndicatorStyles.js.map +1 -0
  253. package/dist/tabs/tabListScrollButtonStyles.js.map +1 -0
  254. package/dist/tabs/tabListStyles.js.map +1 -0
  255. package/dist/tabs/tabStyles.js.map +1 -0
  256. package/dist/tabs/useTabList.js.map +1 -0
  257. package/dist/tabs/useTabs.js.map +1 -0
  258. package/dist/tabs/utils.js.map +1 -0
  259. package/dist/test-utils/IntersectionObserver.js.map +1 -0
  260. package/dist/test-utils/ResizeObserver.js.map +1 -0
  261. package/dist/test-utils/data-testid.js.map +1 -0
  262. package/dist/test-utils/index.js.map +1 -0
  263. package/dist/test-utils/jest-setup.js.map +1 -0
  264. package/dist/test-utils/matchMedia.js.map +1 -0
  265. package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -0
  266. package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -0
  267. package/dist/test-utils/polyfills/index.js.map +1 -0
  268. package/dist/test-utils/polyfills/matchMedia.js.map +1 -0
  269. package/dist/test-utils/polyfills/offsetParent.js.map +1 -0
  270. package/dist/test-utils/polyfills/scrollIntoView.js.map +1 -0
  271. package/dist/test-utils/render.js.map +1 -0
  272. package/dist/test-utils/timers.js.map +1 -0
  273. package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -0
  274. package/dist/theme/ThemeProvider.js.map +1 -0
  275. package/dist/theme/colors.js.map +1 -0
  276. package/dist/theme/cssVars.js.map +1 -0
  277. package/dist/theme/types.js.map +1 -0
  278. package/dist/theme/useCSSVariables.js.map +1 -0
  279. package/dist/theme/useColorScheme.js.map +1 -0
  280. package/dist/theme/useColorSchemeMetaTag.js.map +1 -0
  281. package/dist/theme/useColorSchemeProvider.js.map +1 -0
  282. package/dist/theme/usePrefersColorScheme.js.map +1 -0
  283. package/dist/theme/utils.js.map +1 -0
  284. package/dist/tooltip/Tooltip.js.map +1 -0
  285. package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -0
  286. package/dist/tooltip/constants.js.map +1 -0
  287. package/dist/tooltip/tooltipStyles.js.map +1 -0
  288. package/dist/tooltip/useTooltip.js.map +1 -0
  289. package/dist/tooltip/useTooltipPosition.js.map +1 -0
  290. package/dist/tooltip/utils.js.map +1 -0
  291. package/dist/transition/CSSTransition.js.map +1 -0
  292. package/dist/transition/Collapse.js.map +1 -0
  293. package/dist/transition/CrossFade.js.map +1 -0
  294. package/dist/transition/ScaleTransition.js.map +1 -0
  295. package/dist/transition/SkeletonPlaceholder.js.map +1 -0
  296. package/dist/transition/Slide.js.map +1 -0
  297. package/dist/transition/SlideContainer.js.map +1 -0
  298. package/dist/transition/collapseStyles.js.map +1 -0
  299. package/dist/transition/config.js.map +1 -0
  300. package/dist/transition/maxWidthTransition.js.map +1 -0
  301. package/dist/transition/skeletonPlaceholderUtils.js.map +1 -0
  302. package/dist/transition/types.js.map +1 -0
  303. package/dist/transition/useCSSTransition.js.map +1 -0
  304. package/dist/transition/useCarousel.js.map +1 -0
  305. package/dist/transition/useCollapseTransition.js.map +1 -0
  306. package/dist/transition/useCrossFadeTransition.js.map +1 -0
  307. package/dist/transition/useMaxWidthTransition.js.map +1 -0
  308. package/dist/transition/useScaleTransition.js.map +1 -0
  309. package/dist/transition/useSkeletonPlaceholder.js.map +1 -0
  310. package/dist/transition/useSlideTransition.js.map +1 -0
  311. package/dist/transition/useTransition.js.map +1 -0
  312. package/dist/transition/utils.js.map +1 -0
  313. package/dist/tree/DefaultTreeItemRenderer.js.map +1 -0
  314. package/dist/tree/Tree.js.map +1 -0
  315. package/dist/tree/TreeGroup.js.map +1 -0
  316. package/dist/tree/TreeItem.js.map +1 -0
  317. package/dist/tree/TreeItemExpander.js.map +1 -0
  318. package/dist/tree/TreeProvider.js.map +1 -0
  319. package/dist/tree/styles.js.map +1 -0
  320. package/dist/tree/types.js.map +1 -0
  321. package/dist/tree/useTree.js.map +1 -0
  322. package/dist/tree/useTreeExpansion.js.map +1 -0
  323. package/dist/tree/useTreeItems.js.map +1 -0
  324. package/dist/tree/useTreeMovement.js.map +1 -0
  325. package/dist/tree/useTreeSelection.js.map +1 -0
  326. package/dist/tree/utils.js.map +1 -0
  327. package/dist/types.js.map +1 -0
  328. package/dist/typography/SrOnly.js.map +1 -0
  329. package/dist/typography/TextContainer.js.map +1 -0
  330. package/dist/typography/Typography.js.map +1 -0
  331. package/dist/typography/WritingDirectionProvider.js.map +1 -0
  332. package/dist/useAsyncAction.js.map +1 -0
  333. package/dist/useDebouncedFunction.js.map +1 -0
  334. package/dist/useDropzone.js.map +1 -0
  335. package/dist/useElementSize.js.map +1 -0
  336. package/dist/useEnsuredId.js.map +1 -0
  337. package/dist/useEnsuredRef.js.map +1 -0
  338. package/dist/useEnsuredState.js.map +1 -0
  339. package/dist/useHtmlClassName.js.map +1 -0
  340. package/dist/useIntersectionObserver.js.map +1 -0
  341. package/dist/useIsomorphicLayoutEffect.js.map +1 -0
  342. package/dist/useLocalStorage.js.map +1 -0
  343. package/dist/useOrientation.js.map +1 -0
  344. package/dist/usePageInactive.js.map +1 -0
  345. package/dist/useResizeListener.js.map +1 -0
  346. package/dist/useResizeObserver.js.map +1 -0
  347. package/dist/useThrottledFunction.js.map +1 -0
  348. package/dist/useToggle.js.map +1 -0
  349. package/dist/useUnmounted.js.map +1 -0
  350. package/dist/useWindowSize.js.map +1 -0
  351. package/dist/utils/RenderRecursively.js.map +1 -0
  352. package/dist/utils/alphaNumericSort.js.map +1 -0
  353. package/dist/utils/applyRef.js.map +1 -0
  354. package/dist/utils/bem.js.map +1 -0
  355. package/dist/utils/filters.js.map +1 -0
  356. package/dist/utils/getClientPosition.js.map +1 -0
  357. package/dist/utils/getMiddleOfRange.js.map +1 -0
  358. package/dist/utils/getPercentage.js.map +1 -0
  359. package/dist/utils/getRangeDefaultValue.js.map +1 -0
  360. package/dist/utils/getRangeSteps.js.map +1 -0
  361. package/dist/utils/identity.js.map +1 -0
  362. package/dist/utils/isElementVisible.js.map +1 -0
  363. package/dist/utils/loop.js.map +1 -0
  364. package/dist/utils/nearest.js.map +1 -0
  365. package/dist/utils/parseCssLengthUnit.js.map +1 -0
  366. package/dist/utils/randomInt.js.map +1 -0
  367. package/dist/utils/wait.js.map +1 -0
  368. package/dist/utils/withinRange.js.map +1 -0
  369. package/dist/window-splitter/WindowSplitter.js.map +1 -0
  370. package/dist/window-splitter/useWindowSplitter.js.map +1 -0
  371. package/package.json +2 -2
  372. package/.turbo/turbo-lint.log +0 -12
  373. package/.turbo/turbo-test.log +0 -179
  374. package/.turbo/turbo-typecheck.log +0 -4
  375. package/dist/src/CoreProviders.js.map +0 -1
  376. package/dist/src/NoSsr.js.map +0 -1
  377. package/dist/src/SsrProvider.js.map +0 -1
  378. package/dist/src/app-bar/AppBar.js.map +0 -1
  379. package/dist/src/app-bar/AppBarTitle.js.map +0 -1
  380. package/dist/src/avatar/Avatar.js.map +0 -1
  381. package/dist/src/avatar/styles.js.map +0 -1
  382. package/dist/src/badge/Badge.js.map +0 -1
  383. package/dist/src/box/Box.js.map +0 -1
  384. package/dist/src/box/styles.js.map +0 -1
  385. package/dist/src/button/AsyncButton.js.map +0 -1
  386. package/dist/src/button/Button.js.map +0 -1
  387. package/dist/src/button/ButtonUnstyled.js.map +0 -1
  388. package/dist/src/button/FloatingActionButton.js.map +0 -1
  389. package/dist/src/button/TooltippedButton.js.map +0 -1
  390. package/dist/src/button/buttonStyles.js.map +0 -1
  391. package/dist/src/button/buttonUnstyledStyles.js.map +0 -1
  392. package/dist/src/card/Card.js.map +0 -1
  393. package/dist/src/card/CardContent.js.map +0 -1
  394. package/dist/src/card/CardFooter.js.map +0 -1
  395. package/dist/src/card/CardHeader.js.map +0 -1
  396. package/dist/src/card/CardSubtitle.js.map +0 -1
  397. package/dist/src/card/CardTitle.js.map +0 -1
  398. package/dist/src/card/ClickableCard.js.map +0 -1
  399. package/dist/src/card/styles.js.map +0 -1
  400. package/dist/src/chip/Chip.js.map +0 -1
  401. package/dist/src/chip/styles.js.map +0 -1
  402. package/dist/src/cssUtils.js.map +0 -1
  403. package/dist/src/delegateEvent.js.map +0 -1
  404. package/dist/src/dialog/Dialog.js.map +0 -1
  405. package/dist/src/dialog/DialogContainer.js.map +0 -1
  406. package/dist/src/dialog/DialogContent.js.map +0 -1
  407. package/dist/src/dialog/DialogFooter.js.map +0 -1
  408. package/dist/src/dialog/DialogHeader.js.map +0 -1
  409. package/dist/src/dialog/DialogTitle.js.map +0 -1
  410. package/dist/src/dialog/FixedDialog.js.map +0 -1
  411. package/dist/src/dialog/NestedDialogProvider.js.map +0 -1
  412. package/dist/src/dialog/styles.js.map +0 -1
  413. package/dist/src/divider/Divider.js.map +0 -1
  414. package/dist/src/divider/styles.js.map +0 -1
  415. package/dist/src/draggable/useDraggable.js.map +0 -1
  416. package/dist/src/draggable/utils.js.map +0 -1
  417. package/dist/src/expansion-panel/ExpansionList.js.map +0 -1
  418. package/dist/src/expansion-panel/ExpansionPanel.js.map +0 -1
  419. package/dist/src/expansion-panel/ExpansionPanelHeader.js.map +0 -1
  420. package/dist/src/expansion-panel/useExpansionList.js.map +0 -1
  421. package/dist/src/expansion-panel/useExpansionPanels.js.map +0 -1
  422. package/dist/src/focus/useFocusContainer.js.map +0 -1
  423. package/dist/src/focus/utils.js.map +0 -1
  424. package/dist/src/form/Checkbox.js.map +0 -1
  425. package/dist/src/form/Fieldset.js.map +0 -1
  426. package/dist/src/form/FileInput.js.map +0 -1
  427. package/dist/src/form/Form.js.map +0 -1
  428. package/dist/src/form/FormMessage.js.map +0 -1
  429. package/dist/src/form/FormMessageContainer.js.map +0 -1
  430. package/dist/src/form/FormMessageCounter.js.map +0 -1
  431. package/dist/src/form/InputToggle.js.map +0 -1
  432. package/dist/src/form/InputToggleIcon.js.map +0 -1
  433. package/dist/src/form/Label.js.map +0 -1
  434. package/dist/src/form/Legend.js.map +0 -1
  435. package/dist/src/form/MenuItemCheckbox.js.map +0 -1
  436. package/dist/src/form/MenuItemFileInput.js.map +0 -1
  437. package/dist/src/form/MenuItemInputToggle.js.map +0 -1
  438. package/dist/src/form/MenuItemRadio.js.map +0 -1
  439. package/dist/src/form/MenuItemSwitch.js.map +0 -1
  440. package/dist/src/form/MenuItemTextField.js.map +0 -1
  441. package/dist/src/form/NativeSelect.js.map +0 -1
  442. package/dist/src/form/OptGroup.js.map +0 -1
  443. package/dist/src/form/Option.js.map +0 -1
  444. package/dist/src/form/Password.js.map +0 -1
  445. package/dist/src/form/Radio.js.map +0 -1
  446. package/dist/src/form/Select.js.map +0 -1
  447. package/dist/src/form/SelectValue.js.map +0 -1
  448. package/dist/src/form/Slider.js.map +0 -1
  449. package/dist/src/form/SliderContainer.js.map +0 -1
  450. package/dist/src/form/SliderMark.js.map +0 -1
  451. package/dist/src/form/SliderMarkLabel.js.map +0 -1
  452. package/dist/src/form/SliderThumb.js.map +0 -1
  453. package/dist/src/form/SliderTrack.js.map +0 -1
  454. package/dist/src/form/SliderValueMarks.js.map +0 -1
  455. package/dist/src/form/SliderValueTooltip.js.map +0 -1
  456. package/dist/src/form/Switch.js.map +0 -1
  457. package/dist/src/form/SwitchTrack.js.map +0 -1
  458. package/dist/src/form/TextArea.js.map +0 -1
  459. package/dist/src/form/TextField.js.map +0 -1
  460. package/dist/src/form/TextFieldAddon.js.map +0 -1
  461. package/dist/src/form/TextFieldContainer.js.map +0 -1
  462. package/dist/src/form/TextFieldContainerStyles.js.map +0 -1
  463. package/dist/src/form/fileUtils.js.map +0 -1
  464. package/dist/src/form/formConfig.js.map +0 -1
  465. package/dist/src/form/formMessageStyles.js.map +0 -1
  466. package/dist/src/form/inputToggleStyles.js.map +0 -1
  467. package/dist/src/form/nativeSelectStyles.js.map +0 -1
  468. package/dist/src/form/optionStyles.js.map +0 -1
  469. package/dist/src/form/passwordStyles.js.map +0 -1
  470. package/dist/src/form/selectStyles.js.map +0 -1
  471. package/dist/src/form/selectUtils.js.map +0 -1
  472. package/dist/src/form/sliderUtils.js.map +0 -1
  473. package/dist/src/form/switchStyles.js.map +0 -1
  474. package/dist/src/form/textAreaStyles.js.map +0 -1
  475. package/dist/src/form/textFieldStyles.js.map +0 -1
  476. package/dist/src/form/types.js.map +0 -1
  477. package/dist/src/form/useCheckboxGroup.js.map +0 -1
  478. package/dist/src/form/useFileUpload.js.map +0 -1
  479. package/dist/src/form/useListboxProvider.js.map +0 -1
  480. package/dist/src/form/useNumberField.js.map +0 -1
  481. package/dist/src/form/useRadioGroup.js.map +0 -1
  482. package/dist/src/form/useRangeSlider.js.map +0 -1
  483. package/dist/src/form/useResizingTextArea.js.map +0 -1
  484. package/dist/src/form/useSlider.js.map +0 -1
  485. package/dist/src/form/useTextField.js.map +0 -1
  486. package/dist/src/form/utils.js.map +0 -1
  487. package/dist/src/form/validation.js.map +0 -1
  488. package/dist/src/hoverMode/useHoverMode.js.map +0 -1
  489. package/dist/src/hoverMode/useHoverModeProvider.js.map +0 -1
  490. package/dist/src/icon/FontIcon.js.map +0 -1
  491. package/dist/src/icon/IconRotator.js.map +0 -1
  492. package/dist/src/icon/MaterialIcon.js.map +0 -1
  493. package/dist/src/icon/MaterialSymbol.js.map +0 -1
  494. package/dist/src/icon/SVGIcon.js.map +0 -1
  495. package/dist/src/icon/TextIconSpacing.js.map +0 -1
  496. package/dist/src/icon/iconConfig.js.map +0 -1
  497. package/dist/src/icon/material.js.map +0 -1
  498. package/dist/src/icon/materialConfig.js.map +0 -1
  499. package/dist/src/icon/styles.js.map +0 -1
  500. package/dist/src/index.js.map +0 -1
  501. package/dist/src/interaction/Ripple.js.map +0 -1
  502. package/dist/src/interaction/RippleContainer.js.map +0 -1
  503. package/dist/src/interaction/UserInteractionModeProvider.js.map +0 -1
  504. package/dist/src/interaction/config.js.map +0 -1
  505. package/dist/src/interaction/types.js.map +0 -1
  506. package/dist/src/interaction/useElementInteraction.js.map +0 -1
  507. package/dist/src/interaction/useHigherContrastChildren.js.map +0 -1
  508. package/dist/src/interaction/utils.js.map +0 -1
  509. package/dist/src/layout/LayoutAppBar.js.map +0 -1
  510. package/dist/src/layout/LayoutNav.js.map +0 -1
  511. package/dist/src/layout/LayoutWindowSplitter.js.map +0 -1
  512. package/dist/src/layout/Main.js.map +0 -1
  513. package/dist/src/layout/layoutNavStyles.js.map +0 -1
  514. package/dist/src/layout/layoutWindowSplitterStyles.js.map +0 -1
  515. package/dist/src/layout/mainStyles.js.map +0 -1
  516. package/dist/src/layout/useExpandableLayout.js.map +0 -1
  517. package/dist/src/layout/useHorizontalLayoutTransition.js.map +0 -1
  518. package/dist/src/layout/useLayoutAppBarHeight.js.map +0 -1
  519. package/dist/src/layout/useLayoutTree.js.map +0 -1
  520. package/dist/src/layout/useLayoutWindowSplitter.js.map +0 -1
  521. package/dist/src/layout/useMainTabIndex.js.map +0 -1
  522. package/dist/src/layout/useResizableLayout.js.map +0 -1
  523. package/dist/src/layout/useTemporaryLayout.js.map +0 -1
  524. package/dist/src/link/Link.js.map +0 -1
  525. package/dist/src/link/SkipToMainContent.js.map +0 -1
  526. package/dist/src/link/styles.js.map +0 -1
  527. package/dist/src/list/List.js.map +0 -1
  528. package/dist/src/list/ListItem.js.map +0 -1
  529. package/dist/src/list/ListItemAddon.js.map +0 -1
  530. package/dist/src/list/ListItemChildren.js.map +0 -1
  531. package/dist/src/list/ListItemLink.js.map +0 -1
  532. package/dist/src/list/ListItemText.js.map +0 -1
  533. package/dist/src/list/ListSubheader.js.map +0 -1
  534. package/dist/src/list/getListItemHeight.js.map +0 -1
  535. package/dist/src/list/listItemStyles.js.map +0 -1
  536. package/dist/src/list/types.js.map +0 -1
  537. package/dist/src/media-queries/AppSizeProvider.js.map +0 -1
  538. package/dist/src/media-queries/appSize.js.map +0 -1
  539. package/dist/src/media-queries/useMediaQuery.js.map +0 -1
  540. package/dist/src/menu/DropdownMenu.js.map +0 -1
  541. package/dist/src/menu/Menu.js.map +0 -1
  542. package/dist/src/menu/MenuBar.js.map +0 -1
  543. package/dist/src/menu/MenuButton.js.map +0 -1
  544. package/dist/src/menu/MenuConfigurationProvider.js.map +0 -1
  545. package/dist/src/menu/MenuItem.js.map +0 -1
  546. package/dist/src/menu/MenuItemButton.js.map +0 -1
  547. package/dist/src/menu/MenuItemGroup.js.map +0 -1
  548. package/dist/src/menu/MenuItemSeparator.js.map +0 -1
  549. package/dist/src/menu/MenuSheet.js.map +0 -1
  550. package/dist/src/menu/MenuVisibilityProvider.js.map +0 -1
  551. package/dist/src/menu/MenuWidget.js.map +0 -1
  552. package/dist/src/menu/MenuWidgetKeyboardProvider.js.map +0 -1
  553. package/dist/src/menu/useContextMenu.js.map +0 -1
  554. package/dist/src/menu/useMenuBarProvider.js.map +0 -1
  555. package/dist/src/menu/utils.js.map +0 -1
  556. package/dist/src/movement/constants.js.map +0 -1
  557. package/dist/src/movement/findMatchIndex.js.map +0 -1
  558. package/dist/src/movement/types.js.map +0 -1
  559. package/dist/src/movement/useKeyboardMovementProvider.js.map +0 -1
  560. package/dist/src/movement/utils.js.map +0 -1
  561. package/dist/src/overlay/Overlay.js.map +0 -1
  562. package/dist/src/overlay/overlayStyles.js.map +0 -1
  563. package/dist/src/portal/Portal.js.map +0 -1
  564. package/dist/src/portal/PortalContainerProvider.js.map +0 -1
  565. package/dist/src/positioning/constants.js.map +0 -1
  566. package/dist/src/positioning/createHorizontalPosition.js.map +0 -1
  567. package/dist/src/positioning/createVerticalPosition.js.map +0 -1
  568. package/dist/src/positioning/getFixedPosition.js.map +0 -1
  569. package/dist/src/positioning/types.js.map +0 -1
  570. package/dist/src/positioning/useFixedPositioning.js.map +0 -1
  571. package/dist/src/positioning/utils.js.map +0 -1
  572. package/dist/src/progress/CircularProgress.js.map +0 -1
  573. package/dist/src/progress/LinearProgress.js.map +0 -1
  574. package/dist/src/progress/getProgressA11y.js.map +0 -1
  575. package/dist/src/progress/types.js.map +0 -1
  576. package/dist/src/responsive-item/ResponsiveItemContainer.js.map +0 -1
  577. package/dist/src/responsive-item/ResponsiveItemOverlay.js.map +0 -1
  578. package/dist/src/responsive-item/styles.js.map +0 -1
  579. package/dist/src/scroll/ScrollLock.js.map +0 -1
  580. package/dist/src/scroll/getScrollbarWidth.js.map +0 -1
  581. package/dist/src/scroll/useScrollLock.js.map +0 -1
  582. package/dist/src/segmented-button/SegmentedButton.js.map +0 -1
  583. package/dist/src/segmented-button/SegmentedButtonContainer.js.map +0 -1
  584. package/dist/src/segmented-button/segmentedButtonContainerStyles.js.map +0 -1
  585. package/dist/src/segmented-button/segmentedButtonStyles.js.map +0 -1
  586. package/dist/src/sheet/Sheet.js.map +0 -1
  587. package/dist/src/sheet/styles.js.map +0 -1
  588. package/dist/src/snackbar/DefaultToastRenderer.js.map +0 -1
  589. package/dist/src/snackbar/Snackbar.js.map +0 -1
  590. package/dist/src/snackbar/Toast.js.map +0 -1
  591. package/dist/src/snackbar/ToastActionButton.js.map +0 -1
  592. package/dist/src/snackbar/ToastCloseButton.js.map +0 -1
  593. package/dist/src/snackbar/ToastContent.js.map +0 -1
  594. package/dist/src/snackbar/ToastManager.js.map +0 -1
  595. package/dist/src/snackbar/ToastManagerProvider.js.map +0 -1
  596. package/dist/src/snackbar/snackbarStyles.js.map +0 -1
  597. package/dist/src/snackbar/toastContentStyles.js.map +0 -1
  598. package/dist/src/snackbar/toastStyles.js.map +0 -1
  599. package/dist/src/snackbar/useCurrentToastActions.js.map +0 -1
  600. package/dist/src/suspense/CircularProgressSuspense.js.map +0 -1
  601. package/dist/src/suspense/NullSuspense.js.map +0 -1
  602. package/dist/src/table/Table.js.map +0 -1
  603. package/dist/src/table/TableBody.js.map +0 -1
  604. package/dist/src/table/TableCell.js.map +0 -1
  605. package/dist/src/table/TableCellContent.js.map +0 -1
  606. package/dist/src/table/TableCheckbox.js.map +0 -1
  607. package/dist/src/table/TableConfigurationProvider.js.map +0 -1
  608. package/dist/src/table/TableContainer.js.map +0 -1
  609. package/dist/src/table/TableContainerProvider.js.map +0 -1
  610. package/dist/src/table/TableFooter.js.map +0 -1
  611. package/dist/src/table/TableHeader.js.map +0 -1
  612. package/dist/src/table/TableRadio.js.map +0 -1
  613. package/dist/src/table/TableRow.js.map +0 -1
  614. package/dist/src/table/tableCellStyles.js.map +0 -1
  615. package/dist/src/table/tableContainerStyles.js.map +0 -1
  616. package/dist/src/table/tableFooterStyles.js.map +0 -1
  617. package/dist/src/table/tableHeaderStyles.js.map +0 -1
  618. package/dist/src/table/tableRowStyles.js.map +0 -1
  619. package/dist/src/table/tableStyles.js.map +0 -1
  620. package/dist/src/table/types.js.map +0 -1
  621. package/dist/src/tabs/Tab.js.map +0 -1
  622. package/dist/src/tabs/TabList.js.map +0 -1
  623. package/dist/src/tabs/TabListScrollButton.js.map +0 -1
  624. package/dist/src/tabs/tabIndicatorStyles.js.map +0 -1
  625. package/dist/src/tabs/tabListScrollButtonStyles.js.map +0 -1
  626. package/dist/src/tabs/tabListStyles.js.map +0 -1
  627. package/dist/src/tabs/tabStyles.js.map +0 -1
  628. package/dist/src/tabs/useTabList.js.map +0 -1
  629. package/dist/src/tabs/useTabs.js.map +0 -1
  630. package/dist/src/tabs/utils.js.map +0 -1
  631. package/dist/src/test-utils/IntersectionObserver.js.map +0 -1
  632. package/dist/src/test-utils/ResizeObserver.js.map +0 -1
  633. package/dist/src/test-utils/data-testid.js.map +0 -1
  634. package/dist/src/test-utils/index.js.map +0 -1
  635. package/dist/src/test-utils/jest-setup.js.map +0 -1
  636. package/dist/src/test-utils/matchMedia.js.map +0 -1
  637. package/dist/src/test-utils/polyfills/IntersectionObserver.js.map +0 -1
  638. package/dist/src/test-utils/polyfills/ResizeObserver.js.map +0 -1
  639. package/dist/src/test-utils/polyfills/index.js.map +0 -1
  640. package/dist/src/test-utils/polyfills/matchMedia.js.map +0 -1
  641. package/dist/src/test-utils/polyfills/offsetParent.js.map +0 -1
  642. package/dist/src/test-utils/polyfills/scrollIntoView.js.map +0 -1
  643. package/dist/src/test-utils/render.js.map +0 -1
  644. package/dist/src/test-utils/timers.js.map +0 -1
  645. package/dist/src/theme/LocalStorageColorSchemeProvider.js.map +0 -1
  646. package/dist/src/theme/ThemeProvider.js.map +0 -1
  647. package/dist/src/theme/colors.js.map +0 -1
  648. package/dist/src/theme/cssVars.js.map +0 -1
  649. package/dist/src/theme/types.js.map +0 -1
  650. package/dist/src/theme/useCSSVariables.js.map +0 -1
  651. package/dist/src/theme/useColorScheme.js.map +0 -1
  652. package/dist/src/theme/useColorSchemeMetaTag.js.map +0 -1
  653. package/dist/src/theme/useColorSchemeProvider.js.map +0 -1
  654. package/dist/src/theme/usePrefersColorScheme.js.map +0 -1
  655. package/dist/src/theme/utils.js.map +0 -1
  656. package/dist/src/tooltip/Tooltip.js.map +0 -1
  657. package/dist/src/tooltip/TooltipHoverModeProvider.js.map +0 -1
  658. package/dist/src/tooltip/constants.js.map +0 -1
  659. package/dist/src/tooltip/tooltipStyles.js.map +0 -1
  660. package/dist/src/tooltip/useTooltip.js.map +0 -1
  661. package/dist/src/tooltip/useTooltipPosition.js.map +0 -1
  662. package/dist/src/tooltip/utils.js.map +0 -1
  663. package/dist/src/transition/CSSTransition.js.map +0 -1
  664. package/dist/src/transition/Collapse.js.map +0 -1
  665. package/dist/src/transition/CrossFade.js.map +0 -1
  666. package/dist/src/transition/ScaleTransition.js.map +0 -1
  667. package/dist/src/transition/SkeletonPlaceholder.js.map +0 -1
  668. package/dist/src/transition/Slide.js.map +0 -1
  669. package/dist/src/transition/SlideContainer.js.map +0 -1
  670. package/dist/src/transition/collapseStyles.js.map +0 -1
  671. package/dist/src/transition/config.js.map +0 -1
  672. package/dist/src/transition/maxWidthTransition.js.map +0 -1
  673. package/dist/src/transition/skeletonPlaceholderUtils.js.map +0 -1
  674. package/dist/src/transition/types.js.map +0 -1
  675. package/dist/src/transition/useCSSTransition.js.map +0 -1
  676. package/dist/src/transition/useCarousel.js.map +0 -1
  677. package/dist/src/transition/useCollapseTransition.js.map +0 -1
  678. package/dist/src/transition/useCrossFadeTransition.js.map +0 -1
  679. package/dist/src/transition/useMaxWidthTransition.js.map +0 -1
  680. package/dist/src/transition/useScaleTransition.js.map +0 -1
  681. package/dist/src/transition/useSkeletonPlaceholder.js.map +0 -1
  682. package/dist/src/transition/useSlideTransition.js.map +0 -1
  683. package/dist/src/transition/useTransition.js.map +0 -1
  684. package/dist/src/transition/utils.js.map +0 -1
  685. package/dist/src/tree/DefaultTreeItemRenderer.js.map +0 -1
  686. package/dist/src/tree/Tree.js.map +0 -1
  687. package/dist/src/tree/TreeGroup.js.map +0 -1
  688. package/dist/src/tree/TreeItem.js.map +0 -1
  689. package/dist/src/tree/TreeItemExpander.js.map +0 -1
  690. package/dist/src/tree/TreeProvider.js.map +0 -1
  691. package/dist/src/tree/styles.js.map +0 -1
  692. package/dist/src/tree/types.js.map +0 -1
  693. package/dist/src/tree/useTree.js.map +0 -1
  694. package/dist/src/tree/useTreeExpansion.js.map +0 -1
  695. package/dist/src/tree/useTreeItems.js.map +0 -1
  696. package/dist/src/tree/useTreeMovement.js.map +0 -1
  697. package/dist/src/tree/useTreeSelection.js.map +0 -1
  698. package/dist/src/tree/utils.js.map +0 -1
  699. package/dist/src/types.js.map +0 -1
  700. package/dist/src/typography/SrOnly.js.map +0 -1
  701. package/dist/src/typography/TextContainer.js.map +0 -1
  702. package/dist/src/typography/Typography.js.map +0 -1
  703. package/dist/src/typography/WritingDirectionProvider.js.map +0 -1
  704. package/dist/src/useAsyncAction.js.map +0 -1
  705. package/dist/src/useDebouncedFunction.js.map +0 -1
  706. package/dist/src/useDropzone.js.map +0 -1
  707. package/dist/src/useElementSize.js.map +0 -1
  708. package/dist/src/useEnsuredId.js.map +0 -1
  709. package/dist/src/useEnsuredRef.js.map +0 -1
  710. package/dist/src/useEnsuredState.js.map +0 -1
  711. package/dist/src/useHtmlClassName.js.map +0 -1
  712. package/dist/src/useIntersectionObserver.js.map +0 -1
  713. package/dist/src/useIsomorphicLayoutEffect.js.map +0 -1
  714. package/dist/src/useLocalStorage.js.map +0 -1
  715. package/dist/src/useOrientation.js.map +0 -1
  716. package/dist/src/usePageInactive.js.map +0 -1
  717. package/dist/src/useResizeListener.js.map +0 -1
  718. package/dist/src/useResizeObserver.js.map +0 -1
  719. package/dist/src/useThrottledFunction.js.map +0 -1
  720. package/dist/src/useToggle.js.map +0 -1
  721. package/dist/src/useUnmounted.js.map +0 -1
  722. package/dist/src/useWindowSize.js.map +0 -1
  723. package/dist/src/utils/RenderRecursively.js.map +0 -1
  724. package/dist/src/utils/alphaNumericSort.js.map +0 -1
  725. package/dist/src/utils/applyRef.js.map +0 -1
  726. package/dist/src/utils/bem.js.map +0 -1
  727. package/dist/src/utils/filters.js.map +0 -1
  728. package/dist/src/utils/getClientPosition.js.map +0 -1
  729. package/dist/src/utils/getMiddleOfRange.js.map +0 -1
  730. package/dist/src/utils/getPercentage.js.map +0 -1
  731. package/dist/src/utils/getRangeDefaultValue.js.map +0 -1
  732. package/dist/src/utils/getRangeSteps.js.map +0 -1
  733. package/dist/src/utils/identity.js.map +0 -1
  734. package/dist/src/utils/isElementVisible.js.map +0 -1
  735. package/dist/src/utils/loop.js.map +0 -1
  736. package/dist/src/utils/nearest.js.map +0 -1
  737. package/dist/src/utils/parseCssLengthUnit.js.map +0 -1
  738. package/dist/src/utils/randomInt.js.map +0 -1
  739. package/dist/src/utils/wait.js.map +0 -1
  740. package/dist/src/utils/withinRange.js.map +0 -1
  741. package/dist/src/window-splitter/WindowSplitter.js.map +0 -1
  742. package/dist/src/window-splitter/useWindowSplitter.js.map +0 -1
  743. /package/dist/{src/CoreProviders.js → CoreProviders.js} +0 -0
  744. /package/dist/{src/NoSsr.js → NoSsr.js} +0 -0
  745. /package/dist/{src/SsrProvider.js → SsrProvider.js} +0 -0
  746. /package/dist/{src/app-bar → app-bar}/AppBar.js +0 -0
  747. /package/dist/{src/app-bar → app-bar}/AppBarTitle.js +0 -0
  748. /package/dist/{src/avatar → avatar}/Avatar.js +0 -0
  749. /package/dist/{src/avatar → avatar}/styles.js +0 -0
  750. /package/dist/{src/badge → badge}/Badge.js +0 -0
  751. /package/dist/{src/box → box}/Box.js +0 -0
  752. /package/dist/{src/box → box}/styles.js +0 -0
  753. /package/dist/{src/button → button}/AsyncButton.js +0 -0
  754. /package/dist/{src/button → button}/Button.js +0 -0
  755. /package/dist/{src/button → button}/ButtonUnstyled.js +0 -0
  756. /package/dist/{src/button → button}/FloatingActionButton.js +0 -0
  757. /package/dist/{src/button → button}/TooltippedButton.js +0 -0
  758. /package/dist/{src/button → button}/buttonStyles.js +0 -0
  759. /package/dist/{src/button → button}/buttonUnstyledStyles.js +0 -0
  760. /package/dist/{src/card → card}/Card.js +0 -0
  761. /package/dist/{src/card → card}/CardContent.js +0 -0
  762. /package/dist/{src/card → card}/CardFooter.js +0 -0
  763. /package/dist/{src/card → card}/CardHeader.js +0 -0
  764. /package/dist/{src/card → card}/CardSubtitle.js +0 -0
  765. /package/dist/{src/card → card}/CardTitle.js +0 -0
  766. /package/dist/{src/card → card}/ClickableCard.js +0 -0
  767. /package/dist/{src/card → card}/styles.js +0 -0
  768. /package/dist/{src/chip → chip}/Chip.js +0 -0
  769. /package/dist/{src/chip → chip}/styles.js +0 -0
  770. /package/dist/{src/cssUtils.js → cssUtils.js} +0 -0
  771. /package/dist/{src/delegateEvent.js → delegateEvent.js} +0 -0
  772. /package/dist/{src/dialog → dialog}/Dialog.js +0 -0
  773. /package/dist/{src/dialog → dialog}/DialogContainer.js +0 -0
  774. /package/dist/{src/dialog → dialog}/DialogContent.js +0 -0
  775. /package/dist/{src/dialog → dialog}/DialogFooter.js +0 -0
  776. /package/dist/{src/dialog → dialog}/DialogHeader.js +0 -0
  777. /package/dist/{src/dialog → dialog}/DialogTitle.js +0 -0
  778. /package/dist/{src/dialog → dialog}/FixedDialog.js +0 -0
  779. /package/dist/{src/dialog → dialog}/NestedDialogProvider.js +0 -0
  780. /package/dist/{src/dialog → dialog}/styles.js +0 -0
  781. /package/dist/{src/divider → divider}/Divider.js +0 -0
  782. /package/dist/{src/divider → divider}/styles.js +0 -0
  783. /package/dist/{src/draggable → draggable}/useDraggable.js +0 -0
  784. /package/dist/{src/draggable → draggable}/utils.js +0 -0
  785. /package/dist/{src/expansion-panel → expansion-panel}/ExpansionList.js +0 -0
  786. /package/dist/{src/expansion-panel → expansion-panel}/ExpansionPanel.js +0 -0
  787. /package/dist/{src/expansion-panel → expansion-panel}/ExpansionPanelHeader.js +0 -0
  788. /package/dist/{src/expansion-panel → expansion-panel}/useExpansionList.js +0 -0
  789. /package/dist/{src/expansion-panel → expansion-panel}/useExpansionPanels.js +0 -0
  790. /package/dist/{src/focus → focus}/useFocusContainer.js +0 -0
  791. /package/dist/{src/focus → focus}/utils.js +0 -0
  792. /package/dist/{src/form → form}/Checkbox.js +0 -0
  793. /package/dist/{src/form → form}/Fieldset.js +0 -0
  794. /package/dist/{src/form → form}/FileInput.js +0 -0
  795. /package/dist/{src/form → form}/Form.js +0 -0
  796. /package/dist/{src/form → form}/FormMessage.js +0 -0
  797. /package/dist/{src/form → form}/FormMessageContainer.js +0 -0
  798. /package/dist/{src/form → form}/FormMessageCounter.js +0 -0
  799. /package/dist/{src/form → form}/InputToggle.js +0 -0
  800. /package/dist/{src/form → form}/InputToggleIcon.js +0 -0
  801. /package/dist/{src/form → form}/Label.js +0 -0
  802. /package/dist/{src/form → form}/Legend.js +0 -0
  803. /package/dist/{src/form → form}/MenuItemCheckbox.js +0 -0
  804. /package/dist/{src/form → form}/MenuItemFileInput.js +0 -0
  805. /package/dist/{src/form → form}/MenuItemInputToggle.js +0 -0
  806. /package/dist/{src/form → form}/MenuItemRadio.js +0 -0
  807. /package/dist/{src/form → form}/MenuItemSwitch.js +0 -0
  808. /package/dist/{src/form → form}/MenuItemTextField.js +0 -0
  809. /package/dist/{src/form → form}/NativeSelect.js +0 -0
  810. /package/dist/{src/form → form}/OptGroup.js +0 -0
  811. /package/dist/{src/form → form}/Option.js +0 -0
  812. /package/dist/{src/form → form}/Password.js +0 -0
  813. /package/dist/{src/form → form}/Radio.js +0 -0
  814. /package/dist/{src/form → form}/Select.js +0 -0
  815. /package/dist/{src/form → form}/SelectValue.js +0 -0
  816. /package/dist/{src/form → form}/Slider.js +0 -0
  817. /package/dist/{src/form → form}/SliderContainer.js +0 -0
  818. /package/dist/{src/form → form}/SliderMark.js +0 -0
  819. /package/dist/{src/form → form}/SliderMarkLabel.js +0 -0
  820. /package/dist/{src/form → form}/SliderThumb.js +0 -0
  821. /package/dist/{src/form → form}/SliderTrack.js +0 -0
  822. /package/dist/{src/form → form}/SliderValueMarks.js +0 -0
  823. /package/dist/{src/form → form}/SliderValueTooltip.js +0 -0
  824. /package/dist/{src/form → form}/Switch.js +0 -0
  825. /package/dist/{src/form → form}/SwitchTrack.js +0 -0
  826. /package/dist/{src/form → form}/TextArea.js +0 -0
  827. /package/dist/{src/form → form}/TextField.js +0 -0
  828. /package/dist/{src/form → form}/TextFieldAddon.js +0 -0
  829. /package/dist/{src/form → form}/TextFieldContainer.js +0 -0
  830. /package/dist/{src/form → form}/TextFieldContainerStyles.js +0 -0
  831. /package/dist/{src/form → form}/fileUtils.js +0 -0
  832. /package/dist/{src/form → form}/formConfig.js +0 -0
  833. /package/dist/{src/form → form}/formMessageStyles.js +0 -0
  834. /package/dist/{src/form → form}/inputToggleStyles.js +0 -0
  835. /package/dist/{src/form → form}/nativeSelectStyles.js +0 -0
  836. /package/dist/{src/form → form}/optionStyles.js +0 -0
  837. /package/dist/{src/form → form}/passwordStyles.js +0 -0
  838. /package/dist/{src/form → form}/selectStyles.js +0 -0
  839. /package/dist/{src/form → form}/selectUtils.js +0 -0
  840. /package/dist/{src/form → form}/sliderUtils.js +0 -0
  841. /package/dist/{src/form → form}/switchStyles.js +0 -0
  842. /package/dist/{src/form → form}/textAreaStyles.js +0 -0
  843. /package/dist/{src/form → form}/textFieldStyles.js +0 -0
  844. /package/dist/{src/form → form}/types.js +0 -0
  845. /package/dist/{src/form → form}/useCheckboxGroup.js +0 -0
  846. /package/dist/{src/form → form}/useFileUpload.js +0 -0
  847. /package/dist/{src/form → form}/useListboxProvider.js +0 -0
  848. /package/dist/{src/form → form}/useNumberField.js +0 -0
  849. /package/dist/{src/form → form}/useRadioGroup.js +0 -0
  850. /package/dist/{src/form → form}/useRangeSlider.js +0 -0
  851. /package/dist/{src/form → form}/useResizingTextArea.js +0 -0
  852. /package/dist/{src/form → form}/useSlider.js +0 -0
  853. /package/dist/{src/form → form}/useTextField.js +0 -0
  854. /package/dist/{src/form → form}/utils.js +0 -0
  855. /package/dist/{src/form → form}/validation.js +0 -0
  856. /package/dist/{src/hoverMode → hoverMode}/useHoverMode.js +0 -0
  857. /package/dist/{src/hoverMode → hoverMode}/useHoverModeProvider.js +0 -0
  858. /package/dist/{src/icon → icon}/FontIcon.js +0 -0
  859. /package/dist/{src/icon → icon}/IconRotator.js +0 -0
  860. /package/dist/{src/icon → icon}/MaterialIcon.js +0 -0
  861. /package/dist/{src/icon → icon}/MaterialSymbol.js +0 -0
  862. /package/dist/{src/icon → icon}/SVGIcon.js +0 -0
  863. /package/dist/{src/icon → icon}/TextIconSpacing.js +0 -0
  864. /package/dist/{src/icon → icon}/iconConfig.js +0 -0
  865. /package/dist/{src/icon → icon}/material.js +0 -0
  866. /package/dist/{src/icon → icon}/materialConfig.js +0 -0
  867. /package/dist/{src/icon → icon}/styles.js +0 -0
  868. /package/dist/{src/index.js → index.js} +0 -0
  869. /package/dist/{src/interaction → interaction}/Ripple.js +0 -0
  870. /package/dist/{src/interaction → interaction}/RippleContainer.js +0 -0
  871. /package/dist/{src/interaction → interaction}/UserInteractionModeProvider.js +0 -0
  872. /package/dist/{src/interaction → interaction}/config.js +0 -0
  873. /package/dist/{src/interaction → interaction}/types.js +0 -0
  874. /package/dist/{src/interaction → interaction}/useElementInteraction.js +0 -0
  875. /package/dist/{src/interaction → interaction}/useHigherContrastChildren.js +0 -0
  876. /package/dist/{src/interaction → interaction}/utils.js +0 -0
  877. /package/dist/{src/layout → layout}/LayoutAppBar.js +0 -0
  878. /package/dist/{src/layout → layout}/LayoutNav.js +0 -0
  879. /package/dist/{src/layout → layout}/LayoutWindowSplitter.js +0 -0
  880. /package/dist/{src/layout → layout}/Main.js +0 -0
  881. /package/dist/{src/layout → layout}/layoutNavStyles.js +0 -0
  882. /package/dist/{src/layout → layout}/layoutWindowSplitterStyles.js +0 -0
  883. /package/dist/{src/layout → layout}/mainStyles.js +0 -0
  884. /package/dist/{src/layout → layout}/useExpandableLayout.js +0 -0
  885. /package/dist/{src/layout → layout}/useHorizontalLayoutTransition.js +0 -0
  886. /package/dist/{src/layout → layout}/useLayoutAppBarHeight.js +0 -0
  887. /package/dist/{src/layout → layout}/useLayoutTree.js +0 -0
  888. /package/dist/{src/layout → layout}/useLayoutWindowSplitter.js +0 -0
  889. /package/dist/{src/layout → layout}/useMainTabIndex.js +0 -0
  890. /package/dist/{src/layout → layout}/useResizableLayout.js +0 -0
  891. /package/dist/{src/layout → layout}/useTemporaryLayout.js +0 -0
  892. /package/dist/{src/link → link}/Link.js +0 -0
  893. /package/dist/{src/link → link}/SkipToMainContent.js +0 -0
  894. /package/dist/{src/link → link}/styles.js +0 -0
  895. /package/dist/{src/list → list}/List.js +0 -0
  896. /package/dist/{src/list → list}/ListItem.js +0 -0
  897. /package/dist/{src/list → list}/ListItemAddon.js +0 -0
  898. /package/dist/{src/list → list}/ListItemChildren.js +0 -0
  899. /package/dist/{src/list → list}/ListItemLink.js +0 -0
  900. /package/dist/{src/list → list}/ListItemText.js +0 -0
  901. /package/dist/{src/list → list}/ListSubheader.js +0 -0
  902. /package/dist/{src/list → list}/getListItemHeight.js +0 -0
  903. /package/dist/{src/list → list}/listItemStyles.js +0 -0
  904. /package/dist/{src/list → list}/types.js +0 -0
  905. /package/dist/{src/media-queries → media-queries}/AppSizeProvider.js +0 -0
  906. /package/dist/{src/media-queries → media-queries}/appSize.js +0 -0
  907. /package/dist/{src/media-queries → media-queries}/useMediaQuery.js +0 -0
  908. /package/dist/{src/menu → menu}/DropdownMenu.js +0 -0
  909. /package/dist/{src/menu → menu}/Menu.js +0 -0
  910. /package/dist/{src/menu → menu}/MenuBar.js +0 -0
  911. /package/dist/{src/menu → menu}/MenuButton.js +0 -0
  912. /package/dist/{src/menu → menu}/MenuConfigurationProvider.js +0 -0
  913. /package/dist/{src/menu → menu}/MenuItem.js +0 -0
  914. /package/dist/{src/menu → menu}/MenuItemButton.js +0 -0
  915. /package/dist/{src/menu → menu}/MenuItemGroup.js +0 -0
  916. /package/dist/{src/menu → menu}/MenuItemSeparator.js +0 -0
  917. /package/dist/{src/menu → menu}/MenuSheet.js +0 -0
  918. /package/dist/{src/menu → menu}/MenuVisibilityProvider.js +0 -0
  919. /package/dist/{src/menu → menu}/MenuWidget.js +0 -0
  920. /package/dist/{src/menu → menu}/MenuWidgetKeyboardProvider.js +0 -0
  921. /package/dist/{src/menu → menu}/useContextMenu.js +0 -0
  922. /package/dist/{src/menu → menu}/useMenuBarProvider.js +0 -0
  923. /package/dist/{src/menu → menu}/utils.js +0 -0
  924. /package/dist/{src/movement → movement}/constants.js +0 -0
  925. /package/dist/{src/movement → movement}/findMatchIndex.js +0 -0
  926. /package/dist/{src/movement → movement}/types.js +0 -0
  927. /package/dist/{src/movement → movement}/useKeyboardMovementProvider.js +0 -0
  928. /package/dist/{src/movement → movement}/utils.js +0 -0
  929. /package/dist/{src/overlay → overlay}/Overlay.js +0 -0
  930. /package/dist/{src/overlay → overlay}/overlayStyles.js +0 -0
  931. /package/dist/{src/portal → portal}/Portal.js +0 -0
  932. /package/dist/{src/portal → portal}/PortalContainerProvider.js +0 -0
  933. /package/dist/{src/positioning → positioning}/constants.js +0 -0
  934. /package/dist/{src/positioning → positioning}/createHorizontalPosition.js +0 -0
  935. /package/dist/{src/positioning → positioning}/createVerticalPosition.js +0 -0
  936. /package/dist/{src/positioning → positioning}/getFixedPosition.js +0 -0
  937. /package/dist/{src/positioning → positioning}/types.js +0 -0
  938. /package/dist/{src/positioning → positioning}/useFixedPositioning.js +0 -0
  939. /package/dist/{src/positioning → positioning}/utils.js +0 -0
  940. /package/dist/{src/progress → progress}/CircularProgress.js +0 -0
  941. /package/dist/{src/progress → progress}/LinearProgress.js +0 -0
  942. /package/dist/{src/progress → progress}/getProgressA11y.js +0 -0
  943. /package/dist/{src/progress → progress}/types.js +0 -0
  944. /package/dist/{src/responsive-item → responsive-item}/ResponsiveItemContainer.js +0 -0
  945. /package/dist/{src/responsive-item → responsive-item}/ResponsiveItemOverlay.js +0 -0
  946. /package/dist/{src/responsive-item → responsive-item}/styles.js +0 -0
  947. /package/dist/{src/scroll → scroll}/ScrollLock.js +0 -0
  948. /package/dist/{src/scroll → scroll}/getScrollbarWidth.js +0 -0
  949. /package/dist/{src/scroll → scroll}/useScrollLock.js +0 -0
  950. /package/dist/{src/segmented-button → segmented-button}/SegmentedButton.js +0 -0
  951. /package/dist/{src/segmented-button → segmented-button}/SegmentedButtonContainer.js +0 -0
  952. /package/dist/{src/segmented-button → segmented-button}/segmentedButtonContainerStyles.js +0 -0
  953. /package/dist/{src/segmented-button → segmented-button}/segmentedButtonStyles.js +0 -0
  954. /package/dist/{src/sheet → sheet}/Sheet.js +0 -0
  955. /package/dist/{src/sheet → sheet}/styles.js +0 -0
  956. /package/dist/{src/snackbar → snackbar}/DefaultToastRenderer.js +0 -0
  957. /package/dist/{src/snackbar → snackbar}/Snackbar.js +0 -0
  958. /package/dist/{src/snackbar → snackbar}/Toast.js +0 -0
  959. /package/dist/{src/snackbar → snackbar}/ToastActionButton.js +0 -0
  960. /package/dist/{src/snackbar → snackbar}/ToastCloseButton.js +0 -0
  961. /package/dist/{src/snackbar → snackbar}/ToastContent.js +0 -0
  962. /package/dist/{src/snackbar → snackbar}/ToastManager.js +0 -0
  963. /package/dist/{src/snackbar → snackbar}/ToastManagerProvider.js +0 -0
  964. /package/dist/{src/snackbar → snackbar}/snackbarStyles.js +0 -0
  965. /package/dist/{src/snackbar → snackbar}/toastContentStyles.js +0 -0
  966. /package/dist/{src/snackbar → snackbar}/toastStyles.js +0 -0
  967. /package/dist/{src/snackbar → snackbar}/useCurrentToastActions.js +0 -0
  968. /package/dist/{src/suspense → suspense}/CircularProgressSuspense.js +0 -0
  969. /package/dist/{src/suspense → suspense}/NullSuspense.js +0 -0
  970. /package/dist/{src/table → table}/Table.js +0 -0
  971. /package/dist/{src/table → table}/TableBody.js +0 -0
  972. /package/dist/{src/table → table}/TableCell.js +0 -0
  973. /package/dist/{src/table → table}/TableCellContent.js +0 -0
  974. /package/dist/{src/table → table}/TableCheckbox.js +0 -0
  975. /package/dist/{src/table → table}/TableConfigurationProvider.js +0 -0
  976. /package/dist/{src/table → table}/TableContainer.js +0 -0
  977. /package/dist/{src/table → table}/TableContainerProvider.js +0 -0
  978. /package/dist/{src/table → table}/TableFooter.js +0 -0
  979. /package/dist/{src/table → table}/TableHeader.js +0 -0
  980. /package/dist/{src/table → table}/TableRadio.js +0 -0
  981. /package/dist/{src/table → table}/TableRow.js +0 -0
  982. /package/dist/{src/table → table}/tableCellStyles.js +0 -0
  983. /package/dist/{src/table → table}/tableContainerStyles.js +0 -0
  984. /package/dist/{src/table → table}/tableFooterStyles.js +0 -0
  985. /package/dist/{src/table → table}/tableHeaderStyles.js +0 -0
  986. /package/dist/{src/table → table}/tableRowStyles.js +0 -0
  987. /package/dist/{src/table → table}/tableStyles.js +0 -0
  988. /package/dist/{src/table → table}/types.js +0 -0
  989. /package/dist/{src/tabs → tabs}/Tab.js +0 -0
  990. /package/dist/{src/tabs → tabs}/TabList.js +0 -0
  991. /package/dist/{src/tabs → tabs}/TabListScrollButton.js +0 -0
  992. /package/dist/{src/tabs → tabs}/tabIndicatorStyles.js +0 -0
  993. /package/dist/{src/tabs → tabs}/tabListScrollButtonStyles.js +0 -0
  994. /package/dist/{src/tabs → tabs}/tabListStyles.js +0 -0
  995. /package/dist/{src/tabs → tabs}/tabStyles.js +0 -0
  996. /package/dist/{src/tabs → tabs}/useTabList.js +0 -0
  997. /package/dist/{src/tabs → tabs}/useTabs.js +0 -0
  998. /package/dist/{src/tabs → tabs}/utils.js +0 -0
  999. /package/dist/{src/test-utils → test-utils}/IntersectionObserver.js +0 -0
  1000. /package/dist/{src/test-utils → test-utils}/ResizeObserver.js +0 -0
  1001. /package/dist/{src/test-utils → test-utils}/data-testid.js +0 -0
  1002. /package/dist/{src/test-utils → test-utils}/index.js +0 -0
  1003. /package/dist/{src/test-utils → test-utils}/jest-setup.js +0 -0
  1004. /package/dist/{src/test-utils → test-utils}/matchMedia.js +0 -0
  1005. /package/dist/{src/test-utils → test-utils}/polyfills/IntersectionObserver.js +0 -0
  1006. /package/dist/{src/test-utils → test-utils}/polyfills/ResizeObserver.js +0 -0
  1007. /package/dist/{src/test-utils → test-utils}/polyfills/index.js +0 -0
  1008. /package/dist/{src/test-utils → test-utils}/polyfills/matchMedia.js +0 -0
  1009. /package/dist/{src/test-utils → test-utils}/polyfills/offsetParent.js +0 -0
  1010. /package/dist/{src/test-utils → test-utils}/polyfills/scrollIntoView.js +0 -0
  1011. /package/dist/{src/test-utils → test-utils}/render.js +0 -0
  1012. /package/dist/{src/test-utils → test-utils}/timers.js +0 -0
  1013. /package/dist/{src/theme → theme}/LocalStorageColorSchemeProvider.js +0 -0
  1014. /package/dist/{src/theme → theme}/ThemeProvider.js +0 -0
  1015. /package/dist/{src/theme → theme}/colors.js +0 -0
  1016. /package/dist/{src/theme → theme}/cssVars.js +0 -0
  1017. /package/dist/{src/theme → theme}/types.js +0 -0
  1018. /package/dist/{src/theme → theme}/useCSSVariables.js +0 -0
  1019. /package/dist/{src/theme → theme}/useColorScheme.js +0 -0
  1020. /package/dist/{src/theme → theme}/useColorSchemeMetaTag.js +0 -0
  1021. /package/dist/{src/theme → theme}/useColorSchemeProvider.js +0 -0
  1022. /package/dist/{src/theme → theme}/usePrefersColorScheme.js +0 -0
  1023. /package/dist/{src/theme → theme}/utils.js +0 -0
  1024. /package/dist/{src/tooltip → tooltip}/Tooltip.js +0 -0
  1025. /package/dist/{src/tooltip → tooltip}/TooltipHoverModeProvider.js +0 -0
  1026. /package/dist/{src/tooltip → tooltip}/constants.js +0 -0
  1027. /package/dist/{src/tooltip → tooltip}/tooltipStyles.js +0 -0
  1028. /package/dist/{src/tooltip → tooltip}/useTooltip.js +0 -0
  1029. /package/dist/{src/tooltip → tooltip}/useTooltipPosition.js +0 -0
  1030. /package/dist/{src/tooltip → tooltip}/utils.js +0 -0
  1031. /package/dist/{src/transition → transition}/CSSTransition.js +0 -0
  1032. /package/dist/{src/transition → transition}/Collapse.js +0 -0
  1033. /package/dist/{src/transition → transition}/CrossFade.js +0 -0
  1034. /package/dist/{src/transition → transition}/ScaleTransition.js +0 -0
  1035. /package/dist/{src/transition → transition}/SkeletonPlaceholder.js +0 -0
  1036. /package/dist/{src/transition → transition}/Slide.js +0 -0
  1037. /package/dist/{src/transition → transition}/SlideContainer.js +0 -0
  1038. /package/dist/{src/transition → transition}/collapseStyles.js +0 -0
  1039. /package/dist/{src/transition → transition}/config.js +0 -0
  1040. /package/dist/{src/transition → transition}/maxWidthTransition.js +0 -0
  1041. /package/dist/{src/transition → transition}/skeletonPlaceholderUtils.js +0 -0
  1042. /package/dist/{src/transition → transition}/types.js +0 -0
  1043. /package/dist/{src/transition → transition}/useCSSTransition.js +0 -0
  1044. /package/dist/{src/transition → transition}/useCarousel.js +0 -0
  1045. /package/dist/{src/transition → transition}/useCollapseTransition.js +0 -0
  1046. /package/dist/{src/transition → transition}/useCrossFadeTransition.js +0 -0
  1047. /package/dist/{src/transition → transition}/useMaxWidthTransition.js +0 -0
  1048. /package/dist/{src/transition → transition}/useScaleTransition.js +0 -0
  1049. /package/dist/{src/transition → transition}/useSkeletonPlaceholder.js +0 -0
  1050. /package/dist/{src/transition → transition}/useSlideTransition.js +0 -0
  1051. /package/dist/{src/transition → transition}/useTransition.js +0 -0
  1052. /package/dist/{src/transition → transition}/utils.js +0 -0
  1053. /package/dist/{src/tree → tree}/DefaultTreeItemRenderer.js +0 -0
  1054. /package/dist/{src/tree → tree}/Tree.js +0 -0
  1055. /package/dist/{src/tree → tree}/TreeGroup.js +0 -0
  1056. /package/dist/{src/tree → tree}/TreeItem.js +0 -0
  1057. /package/dist/{src/tree → tree}/TreeItemExpander.js +0 -0
  1058. /package/dist/{src/tree → tree}/TreeProvider.js +0 -0
  1059. /package/dist/{src/tree → tree}/styles.js +0 -0
  1060. /package/dist/{src/tree → tree}/types.js +0 -0
  1061. /package/dist/{src/tree → tree}/useTree.js +0 -0
  1062. /package/dist/{src/tree → tree}/useTreeExpansion.js +0 -0
  1063. /package/dist/{src/tree → tree}/useTreeItems.js +0 -0
  1064. /package/dist/{src/tree → tree}/useTreeMovement.js +0 -0
  1065. /package/dist/{src/tree → tree}/useTreeSelection.js +0 -0
  1066. /package/dist/{src/tree → tree}/utils.js +0 -0
  1067. /package/dist/{src/types.js → types.js} +0 -0
  1068. /package/dist/{src/typography → typography}/SrOnly.js +0 -0
  1069. /package/dist/{src/typography → typography}/TextContainer.js +0 -0
  1070. /package/dist/{src/typography → typography}/Typography.js +0 -0
  1071. /package/dist/{src/typography → typography}/WritingDirectionProvider.js +0 -0
  1072. /package/dist/{src/useAsyncAction.js → useAsyncAction.js} +0 -0
  1073. /package/dist/{src/useDebouncedFunction.js → useDebouncedFunction.js} +0 -0
  1074. /package/dist/{src/useDropzone.js → useDropzone.js} +0 -0
  1075. /package/dist/{src/useElementSize.js → useElementSize.js} +0 -0
  1076. /package/dist/{src/useEnsuredId.js → useEnsuredId.js} +0 -0
  1077. /package/dist/{src/useEnsuredRef.js → useEnsuredRef.js} +0 -0
  1078. /package/dist/{src/useEnsuredState.js → useEnsuredState.js} +0 -0
  1079. /package/dist/{src/useHtmlClassName.js → useHtmlClassName.js} +0 -0
  1080. /package/dist/{src/useIntersectionObserver.js → useIntersectionObserver.js} +0 -0
  1081. /package/dist/{src/useIsomorphicLayoutEffect.js → useIsomorphicLayoutEffect.js} +0 -0
  1082. /package/dist/{src/useLocalStorage.js → useLocalStorage.js} +0 -0
  1083. /package/dist/{src/useOrientation.js → useOrientation.js} +0 -0
  1084. /package/dist/{src/usePageInactive.js → usePageInactive.js} +0 -0
  1085. /package/dist/{src/useResizeListener.js → useResizeListener.js} +0 -0
  1086. /package/dist/{src/useResizeObserver.js → useResizeObserver.js} +0 -0
  1087. /package/dist/{src/useThrottledFunction.js → useThrottledFunction.js} +0 -0
  1088. /package/dist/{src/useToggle.js → useToggle.js} +0 -0
  1089. /package/dist/{src/useUnmounted.js → useUnmounted.js} +0 -0
  1090. /package/dist/{src/useWindowSize.js → useWindowSize.js} +0 -0
  1091. /package/dist/{src/utils → utils}/RenderRecursively.js +0 -0
  1092. /package/dist/{src/utils → utils}/alphaNumericSort.js +0 -0
  1093. /package/dist/{src/utils → utils}/applyRef.js +0 -0
  1094. /package/dist/{src/utils → utils}/bem.js +0 -0
  1095. /package/dist/{src/utils → utils}/filters.js +0 -0
  1096. /package/dist/{src/utils → utils}/getClientPosition.js +0 -0
  1097. /package/dist/{src/utils → utils}/getMiddleOfRange.js +0 -0
  1098. /package/dist/{src/utils → utils}/getPercentage.js +0 -0
  1099. /package/dist/{src/utils → utils}/getRangeDefaultValue.js +0 -0
  1100. /package/dist/{src/utils → utils}/getRangeSteps.js +0 -0
  1101. /package/dist/{src/utils → utils}/identity.js +0 -0
  1102. /package/dist/{src/utils → utils}/isElementVisible.js +0 -0
  1103. /package/dist/{src/utils → utils}/loop.js +0 -0
  1104. /package/dist/{src/utils → utils}/nearest.js +0 -0
  1105. /package/dist/{src/utils → utils}/parseCssLengthUnit.js +0 -0
  1106. /package/dist/{src/utils → utils}/randomInt.js +0 -0
  1107. /package/dist/{src/utils → utils}/wait.js +0 -0
  1108. /package/dist/{src/utils → utils}/withinRange.js +0 -0
  1109. /package/dist/{src/window-splitter → window-splitter}/WindowSplitter.js +0 -0
  1110. /package/dist/{src/window-splitter → window-splitter}/useWindowSplitter.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/fileUtils.ts"],"sourcesContent":["import { nanoid } from \"nanoid\";\nimport { type ChangeEventHandler, type DragEventHandler } from \"react\";\n\n/** @remarks \\@since 2.9.0 */\nexport interface BaseFileUploadStats {\n /**\n * A unique key associated with each upload generated by `nanoid`.\n */\n key: string;\n\n /**\n * The file instance that is being uploaded.\n */\n file: File;\n\n /**\n * The current upload progress as a percentage from 0 - 100 percent.\n */\n progress: number;\n}\n\n/** @remarks \\@since 2.9.0 */\nexport interface ProcessingFileUploadStats extends BaseFileUploadStats {\n status: \"pending\" | \"uploading\";\n}\n\n/** @remarks \\@since 2.9.0 */\nexport type FileReaderResult = FileReader[\"result\"];\n\n/** @remarks \\@since 2.9.0 */\nexport interface CompletedFileUploadStats extends BaseFileUploadStats {\n status: \"complete\";\n\n /**\n * The result after a `FileReader` has read a file completely.\n *\n * Note: This _should_ be an `ArrayBuffer` if the next step is to upload to a\n * server.\n *\n * @see {@link FileReaderParser}\n * @see {@link getFileParser}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/FileReader | FileReader}\n */\n result: FileReaderResult;\n}\n\n/** @remarks \\@since 2.9.0 */\nexport type FileUploadStats =\n | ProcessingFileUploadStats\n | CompletedFileUploadStats;\n\n/** @remarks \\@since 2.9.0 */\nexport type FileUploadStatus = FileUploadStats[\"status\"];\n\n/** @remarks \\@since 2.9.0 */\nexport interface FileUploadHandlers<E extends HTMLElement> {\n onDrop?: DragEventHandler<E>;\n onChange?: ChangeEventHandler<HTMLInputElement>;\n}\n\n/**\n * An error that will be created if a user tries dragging and dropping files\n * from a shared directory that they do not have access to. This error will not\n * occur much.\n *\n * @remarks \\@since 2.9.0\n */\nexport class FileAccessError extends Error {\n /**\n * A unique key generated by `nanoid` that can be used as a `React` key\n */\n public key: string;\n\n /**\n *\n * @param message - An optional message for the error.\n */\n constructor(message?: string) {\n super(message);\n this.key = nanoid();\n this.name = \"FileAccessError\";\n }\n}\n\n/**\n * An error that just requires a `File` to be passed as the first argument.\n *\n * @remarks \\@since 2.9.0\n */\nexport class GenericFileError extends Error {\n /**\n * A unique key generated by `nanoid` that can be used as a `React` key\n */\n public key: string;\n\n /**\n *\n * @param files - A list of files that caused the error.\n * @param reason - An optional reason for the error\n */\n constructor(\n public files: readonly File[],\n public reason?: string\n ) {\n super(\"Invalid files\");\n this.key = nanoid();\n this.name = \"GenericFileError\";\n }\n}\n\n/**\n * An error that is created during the upload process if the number of files\n * exceeds the {@link FileUploadOptions.maxFiles} amount.\n *\n * @remarks \\@since 2.9.0\n */\nexport class TooManyFilesError extends GenericFileError {\n /**\n *\n * @param files - The list of files that could not be uploaded due to the file\n * limit defined.\n * @param limit - The max limit of files allowed.\n */\n constructor(\n files: readonly File[],\n public limit: number\n ) {\n super(files, \"file limit\");\n this.name = \"TooManyFilesError\";\n }\n}\n\n/**\n * An error that will be created if a user tries to upload a file that\n * is either:\n * - less than the {@link FileValidationOptions.minFileSize}\n * - greater than the {@link FileValidationOptions.maxFileSize}\n * - including the file would be greater than the {@link FileValidationOptions.totalFileSize}\n *\n * @remarks \\@since 2.9.0\n */\nexport class FileSizeError extends GenericFileError {\n /**\n *\n * @param files - The list of files that have the file size error\n * @param type - The file size error type\n * @param limit - The number of bytes allowed based on the type\n */\n constructor(\n files: readonly File[],\n public type: \"min\" | \"max\" | \"total\",\n public limit: number\n ) {\n super(files, \"file size\");\n this.name = \"FileSizeError\";\n }\n}\n\n/**\n * An error that will be created if a user tries to upload a file that does not\n * end with one of the {@link FileValidationOptions.extensions}.\n *\n * @remarks \\@since 2.9.0\n */\nexport class FileExtensionError extends GenericFileError {\n /**\n *\n * @param files - The file that caused the error\n * @param extensions - The allowed list of file extensions\n */\n constructor(\n files: readonly File[],\n public extensions: readonly string[]\n ) {\n super(files, \"extension\");\n this.name = \"FileExtensionError\";\n }\n}\n\n/**\n * Mostly an internal type that is used to allow custom validation errors\n *\n * @remarks \\@since 2.9.0\n */\nexport type FileValidationError<E = GenericFileError> =\n | FileAccessError\n | TooManyFilesError\n | FileSizeError\n | FileExtensionError\n | E;\n\n/**\n * A simple type-guard that can be used to check if the\n * {@link FileValidationError} is the {@link GenericFileError} which can be\n * useful when displaying the errors to the user.\n *\n * @param error - The error to check\n * @returns true if the error is a {@link FileAccessError}\n */\nexport function isGenericFileError<CustomError extends {}>(\n error: FileValidationError<CustomError>\n): error is GenericFileError {\n return \"name\" in error && error.name === \"GenericFileError\";\n}\n\n/**\n * A simple type-guard that can be used to check if the\n * {@link FileValidationError} is the {@link FileAccessError} which can be\n * useful when displaying the errors to the user.\n *\n * @param error - The error to check\n * @returns true if the error is a {@link FileAccessError}\n */\nexport function isFileAccessError<CustomError extends {}>(\n error: FileValidationError<CustomError>\n): error is FileAccessError {\n return \"name\" in error && error.name === \"FileAccessError\";\n}\n\n/**\n * A simple type-guard that can be used to check if the\n * {@link FileValidationError} is the {@link TooManyFilesError} which can be\n * useful when displaying the errors to the user.\n *\n * @param error - The error to check\n * @returns true if the error is a {@link TooManyFilesError}\n */\nexport function isTooManyFilesError<CustomError extends {}>(\n error: FileValidationError<CustomError>\n): error is TooManyFilesError {\n return \"name\" in error && error.name === \"TooManyFilesError\";\n}\n\n/**\n * A simple type-guard that can be used to check if the\n * {@link FileValidationError} is the {@link FileSizeError} which can be\n * useful when displaying the errors to the user.\n *\n * @param error - The error to check\n * @returns true if the error is a {@link FileSizeError}\n */\nexport function isFileSizeError<CustomError extends {}>(\n error: FileValidationError<CustomError>\n): error is FileSizeError {\n return \"name\" in error && error.name === \"FileSizeError\";\n}\n\n/**\n * A simple type-guard that can be used to check if the\n * {@link FileValidationError} is the {@link FileExtensionError} which can be\n * useful when displaying the errors to the user.\n *\n * @param error - The error to check\n * @returns true if the error is a {@link FileExtensionError}\n */\nexport function isFileExtensionError<CustomError extends {}>(\n error: FileValidationError<CustomError>\n): error is FileExtensionError {\n return \"name\" in error && error.name === \"FileExtensionError\";\n}\n\n/**\n * This function is used to determine if a file should be added to the\n * {@link FileExtensionError}. The default implementation should work for most\n * use cases except when files that do not have extensions can be uploaded. i.e.\n * LICENSE files.\n *\n * @param file - The file being checked\n * @param extensionRegExp - A regex that will only be defined if the\n * `extensions` list had at least one value.\n * @param extensions - The list of extensions allowed\n * @returns true if the file has a valid name.\n * @remarks \\@since 3.1.0\n */\nexport type IsValidFileName = (\n file: File,\n extensionRegExp: RegExp | undefined,\n extensions: readonly string[]\n) => boolean;\n\n/**\n *\n * @defaultValue `matcher?.test(file.name) ?? true`\n * @remarks \\@since 3.1.0\n */\nexport const isValidFileName: IsValidFileName = (file, matcher) =>\n matcher?.test(file.name) ?? true;\n\n/** @remarks \\@since 2.9.0 */\nexport interface FileValidationOptions {\n /**\n * If the number of files should be limited, set this value to a number\n * greater than `0`.\n *\n * Note: This still allows \"infinite\" files when set to `0` since the\n * `<input>` element should normally be set to `disabled` if files should not\n * be able to be uploaded.\n *\n * @defaultValue `-1`\n */\n maxFiles?: number;\n\n /**\n * An optional minimum file size to enforce for each file. This will only be\n * used when it is greater than `0`.\n *\n * @defaultValue `-1`\n */\n minFileSize?: number;\n\n /**\n * An optional maximum file size to enforce for each file. This will only be\n * used when it is greater than `0`.\n *\n * @defaultValue `-1`\n */\n maxFileSize?: number;\n\n /**\n * An optional list of extensions to enforce when uploading files.\n *\n * Note: The extensions and file names will be compared ignoring case.\n *\n * @example\n * Only Allow Images\n * ```ts\n * const extensions = [\"png\", \"jpeg\", \"jpg\", \"gif\"];\n * ```\n */\n extensions?: readonly string[];\n\n /** {@inheritDoc IsValidFileName} */\n isValidFileName?: IsValidFileName;\n\n /**\n * An optional total file size to enforce when the {@link maxFiles} option is\n * not set to `1`.\n *\n * @defaultValue `-1`\n */\n totalFileSize?: number;\n}\n\n/** @remarks \\@since 2.9.0 */\nexport interface FilesValidationOptions\n extends Required<FileValidationOptions> {\n /**\n * The total number of bytes in the {@link FileUploadHookReturnValue.stats}\n * list. This is really just:\n *\n * ```ts\n * const totalBytes = stats.reduce((total, stat) => total + stat.file.size, 0);\n * ```\n */\n totalBytes: number;\n\n /**\n * The total number of files in the {@link FileUploadHookReturnValue.stats}.\n */\n totalFiles: number;\n}\n\n/** @remarks \\@since 2.9.0 */\nexport interface ValidatedFilesResult<CustomError> {\n /**\n * A filtered list of files that have been validated and can be queued for the\n * upload process.\n */\n pending: readonly File[];\n\n /**\n * A list of {@link FileValidationError} that occurred during the validation\n * step.\n *\n * Note: If an error has occurred, the file **should not** be added to the\n * {@link pending} list of files.\n */\n errors: readonly FileValidationError<CustomError>[];\n}\n\n/**\n * This function will be called whenever a file has been uploaded by the user\n * either through an `<input type=\"file\">` or drag and drop behavior.\n *\n * @example\n * Simple Example\n * ```ts\n * const validateFiles: FilesValidator = (files, options) => {\n * const invalid: File[] = [];\n * const pending: File[] = [];\n * for (const file of files) {\n * if (!/\\.(jpe?g|svg|png)$/i.test(name)) {\n * invalid.push(file);\n * } else {\n * pending.push(file);\n * }\n * }\n *\n * const errors: FileValidationError[] = [];\n * if (invalid.length) {\n * errors.push(new GenericFileError(invalid))\n * }\n *\n * return { pending, errors };\n * };\n * ```\n *\n * @typeparam E - An optional custom file validation error.\n * @param files - The list of files to check\n * @param options - The {@link FilesValidationOptions}\n * @returns the {@link ValidatedFilesResult}\n * @see {@link validateFiles} for the default implementation\n * @remarks \\@since 2.9.0\n */\nexport type FilesValidator<CustomError = never> = (\n files: readonly File[],\n options: FilesValidationOptions\n) => ValidatedFilesResult<CustomError>;\n\n/**\n * A pretty decent default implementation for validating files with the\n * {@link useFileUpload} that ensures the {@link FilesValidationOptions} are\n * enforced before allowing a file to be uploaded.\n *\n * @typeparam E - An optional custom file validation error.\n * @param files - The list of files to check\n * @param options - The {@link FilesValidationOptions}\n * @returns the {@link ValidatedFilesResult}\n * @remarks \\@since 2.9.0\n */\nexport function validateFiles<CustomError>(\n files: readonly File[],\n {\n maxFiles,\n extensions,\n minFileSize,\n maxFileSize,\n totalBytes,\n totalFiles,\n totalFileSize,\n isValidFileName,\n }: FilesValidationOptions\n): ValidatedFilesResult<CustomError> {\n const errors: FileValidationError<CustomError>[] = [];\n const pending: File[] = [];\n const extraFiles: File[] = [];\n const extensionRegExp =\n extensions.length > 0\n ? new RegExp(`\\\\.(${extensions.join(\"|\")})$`, \"i\")\n : undefined;\n\n let maxFilesReached = maxFiles > 0 && totalFiles >= maxFiles;\n let remainingBytes = totalFileSize - totalBytes;\n const extensionErrors: File[] = [];\n const minErrors: File[] = [];\n const maxErrors: File[] = [];\n const totalSizeErrors: File[] = [];\n for (let i = 0; i < files.length; i += 1) {\n const file = files[i];\n\n let valid = true;\n const { size } = file;\n if (!isValidFileName(file, extensionRegExp, extensions)) {\n valid = false;\n extensionErrors.push(file);\n }\n\n if (minFileSize > 0 && size < minFileSize) {\n valid = false;\n minErrors.push(file);\n }\n\n if (maxFileSize > 0 && size > maxFileSize) {\n valid = false;\n maxErrors.push(file);\n } else if (totalFileSize > 0 && remainingBytes - file.size < 0) {\n // don't want both errors displaying\n valid = false;\n totalSizeErrors.push(file);\n }\n\n if (maxFilesReached && valid) {\n extraFiles.push(file);\n } else if (!maxFilesReached && valid) {\n pending.push(file);\n remainingBytes -= file.size;\n maxFilesReached =\n maxFilesReached ||\n (maxFiles > 0 && totalFiles + pending.length >= maxFiles);\n }\n }\n\n if (extensionErrors.length) {\n errors.push(new FileExtensionError(extensionErrors, extensions));\n }\n\n if (minErrors.length) {\n errors.push(new FileSizeError(minErrors, \"min\", minFileSize));\n }\n\n if (maxErrors.length) {\n errors.push(new FileSizeError(maxErrors, \"max\", maxFileSize));\n }\n\n if (totalSizeErrors.length) {\n errors.push(new FileSizeError(totalSizeErrors, \"total\", totalFileSize));\n }\n\n if (extraFiles.length) {\n errors.push(new TooManyFilesError(extraFiles, maxFiles));\n }\n\n return { pending, errors };\n}\n\n/**\n * This will first check if the mime-type of the file starts with `text/` and\n * fallback to checking a few file names or extensions that should be considered\n * text.\n *\n * This function is not guaranteed to be 100% correct and is only useful if\n * trying to generate a preview of files uploaded to the browser.\n *\n * @param file - The file to check\n * @returns `true` if the file should be considered as a text-content file.\n * @remarks \\@since 2.9.0\n */\nexport function isTextFile(file: File): boolean {\n return /\\.((j|t)sx?|json|lock|hbs|ya?ml|log|txt|md)$/i.test(file.name);\n}\n\n/**\n * This will first check if the mime-type of the file starts with `text\\/` and\n * fallback to checking a few file names or extensions that should be considered\n * text.\n *\n * This function is not guaranteed to be 100% correct and is only useful if\n * trying to generate a preview of files uploaded to the browser.\n *\n * @param file - The file to check\n * @returns `true` if the file should be considered as a text content file.\n * @remarks \\@since 2.9.0\n */\nexport function isImageFile(file: File): boolean {\n return /\\.(a?png|avif|svg|tiff|gifv?|jpe?g)/i.test(file.name);\n}\n\n/**\n * This will first check if the mime-type of the file starts with `audio/` and\n * fallback to checking a few file names or extensions that should be considered\n * audio.\n *\n * This function is not guaranteed to be 100% correct and is only useful if\n * trying to generate a preview of files uploaded to the browser.\n *\n * @param file - The file to check\n * @returns `true` if the file should be considered as a audio content file.\n * @remarks \\@since 2.9.0\n */\nexport function isAudioFile(file: File): boolean {\n return /\\.(mp3|wav|ogg|m4p|flac)$/i.test(file.name);\n}\n\n/**\n * This will first check if the mime-type of the file starts with `video/` and\n * fallback to checking a few file names or extensions that should be considered\n * video.\n *\n * This function is not guaranteed to be 100% correct and is only useful if\n * trying to generate a preview of files uploaded to the browser.\n *\n * @param file - The file to check\n * @returns `true` if the file should be considered as a video content file.\n * @remarks \\@since 2.9.0\n */\nexport function isVideoFile(file: File): boolean {\n return /\\.(mkv|mpe?g|mov|avi|flv|webm|mp4)$/i.test(file.name);\n}\n\n/**\n * This function is not guaranteed to be 100% correct and is only useful if\n * trying to generate a preview of files uploaded to the browser.\n *\n * @param file - The file to check\n * @returns `true` if the file matches an image, audio, or video file.\n * @remarks \\@since 2.9.0\n */\nexport function isMediaFile(file: File): boolean {\n return isImageFile(file) || isAudioFile(file) || isVideoFile(file);\n}\n\n/**\n * One of the function names from a `FileReader` to upload a file to the\n * client.\n *\n * Note: If this file does not need to be previewed in the browser and will\n * immediately be uploaded to a server, use `readAsArrayBuffer`.\n *\n * @remarks \\@since 2.9.0\n */\nexport type FileReaderParser =\n | \"readAsText\"\n | \"readAsDataURL\"\n | \"readAsBinaryString\"\n | \"readAsArrayBuffer\";\n\n/**\n * A function that should return one of the {@link FileReaderParser} functions\n * to start uploading a file to the browser.\n *\n * @example\n * The Default File Upload Parser\n * ```ts\n * export const getFileParser: GetFileParser = (file) => {\n * if (isMediaFile(file)) {\n * return \"readAsDataURL\";\n * }\n *\n * if (isTextFile(file)) {\n * return \"readAsText\";\n * }\n *\n * return \"readAsArrayBuffer\";\n * };\n * ```\n *\n * @param file - The file to get a parser for\n * @returns the {@link FileReaderParser} string.\n * @remarks \\@since 2.9.0\n */\nexport type GetFileParser = (file: File) => FileReaderParser;\n\n/**\n * This function will attempt to read:\n * - media (image, audio, and video) files as a data url so they can be\n * previewed in `<img>`, `<audio>`, and `<video>` tags\n * - text files as plain text\n * - everything else as an `ArrayBuffer` which can be manually converted into a\n * data url if needed with `URL.createObjectURL`\n *\n * @remarks \\@since 2.9.0\n */\nexport const getFileParser: GetFileParser = (file) => {\n if (isMediaFile(file)) {\n return \"readAsDataURL\";\n }\n\n if (isTextFile(file)) {\n return \"readAsText\";\n }\n\n return \"readAsArrayBuffer\";\n};\n\n/** @remarks \\@since 2.9.0 */\nexport interface SplitFileUploads {\n readonly pending: readonly ProcessingFileUploadStats[];\n readonly uploading: readonly ProcessingFileUploadStats[];\n readonly complete: readonly CompletedFileUploadStats[];\n}\n\n/**\n * This util will split all the current upload stats by status.\n *\n * @param stats - The {@link FileUploadStats} list generally returned by the\n * {@link useFileUpload} hook.\n * @returns the {@link SplitFileUploads}.\n * @remarks \\@since 2.9.0\n */\nexport function getSplitFileUploads(\n stats: readonly FileUploadStats[]\n): SplitFileUploads {\n const pending: ProcessingFileUploadStats[] = [];\n const uploading: ProcessingFileUploadStats[] = [];\n const complete: CompletedFileUploadStats[] = [];\n stats.forEach((stat) => {\n if (stat.status === \"pending\") {\n pending.push(stat);\n } else if (stat.status === \"uploading\") {\n uploading.push(stat);\n } else if (stat.status === \"complete\") {\n complete.push(stat);\n } else {\n /* istanbul ignore next */\n throw new Error(\"Invalid upload stat\");\n }\n });\n\n return { pending, uploading, complete };\n}\n"],"names":["nanoid","FileAccessError","Error","constructor","message","key","name","GenericFileError","files","reason","TooManyFilesError","limit","FileSizeError","type","FileExtensionError","extensions","isGenericFileError","error","isFileAccessError","isTooManyFilesError","isFileSizeError","isFileExtensionError","isValidFileName","file","matcher","test","validateFiles","maxFiles","minFileSize","maxFileSize","totalBytes","totalFiles","totalFileSize","errors","pending","extraFiles","extensionRegExp","length","RegExp","join","undefined","maxFilesReached","remainingBytes","extensionErrors","minErrors","maxErrors","totalSizeErrors","i","valid","size","push","isTextFile","isImageFile","isAudioFile","isVideoFile","isMediaFile","getFileParser","getSplitFileUploads","stats","uploading","complete","forEach","stat","status"],"mappings":";;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@@
1
- {"version":3,"sources":["../../../src/form/formConfig.ts"],"sourcesContent":["import { type FormConfiguration } from \"./types.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport const FORM_CONFIG: FormConfiguration = {\n theme: \"outline\",\n underlineDirection: \"left\",\n uncontrolledToggles: true,\n};\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function getFormConfig<N extends keyof FormConfiguration>(\n name: N,\n override?: FormConfiguration[N]\n): FormConfiguration[N] {\n if (typeof override !== \"undefined\") {\n return override;\n }\n\n return FORM_CONFIG[name];\n}\n"],"names":["FORM_CONFIG","theme","underlineDirection","uncontrolledToggles","getFormConfig","name","override"],"mappings":"AAEA;;CAEC,GACD,OAAO,MAAMA,cAAiC;IAC5CC,OAAO;IACPC,oBAAoB;IACpBC,qBAAqB;AACvB,EAAE;AAEF;;CAEC,GACD,OAAO,SAASC,cACdC,IAAO,EACPC,QAA+B;IAE/B,IAAI,OAAOA,aAAa,aAAa;QACnC,OAAOA;IACT;IAEA,OAAON,WAAW,CAACK,KAAK;AAC1B"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/formMessageStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { type FormMessageClassNameOptions } from \"./types.js\";\n\nconst styles = bem(\"rmd-form-message\");\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function formMessage(options: FormMessageClassNameOptions = {}): string {\n const { className, error = false, theme = \"none\" } = options;\n\n return cnb(\n styles({ [theme]: theme !== \"none\" }),\n cssUtils({ textColor: error ? \"error\" : \"text-secondary\" }),\n className\n );\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface FormMessageTextClassNameOptions {\n className?: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function formMessageText(\n options: FormMessageTextClassNameOptions = {}\n): string {\n const { className } = options;\n\n return cnb(styles(\"message\"), className);\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface FormMessageCounterClassNameOptions {\n className?: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function formMessageCounter(\n options: FormMessageCounterClassNameOptions = {}\n): string {\n const { className } = options;\n\n return cnb(styles(\"counter\"), className);\n}\n"],"names":["cnb","cssUtils","bem","styles","formMessage","options","className","error","theme","textColor","formMessageText","formMessageCounter"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,GAAG,QAAQ,kBAAkB;AAGtC,MAAMC,SAASD,IAAI;AAEnB;;CAEC,GACD,OAAO,SAASE,YAAYC,UAAuC,CAAC,CAAC;IACnE,MAAM,EAAEC,SAAS,EAAEC,QAAQ,KAAK,EAAEC,QAAQ,MAAM,EAAE,GAAGH;IAErD,OAAOL,IACLG,OAAO;QAAE,CAACK,MAAM,EAAEA,UAAU;IAAO,IACnCP,SAAS;QAAEQ,WAAWF,QAAQ,UAAU;IAAiB,IACzDD;AAEJ;AAOA;;CAEC,GACD,OAAO,SAASI,gBACdL,UAA2C,CAAC,CAAC;IAE7C,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAOL,IAAIG,OAAO,YAAYG;AAChC;AAOA;;CAEC,GACD,OAAO,SAASK,mBACdN,UAA8C,CAAC,CAAC;IAEhD,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAOL,IAAIG,OAAO,YAAYG;AAChC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/inputToggleStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { type FormComponentStates } from \"./types.js\";\n\nconst styles = bem(\"rmd-input-toggle\");\n\n/**\n * The size to use for the `Checkbox` or `Radio` component. Each of these values\n * except for `\"auto\"` map to Sass variables:\n * - `\"small\"` - `$input-toggle-small-size`\n * - `\"dense\"` - `$input-toggle-dense-size`\n * - `\"normal\"` - `$input-toggle-large-size`\n * - `\"large\"` - `$input-toggle-large-size`\n *\n * When this is set to `\"auto\"`, the size will be determined by the current\n * `font-size` of the `Label` element.\n *\n * @remarks \\@since 6.0.0\n */\nexport type InputToggleSize = \"auto\" | \"small\" | \"dense\" | \"normal\" | \"large\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface InputToggleClassNameOptions\n extends Omit<FormComponentStates, \"readOnly\"> {\n className?: string;\n type: \"checkbox\" | \"radio\";\n\n /**\n * Set the icon size to `1em` to allow easy sizing through font size.\n *\n * @defaultValue `true`\n */\n em?: boolean;\n\n /**\n * @see {@link InputToggleSize}\n * @defaultValue `\"auto\"`\n */\n size?: InputToggleSize;\n\n uncontrolled?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function inputToggle(options: InputToggleClassNameOptions): string {\n const {\n className,\n em = true,\n type,\n size = \"auto\",\n error,\n active = false,\n disabled = false,\n uncontrolled,\n } = options;\n\n return cnb(\n `rmd-${type}`,\n styles({\n em,\n active: active && !disabled,\n disabled,\n small: size === \"small\",\n dense: size === \"dense\",\n normal: size === \"normal\",\n large: size === \"large\",\n uncontrolled,\n }),\n cssUtils({\n textColor: disabled ? \"text-disabled\" : error ? \"error\" : undefined,\n }),\n className\n );\n}\n"],"names":["cnb","cssUtils","bem","styles","inputToggle","options","className","em","type","size","error","active","disabled","uncontrolled","small","dense","normal","large","textColor","undefined"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,GAAG,QAAQ,kBAAkB;AAGtC,MAAMC,SAASD,IAAI;AAuCnB;;CAEC,GACD,OAAO,SAASE,YAAYC,OAAoC;IAC9D,MAAM,EACJC,SAAS,EACTC,KAAK,IAAI,EACTC,IAAI,EACJC,OAAO,MAAM,EACbC,KAAK,EACLC,SAAS,KAAK,EACdC,WAAW,KAAK,EAChBC,YAAY,EACb,GAAGR;IAEJ,OAAOL,IACL,CAAC,IAAI,EAAEQ,KAAK,CAAC,EACbL,OAAO;QACLI;QACAI,QAAQA,UAAU,CAACC;QACnBA;QACAE,OAAOL,SAAS;QAChBM,OAAON,SAAS;QAChBO,QAAQP,SAAS;QACjBQ,OAAOR,SAAS;QAChBI;IACF,IACAZ,SAAS;QACPiB,WAAWN,WAAW,kBAAkBF,QAAQ,UAAUS;IAC5D,IACAb;AAEJ"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/nativeSelectStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-native-select\");\nconst containerStyles = bem(\"rmd-native-select-container\");\n\n/** @remarks \\@since 6.0.0 */\nexport interface NativeSelectClassNameOptions {\n className?: string;\n\n /**\n * Set to `true` if using a custom icon instead of the default `<select>`\n * appearance.\n *\n * @defaultValue `false`\n */\n icon?: boolean;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport function nativeSelect(\n options: NativeSelectClassNameOptions = {}\n): string {\n const { className, icon = false } = options;\n\n return cnb(styles({ icon }), className);\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface NativeSelectContainerClassNameOptions {\n className?: string;\n label?: boolean;\n multiple?: boolean;\n underlined?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function nativeSelectContainer(\n options: NativeSelectContainerClassNameOptions = {}\n): string {\n const { className, label, multiple, underlined } = options;\n\n return cnb(\n containerStyles({\n multi: multiple,\n padded: label && multiple && !underlined,\n underline: multiple && underlined,\n \"underline-padded\": label && multiple && underlined,\n }),\n className\n );\n}\n"],"names":["cnb","bem","styles","containerStyles","nativeSelect","options","className","icon","nativeSelectContainer","label","multiple","underlined","multi","padded","underline"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AACnB,MAAME,kBAAkBF,IAAI;AAe5B,2BAA2B,GAC3B,OAAO,SAASG,aACdC,UAAwC,CAAC,CAAC;IAE1C,MAAM,EAAEC,SAAS,EAAEC,OAAO,KAAK,EAAE,GAAGF;IAEpC,OAAOL,IAAIE,OAAO;QAAEK;IAAK,IAAID;AAC/B;AAYA;;CAEC,GACD,OAAO,SAASE,sBACdH,UAAiD,CAAC,CAAC;IAEnD,MAAM,EAAEC,SAAS,EAAEG,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGN;IAEnD,OAAOL,IACLG,gBAAgB;QACdS,OAAOF;QACPG,QAAQJ,SAASC,YAAY,CAACC;QAC9BG,WAAWJ,YAAYC;QACvB,oBAAoBF,SAASC,YAAYC;IAC3C,IACAL;AAEJ"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/optionStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-option\");\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface OptionClassNameOptions {\n className?: string;\n icon: boolean;\n selected: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function option(options: OptionClassNameOptions): string {\n const { className, icon, selected } = options;\n\n return cnb(styles({ icon, selected }), className);\n}\n"],"names":["cnb","bem","styles","option","options","className","icon","selected"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAWnB;;CAEC,GACD,OAAO,SAASE,OAAOC,OAA+B;IACpD,MAAM,EAAEC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGH;IAEtC,OAAOJ,IAAIE,OAAO;QAAEI;QAAMC;IAAS,IAAIF;AACzC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/passwordStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-password\");\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface PasswordClassNameOptions {\n className?: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function password(options: PasswordClassNameOptions = {}): string {\n const { className } = options;\n\n return cnb(styles(), className);\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface PasswordInputClassNameOptions {\n className?: string;\n}\n\nexport function passwordInput(\n options: PasswordInputClassNameOptions = {}\n): string {\n const { className } = options;\n\n return cnb(styles(\"input\"), className);\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface PasswordInputToggleClassNameOptions {\n className?: string;\n}\n\nexport function passwordInputToggle(\n options: PasswordInputToggleClassNameOptions = {}\n): string {\n const { className } = options;\n\n return cnb(styles(\"toggle\"), className);\n}\n"],"names":["cnb","bem","styles","password","options","className","passwordInput","passwordInputToggle"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AASnB;;CAEC,GACD,OAAO,SAASE,SAASC,UAAoC,CAAC,CAAC;IAC7D,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAOJ,IAAIE,UAAUG;AACvB;AASA,OAAO,SAASC,cACdF,UAAyC,CAAC,CAAC;IAE3C,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAOJ,IAAIE,OAAO,UAAUG;AAC9B;AASA,OAAO,SAASE,oBACdH,UAA+C,CAAC,CAAC;IAEjD,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAOJ,IAAIE,OAAO,WAAWG;AAC/B"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/selectStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\nimport { type FormTheme } from \"./types.js\";\n\nconst styles = bem(\"rmd-select\");\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface SelectClassNameOptions {\n className?: string;\n /**\n * @defaultValue `\"outline\"`\n */\n theme?: FormTheme;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function select(options: SelectClassNameOptions = {}): string {\n const { className, theme = \"outline\" } = options;\n\n return cnb(\n styles({\n filled: theme === \"filled\",\n outline: theme === \"outline\",\n underline: theme === \"underline\",\n }),\n className\n );\n}\n"],"names":["cnb","bem","styles","select","options","className","theme","filled","outline","underline"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAGtC,MAAMC,SAASD,IAAI;AAanB;;CAEC,GACD,OAAO,SAASE,OAAOC,UAAkC,CAAC,CAAC;IACzD,MAAM,EAAEC,SAAS,EAAEC,QAAQ,SAAS,EAAE,GAAGF;IAEzC,OAAOJ,IACLE,OAAO;QACLK,QAAQD,UAAU;QAClBE,SAASF,UAAU;QACnBG,WAAWH,UAAU;IACvB,IACAD;AAEJ"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/selectUtils.ts"],"sourcesContent":["import { Children, isValidElement, type ReactNode } from \"react\";\nimport { type MenuItemProps } from \"../menu/MenuItem.js\";\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport interface SelectOption<Value extends string | number = string>\n extends MenuItemProps {\n value: Value;\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nfunction getLabelFromChildren(children: ReactNode): string {\n if (!children) {\n return \"\";\n }\n\n if (typeof children === \"string\" || typeof children === \"number\") {\n return `${children}`;\n }\n\n if (isValidElement<{ children: ReactNode; hidden?: boolean }>(children)) {\n if (children.props.hidden) {\n return \"\";\n }\n\n return getLabelFromChildren(children.props.children);\n }\n\n const childList = Children.toArray(children);\n for (const child of childList) {\n if (typeof child === \"string\" || typeof child === \"number\") {\n return `${child}`[0].toUpperCase();\n }\n\n if (\n isValidElement<{ children: ReactNode; hidden?: boolean }>(child) &&\n !child.props.hidden\n ) {\n return getLabelFromChildren(child.props.children);\n }\n }\n\n return \"\";\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\ninterface ExtractedOptions<Value extends string | number> {\n options: readonly SelectOption<Value>[];\n currentOption: SelectOption<Value> | undefined;\n searchValues: readonly string[];\n currentIndex: number;\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport function extractOptionsFromChildren<Value extends string | number>(\n children: ReactNode,\n currentValue: Value | undefined\n): ExtractedOptions<Value> {\n let currentOption: SelectOption<Value> | undefined;\n let currentIndex = -1;\n\n const options: SelectOption<Value>[] = [];\n const searchValues: string[] = [];\n Children.forEach(children, (child) => {\n if (!isValidElement<SelectOption<Value>>(child)) {\n return;\n }\n\n const { value, disabled, children } = child.props;\n if (typeof value !== \"undefined\") {\n if (\n value === currentValue ||\n (!currentOption && typeof currentValue === \"undefined\")\n ) {\n currentOption = child.props;\n currentIndex = options.length;\n }\n\n if (!disabled) {\n options.push(child.props);\n searchValues.push(getLabelFromChildren(children));\n }\n } else if (children) {\n const result = extractOptionsFromChildren(children, currentValue);\n if (!currentOption) {\n ({ currentOption } = result);\n }\n\n if (result.currentIndex !== -1) {\n currentIndex = options.length + result.currentIndex;\n }\n\n options.push(...result.options);\n searchValues.push(...result.searchValues);\n }\n });\n\n return {\n options,\n searchValues,\n currentOption,\n currentIndex,\n };\n}\n"],"names":["Children","isValidElement","getLabelFromChildren","children","props","hidden","childList","toArray","child","toUpperCase","extractOptionsFromChildren","currentValue","currentOption","currentIndex","options","searchValues","forEach","value","disabled","length","push","result"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,cAAc,QAAwB,QAAQ;AAYjE;;;CAGC,GACD,SAASC,qBAAqBC,QAAmB;IAC/C,IAAI,CAACA,UAAU;QACb,OAAO;IACT;IAEA,IAAI,OAAOA,aAAa,YAAY,OAAOA,aAAa,UAAU;QAChE,OAAO,CAAC,EAAEA,SAAS,CAAC;IACtB;IAEA,IAAIF,eAA0DE,WAAW;QACvE,IAAIA,SAASC,KAAK,CAACC,MAAM,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OR,YAAY;YACrD;YAEAC,QAAQM,IAAI,IAAIC,OAAOP,OAAO;YAC9BC,aAAaK,IAAI,IAAIC,OAAON,YAAY;QAC1C;IACF;IAEA,OAAO;QACLD;QACAC;QACAH;QACAC;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/sliderUtils.ts"],"sourcesContent":["import { type RefObject } from \"react\";\nimport {\n type DraggableEventHandlers,\n type DraggableImplementation,\n type DraggableMouseEventHandlers,\n type DraggableTouchEventHandlers,\n} from \"../draggable/useDraggable.js\";\nimport { type RenameKeysWithPrefix } from \"../types.js\";\nimport {\n getClientPosition,\n type ClientPositionEvent,\n} from \"../utils/getClientPosition.js\";\nimport { getPercentage } from \"../utils/getPercentage.js\";\nimport { getRangeSteps } from \"../utils/getRangeSteps.js\";\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\ninterface JumpOptions {\n min: number;\n max: number;\n step: number;\n jump: number | undefined;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const getJumpValue = (options: JumpOptions): number => {\n const { min, max, step, jump } = options;\n\n const steps = getRangeSteps({ min, max, step });\n const value = jump ?? (steps / 10) * step;\n if (Number.isInteger(step)) {\n return Math.ceil(value);\n }\n\n return value;\n};\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\ntype RequiredThumbProps = Pick<\n DraggableImplementation<HTMLElement>,\n | \"dragging\"\n | keyof DraggableMouseEventHandlers<HTMLElement>\n | keyof DraggableTouchEventHandlers<HTMLElement>\n> & { ref: RefObject<HTMLSpanElement> };\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport type ClosestThumbEventHandlersOptions = RenameKeysWithPrefix<\n RequiredThumbProps,\n \"thumb1\"\n> &\n RenameKeysWithPrefix<RequiredThumbProps, \"thumb2\"> & {\n vertical: boolean;\n isRangeSlider: boolean;\n };\n\n/**\n * NOTE: I do not need the mousemove events for this one to work.\n *\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const getClosestThumbEventHandlers = (\n options: ClosestThumbEventHandlersOptions\n): DraggableEventHandlers<HTMLElement> => {\n const {\n thumb1Ref,\n thumb1Dragging,\n thumb1OnMouseUp,\n thumb1OnMouseDown,\n thumb1OnTouchStart,\n thumb1OnTouchMove,\n thumb2Ref,\n thumb2Dragging,\n thumb2OnMouseUp,\n thumb2OnMouseDown,\n thumb2OnTouchStart,\n thumb2OnTouchMove,\n isRangeSlider,\n vertical,\n } = options;\n\n if (!isRangeSlider) {\n return {\n onMouseDown: thumb1OnMouseDown,\n onMouseUp: thumb1OnMouseUp,\n onTouchStart: thumb1OnTouchStart,\n onTouchMove: thumb1OnTouchMove,\n };\n }\n\n const isThumbOneClosest = (event: ClientPositionEvent): boolean => {\n if (thumb2Dragging) {\n return false;\n }\n\n const thumb1 = thumb1Ref.current;\n const thumb2 = thumb2Ref.current;\n if (!thumb1Dragging && thumb1 && thumb2) {\n const clientPosition = getClientPosition({ event, vertical });\n const thumb1Rect = thumb1.getBoundingClientRect();\n const thumb2Rect = thumb2.getBoundingClientRect();\n const thumb1Position = vertical ? thumb1Rect.y : thumb1Rect.x;\n const thumb2Position = vertical ? thumb2Rect.y : thumb2Rect.x;\n\n return (\n Math.abs(clientPosition - thumb1Position) <\n Math.abs(clientPosition - thumb2Position)\n );\n }\n\n return true;\n };\n\n return {\n onMouseDown(event) {\n if (isThumbOneClosest(event)) {\n thumb1OnMouseDown(event);\n } else {\n thumb2OnMouseDown(event);\n }\n },\n onMouseUp(event) {\n if (isThumbOneClosest(event)) {\n thumb1OnMouseUp(event);\n } else {\n thumb2OnMouseUp(event);\n }\n },\n onTouchStart(event) {\n if (isThumbOneClosest(event)) {\n thumb1OnTouchStart(event);\n } else {\n thumb2OnTouchStart(event);\n }\n },\n onTouchMove(event) {\n if (isThumbOneClosest(event)) {\n thumb1OnTouchMove(event);\n } else {\n thumb2OnTouchMove(event);\n }\n },\n };\n};\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport function getThumbOffset(\n offset: number | undefined,\n fallback: number\n): string | undefined {\n if (typeof offset !== \"number\") {\n return;\n }\n\n // the `offset` will be NaN when there are no possible steps to take because\n // the first thumb is at the maximum value or the second thumb is at the\n // minimum value\n const value = Number.isNaN(offset) ? fallback : offset;\n return `${value * 100}%`;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface ThumbOffsetsOptions {\n min: number;\n max: number;\n thumb1Value: number;\n thumb1Dragging: boolean;\n thumb1DragPercentage: number;\n thumb2Value: number;\n thumb2Dragging: boolean;\n thumb2DragPercentage: number;\n isRangeSlider: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\ninterface ThumbOffsets {\n \"--rmd-slider-offset-1\"?: string;\n \"--rmd-slider-offset-2\"?: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const getThumbOffsets = (options: ThumbOffsetsOptions): ThumbOffsets => {\n const {\n min,\n max,\n thumb1Value,\n thumb1Dragging,\n thumb1DragPercentage,\n thumb2Value,\n thumb2Dragging,\n thumb2DragPercentage,\n isRangeSlider,\n } = options;\n let thumb1Percentage = thumb1Dragging\n ? thumb1DragPercentage\n : getPercentage({ min, max, value: thumb1Value });\n\n let thumb2Percentage: number | undefined;\n if (isRangeSlider) {\n const percentage = getPercentage({ min, max, value: thumb2Value });\n\n thumb1Percentage = Math.min(thumb1Percentage, percentage);\n thumb2Percentage = thumb2Dragging\n ? Math.max(thumb1Percentage, thumb2DragPercentage)\n : percentage;\n }\n\n return {\n \"--rmd-slider-offset-1\": getThumbOffset(thumb1Percentage, 0),\n \"--rmd-slider-offset-2\": getThumbOffset(thumb2Percentage, 1),\n };\n};\n"],"names":["getClientPosition","getPercentage","getRangeSteps","getJumpValue","options","min","max","step","jump","steps","value","Number","isInteger","Math","ceil","getClosestThumbEventHandlers","thumb1Ref","thumb1Dragging","thumb1OnMouseUp","thumb1OnMouseDown","thumb1OnTouchStart","thumb1OnTouchMove","thumb2Ref","thumb2Dragging","thumb2OnMouseUp","thumb2OnMouseDown","thumb2OnTouchStart","thumb2OnTouchMove","isRangeSlider","vertical","onMouseDown","onMouseUp","onTouchStart","onTouchMove","isThumbOneClosest","event","thumb1","current","thumb2","clientPosition","thumb1Rect","getBoundingClientRect","thumb2Rect","thumb1Position","y","x","thumb2Position","abs","getThumbOffset","offset","fallback","isNaN","getThumbOffsets","thumb1Value","thumb1DragPercentage","thumb2Value","thumb2DragPercentage","thumb1Percentage","thumb2Percentage","percentage"],"mappings":"AAQA,SACEA,iBAAiB,QAEZ,gCAAgC;AACvC,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,aAAa,QAAQ,4BAA4B;AAa1D;;;CAGC,GACD,OAAO,MAAMC,eAAe,CAACC;IAC3B,MAAM,EAAEC,GAAG,EAAEC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAE,GAAGJ;IAEjC,MAAMK,QAAQP,cAAc;QAAEG;QAAKC;QAAKC;IAAK;IAC7C,MAAMG,QAAQF,QAAQ,AAACC,QAAQ,KAAMF;IACrC,IAAII,OAAOC,SAAS,CAACL,OAAO;QAC1B,OAAOM,KAAKC,IAAI,CAACJ;IACnB;IAEA,OAAOA;AACT,EAAE;AA0BF;;;;;CAKC,GACD,OAAO,MAAMK,+BAA+B,CAC1CX;IAEA,MAAM,EACJY,SAAS,EACTC,cAAc,EACdC,eAAe,EACfC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,EACjBC,SAAS,EACTC,cAAc,EACdC,eAAe,EACfC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,EACjBC,aAAa,EACbC,QAAQ,EACT,GAAGzB;IAEJ,IAAI,CAACwB,eAAe;QAClB,OAAO;YACLE,aAAaX;YACbY,WAAWb;YACXc,cAAcZ;YACda,aAAaZ;QACf;IACF;IAEA,MAAMa,oBAAoB,CAACC;QACzB,IAAIZ,gBAAgB;YAClB,OAAO;QACT;QAEA,MAAMa,SAASpB,UAAUqB,O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D;IAC9B,MAAM,EACJC,GAAG,EACHC,GAAG,EACH+C,WAAW,EACXpC,cAAc,EACdqC,oBAAoB,EACpBC,WAAW,EACXhC,cAAc,EACdiC,oBAAoB,EACpB5B,aAAa,EACd,GAAGxB;IACJ,IAAIqD,mBAAmBxC,iBACnBqC,uBACArD,cAAc;QAAEI;QAAKC;QAAKI,OAAO2C;IAAY;IAEjD,IAAIK;IACJ,IAAI9B,eAAe;QACjB,MAAM+B,aAAa1D,cAAc;YAAEI;YAAKC;YAAKI,OAAO6C;QAAY;QAEhEE,mBAAmB5C,KAAKR,GAAG,CAACoD,kBAAkBE;QAC9CD,mBAAmBnC,iBACfV,KAAKP,GAAG,CAACmD,kBAAkBD,wBAC3BG;IACN;IAEA,OAAO;QACL,yBAAyBX,eAAeS,kBAAkB;QAC1D,yBAAyBT,eAAeU,kBAAkB;IAC5D;AACF,EAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/switchStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-switch-track-background-color\"?: string;\n \"--rmd-switch-ball-background-color\"?: string;\n }\n}\n\nconst styles = bem(\"rmd-switch\");\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface SwitchClassNameOptions {\n className?: string;\n clickable?: boolean;\n currentColor?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function switchStyles(options: SwitchClassNameOptions = {}): string {\n const { className, clickable, currentColor } = options;\n\n return cnb(styles({ \"current-color\": currentColor, clickable }), className);\n}\n"],"names":["cnb","bem","styles","switchStyles","options","className","clickable","currentColor"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAStC,MAAMC,SAASD,IAAI;AAWnB;;CAEC,GACD,OAAO,SAASE,aAAaC,UAAkC,CAAC,CAAC;IAC/D,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAEC,YAAY,EAAE,GAAGH;IAE/C,OAAOJ,IAAIE,OAAO;QAAE,iBAAiBK;QAAcD;IAAU,IAAID;AACnE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/textAreaStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\nimport {\n textField,\n type TextFieldClassNameOptions,\n} from \"./textFieldStyles.js\";\nimport { type TextAreaResize } from \"./useResizingTextArea.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-textarea-height\"?: string | number;\n \"--rmd-textarea-padding\"?: string | number;\n }\n}\n\nconst styles = bem(\"rmd-textarea\");\nconst containerStyles = bem(\"rmd-textarea-container\");\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface TextareaClassNameOptions extends TextFieldClassNameOptions {\n className?: string;\n\n /**\n * This should not be used externally and is only used for creating the hidden\n * textarea mask for the auto resizing behavior.\n *\n * @defaultValue `false`\n */\n mask?: boolean;\n\n /**\n * @see {@link TextAreaResize}\n * @defaultValue `\"auto\"`\n */\n resize?: TextAreaResize;\n\n /**\n * Set this to `true` if the textarea should display a scrollbar.\n *\n * @defaultValue `false`\n */\n scrollable?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function textArea(options: TextareaClassNameOptions = {}): string {\n const {\n className,\n mask,\n resize = \"auto\",\n scrollable,\n placeholderHidden,\n } = options;\n\n return cnb(\n textField({ placeholderHidden }),\n styles({\n rh: resize === \"horizontal\",\n rv: resize === \"vertical\",\n rn: resize === \"auto\" || resize === \"none\",\n mask,\n scrollable: scrollable || resize === \"none\",\n }),\n className\n );\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface TextareaContainerClassNameOptions {\n className?: string;\n height?: boolean;\n disabled?: boolean;\n animate?: boolean;\n underlineLabelled?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function textAreaContainer(\n options: TextareaContainerClassNameOptions = {}\n): string {\n const { className, height, animate, disabled, underlineLabelled } = options;\n\n return cnb(\n containerStyles({\n height,\n animate,\n cursor: !disabled,\n \"underline-labelled\": underlineLabelled,\n }),\n className\n );\n}\n"],"names":["cnb","bem","textField","styles","containerStyles","textArea","options","className","mask","resize","scrollable","placeholderHidden","rh","rv","rn","textAreaContainer","height","animate","disabled","underlineLabelled","cursor"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SACEC,SAAS,QAEJ,uBAAuB;AAU9B,MAAMC,SAASF,IAAI;AACnB,MAAMG,kBAAkBH,IAAI;AA8B5B;;CAEC,GACD,OAAO,SAASI,SAASC,UAAoC,CAAC,CAAC;IAC7D,MAAM,EACJC,SAAS,EACTC,IAAI,EACJC,SAAS,MAAM,EACfC,UAAU,EACVC,iBAAiB,EAClB,GAAGL;IAEJ,OAAON,IACLE,UAAU;QAAES;IAAkB,IAC9BR,OAAO;QACLS,IAAIH,WAAW;QACfI,IAAIJ,WAAW;QACfK,IAAIL,WAAW,UAAUA,WAAW;QACpCD;QACAE,YAAYA,cAAcD,WAAW;IACvC,IACAF;AAEJ;AAaA;;CAEC,GACD,OAAO,SAASQ,kBACdT,UAA6C,CAAC,CAAC;IAE/C,MAAM,EAAEC,SAAS,EAAES,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,iBAAiB,EAAE,GAAGb;IAEpE,OAAON,IACLI,gBAAgB;QACdY;QACAC;QACAG,QAAQ,CAACF;QACT,sBAAsBC;IACxB,IACAZ;AAEJ"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/textFieldStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-text-field\");\n\n/** @remarks \\@since 6.0.0 */\nexport interface TextFieldClassNameOptions {\n className?: string;\n\n /**\n * Set this value to `true` when a text field has a floating label the text\n * field is not focused or valued so that the placeholder is hidden by setting\n * the opacity to 0. This makes it so the placeholder and label to not cover\n * each other.\n *\n * @defaultValue `false`\n */\n placeholderHidden?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function textField(options: TextFieldClassNameOptions = {}): string {\n const { className, placeholderHidden = false } = options;\n\n return cnb(\n styles({\n \"placeholder-hidden\": placeholderHidden,\n }),\n className\n );\n}\n"],"names":["cnb","bem","styles","textField","options","className","placeholderHidden"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAiBnB;;CAEC,GACD,OAAO,SAASE,UAAUC,UAAqC,CAAC,CAAC;IAC/D,MAAM,EAAEC,SAAS,EAAEC,oBAAoB,KAAK,EAAE,GAAGF;IAEjD,OAAOJ,IACLE,OAAO;QACL,sBAAsBI;IACxB,IACAD;AAEJ"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/types.ts"],"sourcesContent":["import {\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type LabelHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { type PropsWithRef } from \"../types.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-form-active-color\"?: string;\n \"--rmd-form-focus-color\"?: string;\n }\n}\n\n/**\n * The supported themes for the `TextField`, `TextArea`, and `Select`\n * components.\n *\n * - \"none\" - display as an unstyled text field without any border or background\n * colors.\n * - \"underline\" - display with only an underline that gains the form active\n * color and animates from the left or right to the other side when the field\n * is focused.\n * - \"filled\" - an extension of the `\"underline\"` state that will also have a\n * slightly dark background applied.\n * - \"outline\" - outlines the entire text field in a border and applies the\n * active color as box shadow when the field is focused.\n */\nexport type FormTheme = \"none\" | \"underline\" | \"filled\" | \"outline\";\n\n/**\n * The direction that the underline should appear from when the theme is\n * `\"underline\"` or `\"filled\"`.\n */\nexport type FormUnderlineDirection = \"left\" | \"center\" | \"right\";\n\nexport interface FormThemeOptions {\n /**\n * The current theme type.\n *\n * @defaultValue `\"outline\"`\n */\n theme?: FormTheme;\n\n /**\n * The current underline direction.\n *\n * @defaultValue `\"left\"`\n */\n underlineDirection?: FormUnderlineDirection;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface FormConfiguration extends Required<FormThemeOptions> {\n /**\n * Set this to `false` if the `$disable-uncontrolled-input-toggles` variable\n * is set to `true` in the Sass configuration.\n *\n * Since the `checked` state only changes for the radio that has been clicked,\n * the previously checked radio would also be shown as checked with no way of\n * fixing it without controlling the radio component. When this flag is\n * enabled, the checked icons and state are handled through css instead of\n * `useState`.\n *\n * @defaultValue `true`\n */\n uncontrolledToggles: boolean;\n}\n\nexport interface FormComponentStates {\n /** @defaultValue `false` */\n error?: boolean;\n\n /** @defaultValue `false` */\n active?: boolean;\n\n /** @defaultValue `false` */\n disabled?: boolean;\n\n /** @defaultValue `false` */\n readOnly?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @see https://html.spec.whatwg.org/multipage/forms.html#autofill\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values\n */\nexport type AutoCompleteValue =\n | \"off\"\n | \"on\"\n | \"name\"\n | \"honorific-prefix\"\n | \"given-name\"\n | \"additional-name\"\n | \"family-name\"\n | \"honorific-suffix\"\n | \"nickname\"\n | \"email\"\n | \"username\"\n | \"new-password\"\n | \"current-password\"\n | \"one-time-code\"\n | \"organization-title\"\n | \"organization\"\n | \"street-address\"\n | \"address-line1\"\n | \"address-line2\"\n | \"address-line3\"\n | \"address-level1\"\n | \"address-level2\"\n | \"address-level3\"\n | \"address-level4\"\n | \"country\"\n | \"country-name\"\n | \"postal-code\"\n | \"cc-name\"\n | \"cc-given-name\"\n | \"cc-additional-name\"\n | \"cc-family-name\"\n | \"cc-number\"\n | \"cc-exp\"\n | \"cc-exp-month\"\n | \"cc-exp-year\"\n | \"cc-csc\"\n | \"cc-type\"\n | \"transaction-currency\"\n | \"transaction-amount\"\n | \"language\"\n | \"bday\"\n | \"bday-day\"\n | \"bday-month\"\n | \"bday-year\"\n | \"sex\"\n | \"tel\"\n | \"tel-country-code\"\n | \"tel-national\"\n | \"tek-area-code\"\n | \"tel-local\"\n | \"tel-extension\"\n | \"impp\"\n | \"url\"\n | \"photo\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface UserAgentAutoCompleteProps {\n /**\n * Set this to enable additional autocompletion suggestions for a user for\n * different form fields. Using this prop will update the\n * {@link UserAgentAutoCompleteProps.name} and {@link autoComplete} to default to\n * this value.\n *\n * @example\n * ```tsx\n * <Form>\n * <TextField\n * label=\"Enter your credit card number\"\n * autoCompleteValue=\"cc-number\"\n * {...creditCardProps}\n * inputMode=\"number\"\n * />\n * <TextField\n * label=\"Name on card\"\n * autoCompleteValue=\"cc-name\"\n * {...creditCardNameProps}\n * />\n * <TextField\n * label=\"Security code\"\n * autoCompleteValue=\"cc-csc\"\n * {...securityCodeProps}\n * inputMode=\"number\"\n * />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n *\n * @see https://html.spec.whatwg.org/multipage/forms.html#autofill\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values\n * @see {@link AutoCompleteValue}\n * @see {@link autoComplete}\n * @see {@link UserAgentAutoCompleteProps.name}\n */\n autoCompleteValue?: AutoCompleteValue;\n\n /**\n * @see {@link autoCompleteValue}\n * @defaultValue `autoCompleteValue`\n */\n autoComplete?: InputHTMLAttributes<HTMLInputElement>[\"autoComplete\"];\n\n /**\n * @see {@link autoCompleteValue}\n * @defaultValue `autoCompleteValue`\n */\n name?: string;\n}\n\nexport interface FormMessageClassNameOptions {\n className?: string;\n\n /**\n * Boolean if the message should gain the error state which changes the text\n * color to `red` by default.\n *\n * @defaultValue `false`\n */\n error?: boolean;\n\n /**\n * The current theme for the related text field. This is really only used to\n * match the current horizontal padding of the text field.\n *\n * @defaultValue `\"outline\"`\n */\n theme?: FormTheme;\n}\n\nexport interface FormMessageProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"minLength\" | \"maxLength\">,\n FormMessageClassNameOptions {\n /**\n * If this component is acting as a form-level error message handler, the role\n * should be updated to be `\"alert\"` for additional accessibility.\n *\n * Note: when creating a form-level error message handler, the messages should\n * no longer appear as the user types and instead once the user tries to\n * submit the form. Having an alert role disrupts normal screen reader\n * behavior by immediately reading changes in this element.\n *\n * @defaultValue `undefined`\n */\n role?: \"alert\";\n\n /**\n * Boolean if the children should no longer be wrapped in a `<p>` tag. This\n * should normally only be disabled if using a custom error message wrapper or\n * the counter behavior is not being used. To get correct alignments of the\n * message and counter, the `children` must be wrapped in some element and\n * cannot be plain test.\n *\n * Note: this will always be considered `true` if the `role` is set to\n * `\"alert\"`.\n *\n * @defaultValue `false`\n */\n disableWrap?: boolean;\n\n /**\n * An optional style to apply to the `<p>` tag that surrounds the `children`.\n * This will not be used if `role=\"alert\"` or `disableWrap={true}`.\n */\n messageStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the `<p>` tag that surrounds the\n * `children`. This will not be used if `role=\"alert\"` or\n * `disableWrap={true}`.\n */\n messageClassName?: string;\n}\n\n/**\n * Props that are used to automatically add a counter for the remaining letters\n * available for the text field. The counter will always be created to the right\n * of the optional message.\n *\n * The counter is really a simple string of: `${length} / ${maxLength}`.\n *\n * If you need additional customization, it is recommended to create your own\n * implementation such as:\n *\n * ```tsx\n * <FormMessage>\n * {errorMessage}\n * <MyCounter {...props} />\n * </FormMessage>\n * ```\n *\n * Note: this should not be used alongside form-level messages.\n *\n * @remarks \\@since 2.9.0 Renamed from `FormMessageCounterProps` to\n * `FormMessageInputLengthCounterProps` since a `FormMessageCounter` component\n * was added\n */\nexport interface FormMessageInputLengthCounterProps {\n /**\n * The current length of the value in the related text field.\n */\n length: number;\n\n /**\n * The max length allowed for the value in the related text field.\n */\n maxLength: number;\n\n /**\n * An optional style to apply to the counter wrapper element.\n */\n counterStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the counter wrapper element.\n */\n counterClassName?: string;\n}\n\nexport interface FormMessageWithCounterProps\n extends FormMessageProps,\n FormMessageInputLengthCounterProps {}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface FormMessageWithoutCounterProps extends FormMessageProps {\n length?: never;\n maxLength?: never;\n counterStyle?: never;\n counterClassName?: never;\n}\n\nexport interface FormMessageContainerExtension {\n /**\n * If the extension doesn't actually want to render the `FormMessage`\n * component, these props are optional. It kind of eliminates the whole\n * purpose of this component though.\n */\n messageProps?: PropsWithRef<\n FormMessageProps & Partial<FormMessageInputLengthCounterProps>,\n HTMLDivElement\n >;\n\n /**\n * Any props (and an optional ref) to provide to the `<div>` surrounding the\n * children and `FormMessage` component.\n *\n * Note: This will not be used if the `messageProps` are not provided since\n * only the `children` will be returned without the container.\n */\n messageContainerProps?: PropsWithRef<\n HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n >;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface LabelClassNameOptions {\n className?: string;\n\n /**\n * Set this to `true` to remove the `gap` style from the label.\n *\n * @see `$label-gap`\n * @defaultValue `false`\n */\n gap?: boolean;\n\n /**\n * Set this to `true` when the parent `TextFieldContainer` has the `dense`\n * spec enabled. This updates the floating styles to match the smaller height.\n *\n * @defaultValue `false`\n */\n dense?: boolean;\n\n /**\n * Set this to `true` to update the label's color to the error color.\n *\n * @see `$error-color`\n * @defaultValue `false`\n */\n error?: boolean;\n\n /**\n * Set this to `true` to update the label's color to the active color.\n *\n * @see `$active-color`\n * @defaultValue `false`\n */\n active?: boolean;\n\n /**\n * Set this to `true` if the label should gain `flex-direction: column`\n * styling.\n *\n * @defaultValue `false`\n */\n stacked?: boolean;\n\n /**\n * Set this to `true` to update the label's color to be the disabled color.\n *\n * @see `$disabled-color`\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * Set this to true when label can floating above an input, textarea, or\n * select inside of a `TextFieldContainer`.\n *\n * @defaultValue `false`\n */\n floating?: boolean;\n\n /**\n * Set this to true when label is currently floating above an input,\n * textarea, or selected inside of a `TextFieldContainer`.\n *\n * @see {@link active}\n * @defaultValue `active`\n */\n floatingActive?: boolean;\n\n /**\n * Set this to `true` to gain `flex-direction: row-reversed` styling. If the\n * {@link stacked} prop is also `true`, `flex-direction: column-reversed` will\n * be applied.\n *\n * @defaultValue `false`\n */\n reversed?: boolean;\n\n /**\n * @defaultValue `false`\n */\n inactive?: boolean;\n}\n\nexport interface LabelProps\n extends LabelHTMLAttributes<HTMLLabelElement>,\n LabelClassNameOptions {}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ConfigurableTextFieldAddonProps\n extends HTMLAttributes<HTMLSpanElement> {\n /**\n * Boolean if the addon should be presentational only and prevent pointer\n * events.\n *\n * @defaultValue `false`\n */\n pointerEvents?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0 Added support for `leftAddonProps` and\n * `rightAddonProps`.\n */\nexport interface TextFieldContainerOptions\n extends FormThemeOptions,\n FormComponentStates {\n /**\n * Set this to `true` to enable the dense spec which reduces the height.\n *\n * @defaultValue `false`\n */\n dense?: boolean;\n\n /**\n * Set this to `true` to change the style from `display: flex` to\n * `display: inline-flex`.\n *\n * @defaultValue `false`\n */\n inline?: boolean;\n\n /**\n * Set this to `true` if this component should stretch to fill a flex or grid\n * container using `flex: 1 1 auto`.\n *\n * @defaultValue `false`\n */\n stretch?: boolean;\n\n /**\n * This should generally be an icon or a button that will be placed before the\n * `TextField` or `TextArea`.\n */\n leftAddon?: ReactNode;\n\n /**\n * Any additional props to pass to the `<span>` surrounding the {@link leftAddon}.\n *\n * @remarks \\@since 6.0.0\n */\n leftAddonProps?: PropsWithRef<\n ConfigurableTextFieldAddonProps,\n HTMLSpanElement\n >;\n\n /**\n * @see {@link TextFieldAddonProps.disabled}\n *\n * @defaultValue `false`\n */\n disableLeftAddonStyles?: boolean;\n\n /**\n * This should generally be an icon or a button that will be placed after the\n * `TextField` or `TextArea`.\n */\n rightAddon?: ReactNode;\n\n /**\n * Any additional props to pass to the `<span>` surrounding the {@link rightAddon}.\n *\n * @remarks \\@since 6.0.0\n */\n rightAddonProps?: PropsWithRef<\n ConfigurableTextFieldAddonProps,\n HTMLSpanElement\n >;\n\n /**\n * @see {@link TextFieldAddonProps.disabled}\n *\n * @defaultValue `false`\n */\n disableRightAddonStyles?: boolean;\n}\n\nexport interface FormFieldOptions\n extends TextFieldContainerOptions,\n FormMessageContainerExtension {\n /**\n * An optional floating label to use with the text field. A label is generally\n * recommended for accessibility, but can be omitted if an `aria-label` or\n * `aria-labelledby` is provided.\n */\n label?: ReactNode;\n\n /**\n * Any additional props and/or ref that should be passed to the `<label>`\n * element when a {@link label} is provided.\n *\n * @example\n * ```tsx\n * labelProps={{\n * ref: labelRef,\n * style: {},\n * className: \"some-custom-class-name\",\n * onClick: (event) => {\n * // do something\n * }\n * }}\n * ```\n */\n labelProps?: PropsWithRef<LabelProps, HTMLLabelElement>;\n\n /**\n * A convenience prop to apply a custom style to a label. This is equivalent\n * to:\n *\n * ```ts\n * labelProps={{\n * style: // some style here\n * }}\n * ```\n */\n labelStyle?: CSSProperties;\n\n /**\n * A convenience prop to apply a custom className to a label. This is\n * equivalent to:\n *\n * ```ts\n * labelProps={{\n * className: \"some-class-name\",\n * }}\n * ```\n */\n labelClassName?: string;\n}\n"],"names":[],"mappings":"AAihBA,WAmDC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/useCheckboxGroup.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { type UseStateInitializer, type UseStateSetter } from \"../types.js\";\n\nconst EMPTY_LIST = [] as const;\n\n/** @remarks \\@since 6.0.0 */\nexport interface CheckboxGroupOptions<V> {\n /**\n * A `name` to apply to all the checkboxes within the group. This is required\n * if the {@link menu} option is set to `true`.\n */\n name?: string;\n\n /**\n * Set this to `true` if using the `MenuItemCheckbox` component instead of the\n * `Checkbox` so the correct props can be provided.\n *\n * @defaultValue `false`\n */\n menu?: boolean;\n\n /**\n * This prop **must** be defined to enable the indeterminate checkbox feature\n * from the hook. This should be a list of all the possible checkbox values in\n * the group. This will be used to select all values when the indeterminate\n * checkbox is checked and determine if all the checkboxes have manually be\n * selected.\n *\n * @example\n * Indeterminate Behavior\n * ```tsx\n * const OPTIONS = [\n * { label: \"First\", value: \"a\" },\n * { label: \"Second\", value: \"b\" },\n * { label: \"Third\", value: \"c\" },\n * ] as const:\n * const VALUES = OPTIONS.map(({ value }) => value) as const;\n *\n * const {\n * getCheckboxProps,\n * getIndeterminateProps,\n * checkedValues,\n * } = useCheckboxGroup({ name: \"group\", values: VALUES });\n * ```\n */\n values?: readonly V[];\n\n /**\n * Set this to a list of checkbox values that should be checked by default.\n *\n * @defaultValue `[]`\n */\n defaultCheckedValues?: UseStateInitializer<readonly V[]>;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface CheckboxGroupImplementation<V extends string> {\n reset(): void;\n checkedValues: ReadonlySet<V>;\n setCheckedValues: UseStateSetter<ReadonlySet<V>>;\n getCheckboxProps(value: V): {\n name: string;\n value: V;\n checked: boolean;\n onChange(): void;\n };\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface IndeterminateCheckboxGroupImplementation<V extends string>\n extends CheckboxGroupImplementation<V> {\n getIndeterminateProps(): {\n \"aria-checked\": \"mixed\" | undefined;\n name: string;\n checked: boolean;\n indeterminate: boolean;\n onChange(): void;\n };\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface MenuItemCheckboxGroupImplementation<V extends string> {\n reset(): void;\n checkedValues: ReadonlySet<V>;\n setCheckedValues: UseStateSetter<ReadonlySet<V>>;\n getCheckboxProps(value: V): {\n checked: boolean;\n onCheckedChange(): void;\n };\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface IndeterminateMenuItemCheckboxGroupImplementation<\n V extends string,\n> extends MenuItemCheckboxGroupImplementation<V> {\n getIndeterminateProps(): {\n \"aria-checked\": \"mixed\" | undefined;\n checked: boolean;\n indeterminate: boolean;\n onCheckedChange(): void;\n };\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface CombinedCheckboxGroupReturnValue<V extends string> {\n reset(): void;\n checkedValues: ReadonlySet<V>;\n setCheckedValues: UseStateSetter<ReadonlySet<V>>;\n getCheckboxProps(value: V): {\n name?: string;\n value?: V;\n checked: boolean;\n onChange?(): void;\n onCheckedChange?(): void;\n };\n getIndeterminateProps?(): {\n \"aria-checked\": \"mixed\" | undefined;\n name?: string;\n checked: boolean;\n indeterminate: boolean;\n onChange?(): void;\n onCheckedChange?(): void;\n };\n}\n\n/**\n * @example\n * Checkbox Group\n * ```tsx\n * const { getCheckboxProps, checkedValues } = useCheckboxGroup({ name: \"example\" });\n *\n * return (\n * <>\n * <Checkbox {...getCheckboxProps(\"a\")}>\n * First\n * </Checkbox>\n * <Checkbox {...getCheckboxProps(\"b\")}>\n * Second\n * </Checkbox>\n * <Checkbox {...getCheckboxProps(\"c\")}>\n * Third\n * </Checkbox>\n * </>\n * );\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useCheckboxGroup<V extends string>(\n options: CheckboxGroupOptions<V> & {\n menu?: false;\n name: string;\n values?: never;\n }\n): CheckboxGroupImplementation<V>;\n/**\n * @example\n * Indeterminate Checkbox Group\n * ```tsx\n * const OPTIONS = [\n * { label: \"First\", value: \"a\" },\n * { label: \"Second\", value: \"b\" },\n * { label: \"Third\", value: \"c\" },\n * ] as const:\n * const VALUES = OPTIONS.map(({ value }) => value) as const;\n *\n * const {\n * getCheckboxProps,\n * getIndeterminateProps,\n * checkedValues\n * } = useCheckboxGroup({\n * name: \"example\",\n * values: VALUES,\n * });\n *\n * return (\n * <>\n * <Checkbox {...getIndeterminateProps()} label=\"Select all\" />\n * {VALUES.map(({ label, value }) => (\n * <Checkbox key={value} label={label} {...getCheckboxProps(value)} />\n * ))}\n * </>\n * );\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useCheckboxGroup<V extends string>(\n options: CheckboxGroupOptions<V> & {\n menu?: false;\n name: string;\n values: readonly V[];\n }\n): IndeterminateCheckboxGroupImplementation<V>;\n/**\n * @example\n * MenuItemCheckbox Group\n * ```tsx\n * const { getCheckboxProps, checkedValues } = useCheckboxGroup({ menu: true });\n *\n * return (\n * <>\n * <MenuItemCheckbox {...getCheckboxProps(\"a\")}>\n * First\n * </MenuItemCheckbox>\n * <MenuItemCheckbox {...getCheckboxProps(\"b\")}>\n * Second\n * </MenuItemCheckbox>\n * <MenuItemCheckbox {...getCheckboxProps(\"c\")}>\n * Third\n * </MenuItemCheckbox>\n * </>\n * );\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useCheckboxGroup<V extends string>(\n options: CheckboxGroupOptions<V> & {\n menu: true;\n name?: never;\n values?: never;\n }\n): MenuItemCheckboxGroupImplementation<V>;\n/**\n * @example\n * Indeterminate MenuItemCheckbox Group\n * ```tsx\n * const OPTIONS = [\n * { label: \"First\", value: \"a\" },\n * { label: \"Second\", value: \"b\" },\n * { label: \"Third\", value: \"c\" },\n * ] as const:\n * const VALUES = OPTIONS.map(({ value }) => value) as const;\n *\n * const { getCheckboxProps, getIndeterminateProps, checkedValues } = useCheckboxGroup({\n * menu: true,\n * values: VALUES,\n * });\n *\n * return (\n * <>\n * <MenuItemCheckbox {...getIndeterminateProps()}>\n * All\n * <MenuItemCheckbox>\n * {OPTIONS.map(({ label, value }) => (\n * <MenuItemCheckbox key={value} {...getCheckboxProps(value)}>\n * {label}\n * </MenuItemCheckbox>\n * ))}\n * </>\n * );\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useCheckboxGroup<V extends string>(\n options: CheckboxGroupOptions<V> & {\n menu: true;\n name?: never;\n values: readonly V[];\n }\n): IndeterminateMenuItemCheckboxGroupImplementation<V>;\nexport function useCheckboxGroup<V extends string>(\n options: CheckboxGroupOptions<V>\n): CombinedCheckboxGroupReturnValue<V> {\n const {\n name,\n menu = false,\n values,\n defaultCheckedValues = EMPTY_LIST,\n } = options;\n const [checkedValues, setCheckedValues] = useState<ReadonlySet<V>>(() => {\n if (typeof defaultCheckedValues === \"function\") {\n return new Set(defaultCheckedValues());\n }\n\n return new Set(defaultCheckedValues);\n });\n const initial = useRef(checkedValues);\n\n let getIndeterminateProps: CombinedCheckboxGroupReturnValue<V>[\"getIndeterminateProps\"];\n if (values) {\n getIndeterminateProps = () => {\n const checked = checkedValues.size > 0;\n const indeterminate = checked && checkedValues.size < values.length;\n\n return {\n \"aria-checked\": indeterminate ? \"mixed\" : undefined,\n name,\n checked,\n indeterminate,\n [menu ? \"onCheckedChange\" : \"onChange\"]() {\n setCheckedValues(() => {\n if (checkedValues.size === 0 || indeterminate) {\n return new Set(values);\n }\n\n return new Set();\n });\n },\n };\n };\n }\n\n return {\n reset: useCallback(() => {\n setCheckedValues(initial.current);\n }, []),\n checkedValues,\n setCheckedValues,\n getIndeterminateProps,\n getCheckboxProps(value) {\n return {\n name,\n value: menu ? undefined : value,\n checked: checkedValues.has(value),\n [menu ? \"onCheckedChange\" : \"onChange\"]() {\n setCheckedValues((prevValues) => {\n const nextValues = new Set(prevValues);\n if (prevValues.has(value)) {\n nextValues.delete(value);\n } else {\n nextValues.add(value);\n }\n\n return nextValues;\n });\n },\n };\n },\n };\n}\n"],"names":["useCallback","useRef","useState","EMPTY_LIST","useCheckboxGroup","options","name","menu","values","defaultCheckedValues","checkedValues","setCheckedValues","Set","initial","getIndeterminateProps","checked","size","indeterminate","length","undefined","reset","current","getCheckboxProps","value","has","prevValues","nextValues","delete","add"],"mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAGtD,MAAMC,aAAa,EAAE;AAoQrB,OAAO,SAASC,iBACdC,OAAgC;IAEhC,MAAM,EACJC,IAAI,EACJC,OAAO,KAAK,EACZC,MAAM,EACNC,uBAAuBN,UAAU,EAClC,GAAGE;IACJ,MAAM,CAACK,eAAeC,iBAAiB,GAAGT,SAAyB;QACjE,IAAI,OAAOO,yBAAyB,YAAY;YAC9C,OAAO,IAAIG,IAAIH;QACjB;QAEA,OAAO,IAAIG,IAAIH;IACjB;IACA,MAAMI,UAAUZ,OAAOS;IAEvB,IAAII;IACJ,IAAIN,QAAQ;QACVM,wBAAwB;YACtB,MAAMC,UAAUL,cAAcM,IAAI,GAAG;YACrC,MAAMC,gBAAgBF,WAAWL,cAAcM,IAAI,GAAGR,OAAOU,MAAM;YAEnE,OAAO;gBACL,gBAAgBD,gBAAgB,UAAUE;gBAC1Cb;gBACAS;gBACAE;gBACA,CAACV,OAAO,oBAAoB,WAAW;oBACrCI,iBAAiB;wBACf,IAAID,cAAcM,IAAI,KAAK,KAAKC,eAAe;4BAC7C,OAAO,IAAIL,IAAIJ;wBACjB;wBAEA,OAAO,IAAII;oBACb;gBACF;YACF;QACF;IACF;IAEA,OAAO;QACLQ,OAAOpB,YAAY;YACjBW,iBAAiBE,QAAQQ,OAAO;QAClC,GAAG,EAAE;QACLX;QACAC;QACAG;QACAQ,kBAAiBC,KAAK;YACpB,OAAO;gBACLjB;gBACAiB,OAAOhB,OAAOY,YAAYI;gBAC1BR,SAASL,cAAcc,GAAG,CAACD;gBAC3B,CAAChB,OAAO,oBAAoB,WAAW;oBACrCI,iBAAiB,CAACc;wBAChB,MAAMC,aAAa,IAAId,IAAIa;wBAC3B,IAAIA,WAAWD,GAAG,CAACD,QAAQ;4BACzBG,WAAWC,MAAM,CAACJ;wBACpB,OAAO;4BACLG,WAAWE,GAAG,CAACL;wBACjB;wBAEA,OAAOG;oBACT;gBACF;YACF;QACF;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/useFileUpload.ts"],"sourcesContent":["\"use client\";\nimport { nanoid } from \"nanoid\";\nimport {\n useCallback,\n useEffect,\n useReducer,\n type ChangeEvent,\n type DragEvent,\n} from \"react\";\nimport {\n FileAccessError,\n getFileParser as defaultGetFileParser,\n isValidFileName as defaultIsValidFileName,\n validateFiles as defaultValidateFiles,\n type CompletedFileUploadStats,\n type FileReaderResult,\n type FileUploadHandlers,\n type FileUploadStats,\n type FileValidationError,\n type FileValidationOptions,\n type FilesValidator,\n type GetFileParser,\n type ProcessingFileUploadStats,\n} from \"./fileUtils.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n *\n * @typeParam CustomError - An optional error type that gets returned from the\n * {@link FilesValidator}.\n * @remarks \\@since 2.9.0\n */\nexport interface FileUploadState<CustomError = never> {\n /**\n * All the files that have been validated and are either:\n * - pending upload\n * - uploading\n * - complete\n *\n * Each key in this object is the {@link BaseFileUploadStats.key} generated\n * once the upload starts pending.\n */\n stats: Readonly<Record<string, Readonly<FileUploadStats>>>;\n\n /**\n * A list of validation errors that have occurred before starting the upload\n * process.\n *\n * @see {@link FileAccessError}\n * @see {@link TooManyFilesError}\n * @see {@link FileValidationError}\n */\n errors: readonly FileValidationError<CustomError>[];\n}\n\n/**\n *\n * @typeParam CustomError - An optional error type that gets returned from the\n * {@link FilesValidator}.\n * @remarks \\@since 2.9.0\n * @internal\n */\nexport interface FileUploadHookState<CustomError = never>\n extends FileUploadState<CustomError> {\n /**\n * All the current readers used for uploading files to the browser.\n *\n * Note: Once an upload has completed, the reader will be removed.\n */\n readers: Readonly<Record<string, FileReader>>;\n}\n\n/**\n *\n * @typeParam E - An optional HTMLElement type that is used for the\n * {@link FileUploadHandlers}.\n * @typeParam CustomError - An optional error type that gets returned from the\n * {@link FilesValidator}.\n * @remarks \\@since 2.9.0\n */\nexport interface FileUploadOptions<E extends HTMLElement, CustomError = never>\n extends FileUploadHandlers<E>,\n FileValidationOptions {\n /**\n * Setting this value to a number greater than `0` will update the browser\n * upload process to queue the uploads in chunks instead of all at once. This\n * can help prevent the browser from freezing if dealing with large files that\n * are being converted to data urls.\n *\n * @defaultValue `-1`\n */\n concurrency?: number;\n\n /** {@inheritDoc FilesValidator} */\n validateFiles?: FilesValidator<CustomError>;\n /** {@inheritDoc GetFileParser} */\n getFileParser?: GetFileParser;\n}\n\n/** @internal */\ntype Action<E = never> =\n | {\n type: \"queue\";\n errors: readonly FileValidationError<E>[];\n files: readonly File[];\n }\n | { type: \"reset\" }\n | { type: \"remove\"; files: readonly string[] }\n | { type: \"start\"; key: string; reader: FileReader }\n | { type: \"progress\"; key: string; progress: number }\n | { type: \"complete\"; key: string; result: FileReaderResult }\n | { type: \"clearErrors\" };\n\n/** @remarks \\@since 2.9.0 */\nexport interface FileUploadActions {\n /**\n * Reset everything related to uploads ensuring that all file readers have\n * been aborted.\n */\n reset(): void;\n\n /**\n * Removes all the errors that exist in state without cancelling any of the\n * uploads already in progress.\n */\n clearErrors(): void;\n\n /**\n * This function is used to cancel pending and uploading files or removing\n * completed files.\n *\n * @param keyOrKeys - A single or list of {@link BaseFileUploadStats.key} to\n * remove from state.\n */\n remove(keyOrKeys: string | readonly string[]): void;\n}\n\n/**\n *\n * @typeParam E - An optional HTMLElement type that is used for the\n * {@link FileUploadHandlers}.\n * @typeParam CustomError - An optional error type that gets returned from the\n * {@link FilesValidator}.\n * @remarks \\@since 2.9.0\n */\nexport interface FileUploadHookReturnValue<\n E extends HTMLElement = HTMLElement,\n CustomError = never,\n> extends FileUploadActions,\n Required<FileUploadHandlers<E>> {\n /** {@inheritDoc FileUploadState.errors} */\n errors: readonly FileValidationError<CustomError>[];\n\n /**\n * A list of all the {@link FileUploadStats}.\n *\n * @see {@link getSplitFileUploads} for separating by status\n */\n stats: readonly Readonly<FileUploadStats>[];\n\n /**\n * The total number of bytes for all the files that exist in the\n * {@link stats} list.\n */\n totalBytes: number;\n\n /**\n * The total number of files in the {@link stats} list.\n */\n totalFiles: number;\n\n /**\n * An `accept` string that can be passed to the {@link FileInput} component\n * when the {@link FileValidationOptions.extensions} list has been provided to\n * limit which files the OS will _attempt_ to allow access to.\n *\n * @example\n * Simple example\n * ```ts\n * const extensions = ['pdf', 'docx', 'ppt'];\n * const { accept } = useFileUpload({ extensions, ...others });\n *\n * expect(accept).toBe(\"*.pdf,*.docx,*.ppt\")\n * ```\n *\n * @defaultValue `\"*\"`\n */\n accept: string;\n}\n\n/** @internal */\nconst EMPTY_LIST = [] as const;\n/** @internal */\nconst EMPTY_OBJECT = {} as const;\n\n/**\n * This hook is generally used to upload files **to the browser** in different\n * formats to be previewed `<img>`, `<video>`, `<embed>`, etc tags. However, it\n * can also be used to upload the files as an `ArrayBuffer` and then uploaded to\n * a server.\n *\n * Note: If using the `aws-sdk` to upload files directly to S3, **do not use\n * this hook** since it uses its own upload process.\n *\n * @typeParam E - An optional HTMLElement type that is used for the\n * {@link FileUploadHandlers}.\n * @typeParam CustomError - An optional error type that gets returned from the\n * {@link FilesValidator}.\n * @param options - All the {@link FileUploadOptions}\n * @returns the {@link FileUploadHookReturnValue}\n * @remarks \\@since 2.9.0\n */\nexport function useFileUpload<E extends HTMLElement, CustomError = never>({\n maxFiles = -1,\n extensions = EMPTY_LIST,\n minFileSize = -1,\n maxFileSize = -1,\n totalFileSize = -1,\n concurrency = -1,\n onDrop: propOnDrop = noop,\n onChange: propOnChange = noop,\n validateFiles = defaultValidateFiles,\n getFileParser = defaultGetFileParser,\n isValidFileName = defaultIsValidFileName,\n}: FileUploadOptions<E, CustomError> = {}): Readonly<\n FileUploadHookReturnValue<E, CustomError>\n> {\n const [state, dispatch] = useReducer(\n function reducer(\n state: FileUploadHookState<CustomError>,\n action: Action<CustomError>\n ): FileUploadHookState<CustomError> {\n switch (action.type) {\n case \"reset\":\n // need to reuse constants so that calling reset doesn't cause an\n // infinite loop in an effect\n return {\n stats: EMPTY_OBJECT,\n errors: EMPTY_LIST,\n readers: EMPTY_OBJECT,\n };\n case \"remove\": {\n const stats: Record<string, FileUploadStats> = {};\n for (const key in state.stats) {\n if (!action.files.includes(key)) {\n stats[key] = state.stats[key];\n }\n }\n\n return {\n ...state,\n stats,\n };\n }\n case \"queue\":\n return {\n ...state,\n stats: {\n ...state.stats,\n ...action.files.reduce<Record<string, ProcessingFileUploadStats>>(\n (files, file) => {\n const key = nanoid();\n files[key] = {\n key,\n file,\n progress: 0,\n status: \"pending\",\n };\n\n return files;\n },\n {}\n ),\n },\n errors: [...state.errors, ...action.errors],\n };\n case \"start\": {\n const { key, reader } = action;\n const fileStats: ProcessingFileUploadStats = {\n key,\n file: state.stats[key].file,\n progress: 0,\n status: \"uploading\",\n };\n\n return {\n ...state,\n readers: {\n ...state.readers,\n [key]: reader,\n },\n stats: {\n ...state.stats,\n [key]: fileStats,\n },\n };\n }\n case \"progress\": {\n const { key, progress } = action;\n return {\n ...state,\n stats: {\n ...state.stats,\n [key]: {\n ...state.stats[key],\n progress,\n },\n },\n };\n }\n case \"complete\": {\n const { key, result } = action;\n const file: CompletedFileUploadStats = {\n key,\n file: state.stats[key].file,\n status: \"complete\",\n result,\n progress: 100,\n };\n const { [key]: _reader, ...readers } = state.readers;\n\n return {\n ...state,\n readers,\n stats: {\n ...state.stats,\n [key]: file,\n },\n };\n }\n case \"clearErrors\":\n return { ...state, errors: [] };\n }\n },\n {\n stats: EMPTY_OBJECT,\n errors: EMPTY_LIST,\n readers: EMPTY_OBJECT,\n }\n );\n const { stats, errors, readers } = state;\n\n const statsList = Object.values(stats);\n const totalFiles = statsList.length;\n const totalBytes = statsList.reduce(\n (result, { file: { size } }) => result + size,\n 0\n );\n const queueFiles = useCallback(\n (files: readonly File[]) => {\n const { pending, errors } = validateFiles(files, {\n maxFiles,\n extensions,\n minFileSize,\n maxFileSize,\n totalBytes,\n totalFiles,\n totalFileSize,\n isValidFileName,\n });\n\n dispatch({ type: \"queue\", errors, files: pending });\n },\n [\n validateFiles,\n maxFiles,\n extensions,\n minFileSize,\n maxFileSize,\n totalBytes,\n totalFiles,\n totalFileSize,\n isValidFileName,\n ]\n );\n const onDrop = useCallback(\n (event: DragEvent<E>) => {\n propOnDrop(event);\n event.preventDefault();\n event.stopPropagation();\n\n try {\n const files = event.dataTransfer.files;\n if (files) {\n queueFiles(Array.from(files));\n }\n } catch (e) {\n dispatch({\n type: \"queue\",\n files: [],\n errors: [\n new FileAccessError(e instanceof Error ? e.message : undefined),\n ],\n });\n }\n },\n [queueFiles, propOnDrop]\n );\n const onChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n propOnChange(event);\n try {\n const files = event.currentTarget.files;\n if (files) {\n queueFiles(Array.from(files));\n } else {\n throw new Error();\n }\n } catch (e) {\n dispatch({\n type: \"queue\",\n files: [],\n errors: [\n new FileAccessError(e instanceof Error ? e.message : undefined),\n ],\n });\n }\n },\n [queueFiles, propOnChange]\n );\n\n const remove = useCallback(\n (keyOrKeys: string | readonly string[]) => {\n const files = typeof keyOrKeys === \"string\" ? [keyOrKeys] : keyOrKeys;\n files.forEach((fileKey) => {\n readers[fileKey]?.abort();\n });\n\n dispatch({ type: \"remove\", files });\n },\n [readers]\n );\n const reset = useCallback(() => {\n Object.values(readers).forEach((reader) => {\n reader.abort();\n });\n\n dispatch({ type: \"reset\" });\n }, [readers]);\n const clearErrors = useCallback(() => {\n dispatch({ type: \"clearErrors\" });\n }, []);\n const start = useCallback((key: string, reader: FileReader) => {\n dispatch({ type: \"start\", key, reader });\n }, []);\n const complete = useCallback(\n (key: string, result: FileReaderResult = null) => {\n dispatch({ type: \"complete\", key, result });\n },\n []\n );\n const createProgressEventHandler = useCallback(\n (key: string) => (event: ProgressEvent) => {\n if (event.lengthComputable) {\n const percentage = Math.round((event.loaded * 100) / event.total);\n dispatch({ type: \"progress\", key, progress: percentage });\n }\n },\n []\n );\n\n useEffect(() => {\n const pending: ProcessingFileUploadStats[] = [];\n const uploading: ProcessingFileUploadStats[] = [];\n Object.values(stats).forEach((file) => {\n if (file.status === \"pending\") {\n pending.push(file);\n } else if (file.status === \"uploading\") {\n uploading.push(file);\n }\n });\n\n const lastIndex =\n concurrency === -1\n ? pending.length\n : Math.max(0, concurrency - uploading.length);\n const queue = pending.slice(0, lastIndex);\n if (!queue.length) {\n return;\n }\n\n queue.forEach((stats) => {\n const { key, file } = stats;\n const reader = new FileReader();\n\n // using `addEventListener` instead of directly setting to\n // `reader.progress`/`reader.load` so it's easier to test\n reader.addEventListener(\"progress\", createProgressEventHandler(key));\n reader.addEventListener(\"load\", () => {\n complete(key, reader.result);\n });\n\n start(key, reader);\n const parser = getFileParser(file);\n /* istanbul ignore next */\n if (\n process.env.NODE_ENV !== \"production\" &&\n ![\n \"readAsText\",\n \"readAsDataURL\",\n \"readAsArrayBuffer\",\n \"readAsBinaryString\",\n ].includes(parser)\n ) {\n throw new Error(\"Invalid file reader parser\");\n }\n\n reader[parser](file);\n });\n }, [\n concurrency,\n stats,\n getFileParser,\n createProgressEventHandler,\n start,\n complete,\n ]);\n\n let accept = \"\";\n if (extensions.length) {\n accept = extensions.reduce((s, ext) => `${s ? `${s},` : \"\"}.${ext}`, \"\");\n }\n\n return {\n stats: statsList,\n errors,\n accept,\n totalBytes,\n totalFiles,\n onDrop,\n onChange,\n reset,\n remove,\n clearErrors,\n };\n}\n"],"names":["nanoid","useCallback","useEffect","useReducer","FileAccessError","getFileParser","defaultGetFileParser","isValidFileName","defaultIsValidFileName","validateFiles","defaultValidateFiles","noop","EMPTY_LIST","EMPTY_OBJECT","useFileUpload","maxFiles","extensions","minFileSize","maxFileSize","totalFileSize","concurrency","onDrop","propOnDrop","onChange","propOnChange","state","dispatch","reducer","action","type","stats","errors","readers","key","files","includes","reduce","file","progress","status","reader","fileStats","result","_reader","statsList","Object","values","totalFiles","length","totalBytes","size","queueFiles","pending","event","preventDefault","stopPropagation","dataTransfer","Array","from","e","Error","message","undefined","currentTarget","remove","keyOrKeys","forEach","fileKey","abort","reset","clearErrors","start","complete","createProgressEventHandler","lengthComputable","percentage","Math","round","loaded","total","uploading","push","lastIndex","max","queue","slice","FileReader","addEventListener","parser","process","env","NODE_ENV","accept","s","ext"],"mappings":"AAAA;AACA,SAASA,MAAM,QAAQ,SAAS;AAChC,SACEC,WAAW,EACXC,SAAS,EACTC,UAAU,QAGL,QAAQ;AACf,SACEC,eAAe,EACfC,iBAAiBC,oBAAoB,EACrCC,mBAAmBC,sBAAsB,EACzCC,iBAAiBC,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O;QACLhE,OAAOc;QACPb;QACA6D;QACA3C;QACAF;QACA1B;QACAE;QACA8C;QACAL;QACAM;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/useListboxProvider.ts"],"sourcesContent":["\"use client\";\nimport { createContext, useContext, type RefObject } from \"react\";\n\n/**\n * @internal\n * \\@remarks \\@since 6.0.0\n */\nexport interface ListboxContext {\n /**\n * This ref is used to trigger the change event when an option is clicked.\n */\n inputRef: RefObject<HTMLInputElement>;\n\n /**\n * This is used within the `Option` component to determine if it is currently\n * selected or not.\n */\n currentValue: string | number | null;\n\n disableSelectedIcon: boolean;\n}\n\nconst context = createContext<ListboxContext>({\n inputRef: { current: null },\n currentValue: null,\n disableSelectedIcon: false,\n});\n\n/**\n * **Client Component**\n *\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport const { Provider: ListboxProvider } = context;\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport function useListboxContext(): ListboxContext {\n return useContext(context);\n}\n"],"names":["createContext","useContext","context","inputRef","current","currentValue","disableSelectedIcon","Provider","ListboxProvider","useListboxContext"],"mappings":"AAAA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAwB,QAAQ;AAqBlE,MAAMC,UAAUF,cAA8B;IAC5CG,UAAU;QAAEC,SAAS;IAAK;IAC1BC,cAAc;IACdC,qBAAqB;AACvB;AAEA;;;;;CAKC,GACD,OAAO,MAAM,EAAEC,UAAUC,eAAe,EAAE,GAAGN,QAAQ;AAErD;;;CAGC,GACD,OAAO,SAASO;IACd,OAAOR,WAAWC;AACpB"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/useNumberField.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { type UseStateInitializer, type UseStateSetter } from \"../types.js\";\nimport { withinRange } from \"../utils/withinRange.js\";\nimport {\n useTextField,\n type ProvidedTextFieldMessageProps,\n type ProvidedTextFieldProps,\n type TextFieldHookOptions,\n type TextFieldHookState,\n type TextFieldImplementation,\n type ValidatedTextFieldImplementation,\n} from \"./useTextField.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @remarks \\@since 2.5.0 */\nexport interface NumberFieldConstraints {\n /**\n * An optional min value for the number field.\n */\n min?: number;\n\n /**\n * An optional max value for the number field.\n */\n max?: number;\n\n /**\n * An optional step amount to use.\n *\n * Note: The `min` and `max` values must be divisible by this value when any\n * are defined.\n */\n step?: number;\n}\n\n/**\n * @remarks\n * \\@since 2.5.0\n * \\@since 6.0.0\n * - Removed `updateOnChange` in favor of `updateValue`\n * - Renamed `fixOnBlur` to `updateValueOnBlur`\n */\nexport interface NumberFieldHookOptions\n extends Omit<\n TextFieldHookOptions<HTMLInputElement>,\n \"defaultValue\" | \"isNumber\"\n >,\n NumberFieldConstraints {\n /**\n * @defaultValue `undefined`\n */\n defaultValue?: UseStateInitializer<number>;\n\n /**\n * This controls the behavior for the `value` returned by this hook. If you\n * need access to the current value immediately as the user types to update\n * other components, keep this as the default of `\"change\"`. Otherwise, set\n * this to `\"blur\"`.\n *\n * @example\n * Deferring Updates on Blur\n * ```tsx\n * import { TextField, useNumberField } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { fieldProps, value } = useNumberField({\n * min: 0,\n * max: 100,\n * name: \"someName\",\n * defaultValue: 0,\n * updateValue: \"blur\",\n * });\n *\n * const result = useMemo(() => someExpensiveComputation(value), [value]);\n *\n * return <TextField {...fieldProps} label=\"Label\" />;\n * }\n * ```\n *\n * @defaultValue `\"change\"`\n */\n updateValue?: \"blur\" | \"change\";\n\n /**\n * This option is used to update the `number` value and text field value to be\n * within the `min` and `max` range or just format the text field value when\n * the input is blurred. This update will only be applied if the text field\n * contains a valid number. Using `min = 0` and `max = 10`:\n *\n * | text value | updated value |\n * | ---------- | ------------- |\n * | 000001 | 1 |\n * | -1 | 0 |\n * | 20 | 10 |\n * | -12 | 0 |\n * | --1 | --1 |\n * | fjdka | fjdka |\n *\n *\n * Set this to `false` if no changed should be applied and force the user to\n * fix any min/max errors manually and maintain weird formatting.\n *\n * @defaultValue `true`\n * @remarks \\@since 6.0.0 This was renamed from `fixOnBlur` and removed the\n * `\"min\"` and `\"max\"` behavior.\n */\n updateValueOnBlur?: boolean;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface NumberFieldHookState\n extends Omit<TextFieldHookState, \"value\"> {\n value: number | undefined;\n}\n\n/** @remarks \\@since 2.5.6 */\nexport interface ProvidedNumberFieldProps\n extends ProvidedTextFieldProps<HTMLInputElement>,\n NumberFieldConstraints {\n type: \"number\";\n}\n\n/** @remarks \\@since 2.5.6 */\nexport interface ProvidedNumberFieldMessageProps\n extends ProvidedTextFieldMessageProps<HTMLInputElement>,\n NumberFieldConstraints {\n type: \"number\";\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface NumberFieldImplementation\n extends Omit<\n TextFieldImplementation<HTMLInputElement>,\n \"value\" | \"setState\"\n > {\n value: number | undefined;\n setState: UseStateSetter<NumberFieldHookState>;\n fieldProps: ProvidedNumberFieldProps;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface NumberFieldWithMessageImplementation\n extends NumberFieldImplementation {\n fieldProps: ProvidedNumberFieldMessageProps;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface ValidatedNumberFieldImplementation\n extends Omit<\n ValidatedTextFieldImplementation<HTMLInputElement>,\n \"value\" | \"setState\"\n > {\n value: number | undefined;\n setState: UseStateSetter<NumberFieldHookState>;\n fieldProps: ProvidedNumberFieldProps | ProvidedNumberFieldMessageProps;\n}\n\n/**\n * @example\n * Enforce Number Value and No Error Messages\n * ```tsx\n * import { TextField, useNumberField } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { fieldProps, value } = useNumberField({\n * min: 0,\n * max: 100,\n * name: \"someName\",\n * defaultValue: 0,\n * disableMessage: true,\n * });\n *\n * // this is safe since `value` will always be a number even if there is a\n * // validation error. since the min and max options were provided as well,\n * // number will be between that range as well.\n * const computed = value * 10;\n *\n * return <TextField {...fieldProps} label=\"Label\" />;\n * }\n *\n * @see {@link useTextField}\n * @see {@link useNumberField} overrides for other examples.\n * ```\n */\nexport function useNumberField(\n options: NumberFieldHookOptions & {\n disableMessage: true;\n defaultValue: UseStateInitializer<number>;\n }\n): NumberFieldImplementation & {\n value: number;\n setState: UseStateSetter<NumberFieldHookState & { value: number }>;\n};\n\n/**\n * @example\n * No Error Messages\n * ```tsx\n * import { TextField, useNumberField } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { fieldProps, value } = useNumberField({\n * min: 0,\n * max: 100,\n * name: \"someName\",\n * disableMessage: true,\n * });\n *\n * // `value` will be `undefined` until the user enters a valid value once\n * // there is a valid value, `value` will be a `number`. So this might cause\n * // `computed` to be `NaN | number`\n * //\n * // const computed = value * 10;\n *\n * return <TextField {...fieldProps} label=\"Label\" />;\n * }\n * ```\n *\n * @see {@link useTextField}\n * @see {@link useNumberField} overrides for other examples.\n */\nexport function useNumberField(\n options: NumberFieldHookOptions & { disableMessage: true }\n): NumberFieldImplementation;\n\n/**\n * @example\n * Enforce Number Value\n * ```tsx\n * import { TextField, useNumberField } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { fieldProps, value } = useNumberField({\n * min: 0,\n * max: 100,\n * name: \"someName\",\n * defaultValue: 0,\n * });\n *\n * // this is safe since `value` will always be a number even if there is a\n * // validation error. since the min and max options were provided as well,\n * // number will be between that range as well.\n * const computed = value * 10;\n *\n * return <TextField {...fieldProps} label=\"Label\" />;\n * }\n * ```\n *\n * @example\n * Enforce Number Value and Deferring Updates\n * ```tsx\n * import { TextField, useNumberField } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { fieldProps, value } = useNumberField({\n * min: 0,\n * max: 100,\n * name: \"someName\",\n * defaultValue: 0,\n * updateValue: \"blur\",\n * });\n *\n * // the `value` will only be updated whenever the `TextField` is blurred.\n * // This is helpful if the `value` is used in expensive computations or\n * // updates that do not need to be updated as the user types\n * const computed = value * 10;\n *\n * return <TextField {...fieldProps} label=\"Label\" />;\n * }\n * ```\n *\n * @see {@link useTextField}\n * @see {@link useNumberField} overrides for other examples.\n */\nexport function useNumberField(\n options: NumberFieldHookOptions & {\n defaultValue: UseStateInitializer<number>;\n }\n): NumberFieldWithMessageImplementation & {\n value: number;\n setState: UseStateSetter<NumberFieldHookState & { value: number }>;\n};\n\n/**\n * The `useNumberField` hook is used to control the state of a `TextField` or\n * `<input type=\"number\">`\n *\n * @example\n * Default Implementation\n * ```tsx\n * import { TextField, useNumberField } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { fieldProps, value } = useNumberField({\n * name: \"someName\",\n * });\n *\n * // `value` will be `undefined` until the user enters a valid value once\n * // there is a valid value, `value` will be a `number`. So this might cause\n * // `computed` to be `NaN | number`\n * //\n * // const computed = value * 10;\n *\n * // whenever there is an error, an error message will be displayed below the\n * // `TextField`\n * return <TextField {...fieldProps} label=\"Label\" />;\n * }\n * ```\n *\n * @example\n * Adding Constraints\n * ```tsx\n * import { TextField, useNumberField } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { fieldProps, value } = useNumberField({\n * name: \"someName\",\n * min: 0,\n * max: 100,\n * step: 2,\n * required: true,\n * });\n *\n * return <TextField {...fieldProps} label=\"Label\" />;\n * }\n * ```\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation\n * @see {@link useTextField}\n */\nexport function useNumberField(\n options: NumberFieldHookOptions\n): NumberFieldWithMessageImplementation;\n\n/**\n * @internal\n * @see {@link useTextField}\n * @see {@link useNumberField} overrides for other examples.\n */\nexport function useNumberField(\n options: NumberFieldHookOptions\n): ValidatedNumberFieldImplementation {\n const {\n min,\n max,\n step,\n onBlur = noop,\n onChange = noop,\n updateValue = \"change\",\n updateValueOnBlur = true,\n defaultValue,\n ...textOptions\n } = options;\n\n const [number, setNumber] = useState(defaultValue);\n const initial = useRef(number);\n const {\n value: _value,\n reset: resetTextField,\n fieldProps,\n setState: setTextFieldState,\n ...remaining\n } = useTextField({\n ...textOptions,\n isNumber: true,\n defaultValue: `${number ?? \"\"}`,\n onBlur(event) {\n onBlur(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n const input = event.currentTarget;\n input.setCustomValidity(\"\");\n input.checkValidity();\n if (\n !updateValueOnBlur ||\n // do nothing else since it's a weird value like: `\"--0\"` which causes\n // the value to be `\"\"` and `numberAsValue` to be `NaN`\n input.validity.badInput\n ) {\n return;\n }\n\n let value = input.valueAsNumber;\n if (input.value === \"\" && typeof initial.current === \"number\") {\n value = min ?? initial.current;\n }\n\n // can't have both rangeUnderflow and rangeOverflow at the same time, so\n // it's \"safe\" to always provide both\n value = withinRange({ min, max, value });\n if (!Number.isNaN(value)) {\n setNumber(value);\n input.value = `${value}`;\n } else if (typeof initial.current === \"undefined\") {\n setNumber(undefined);\n }\n },\n onChange(event) {\n onChange(event);\n if (event.isPropagationStopped() || updateValue === \"blur\") {\n return;\n }\n\n const input = event.currentTarget;\n input.checkValidity();\n const value = withinRange({\n min,\n max,\n value: event.currentTarget.valueAsNumber,\n });\n if (\n !input.validity.valid &&\n !input.validity.rangeUnderflow &&\n !input.validity.rangeOverflow\n ) {\n return;\n }\n\n if (!Number.isNaN(value)) {\n setNumber(value);\n } else if (initial.current === undefined) {\n setNumber(undefined);\n }\n },\n });\n\n const reset = useCallback(() => {\n resetTextField();\n setNumber(initial.current);\n }, [resetTextField]);\n const setState = useCallback<UseStateSetter<NumberFieldHookState>>(\n (nextState) => {\n if (typeof nextState === \"function\") {\n setNumber((prevNumber) => {\n let nextNumber: number | undefined = prevNumber;\n setTextFieldState((prevState) => {\n const updated = nextState({\n ...prevState,\n value: prevNumber,\n });\n\n nextNumber = updated.value;\n\n return {\n ...updated,\n value: `${nextNumber ?? \"\"}`,\n };\n });\n\n return nextNumber;\n });\n return;\n }\n\n const { value, error, errorMessage } = nextState;\n setNumber(value);\n setTextFieldState({\n value: `${value ?? \"\"}`,\n error,\n errorMessage,\n });\n },\n [setTextFieldState]\n );\n\n return {\n ...remaining,\n reset,\n value: number,\n setState,\n fieldProps: {\n ...fieldProps,\n min,\n max,\n step,\n type: \"number\",\n },\n };\n}\n"],"names":["useCallback","useRef","useState","withinRange","useTextField","noop","useNumberField","options","min","max","step","onBlur","onChange","updateValue","updateValueOnBlur","defaultValue","textOptions","number","setNumber","initial","value","_value","reset","resetTextField","fieldProps","setState","setTextFieldState","remaining","isNumber","event","isPropagationStopped","input","currentTarget","setCustomValidity","checkValidity","validity","badInput","valueAsNumber","current","Number","isNaN","undefined","valid","rangeUnderflow","rangeOverflow","nextState","prevNumber","nextNumber","prevState","updated","error","errorMessage","type"],"mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAEtD,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SACEC,YAAY,QAOP,oBAAoB;AAE3B,MAAMC,OAAO;AACX,aAAa;AACf;AAyUA;;;;CAIC,GACD,OAAO,SAASC,eACdC,OAA+B;IAE/B,MAAM,EACJC,GAAG,EACHC,GAAG,EACHC,IAAI,EACJC,SAASN,IAAI,EACbO,WAAWP,IAAI,EACfQ,cAAc,QAAQ,EACtBC,oBAAoB,IAAI,EACxBC,YAAY,EACZ,GAAGC,aACJ,GAAGT;IAEJ,MAAM,CAACU,QAAQC,UAAU,GAAGhB,SAASa;IACrC,MAAMI,UAAUlB,OAAOgB;IACvB,MAAM,EACJG,OAAOC,MAAM,EACbC,OAAOC,cAAc,EACrBC,UAAU,EACVC,UAAUC,iBAAiB,EAC3B,GAAGC,WACJ,GAAGvB,aAAa;QACf,GAAGY,WAAW;QACdY,UAAU;QACVb,cAAc,CAAC,EAAEE,UAAU,GAAG,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IAEA,MAAMnB,QAAQtB,YAAY;QACxBuB;QACAL,UAAUC,QAAQmB,OAAO;IAC3B,GAAG;QAACf;KAAe;IACnB,MAAME,WAAWzB,YACf,CAAC6C;QACC,IAAI,OAAOA,cAAc,YAAY;YACnC3B,UAAU,CAAC4B;gBACT,IAAIC,aAAiCD;gBACrCpB,kBAAkB,CAACsB;oBACjB,MAAMC,UAAUJ,UAAU;wBACxB,GAAGG,SAAS;wBACZ5B,OAAO0B;oBACT;oBAEAC,aAAaE,QAAQ7B,KAAK;oBAE1B,OAAO;wBACL,GAAG6B,OAAO;wBACV7B,OAAO,CAAC,EAAE2B,cAAc,GAAG,CAAC;oBAC9B;gBACF;gBAEA,OAAOA;YACT;YACA;QACF;QAEA,MAAM,EAAE3B,KAAK,EAAE8B,KAAK,EAAEC,YAAY,EAAE,GAAGN;QACvC3B,UAAUE;QACVM,kBAAkB;YAChBN,OAAO,CAAC,EAAEA,SAAS,GAAG,CAAC;YACvB8B;YACAC;QACF;IACF,GACA;QAACzB;KAAkB;IAGrB,OAAO;QACL,GAAGC,SAAS;QACZL;QACAF,OAAOH;QACPQ;QACAD,YAAY;YACV,GAAGA,UAAU;YACbhB;YACAC;YACAC;YACA0C,MAAM;QACR;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/useRadioGroup.ts"],"sourcesContent":["\"use client\";\nimport {\n useCallback,\n useRef,\n useState,\n type ChangeEventHandler,\n type FormEventHandler,\n} from \"react\";\nimport { type UseStateInitializer, type UseStateSetter } from \"../types.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @remarks \\@since 6.0.0 */\nexport interface RadioGroupOptions<T extends string | number> {\n /**\n * A `name` to apply to all the radios within the group. This is required if\n * unless {@link menu} is set to `true`.\n */\n name?: string;\n\n /**\n * Set this to `true` if using the `MenuItemRadio` component instead of the\n * `Radio` so the correct props can be provided.\n *\n * @defaultValue `false`\n */\n menu?: boolean;\n\n /**\n * The value of a radio that should be checked by default. If you want to\n * force the user to select one of the radios, keep this as the empty string\n * or set it to a string or number that does not represent a valid radio\n * value.\n *\n * @defaultValue `\"\"`\n */\n defaultValue?: UseStateInitializer<T>;\n\n /**\n * Set this to `true` if one of the radios within the group must be checked before\n * a form can be submitted.\n *\n * This option is invalid and will be ignored if {@link menu} is `true`.\n *\n * @defaultValue `false`\n */\n required?: boolean;\n\n /**\n * If you need to prevent the default behavior in a radio group for some\n * reason, you can provide a custom `onCHange` event handler and call\n * `event.stopPropagation()`. This will be called whenever a new radio button\n * is checked.\n *\n * This option is invalid and will be ignored if {@link menu} is `true`.\n *\n * @defaultValue `() => {}`\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n\n /**\n * If the radio group has {@link required} set to `true`, the radios will gain\n * the `error` state if a form is submitted without a checked radio. If you\n * want to prevent that behavior for some reason, you can provide this\n * function and call `event.stopPropagation()`.\n *\n * This option is invalid and will be ignored if {@link menu} is `true`.\n *\n * @defaultValue `() => {}`\n */\n onInvalid?: FormEventHandler<HTMLInputElement>;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface ProvidedRadioGroupProps<V extends string | number> {\n name: string;\n value: V;\n checked: boolean;\n onChange: ChangeEventHandler<HTMLInputElement>;\n error: boolean;\n required: boolean;\n onInvalid: FormEventHandler<HTMLInputElement>;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport type GetRadioGroupProps<V extends string | number> = (\n value: V\n) => Readonly<ProvidedRadioGroupProps<V>>;\n\n/** @remarks \\@since 6.0.0 */\nexport interface RadioGroupImplementation<V extends string | number> {\n reset(): void;\n value: V;\n setValue: UseStateSetter<V>;\n getRadioProps: GetRadioGroupProps<V>;\n}\n\nexport type GetMenuItemRadioGroupProps<V extends string | number> = (\n value: V\n) => Readonly<{ checked: boolean; onCheckedChange(): void }>;\n\n/** @remarks \\@since 6.0.0 */\nexport interface MenuItemRadioGroupImplementation<V extends string | number> {\n reset(): void;\n value: V;\n setValue: UseStateSetter<V>;\n getRadioProps: GetMenuItemRadioGroupProps<V>;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface CombinedRadioGroupReturnValue<V extends string | number> {\n reset(): void;\n value: V;\n setValue: UseStateSetter<V>;\n getRadioProps?(value: V): {\n name?: string;\n value?: V;\n checked: boolean;\n error?: boolean;\n required?: boolean;\n onChange?: ChangeEventHandler<HTMLInputElement>;\n onCheckedChange?(): void;\n onInvalid?: FormEventHandler<HTMLInputElement>;\n };\n}\n\n// Note: These overrides are set up so that the value will default to any\n// string.\n\n/**\n * @example\n * Generic Number Example\n * ```tsx\n * const { value, getRadioProps } = useRadioGroup<number>({\n * name: \"group\",\n * defaultValue: -1\n * });\n *\n *\n * return (\n * <>\n * <Radio {...getRadioProps(0)} label=\"First\" />\n * <Radio {...getRadioProps(1)} label=\"Second\" />\n * <Radio {...getRadioProps(2)} label=\"Third\" />\n * </>\n * );\n * ```\n * @remarks \\@since 6.0.0\n */\nexport function useRadioGroup<V extends number>(\n options: RadioGroupOptions<V> & {\n menu?: false;\n name: string;\n defaultValue: UseStateInitializer<V>;\n }\n): RadioGroupImplementation<V>;\nexport function useRadioGroup<V extends number>(\n options: RadioGroupOptions<V> & {\n menu: true;\n name?: never;\n required?: never;\n onChange?: never;\n onInvalid?: never;\n defaultValue: UseStateInitializer<V>;\n }\n): MenuItemRadioGroupImplementation<V>;\n/**\n * @example\n * Generic String Example\n * ```tsx\n * const { value, getRadioProps } = useRadioGroup({ name: \"group\" });\n *\n * return (\n * <>\n * <Radio {...getRadioProps(\"a\")} label=\"First\" />\n * <Radio {...getRadioProps(\"b\")} label=\"Second\" />\n * <Radio {...getRadioProps(\"c\")} label=\"Third\" />\n * </>\n * );\n * ```\n *\n * @example\n * String Union Example\n * ```tsx\n * const values = [\n * { label: \"First\", value: \"a\" },\n * { label: \"Second\", value: \"b\" },\n * { label: \"Third\", value: \"c\" },\n * ] as const;\n *\n * type Values = typeof values[number][\"value\"];\n * // ^ \"a\" | \"b\" | \"c\"\n *\n * const { value, getRadioProps } = useRadioGroup<Values | \"\">({\n * name: \"group\",\n * defaultValue: \"\",\n * });\n *\n *\n * return (\n * <>\n * {values.map(({ label, value }) => (\n * <Radio {...getRadioProps(value)} key={value} label={label} />\n * ))}\n * </>\n * );\n * ```\n * @remarks \\@since 6.0.0\n */\nexport function useRadioGroup<V extends string>(\n options: RadioGroupOptions<V> & {\n menu?: false;\n name: string;\n defaultValue?: UseStateInitializer<V>;\n }\n): RadioGroupImplementation<V>;\nexport function useRadioGroup<V extends string>(\n options: RadioGroupOptions<V> & {\n menu: true;\n name?: never;\n required?: never;\n onChange?: never;\n onInvalid?: never;\n defaultValue?: UseStateInitializer<V>;\n }\n): MenuItemRadioGroupImplementation<V>;\n/**\n * @example\n * Strict Union Example\n * ```tsx\n * type ValidValues = 1 | 2 | 3 | 4 | \"\" | \"a\" | \"b\";\n *\n * const { value, getRadioProps } = useRadioGroup<ValidValues>({\n * name: \"group\",\n * defaultValue: \"\"\n * });\n *\n *\n * return (\n * <>\n * <Radio {...getRadioProps(1)} label=\"First\" />\n * <Radio {...getRadioProps(2)} label=\"Second\" />\n * <Radio {...getRadioProps(3)} label=\"Third\" />\n * <Radio {...getRadioProps(4)} label=\"Forth\" />\n * <Radio {...getRadioProps(\"a\")} label=\"Fifth\" />\n * <Radio {...getRadioProps(\"b\")} label=\"Sixth\" />\n * <Radio {...getRadioProps(\"c\")} label=\"Seventh\" />\n * </>\n * );\n * ```\n * @remarks \\@since 6.0.0\n */\nexport function useRadioGroup<V extends string | number>(\n options: RadioGroupOptions<V>\n): CombinedRadioGroupReturnValue<V> {\n const {\n name,\n defaultValue,\n menu = false,\n required,\n onChange = noop,\n onInvalid = noop,\n } = options;\n const [value, setValue] = useState<V>(() => {\n if (typeof defaultValue === \"function\") {\n return defaultValue();\n }\n\n return defaultValue ?? (\"\" as V);\n });\n const initial = useRef(value);\n const [error, setError] = useState(false);\n\n return {\n reset: useCallback(() => {\n setError(false);\n setValue(initial.current);\n }, []),\n value,\n setValue,\n getRadioProps(radioValue) {\n const checked = value === radioValue;\n if (menu) {\n return {\n checked,\n onCheckedChange() {\n setValue(radioValue);\n },\n };\n }\n\n return {\n name,\n value: radioValue,\n error,\n checked,\n required,\n onChange(event) {\n onChange(event);\n setError(false);\n setValue(radioValue);\n },\n onInvalid(event) {\n onInvalid(event);\n setError(true);\n },\n };\n },\n };\n}\n"],"names":["useCallback","useRef","useState","noop","useRadioGroup","options","name","defaultValue","menu","required","onChange","onInvalid","value","setValue","initial","error","setError","reset","current","getRadioProps","radioValue","checked","onCheckedChange","event"],"mappings":"AAAA;AACA,SACEA,WAAW,EACXC,MAAM,EACNC,QAAQ,QAGH,QAAQ;AAGf,MAAMC,OAAO;AACX,aAAa;AACf;AAwNA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,OAAO,SAASC,cACdC,OAA6B;IAE7B,MAAM,EACJC,IAAI,EACJC,YAAY,EACZC,OAAO,KAAK,EACZC,QAAQ,EACRC,WAAWP,IAAI,EACfQ,YAAYR,IAAI,EACjB,GAAGE;IACJ,MAAM,CAACO,OAAOC,SAAS,GAAGX,SAAY;QACpC,IAAI,OAAOK,iBAAiB,YAAY;YACtC,OAAOA;QACT;QAEA,OAAOA,gBAAiB;IAC1B;IACA,MAAMO,UAAUb,OAAOW;IACvB,MAAM,CAACG,OAAOC,SAAS,GAAGd,SAAS;IAEnC,OAAO;QACLe,OAAOjB,YAAY;YACjBgB,SAAS;YACTH,SAASC,QAAQI,OAAO;QAC1B,GAAG,EAAE;QACLN;QACAC;QACAM,eAAcC,UAAU;YACtB,MAAMC,UAAUT,UAAUQ;YAC1B,IAAIZ,MAAM;gBACR,OAAO;oBACLa;oBACAC;wBACET,SAASO;oBACX;gBACF;YACF;YAEA,OAAO;gBACLd;gBACAM,OAAOQ;gBACPL;gBACAM;gBACAZ;gBACAC,UAASa,KAAK;oBACZb,SAASa;oBACTP,SAAS;oBACTH,SAASO;gBACX;gBACAT,WAAUY,KAAK;oBACbZ,UAAUY;oBACVP,SAAS;gBACX;YACF;QACF;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/useRangeSlider.ts"],"sourcesContent":["\"use client\";\nimport { useState } from \"react\";\nimport { type UseStateInitializer, type UseStateSetter } from \"../types.js\";\nimport { type SliderValueOptions } from \"./useSlider.js\";\n\n/**\n * @remarks\n * \\@since 2.5.0\n * \\@since 6.0.0 Updated to use labeled tuple.\n */\nexport type RangeSliderValue = readonly [minValue: number, maxValue: number];\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface RangeSliderState {\n rangeValue: RangeSliderValue;\n setRangeValue: UseStateSetter<RangeSliderValue>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface RangeSliderOptions extends SliderValueOptions {\n defaultValue?: UseStateInitializer<RangeSliderValue>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface RangeSliderImplementation\n extends Required<SliderValueOptions>,\n RangeSliderState {}\n\n/**\n * @example\n * Range Slider Example\n * ```tsx\n * import { Fieldset, Form, Legend, Slider, useRangeSlider } from \"@react-md/core\";\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 The `Slider` component for additional examples.\n * @remarks\n * \\@since 2.5.0\n * \\@since 6.0.0 Now returns an object instead of an ordered tuple and only\n * return the `rangeValue` and `setRangeValue` instead of all the slider\n * functionality. In addition, the hook only accepts a single object argument.\n */\nexport function useRangeSlider(\n options: RangeSliderOptions = {}\n): RangeSliderImplementation {\n const { min = 0, max = 100, step = 1, defaultValue } = options;\n const [rangeValue, setRangeValue] = useState<RangeSliderValue>(\n defaultValue ?? [min, max]\n );\n\n return {\n min,\n max,\n step,\n rangeValue,\n setRangeValue,\n };\n}\n"],"names":["useState","useRangeSlider","options","min","max","step","defaultValue","rangeValue","setRangeValue"],"mappings":"AAAA;AACA,SAASA,QAAQ,QAAQ,QAAQ;AAiCjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCC,GACD,OAAO,SAASC,eACdC,UAA8B,CAAC,CAAC;IAEhC,MAAM,EAAEC,MAAM,CAAC,EAAEC,MAAM,GAAG,EAAEC,OAAO,CAAC,EAAEC,YAAY,EAAE,GAAGJ;IACvD,MAAM,CAACK,YAAYC,cAAc,GAAGR,SAClCM,gBAAgB;QAACH;QAAKC;KAAI;IAG5B,OAAO;QACLD;QACAC;QACAC;QACAE;QACAC;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/useResizingTextArea.ts"],"sourcesContent":["\"use client\";\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type ChangeEventHandler,\n type RefCallback,\n type RefObject,\n} from \"react\";\nimport { useResizeObserver } from \"../useResizeObserver.js\";\n\n// this is the default of 1.5rem line-height in the styles\nconst DEFAULT_LINE_HEIGHT = \"24\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * A textarea is normally resizable in browsers by default by dragging the\n * bottom right corner to the desired size which will set inline styles for\n * `height` and `width`. Since this makes creating layouts a bit more difficult,\n * this is disabled by default but can be configured using one of these values:\n *\n * - `\"auto\"` - The textarea will automatically grow in in height as the user\n * types until a max number of rows have been added. If there is additional\n * text, a scrollbar will appear in the textarea. The browser's native resize\n * behavior is disabled.\n * - `\"none\"` - The textarea's height and width will remain static\n * - `\"horizontal\"` - The textarea's width can be resized by the browser's\n * native resize behavior.\n * - `\"vertical\"` - The textarea's height can be resized by the browser's native\n * resize behavior.\n * - `\"both\"` - The browser's native resize behavior will be allowed.\n */\nexport type TextAreaResize =\n | \"none\"\n | \"auto\"\n | \"horizontal\"\n | \"vertical\"\n | \"both\";\n\n/** @internal */\nexport interface ResizingTextAreaOptions {\n resize: TextAreaResize;\n maxRows: number;\n onChange: ChangeEventHandler<HTMLTextAreaElement> | undefined;\n containerRef: RefObject<HTMLDivElement>;\n}\n\n/** @internal */\nexport interface ResizingTextAreaReturnValue {\n height: string | undefined;\n maskRef: RefCallback<HTMLTextAreaElement>;\n onChange: ChangeEventHandler<HTMLTextAreaElement>;\n scrollable: boolean;\n}\n\n/** @internal */\nexport function useResizingTextArea(\n options: ResizingTextAreaOptions\n): ResizingTextAreaReturnValue {\n const { maxRows, resize, onChange = noop, containerRef } = options;\n\n const maskRef = useRef<HTMLTextAreaElement>(null);\n const [height, setHeight] = useState<number>();\n const [scrollable, setScrollable] = useState(false);\n useEffect(() => {\n if (resize !== \"auto\") {\n setHeight(undefined);\n }\n }, [resize]);\n\n const updateHeight = useCallback(() => {\n const mask = maskRef.current;\n const container = containerRef.current;\n if (!mask || !container) {\n return;\n }\n\n const containerStyles = window.getComputedStyle(container);\n const borderHeight =\n parseFloat(containerStyles.borderTopWidth) +\n parseFloat(containerStyles.borderBottomWidth);\n let nextHeight = mask.scrollHeight + borderHeight;\n /* istanbul ignore if */\n if (maxRows > 0) {\n const lineHeight = parseFloat(\n window.getComputedStyle(mask).lineHeight || DEFAULT_LINE_HEIGHT\n );\n const maxHeight = maxRows * lineHeight;\n nextHeight = Math.min(maxHeight, nextHeight);\n\n // only want the textarea to be scrollable if there's a limit on the rows\n // since it'll flash the scrollbar on most OS during the height transition\n if (nextHeight === maxHeight && !scrollable) {\n setScrollable(true);\n } else if (nextHeight !== maxHeight && scrollable) {\n setScrollable(false);\n }\n }\n\n setHeight(nextHeight + 2);\n }, [containerRef, maxRows, scrollable]);\n\n const maskRefCallback = useResizeObserver({\n ref: maskRef,\n onUpdate: updateHeight,\n disableHeight: true,\n });\n\n return {\n height: typeof height === \"number\" ? `${height}px` : undefined,\n maskRef: maskRefCallback,\n scrollable,\n onChange(event) {\n const mask = maskRef.current;\n onChange(event);\n if (event.isPropagationStopped() || !mask || resize !== \"auto\") {\n return;\n }\n\n // to get the height transition to work, you have to set the height on:\n // - the main container element (including padding) that has the height\n // transition enabled\n // - a child div wrapper (without padding) that has the height transition\n // enabled\n // - the textarea element (without padding) and without a height transition\n //\n // if it isn't done this way, the height transition will look weird since\n // the text will be fixed to the bottom of the area and more text at the top\n // will become visible as the height transition completes. applying the\n // transition on the two parent elements work because:\n // - the height is set immediately on the text field so it expands to show all\n // the text\n // - the height is correctly applied to both parent elements, but their height\n // haven't fully been adjusted due to the animation\n // - the parent divs have overflow visible by default, so the textarea's text\n // will expand past the boundaries of the divs and not cause the upwards\n // animation weirdness.\n mask.value = event.currentTarget.value;\n updateHeight();\n },\n };\n}\n"],"names":["useCallback","useEffect","useRef","useState","useResizeObserver","DEFAULT_LINE_HEIGHT","noop","useResizingTextArea","options","maxRows","resize","onChange","containerRef","maskRef","height","setHeight","scrollable","setScrollable","undefined","updateHeight","mask","current","container","containerStyles","window","getComputedStyle","borderHeight","parseFloat","borderTopWidth","borderBottomWidth","nextHeight","scrollHeight","lineHeight","maxHeight","Math","min","maskRefCallback","ref","onUpdate","disableHeight","event","isPropagationStopped","value","currentTarget"],"mappings":"AAAA;AACA,SACEA,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QAIH,QAAQ;AACf,SAASC,iBAAiB,QAAQ,0BAA0B;AAE5D,0DAA0D;AAC1D,MAAMC,sBAAsB;AAE5B,MAAMC,OAAO;AACX,aAAa;AACf;AA0CA,cAAc,GACd,OAAO,SAASC,oBACdC,OAAgC;IAEhC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEC,WAAWL,IAAI,EAAEM,YAAY,EAAE,GAAGJ;IAE3D,MAAMK,UAAUX,OAA4B;IAC5C,MAAM,CAACY,QAAQC,UAAU,GAAGZ;IAC5B,MAAM,CAACa,YAAYC,cAAc,G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,EAAE;YACF,yEAAyE;YACzE,4EAA4E;YAC5E,uEAAuE;YACvE,sDAAsD;YACtD,8EAA8E;YAC9E,cAAc;YACd,8EAA8E;YAC9E,sDAAsD;YACtD,6EAA6E;YAC7E,2EAA2E;YAC3E,0BAA0B;YAC1BU,KAAKsB,KAAK,GAAGF,MAAMG,aAAa,CAACD,KAAK;YACtCvB;QACF;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/useSlider.ts"],"sourcesContent":["\"use client\";\nimport { useState } from \"react\";\nimport { type UseStateInitializer, type UseStateSetter } from \"../types.js\";\nimport { getRangeDefaultValue } from \"../utils/getRangeDefaultValue.js\";\n\n/**\n * @remarks \\@since 2.5.0\n */\nexport interface SliderValueOptions {\n /**\n * The min value for the slider.\n *\n * @defaultValue `0`\n */\n min?: number;\n\n /**\n * The max value for the slider.\n *\n * @defaultValue `100`\n */\n max?: number;\n\n /**\n * A positive number representing the value to \"jump\" while incrementing or\n * decrementing the slider's value. This should normally stay as the default\n * value of `1`, but can also be decimal values if needed.\n *\n * @defaultValue `1`\n */\n step?: number;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface SliderState {\n value: number;\n setValue: UseStateSetter<number>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface SliderImplementation\n extends Required<SliderValueOptions>,\n SliderState {}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface SliderOptions extends SliderValueOptions {\n /**\n * @defaultValue `(max - min ) / 2`\n */\n defaultValue?: UseStateInitializer<number>;\n}\n\n/**\n * @example\n * Simple Example\n * ```tsx\n * import { Form, Slider, useSlider } from \"@react-md/core\";\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 * @see The `Slider` component for additional examples.\n * @remarks\n * \\@since 2.5.0\n * \\@since 6.0.0 Now returns an object instead of an ordered tuple and only\n * return the `value` and `setValue` instead of all the slider functionality. In\n * addition, the hook only accepts a single object argument.\n */\nexport function useSlider(options: SliderOptions = {}): SliderImplementation {\n const { min = 0, max = 100, step = 1, defaultValue } = options;\n const [value, setValue] = useState(\n getRangeDefaultValue({\n min,\n max,\n step,\n defaultValue,\n })\n );\n\n return {\n min,\n max,\n step,\n value,\n setValue,\n };\n}\n"],"names":["useState","getRangeDefaultValue","useSlider","options","min","max","step","defaultValue","value","setValue"],"mappings":"AAAA;AACA,SAASA,QAAQ,QAAQ,QAAQ;AAEjC,SAASC,oBAAoB,QAAQ,mCAAmC;AAuDxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCC,GACD,OAAO,SAASC,UAAUC,UAAyB,CAAC,CAAC;IACnD,MAAM,EAAEC,MAAM,CAAC,EAAEC,MAAM,GAAG,EAAEC,OAAO,CAAC,EAAEC,YAAY,EAAE,GAAGJ;IACvD,MAAM,CAACK,OAAOC,SAAS,GAAGT,SACxBC,qBAAqB;QACnBG;QACAC;QACAC;QACAC;IACF;IAGF,OAAO;QACLH;QACAC;QACAC;QACAE;QACAC;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/useTextField.ts"],"sourcesContent":["\"use client\";\nimport {\n useCallback,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n type RefCallback,\n type RefObject,\n} from \"react\";\nimport { getIcon } from \"../icon/iconConfig.js\";\nimport { type UseStateInitializer, type UseStateSetter } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { type TextFieldProps } from \"./TextField.js\";\nimport {\n type FormMessageInputLengthCounterProps,\n type FormMessageProps,\n} from \"./types.js\";\nimport {\n defaultGetErrorIcon,\n defaultGetErrorMessage,\n defaultIsErrored,\n type ErrorMessageOptions,\n type GetErrorIcon,\n type GetErrorMessage,\n type IsErrored,\n type TextFieldValidationOptions,\n type TextFieldValidationType,\n} from \"./validation.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @remarks\n * \\@since 2.5.0\n * \\@since 6.0.0 Added the `onInvalid` handler\n */\nexport type TextFieldChangeHandlers<\n E extends HTMLInputElement | HTMLTextAreaElement,\n> = Pick<HTMLAttributes<E>, \"onBlur\" | \"onChange\" | \"onInvalid\">;\n\n/** @remarks \\@since 6.0.0 */\nexport interface ErrorChangeHandlerOptions<\n E extends HTMLInputElement | HTMLTextAreaElement,\n> {\n /**\n * A ref containing the `TextField` or `TextArea` if you need access to that\n * DOM node for error reporting.\n */\n ref: RefObject<E>;\n\n /**\n * The current name for the `TextField` or `TextArea`.\n */\n name: string;\n\n /**\n * This will be `true` when the `TextField`/`TextArea` has an error.\n */\n error: boolean;\n\n /**\n * The error message returned by {@link GetErrorMessage}/the browser's\n * validation message. This is normally an empty string when the {@link error}\n * state is `false`.\n */\n errorMessage: string;\n}\n\n/**\n * A function that reports the error state changing. A good use-case for this is\n * to keep track of all the errors within your form and keep a submit button\n * disabled until they have been resolved.\n *\n * Example:\n *\n * ```ts\n * const [errors, setErrors] = useState<Record<string, boolean | undefined>>({});\n * const onErrorChange: ErrorChangeHandler = ({ name, error }) =>\n * setErrors((prevErrors) => ({ ...prevErrors, [name]: error }));\n *\n * const invalid = Object.values(errors).some(Boolean);\n *\n * // form implementation is left as an exercise for the reader\n * <Button type=\"submit\" disabled={invalid} onClick={submitForm}>Submit</Button>\n * ```\n *\n * @remarks\n * \\@since 2.5.0\n * \\@since 6.0.0 Changed to object argument.\n */\nexport type ErrorChangeHandler<\n E extends HTMLInputElement | HTMLTextAreaElement,\n> = (options: ErrorChangeHandlerOptions<E>) => void;\n\n/** @remarks \\@since 2.5.6 */\nexport interface TextFieldHookState {\n /**\n * The current value for the `TextField` or `TextArea`.\n */\n value: string;\n\n /**\n * This will be `true` when the `TextField`/`TextArea` has an error.\n */\n error: boolean;\n\n /**\n * The error message returned by {@link GetErrorMessage}/the browser's\n * validation message. This is normally an empty string when the {@link error}\n * state is `false`.\n */\n errorMessage: string;\n}\n\n/**\n * All the props that will be generated and return from the `useTextField` hook\n * that should be passed to a `FormMessage` component.\n *\n * @remarks \\@since 2.5.0\n */\nexport interface ProvidedFormMessageProps\n extends Pick<FormMessageProps, \"id\" | \"theme\" | \"children\">,\n Required<Pick<TextFieldProps, \"error\">>,\n Partial<Pick<FormMessageInputLengthCounterProps, \"length\" | \"maxLength\">> {}\n\n/**\n * All the props that will be generated and returned by the `useTextField` hook\n * that should be passed to a `TextField` component.\n *\n * @remarks \\@since 2.5.0\n */\nexport interface ProvidedTextFieldProps<\n E extends HTMLInputElement | HTMLTextAreaElement,\n> extends TextFieldValidationOptions,\n TextFieldChangeHandlers<E>,\n Required<Pick<TextFieldProps, \"id\" | \"name\" | \"value\" | \"error\">>,\n Pick<TextFieldProps, \"aria-describedby\" | \"rightAddon\"> {\n /**\n * A ref that must be passed to the `TextField`/`TextArea` so that the custom\n * validity behavior can work.\n *\n * @remarks \\@since 6.0.0\n */\n ref: RefCallback<E>;\n}\n\n/**\n * @remarks \\@since 2.5.0\n */\nexport interface ProvidedTextFieldMessageProps<\n E extends HTMLInputElement | HTMLTextAreaElement,\n> extends ProvidedTextFieldProps<E> {\n /**\n * These props will be defined as long as the `disableMessage` prop is not\n * `true` from the `useTextField` hook.\n */\n messageProps: ProvidedFormMessageProps;\n}\n\n/** @remarks \\@since 2.5.6 */\nexport interface TextFieldHookOptions<\n E extends HTMLInputElement | HTMLTextAreaElement,\n> extends TextFieldValidationOptions,\n TextFieldChangeHandlers<E> {\n /**\n * An optional id to use for the `TextField` or `TextArea` that is also used\n * to create an id for the inline help/error messages.\n *\n * @defaultValue `\"text-field-\" + useId()`\n */\n id?: string;\n\n /**\n * An optional ref that should be merged with the ref returned by this hook.\n * This should really only be used if you are making a custom component using\n * this hook and forwarding refs. If you need a ref to access the `<input>` or\n * `<textarea>` DOM node, you can use the `fieldRef` returned by this hook\n * instead.\n *\n * @example\n * Accessing TextField DOM Node\n * ```tsx\n * import { TextField, useTextField } from \"@react-md/core\";\n * import { useEffect } from \"react\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { fieldRef, fieldProps } = useTextField({ name: \"example\" });\n *\n * useEffect(() => {\n * fieldRef.current;\n * // ^ HTMLInputElement | null\n * }, [fieldRef]);\n *\n * return <TextField {...fieldProps} label=\"Example\" />;\n * }\n * ```\n */\n ref?: Ref<E>;\n\n /**\n * A unique name to attach to the `TextField`, `TextArea` or `Password`\n * component.\n */\n name: string;\n\n /**\n * Boolean if the `FormMessage` should also display a counter for the\n * remaining letters allowed based on the `maxLength`.\n *\n * This will still be considered false if the `maxLength` value is not\n * provided.\n *\n * @defaultValue `false`\n */\n counter?: boolean;\n\n /**\n * This is used internally for the `useNumberField` hook and probably\n * shouldn't be used otherwise. This is just passed into the\n * {@link getErrorMessage} options and is used for additional validation.\n *\n * @defaultValue `false`\n */\n isNumber?: boolean;\n\n /**\n * The default value to use for the `TextField` or `TextArea` one initial\n * render. If you want to manually change the value to something else after\n * the initial render, either change the `key` for the component containing\n * this hook, or use the `setState` function returned from this hook.\n *\n * @defaultValue `\"\"`\n */\n defaultValue?: UseStateInitializer<string>;\n\n /**\n * An optional help text to display in the `FormMessage` component when there\n * is not an error.\n */\n helpText?: ReactNode;\n\n /**\n * A function used to determine if the `TextField` or `TextArea` is an in\n * errored state.\n *\n * @see {@link defaultIsErrored}\n * @defaultValue `defaultIsErrored`\n */\n isErrored?: IsErrored;\n\n /**\n * An optional error icon used in the {@link getErrorIcon} option.\n *\n * @defaultValue `getIcon(\"error\")`\n */\n errorIcon?: ReactNode;\n\n /**\n * A function used to get the error icon to display at the right of the\n * `TextField` or `TextArea`. The default behavior will only show an icon when\n * the `error` state is `true` and an `errorIcon` option has been provided.\n *\n * @see {@link defaultGetErrorIcon}\n * @defaultValue `defaultGetErrorIcon`\n */\n getErrorIcon?: GetErrorIcon;\n\n /**\n * A function to get and display an error message based on the `TextField` or\n * `TextArea` validity.\n *\n * @see {@link defaultGetErrorMessage}\n * @defaultValue `defaultGetErrorMessage`\n */\n getErrorMessage?: GetErrorMessage;\n\n /**\n * An optional function that will be called whenever the `error` state is\n * changed. This can be used for more complex forms to `disable` the Submit\n * button or anything else if any field has an error.\n *\n * @defaultValue `() => {}`\n */\n onErrorChange?: ErrorChangeHandler<E>;\n\n /**\n * Boolean if the `TextField` or `TextArea` will **not** be rendered along\n * with a `FormMessage` component. This will prevent the `aria-describedby`\n * prop from being returned when set to `true`.\n *\n * @defaultValue `false`\n */\n disableMessage?: boolean;\n\n /**\n * Boolean if the `maxLength` prop should not be passed to the `TextField`\n * component since it will prevent any additional characters from being\n * entered in the text field which might feel like weird behavior to some\n * users. This should really only be used when the `counter` option is also\n * enabled and rendering along with a `FormMessage` component.\n *\n * @defaultValue `false`\n */\n disableMaxLength?: boolean;\n\n /**\n * @defaultValue `\"recommended\"`\n */\n validationType?: TextFieldValidationType;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface TextFieldImplementation<\n E extends HTMLInputElement | HTMLTextAreaElement,\n> extends TextFieldHookState {\n fieldRef: RefObject<E>;\n reset(): void;\n setState: UseStateSetter<Readonly<TextFieldHookState>>;\n fieldProps: ProvidedTextFieldProps<E>;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface TextFieldWithMessageImplementation<\n E extends HTMLInputElement | HTMLTextAreaElement,\n> extends TextFieldImplementation<E> {\n fieldProps: ProvidedTextFieldMessageProps<E>;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface ValidatedTextFieldImplementation<\n E extends HTMLInputElement | HTMLTextAreaElement,\n> extends TextFieldImplementation<E> {\n fieldProps: ProvidedTextFieldProps<E> | ProvidedTextFieldMessageProps<E>;\n}\n\n/**\n * If you do not want to display the error messages below the `TextField` and\n * handle error messages separately, set the `disableMessage` option to `true`.\n *\n * @example\n * No Inline Error Messages\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { TextField, useTextField } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const { fieldProps } = useTextField({\n * name: \"example\",\n * disableMessage: true,\n * });\n *\n * return <TextField {...fieldProps} label=\"Example\" />;\n * }\n * ```\n *\n * Look at the other {@link useTextField} override for additional examples.\n */\nexport function useTextField<E extends HTMLInputElement | HTMLTextAreaElement>(\n options: TextFieldHookOptions<E> & { disableMessage: true }\n): TextFieldImplementation<E>;\n\n/**\n * @example\n * Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { TextField, useTextField } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const { fieldProps } = useTextField({\n * name: \"example\",\n * });\n *\n * return <TextField {...fieldProps} label=\"Example\" />;\n * }\n * ```\n *\n * @example\n * Inline Counter\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { TextField, useTextField } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const { fieldProps } = useTextField({\n * name: \"example\",\n * counter: true,\n * required: true,\n * maxLength: 20,\n * disableMaxLength: true,\n * });\n *\n * return <TextField {...fieldProps} label=\"Example\" />;\n * }\n * ```\n *\n * @example\n * Adding Constraints\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { TextField, useTextField } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const { fieldProps } = useTextField({\n * name: \"example\",\n * required: true,\n * pattern: \"^[A-z]+$\",\n * minLength: 4,\n * maxLength: 20,\n * });\n *\n * return <TextField {...fieldProps} label=\"Example\" />;\n * }\n * ```\n *\n * @example\n * Custom Validation\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { TextField, useTextField } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const { fieldProps } = useTextField({\n * name: \"example\",\n * required: true,\n * getErrorMessage(options) {\n * const {\n * value,\n * pattern,\n * required,\n * minLength,\n * maxLength,\n * validity,\n * validationMessage,\n * isNumber,\n * isBlurEvent,\n * validationType,\n * } = options;\n *\n * if (validity.tooLong) {\n * return `No more than ${maxLength} characters.`;\n * }\n *\n * if (validity.tooShort) {\n * return `No more than ${minLength} characters.`;\n * }\n *\n * if (validity.valueMissing) {\n * return \"This value is required!\";\n * }\n *\n * if (value === \"bad value\") {\n * return \"Value cannot be bad value\";\n * }\n *\n * return defaultGetErrorMessage(options);\n * }\n * });\n *\n * return <TextField {...fieldProps} label=\"Example\" />;\n * }\n * ```\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation\n * @remarks\n * \\@since 2.5.6\n * \\@since 6.0.0 This hook returns an object instead of an ordered list.\n */\nexport function useTextField<E extends HTMLInputElement | HTMLTextAreaElement>(\n options: TextFieldHookOptions<E>\n): TextFieldWithMessageImplementation<E>;\nexport function useTextField<E extends HTMLInputElement | HTMLTextAreaElement>(\n options: TextFieldHookOptions<E>\n): ValidatedTextFieldImplementation<E> {\n const {\n id: propId,\n ref: propRef,\n name,\n defaultValue = \"\",\n isNumber = false,\n required,\n pattern,\n minLength,\n maxLength,\n onBlur = noop,\n onChange = noop,\n onInvalid = noop,\n counter = false,\n helpText,\n validationType = \"recommended\",\n disableMessage = false,\n disableMaxLength = false,\n errorIcon: propErrorIcon,\n isErrored = defaultIsErrored,\n onErrorChange = noop,\n getErrorIcon = defaultGetErrorIcon,\n getErrorMessage = defaultGetErrorMessage,\n } = options;\n\n const id = useEnsuredId(propId, \"text-field\");\n const messageId = `${id}-message`;\n const [fieldRef, ref] = useEnsuredRef(propRef);\n const [state, setState] = useState<TextFieldHookState>(() => {\n const value =\n typeof defaultValue === \"function\" ? defaultValue() : defaultValue;\n\n return {\n value,\n error: false,\n errorMessage: \"\",\n };\n });\n const { value, error, errorMessage } = state;\n\n // using a `ref` instead of a `useCallback` makes it so the `defaultValue`\n // will always be used once reset.\n const reset = useRef(() => {\n fieldRef.current?.setCustomValidity(\"\");\n setState({ value, error: false, errorMessage: \"\" });\n }).current;\n\n const errored = useRef(error);\n const checkValidity = useCallback(\n (isBlurEvent: boolean) => {\n const field = fieldRef.current;\n if (!field) {\n throw new Error(\"Unable to check validity due to missing ref\");\n }\n\n // need to temporarily set the `maxLength` back so it can be \"verified\"\n // through the validity api\n /* istanbul ignore next */\n if (isBlurEvent && disableMaxLength && typeof maxLength === \"number\") {\n field.maxLength = maxLength;\n }\n\n const { value } = field;\n field.setCustomValidity(\"\");\n field.checkValidity();\n\n // remove the temporarily set `maxLength` attribute after checking the\n // validity\n /* istanbul ignore next */\n if (disableMaxLength && typeof maxLength === \"number\") {\n field.removeAttribute(\"maxLength\");\n }\n\n const options: ErrorMessageOptions = {\n value,\n pattern,\n required,\n minLength,\n maxLength,\n isBlurEvent,\n isNumber,\n validationType,\n validity: field.validity,\n validationMessage: field.validationMessage,\n };\n const errorMessage = getErrorMessage(options);\n const error = isErrored({ ...options, errorMessage });\n\n if (errored.current !== error) {\n errored.current = error;\n onErrorChange({\n ref: fieldRef,\n name,\n error,\n errorMessage,\n });\n }\n\n /* istanbul ignore next */\n if (errorMessage !== field.validationMessage) {\n field.setCustomValidity(errorMessage);\n }\n\n setState((prevState) => {\n if (\n prevState.value === value &&\n prevState.error === error &&\n prevState.errorMessage === errorMessage\n ) {\n return prevState;\n }\n\n return {\n value,\n error,\n errorMessage,\n };\n });\n },\n [\n disableMaxLength,\n fieldRef,\n getErrorMessage,\n isErrored,\n isNumber,\n maxLength,\n minLength,\n name,\n onErrorChange,\n pattern,\n required,\n validationType,\n ]\n );\n\n const errorIcon = getIcon(\"error\", propErrorIcon);\n const fieldProps: ProvidedTextFieldProps<E> & {\n messageProps?: ProvidedFormMessageProps;\n } = {\n id,\n ref,\n name,\n value,\n error,\n required,\n pattern,\n minLength,\n maxLength: disableMaxLength ? undefined : maxLength,\n rightAddon: getErrorIcon({\n error,\n errorIcon,\n errorMessage,\n }),\n onBlur(event) {\n onBlur(event);\n if (event.isPropagationStopped()) {\n return;\n }\n checkValidity(true);\n },\n onChange(event) {\n onChange(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n if (validationType === \"blur\") {\n setState((prevState) => ({\n ...prevState,\n value: event.currentTarget.value,\n }));\n return;\n }\n\n checkValidity(false);\n },\n onInvalid(event) {\n onInvalid(event);\n if (\n event.isPropagationStopped() ||\n event.currentTarget === document.activeElement\n ) {\n return;\n }\n\n // this makes it so that if a submit button is clicked in a form, all\n // textfields will gain the error state immediately\n // also need to extract the validationMessage immediately because of the\n // SyntheticEvent behavior in React. By the time the `setState` is called,\n // the event might've been deleted\n const { validationMessage } = event.currentTarget;\n\n setState((prevState) => {\n if (prevState.error) {\n return prevState;\n }\n\n return {\n ...prevState,\n error: true,\n errorMessage: validationMessage,\n };\n });\n },\n };\n\n if (!disableMessage) {\n fieldProps[\"aria-describedby\"] = messageId;\n fieldProps.messageProps = {\n id: messageId,\n error,\n length: counter ? value.length : undefined,\n maxLength:\n counter && typeof maxLength === \"number\" ? maxLength : undefined,\n children: errorMessage || helpText,\n };\n }\n\n return {\n ...state,\n reset,\n setState,\n fieldRef,\n fieldProps,\n };\n}\n"],"names":["useCallback","useRef","useState","getIcon","useEnsuredId","useEnsuredRef","defaultGetErrorIcon","defaultGetErrorMessage","defaultIsErrored","noop","useTextField","options","id","propId","ref","propRef","name","defaultValue","isNumber","required","pattern","minLength","maxLength","onBlur","onChange","onInvalid","counter","helpText","validationType","disableMessage","disableMaxLength","errorIcon","propErrorIcon","isErrored","onErrorChange","getErrorIcon","getErrorMessage","messageId","fieldRef","state","setState","value","error","errorMessage","reset","current","setCustomValidity","errored","checkValidity","isBlurEvent","field","Error","removeAttribute","validity","validationMessage","prevState","fieldProps","undefined","rightAddon","event","isPropagationStopped","currentTarget","document","activeElement","messageProps","length","children"],"mappings":"AAAA;AACA,SACEA,WAAW,EACXC,MAAM,EACNC,QAAQ,QAMH,QAAQ;AACf,SAASC,OAAO,QAAQ,wBAAwB;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["../../../src/form/utils.ts"],"sourcesContent":["import { type KeyboardEvent } from \"react\";\n\n/**\n * This util should be used to implement the native \"Enter\" keypress behavior\n * for \"fake\" form components to submit the form if exists.\n *\n * The way this will work will be:\n * - attempt to find a form by querying for a parent form element. if no parent\n * form element can be found, try to use the `formId` in a\n * `document.getElementById`\n * - if a form element is found, find the submit button within the form. If\n * there are no submit buttons within the form, try to find a submit button in\n * the document that is linked to this form by `form={formId}`\n * - if the submit button was found, click it to trigger the form submit\n * behavior\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit\n * @internal\n * @remarks\n * \\@since 2.7.0\n * \\@since 6.0.0 No longer returns a boolean, added the `formId` parameter, and\n * moved into the form package.\n * \\@since 6.0.0 Uses `form.requestSubmit` instead of clicking the submit button\n */\nexport function tryToSubmitRelatedForm<E extends HTMLElement>(\n event: KeyboardEvent<E>,\n formId: string | undefined\n): void {\n const { currentTarget } = event;\n let form: HTMLElement | null = null;\n if (formId) {\n form = document.getElementById(formId);\n } else {\n form = currentTarget.closest(\"form\");\n }\n\n if (!form || !(form instanceof HTMLFormElement)) {\n return;\n }\n\n formId = formId || form.id;\n let submit = form.querySelector<HTMLButtonElement>('[type=\"submit\"]');\n if (!submit && formId) {\n submit = document.querySelector<HTMLButtonElement>(\n `[type=\"submit\"][form=\"${formId}\"]`\n );\n }\n\n form.requestSubmit(submit);\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport type ChangeableHTMLElement =\n | HTMLInputElement\n | HTMLTextAreaElement\n | HTMLSelectElement;\n\n/**\n * This is used to trigger a change event for a form element.\n *\n * @internal\n * @see https://stackoverflow.com/a/46012210\n * @remarks \\@since 6.0.0\n */\nexport function triggerManualChangeEvent(\n element: ChangeableHTMLElement | null,\n value: string | number\n): void {\n if (!element) {\n return;\n }\n\n const prototype = Object.getPrototypeOf(element);\n const setter = Object.getOwnPropertyDescriptor(prototype, \"value\")?.set;\n if (!setter) {\n return;\n }\n\n setter.call(element, value);\n const event = new Event(\"input\", { bubbles: true });\n element.dispatchEvent(event);\n}\n"],"names":["tryToSubmitRelatedForm","event","formId","currentTarget","form","document","getElementById","closest","HTMLFormElement","id","submit","querySelector","requestSubmit","triggerManualChangeEvent","element","value","prototype","Object","getPrototypeOf","setter","getOwnPropertyDescriptor","set","call","Event","bubbles","dispatchEvent"],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,SAASA,uBACdC,KAAuB,EACvBC,MAA0B;IAE1B,MAAM,EAAEC,aAAa,EAAE,GAAGF;IAC1B,IAAIG,OAA2B;IAC/B,IAAIF,QAAQ;QACVE,OAAOC,SAASC,cAAc,CAACJ;IACjC,OAAO;QACLE,OAAOD,cAAcI,OAAO,CAAC;IAC/B;IAEA,IAAI,CAACH,QAAQ,CAAEA,CAAAA,gBAAgBI,eAAc,GAAI;QAC/C;IACF;IAEAN,SAASA,UAAUE,KAAKK,EAAE;IAC1B,IAAIC,SAASN,KAAKO,aAAa,CAAoB;IACnD,IAAI,CAACD,UAAUR,QAAQ;QACrBQ,SAASL,SAASM,aAAa,CAC7B,CAAC,sBAAsB,EAAET,OAAO,EAAE,CAAC;IAEvC;IAEAE,KAAKQ,aAAa,CAACF;AACrB;AAWA;;;;;;CAMC,GACD,OAAO,SAASG,yBACdC,OAAqC,EACrCC,KAAsB;IAEtB,IAAI,CAACD,SAAS;QACZ;IACF;IAEA,MAAME,YAAYC,OAAOC,cAAc,CAACJ;IACxC,MAAMK,SAASF,OAAOG,wBAAwB,CAACJ,WAAW,UAAUK;IACpE,IAAI,CAACF,QAAQ;QACX;IACF;IAEAA,OAAOG,IAAI,CAACR,SAASC;IACrB,MAAMd,QAAQ,IAAIsB,MAAM,SAAS;QAAEC,SAAS;IAAK;IACjDV,QAAQW,aAAa,CAACxB;AACxB"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/form/validation.ts"],"sourcesContent":["import { type InputHTMLAttributes, type ReactNode } from \"react\";\n\n/**\n * @remarks \\@since 2.5.6\n * @remarks \\@since 6.0.0 Renamed from `TextConstraints` to\n * `TextFieldValidationOptions`\n */\nexport type TextFieldValidationOptions = Pick<\n InputHTMLAttributes<HTMLInputElement>,\n \"minLength\" | \"maxLength\" | \"required\" | \"pattern\"\n>;\n\n/**\n * Since the default validation messages can be verbose, this type is used to\n * configure when/how to display the native browser messages when the validation\n * state changes during the `change` event phase. The validation message will\n * always be shown on blur.\n *\n * When this is:\n *\n * - `true` -&gt; always show the browser message when it exists\n * - `false` -&gt; never show the browser message\n * - `\"recommended\"` -&gt; only shows the browser message if it is one of the\n * `RECOMMENDED_STATE_KEYS`/`RECOMMENDED_NUMBER_STATE_KEYS` validation errors\n * - `keyof ValidityState` -&gt; only shows the browser message if it is not the\n * specific validation error\n * - `(keyof ValidityState)[]` -&gt; only shows the browser message if it is not\n * the specific validation errors\n *\n * @see {@link RECOMMENDED_STATE_KEYS}\n * @see {@link RECOMMENDED_NUMBER_STATE_KEYS}\n * @remarks \\@since 2.5.6\n * @remarks \\@since 6.0.0 Renamed from `ChangeValidationBehavior` to\n * `TextFieldValidationType`\n */\nexport type TextFieldValidationType =\n | \"blur\"\n | \"change\"\n | \"recommended\"\n | keyof ValidityState\n | readonly (keyof ValidityState)[];\n\n/**\n * @remarks \\@since 2.5.0\n */\nexport interface ErrorMessageOptions extends TextFieldValidationOptions {\n /**\n * The current input or textarea's validity state.\n */\n validity: ValidityState;\n\n /**\n * The browser defined validation message based on the validity state. This\n * will be the empty string when there are no errors.\n */\n validationMessage: string;\n\n /**\n * The current `TextField` or `TextArea` value.\n */\n value: string;\n\n /**\n * This will only be `true` if called by the `useNumberField` hook.\n */\n isNumber: boolean;\n\n /**\n * Boolean if this is triggered from a blur event instead of a change event.\n */\n isBlurEvent: boolean;\n\n /**\n * The validation type defined by the `useTextField` hook.\n */\n validationType: TextFieldValidationType;\n}\n\n/**\n * A function to get a custom error message for specific errors. This is really\n * useful when using the `pattern` attribute to give additional information or\n * changing the native \"language translated\" error message.\n *\n * @param options - An object containing metadata that can be used to create an\n * error message for your `TextField` or `TextArea`.\n * @returns An error message to display or an empty string.\n * @remarks \\@since 2.5.0\n */\nexport type GetErrorMessage = (options: ErrorMessageOptions) => string;\n\n/**\n * @internal\n * @remarks \\@since 2.5.0\n */\nconst VALIDITY_STATE_KEYS: readonly (keyof ValidityState)[] = [\n \"badInput\",\n \"customError\",\n \"patternMismatch\",\n \"rangeOverflow\",\n \"rangeUnderflow\",\n \"stepMismatch\",\n \"tooLong\",\n \"tooShort\",\n \"typeMismatch\",\n \"valueMissing\",\n];\n\n/**\n * @internal\n * @remarks \\@since 2.5.0\n */\nexport const RECOMMENDED_STATE_KEYS: readonly (keyof ValidityState)[] = [\n \"badInput\",\n \"tooLong\",\n \"valueMissing\",\n];\n\n/**\n * @internal\n * @remarks \\@since 2.5.0\n */\nexport const RECOMMENDED_NUMBER_STATE_KEYS: readonly (keyof ValidityState)[] = [\n ...RECOMMENDED_STATE_KEYS,\n \"rangeOverflow\",\n \"rangeUnderflow\",\n \"tooShort\",\n \"typeMismatch\",\n];\n\n/**\n * The validation message is actually kind of weird since it's possible for a\n * form element to have multiple errors at once. The validation message will be\n * the first error that appears, so need to make sure that the first error is\n * one of the recommended state keys so the message appears for only those types\n * of errors.\n *\n * @internal\n * @remarks \\@since 2.5.0\n */\nconst isRecommended = (validity: ValidityState, isNumber: boolean): boolean => {\n const errorable = isNumber\n ? RECOMMENDED_NUMBER_STATE_KEYS\n : RECOMMENDED_STATE_KEYS;\n\n return VALIDITY_STATE_KEYS.every((key) => {\n const errored = validity[key];\n return !errored || errorable.includes(key);\n });\n};\n\n/**\n * The default implementation for getting an error message for the `TextField`\n * or `TextArea` components that relies on the behavior of the\n * {@link ChangeValidationBehavior}\n *\n * @remarks \\@since 2.5.0\n */\nexport const defaultGetErrorMessage: GetErrorMessage = (options) => {\n const {\n isNumber,\n isBlurEvent,\n validity,\n validationMessage,\n validationType: validate,\n } = options;\n\n if (isBlurEvent || !validationMessage || validate === \"change\") {\n return validationMessage;\n }\n\n if (validate === \"blur\") {\n return \"\";\n }\n\n if (validate === \"recommended\") {\n return isRecommended(validity, isNumber) ? validationMessage : \"\";\n }\n\n const keys = typeof validate === \"string\" ? [validate] : validate;\n\n return keys.length &&\n VALIDITY_STATE_KEYS.some((key) => validity[key] && keys.includes(key))\n ? validationMessage\n : \"\";\n};\n\n/**\n * @remarks \\@since 2.5.0\n */\nexport interface IsErroredOptions extends ErrorMessageOptions {\n /**\n * The current error message or an empty string.\n */\n errorMessage: string;\n}\n\n/**\n * A function that is used to determine if a `TextField` or `TextArea` is in an\n * errored state.\n *\n * @param options - All the current options that can be used to determine the\n * error state.\n * @returns True if the component is considered to be in an errored state.\n * @remarks \\@since 2.5.0\n */\nexport type IsErrored = (options: IsErroredOptions) => boolean;\n\n/**\n * The default implementation for checking if a `TextField` or `TextArea` is\n * errored by returning `true` if the `errorMessage` string is truthy or the\n * value is not within the `minLength` and `maxLength` constraints when they\n * exist.\n *\n * @remarks \\@since 2.5.0\n */\nexport const defaultIsErrored: IsErrored = (options) => {\n const { value, errorMessage, minLength, maxLength, isBlurEvent } = options;\n\n return (\n !!errorMessage ||\n (typeof maxLength === \"number\" && value.length > maxLength) ||\n (isBlurEvent && typeof minLength === \"number\" && value.length < minLength)\n );\n};\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface GetErrorIconOptions {\n /**\n * This will be `true` if the `TextField` or `TextArea` is in an errored state.\n */\n error: boolean;\n\n /**\n * The current error icon that was provided.\n */\n errorIcon: ReactNode;\n\n /**\n * The current error message or an empty string.\n */\n errorMessage: string;\n}\n\n/**\n * A function that can be used to dynamically get an error icon based on the\n * current visible error.\n *\n * @param options - The {@link GetErrorIconOptions}\n * @returns An icon to render or falsey to render nothing.\n * @remarks \\@since 2.5.0\n * @remarks \\@since 6.0.0 Updated to accept a single object argument\n */\nexport type GetErrorIcon = (options: GetErrorIconOptions) => ReactNode;\n\n/**\n * The default implementation for showing an error icon in `TextField` and\n * `TextArea` components that will only display when the error flag is enabled.\n *\n * @remarks \\@since 2.5.0\n */\nexport const defaultGetErrorIcon: GetErrorIcon = (options) => {\n const { error, errorIcon } = options;\n\n return error && errorIcon;\n};\n"],"names":["VALIDITY_STATE_KEYS","RECOMMENDED_STATE_KEYS","RECOMMENDED_NUMBER_STATE_KEYS","isRecommended","validity","isNumber","errorable","every","key","errored","includes","defaultGetErrorMessage","options","isBlurEvent","validationMessage","validationType","validate","keys","length","some","defaultIsErrored","value","errorMessage","minLength","maxLength","defaultGetErrorIcon","error","errorIcon"],"mappings":"AA0FA;;;CAGC,GACD,MAAMA,sBAAwD;IAC5D;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED;;;CAGC,GACD,OAAO,MAAMC,yBAA2D;IACtE;IACA;IACA;CACD,CAAC;AAEF;;;CAGC,GACD,OAAO,MAAMC,gCAAkE;OAC1ED;IACH;IACA;IACA;IACA;CACD,CAAC;AAEF;;;;;;;;;CASC,GACD,MAAME,gBAAgB,CAACC,UAAyBC;IAC9C,MAAMC,YAAYD,WACdH,gCACAD;IAEJ,OAAOD,oBAAoBO,KAAK,CAAC,CAACC;QAChC,MAAMC,UAAUL,QAAQ,CAACI,IAAI;QAC7B,OAAO,CAACC,WAAWH,UAAUI,QAAQ,CAACF;IACxC;AACF;AAEA;;;;;;CAMC,GACD,OAAO,MAAMG,yBAA0C,CAACC;IACtD,MAAM,EACJP,QAAQ,EACRQ,WAAW,EACXT,QAAQ,EACRU,iBAAiB,EACjBC,gBAAgBC,QAAQ,EACzB,GAAGJ;IAEJ,IAAIC,eAAe,CAACC,qBAAqBE,aAAa,UAAU;QAC9D,OAAOF;IACT;IAEA,IAAIE,aAAa,QAAQ;QACvB,OAAO;IACT;IAEA,IAAIA,aAAa,eAAe;QAC9B,OAAOb,cAAcC,UAAUC,YAAYS,oBAAoB;IACjE;IAEA,MAAMG,OAAO,OAAOD,aAAa,WAAW;QAACA;KAAS,GAAGA;IAEzD,OAAOC,KAAKC,MAAM,IAChBlB,oBAAoBmB,IAAI,CAAC,CAACX,MAAQJ,QAAQ,CAACI,IAAI,IAAIS,KAAKP,QAAQ,CAACF,QAC/DM,oBACA;AACN,EAAE;AAuBF;;;;;;;CAOC,GACD,OAAO,MAAMM,mBAA8B,CAACR;IAC1C,MAAM,EAAES,KAAK,EAAEC,YAAY,EAAEC,SAAS,EAAEC,SAAS,EAAEX,WAAW,EAAE,GAAGD;IAEnE,OACE,CAAC,CAACU,gBACD,OAAOE,cAAc,YAAYH,MAAMH,MAAM,GAAGM,aAChDX,eAAe,OAAOU,cAAc,YAAYF,MAAMH,MAAM,GAAGK;AAEpE,EAAE;AAiCF;;;;;CAKC,GACD,OAAO,MAAME,sBAAoC,CAACb;IAChD,MAAM,EAAEc,KAAK,EAAEC,SAAS,EAAE,GAAGf;IAE7B,OAAOc,SAASC;AAClB,EAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/hoverMode/useHoverMode.ts"],"sourcesContent":["\"use client\";\nimport type { MouseEvent } from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { UseStateInitializer, UseStateSetter } from \"../types.js\";\nimport type { SimpleHoverModeContext } from \"./useHoverModeProvider.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface HoverModeConfigurationOptions extends SimpleHoverModeContext {\n /** @defaultValue `false` */\n disabled?: boolean;\n\n /**\n * This can be used to override the `HoverModeContext`'s hover time.\n */\n hoverTimeout?: number;\n\n /**\n * This can be used to override the `HoverModeContext`'s leave time.\n */\n leaveTimeout?: number;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ControlledHoverModeOptions\n extends HoverModeConfigurationOptions {\n setVisible: UseStateSetter<boolean>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ControlledHoverModeImplementation {\n startShowFlow(id?: string | MouseEvent): void;\n startHideFlow(): void;\n clearVisibilityTimeout(): void;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface UncontrolledHoverModeOptions\n extends HoverModeConfigurationOptions {\n defaultVisible?: UseStateInitializer<boolean>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface UncontrolledHoverModeImplementation\n extends ControlledHoverModeImplementation {\n visible: boolean;\n setVisible: UseStateSetter<boolean>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface HoverModeImplementation\n extends ControlledHoverModeImplementation {\n visible?: boolean;\n setVisible?: UseStateSetter<boolean>;\n}\n\n/**\n * @remarks\n * \\@since 2.8.0\n * \\@since 5.0.0 This hook no longer returns `handlers` or\n * `stickyHandlers` and does not hide when an element on the page is clicked.\n * \\@since 6.0.0 Requires passing the custom hover mode context to\n * work.\n */\nexport function useHoverMode(\n options: ControlledHoverModeOptions\n): ControlledHoverModeImplementation;\nexport function useHoverMode(\n options: UncontrolledHoverModeOptions\n): UncontrolledHoverModeImplementation;\nexport function useHoverMode(\n options: ControlledHoverModeOptions | UncontrolledHoverModeOptions\n): HoverModeImplementation {\n const {\n disabled,\n hoverTimeout: hoverTime,\n hoverTimeoutRef,\n leaveTimeout: leaveTime,\n leaveTimeoutRef,\n enableHoverMode,\n disableHoverMode,\n startDisableTimer,\n clearDisableTimer,\n setVisible: propSetVisible,\n defaultVisible = false,\n } = options as ControlledHoverModeOptions & UncontrolledHoverModeOptions;\n\n const state = useState(defaultVisible);\n let visible: boolean | undefined;\n let setVisible: UseStateSetter<boolean>;\n if (typeof propSetVisible !== \"undefined\") {\n setVisible = propSetVisible;\n } else {\n [visible, setVisible] = state;\n }\n\n const visibilityTimeout = useRef<number | undefined>();\n const clearVisibilityTimeout = useCallback(() => {\n window.clearTimeout(visibilityTimeout.current);\n }, []);\n\n // if the element is near the viewport edge, the mouseleave event might not\n // trigger correctly. for these cases, just clear any timeouts to be safe.\n // do not hide the visibility so that you can still inspect things in the\n // devtools\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n const handler = (): void => {\n window.clearTimeout(visibilityTimeout.current);\n\n // might need to play with this more or make it configurable. if the mouse\n // leaves the window, you're _normally_ not interacting with the app\n // anymore and state should reset.\n disableHoverMode();\n };\n\n document.addEventListener(\"mouseleave\", handler);\n return () => {\n document.removeEventListener(\"mouseleave\", handler);\n };\n }, [disableHoverMode, disabled]);\n\n useEffect(() => {\n return () => {\n window.clearTimeout(visibilityTimeout.current);\n };\n }, []);\n\n return {\n visible,\n setVisible: setVisible === propSetVisible ? undefined : setVisible,\n startShowFlow: useCallback(\n (eventOrId) => {\n const hoverTimeout = hoverTime ?? hoverTimeoutRef.current;\n if (disabled || typeof hoverTimeout === \"undefined\") {\n return;\n }\n\n let id: string;\n if (typeof eventOrId === \"string\" || typeof eventOrId === \"undefined\") {\n id = eventOrId || \"\";\n } else {\n id = eventOrId.currentTarget.id;\n }\n\n clearDisableTimer();\n clearVisibilityTimeout();\n visibilityTimeout.current = window.setTimeout(() => {\n enableHoverMode(id);\n setVisible(true);\n }, hoverTimeout);\n },\n [\n clearDisableTimer,\n clearVisibilityTimeout,\n disabled,\n enableHoverMode,\n hoverTime,\n hoverTimeoutRef,\n setVisible,\n ]\n ),\n startHideFlow: useCallback(() => {\n if (disabled) {\n return;\n }\n\n startDisableTimer();\n clearVisibilityTimeout();\n visibilityTimeout.current = window.setTimeout(() => {\n setVisible(false);\n }, leaveTime ?? leaveTimeoutRef.current);\n }, [\n clearVisibilityTimeout,\n disabled,\n leaveTime,\n leaveTimeoutRef,\n setVisible,\n startDisableTimer,\n ]),\n clearVisibilityTimeout,\n };\n}\n"],"names":["useCallback","useEffect","useRef","useState","useHoverMode","options","disabled","hoverTimeout","hoverTime","hoverTimeoutRef","leaveTimeout","leaveTime","leaveTimeoutRef","enableHoverMode","disableHoverMode","startDisableTimer","clearDisableTimer","setVisible","propSetVisible","defaultVisible","state","visible","visibilityTimeout","clearVisibilityTimeout","window","clearTimeout","current","handler","document","addEventListener","removeEventListener","undefined","startShowFlow","eventOrId","id","currentTarget","setTimeout","startHideFlow"],"mappings":"AAAA;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AA+EjE,OAAO,SAASC,aACdC,OAAkE;IAElE,MAAM,EACJC,QAAQ,EACRC,cAAcC,SAAS,EACvBC,eAAe,EACfC,cAAcC,SAAS,EACvBC,eAAe,EACfC,eAAe,EACfC,gBAAgB,EAChBC,iBAAiB,EACjBC,iBAAiB,EACjBC,YAAYC,cAAc,EAC1BC,iBAAiB,KAAK,EACvB,GAAGd;IAEJ,MAAMe,QAAQjB,SAASgB;IACvB,IAAIE;IACJ,IAAIJ;IACJ,IAAI,OAAOC,mBAAmB,aAAa;QACzCD,aAAaC;IACf,OAAO;QACL,CAACG,SAASJ,WAAW,GAAGG;IAC1B;IAEA,MAAME,oBAAoBpB;IAC1B,MAAMqB,yBAAyBvB,YAAY;QACzCwB,OAAOC,YAAY,CAACH,kBAAkBI,OAAO;IAC/C,GAAG,EAAE;IAEL,2EAA2E;IAC3E,0EAA0E;IAC1E,yEAAyE;IACzE,WAAW;IACXzB,UAAU;QACR,IAAIK,UAAU;YACZ;QACF;QAEA,MAAMqB,UAAU;YACdH,OAAOC,YAAY,CAACH,kBAAkBI,OAAO;YAE7C,0EAA0E;YAC1E,oEAAoE;YACpE,kCAAkC;YAClCZ;QACF;QAEAc,SAASC,gBAAgB,CAAC,cAAcF;QACxC,OAAO;YACLC,SAASE,mBAAmB,CAAC,cAAcH;QAC7C;IACF,GAAG;QAACb;QAAkBR;KAAS;IAE/BL,UAAU;QACR,OAAO;YACLuB,OAAOC,YAAY,CAACH,kBAAkBI,OAAO;QAC/C;IACF,GAAG,EAAE;IAEL,OAAO;QACLL;QACAJ,YAAYA,eAAeC,iBAAiBa,YAAYd;QACxDe,eAAehC,YACb,CAACiC;YACC,MAAM1B,eAAeC,aAAaC,gBAAgBiB,OAAO;YACzD,IAAIpB,YAA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