@react-md/core 1.0.0-next.3 → 1.0.0-next.4
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.
- package/.turbo/turbo-build.log +5 -5
- package/.turbo/turbo-lint.log +3 -3
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +6 -0
- package/coverage/clover.xml +529 -437
- package/coverage/coverage-final.json +3 -3
- package/coverage/lcov-report/ListItem.tsx.html +2 -2
- package/coverage/lcov-report/ListItemLink.tsx.html +616 -0
- package/coverage/lcov-report/getListItemHeight.ts.html +298 -0
- package/coverage/lcov-report/index.html +38 -23
- package/coverage/lcov.info +423 -317
- package/dist/_core.scss +1 -1
- package/dist/form/_form.scss +1 -1
- package/dist/list/getListItemHeight.d.ts +0 -1
- package/dist/list/types.d.ts +1 -1
- package/dist/menu/_menu.scss +0 -2
- package/dist/src/CoreProviders.js.map +1 -0
- package/dist/src/NoSsr.js.map +1 -0
- package/dist/src/SsrProvider.js.map +1 -0
- package/dist/src/app-bar/AppBar.js.map +1 -0
- package/dist/src/app-bar/AppBarTitle.js.map +1 -0
- package/dist/src/avatar/Avatar.js.map +1 -0
- package/dist/src/avatar/styles.js.map +1 -0
- package/dist/src/badge/Badge.js.map +1 -0
- package/dist/src/box/Box.js.map +1 -0
- package/dist/src/box/styles.js.map +1 -0
- package/dist/src/button/AsyncButton.js.map +1 -0
- package/dist/src/button/Button.js.map +1 -0
- package/dist/src/button/ButtonUnstyled.js.map +1 -0
- package/dist/src/button/FloatingActionButton.js.map +1 -0
- package/dist/src/button/TooltippedButton.js.map +1 -0
- package/dist/src/button/buttonStyles.js.map +1 -0
- package/dist/src/button/buttonUnstyledStyles.js.map +1 -0
- package/dist/src/card/Card.js.map +1 -0
- package/dist/src/card/CardContent.js.map +1 -0
- package/dist/src/card/CardFooter.js.map +1 -0
- package/dist/src/card/CardHeader.js.map +1 -0
- package/dist/src/card/CardSubtitle.js.map +1 -0
- package/dist/src/card/CardTitle.js.map +1 -0
- package/dist/src/card/ClickableCard.js.map +1 -0
- package/dist/src/card/styles.js.map +1 -0
- package/dist/src/chip/Chip.js.map +1 -0
- package/dist/src/chip/styles.js.map +1 -0
- package/dist/src/cssUtils.js.map +1 -0
- package/dist/src/delegateEvent.js.map +1 -0
- package/dist/src/dialog/Dialog.js.map +1 -0
- package/dist/src/dialog/DialogContainer.js.map +1 -0
- package/dist/src/dialog/DialogContent.js.map +1 -0
- package/dist/src/dialog/DialogFooter.js.map +1 -0
- package/dist/src/dialog/DialogHeader.js.map +1 -0
- package/dist/src/dialog/DialogTitle.js.map +1 -0
- package/dist/src/dialog/FixedDialog.js.map +1 -0
- package/dist/src/dialog/NestedDialogProvider.js.map +1 -0
- package/dist/src/dialog/styles.js.map +1 -0
- package/dist/src/divider/Divider.js.map +1 -0
- package/dist/src/divider/styles.js.map +1 -0
- package/dist/src/draggable/useDraggable.js.map +1 -0
- package/dist/src/draggable/utils.js.map +1 -0
- package/dist/src/expansion-panel/ExpansionList.js.map +1 -0
- package/dist/src/expansion-panel/ExpansionPanel.js.map +1 -0
- package/dist/src/expansion-panel/ExpansionPanelHeader.js.map +1 -0
- package/dist/src/expansion-panel/useExpansionList.js.map +1 -0
- package/dist/src/expansion-panel/useExpansionPanels.js.map +1 -0
- package/dist/src/focus/useFocusContainer.js.map +1 -0
- package/dist/src/focus/utils.js.map +1 -0
- package/dist/src/form/Checkbox.js.map +1 -0
- package/dist/src/form/Fieldset.js.map +1 -0
- package/dist/src/form/FileInput.js.map +1 -0
- package/dist/src/form/Form.js.map +1 -0
- package/dist/src/form/FormMessage.js.map +1 -0
- package/dist/src/form/FormMessageContainer.js.map +1 -0
- package/dist/src/form/FormMessageCounter.js.map +1 -0
- package/dist/src/form/InputToggle.js.map +1 -0
- package/dist/src/form/InputToggleIcon.js.map +1 -0
- package/dist/src/form/Label.js.map +1 -0
- package/dist/src/form/Legend.js.map +1 -0
- package/dist/src/form/MenuItemCheckbox.js.map +1 -0
- package/dist/src/form/MenuItemFileInput.js.map +1 -0
- package/dist/src/form/MenuItemInputToggle.js.map +1 -0
- package/dist/src/form/MenuItemRadio.js.map +1 -0
- package/dist/src/form/MenuItemSwitch.js.map +1 -0
- package/dist/src/form/MenuItemTextField.js.map +1 -0
- package/dist/src/form/NativeSelect.js.map +1 -0
- package/dist/src/form/OptGroup.js.map +1 -0
- package/dist/src/form/Option.js.map +1 -0
- package/dist/src/form/Password.js.map +1 -0
- package/dist/src/form/Radio.js.map +1 -0
- package/dist/src/form/Select.js.map +1 -0
- package/dist/src/form/SelectValue.js.map +1 -0
- package/dist/src/form/Slider.js.map +1 -0
- package/dist/src/form/SliderContainer.js.map +1 -0
- package/dist/src/form/SliderMark.js.map +1 -0
- package/dist/src/form/SliderMarkLabel.js.map +1 -0
- package/dist/src/form/SliderThumb.js.map +1 -0
- package/dist/src/form/SliderTrack.js.map +1 -0
- package/dist/src/form/SliderValueMarks.js.map +1 -0
- package/dist/src/form/SliderValueTooltip.js.map +1 -0
- package/dist/src/form/Switch.js.map +1 -0
- package/dist/src/form/SwitchTrack.js.map +1 -0
- package/dist/src/form/TextArea.js.map +1 -0
- package/dist/src/form/TextField.js.map +1 -0
- package/dist/src/form/TextFieldAddon.js.map +1 -0
- package/dist/src/form/TextFieldContainer.js.map +1 -0
- package/dist/src/form/TextFieldContainerStyles.js.map +1 -0
- package/dist/src/form/fileUtils.js.map +1 -0
- package/dist/src/form/formConfig.js.map +1 -0
- package/dist/src/form/formMessageStyles.js.map +1 -0
- package/dist/src/form/inputToggleStyles.js.map +1 -0
- package/dist/src/form/nativeSelectStyles.js.map +1 -0
- package/dist/src/form/optionStyles.js.map +1 -0
- package/dist/src/form/passwordStyles.js.map +1 -0
- package/dist/src/form/selectStyles.js.map +1 -0
- package/dist/src/form/selectUtils.js.map +1 -0
- package/dist/src/form/sliderUtils.js.map +1 -0
- package/dist/src/form/switchStyles.js.map +1 -0
- package/dist/src/form/textAreaStyles.js.map +1 -0
- package/dist/src/form/textFieldStyles.js.map +1 -0
- package/dist/src/form/types.js.map +1 -0
- package/dist/src/form/useCheckboxGroup.js.map +1 -0
- package/dist/src/form/useFileUpload.js.map +1 -0
- package/dist/src/form/useListboxProvider.js.map +1 -0
- package/dist/src/form/useNumberField.js.map +1 -0
- package/dist/src/form/useRadioGroup.js.map +1 -0
- package/dist/src/form/useRangeSlider.js.map +1 -0
- package/dist/src/form/useResizingTextArea.js.map +1 -0
- package/dist/src/form/useSlider.js.map +1 -0
- package/dist/src/form/useTextField.js.map +1 -0
- package/dist/src/form/utils.js.map +1 -0
- package/dist/src/form/validation.js.map +1 -0
- package/dist/src/hoverMode/useHoverMode.js.map +1 -0
- package/dist/src/hoverMode/useHoverModeProvider.js.map +1 -0
- package/dist/src/icon/FontIcon.js.map +1 -0
- package/dist/src/icon/IconRotator.js.map +1 -0
- package/dist/src/icon/MaterialIcon.js.map +1 -0
- package/dist/src/icon/MaterialSymbol.js.map +1 -0
- package/dist/src/icon/SVGIcon.js.map +1 -0
- package/dist/src/icon/TextIconSpacing.js.map +1 -0
- package/dist/src/icon/iconConfig.js.map +1 -0
- package/dist/src/icon/material.js.map +1 -0
- package/dist/src/icon/materialConfig.js.map +1 -0
- package/dist/src/icon/styles.js.map +1 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/interaction/Ripple.js.map +1 -0
- package/dist/src/interaction/RippleContainer.js.map +1 -0
- package/dist/src/interaction/UserInteractionModeProvider.js.map +1 -0
- package/dist/src/interaction/config.js.map +1 -0
- package/dist/src/interaction/types.js.map +1 -0
- package/dist/src/interaction/useElementInteraction.js.map +1 -0
- package/dist/src/interaction/useHigherContrastChildren.js.map +1 -0
- package/dist/src/interaction/utils.js.map +1 -0
- package/dist/src/layout/LayoutAppBar.js.map +1 -0
- package/dist/src/layout/LayoutNav.js.map +1 -0
- package/dist/src/layout/LayoutWindowSplitter.js.map +1 -0
- package/dist/src/layout/Main.js.map +1 -0
- package/dist/src/layout/layoutNavStyles.js.map +1 -0
- package/dist/src/layout/layoutWindowSplitterStyles.js.map +1 -0
- package/dist/src/layout/mainStyles.js.map +1 -0
- package/dist/src/layout/useExpandableLayout.js.map +1 -0
- package/dist/src/layout/useHorizontalLayoutTransition.js.map +1 -0
- package/dist/src/layout/useLayoutAppBarHeight.js.map +1 -0
- package/dist/src/layout/useLayoutTree.js.map +1 -0
- package/dist/src/layout/useLayoutWindowSplitter.js.map +1 -0
- package/dist/src/layout/useMainTabIndex.js.map +1 -0
- package/dist/src/layout/useResizableLayout.js.map +1 -0
- package/dist/src/layout/useTemporaryLayout.js.map +1 -0
- package/dist/src/link/Link.js.map +1 -0
- package/dist/src/link/SkipToMainContent.js.map +1 -0
- package/dist/src/link/styles.js.map +1 -0
- package/dist/src/list/List.js.map +1 -0
- package/dist/src/list/ListItem.js +148 -0
- package/dist/src/list/ListItem.js.map +1 -0
- package/dist/src/list/ListItemAddon.js.map +1 -0
- package/dist/src/list/ListItemChildren.js.map +1 -0
- package/dist/src/list/ListItemLink.js +89 -0
- package/dist/src/list/ListItemLink.js.map +1 -0
- package/dist/src/list/ListItemText.js.map +1 -0
- package/dist/src/list/ListSubheader.js.map +1 -0
- package/dist/src/list/getListItemHeight.js +28 -0
- package/dist/src/list/getListItemHeight.js.map +1 -0
- package/dist/src/list/listItemStyles.js.map +1 -0
- package/dist/src/list/types.js.map +1 -0
- package/dist/src/media-queries/AppSizeProvider.js.map +1 -0
- package/dist/src/media-queries/appSize.js.map +1 -0
- package/dist/src/media-queries/useMediaQuery.js.map +1 -0
- package/dist/src/menu/DropdownMenu.js.map +1 -0
- package/dist/src/menu/Menu.js.map +1 -0
- package/dist/src/menu/MenuBar.js.map +1 -0
- package/dist/src/menu/MenuButton.js.map +1 -0
- package/dist/src/menu/MenuConfigurationProvider.js.map +1 -0
- package/dist/src/menu/MenuItem.js.map +1 -0
- package/dist/src/menu/MenuItemButton.js.map +1 -0
- package/dist/src/menu/MenuItemGroup.js.map +1 -0
- package/dist/src/menu/MenuItemSeparator.js.map +1 -0
- package/dist/src/menu/MenuSheet.js.map +1 -0
- package/dist/src/menu/MenuVisibilityProvider.js.map +1 -0
- package/dist/src/menu/MenuWidget.js.map +1 -0
- package/dist/src/menu/MenuWidgetKeyboardProvider.js.map +1 -0
- package/dist/src/menu/useContextMenu.js.map +1 -0
- package/dist/src/menu/useMenuBarProvider.js.map +1 -0
- package/dist/src/menu/utils.js.map +1 -0
- package/dist/src/movement/constants.js.map +1 -0
- package/dist/src/movement/findMatchIndex.js.map +1 -0
- package/dist/src/movement/types.js.map +1 -0
- package/dist/src/movement/useKeyboardMovementProvider.js.map +1 -0
- package/dist/src/movement/utils.js.map +1 -0
- package/dist/src/overlay/Overlay.js.map +1 -0
- package/dist/src/overlay/overlayStyles.js.map +1 -0
- package/dist/src/portal/Portal.js.map +1 -0
- package/dist/src/portal/PortalContainerProvider.js.map +1 -0
- package/dist/src/positioning/constants.js.map +1 -0
- package/dist/src/positioning/createHorizontalPosition.js.map +1 -0
- package/dist/src/positioning/createVerticalPosition.js.map +1 -0
- package/dist/src/positioning/getFixedPosition.js.map +1 -0
- package/dist/src/positioning/types.js.map +1 -0
- package/dist/src/positioning/useFixedPositioning.js.map +1 -0
- package/dist/src/positioning/utils.js.map +1 -0
- package/dist/src/progress/CircularProgress.js.map +1 -0
- package/dist/src/progress/LinearProgress.js.map +1 -0
- package/dist/src/progress/getProgressA11y.js.map +1 -0
- package/dist/src/progress/types.js.map +1 -0
- package/dist/src/responsive-item/ResponsiveItemContainer.js.map +1 -0
- package/dist/src/responsive-item/ResponsiveItemOverlay.js.map +1 -0
- package/dist/src/responsive-item/styles.js.map +1 -0
- package/dist/src/scroll/ScrollLock.js.map +1 -0
- package/dist/src/scroll/getScrollbarWidth.js.map +1 -0
- package/dist/src/scroll/useScrollLock.js.map +1 -0
- package/dist/src/segmented-button/SegmentedButton.js.map +1 -0
- package/dist/src/segmented-button/SegmentedButtonContainer.js.map +1 -0
- package/dist/src/segmented-button/segmentedButtonContainerStyles.js.map +1 -0
- package/dist/src/segmented-button/segmentedButtonStyles.js.map +1 -0
- package/dist/src/sheet/Sheet.js.map +1 -0
- package/dist/src/sheet/styles.js.map +1 -0
- package/dist/src/snackbar/DefaultToastRenderer.js.map +1 -0
- package/dist/src/snackbar/Snackbar.js.map +1 -0
- package/dist/src/snackbar/Toast.js.map +1 -0
- package/dist/src/snackbar/ToastActionButton.js.map +1 -0
- package/dist/src/snackbar/ToastCloseButton.js.map +1 -0
- package/dist/src/snackbar/ToastContent.js.map +1 -0
- package/dist/src/snackbar/ToastManager.js.map +1 -0
- package/dist/src/snackbar/ToastManagerProvider.js.map +1 -0
- package/dist/src/snackbar/snackbarStyles.js.map +1 -0
- package/dist/src/snackbar/toastContentStyles.js.map +1 -0
- package/dist/src/snackbar/toastStyles.js.map +1 -0
- package/dist/src/snackbar/useCurrentToastActions.js.map +1 -0
- package/dist/src/suspense/CircularProgressSuspense.js.map +1 -0
- package/dist/src/suspense/NullSuspense.js.map +1 -0
- package/dist/src/table/Table.js.map +1 -0
- package/dist/src/table/TableBody.js.map +1 -0
- package/dist/src/table/TableCell.js.map +1 -0
- package/dist/src/table/TableCellContent.js.map +1 -0
- package/dist/src/table/TableCheckbox.js.map +1 -0
- package/dist/src/table/TableConfigurationProvider.js.map +1 -0
- package/dist/src/table/TableContainer.js.map +1 -0
- package/dist/src/table/TableContainerProvider.js.map +1 -0
- package/dist/src/table/TableFooter.js.map +1 -0
- package/dist/src/table/TableHeader.js.map +1 -0
- package/dist/src/table/TableRadio.js.map +1 -0
- package/dist/src/table/TableRow.js.map +1 -0
- package/dist/src/table/tableCellStyles.js.map +1 -0
- package/dist/src/table/tableContainerStyles.js.map +1 -0
- package/dist/src/table/tableFooterStyles.js.map +1 -0
- package/dist/src/table/tableHeaderStyles.js.map +1 -0
- package/dist/src/table/tableRowStyles.js.map +1 -0
- package/dist/src/table/tableStyles.js.map +1 -0
- package/dist/src/table/types.js.map +1 -0
- package/dist/src/tabs/Tab.js.map +1 -0
- package/dist/src/tabs/TabList.js.map +1 -0
- package/dist/src/tabs/TabListScrollButton.js.map +1 -0
- package/dist/src/tabs/tabIndicatorStyles.js.map +1 -0
- package/dist/src/tabs/tabListScrollButtonStyles.js.map +1 -0
- package/dist/src/tabs/tabListStyles.js.map +1 -0
- package/dist/src/tabs/tabStyles.js.map +1 -0
- package/dist/src/tabs/useTabList.js.map +1 -0
- package/dist/src/tabs/useTabs.js.map +1 -0
- package/dist/src/tabs/utils.js.map +1 -0
- package/dist/src/test-utils/IntersectionObserver.js.map +1 -0
- package/dist/src/test-utils/ResizeObserver.js.map +1 -0
- package/dist/src/test-utils/data-testid.js.map +1 -0
- package/dist/src/test-utils/index.js.map +1 -0
- package/dist/src/test-utils/jest-setup.js.map +1 -0
- package/dist/src/test-utils/matchMedia.js.map +1 -0
- package/dist/src/test-utils/polyfills/IntersectionObserver.js.map +1 -0
- package/dist/src/test-utils/polyfills/ResizeObserver.js.map +1 -0
- package/dist/src/test-utils/polyfills/index.js.map +1 -0
- package/dist/src/test-utils/polyfills/matchMedia.js.map +1 -0
- package/dist/src/test-utils/polyfills/offsetParent.js.map +1 -0
- package/dist/src/test-utils/polyfills/scrollIntoView.js.map +1 -0
- package/dist/src/test-utils/render.js.map +1 -0
- package/dist/src/test-utils/timers.js.map +1 -0
- package/dist/src/theme/LocalStorageColorSchemeProvider.js.map +1 -0
- package/dist/src/theme/ThemeProvider.js.map +1 -0
- package/dist/src/theme/colors.js.map +1 -0
- package/dist/src/theme/cssVars.js.map +1 -0
- package/dist/src/theme/types.js.map +1 -0
- package/dist/src/theme/useCSSVariables.js.map +1 -0
- package/dist/src/theme/useColorScheme.js.map +1 -0
- package/dist/src/theme/useColorSchemeMetaTag.js.map +1 -0
- package/dist/src/theme/useColorSchemeProvider.js.map +1 -0
- package/dist/src/theme/usePrefersColorScheme.js.map +1 -0
- package/dist/src/theme/utils.js.map +1 -0
- package/dist/src/tooltip/Tooltip.js.map +1 -0
- package/dist/src/tooltip/TooltipHoverModeProvider.js.map +1 -0
- package/dist/src/tooltip/constants.js.map +1 -0
- package/dist/src/tooltip/tooltipStyles.js.map +1 -0
- package/dist/src/tooltip/useTooltip.js.map +1 -0
- package/dist/src/tooltip/useTooltipPosition.js.map +1 -0
- package/dist/src/tooltip/utils.js.map +1 -0
- package/dist/src/transition/CSSTransition.js.map +1 -0
- package/dist/src/transition/Collapse.js.map +1 -0
- package/dist/src/transition/CrossFade.js.map +1 -0
- package/dist/src/transition/ScaleTransition.js.map +1 -0
- package/dist/src/transition/SkeletonPlaceholder.js.map +1 -0
- package/dist/src/transition/Slide.js.map +1 -0
- package/dist/src/transition/SlideContainer.js.map +1 -0
- package/dist/src/transition/collapseStyles.js.map +1 -0
- package/dist/src/transition/config.js.map +1 -0
- package/dist/src/transition/maxWidthTransition.js.map +1 -0
- package/dist/src/transition/skeletonPlaceholderUtils.js.map +1 -0
- package/dist/src/transition/types.js.map +1 -0
- package/dist/src/transition/useCSSTransition.js.map +1 -0
- package/dist/src/transition/useCarousel.js.map +1 -0
- package/dist/src/transition/useCollapseTransition.js.map +1 -0
- package/dist/src/transition/useCrossFadeTransition.js.map +1 -0
- package/dist/src/transition/useMaxWidthTransition.js.map +1 -0
- package/dist/src/transition/useScaleTransition.js.map +1 -0
- package/dist/src/transition/useSkeletonPlaceholder.js.map +1 -0
- package/dist/src/transition/useSlideTransition.js.map +1 -0
- package/dist/src/transition/useTransition.js.map +1 -0
- package/dist/src/transition/utils.js.map +1 -0
- package/dist/src/tree/DefaultTreeItemRenderer.js.map +1 -0
- package/dist/src/tree/Tree.js.map +1 -0
- package/dist/src/tree/TreeGroup.js.map +1 -0
- package/dist/src/tree/TreeItem.js.map +1 -0
- package/dist/src/tree/TreeItemExpander.js.map +1 -0
- package/dist/src/tree/TreeProvider.js.map +1 -0
- package/dist/src/tree/styles.js.map +1 -0
- package/dist/src/tree/types.js.map +1 -0
- package/dist/src/tree/useTree.js.map +1 -0
- package/dist/src/tree/useTreeExpansion.js.map +1 -0
- package/dist/src/tree/useTreeItems.js.map +1 -0
- package/dist/src/tree/useTreeMovement.js.map +1 -0
- package/dist/src/tree/useTreeSelection.js.map +1 -0
- package/dist/src/tree/utils.js.map +1 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/typography/SrOnly.js.map +1 -0
- package/dist/src/typography/TextContainer.js.map +1 -0
- package/dist/src/typography/Typography.js.map +1 -0
- package/dist/src/typography/WritingDirectionProvider.js.map +1 -0
- package/dist/src/useAsyncAction.js.map +1 -0
- package/dist/src/useDebouncedFunction.js.map +1 -0
- package/dist/src/useDropzone.js.map +1 -0
- package/dist/src/useElementSize.js.map +1 -0
- package/dist/src/useEnsuredId.js.map +1 -0
- package/dist/src/useEnsuredRef.js.map +1 -0
- package/dist/src/useEnsuredState.js.map +1 -0
- package/dist/src/useHtmlClassName.js.map +1 -0
- package/dist/src/useIntersectionObserver.js.map +1 -0
- package/dist/src/useIsomorphicLayoutEffect.js.map +1 -0
- package/dist/src/useLocalStorage.js.map +1 -0
- package/dist/src/useOrientation.js.map +1 -0
- package/dist/src/usePageInactive.js.map +1 -0
- package/dist/src/useResizeListener.js.map +1 -0
- package/dist/src/useResizeObserver.js.map +1 -0
- package/dist/src/useThrottledFunction.js.map +1 -0
- package/dist/src/useToggle.js.map +1 -0
- package/dist/src/useUnmounted.js.map +1 -0
- package/dist/src/useWindowSize.js.map +1 -0
- package/dist/src/utils/RenderRecursively.js.map +1 -0
- package/dist/src/utils/alphaNumericSort.js.map +1 -0
- package/dist/src/utils/applyRef.js.map +1 -0
- package/dist/src/utils/bem.js.map +1 -0
- package/dist/src/utils/filters.js.map +1 -0
- package/dist/src/utils/getClientPosition.js.map +1 -0
- package/dist/src/utils/getMiddleOfRange.js.map +1 -0
- package/dist/src/utils/getPercentage.js.map +1 -0
- package/dist/src/utils/getRangeDefaultValue.js.map +1 -0
- package/dist/src/utils/getRangeSteps.js.map +1 -0
- package/dist/src/utils/identity.js.map +1 -0
- package/dist/src/utils/isElementVisible.js.map +1 -0
- package/dist/src/utils/loop.js.map +1 -0
- package/dist/src/utils/nearest.js.map +1 -0
- package/dist/src/utils/parseCssLengthUnit.js.map +1 -0
- package/dist/src/utils/randomInt.js.map +1 -0
- package/dist/src/utils/wait.js.map +1 -0
- package/dist/src/utils/withinRange.js.map +1 -0
- package/dist/src/window-splitter/WindowSplitter.js.map +1 -0
- package/dist/src/window-splitter/useWindowSplitter.js.map +1 -0
- package/dist/theme/_theme.scss +20 -10
- package/package.json +8 -8
- package/src/_core.scss +1 -1
- package/src/form/_form.scss +1 -1
- package/src/list/ListItem.tsx +1 -1
- package/src/list/ListItemLink.tsx +1 -1
- package/src/list/__tests__/getListItemHeight.ts +2 -2
- package/src/list/getListItemHeight.ts +2 -3
- package/src/list/types.ts +1 -1
- package/src/menu/_menu.scss +0 -2
- package/src/theme/_theme.scss +20 -10
- package/dist/CoreProviders.js.map +0 -1
- package/dist/NoSsr.js.map +0 -1
- package/dist/SsrProvider.js.map +0 -1
- package/dist/app-bar/AppBar.js.map +0 -1
- package/dist/app-bar/AppBarTitle.js.map +0 -1
- package/dist/avatar/Avatar.js.map +0 -1
- package/dist/avatar/styles.js.map +0 -1
- package/dist/badge/Badge.js.map +0 -1
- package/dist/box/Box.js.map +0 -1
- package/dist/box/styles.js.map +0 -1
- package/dist/button/AsyncButton.js.map +0 -1
- package/dist/button/Button.js.map +0 -1
- package/dist/button/ButtonUnstyled.js.map +0 -1
- package/dist/button/FloatingActionButton.js.map +0 -1
- package/dist/button/TooltippedButton.js.map +0 -1
- package/dist/button/buttonStyles.js.map +0 -1
- package/dist/button/buttonUnstyledStyles.js.map +0 -1
- package/dist/card/Card.js.map +0 -1
- package/dist/card/CardContent.js.map +0 -1
- package/dist/card/CardFooter.js.map +0 -1
- package/dist/card/CardHeader.js.map +0 -1
- package/dist/card/CardSubtitle.js.map +0 -1
- package/dist/card/CardTitle.js.map +0 -1
- package/dist/card/ClickableCard.js.map +0 -1
- package/dist/card/styles.js.map +0 -1
- package/dist/chip/Chip.js.map +0 -1
- package/dist/chip/styles.js.map +0 -1
- package/dist/cssUtils.js.map +0 -1
- package/dist/delegateEvent.js.map +0 -1
- package/dist/dialog/Dialog.js.map +0 -1
- package/dist/dialog/DialogContainer.js.map +0 -1
- package/dist/dialog/DialogContent.js.map +0 -1
- package/dist/dialog/DialogFooter.js.map +0 -1
- package/dist/dialog/DialogHeader.js.map +0 -1
- package/dist/dialog/DialogTitle.js.map +0 -1
- package/dist/dialog/FixedDialog.js.map +0 -1
- package/dist/dialog/NestedDialogProvider.js.map +0 -1
- package/dist/dialog/styles.js.map +0 -1
- package/dist/divider/Divider.js.map +0 -1
- package/dist/divider/styles.js.map +0 -1
- package/dist/draggable/useDraggable.js.map +0 -1
- package/dist/draggable/utils.js.map +0 -1
- package/dist/expansion-panel/ExpansionList.js.map +0 -1
- package/dist/expansion-panel/ExpansionPanel.js.map +0 -1
- package/dist/expansion-panel/ExpansionPanelHeader.js.map +0 -1
- package/dist/expansion-panel/useExpansionList.js.map +0 -1
- package/dist/expansion-panel/useExpansionPanels.js.map +0 -1
- package/dist/focus/useFocusContainer.js.map +0 -1
- package/dist/focus/utils.js.map +0 -1
- package/dist/form/Checkbox.js.map +0 -1
- package/dist/form/Fieldset.js.map +0 -1
- package/dist/form/FileInput.js.map +0 -1
- package/dist/form/Form.js.map +0 -1
- package/dist/form/FormMessage.js.map +0 -1
- package/dist/form/FormMessageContainer.js.map +0 -1
- package/dist/form/FormMessageCounter.js.map +0 -1
- package/dist/form/InputToggle.js.map +0 -1
- package/dist/form/InputToggleIcon.js.map +0 -1
- package/dist/form/Label.js.map +0 -1
- package/dist/form/Legend.js.map +0 -1
- package/dist/form/MenuItemCheckbox.js.map +0 -1
- package/dist/form/MenuItemFileInput.js.map +0 -1
- package/dist/form/MenuItemInputToggle.js.map +0 -1
- package/dist/form/MenuItemRadio.js.map +0 -1
- package/dist/form/MenuItemSwitch.js.map +0 -1
- package/dist/form/MenuItemTextField.js.map +0 -1
- package/dist/form/NativeSelect.js.map +0 -1
- package/dist/form/OptGroup.js.map +0 -1
- package/dist/form/Option.js.map +0 -1
- package/dist/form/Password.js.map +0 -1
- package/dist/form/Radio.js.map +0 -1
- package/dist/form/Select.js.map +0 -1
- package/dist/form/SelectValue.js.map +0 -1
- package/dist/form/Slider.js.map +0 -1
- package/dist/form/SliderContainer.js.map +0 -1
- package/dist/form/SliderMark.js.map +0 -1
- package/dist/form/SliderMarkLabel.js.map +0 -1
- package/dist/form/SliderThumb.js.map +0 -1
- package/dist/form/SliderTrack.js.map +0 -1
- package/dist/form/SliderValueMarks.js.map +0 -1
- package/dist/form/SliderValueTooltip.js.map +0 -1
- package/dist/form/Switch.js.map +0 -1
- package/dist/form/SwitchTrack.js.map +0 -1
- package/dist/form/TextArea.js.map +0 -1
- package/dist/form/TextField.js.map +0 -1
- package/dist/form/TextFieldAddon.js.map +0 -1
- package/dist/form/TextFieldContainer.js.map +0 -1
- package/dist/form/TextFieldContainerStyles.js.map +0 -1
- package/dist/form/fileUtils.js.map +0 -1
- package/dist/form/formConfig.js.map +0 -1
- package/dist/form/formMessageStyles.js.map +0 -1
- package/dist/form/inputToggleStyles.js.map +0 -1
- package/dist/form/nativeSelectStyles.js.map +0 -1
- package/dist/form/optionStyles.js.map +0 -1
- package/dist/form/passwordStyles.js.map +0 -1
- package/dist/form/selectStyles.js.map +0 -1
- package/dist/form/selectUtils.js.map +0 -1
- package/dist/form/sliderUtils.js.map +0 -1
- package/dist/form/switchStyles.js.map +0 -1
- package/dist/form/textAreaStyles.js.map +0 -1
- package/dist/form/textFieldStyles.js.map +0 -1
- package/dist/form/types.js.map +0 -1
- package/dist/form/useCheckboxGroup.js.map +0 -1
- package/dist/form/useFileUpload.js.map +0 -1
- package/dist/form/useListboxProvider.js.map +0 -1
- package/dist/form/useNumberField.js.map +0 -1
- package/dist/form/useRadioGroup.js.map +0 -1
- package/dist/form/useRangeSlider.js.map +0 -1
- package/dist/form/useResizingTextArea.js.map +0 -1
- package/dist/form/useSlider.js.map +0 -1
- package/dist/form/useTextField.js.map +0 -1
- package/dist/form/utils.js.map +0 -1
- package/dist/form/validation.js.map +0 -1
- package/dist/hoverMode/useHoverMode.js.map +0 -1
- package/dist/hoverMode/useHoverModeProvider.js.map +0 -1
- package/dist/icon/FontIcon.js.map +0 -1
- package/dist/icon/IconRotator.js.map +0 -1
- package/dist/icon/MaterialIcon.js.map +0 -1
- package/dist/icon/MaterialSymbol.js.map +0 -1
- package/dist/icon/SVGIcon.js.map +0 -1
- package/dist/icon/TextIconSpacing.js.map +0 -1
- package/dist/icon/iconConfig.js.map +0 -1
- package/dist/icon/material.js.map +0 -1
- package/dist/icon/materialConfig.js.map +0 -1
- package/dist/icon/styles.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/interaction/Ripple.js.map +0 -1
- package/dist/interaction/RippleContainer.js.map +0 -1
- package/dist/interaction/UserInteractionModeProvider.js.map +0 -1
- package/dist/interaction/config.js.map +0 -1
- package/dist/interaction/types.js.map +0 -1
- package/dist/interaction/useElementInteraction.js.map +0 -1
- package/dist/interaction/useHigherContrastChildren.js.map +0 -1
- package/dist/interaction/utils.js.map +0 -1
- package/dist/layout/LayoutAppBar.js.map +0 -1
- package/dist/layout/LayoutNav.js.map +0 -1
- package/dist/layout/LayoutWindowSplitter.js.map +0 -1
- package/dist/layout/Main.js.map +0 -1
- package/dist/layout/layoutNavStyles.js.map +0 -1
- package/dist/layout/layoutWindowSplitterStyles.js.map +0 -1
- package/dist/layout/mainStyles.js.map +0 -1
- package/dist/layout/useExpandableLayout.js.map +0 -1
- package/dist/layout/useHorizontalLayoutTransition.js.map +0 -1
- package/dist/layout/useLayoutAppBarHeight.js.map +0 -1
- package/dist/layout/useLayoutTree.js.map +0 -1
- package/dist/layout/useLayoutWindowSplitter.js.map +0 -1
- package/dist/layout/useMainTabIndex.js.map +0 -1
- package/dist/layout/useResizableLayout.js.map +0 -1
- package/dist/layout/useTemporaryLayout.js.map +0 -1
- package/dist/link/Link.js.map +0 -1
- package/dist/link/SkipToMainContent.js.map +0 -1
- package/dist/link/styles.js.map +0 -1
- package/dist/list/List.js.map +0 -1
- package/dist/list/ListItem.js +0 -148
- package/dist/list/ListItem.js.map +0 -1
- package/dist/list/ListItemAddon.js.map +0 -1
- package/dist/list/ListItemChildren.js.map +0 -1
- package/dist/list/ListItemLink.js +0 -89
- package/dist/list/ListItemLink.js.map +0 -1
- package/dist/list/ListItemText.js.map +0 -1
- package/dist/list/ListSubheader.js.map +0 -1
- package/dist/list/getListItemHeight.js +0 -28
- package/dist/list/getListItemHeight.js.map +0 -1
- package/dist/list/listItemStyles.js.map +0 -1
- package/dist/list/types.js.map +0 -1
- package/dist/media-queries/AppSizeProvider.js.map +0 -1
- package/dist/media-queries/appSize.js.map +0 -1
- package/dist/media-queries/useMediaQuery.js.map +0 -1
- package/dist/menu/DropdownMenu.js.map +0 -1
- package/dist/menu/Menu.js.map +0 -1
- package/dist/menu/MenuBar.js.map +0 -1
- package/dist/menu/MenuButton.js.map +0 -1
- package/dist/menu/MenuConfigurationProvider.js.map +0 -1
- package/dist/menu/MenuItem.js.map +0 -1
- package/dist/menu/MenuItemButton.js.map +0 -1
- package/dist/menu/MenuItemGroup.js.map +0 -1
- package/dist/menu/MenuItemSeparator.js.map +0 -1
- package/dist/menu/MenuSheet.js.map +0 -1
- package/dist/menu/MenuVisibilityProvider.js.map +0 -1
- package/dist/menu/MenuWidget.js.map +0 -1
- package/dist/menu/MenuWidgetKeyboardProvider.js.map +0 -1
- package/dist/menu/useContextMenu.js.map +0 -1
- package/dist/menu/useMenuBarProvider.js.map +0 -1
- package/dist/menu/utils.js.map +0 -1
- package/dist/movement/constants.js.map +0 -1
- package/dist/movement/findMatchIndex.js.map +0 -1
- package/dist/movement/types.js.map +0 -1
- package/dist/movement/useKeyboardMovementProvider.js.map +0 -1
- package/dist/movement/utils.js.map +0 -1
- package/dist/overlay/Overlay.js.map +0 -1
- package/dist/overlay/overlayStyles.js.map +0 -1
- package/dist/portal/Portal.js.map +0 -1
- package/dist/portal/PortalContainerProvider.js.map +0 -1
- package/dist/positioning/constants.js.map +0 -1
- package/dist/positioning/createHorizontalPosition.js.map +0 -1
- package/dist/positioning/createVerticalPosition.js.map +0 -1
- package/dist/positioning/getFixedPosition.js.map +0 -1
- package/dist/positioning/types.js.map +0 -1
- package/dist/positioning/useFixedPositioning.js.map +0 -1
- package/dist/positioning/utils.js.map +0 -1
- package/dist/progress/CircularProgress.js.map +0 -1
- package/dist/progress/LinearProgress.js.map +0 -1
- package/dist/progress/getProgressA11y.js.map +0 -1
- package/dist/progress/types.js.map +0 -1
- package/dist/responsive-item/ResponsiveItemContainer.js.map +0 -1
- package/dist/responsive-item/ResponsiveItemOverlay.js.map +0 -1
- package/dist/responsive-item/styles.js.map +0 -1
- package/dist/scroll/ScrollLock.js.map +0 -1
- package/dist/scroll/getScrollbarWidth.js.map +0 -1
- package/dist/scroll/useScrollLock.js.map +0 -1
- package/dist/segmented-button/SegmentedButton.js.map +0 -1
- package/dist/segmented-button/SegmentedButtonContainer.js.map +0 -1
- package/dist/segmented-button/segmentedButtonContainerStyles.js.map +0 -1
- package/dist/segmented-button/segmentedButtonStyles.js.map +0 -1
- package/dist/sheet/Sheet.js.map +0 -1
- package/dist/sheet/styles.js.map +0 -1
- package/dist/snackbar/DefaultToastRenderer.js.map +0 -1
- package/dist/snackbar/Snackbar.js.map +0 -1
- package/dist/snackbar/Toast.js.map +0 -1
- package/dist/snackbar/ToastActionButton.js.map +0 -1
- package/dist/snackbar/ToastCloseButton.js.map +0 -1
- package/dist/snackbar/ToastContent.js.map +0 -1
- package/dist/snackbar/ToastManager.js.map +0 -1
- package/dist/snackbar/ToastManagerProvider.js.map +0 -1
- package/dist/snackbar/snackbarStyles.js.map +0 -1
- package/dist/snackbar/toastContentStyles.js.map +0 -1
- package/dist/snackbar/toastStyles.js.map +0 -1
- package/dist/snackbar/useCurrentToastActions.js.map +0 -1
- package/dist/suspense/CircularProgressSuspense.js.map +0 -1
- package/dist/suspense/NullSuspense.js.map +0 -1
- package/dist/table/Table.js.map +0 -1
- package/dist/table/TableBody.js.map +0 -1
- package/dist/table/TableCell.js.map +0 -1
- package/dist/table/TableCellContent.js.map +0 -1
- package/dist/table/TableCheckbox.js.map +0 -1
- package/dist/table/TableConfigurationProvider.js.map +0 -1
- package/dist/table/TableContainer.js.map +0 -1
- package/dist/table/TableContainerProvider.js.map +0 -1
- package/dist/table/TableFooter.js.map +0 -1
- package/dist/table/TableHeader.js.map +0 -1
- package/dist/table/TableRadio.js.map +0 -1
- package/dist/table/TableRow.js.map +0 -1
- package/dist/table/tableCellStyles.js.map +0 -1
- package/dist/table/tableContainerStyles.js.map +0 -1
- package/dist/table/tableFooterStyles.js.map +0 -1
- package/dist/table/tableHeaderStyles.js.map +0 -1
- package/dist/table/tableRowStyles.js.map +0 -1
- package/dist/table/tableStyles.js.map +0 -1
- package/dist/table/types.js.map +0 -1
- package/dist/tabs/Tab.js.map +0 -1
- package/dist/tabs/TabList.js.map +0 -1
- package/dist/tabs/TabListScrollButton.js.map +0 -1
- package/dist/tabs/tabIndicatorStyles.js.map +0 -1
- package/dist/tabs/tabListScrollButtonStyles.js.map +0 -1
- package/dist/tabs/tabListStyles.js.map +0 -1
- package/dist/tabs/tabStyles.js.map +0 -1
- package/dist/tabs/useTabList.js.map +0 -1
- package/dist/tabs/useTabs.js.map +0 -1
- package/dist/tabs/utils.js.map +0 -1
- package/dist/test-utils/IntersectionObserver.js.map +0 -1
- package/dist/test-utils/ResizeObserver.js.map +0 -1
- package/dist/test-utils/data-testid.js.map +0 -1
- package/dist/test-utils/index.js.map +0 -1
- package/dist/test-utils/jest-setup.js.map +0 -1
- package/dist/test-utils/matchMedia.js.map +0 -1
- package/dist/test-utils/polyfills/IntersectionObserver.js.map +0 -1
- package/dist/test-utils/polyfills/ResizeObserver.js.map +0 -1
- package/dist/test-utils/polyfills/index.js.map +0 -1
- package/dist/test-utils/polyfills/matchMedia.js.map +0 -1
- package/dist/test-utils/polyfills/offsetParent.js.map +0 -1
- package/dist/test-utils/polyfills/scrollIntoView.js.map +0 -1
- package/dist/test-utils/render.js.map +0 -1
- package/dist/test-utils/timers.js.map +0 -1
- package/dist/theme/LocalStorageColorSchemeProvider.js.map +0 -1
- package/dist/theme/ThemeProvider.js.map +0 -1
- package/dist/theme/colors.js.map +0 -1
- package/dist/theme/cssVars.js.map +0 -1
- package/dist/theme/types.js.map +0 -1
- package/dist/theme/useCSSVariables.js.map +0 -1
- package/dist/theme/useColorScheme.js.map +0 -1
- package/dist/theme/useColorSchemeMetaTag.js.map +0 -1
- package/dist/theme/useColorSchemeProvider.js.map +0 -1
- package/dist/theme/usePrefersColorScheme.js.map +0 -1
- package/dist/theme/utils.js.map +0 -1
- package/dist/tooltip/Tooltip.js.map +0 -1
- package/dist/tooltip/TooltipHoverModeProvider.js.map +0 -1
- package/dist/tooltip/constants.js.map +0 -1
- package/dist/tooltip/tooltipStyles.js.map +0 -1
- package/dist/tooltip/useTooltip.js.map +0 -1
- package/dist/tooltip/useTooltipPosition.js.map +0 -1
- package/dist/tooltip/utils.js.map +0 -1
- package/dist/transition/CSSTransition.js.map +0 -1
- package/dist/transition/Collapse.js.map +0 -1
- package/dist/transition/CrossFade.js.map +0 -1
- package/dist/transition/ScaleTransition.js.map +0 -1
- package/dist/transition/SkeletonPlaceholder.js.map +0 -1
- package/dist/transition/Slide.js.map +0 -1
- package/dist/transition/SlideContainer.js.map +0 -1
- package/dist/transition/collapseStyles.js.map +0 -1
- package/dist/transition/config.js.map +0 -1
- package/dist/transition/maxWidthTransition.js.map +0 -1
- package/dist/transition/skeletonPlaceholderUtils.js.map +0 -1
- package/dist/transition/types.js.map +0 -1
- package/dist/transition/useCSSTransition.js.map +0 -1
- package/dist/transition/useCarousel.js.map +0 -1
- package/dist/transition/useCollapseTransition.js.map +0 -1
- package/dist/transition/useCrossFadeTransition.js.map +0 -1
- package/dist/transition/useMaxWidthTransition.js.map +0 -1
- package/dist/transition/useScaleTransition.js.map +0 -1
- package/dist/transition/useSkeletonPlaceholder.js.map +0 -1
- package/dist/transition/useSlideTransition.js.map +0 -1
- package/dist/transition/useTransition.js.map +0 -1
- package/dist/transition/utils.js.map +0 -1
- package/dist/tree/DefaultTreeItemRenderer.js.map +0 -1
- package/dist/tree/Tree.js.map +0 -1
- package/dist/tree/TreeGroup.js.map +0 -1
- package/dist/tree/TreeItem.js.map +0 -1
- package/dist/tree/TreeItemExpander.js.map +0 -1
- package/dist/tree/TreeProvider.js.map +0 -1
- package/dist/tree/styles.js.map +0 -1
- package/dist/tree/types.js.map +0 -1
- package/dist/tree/useTree.js.map +0 -1
- package/dist/tree/useTreeExpansion.js.map +0 -1
- package/dist/tree/useTreeItems.js.map +0 -1
- package/dist/tree/useTreeMovement.js.map +0 -1
- package/dist/tree/useTreeSelection.js.map +0 -1
- package/dist/tree/utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/typography/SrOnly.js.map +0 -1
- package/dist/typography/TextContainer.js.map +0 -1
- package/dist/typography/Typography.js.map +0 -1
- package/dist/typography/WritingDirectionProvider.js.map +0 -1
- package/dist/useAsyncAction.js.map +0 -1
- package/dist/useDebouncedFunction.js.map +0 -1
- package/dist/useDropzone.js.map +0 -1
- package/dist/useElementSize.js.map +0 -1
- package/dist/useEnsuredId.js.map +0 -1
- package/dist/useEnsuredRef.js.map +0 -1
- package/dist/useEnsuredState.js.map +0 -1
- package/dist/useHtmlClassName.js.map +0 -1
- package/dist/useIntersectionObserver.js.map +0 -1
- package/dist/useIsomorphicLayoutEffect.js.map +0 -1
- package/dist/useLocalStorage.js.map +0 -1
- package/dist/useOrientation.js.map +0 -1
- package/dist/usePageInactive.js.map +0 -1
- package/dist/useResizeListener.js.map +0 -1
- package/dist/useResizeObserver.js.map +0 -1
- package/dist/useThrottledFunction.js.map +0 -1
- package/dist/useToggle.js.map +0 -1
- package/dist/useUnmounted.js.map +0 -1
- package/dist/useWindowSize.js.map +0 -1
- package/dist/utils/RenderRecursively.js.map +0 -1
- package/dist/utils/alphaNumericSort.js.map +0 -1
- package/dist/utils/applyRef.js.map +0 -1
- package/dist/utils/bem.js.map +0 -1
- package/dist/utils/filters.js.map +0 -1
- package/dist/utils/getClientPosition.js.map +0 -1
- package/dist/utils/getMiddleOfRange.js.map +0 -1
- package/dist/utils/getPercentage.js.map +0 -1
- package/dist/utils/getRangeDefaultValue.js.map +0 -1
- package/dist/utils/getRangeSteps.js.map +0 -1
- package/dist/utils/identity.js.map +0 -1
- package/dist/utils/isElementVisible.js.map +0 -1
- package/dist/utils/loop.js.map +0 -1
- package/dist/utils/nearest.js.map +0 -1
- package/dist/utils/parseCssLengthUnit.js.map +0 -1
- package/dist/utils/randomInt.js.map +0 -1
- package/dist/utils/wait.js.map +0 -1
- package/dist/utils/withinRange.js.map +0 -1
- package/dist/window-splitter/WindowSplitter.js.map +0 -1
- package/dist/window-splitter/useWindowSplitter.js.map +0 -1
- /package/dist/{CoreProviders.js → src/CoreProviders.js} +0 -0
- /package/dist/{NoSsr.js → src/NoSsr.js} +0 -0
- /package/dist/{SsrProvider.js → src/SsrProvider.js} +0 -0
- /package/dist/{app-bar → src/app-bar}/AppBar.js +0 -0
- /package/dist/{app-bar → src/app-bar}/AppBarTitle.js +0 -0
- /package/dist/{avatar → src/avatar}/Avatar.js +0 -0
- /package/dist/{avatar → src/avatar}/styles.js +0 -0
- /package/dist/{badge → src/badge}/Badge.js +0 -0
- /package/dist/{box → src/box}/Box.js +0 -0
- /package/dist/{box → src/box}/styles.js +0 -0
- /package/dist/{button → src/button}/AsyncButton.js +0 -0
- /package/dist/{button → src/button}/Button.js +0 -0
- /package/dist/{button → src/button}/ButtonUnstyled.js +0 -0
- /package/dist/{button → src/button}/FloatingActionButton.js +0 -0
- /package/dist/{button → src/button}/TooltippedButton.js +0 -0
- /package/dist/{button → src/button}/buttonStyles.js +0 -0
- /package/dist/{button → src/button}/buttonUnstyledStyles.js +0 -0
- /package/dist/{card → src/card}/Card.js +0 -0
- /package/dist/{card → src/card}/CardContent.js +0 -0
- /package/dist/{card → src/card}/CardFooter.js +0 -0
- /package/dist/{card → src/card}/CardHeader.js +0 -0
- /package/dist/{card → src/card}/CardSubtitle.js +0 -0
- /package/dist/{card → src/card}/CardTitle.js +0 -0
- /package/dist/{card → src/card}/ClickableCard.js +0 -0
- /package/dist/{card → src/card}/styles.js +0 -0
- /package/dist/{chip → src/chip}/Chip.js +0 -0
- /package/dist/{chip → src/chip}/styles.js +0 -0
- /package/dist/{cssUtils.js → src/cssUtils.js} +0 -0
- /package/dist/{delegateEvent.js → src/delegateEvent.js} +0 -0
- /package/dist/{dialog → src/dialog}/Dialog.js +0 -0
- /package/dist/{dialog → src/dialog}/DialogContainer.js +0 -0
- /package/dist/{dialog → src/dialog}/DialogContent.js +0 -0
- /package/dist/{dialog → src/dialog}/DialogFooter.js +0 -0
- /package/dist/{dialog → src/dialog}/DialogHeader.js +0 -0
- /package/dist/{dialog → src/dialog}/DialogTitle.js +0 -0
- /package/dist/{dialog → src/dialog}/FixedDialog.js +0 -0
- /package/dist/{dialog → src/dialog}/NestedDialogProvider.js +0 -0
- /package/dist/{dialog → src/dialog}/styles.js +0 -0
- /package/dist/{divider → src/divider}/Divider.js +0 -0
- /package/dist/{divider → src/divider}/styles.js +0 -0
- /package/dist/{draggable → src/draggable}/useDraggable.js +0 -0
- /package/dist/{draggable → src/draggable}/utils.js +0 -0
- /package/dist/{expansion-panel → src/expansion-panel}/ExpansionList.js +0 -0
- /package/dist/{expansion-panel → src/expansion-panel}/ExpansionPanel.js +0 -0
- /package/dist/{expansion-panel → src/expansion-panel}/ExpansionPanelHeader.js +0 -0
- /package/dist/{expansion-panel → src/expansion-panel}/useExpansionList.js +0 -0
- /package/dist/{expansion-panel → src/expansion-panel}/useExpansionPanels.js +0 -0
- /package/dist/{focus → src/focus}/useFocusContainer.js +0 -0
- /package/dist/{focus → src/focus}/utils.js +0 -0
- /package/dist/{form → src/form}/Checkbox.js +0 -0
- /package/dist/{form → src/form}/Fieldset.js +0 -0
- /package/dist/{form → src/form}/FileInput.js +0 -0
- /package/dist/{form → src/form}/Form.js +0 -0
- /package/dist/{form → src/form}/FormMessage.js +0 -0
- /package/dist/{form → src/form}/FormMessageContainer.js +0 -0
- /package/dist/{form → src/form}/FormMessageCounter.js +0 -0
- /package/dist/{form → src/form}/InputToggle.js +0 -0
- /package/dist/{form → src/form}/InputToggleIcon.js +0 -0
- /package/dist/{form → src/form}/Label.js +0 -0
- /package/dist/{form → src/form}/Legend.js +0 -0
- /package/dist/{form → src/form}/MenuItemCheckbox.js +0 -0
- /package/dist/{form → src/form}/MenuItemFileInput.js +0 -0
- /package/dist/{form → src/form}/MenuItemInputToggle.js +0 -0
- /package/dist/{form → src/form}/MenuItemRadio.js +0 -0
- /package/dist/{form → src/form}/MenuItemSwitch.js +0 -0
- /package/dist/{form → src/form}/MenuItemTextField.js +0 -0
- /package/dist/{form → src/form}/NativeSelect.js +0 -0
- /package/dist/{form → src/form}/OptGroup.js +0 -0
- /package/dist/{form → src/form}/Option.js +0 -0
- /package/dist/{form → src/form}/Password.js +0 -0
- /package/dist/{form → src/form}/Radio.js +0 -0
- /package/dist/{form → src/form}/Select.js +0 -0
- /package/dist/{form → src/form}/SelectValue.js +0 -0
- /package/dist/{form → src/form}/Slider.js +0 -0
- /package/dist/{form → src/form}/SliderContainer.js +0 -0
- /package/dist/{form → src/form}/SliderMark.js +0 -0
- /package/dist/{form → src/form}/SliderMarkLabel.js +0 -0
- /package/dist/{form → src/form}/SliderThumb.js +0 -0
- /package/dist/{form → src/form}/SliderTrack.js +0 -0
- /package/dist/{form → src/form}/SliderValueMarks.js +0 -0
- /package/dist/{form → src/form}/SliderValueTooltip.js +0 -0
- /package/dist/{form → src/form}/Switch.js +0 -0
- /package/dist/{form → src/form}/SwitchTrack.js +0 -0
- /package/dist/{form → src/form}/TextArea.js +0 -0
- /package/dist/{form → src/form}/TextField.js +0 -0
- /package/dist/{form → src/form}/TextFieldAddon.js +0 -0
- /package/dist/{form → src/form}/TextFieldContainer.js +0 -0
- /package/dist/{form → src/form}/TextFieldContainerStyles.js +0 -0
- /package/dist/{form → src/form}/fileUtils.js +0 -0
- /package/dist/{form → src/form}/formConfig.js +0 -0
- /package/dist/{form → src/form}/formMessageStyles.js +0 -0
- /package/dist/{form → src/form}/inputToggleStyles.js +0 -0
- /package/dist/{form → src/form}/nativeSelectStyles.js +0 -0
- /package/dist/{form → src/form}/optionStyles.js +0 -0
- /package/dist/{form → src/form}/passwordStyles.js +0 -0
- /package/dist/{form → src/form}/selectStyles.js +0 -0
- /package/dist/{form → src/form}/selectUtils.js +0 -0
- /package/dist/{form → src/form}/sliderUtils.js +0 -0
- /package/dist/{form → src/form}/switchStyles.js +0 -0
- /package/dist/{form → src/form}/textAreaStyles.js +0 -0
- /package/dist/{form → src/form}/textFieldStyles.js +0 -0
- /package/dist/{form → src/form}/types.js +0 -0
- /package/dist/{form → src/form}/useCheckboxGroup.js +0 -0
- /package/dist/{form → src/form}/useFileUpload.js +0 -0
- /package/dist/{form → src/form}/useListboxProvider.js +0 -0
- /package/dist/{form → src/form}/useNumberField.js +0 -0
- /package/dist/{form → src/form}/useRadioGroup.js +0 -0
- /package/dist/{form → src/form}/useRangeSlider.js +0 -0
- /package/dist/{form → src/form}/useResizingTextArea.js +0 -0
- /package/dist/{form → src/form}/useSlider.js +0 -0
- /package/dist/{form → src/form}/useTextField.js +0 -0
- /package/dist/{form → src/form}/utils.js +0 -0
- /package/dist/{form → src/form}/validation.js +0 -0
- /package/dist/{hoverMode → src/hoverMode}/useHoverMode.js +0 -0
- /package/dist/{hoverMode → src/hoverMode}/useHoverModeProvider.js +0 -0
- /package/dist/{icon → src/icon}/FontIcon.js +0 -0
- /package/dist/{icon → src/icon}/IconRotator.js +0 -0
- /package/dist/{icon → src/icon}/MaterialIcon.js +0 -0
- /package/dist/{icon → src/icon}/MaterialSymbol.js +0 -0
- /package/dist/{icon → src/icon}/SVGIcon.js +0 -0
- /package/dist/{icon → src/icon}/TextIconSpacing.js +0 -0
- /package/dist/{icon → src/icon}/iconConfig.js +0 -0
- /package/dist/{icon → src/icon}/material.js +0 -0
- /package/dist/{icon → src/icon}/materialConfig.js +0 -0
- /package/dist/{icon → src/icon}/styles.js +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{interaction → src/interaction}/Ripple.js +0 -0
- /package/dist/{interaction → src/interaction}/RippleContainer.js +0 -0
- /package/dist/{interaction → src/interaction}/UserInteractionModeProvider.js +0 -0
- /package/dist/{interaction → src/interaction}/config.js +0 -0
- /package/dist/{interaction → src/interaction}/types.js +0 -0
- /package/dist/{interaction → src/interaction}/useElementInteraction.js +0 -0
- /package/dist/{interaction → src/interaction}/useHigherContrastChildren.js +0 -0
- /package/dist/{interaction → src/interaction}/utils.js +0 -0
- /package/dist/{layout → src/layout}/LayoutAppBar.js +0 -0
- /package/dist/{layout → src/layout}/LayoutNav.js +0 -0
- /package/dist/{layout → src/layout}/LayoutWindowSplitter.js +0 -0
- /package/dist/{layout → src/layout}/Main.js +0 -0
- /package/dist/{layout → src/layout}/layoutNavStyles.js +0 -0
- /package/dist/{layout → src/layout}/layoutWindowSplitterStyles.js +0 -0
- /package/dist/{layout → src/layout}/mainStyles.js +0 -0
- /package/dist/{layout → src/layout}/useExpandableLayout.js +0 -0
- /package/dist/{layout → src/layout}/useHorizontalLayoutTransition.js +0 -0
- /package/dist/{layout → src/layout}/useLayoutAppBarHeight.js +0 -0
- /package/dist/{layout → src/layout}/useLayoutTree.js +0 -0
- /package/dist/{layout → src/layout}/useLayoutWindowSplitter.js +0 -0
- /package/dist/{layout → src/layout}/useMainTabIndex.js +0 -0
- /package/dist/{layout → src/layout}/useResizableLayout.js +0 -0
- /package/dist/{layout → src/layout}/useTemporaryLayout.js +0 -0
- /package/dist/{link → src/link}/Link.js +0 -0
- /package/dist/{link → src/link}/SkipToMainContent.js +0 -0
- /package/dist/{link → src/link}/styles.js +0 -0
- /package/dist/{list → src/list}/List.js +0 -0
- /package/dist/{list → src/list}/ListItemAddon.js +0 -0
- /package/dist/{list → src/list}/ListItemChildren.js +0 -0
- /package/dist/{list → src/list}/ListItemText.js +0 -0
- /package/dist/{list → src/list}/ListSubheader.js +0 -0
- /package/dist/{list → src/list}/listItemStyles.js +0 -0
- /package/dist/{list → src/list}/types.js +0 -0
- /package/dist/{media-queries → src/media-queries}/AppSizeProvider.js +0 -0
- /package/dist/{media-queries → src/media-queries}/appSize.js +0 -0
- /package/dist/{media-queries → src/media-queries}/useMediaQuery.js +0 -0
- /package/dist/{menu → src/menu}/DropdownMenu.js +0 -0
- /package/dist/{menu → src/menu}/Menu.js +0 -0
- /package/dist/{menu → src/menu}/MenuBar.js +0 -0
- /package/dist/{menu → src/menu}/MenuButton.js +0 -0
- /package/dist/{menu → src/menu}/MenuConfigurationProvider.js +0 -0
- /package/dist/{menu → src/menu}/MenuItem.js +0 -0
- /package/dist/{menu → src/menu}/MenuItemButton.js +0 -0
- /package/dist/{menu → src/menu}/MenuItemGroup.js +0 -0
- /package/dist/{menu → src/menu}/MenuItemSeparator.js +0 -0
- /package/dist/{menu → src/menu}/MenuSheet.js +0 -0
- /package/dist/{menu → src/menu}/MenuVisibilityProvider.js +0 -0
- /package/dist/{menu → src/menu}/MenuWidget.js +0 -0
- /package/dist/{menu → src/menu}/MenuWidgetKeyboardProvider.js +0 -0
- /package/dist/{menu → src/menu}/useContextMenu.js +0 -0
- /package/dist/{menu → src/menu}/useMenuBarProvider.js +0 -0
- /package/dist/{menu → src/menu}/utils.js +0 -0
- /package/dist/{movement → src/movement}/constants.js +0 -0
- /package/dist/{movement → src/movement}/findMatchIndex.js +0 -0
- /package/dist/{movement → src/movement}/types.js +0 -0
- /package/dist/{movement → src/movement}/useKeyboardMovementProvider.js +0 -0
- /package/dist/{movement → src/movement}/utils.js +0 -0
- /package/dist/{overlay → src/overlay}/Overlay.js +0 -0
- /package/dist/{overlay → src/overlay}/overlayStyles.js +0 -0
- /package/dist/{portal → src/portal}/Portal.js +0 -0
- /package/dist/{portal → src/portal}/PortalContainerProvider.js +0 -0
- /package/dist/{positioning → src/positioning}/constants.js +0 -0
- /package/dist/{positioning → src/positioning}/createHorizontalPosition.js +0 -0
- /package/dist/{positioning → src/positioning}/createVerticalPosition.js +0 -0
- /package/dist/{positioning → src/positioning}/getFixedPosition.js +0 -0
- /package/dist/{positioning → src/positioning}/types.js +0 -0
- /package/dist/{positioning → src/positioning}/useFixedPositioning.js +0 -0
- /package/dist/{positioning → src/positioning}/utils.js +0 -0
- /package/dist/{progress → src/progress}/CircularProgress.js +0 -0
- /package/dist/{progress → src/progress}/LinearProgress.js +0 -0
- /package/dist/{progress → src/progress}/getProgressA11y.js +0 -0
- /package/dist/{progress → src/progress}/types.js +0 -0
- /package/dist/{responsive-item → src/responsive-item}/ResponsiveItemContainer.js +0 -0
- /package/dist/{responsive-item → src/responsive-item}/ResponsiveItemOverlay.js +0 -0
- /package/dist/{responsive-item → src/responsive-item}/styles.js +0 -0
- /package/dist/{scroll → src/scroll}/ScrollLock.js +0 -0
- /package/dist/{scroll → src/scroll}/getScrollbarWidth.js +0 -0
- /package/dist/{scroll → src/scroll}/useScrollLock.js +0 -0
- /package/dist/{segmented-button → src/segmented-button}/SegmentedButton.js +0 -0
- /package/dist/{segmented-button → src/segmented-button}/SegmentedButtonContainer.js +0 -0
- /package/dist/{segmented-button → src/segmented-button}/segmentedButtonContainerStyles.js +0 -0
- /package/dist/{segmented-button → src/segmented-button}/segmentedButtonStyles.js +0 -0
- /package/dist/{sheet → src/sheet}/Sheet.js +0 -0
- /package/dist/{sheet → src/sheet}/styles.js +0 -0
- /package/dist/{snackbar → src/snackbar}/DefaultToastRenderer.js +0 -0
- /package/dist/{snackbar → src/snackbar}/Snackbar.js +0 -0
- /package/dist/{snackbar → src/snackbar}/Toast.js +0 -0
- /package/dist/{snackbar → src/snackbar}/ToastActionButton.js +0 -0
- /package/dist/{snackbar → src/snackbar}/ToastCloseButton.js +0 -0
- /package/dist/{snackbar → src/snackbar}/ToastContent.js +0 -0
- /package/dist/{snackbar → src/snackbar}/ToastManager.js +0 -0
- /package/dist/{snackbar → src/snackbar}/ToastManagerProvider.js +0 -0
- /package/dist/{snackbar → src/snackbar}/snackbarStyles.js +0 -0
- /package/dist/{snackbar → src/snackbar}/toastContentStyles.js +0 -0
- /package/dist/{snackbar → src/snackbar}/toastStyles.js +0 -0
- /package/dist/{snackbar → src/snackbar}/useCurrentToastActions.js +0 -0
- /package/dist/{suspense → src/suspense}/CircularProgressSuspense.js +0 -0
- /package/dist/{suspense → src/suspense}/NullSuspense.js +0 -0
- /package/dist/{table → src/table}/Table.js +0 -0
- /package/dist/{table → src/table}/TableBody.js +0 -0
- /package/dist/{table → src/table}/TableCell.js +0 -0
- /package/dist/{table → src/table}/TableCellContent.js +0 -0
- /package/dist/{table → src/table}/TableCheckbox.js +0 -0
- /package/dist/{table → src/table}/TableConfigurationProvider.js +0 -0
- /package/dist/{table → src/table}/TableContainer.js +0 -0
- /package/dist/{table → src/table}/TableContainerProvider.js +0 -0
- /package/dist/{table → src/table}/TableFooter.js +0 -0
- /package/dist/{table → src/table}/TableHeader.js +0 -0
- /package/dist/{table → src/table}/TableRadio.js +0 -0
- /package/dist/{table → src/table}/TableRow.js +0 -0
- /package/dist/{table → src/table}/tableCellStyles.js +0 -0
- /package/dist/{table → src/table}/tableContainerStyles.js +0 -0
- /package/dist/{table → src/table}/tableFooterStyles.js +0 -0
- /package/dist/{table → src/table}/tableHeaderStyles.js +0 -0
- /package/dist/{table → src/table}/tableRowStyles.js +0 -0
- /package/dist/{table → src/table}/tableStyles.js +0 -0
- /package/dist/{table → src/table}/types.js +0 -0
- /package/dist/{tabs → src/tabs}/Tab.js +0 -0
- /package/dist/{tabs → src/tabs}/TabList.js +0 -0
- /package/dist/{tabs → src/tabs}/TabListScrollButton.js +0 -0
- /package/dist/{tabs → src/tabs}/tabIndicatorStyles.js +0 -0
- /package/dist/{tabs → src/tabs}/tabListScrollButtonStyles.js +0 -0
- /package/dist/{tabs → src/tabs}/tabListStyles.js +0 -0
- /package/dist/{tabs → src/tabs}/tabStyles.js +0 -0
- /package/dist/{tabs → src/tabs}/useTabList.js +0 -0
- /package/dist/{tabs → src/tabs}/useTabs.js +0 -0
- /package/dist/{tabs → src/tabs}/utils.js +0 -0
- /package/dist/{test-utils → src/test-utils}/IntersectionObserver.js +0 -0
- /package/dist/{test-utils → src/test-utils}/ResizeObserver.js +0 -0
- /package/dist/{test-utils → src/test-utils}/data-testid.js +0 -0
- /package/dist/{test-utils → src/test-utils}/index.js +0 -0
- /package/dist/{test-utils → src/test-utils}/jest-setup.js +0 -0
- /package/dist/{test-utils → src/test-utils}/matchMedia.js +0 -0
- /package/dist/{test-utils → src/test-utils}/polyfills/IntersectionObserver.js +0 -0
- /package/dist/{test-utils → src/test-utils}/polyfills/ResizeObserver.js +0 -0
- /package/dist/{test-utils → src/test-utils}/polyfills/index.js +0 -0
- /package/dist/{test-utils → src/test-utils}/polyfills/matchMedia.js +0 -0
- /package/dist/{test-utils → src/test-utils}/polyfills/offsetParent.js +0 -0
- /package/dist/{test-utils → src/test-utils}/polyfills/scrollIntoView.js +0 -0
- /package/dist/{test-utils → src/test-utils}/render.js +0 -0
- /package/dist/{test-utils → src/test-utils}/timers.js +0 -0
- /package/dist/{theme → src/theme}/LocalStorageColorSchemeProvider.js +0 -0
- /package/dist/{theme → src/theme}/ThemeProvider.js +0 -0
- /package/dist/{theme → src/theme}/colors.js +0 -0
- /package/dist/{theme → src/theme}/cssVars.js +0 -0
- /package/dist/{theme → src/theme}/types.js +0 -0
- /package/dist/{theme → src/theme}/useCSSVariables.js +0 -0
- /package/dist/{theme → src/theme}/useColorScheme.js +0 -0
- /package/dist/{theme → src/theme}/useColorSchemeMetaTag.js +0 -0
- /package/dist/{theme → src/theme}/useColorSchemeProvider.js +0 -0
- /package/dist/{theme → src/theme}/usePrefersColorScheme.js +0 -0
- /package/dist/{theme → src/theme}/utils.js +0 -0
- /package/dist/{tooltip → src/tooltip}/Tooltip.js +0 -0
- /package/dist/{tooltip → src/tooltip}/TooltipHoverModeProvider.js +0 -0
- /package/dist/{tooltip → src/tooltip}/constants.js +0 -0
- /package/dist/{tooltip → src/tooltip}/tooltipStyles.js +0 -0
- /package/dist/{tooltip → src/tooltip}/useTooltip.js +0 -0
- /package/dist/{tooltip → src/tooltip}/useTooltipPosition.js +0 -0
- /package/dist/{tooltip → src/tooltip}/utils.js +0 -0
- /package/dist/{transition → src/transition}/CSSTransition.js +0 -0
- /package/dist/{transition → src/transition}/Collapse.js +0 -0
- /package/dist/{transition → src/transition}/CrossFade.js +0 -0
- /package/dist/{transition → src/transition}/ScaleTransition.js +0 -0
- /package/dist/{transition → src/transition}/SkeletonPlaceholder.js +0 -0
- /package/dist/{transition → src/transition}/Slide.js +0 -0
- /package/dist/{transition → src/transition}/SlideContainer.js +0 -0
- /package/dist/{transition → src/transition}/collapseStyles.js +0 -0
- /package/dist/{transition → src/transition}/config.js +0 -0
- /package/dist/{transition → src/transition}/maxWidthTransition.js +0 -0
- /package/dist/{transition → src/transition}/skeletonPlaceholderUtils.js +0 -0
- /package/dist/{transition → src/transition}/types.js +0 -0
- /package/dist/{transition → src/transition}/useCSSTransition.js +0 -0
- /package/dist/{transition → src/transition}/useCarousel.js +0 -0
- /package/dist/{transition → src/transition}/useCollapseTransition.js +0 -0
- /package/dist/{transition → src/transition}/useCrossFadeTransition.js +0 -0
- /package/dist/{transition → src/transition}/useMaxWidthTransition.js +0 -0
- /package/dist/{transition → src/transition}/useScaleTransition.js +0 -0
- /package/dist/{transition → src/transition}/useSkeletonPlaceholder.js +0 -0
- /package/dist/{transition → src/transition}/useSlideTransition.js +0 -0
- /package/dist/{transition → src/transition}/useTransition.js +0 -0
- /package/dist/{transition → src/transition}/utils.js +0 -0
- /package/dist/{tree → src/tree}/DefaultTreeItemRenderer.js +0 -0
- /package/dist/{tree → src/tree}/Tree.js +0 -0
- /package/dist/{tree → src/tree}/TreeGroup.js +0 -0
- /package/dist/{tree → src/tree}/TreeItem.js +0 -0
- /package/dist/{tree → src/tree}/TreeItemExpander.js +0 -0
- /package/dist/{tree → src/tree}/TreeProvider.js +0 -0
- /package/dist/{tree → src/tree}/styles.js +0 -0
- /package/dist/{tree → src/tree}/types.js +0 -0
- /package/dist/{tree → src/tree}/useTree.js +0 -0
- /package/dist/{tree → src/tree}/useTreeExpansion.js +0 -0
- /package/dist/{tree → src/tree}/useTreeItems.js +0 -0
- /package/dist/{tree → src/tree}/useTreeMovement.js +0 -0
- /package/dist/{tree → src/tree}/useTreeSelection.js +0 -0
- /package/dist/{tree → src/tree}/utils.js +0 -0
- /package/dist/{types.js → src/types.js} +0 -0
- /package/dist/{typography → src/typography}/SrOnly.js +0 -0
- /package/dist/{typography → src/typography}/TextContainer.js +0 -0
- /package/dist/{typography → src/typography}/Typography.js +0 -0
- /package/dist/{typography → src/typography}/WritingDirectionProvider.js +0 -0
- /package/dist/{useAsyncAction.js → src/useAsyncAction.js} +0 -0
- /package/dist/{useDebouncedFunction.js → src/useDebouncedFunction.js} +0 -0
- /package/dist/{useDropzone.js → src/useDropzone.js} +0 -0
- /package/dist/{useElementSize.js → src/useElementSize.js} +0 -0
- /package/dist/{useEnsuredId.js → src/useEnsuredId.js} +0 -0
- /package/dist/{useEnsuredRef.js → src/useEnsuredRef.js} +0 -0
- /package/dist/{useEnsuredState.js → src/useEnsuredState.js} +0 -0
- /package/dist/{useHtmlClassName.js → src/useHtmlClassName.js} +0 -0
- /package/dist/{useIntersectionObserver.js → src/useIntersectionObserver.js} +0 -0
- /package/dist/{useIsomorphicLayoutEffect.js → src/useIsomorphicLayoutEffect.js} +0 -0
- /package/dist/{useLocalStorage.js → src/useLocalStorage.js} +0 -0
- /package/dist/{useOrientation.js → src/useOrientation.js} +0 -0
- /package/dist/{usePageInactive.js → src/usePageInactive.js} +0 -0
- /package/dist/{useResizeListener.js → src/useResizeListener.js} +0 -0
- /package/dist/{useResizeObserver.js → src/useResizeObserver.js} +0 -0
- /package/dist/{useThrottledFunction.js → src/useThrottledFunction.js} +0 -0
- /package/dist/{useToggle.js → src/useToggle.js} +0 -0
- /package/dist/{useUnmounted.js → src/useUnmounted.js} +0 -0
- /package/dist/{useWindowSize.js → src/useWindowSize.js} +0 -0
- /package/dist/{utils → src/utils}/RenderRecursively.js +0 -0
- /package/dist/{utils → src/utils}/alphaNumericSort.js +0 -0
- /package/dist/{utils → src/utils}/applyRef.js +0 -0
- /package/dist/{utils → src/utils}/bem.js +0 -0
- /package/dist/{utils → src/utils}/filters.js +0 -0
- /package/dist/{utils → src/utils}/getClientPosition.js +0 -0
- /package/dist/{utils → src/utils}/getMiddleOfRange.js +0 -0
- /package/dist/{utils → src/utils}/getPercentage.js +0 -0
- /package/dist/{utils → src/utils}/getRangeDefaultValue.js +0 -0
- /package/dist/{utils → src/utils}/getRangeSteps.js +0 -0
- /package/dist/{utils → src/utils}/identity.js +0 -0
- /package/dist/{utils → src/utils}/isElementVisible.js +0 -0
- /package/dist/{utils → src/utils}/loop.js +0 -0
- /package/dist/{utils → src/utils}/nearest.js +0 -0
- /package/dist/{utils → src/utils}/parseCssLengthUnit.js +0 -0
- /package/dist/{utils → src/utils}/randomInt.js +0 -0
- /package/dist/{utils → src/utils}/wait.js +0 -0
- /package/dist/{utils → src/utils}/withinRange.js +0 -0
- /package/dist/{window-splitter → src/window-splitter}/WindowSplitter.js +0 -0
- /package/dist/{window-splitter → src/window-splitter}/useWindowSplitter.js +0 -0
package/dist/form/Switch.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/form/Switch.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { type InputToggleLabelProps } from \"./InputToggle.js\";\nimport { Label } from \"./Label.js\";\nimport { SwitchTrack } from \"./SwitchTrack.js\";\nimport { switchStyles } from \"./switchStyles.js\";\nimport {\n type FormComponentStates,\n type FormMessageContainerExtension,\n} from \"./types.js\";\n\n/**\n * @remarks \\@since 6.0.0 Added `containerProps` and support for the\n * `FormMessage` behavior.\n */\nexport interface SwitchProps\n extends InputHTMLAttributes<HTMLInputElement>,\n InputToggleLabelProps,\n FormMessageContainerExtension,\n FormComponentStates {\n containerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n trackProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n trackStyle?: CSSProperties;\n trackClassName?: string;\n ballAddon?: ReactNode;\n ballProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;\n ballStyle?: CSSProperties;\n ballClassName?: string;\n}\n\n/**\n * **Server Component**\n *\n * @example\n * Simple Example\n * ```tsx\n * import { Form, Switch } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n * import { useState } from \"react\";\n *\n * function Example(): ReactElement {\n * const [checked, setChecked] = useState(false);\n *\n * return (\n * <Form>\n * <Switch\n * label=\"Label\"\n * name=\"enabled\"\n * checked={checked}\n * onChange={(event) => setChecked(event.currentTarget.checked)}\n * />\n * </Form>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0 Added support for `FormMessage` behavior.\n */\nexport const Switch = forwardRef<HTMLInputElement, SwitchProps>(\n function Switch(props, ref) {\n const {\n id: propId,\n label,\n labelProps,\n style,\n className,\n containerProps,\n ballProps,\n ballStyle,\n ballClassName,\n ballAddon,\n trackProps,\n trackStyle,\n trackClassName,\n messageProps,\n messageContainerProps,\n disableLabelGap = false,\n error = false,\n active = false,\n stacked = false,\n iconAfter = false,\n disabled = false,\n readOnly = false,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"switch\");\n\n return (\n <FormMessageContainer\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <Label\n style={style}\n {...labelProps}\n className={cnb(className, labelProps?.className)}\n gap={!disableLabelGap}\n stacked={stacked}\n reversed={!iconAfter}\n active={active}\n error={error}\n disabled={disabled}\n >\n {label}\n <div\n {...containerProps}\n className={switchStyles({\n clickable: !disabled && !readOnly,\n className: containerProps?.className,\n currentColor: active || error,\n })}\n >\n <SwitchTrack\n style={trackStyle}\n {...trackProps}\n className={cnb(trackClassName, trackProps?.className)}\n disabled={disabled}\n ballAddon={ballAddon}\n ballProps={ballProps}\n ballStyle={ballStyle}\n ballClassName={ballClassName}\n >\n <input\n {...remaining}\n id={id}\n ref={ref}\n role=\"switch\"\n type=\"checkbox\"\n className={cnb(\n \"rmd-switch__input rmd-hidden-input\",\n disabled && \"rmd-hidden-input--disabled\"\n )}\n disabled={disabled}\n />\n </SwitchTrack>\n </div>\n </Label>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["cnb","forwardRef","useEnsuredId","FormMessageContainer","Label","SwitchTrack","switchStyles","Switch","props","ref","id","propId","label","labelProps","style","className","containerProps","ballProps","ballStyle","ballClassName","ballAddon","trackProps","trackStyle","trackClassName","messageProps","messageContainerProps","disableLabelGap","error","active","stacked","iconAfter","disabled","readOnly","remaining","gap","reversed","div","clickable","currentColor","input","role","type"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,QAKL,QAAQ;AAEf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,4BAA4B;AAEjE,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,YAAY,QAAQ,oBAAoB;AAyBjD;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GACD,OAAO,MAAMC,uBAASN,WACpB,SAASM,OAAOC,KAAK,EAAEC,GAAG;IACxB,MAAM,EACJC,IAAIC,MAAM,EACVC,KAAK,EACLC,UAAU,EACVC,KAAK,EACLC,SAAS,EACTC,cAAc,EACdC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,cAAc,EACdC,YAAY,EACZC,qBAAqB,EACrBC,kBAAkB,KAAK,EACvBC,QAAQ,KAAK,EACbC,SAAS,KAAK,EACdC,UAAU,KAAK,EACfC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,WAAW,KAAK,EAChB,GAAGC,WACJ,GAAGzB;IACJ,MAAME,KAAKR,aAAaS,QAAQ;IAEhC,qBACE,KAACR;QACE,GAAGsB,qBAAqB;QACzBD,cAAcA;kBAEd,cAAA,MAACpB;YACCU,OAAOA;YACN,GAAGD,UAAU;YACdE,WAAWf,IAAIe,WAAWF,YAAYE;YACtCmB,KAAK,CAACR;YACNG,SAASA;YACTM,UAAU,CAACL;YACXF,QAAQA;YACRD,OAAOA;YACPI,UAAUA;;gBAETnB;8BACD,KAACwB;oBACE,GAAGpB,cAAc;oBAClBD,WAAWT,aAAa;wBACtB+B,WAAW,CAACN,YAAY,CAACC;wBACzBjB,WAAWC,gBAAgBD;wBAC3BuB,cAAcV,UAAUD;oBAC1B;8BAEA,cAAA,KAACtB;wBACCS,OAAOQ;wBACN,GAAGD,UAAU;wBACdN,WAAWf,IAAIuB,gBAAgBF,YAAYN;wBAC3CgB,UAAUA;wBACVX,WAAWA;wBACXH,WAAWA;wBACXC,WAAWA;wBACXC,eAAeA;kCAEf,cAAA,KAACoB;4BACE,GAAGN,SAAS;4BACbvB,IAAIA;4BACJD,KAAKA;4BACL+B,MAAK;4BACLC,MAAK;4BACL1B,WAAWf,IACT,sCACA+B,YAAY;4BAEdA,UAAUA;;;;;;;AAOxB,GACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/form/SwitchTrack.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-switch\");\n\nexport interface SwitchTrackProps extends HTMLAttributes<HTMLDivElement> {\n active?: boolean;\n disabled?: boolean;\n ballAddon?: ReactNode;\n ballProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;\n ballStyle?: CSSProperties;\n ballClassName?: string;\n}\n\n/**\n * **Server Component**\n */\nexport const SwitchTrack = forwardRef<HTMLDivElement, SwitchTrackProps>(\n function SwitchTrack(props, ref) {\n const {\n style,\n className,\n ballAddon,\n ballProps,\n ballStyle,\n ballClassName,\n active,\n children,\n disabled = false,\n ...remaining\n } = props;\n\n return (\n <div\n {...remaining}\n ref={ref}\n style={style}\n className={cnb(styles(\"track\", { disabled }), className)}\n >\n {children}\n <span\n style={ballStyle}\n {...ballProps}\n className={cnb(styles(\"ball\", { active }), ballClassName)}\n >\n {ballAddon}\n {ballProps?.children}\n </span>\n </div>\n );\n }\n);\n"],"names":["cnb","forwardRef","bem","styles","SwitchTrack","props","ref","style","className","ballAddon","ballProps","ballStyle","ballClassName","active","children","disabled","remaining","div","span"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,QAIL,QAAQ;AAEf,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAWnB;;CAEC,GACD,OAAO,MAAME,4BAAcH,WACzB,SAASG,YAAYC,KAAK,EAAEC,GAAG;IAC7B,MAAM,EACJC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,MAAM,EACNC,QAAQ,EACRC,WAAW,KAAK,EAChB,GAAGC,WACJ,GAAGX;IAEJ,qBACE,MAACY;QACE,GAAGD,SAAS;QACbV,KAAKA;QACLC,OAAOA;QACPC,WAAWR,IAAIG,OAAO,SAAS;YAAEY;QAAS,IAAIP;;YAE7CM;0BACD,MAACI;gBACCX,OAAOI;gBACN,GAAGD,SAAS;gBACbF,WAAWR,IAAIG,OAAO,QAAQ;oBAAEU;gBAAO,IAAID;;oBAE1CH;oBACAC,WAAWI;;;;;AAIpB,GACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/form/TextArea.tsx"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n useRef,\n type CSSProperties,\n type HTMLAttributes,\n type TextareaHTMLAttributes,\n} from \"react\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { Label } from \"./Label.js\";\nimport { TextFieldContainer } from \"./TextFieldContainer.js\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { textArea, textAreaContainer } from \"./textAreaStyles.js\";\nimport { type FormFieldOptions } from \"./types.js\";\nimport {\n useResizingTextArea,\n type TextAreaResize,\n} from \"./useResizingTextArea.js\";\n\nexport interface TextAreaProps\n extends FormFieldOptions,\n TextareaHTMLAttributes<HTMLTextAreaElement> {\n /**\n * Optional placeholder text to display in the text field.\n *\n * @defaultValue `label ? \" \" : \"\"`\n */\n placeholder?: string;\n\n /**\n * Set this to `true` if the auto resizing textarea should not animate for new\n * height changes.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * An optional style to apply to the textarea element. The base `style` prop\n * is applied to the surrounding `div` instead.\n */\n areaStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the textarea element. The base `style`\n * prop is applied to the surrounding `div` instead.\n */\n areaClassName?: string;\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n * @defaultValue `2`\n */\n rows?: number;\n\n /**\n * The maximum number of rows a textarea can expand to before showing a\n * scrollbar. When this is set to `-1`, there will be no limit.\n *\n * @defaultValue `-1`\n */\n maxRows?: number;\n\n /**\n * @see {@link TextAreaResize}\n * @defaultValue `\"auto\"`\n */\n resize?: TextAreaResize;\n\n /**\n * When the {@link resize} prop is set to `\"auto\"`, an additional `<div>` is\n * added along with a hidden `<textarea>` mask. This prop can be used to add\n * any additional styling or props to that div.\n *\n * This will only be applied when {@link resize} is set to `\"auto\"`.\n */\n resizeContainerProps?: PropsWithRef<\n HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n >;\n}\n\n/**\n * **Client Component**\n *\n * @example\n * Simple Example\n * ```tsx\n * import { TextArea } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <TextArea\n * label=\"Label\"\n * placeholder=\"Placeholder\"\n * />\n * );\n * }\n * ```\n */\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(props, ref) {\n const {\n id: propId,\n style,\n className,\n label,\n labelProps,\n labelStyle,\n labelClassName,\n areaStyle,\n areaClassName,\n resizeContainerProps,\n resize = \"auto\",\n dense = false,\n error = false,\n active = false,\n inline: propInline = false,\n stretch = false,\n leftAddon,\n rightAddon,\n disableLeftAddonStyles = false,\n disableRightAddonStyles = false,\n theme: propTheme,\n underlineDirection: propUnderlineDirection,\n messageProps,\n messageContainerProps,\n rows = 2,\n maxRows = -1,\n onChange: propOnChange,\n disableTransition = false,\n ...remaining\n } = props;\n const { disabled = false, readOnly = false, value, defaultValue } = props;\n const id = useEnsuredId(propId, \"text-field\");\n const theme = getFormConfig(\"theme\", propTheme);\n const underlineDirection = getFormConfig(\n \"underlineDirection\",\n propUnderlineDirection\n );\n const [areaRef, areaRefCallback] = useEnsuredRef(ref);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const { maskRef, height, onChange, scrollable } = useResizingTextArea({\n maxRows,\n resize,\n onChange: propOnChange,\n containerRef,\n });\n\n let { placeholder = \"\" } = props;\n if (label && !placeholder) {\n // See the placeholder type definition comments for information\n placeholder = \" \";\n }\n\n // have to force it inline or else you won't be able to resize\n // it horizontally.\n const inline = resize === \"horizontal\" || resize === \"both\" || propInline;\n\n const area = (\n <textarea\n {...remaining}\n id={id}\n ref={areaRefCallback}\n rows={rows}\n disabled={disabled}\n onChange={onChange}\n style={areaStyle}\n className={textArea({\n resize,\n scrollable,\n className: areaClassName,\n placeholderHidden: !!label && !active,\n })}\n />\n );\n\n const labelNode = label && (\n <Label\n {...labelProps}\n htmlFor={id}\n style={labelProps?.style ?? labelStyle}\n className={labelProps?.className ?? labelClassName}\n floating\n dense={dense}\n error={error}\n active={active}\n disabled={disabled}\n >\n {label}\n </Label>\n );\n\n let children = (\n <>\n {area}\n {labelNode}\n </>\n );\n\n if (resize === \"auto\") {\n children = (\n <div\n {...resizeContainerProps}\n className={cnb(\n \"rmd-textarea-container__inner\",\n !disableTransition && \"rmd-textarea-container__inner--animate\",\n resizeContainerProps?.className\n )}\n >\n {area}\n {labelNode}\n <textarea\n aria-hidden\n id={`${id}-mask`}\n ref={maskRef}\n defaultValue={value ?? defaultValue}\n readOnly\n tabIndex={-1}\n rows={rows}\n style={areaStyle}\n className={textArea({\n mask: true,\n resize,\n className: areaClassName,\n })}\n />\n </div>\n );\n }\n\n return (\n <FormMessageContainer\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <TextFieldContainer\n ref={containerRef}\n style={{\n ...style,\n \"--rmd-textarea-height\": height,\n }}\n className={textAreaContainer({\n animate: !disableTransition && resize == \"auto\",\n disabled,\n height: !!height,\n underlineLabelled:\n !!label && (theme === \"underline\" || theme === \"filled\"),\n className,\n })}\n theme={theme}\n label={!!label}\n error={error}\n dense={dense}\n inline={inline}\n active={active}\n stretch={stretch}\n readOnly={readOnly}\n disabled={disabled}\n leftAddon={leftAddon}\n rightAddon={rightAddon}\n underlineDirection={underlineDirection}\n disableLeftAddonStyles={disableLeftAddonStyles}\n disableRightAddonStyles={disableRightAddonStyles}\n onClick={(event) => {\n // The textarea container adds padding-top when there is a label so\n // that the label does not cover the text so this makes it so you\n // can still click anywhere in the \"box\" to focus the textarea.\n if (!disabled && event.target === event.currentTarget) {\n areaRef.current?.focus();\n }\n }}\n >\n {children}\n </TextFieldContainer>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["cnb","forwardRef","useRef","useEnsuredId","useEnsuredRef","FormMessageContainer","Label","TextFieldContainer","getFormConfig","textArea","textAreaContainer","useResizingTextArea","TextArea","props","ref","id","propId","style","className","label","labelProps","labelStyle","labelClassName","areaStyle","areaClassName","resizeContainerProps","resize","dense","error","active","inline","propInline","stretch","leftAddon","rightAddon","disableLeftAddonStyles","disableRightAddonStyles","theme","propTheme","underlineDirection","propUnderlineDirection","messageProps","messageContainerProps","rows","maxRows","onChange","propOnChange","disableTransition","remaining","disabled","readOnly","value","defaultValue","areaRef","areaRefCallback","containerRef","maskRef","height","scrollable","placeholder","area","textarea","placeholderHidden","labelNode","htmlFor","floating","children","div","aria-hidden","tabIndex","mask","animate","underlineLabelled","onClick","event","target","currentTarget","current","focus"],"mappings":"AAAA;;AACA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,EACVC,MAAM,QAID,QAAQ;AAEf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,QAAQ,EAAEC,iBAAiB,QAAQ,sBAAsB;AAElE,SACEC,mBAAmB,QAEd,2BAA2B;AAiElC;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,MAAMC,yBAAWX,WACtB,SAASW,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJC,IAAIC,MAAM,EACVC,KAAK,EACLC,SAAS,EACTC,KAAK,EACLC,UAAU,EACVC,UAAU,EACVC,cAAc,EACdC,SAAS,EACTC,aAAa,EACbC,oBAAoB,EACpBC,SAAS,MAAM,EACfC,QAAQ,KAAK,EACbC,QAAQ,KAAK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AAME,aAAa,EAAE;oBACrDvB,QAAQwB,OAAO,EAAEC;gBACnB;YACF;sBAECZ;;;AAIT,GACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/form/TextField.tsx"],"sourcesContent":["import {\n forwardRef,\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { Label } from \"./Label.js\";\nimport { TextFieldContainer } from \"./TextFieldContainer.js\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { textField } from \"./textFieldStyles.js\";\nimport {\n type FormFieldOptions,\n type UserAgentAutoCompleteProps,\n} from \"./types.js\";\n\n/**\n * These are all the \"supported\" input types for react-md so that they at least\n * render reasonably well by default. There is no built-in validation or\n * anything adding onto existing browser functionality for these types.\n *\n * @remarks\n * \\@since 2.5.0 - `\"search\"` was added\n * \\@since 6.0.0 Dropped support for `\"week\"` and `\"month\"` input types since\n * they are not available in Firefox and Safari at this time.\n */\nexport type SupportedInputTypes =\n | \"text\"\n | \"password\"\n | \"number\"\n | \"tel\"\n | \"email\"\n | \"date\"\n | \"time\"\n | \"datetime-local\"\n | \"url\"\n | \"color\"\n | \"search\";\n\n/**\n * @remarks \\@since 6.0.0 Renamed from `TextFieldAttributes` to\n * `TextFieldInputAttributes`\n */\nexport type TextFieldInputAttributes = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\"\n>;\n\n/**\n * @remarks \\@since 6.0.0 Removed the `containerRef` prop.\n */\nexport interface TextFieldProps\n extends TextFieldInputAttributes,\n UserAgentAutoCompleteProps,\n FormFieldOptions {\n /**\n * @defaultValue `\"text-field-\" + useId()`\n */\n id?: string;\n\n /**\n * Optional placeholder text to display in the text field.\n *\n * @defaultValue `label ? \" \" : \"\"`\n */\n placeholder?: string;\n\n /**\n * Any optional inline styles to set on the input.\n */\n inputStyle?: CSSProperties;\n\n /**\n * An optional `className` to add to the input.\n */\n inputClassName?: string;\n\n /**\n * The text field type.\n *\n * @defaultValue `\"text\"`\n */\n type?: SupportedInputTypes;\n\n /**\n * Optional props to provide to the {@link TextFieldContainer} component.\n * There probably isn't any real use for this prop other than if you need to\n * add a `ref` for some DOM behavior.\n */\n containerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n\n /**\n * The `children` will be rendered within the `TextFieldContainer` and before\n * the `<input />` element. This was added to support the new `Select`\n * component implementation\n *\n * @internal\n * @remarks \\@since 6.0.0\n */\n children?: ReactNode;\n}\n\n/**\n * **Server Component**\n *\n * The structure for this component is:\n * @example\n * Component Structure\n * ```tsx\n * <FormMessageContainer {...messageContainerProps}>\n * <TextFieldContainer {...containerProps}>\n * <input {...props} />\n * <Label {...labelProps} />\n * </TextFieldContainer>\n * </FormMessageContainer>\n * ```\n *\n * @example\n * Simple Example\n * ```tsx\n * import { TextField } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <TextField\n * label=\"Name\"\n * placeholder=\"Bob\"\n * defaultValue=\"\"\n * />\n * );\n * }\n * ```\n */\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n function TextField(props, ref) {\n const {\n id: propId,\n style,\n className,\n type = \"text\",\n label,\n labelProps,\n labelStyle,\n labelClassName,\n autoCompleteValue,\n autoComplete = autoCompleteValue,\n name = autoCompleteValue,\n dense = false,\n error = false,\n active = false,\n inline = false,\n stretch = false,\n leftAddon,\n leftAddonProps,\n rightAddon,\n rightAddonProps,\n disableLeftAddonStyles = false,\n disableRightAddonStyles = false,\n inputStyle,\n inputClassName,\n theme: propTheme,\n underlineDirection: propUnderlineDirection,\n messageProps,\n messageContainerProps,\n containerProps,\n children,\n ...remaining\n } = props;\n const { disabled = false, readOnly = false } = props;\n const id = useEnsuredId(propId, \"text-field\");\n const theme = getFormConfig(\"theme\", propTheme);\n const underlineDirection = getFormConfig(\n \"underlineDirection\",\n propUnderlineDirection\n );\n\n let { placeholder = \"\" } = props;\n if (label && !placeholder) {\n // See the placeholder type definition comments for information\n placeholder = \" \";\n }\n\n return (\n <FormMessageContainer\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <TextFieldContainer\n {...containerProps}\n style={style}\n className={className}\n theme={theme}\n label={!!label}\n error={error}\n dense={dense}\n inline={inline}\n active={active}\n stretch={stretch}\n readOnly={readOnly}\n disabled={disabled}\n leftAddon={leftAddon}\n leftAddonProps={leftAddonProps}\n rightAddon={rightAddon}\n rightAddonProps={rightAddonProps}\n underlineDirection={underlineDirection}\n disableLeftAddonStyles={disableLeftAddonStyles}\n disableRightAddonStyles={disableRightAddonStyles}\n >\n {children}\n <input\n {...remaining}\n id={id}\n ref={ref}\n type={type}\n name={name}\n disabled={disabled}\n placeholder={placeholder}\n autoComplete={autoComplete}\n style={inputStyle}\n className={textField({\n className: inputClassName,\n placeholderHidden: !!label && !active,\n })}\n />\n {label && (\n <Label\n floating\n dense={dense}\n error={error}\n active={active}\n disabled={disabled}\n {...labelProps}\n htmlFor={id}\n style={labelProps?.style ?? labelStyle}\n className={labelProps?.className ?? labelClassName}\n >\n {label}\n </Label>\n )}\n </TextFieldContainer>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["forwardRef","useEnsuredId","FormMessageContainer","Label","TextFieldContainer","getFormConfig","textField","TextField","props","ref","id","propId","style","className","type","label","labelProps","labelStyle","labelClassName","autoCompleteValue","autoComplete","name","dense","error","active","inline","stretch","leftAddon","leftAddonProps","rightAddon","rightAddonProps","disableLeftAddonStyles","disableRightAddonStyles","inputStyle","inputClassName","theme","propTheme","underlineDirection","propUnderlineDirection","messageProps","messageContainerProps","containerProps","children","remaining","disabled","readOnly","placeholder","input","placeholderHidden","floating","htmlFor"],"mappings":";AAAA,SACEA,UAAU,QAKL,QAAQ;AAEf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAA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B,OAAO,CAAC,CAACA;YACTQ,OAAOA;YACPD,OAAOA;YACPG,QAAQA;YACRD,QAAQA;YACRE,SAASA;YACTmB,UAAUA;YACVD,UAAUA;YACVjB,WAAWA;YACXC,gBAAgBA;YAChBC,YAAYA;YACZC,iBAAiBA;YACjBO,oBAAoBA;YACpBN,wBAAwBA;YACxBC,yBAAyBA;;gBAExBU;8BACD,KAACK;oBACE,GAAGJ,SAAS;oBACbjC,IAAIA;oBACJD,KAAKA;oBACLK,MAAMA;oBACNO,MAAMA;oBACNuB,UAAUA;oBACVE,aAAaA;oBACb1B,cAAcA;oBACdR,OAAOqB;oBACPpB,WAAWP,UAAU;wBACnBO,WAAWqB;wBACXc,mBAAmB,CAAC,CAACjC,SAAS,CAACS;oBACjC;;gBAEDT,uBACC,KAACZ;oBACC8C,QAAQ;oBACR3B,OAAOA;oBACPC,OAAOA;oBACPC,QAAQA;oBACRoB,UAAUA;oBACT,GAAG5B,UAAU;oBACdkC,SAASxC;oBACTE,OAAOI,YAAYJ,SAASK;oBAC5BJ,WAAWG,YAAYH,aAAaK;8BAEnCH;;;;;AAMb,GACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/form/TextFieldAddon.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { forwardRef } from \"react\";\nimport { bem } from \"../utils/bem.js\";\nimport { type ConfigurableTextFieldAddonProps } from \"./types.js\";\n\nconst styles = bem(\"rmd-text-field-addon\");\n\n/** @remarks \\@since 6.0.0 */\nexport interface TextFieldAddonClassNameOptions {\n className?: string;\n\n /**\n * @defaultValue `false`\n */\n after?: boolean;\n\n /**\n *\n * @defaultValue `true`\n */\n presentational?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function textFieldAddon(\n options: TextFieldAddonClassNameOptions = {}\n): string {\n const { className, after = false, presentational = false } = options;\n\n return cnb(\n styles({\n before: !after,\n after,\n presentational,\n }),\n className\n );\n}\n\n/**\n * @remarks \\@since 6.0.0 Split props into `ConfigurableTextFieldAddonProps`\n */\nexport interface TextFieldAddonProps extends ConfigurableTextFieldAddonProps {\n /**\n * @defaultValue `false`\n */\n after?: boolean;\n\n /**\n * Set this to `true` if the addon should not be wrapped in a `<span>` with some\n * additional styles.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n}\n\n/**\n * **Server Component**\n *\n * This component is used to add an an icon before or after the text field with\n * correct styling.\n */\nexport const TextFieldAddon = forwardRef<HTMLSpanElement, TextFieldAddonProps>(\n function TextFieldAddon(props, ref) {\n const {\n after = false,\n children,\n className,\n disabled = false,\n pointerEvents = false,\n ...remaining\n } = props;\n\n if (!children) {\n return null;\n }\n\n if (disabled) {\n return <>{children}</>;\n }\n\n return (\n <span\n {...remaining}\n ref={ref}\n className={textFieldAddon({\n after,\n presentational: !pointerEvents,\n className,\n })}\n >\n {children}\n </span>\n );\n }\n);\n"],"names":["cnb","forwardRef","bem","styles","textFieldAddon","options","className","after","presentational","before","TextFieldAddon","props","ref","children","disabled","pointerEvents","remaining","span"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAAQ,QAAQ;AACnC,SAASC,GAAG,QAAQ,kBAAkB;AAGtC,MAAMC,SAASD,IAAI;AAkBnB;;CAEC,GACD,OAAO,SAASE,eACdC,UAA0C,CAAC,CAAC;IAE5C,MAAM,EAAEC,SAAS,EAAEC,QAAQ,KAAK,EAAEC,iBAAiB,KAAK,EAAE,GAAGH;IAE7D,OAAOL,IACLG,OAAO;QACLM,QAAQ,CAACF;QACTA;QACAC;IACF,IACAF;AAEJ;AAoBA;;;;;CAKC,GACD,OAAO,MAAMI,+BAAiBT,WAC5B,SAASS,eAAeC,KAAK,EAAEC,GAAG;IAChC,MAAM,EACJL,QAAQ,KAAK,EACbM,QAAQ,EACRP,SAAS,EACTQ,WAAW,KAAK,EAChBC,gBAAgB,KAAK,EACrB,GAAGC,WACJ,GAAGL;IAEJ,IAAI,CAACE,UAAU;QACb,OAAO;IACT;IAEA,IAAIC,UAAU;QACZ,qBAAO;sBAAGD;;IACZ;IAEA,qBACE,KAACI;QACE,GAAGD,SAAS;QACbJ,KAAKA;QACLN,WAAWF,eAAe;YACxBG;YACAC,gBAAgB,CAACO;YACjBT;QACF;kBAECO;;AAGP,GACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/form/TextFieldContainer.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { TextFieldAddon } from \"./TextFieldAddon.js\";\nimport { textFieldContainer } from \"./TextFieldContainerStyles.js\";\nimport { type TextFieldContainerOptions } from \"./types.js\";\n\nexport interface TextFieldContainerProps\n extends HTMLAttributes<HTMLDivElement>,\n TextFieldContainerOptions {\n /**\n * Set this to `true` if there is a floating label with the `TextField` or\n * `TextArea`.\n *\n * @defaultValue `false`\n */\n label?: boolean;\n}\n\n/**\n * **Client Component**\n * This might be able to become a server component if I remove the useFormTheme hook\n *\n * This component is used to add the additional `TextField`, `TextArea`, and\n * `Select` theme styles.\n *\n * @internal\n */\nexport const TextFieldContainer = forwardRef<\n HTMLDivElement,\n TextFieldContainerProps\n>(function TextFieldContainer(props, ref) {\n const {\n children,\n className,\n dense = false,\n error = false,\n label = false,\n active = false,\n inline = false,\n stretch = false,\n readOnly = false,\n disabled = false,\n leftAddon,\n leftAddonProps,\n disableLeftAddonStyles = false,\n rightAddon,\n rightAddonProps,\n disableRightAddonStyles = false,\n theme: propTheme,\n underlineDirection: propUnderlineDirection,\n ...remaining\n } = props;\n const theme = getFormConfig(\"theme\", propTheme);\n const underlineDirection = getFormConfig(\n \"underlineDirection\",\n propUnderlineDirection\n );\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={textFieldContainer({\n theme,\n dense,\n error,\n label,\n inline,\n active,\n stretch,\n readOnly,\n disabled,\n className,\n leftAddon: !!leftAddon && !disableLeftAddonStyles,\n rightAddon: !!rightAddon && !disableRightAddonStyles,\n underlineDirection,\n })}\n >\n <TextFieldAddon {...leftAddonProps} disabled={disableLeftAddonStyles}>\n {leftAddon}\n </TextFieldAddon>\n {children}\n <TextFieldAddon\n {...rightAddonProps}\n disabled={disableRightAddonStyles}\n after\n >\n {rightAddon}\n </TextFieldAddon>\n </div>\n );\n});\n"],"names":["forwardRef","getFormConfig","TextFieldAddon","textFieldContainer","TextFieldContainer","props","ref","children","className","dense","error","label","active","inline","stretch","readOnly","disabled","leftAddon","leftAddonProps","disableLeftAddonStyles","rightAddon","rightAddonProps","disableRightAddonStyles","theme","propTheme","underlineDirection","propUnderlineDirection","remaining","div","after"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAA6B,QAAQ;AACxD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,kBAAkB,QAAQ,gCAAgC;AAenE;;;;;;;;CAQC,GACD,OAAO,MAAMC,mCAAqBJ,WAGhC,SAASI,mBAAmBC,KAAK,EAAEC,GAAG;IACtC,MAAM,EACJC,QAAQ,EACRC,SAAS,EACTC,QAAQ,KAAK,EACbC,QAAQ,KAAK,EACbC,QAAQ,KAAK,EACbC,SAAS,KAAK,EACdC,SAAS,KAAK,EACdC,UAAU,KAAK,EACfC,WAAW,KAAK,EAChBC,WAAW,KAAK,EAChBC,SAAS,EACTC,cAAc,EACdC,yBAAyB,KAAK,EAC9BC,UAAU,EACVC,eAAe,EACfC,0BAA0B,KAAK,EAC/BC,OAAOC,SAAS,EAChBC,oBAAoBC,sBAAsB,EAC1C,GAAGC,WACJ,GAAGtB;IACJ,MAAMkB,QAAQtB,cAAc,SAASuB;IACrC,MAAMC,qBAAqBxB,cACzB,sBACAyB;IAGF,qBACE,MAACE;QACE,GAAGD,SAAS;QACbrB,KAAKA;QACLE,WAAWL,mBAAmB;YAC5BoB;YACAd;YACAC;YACAC;YACAE;YACAD;YACAE;YACAC;YACAC;YACAR;YACAS,WAAW,CAAC,CAACA,aAAa,CAACE;YAC3BC,YAAY,CAAC,CAACA,cAAc,CAACE;YAC7BG;QACF;;0BAEA,KAACvB;gBAAgB,GAAGgB,cAAc;gBAAEF,UAAUG;0BAC3CF;;YAEFV;0BACD,KAACL;gBACE,GAAGmB,eAAe;gBACnBL,UAAUM;gBACVO,KAAK;0BAEJT;;;;AAIT,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/form/TextFieldContainerStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { cssUtils, type TextColor, type ThemeColor } from \"../cssUtils.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { type FormComponentStates, type FormThemeOptions } from \"./types.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-text-field-height\"?: string | number;\n \"--rmd-text-field-padding-left\"?: string | number;\n \"--rmd-text-field-padding-right\"?: string | number;\n \"--rmd-text-field-padding-top\"?: string | number;\n \"--rmd-text-field-border-color\"?: string;\n \"--rmd-text-field-hover-border-color\"?: string;\n \"--rmd-text-field-filled-color\"?: string;\n \"--rmd-form-addon-top\"?: string | number;\n \"--rmd-form-addon-margin-top\"?: string | number;\n }\n}\n\nconst styles = bem(\"rmd-text-field-container\");\n\n/** @remarks \\@since 6.0.0 */\nexport interface TextFieldContainerClassNameOptions\n extends FormThemeOptions,\n FormComponentStates {\n className?: string;\n\n /** @defaultValue `false` */\n dense?: boolean;\n\n /** @defaultValue `false` */\n inline?: boolean;\n\n /** @defaultValue `false` */\n stretch?: boolean;\n\n /** @defaultValue `false` */\n label?: boolean;\n\n /** @defaultValue `false` */\n leftAddon?: boolean;\n\n /** @defaultValue `false` */\n rightAddon?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function textFieldContainer(\n options: TextFieldContainerClassNameOptions = {}\n): string {\n const {\n className,\n theme = \"outline\",\n dense = false,\n error = false,\n label = false,\n active = false,\n inline = false,\n stretch = false,\n readOnly = false,\n disabled = false,\n leftAddon = false,\n rightAddon = false,\n underlineDirection = \"left\",\n } = options;\n const underline = theme === \"underline\";\n const outline = theme === \"outline\";\n const filled = theme === \"filled\";\n const isUnderlined = underline || filled;\n const isOutlineActive = outline && active;\n\n let textColor: ThemeColor | TextColor | undefined;\n if (disabled) {\n textColor = \"text-disabled\";\n } else if (error) {\n textColor = \"error\";\n }\n\n return cnb(\n styles({\n error,\n inline,\n stretch,\n filled,\n outline,\n disabled: disabled || readOnly,\n hoverable: !disabled && !isOutlineActive,\n label: label && !dense,\n dense: !label && dense,\n \"dense-label\": label && dense,\n \"dense-placeholder\": !label && dense && isUnderlined,\n \"outline-active\": isOutlineActive,\n \"outline-error\": outline && error,\n \"outline-left\": outline && leftAddon,\n \"outline-right\": outline && rightAddon,\n underline: isUnderlined,\n \"underline-placeholder\": isUnderlined && !label,\n \"underline-placeholder-only\":\n isUnderlined && !label && !leftAddon && !rightAddon,\n \"underline-labelled\": isUnderlined && label,\n \"underline-active\": isUnderlined && active,\n [`underline-${underlineDirection}`]: isUnderlined,\n \"underline-left-addon\": isUnderlined && leftAddon,\n \"underline-right-addon\": isUnderlined && rightAddon,\n }),\n cssUtils({ textColor }),\n className\n );\n}\n"],"names":["cnb","cssUtils","bem","styles","textFieldContainer","options","className","theme","dense","error","label","active","inline","stretch","readOnly","disabled","leftAddon","rightAddon","underlineDirection","underline","outline","filled","isUnderlined","isOutlineActive","textColor","hoverable"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,QAAQ,QAAyC,iBAAiB;AAC3E,SAASC,GAAG,QAAQ,kBAAkB;AAiBtC,MAAMC,SAASD,IAAI;AA2BnB;;CAEC,GACD,OAAO,SAASE,mBACdC,UAA8C,CAAC,CAAC;IAEhD,MAAM,EACJC,SAAS,EACTC,QAAQ,SAAS,EACjBC,QAAQ,KAAK,EACbC,QAAQ,KAAK,EACbC,QAAQ,KAAK,EACbC,SAAS,KAAK,EACdC,SAAS,KAAK,EACdC,UAAU,KAAK,EACfC,WAAW,KAAK,EAChBC,WAAW,KAAK,EAChBC,YAAY,KAAK,EACjBC,aAAa,KAAK,EAClBC,qBAAqB,MAAM,EAC5B,GAAGb;IACJ,MAAMc,YAAYZ,UAAU;IAC5B,MAAMa,UAAUb,UAAU;IAC1B,MAAMc,SAASd,UAAU;IACzB,MAAMe,eAAeH,aAAaE;IAClC,MAAME,kBAAkBH,WAAWT;IAEnC,IAAIa;IACJ,IAAIT,UAAU;QACZS,YAAY;IACd,OAAO,IAAIf,OAAO;QAChBe,YAAY;IACd;IAEA,OAAOxB,IACLG,OAAO;QACLM;QACAG;QACAC;QACAQ;QACAD;QACAL,UAAUA,YAAYD;QACtBW,WAAW,CAACV,YAAY,CAACQ;QACzBb,OAAOA,SAAS,CAACF;QACjBA,OAAO,CAACE,SAASF;QACjB,eAAeE,SAASF;QACxB,qBAAqB,CAACE,SAASF,SAASc;QACxC,kBAAkBC;QAClB,iBAAiBH,WAAWX;QAC5B,gBAAgBW,WAAWJ;QAC3B,iBAAiBI,WAAWH;QAC5BE,WAAWG;QACX,yBAAyBA,gBAAgB,CAACZ;QAC1C,8BACEY,gBAAgB,CAACZ,SAAS,CAACM,aAAa,CAACC;QAC3C,sBAAsBK,gBAAgBZ;QACtC,oBAAoBY,gBAAgBX;QACpC,CAAC,CAAC,UAAU,EAAEO,mBAAmB,CAAC,CAAC,EAAEI;QACrC,wBAAwBA,gBAAgBN;QACxC,yBAAyBM,gBAAgBL;IAC3C,IACAhB,SAAS;QAAEuB;IAAU,IACrBlB;AAEJ"}
|
|
@@ -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":";;;;;;;;;;;;;AAAA,SAASA,MAAM,QAAQ,SAAS;AA4DhC;;;;;;CAMC,GACD,OAAO,MAAMC,wBAAwBC;IAMnC;;;GAGC,GACDC,YAAYC,OAAgB,CAAE;QAC5B,KAAK,CAACA;QAVR;;GAEC,GACD,uBAAOC,OAAP,KAAA;QAQE,IAAI,CAACA,GAAG,GAAGL;QACX,IAAI,CAACM,IAAI,GAAG;IACd;AACF;AAEA;;;;CAIC,GACD,OAAO,MAAMC,yBAAyBL;IAMpC;;;;GAIC,GACDC,YACE,AAAOK,KAAsB,EAC7B,AAAOC,MAAe,CACtB;QACA,KAAK,CAAC;;;QAdR;;GAEC,GACD,uBAAOJ,OAAP,KAAA;aAQSG,QAAAA;aACAC,SAAAA;QAGP,IAAI,CAACJ,GAAG,GAAGL;QACX,IAAI,CAACM,IAAI,GAAG;IACd;AACF;AAEA;;;;;CAKC,GACD,OAAO,MAAMI,0BAA0BH;IACrC;;;;;GAKC,GACDJ,YACEK,KAAsB,EACtB,AAAOG,KAAa,CACpB;QACA,KAAK,CAACH,OAAO;;aAFNG,QAAAA;QAGP,IAAI,CAACL,IAAI,GAAG;IACd;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMM,sBAAsBL;IACjC;;;;;GAKC,GACDJ,YACEK,KAAsB,EACtB,AAAOK,IAA6B,EACpC,AAAOF,KAAa,CACpB;QACA,KAAK,CAACH,OAAO;;;aAHNK,OAAAA;aACAF,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AACC;QACb,IAAIA,KAAKC,MAAM,KAAK,WAAW;YAC7B7B,QAAQgB,IAAI,CAACY;QACf,OAAO,IAAIA,KAAKC,MAAM,KAAK,aAAa;YACtCJ,UAAUT,IAAI,CAACY;QACjB,OAAO,IAAIA,KAAKC,MAAM,KAAK,YAAY;YACrCH,SAASV,IAAI,CAACY;QAChB,OAAO;YACL,wBAAwB,GACxB,MAAM,IAAI5D,MAAM;QAClB;IACF;IAEA,OAAO;QAAEgC;QAASyB;QAAWC;IAAS;AACxC"}
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE;YACzB,OAAO;QACT;QAEA,OAAOH,qBAAqBC,SAASC,KAAK,CAACD,QAAQ;IACrD;IAEA,MAAMG,YAAYN,SAASO,OAAO,CAACJ;IACnC,KAAK,MAAMK,SAASF,UAAW;QAC7B,IAAI,OAAOE,UAAU,YAAY,OAAOA,UAAU,UAAU;YAC1D,OAAO,CAAC,EAAEA,MAAM,CAAC,CAAC,EAAE,CAACC,WAAW;QAClC;QAEA,IACER,eAA0DO,UAC1D,CAACA,MAAMJ,KAAK,CAACC,MAAM,EACnB;YACA,OAAOH,qBAAqBM,MAAMJ,KAAK,CAACD,QAAQ;QAClD;IACF;IAEA,OAAO;AACT;AAaA;;;CAGC,GACD,OAAO,SAASO,2BACdP,QAAmB,EACnBQ,YAA+B;IAE/B,IAAIC;IACJ,IAAIC,eAAe,CAAC;IAEpB,MAAMC,UAAiC,EAAE;IACzC,MAAMC,eAAyB,EAAE;IACjCf,SAASgB,OAAO,CAACb,UAAU,CAACK;QAC1B,IAAI,CAACP,eAAoCO,QAAQ;YAC/C;QACF;QAEA,MAAM,EAAES,KAAK,EAAEC,QAAQ,EAAEf,QAAQ,EAAE,GAAGK,MAAMJ,KAAK;QACjD,IAAI,OAAOa,UAAU,aAAa;YAChC,IACEA,UAAUN,gBACT,CAACC,iBAAiB,OAAOD,iBAAiB,aAC3C;gBACAC,gBAAgBJ,MAAMJ,KAAK;gBAC3BS,eAAeC,QAAQK,MAAM;YAC/B;YAEA,IAAI,CAACD,UAAU;gBACbJ,QAAQM,IAAI,CAACZ,MAAMJ,KAAK;gBACxBW,aAAaK,IAAI,CAAClB,qBAAqBC;YACzC;QACF,OAAO,IAAIA,UAAU;YACnB,MAAMkB,SAASX,2BAA2BP,UAAUQ;YACpD,IAAI,CAACC,eAAe;gBACjB,CAAA,EAAEA,aAAa,EAAE,GAAGS,MAAK;YAC5B;YAEA,IAAIA,OAAOR,YAAY,KAAK,CAAC,GAAG;gBAC9BA,eAAeC,QAAQK,MAAM,GAAGE,OAAOR,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;A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AO;gBACLT,mBAAmBS;YACrB;QACF;QACAF,aAAYE,KAAK;YACf,IAAID,kBAAkBC,QAAQ;gBAC5Bd,kBAAkBc;YACpB,OAAO;gBACLR,kBAAkBQ;YACpB;QACF;IACF;AACF,EAAE;AAEF;;;CAGC,GACD,OAAO,SAASa,eACdC,MAA0B,EAC1BC,QAAgB;IAEhB,IAAI,OAAOD,WAAW,UAAU;QAC9B;IACF;IAEA,4EAA4E;IAC5E,wEAAwE;IACxE,gBAAgB;IAChB,MAAMvC,QAAQC,OAAOwC,KAAK,CAACF,UAAUC,WAAWD;IAChD,OAAO,CAAC,EAAEvC,QAAQ,IAAI,CAAC,CAAC;AAC1B;AA2BA;;;CAGC,GACD,OAAO,MAAM0C,kBAAkB,CAAChD;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"}
|
package/dist/form/types.js.map
DELETED
|
@@ -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,oBAAoB,QAUhC,iBAAiB;AAExB,MAAMC,OAAO;AACX,aAAa;AACf;AAsKA,cAAc,GACd,MAAMC,aAAa,EAAE;AACrB,cAAc,GACd,MAAMC,eAAe,CAAC;AAEtB;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASC,cAA0D,EACxEC,WAAW,CAAC,CAAC,EACbC,aAAaJ,UAAU,EACvBK,cAAc,CAAC,CAAC,EAChBC,cAAc,CAAC,CAAC,EAChBC,gBAAgB,CAAC,CAAC,EAClBC,cAAc,CAAC,CAAC,EAChBC,QAAQC,aAAaX,IAAI,EACzBY,UAAUC,eAAeb,IAAI,EAC7BF,gBAAgBC,oBAAoB,EACpCL,gBAAgBC,oBAAoB,EACpCC,kBAAkBC,sBAAsB,EACN,GAAG,CAAC,CAAC;IAGvC,MAAM,CAACiB,OAAOC,SAAS,GAAGvB,WACxB,SAASwB,QACPF,KAAuC,EACvCG,MAA2B;QAE3B,OAAQA,OAAOC,IAAI;YACjB,KAAK;gBACH,iEAAiE;gBACjE,6BAA6B;gBAC7B,O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gBAC9Bf,SAASvC,KAAKO,OAAOE,MAAM;YAC7B;YAEA6B,MAAMtC,KAAKO;YACX,MAAMgD,SAASnF,cAAcgC;YAC7B,wBAAwB,GACxB,IACEoD,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBACzB,CAAC;gBACC;gBACA;gBACA;gBACA;aACD,CAACxD,QAAQ,CAACqD,SACX;gBACA,MAAM,IAAI5B,MAAM;YAClB;YAEApB,MAAM,CAACgD,OAAO,CAACnD;QACjB;IACF,GAAG;QACDjB;QACAU;QACAzB;QACAoE;QACAF;QACAC;KACD;IAED,IAAIoB,SAAS;IACb,IAAI5E,WAAWgC,MAAM,EAAE;QACrB4C,SAAS5E,WAAWoB,MAAM,CAAC,CAACyD,GAAGC,MAAQ,CAAC,EAAED,IAAI,CAAC,EAAEA,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,EAAEC,IAAI,CAAC,EAAE;IACvE;IAEA,OAAO;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,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ACzB;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,GAAGd,SAAS;IAC7CF,UAAU;QACR,IAAIS,WAAW,QAAQ;YACrBK,UAAUG;QACZ;IACF,GAAG;QAACR;KAAO;IAEX,MAAMS,eAAenB,YAAY;QAC/B,MAAMoB,OAAOP,QAAQQ,OAAO;QAC5B,MAAMC,YAAYV,aAAaS,OAAO;QACtC,IAAI,CAACD,QAAQ,CAACE,WAAW;YACvB;QACF;QAEA,MAAMC,kBAAkBC,OAAOC,gBAAgB,CAACH;QAChD,MAAMI,eACJC,WAAWJ,gBAAgBK,cAAc,IACzCD,WAAWJ,gBAAgBM,iBAAiB;QAC9C,IAAIC,aAAaV,KAAKW,YAAY,GAAGL;QACrC,sBAAsB,GACtB,IAAIjB,UAAU,GAAG;YACf,MAAMuB,aAAaL,WACjBH,OAAOC,gBAAgB,CAACL,MAAMY,UAAU,IAAI3B;YAE9C,MAAM4B,YAAYxB,UAAUuB;YAC5BF,aAAaI,KAAKC,GAAG,CAACF,WAAWH;YAEjC,yEAAyE;YACzE,0EAA0E;YAC1E,IAAIA,eAAeG,aAAa,CAACjB,YAAY;gBAC3CC,cAAc;YAChB,OAAO,IAAIa,eAAeG,aAAajB,YAAY;gBACjDC,cAAc;YAChB;QACF;QAEAF,UAAUe,aAAa;IACzB,GAAG;QAAClB;QAAcH;QAASO;KAAW;IAEtC,MAAMoB,kBAAkBhC,kBAAkB;QACxCiC,KAAKxB;QACLyB,UAAUnB;QACVoB,eAAe;IACjB;IAEA,OAAO;QACLzB,QAAQ,OAAOA,WAAW,WAAW,CAAC,EAAEA,OAAO,EAAE,CAAC,GAAGI;QACrDL,SAASuB;QACTpB;QACAL,UAAS6B,KAAK;YACZ,MAAMpB,OAAOP,QAAQQ,OAAO;YAC5BV,SAAS6B;YACT,IAAIA,MAAMC,oBAAoB,MAAM,CAACrB,QAAQV,WAAW,QAAQ;gBAC9D;YACF;YAEA,uEAAuE;YACvE,uEAAuE;YACvE,wBAAwB;YACxB,yEAAyE;YACzE,aAAa;YACb,2EAA2E;YAC3E,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"}
|