@vjdesigns/vjdesigns-ui 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +45 -1
- package/dist/ai/llms-full.txt +133 -76
- package/dist/ai/registry.json +82 -61
- package/dist/components/data-display/Accordion/Accordion.cjs.js +1 -1
- package/dist/components/data-display/Accordion/Accordion.mjs +22 -22
- package/dist/components/data-display/Accordion/Accordion.module.css.mjs +1 -2
- package/dist/components/data-display/Avatar/Avatar.cjs.js +1 -1
- package/dist/components/data-display/Avatar/Avatar.mjs +92 -92
- package/dist/components/data-display/Avatar/Avatar.module.css.mjs +1 -2
- package/dist/components/data-display/Badge/Badge.cjs.js +1 -1
- package/dist/components/data-display/Badge/Badge.mjs +2 -2
- package/dist/components/data-display/Badge/Badge.module.css.mjs +1 -2
- package/dist/components/data-display/Card/Card.cjs.js +1 -1
- package/dist/components/data-display/Card/Card.mjs +2 -2
- package/dist/components/data-display/Card/Card.module.css.mjs +1 -2
- package/dist/components/data-display/Carousel/Carousel.cjs.js +1 -1
- package/dist/components/data-display/Carousel/Carousel.mjs +42 -42
- package/dist/components/data-display/Carousel/Carousel.module.css.mjs +1 -2
- package/dist/components/data-display/Chat/Chat.cjs.js +1 -1
- package/dist/components/data-display/Chat/Chat.mjs +114 -118
- package/dist/components/data-display/Chat/Chat.module.css.mjs +1 -2
- package/dist/components/data-display/Chat/streams.mjs +1 -2
- package/dist/components/data-display/Chip/Chip.cjs.js +1 -1
- package/dist/components/data-display/Chip/Chip.mjs +50 -54
- package/dist/components/data-display/Chip/Chip.module.css.mjs +1 -2
- package/dist/components/data-display/CodeBlock/CodeBlock.cjs.js +4 -4
- package/dist/components/data-display/CodeBlock/CodeBlock.mjs +113 -113
- package/dist/components/data-display/CodeBlock/CodeBlock.module.css.mjs +1 -2
- package/dist/components/data-display/CodeBlock/tokenize.mjs +1 -2
- package/dist/components/data-display/DataGrid/DataGrid.cjs.js +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.d.ts +14 -3
- package/dist/components/data-display/DataGrid/DataGrid.mjs +352 -267
- package/dist/components/data-display/DataGrid/DataGrid.module.css.cjs.js +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.module.css.mjs +6 -5
- package/dist/components/data-display/DataGrid/dataGridUtils.cjs.js +1 -1
- package/dist/components/data-display/DataGrid/dataGridUtils.d.ts +18 -0
- package/dist/components/data-display/DataGrid/dataGridUtils.mjs +100 -32
- package/dist/components/data-display/EmptyState/EmptyState.cjs.js +1 -1
- package/dist/components/data-display/EmptyState/EmptyState.mjs +53 -53
- package/dist/components/data-display/EmptyState/EmptyState.module.css.mjs +1 -2
- package/dist/components/data-display/Image/Image.cjs.js +1 -1
- package/dist/components/data-display/Image/Image.mjs +6 -6
- package/dist/components/data-display/Image/Image.module.css.mjs +1 -2
- package/dist/components/data-display/List/List.cjs.js +1 -1
- package/dist/components/data-display/List/List.mjs +68 -68
- package/dist/components/data-display/List/List.module.css.mjs +1 -2
- package/dist/components/data-display/Stat/Stat.cjs.js +1 -1
- package/dist/components/data-display/Stat/Stat.mjs +112 -112
- package/dist/components/data-display/Stat/Stat.module.css.mjs +1 -2
- package/dist/components/data-display/Table/Table.cjs.js +1 -1
- package/dist/components/data-display/Table/Table.mjs +187 -183
- package/dist/components/data-display/Table/Table.module.css.mjs +1 -2
- package/dist/components/data-display/Table/useTable.cjs.js +1 -1
- package/dist/components/data-display/Table/useTable.mjs +2 -2
- package/dist/components/data-display/Timeline/Timeline.cjs.js +1 -1
- package/dist/components/data-display/Timeline/Timeline.mjs +64 -64
- package/dist/components/data-display/Timeline/Timeline.module.css.mjs +1 -2
- package/dist/components/data-display/TreeView/TreeView.cjs.js +1 -1
- package/dist/components/data-display/TreeView/TreeView.mjs +107 -119
- package/dist/components/data-display/TreeView/TreeView.module.css.mjs +1 -2
- package/dist/components/data-display/TreeView/treeUtils.mjs +1 -2
- package/dist/components/data-display/VirtualList/VirtualList.cjs.js +1 -1
- package/dist/components/data-display/VirtualList/VirtualList.mjs +2 -2
- package/dist/components/data-display/VirtualList/VirtualList.module.css.mjs +1 -2
- package/dist/components/feedback/Alert/Alert.cjs.js +1 -1
- package/dist/components/feedback/Alert/Alert.mjs +56 -56
- package/dist/components/feedback/Alert/Alert.module.css.mjs +1 -2
- package/dist/components/feedback/Banner/Banner.cjs.js +1 -1
- package/dist/components/feedback/Banner/Banner.mjs +48 -48
- package/dist/components/feedback/Banner/Banner.module.css.mjs +1 -2
- package/dist/components/feedback/ErrorSummary/ErrorSummary.cjs.js +1 -1
- package/dist/components/feedback/ErrorSummary/ErrorSummary.mjs +10 -10
- package/dist/components/feedback/ErrorSummary/ErrorSummary.module.css.mjs +1 -2
- package/dist/components/feedback/Progress/Progress.cjs.js +1 -1
- package/dist/components/feedback/Progress/Progress.mjs +2 -2
- package/dist/components/feedback/Progress/Progress.module.css.mjs +1 -2
- package/dist/components/feedback/Skeleton/Skeleton.cjs.js +1 -1
- package/dist/components/feedback/Skeleton/Skeleton.mjs +73 -73
- package/dist/components/feedback/Skeleton/Skeleton.module.css.mjs +1 -2
- package/dist/components/feedback/Spinner/Spinner.cjs.js +1 -1
- package/dist/components/feedback/Spinner/Spinner.mjs +29 -29
- package/dist/components/feedback/Spinner/Spinner.module.css.mjs +1 -2
- package/dist/components/feedback/Toast/Toast.cjs.js +1 -1
- package/dist/components/feedback/Toast/Toast.mjs +42 -42
- package/dist/components/feedback/Toast/Toast.module.css.mjs +1 -2
- package/dist/components/feedback/Toast/ToastItem.cjs.js +1 -1
- package/dist/components/feedback/Toast/ToastItem.mjs +10 -10
- package/dist/components/feedback/Toast/ToastProvider.cjs.js +1 -1
- package/dist/components/feedback/Toast/ToastProvider.mjs +11 -11
- package/dist/components/feedback/Toast/ToastViewport.cjs.js +1 -1
- package/dist/components/feedback/Toast/ToastViewport.mjs +30 -30
- package/dist/components/feedback/Toast/toastStore.mjs +1 -2
- package/dist/components/feedback/Toast/toastTiming.cjs.js +1 -1
- package/dist/components/feedback/Toast/toastTiming.mjs +2 -2
- package/dist/components/feedback/Toast/useToast.cjs.js +1 -1
- package/dist/components/feedback/Toast/useToast.mjs +2 -2
- package/dist/components/feedback/Toast/useToastAnnouncer.cjs.js +1 -1
- package/dist/components/feedback/Toast/useToastAnnouncer.mjs +2 -2
- package/dist/components/forms/CheckBox/CheckBox.cjs.js +1 -1
- package/dist/components/forms/CheckBox/CheckBox.mjs +2 -2
- package/dist/components/forms/CheckBox/CheckBox.module.css.mjs +1 -2
- package/dist/components/forms/ColorPicker/ColorInput.cjs.js +1 -1
- package/dist/components/forms/ColorPicker/ColorInput.mjs +43 -43
- package/dist/components/forms/ColorPicker/ColorPicker.cjs.js +1 -1
- package/dist/components/forms/ColorPicker/ColorPicker.mjs +153 -153
- package/dist/components/forms/ColorPicker/ColorPicker.module.css.mjs +1 -2
- package/dist/components/forms/ColorPicker/colorUtils.mjs +1 -2
- package/dist/components/forms/Combobox/Combobox.cjs.js +1 -1
- package/dist/components/forms/Combobox/Combobox.mjs +200 -213
- package/dist/components/forms/Combobox/Combobox.module.css.mjs +1 -2
- package/dist/components/forms/Combobox/ComboboxPopup.cjs.js +1 -1
- package/dist/components/forms/Combobox/ComboboxPopup.mjs +164 -121
- package/dist/components/forms/Combobox/comboboxUtils.cjs.js +1 -1
- package/dist/components/forms/Combobox/comboboxUtils.d.ts +4 -1
- package/dist/components/forms/Combobox/comboboxUtils.mjs +21 -20
- package/dist/components/forms/DatePicker/Calendar.cjs.js +1 -1
- package/dist/components/forms/DatePicker/Calendar.mjs +60 -66
- package/dist/components/forms/DatePicker/Calendar.module.css.mjs +1 -2
- package/dist/components/forms/DatePicker/DatePicker.cjs.js +1 -1
- package/dist/components/forms/DatePicker/DatePicker.mjs +72 -74
- package/dist/components/forms/DatePicker/DatePicker.module.css.mjs +1 -2
- package/dist/components/forms/DatePicker/DateRangePicker.cjs.js +1 -1
- package/dist/components/forms/DatePicker/DateRangePicker.mjs +117 -117
- package/dist/components/forms/DatePicker/DateRangePicker.module.css.mjs +1 -2
- package/dist/components/forms/DatePicker/dateUtils.mjs +1 -2
- package/dist/components/forms/DateTimePicker/DateTimePicker.cjs.js +1 -1
- package/dist/components/forms/DateTimePicker/DateTimePicker.mjs +19 -19
- package/dist/components/forms/DateTimePicker/DateTimePicker.module.css.mjs +1 -2
- package/dist/components/forms/Field/Field.cjs.js +1 -1
- package/dist/components/forms/Field/Field.mjs +14 -14
- package/dist/components/forms/Field/Field.module.css.mjs +1 -2
- package/dist/components/forms/Field/FieldContext.cjs.js +1 -1
- package/dist/components/forms/Field/FieldContext.mjs +2 -2
- package/dist/components/forms/FileUpload/FileUpload.cjs.js +1 -1
- package/dist/components/forms/FileUpload/FileUpload.mjs +250 -255
- package/dist/components/forms/FileUpload/FileUpload.module.css.mjs +1 -2
- package/dist/components/forms/Input/Input.cjs.js +1 -1
- package/dist/components/forms/Input/Input.mjs +35 -35
- package/dist/components/forms/Input/Input.module.css.mjs +1 -2
- package/dist/components/forms/NumberInput/NumberInput.cjs.js +1 -1
- package/dist/components/forms/NumberInput/NumberInput.mjs +137 -142
- package/dist/components/forms/NumberInput/NumberInput.module.css.mjs +1 -2
- package/dist/components/forms/PasswordInput/PasswordInput.cjs.js +1 -1
- package/dist/components/forms/PasswordInput/PasswordInput.mjs +142 -142
- package/dist/components/forms/PasswordInput/PasswordInput.module.css.mjs +1 -2
- package/dist/components/forms/PinInput/PinInput.cjs.js +1 -1
- package/dist/components/forms/PinInput/PinInput.mjs +12 -12
- package/dist/components/forms/PinInput/PinInput.module.css.mjs +1 -2
- package/dist/components/forms/Radio/Radio.cjs.js +1 -1
- package/dist/components/forms/Radio/Radio.mjs +2 -2
- package/dist/components/forms/Radio/Radio.module.css.mjs +1 -2
- package/dist/components/forms/Rating/Rating.cjs.js +1 -1
- package/dist/components/forms/Rating/Rating.mjs +110 -109
- package/dist/components/forms/Rating/Rating.module.css.mjs +1 -2
- package/dist/components/forms/SearchInput/SearchInput.cjs.js +1 -1
- package/dist/components/forms/SearchInput/SearchInput.mjs +118 -126
- package/dist/components/forms/SearchInput/SearchInput.module.css.mjs +1 -2
- package/dist/components/forms/SegmentedControl/SegmentedControl.cjs.js +1 -1
- package/dist/components/forms/SegmentedControl/SegmentedControl.mjs +46 -43
- package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.mjs +1 -2
- package/dist/components/forms/Select/Select.cjs.js +1 -1
- package/dist/components/forms/Select/Select.mjs +2 -2
- package/dist/components/forms/Select/Select.module.css.mjs +1 -2
- package/dist/components/forms/Slider/Slider.cjs.js +1 -1
- package/dist/components/forms/Slider/Slider.mjs +2 -2
- package/dist/components/forms/Slider/Slider.module.css.mjs +1 -2
- package/dist/components/forms/Switch/Switch.cjs.js +1 -1
- package/dist/components/forms/Switch/Switch.mjs +39 -39
- package/dist/components/forms/Switch/Switch.module.css.mjs +1 -2
- package/dist/components/forms/TagInput/TagInput.cjs.js +1 -1
- package/dist/components/forms/TagInput/TagInput.mjs +197 -203
- package/dist/components/forms/TagInput/TagInput.module.css.mjs +1 -2
- package/dist/components/forms/Textarea/Textarea.cjs.js +1 -1
- package/dist/components/forms/Textarea/Textarea.mjs +59 -59
- package/dist/components/forms/Textarea/Textarea.module.css.mjs +1 -2
- package/dist/components/forms/TimePicker/TimePicker.cjs.js +1 -1
- package/dist/components/forms/TimePicker/TimePicker.mjs +14 -16
- package/dist/components/forms/TimePicker/TimePicker.module.css.mjs +1 -2
- package/dist/components/forms/TimePicker/timeUtils.cjs.js +1 -1
- package/dist/components/forms/TimePicker/timeUtils.d.ts +4 -1
- package/dist/components/forms/TimePicker/timeUtils.mjs +43 -38
- package/dist/components/forms/ToggleGroup/ToggleGroup.cjs.js +1 -1
- package/dist/components/forms/ToggleGroup/ToggleGroup.mjs +10 -10
- package/dist/components/forms/ToggleGroup/ToggleGroup.module.css.mjs +1 -2
- package/dist/components/layout/Box/Box.mjs +1 -2
- package/dist/components/layout/Box/Box.module.css.mjs +1 -2
- package/dist/components/layout/Container/Container.mjs +1 -2
- package/dist/components/layout/Container/Container.module.css.mjs +1 -2
- package/dist/components/layout/Divider/Divider.mjs +1 -2
- package/dist/components/layout/Divider/Divider.module.css.mjs +1 -2
- package/dist/components/layout/Flex/Flex.cjs.js +1 -1
- package/dist/components/layout/Flex/Flex.mjs +12 -13
- package/dist/components/layout/Flex/Flex.module.css.mjs +1 -2
- package/dist/components/layout/Grid/Grid.cjs.js +1 -1
- package/dist/components/layout/Grid/Grid.mjs +20 -21
- package/dist/components/layout/Grid/Grid.module.css.mjs +1 -2
- package/dist/components/layout/ResizablePanels/ResizablePanels.cjs.js +1 -1
- package/dist/components/layout/ResizablePanels/ResizablePanels.mjs +17 -17
- package/dist/components/layout/ResizablePanels/ResizablePanels.module.css.mjs +1 -2
- package/dist/components/layout/ScrollArea/ScrollArea.cjs.js +1 -1
- package/dist/components/layout/ScrollArea/ScrollArea.mjs +2 -2
- package/dist/components/layout/ScrollArea/ScrollArea.module.css.mjs +1 -2
- package/dist/components/layout/Stack/Stack.cjs.js +1 -1
- package/dist/components/layout/Stack/Stack.mjs +8 -9
- package/dist/components/layout/Stack/Stack.module.css.mjs +1 -2
- package/dist/components/navigation/Breadcrumbs/Breadcrumbs.cjs.js +1 -1
- package/dist/components/navigation/Breadcrumbs/Breadcrumbs.mjs +41 -41
- package/dist/components/navigation/Breadcrumbs/Breadcrumbs.module.css.mjs +1 -2
- package/dist/components/navigation/ContextMenu/ContextMenu.cjs.js +1 -1
- package/dist/components/navigation/ContextMenu/ContextMenu.mjs +48 -48
- package/dist/components/navigation/ContextMenu/ContextMenu.module.css.mjs +1 -2
- package/dist/components/navigation/Link/Link.cjs.js +1 -1
- package/dist/components/navigation/Link/Link.mjs +6 -7
- package/dist/components/navigation/Link/Link.module.css.mjs +1 -2
- package/dist/components/navigation/Menu/Menu.cjs.js +1 -1
- package/dist/components/navigation/Menu/Menu.mjs +11 -11
- package/dist/components/navigation/Menu/Menu.module.css.mjs +1 -2
- package/dist/components/navigation/Menu/MenuContent.cjs.js +1 -1
- package/dist/components/navigation/Menu/MenuContent.mjs +46 -46
- package/dist/components/navigation/Menu/MenuContext.cjs.js +1 -1
- package/dist/components/navigation/Menu/MenuContext.mjs +2 -2
- package/dist/components/navigation/Menu/MenuItem.cjs.js +1 -1
- package/dist/components/navigation/Menu/MenuItem.mjs +35 -39
- package/dist/components/navigation/Menu/MenuSub.cjs.js +1 -1
- package/dist/components/navigation/Menu/MenuSub.mjs +16 -20
- package/dist/components/navigation/Menu/useMenuRoot.cjs.js +1 -1
- package/dist/components/navigation/Menu/useMenuRoot.mjs +2 -2
- package/dist/components/navigation/Navbar/Navbar.cjs.js +1 -1
- package/dist/components/navigation/Navbar/Navbar.mjs +111 -111
- package/dist/components/navigation/Navbar/Navbar.module.css.mjs +1 -2
- package/dist/components/navigation/Pagination/Pagination.cjs.js +1 -1
- package/dist/components/navigation/Pagination/Pagination.mjs +31 -35
- package/dist/components/navigation/Pagination/Pagination.module.css.mjs +1 -2
- package/dist/components/navigation/Sidebar/Sidebar.cjs.js +1 -1
- package/dist/components/navigation/Sidebar/Sidebar.mjs +52 -52
- package/dist/components/navigation/Sidebar/Sidebar.module.css.mjs +1 -2
- package/dist/components/navigation/Sidebar/SidebarContext.cjs.js +1 -1
- package/dist/components/navigation/Sidebar/SidebarContext.mjs +2 -2
- package/dist/components/navigation/Sidebar/SidebarParts.cjs.js +1 -1
- package/dist/components/navigation/Sidebar/SidebarParts.mjs +76 -80
- package/dist/components/navigation/SkipLink/SkipLink.cjs.js +1 -1
- package/dist/components/navigation/SkipLink/SkipLink.mjs +12 -12
- package/dist/components/navigation/SkipLink/SkipLink.module.css.mjs +1 -2
- package/dist/components/navigation/Stepper/Stepper.cjs.js +1 -1
- package/dist/components/navigation/Stepper/Stepper.mjs +46 -46
- package/dist/components/navigation/Stepper/Stepper.module.css.mjs +1 -2
- package/dist/components/navigation/Tabs/Tabs.cjs.js +1 -1
- package/dist/components/navigation/Tabs/Tabs.mjs +2 -2
- package/dist/components/navigation/Tabs/Tabs.module.css.mjs +1 -2
- package/dist/components/overlays/CommandPalette/CommandPalette.cjs.js +1 -1
- package/dist/components/overlays/CommandPalette/CommandPalette.mjs +206 -206
- package/dist/components/overlays/CommandPalette/CommandPalette.module.css.mjs +1 -2
- package/dist/components/overlays/CommandPalette/CommandPaletteContext.cjs.js +1 -1
- package/dist/components/overlays/CommandPalette/CommandPaletteContext.mjs +2 -2
- package/dist/components/overlays/CommandPalette/CommandPaletteParts.cjs.js +1 -1
- package/dist/components/overlays/CommandPalette/CommandPaletteParts.mjs +104 -104
- package/dist/components/overlays/CommandPalette/commandPaletteUtils.cjs.js +1 -1
- package/dist/components/overlays/CommandPalette/commandPaletteUtils.mjs +62 -60
- package/dist/components/overlays/Drawer/Drawer.cjs.js +1 -1
- package/dist/components/overlays/Drawer/Drawer.mjs +31 -31
- package/dist/components/overlays/Drawer/Drawer.module.css.mjs +1 -2
- package/dist/components/overlays/Drawer/DrawerContent.cjs.js +1 -1
- package/dist/components/overlays/Drawer/DrawerContent.mjs +99 -99
- package/dist/components/overlays/Drawer/DrawerContext.cjs.js +1 -1
- package/dist/components/overlays/Drawer/DrawerContext.mjs +2 -2
- package/dist/components/overlays/Drawer/DrawerParts.cjs.js +1 -1
- package/dist/components/overlays/Drawer/DrawerParts.mjs +18 -18
- package/dist/components/overlays/Drawer/internal.mjs +1 -2
- package/dist/components/overlays/Drawer/useDragToClose.cjs.js +1 -1
- package/dist/components/overlays/Drawer/useDragToClose.mjs +2 -2
- package/dist/components/overlays/HoverCard/HoverCard.cjs.js +1 -1
- package/dist/components/overlays/HoverCard/HoverCard.mjs +31 -31
- package/dist/components/overlays/HoverCard/HoverCard.module.css.mjs +1 -2
- package/dist/components/overlays/Modal/ConfirmModal.cjs.js +1 -1
- package/dist/components/overlays/Modal/ConfirmModal.mjs +21 -23
- package/dist/components/overlays/Modal/Modal.cjs.js +1 -1
- package/dist/components/overlays/Modal/Modal.mjs +47 -47
- package/dist/components/overlays/Modal/Modal.module.css.mjs +1 -2
- package/dist/components/overlays/Modal/ModalContent.cjs.js +1 -1
- package/dist/components/overlays/Modal/ModalContent.mjs +24 -24
- package/dist/components/overlays/Modal/ModalContext.cjs.js +1 -1
- package/dist/components/overlays/Modal/ModalContext.mjs +2 -2
- package/dist/components/overlays/Modal/useScrollRegion.cjs.js +1 -1
- package/dist/components/overlays/Modal/useScrollRegion.mjs +2 -2
- package/dist/components/overlays/Popover/Popover.cjs.js +1 -1
- package/dist/components/overlays/Popover/Popover.mjs +40 -40
- package/dist/components/overlays/Popover/Popover.module.css.mjs +1 -2
- package/dist/components/overlays/Popover/PopoverContent.cjs.js +1 -1
- package/dist/components/overlays/Popover/PopoverContent.mjs +39 -39
- package/dist/components/overlays/Popover/PopoverContext.cjs.js +1 -1
- package/dist/components/overlays/Popover/PopoverContext.mjs +2 -2
- package/dist/components/overlays/Tooltip/Tooltip.cjs.js +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.mjs +100 -95
- package/dist/components/overlays/Tooltip/Tooltip.module.css.mjs +1 -2
- package/dist/components/primitives/Button/Button.cjs.js +1 -1
- package/dist/components/primitives/Button/Button.mjs +59 -63
- package/dist/components/primitives/Button/Button.module.css.mjs +1 -2
- package/dist/components/primitives/Icon/Icon.cjs.js +1 -1
- package/dist/components/primitives/Icon/Icon.mjs +5 -6
- package/dist/components/primitives/Icon/Icon.module.css.mjs +1 -2
- package/dist/components/primitives/Icon/IconSvg.mjs +1 -2
- package/dist/components/primitives/Icon/icons.mjs +1 -2
- package/dist/components/primitives/Kbd/Kbd.cjs.js +1 -1
- package/dist/components/primitives/Kbd/Kbd.mjs +30 -30
- package/dist/components/primitives/Kbd/Kbd.module.css.mjs +1 -2
- package/dist/components/primitives/Typography/Typography.mjs +1 -2
- package/dist/components/primitives/Typography/Typography.module.css.mjs +1 -2
- package/dist/components/utilities/LocaleProvider/LocaleProvider.cjs.js +1 -1
- package/dist/components/utilities/LocaleProvider/LocaleProvider.mjs +11 -11
- package/dist/components/utilities/LocaleProvider/LocaleProvider.module.css.mjs +1 -2
- package/dist/components/utilities/Portal/Portal.cjs.js +1 -1
- package/dist/components/utilities/Portal/Portal.mjs +2 -2
- package/dist/components/utilities/Theme/Theme.cjs.js +1 -1
- package/dist/components/utilities/Theme/Theme.mjs +13 -13
- package/dist/components/utilities/Theme/Theme.module.css.mjs +1 -2
- package/dist/components/utilities/VisuallyHidden/VisuallyHidden.mjs +1 -2
- package/dist/components/utilities/VisuallyHidden/VisuallyHidden.module.css.mjs +1 -2
- package/dist/hooks/elementSource.cjs.js +1 -1
- package/dist/hooks/elementSource.mjs +4 -3
- package/dist/hooks/useClipboard.cjs.js +1 -1
- package/dist/hooks/useClipboard.mjs +2 -2
- package/dist/hooks/useControllableState.cjs.js +1 -1
- package/dist/hooks/useControllableState.mjs +2 -2
- package/dist/hooks/useDisclosure.cjs.js +1 -1
- package/dist/hooks/useDisclosure.mjs +2 -2
- package/dist/hooks/useDismiss.cjs.js +1 -1
- package/dist/hooks/useDismiss.mjs +2 -2
- package/dist/hooks/useElementObservers.cjs.js +1 -1
- package/dist/hooks/useElementObservers.mjs +2 -2
- package/dist/hooks/useEnvironment.cjs.js +1 -1
- package/dist/hooks/useEnvironment.mjs +2 -2
- package/dist/hooks/useFloatingPosition.cjs.js +1 -1
- package/dist/hooks/useFloatingPosition.mjs +2 -2
- package/dist/hooks/useFocusTrap.cjs.js +1 -1
- package/dist/hooks/useFocusTrap.mjs +4 -15
- package/dist/hooks/useFormReset.cjs.js +1 -1
- package/dist/hooks/useFormReset.mjs +2 -2
- package/dist/hooks/useFormValidation.cjs.js +1 -1
- package/dist/hooks/useFormValidation.mjs +2 -2
- package/dist/hooks/useHotkeys.cjs.js +1 -1
- package/dist/hooks/useHotkeys.mjs +2 -2
- package/dist/hooks/useInertOutside.cjs.js +1 -1
- package/dist/hooks/useInertOutside.mjs +5 -9
- package/dist/hooks/useMediaQuery.cjs.js +1 -1
- package/dist/hooks/useMediaQuery.mjs +2 -2
- package/dist/hooks/useMergedRef.cjs.js +1 -1
- package/dist/hooks/useMergedRef.mjs +2 -2
- package/dist/hooks/useOverlayLayer.cjs.js +1 -1
- package/dist/hooks/useOverlayLayer.mjs +3 -3
- package/dist/hooks/useResponsiveValue.cjs.js +1 -1
- package/dist/hooks/useResponsiveValue.mjs +2 -2
- package/dist/hooks/useScrollLock.cjs.js +1 -1
- package/dist/hooks/useScrollLock.mjs +2 -2
- package/dist/hooks/useStorage.cjs.js +1 -1
- package/dist/hooks/useStorage.mjs +2 -2
- package/dist/hooks/useTiming.cjs.js +1 -1
- package/dist/hooks/useTiming.mjs +10 -15
- package/dist/hooks/useVirtualizer.cjs.js +1 -1
- package/dist/hooks/useVirtualizer.d.ts +13 -0
- package/dist/hooks/useVirtualizer.mjs +93 -54
- package/dist/i18n/en.mjs +1 -2
- package/dist/i18n/merge.mjs +1 -2
- package/dist/i18n/plural.mjs +1 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +114 -114
- package/dist/locales/ar.mjs +1 -2
- package/dist/locales/bn.mjs +1 -2
- package/dist/locales/cs.mjs +1 -2
- package/dist/locales/da.mjs +1 -2
- package/dist/locales/de.mjs +1 -2
- package/dist/locales/el.mjs +1 -2
- package/dist/locales/es.mjs +1 -2
- package/dist/locales/fa.mjs +1 -2
- package/dist/locales/fi.mjs +1 -2
- package/dist/locales/fr.mjs +1 -2
- package/dist/locales/he.mjs +1 -2
- package/dist/locales/hi.mjs +1 -2
- package/dist/locales/hu.mjs +1 -2
- package/dist/locales/id.mjs +1 -2
- package/dist/locales/it.mjs +1 -2
- package/dist/locales/ja.mjs +1 -2
- package/dist/locales/ko.mjs +1 -2
- package/dist/locales/nb.mjs +1 -2
- package/dist/locales/nl.mjs +1 -2
- package/dist/locales/pl.mjs +1 -2
- package/dist/locales/pt-BR.mjs +1 -2
- package/dist/locales/ro.mjs +1 -2
- package/dist/locales/ru.mjs +1 -2
- package/dist/locales/sv.mjs +1 -2
- package/dist/locales/th.mjs +1 -2
- package/dist/locales/tr.mjs +1 -2
- package/dist/locales/uk.mjs +1 -2
- package/dist/locales/ur.mjs +1 -2
- package/dist/locales/vi.mjs +1 -2
- package/dist/locales/zh-Hans.mjs +1 -2
- package/dist/locales/zh-Hant.mjs +1 -2
- package/dist/types/common.mjs +1 -2
- package/dist/utils/announce.cjs.js +1 -1
- package/dist/utils/announce.mjs +3 -4
- package/dist/utils/brandPalette.mjs +1 -2
- package/dist/utils/clipboard.mjs +1 -2
- package/dist/utils/cx.mjs +1 -2
- package/dist/utils/fillSlot.cjs.js +1 -1
- package/dist/utils/fillSlot.mjs +2 -2
- package/dist/utils/flattenChildren.mjs +1 -2
- package/dist/utils/hotkeys.mjs +1 -2
- package/dist/utils/intl.cjs.js +1 -0
- package/dist/utils/intl.d.ts +10 -0
- package/dist/utils/intl.mjs +15 -0
- package/dist/utils/refs.mjs +1 -2
- package/dist/utils/responsive.mjs +1 -2
- package/dist/utils/slot.mjs +1 -2
- package/dist/utils/validators.mjs +1 -2
- package/dist/vjdesigns-ui.css +1 -1
- package/dist/vjdesigns-ui.css.d.ts +2 -0
- package/package.json +24 -14
|
@@ -1,87 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { useControllableState as e } from "../../../hooks/useControllableState.mjs";
|
|
2
3
|
import { useFormReset as t } from "../../../hooks/useFormReset.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useCallback as
|
|
4
|
+
import { cx as n } from "../../../utils/cx.mjs";
|
|
5
|
+
import { VisuallyHidden as r } from "../../utilities/VisuallyHidden/VisuallyHidden.mjs";
|
|
6
|
+
import { useFieldControl as ee } from "../Field/FieldContext.mjs";
|
|
7
|
+
import i from "./Textarea.module.css.mjs";
|
|
8
|
+
import { useMessages as a } from "../../utilities/LocaleProvider/LocaleProvider.mjs";
|
|
9
|
+
import { useCallback as o, useEffect as s, useId as c, useLayoutEffect as l, useRef as u, useState as te } from "react";
|
|
9
10
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
-
|
|
11
|
+
// src/components/forms/Textarea/Textarea.tsx
|
|
11
12
|
var p = {
|
|
12
|
-
sm:
|
|
13
|
-
md:
|
|
14
|
-
lg:
|
|
13
|
+
sm: i.sm,
|
|
14
|
+
md: i.md,
|
|
15
|
+
lg: i.lg
|
|
15
16
|
}, m = {
|
|
16
|
-
outline:
|
|
17
|
-
filled:
|
|
17
|
+
outline: i.outline,
|
|
18
|
+
filled: i.filled
|
|
18
19
|
}, h = {
|
|
19
|
-
none:
|
|
20
|
-
xs:
|
|
21
|
-
sm:
|
|
22
|
-
md:
|
|
23
|
-
lg:
|
|
24
|
-
xl:
|
|
25
|
-
"2xl":
|
|
26
|
-
},
|
|
27
|
-
none:
|
|
28
|
-
vertical:
|
|
29
|
-
both:
|
|
30
|
-
},
|
|
31
|
-
function
|
|
32
|
-
return
|
|
20
|
+
none: i.radiusNone,
|
|
21
|
+
xs: i.radiusXs,
|
|
22
|
+
sm: i.radiusSm,
|
|
23
|
+
md: i.radiusMd,
|
|
24
|
+
lg: i.radiusLg,
|
|
25
|
+
xl: i.radiusXl,
|
|
26
|
+
"2xl": i.radius2xl
|
|
27
|
+
}, ne = {
|
|
28
|
+
none: i.resizeNone,
|
|
29
|
+
vertical: i.resizeVertical,
|
|
30
|
+
both: i.resizeBoth
|
|
31
|
+
}, re = .9, ie = 600, g;
|
|
32
|
+
function _() {
|
|
33
|
+
return g === void 0 && (g = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("field-sizing", "content")), g;
|
|
33
34
|
}
|
|
34
|
-
var
|
|
35
|
-
let z =
|
|
35
|
+
var ae = typeof window < "u" ? l : s, v = ({ size: l, variant: g = "outline", radius: v, invalid: oe, value: y, defaultValue: b, onValueChange: x, onChange: S, rows: C = 3, autoResize: w = !1, minRows: T, maxRows: E, resize: se = "vertical", showCount: ce = !1, maxLength: D, fullWidth: le = !0, className: O, textareaClassName: k, style: A, cols: j, id: M, required: N, disabled: P, readOnly: F, "aria-describedby": I, ref: L, ...R }) => {
|
|
36
|
+
let z = a(), B = c(), V = ce && D !== void 0 && D > 0, H = ee({
|
|
36
37
|
id: M,
|
|
37
|
-
invalid:
|
|
38
|
+
invalid: oe,
|
|
38
39
|
required: N,
|
|
39
40
|
disabled: P,
|
|
40
41
|
readOnly: F,
|
|
41
42
|
size: l,
|
|
42
43
|
"aria-describedby": [I, V ? B : void 0].filter(Boolean).join(" ") || void 0
|
|
43
|
-
}), U = H.size ?? "md", ue =
|
|
44
|
-
value:
|
|
45
|
-
defaultValue:
|
|
46
|
-
onChange:
|
|
44
|
+
}), U = H.size ?? "md", ue = y !== void 0, [W, G] = e({
|
|
45
|
+
value: y,
|
|
46
|
+
defaultValue: b ?? "",
|
|
47
|
+
onChange: x
|
|
47
48
|
});
|
|
48
|
-
t(() => H.id ? document.getElementById(H.id) : null, () => G(
|
|
49
|
+
t(() => H.id ? document.getElementById(H.id) : null, () => G(b ?? ""), y === void 0);
|
|
49
50
|
let de = (e) => {
|
|
50
|
-
|
|
51
|
-
}, K = u(null), fe =
|
|
51
|
+
S?.(e), G(e.target.value);
|
|
52
|
+
}, K = u(null), fe = o((e) => {
|
|
52
53
|
K.current = e;
|
|
53
54
|
let t;
|
|
54
55
|
return typeof L == "function" ? t = L(e) : L && (L.current = e), () => {
|
|
55
56
|
K.current = null, typeof L == "function" ? typeof t == "function" ? t() : L(null) : L && (L.current = null);
|
|
56
57
|
};
|
|
57
|
-
}, [L]), q = Math.max(1,
|
|
58
|
+
}, [L]), q = Math.max(1, T ?? C), J = E === void 0 ? void 0 : Math.max(q, E), Y = o(() => {
|
|
58
59
|
let e = K.current;
|
|
59
60
|
if (!e) return;
|
|
60
61
|
e.style.height = "auto";
|
|
61
62
|
let t = window.getComputedStyle(e), n = parseFloat(t.borderTopWidth) + parseFloat(t.borderBottomWidth);
|
|
62
63
|
e.style.height = `${e.scrollHeight + n}px`;
|
|
63
64
|
}, []);
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
ae(() => {
|
|
66
|
+
w && !_() && Y();
|
|
66
67
|
}, [
|
|
67
|
-
|
|
68
|
+
w,
|
|
68
69
|
Y,
|
|
69
70
|
W,
|
|
70
71
|
q,
|
|
71
72
|
J,
|
|
72
73
|
U
|
|
73
|
-
]),
|
|
74
|
+
]), s(() => {
|
|
74
75
|
let e = K.current;
|
|
75
|
-
if (!
|
|
76
|
+
if (!w || _() || !e || typeof ResizeObserver > "u") return;
|
|
76
77
|
let t = e.offsetWidth, n = new ResizeObserver(() => {
|
|
77
78
|
e.offsetWidth !== t && (t = e.offsetWidth, Y());
|
|
78
79
|
});
|
|
79
80
|
return n.observe(e), () => {
|
|
80
81
|
n.disconnect(), e.style.height = "";
|
|
81
82
|
};
|
|
82
|
-
}, [
|
|
83
|
-
let X = W.length, pe = V ? X /
|
|
84
|
-
|
|
83
|
+
}, [w, Y]);
|
|
84
|
+
let X = W.length, pe = V ? X / D : 0, Z = V && pe >= re, me = V && X >= D, Q = V ? Math.max(0, D - X) : 0, [he, $] = te("");
|
|
85
|
+
s(() => {
|
|
85
86
|
if (!V) return;
|
|
86
87
|
if (!Z) {
|
|
87
88
|
$("");
|
|
@@ -89,7 +90,7 @@ var ie = typeof window < "u" ? l : c, y = ({ size: l, variant: _ = "outline", ra
|
|
|
89
90
|
}
|
|
90
91
|
let e = window.setTimeout(() => {
|
|
91
92
|
$(Q === 0 ? z.textarea.limitReached : z.textarea.remaining(Q));
|
|
92
|
-
},
|
|
93
|
+
}, ie);
|
|
93
94
|
return () => window.clearTimeout(e);
|
|
94
95
|
}, [
|
|
95
96
|
V,
|
|
@@ -97,13 +98,13 @@ var ie = typeof window < "u" ? l : c, y = ({ size: l, variant: _ = "outline", ra
|
|
|
97
98
|
Q,
|
|
98
99
|
z
|
|
99
100
|
]);
|
|
100
|
-
let ge = { ...
|
|
101
|
+
let ge = { ...w ? {
|
|
101
102
|
"--textarea-min-rows": q,
|
|
102
103
|
"--textarea-max-rows": J,
|
|
103
104
|
"--textarea-cols": j
|
|
104
105
|
} : null };
|
|
105
106
|
return /* @__PURE__ */ f("div", {
|
|
106
|
-
className:
|
|
107
|
+
className: n(i.root, le ? i.fullWidth : i.inline, O),
|
|
107
108
|
style: A,
|
|
108
109
|
children: [
|
|
109
110
|
/* @__PURE__ */ d("textarea", {
|
|
@@ -114,32 +115,32 @@ var ie = typeof window < "u" ? l : c, y = ({ size: l, variant: _ = "outline", ra
|
|
|
114
115
|
required: H.required,
|
|
115
116
|
disabled: H.disabled,
|
|
116
117
|
readOnly: H.readOnly,
|
|
117
|
-
maxLength:
|
|
118
|
+
maxLength: D,
|
|
118
119
|
cols: j,
|
|
119
|
-
rows:
|
|
120
|
-
...ue ? { value: W } : { defaultValue:
|
|
120
|
+
rows: w ? q : C,
|
|
121
|
+
...ue ? { value: W } : { defaultValue: b ?? "" },
|
|
121
122
|
onChange: de,
|
|
122
123
|
style: ge,
|
|
123
|
-
className:
|
|
124
|
+
className: n(i.textarea, p[U], m[g], v && h[v], ne[w ? "none" : se], w && i.autoResize, w && J !== void 0 && i.hasMaxRows, H.invalid && i.invalid, k)
|
|
124
125
|
}),
|
|
125
126
|
V && /* @__PURE__ */ f("div", {
|
|
126
127
|
id: B,
|
|
127
|
-
className:
|
|
128
|
+
className: n(i.counter, p[U], Z && i.counterNear, me && i.counterAtLimit),
|
|
128
129
|
children: [/* @__PURE__ */ f("span", {
|
|
129
130
|
"aria-hidden": "true",
|
|
130
131
|
children: [
|
|
131
132
|
X,
|
|
132
133
|
" / ",
|
|
133
|
-
|
|
134
|
+
D
|
|
134
135
|
]
|
|
135
|
-
}), /* @__PURE__ */ f(
|
|
136
|
+
}), /* @__PURE__ */ f(r, { children: [
|
|
136
137
|
X,
|
|
137
138
|
" of ",
|
|
138
|
-
|
|
139
|
+
D,
|
|
139
140
|
" characters used"
|
|
140
141
|
] })]
|
|
141
142
|
}),
|
|
142
|
-
V && /* @__PURE__ */ d(
|
|
143
|
+
V && /* @__PURE__ */ d(r, {
|
|
143
144
|
"aria-live": "polite",
|
|
144
145
|
"aria-atomic": "true",
|
|
145
146
|
children: he
|
|
@@ -147,5 +148,4 @@ var ie = typeof window < "u" ? l : c, y = ({ size: l, variant: _ = "outline", ra
|
|
|
147
148
|
]
|
|
148
149
|
});
|
|
149
150
|
};
|
|
150
|
-
|
|
151
|
-
export { y as Textarea };
|
|
151
|
+
export { v as Textarea };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/forms/Textarea/Textarea.module.css
|
|
2
2
|
var e = "_root_w9tza_3", t = "_fullWidth_w9tza_17", n = "_inline_w9tza_27", r = "_textarea_w9tza_39", i = "_sm_w9tza_143", a = "_md_w9tza_157", o = "_lg_w9tza_167", s = "_outline_w9tza_183", c = "_filled_w9tza_189", l = "_radiusNone_w9tza_219", u = "_radiusXs_w9tza_225", d = "_radiusSm_w9tza_231", f = "_radiusMd_w9tza_237", p = "_radiusLg_w9tza_243", m = "_radiusXl_w9tza_249", h = "_radius2xl_w9tza_255", g = "_resizeNone_w9tza_265", _ = "_resizeVertical_w9tza_271", v = "_resizeBoth_w9tza_277", y = "_autoResize_w9tza_293", b = "_hasMaxRows_w9tza_311", x = "_invalid_w9tza_347", S = "_counter_w9tza_391", C = "_counterNear_w9tza_429", w = "_counterAtLimit_w9tza_439", T = {
|
|
3
3
|
root: e,
|
|
4
4
|
fullWidth: t,
|
|
@@ -26,5 +26,4 @@ var e = "_root_w9tza_3", t = "_fullWidth_w9tza_17", n = "_inline_w9tza_27", r =
|
|
|
26
26
|
counterNear: C,
|
|
27
27
|
counterAtLimit: w
|
|
28
28
|
};
|
|
29
|
-
//#endregion
|
|
30
29
|
export { y as autoResize, S as counter, w as counterAtLimit, C as counterNear, T as default, c as filled, t as fullWidth, b as hasMaxRows, n as inline, x as invalid, o as lg, a as md, s as outline, h as radius2xl, p as radiusLg, f as radiusMd, l as radiusNone, d as radiusSm, m as radiusXl, u as radiusXs, v as resizeBoth, g as resizeNone, _ as resizeVertical, e as root, i as sm, r as textarea };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../../../hooks/useControllableState.cjs.js"),t=require("
|
|
1
|
+
"use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../utils/cx.cjs.js"),n=require("../../primitives/Icon/icons.cjs.js"),r=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),i=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),ee=require("../Combobox/Combobox.cjs.js"),te=require("../Field/FieldContext.cjs.js"),a=require("./timeUtils.cjs.js"),o=require("./TimePicker.module.css.cjs.js");let s=require("react"),c=require("react/jsx-runtime");var l=`14:30`;function u(e,t,n,r,i){return t.reason===`unparseable`?e.unparseable(t.example):r&&i?e.between(n(r),n(i)):r?e.onOrAfter(n(r)):e.onOrBefore(n(i))}var d=e=>e.replace(/\D/g,``),f=({value:f,defaultValue:p,onValueChange:ne,min:m,max:h,step:g=30,hourCycle:re,locale:_,size:v,name:y,clearable:ie=!1,placeholder:ae,invalid:b,required:x,disabled:S,readOnly:C,placement:w=`bottom-start`,maxHeight:T=`16rem`,fullWidth:E=!0,onInvalidInput:D,invalidMessage:O,formatDescription:oe,showTimesLabel:se,hideTimesLabel:ce,id:le,"aria-label":ue,"aria-labelledby":de,"aria-describedby":fe,className:pe,style:me,ref:k,onBlur:A})=>{let{messages:j,locale:M}=r.useLocale(),N=_??M,P=re??a.getLocaleHourCycle(N),F=(0,s.useMemo)(()=>e=>a.formatTime(e,N,P),[N,P]),I=F(l),L=oe??j.timePicker.format,R=te.useFieldControl({disabled:S,readOnly:C,size:v,invalid:b,required:x}),he=R.size??`md`,[z,B]=e.useControllableState({value:f,defaultValue:p??null,onChange:ne}),[V,H]=(0,s.useState)(()=>z?F(z):``),[U,W]=(0,s.useState)(null),G=(0,s.useRef)({value:z,format:F});(0,s.useEffect)(()=>{let e=G.current;if(e.value===z&&e.format===F)return;let t=e.value?V===e.format(e.value):V===``;G.current={value:z,format:F},(e.value!==z||t)&&(H(z?F(z):``),e.value!==z&&W(null))},[z,F,V]);let K=e=>{G.current={value:e,format:F},H(e?F(e):``),B(e)},q=(e=V)=>{let t=e.trim();if(!t){W(null),z!==null&&K(null);return}let n=a.parseTimeText(t,N),r=a.parseISOTime(n),i=r!==null&&(m!==void 0&&r<a.parseISOTime(m)||h!==void 0&&r>a.parseISOTime(h));if(!n||i){let e={text:t,reason:n?`out-of-range`:`unparseable`,time:n??void 0,example:I};W(e),G.current={value:null,format:F},B(null),D?.(e)}else W(null),K(n)},J=(0,s.useMemo)(()=>a.timeSlots(g,m,h).map(e=>({value:e,label:F(e)})),[g,m,h,F]),ge=(0,s.useMemo)(()=>new Set(J.map(e=>e.value)),[J]),Y=z?F(z).toLowerCase():``,_e=(0,s.useMemo)(()=>(e,t)=>{let n=t.trim().toLowerCase();if(!n||n===Y||e.label.toLowerCase().includes(n))return!0;let r=d(n);if(r&&r===n.replace(/[:.\s]/g,``)){let t=d(e.value);if(t.startsWith(r)||t.startsWith(`0${r}`))return!0}return a.parseTimeText(n,N)===e.value},[N,Y]),X=(0,s.useId)(),Z=`${X}-format`,Q=`${X}-error`,$=U&&O!==null?typeof O==`function`?O(U):O??u(j.timePicker.invalid,U,F,m,h):null,ve=[fe,Z,$==null?void 0:Q].filter(Boolean).join(` `)||void 0;return(0,c.jsxs)(`div`,{className:t.cx(o.default.root,E&&o.default.fullWidth,pe),style:me,"data-size":he,children:[(0,c.jsx)(ee.Combobox,{ref:k,id:le,options:J,value:z&&ge.has(z)?z:null,onValueChange:e=>{e!==null&&(W(null),K(e))},inputValue:V,onInputValueChange:e=>{H(e),e===``&&(W(null),z!==null&&K(null))},allowCustomValue:!0,filter:_e,emptyMessage:null,clearable:ie,showSuggestionsLabel:se??j.timePicker.showTimes,hideSuggestionsLabel:ce??j.timePicker.hideTimes,size:v,invalid:b??(U?!0:void 0),required:x,disabled:S,readOnly:C,placement:w,maxHeight:T,fullWidth:E,placeholder:ae,autoComplete:`off`,"aria-label":ue,"aria-labelledby":de,"aria-describedby":ve,onKeyDown:e=>{e.key===`Enter`&&!e.currentTarget.getAttribute(`aria-activedescendant`)&&q(e.currentTarget.value)},onBlur:e=>{!R.disabled&&!R.readOnly&&q(e.currentTarget.value),A?.(e)}}),(0,c.jsx)(i.VisuallyHidden,{id:Z,children:L(I)}),y!==void 0&&(0,c.jsx)(`input`,{type:`hidden`,name:y,value:z??``,disabled:R.disabled}),(0,c.jsx)(`div`,{"aria-live":`polite`,children:$!=null&&(0,c.jsxs)(`p`,{id:Q,className:o.default.error,children:[(0,c.jsx)(n.ErrorIcon,{size:`sm`,className:o.default.errorIcon}),(0,c.jsx)(`span`,{children:$})]})})]})};exports.TimePicker=f,exports.formatTime=a.formatTime,exports.isISOTime=a.isISOTime,exports.parseTimeText=a.parseTimeText;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { useControllableState as e } from "../../../hooks/useControllableState.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { cx as t } from "../../../utils/cx.mjs";
|
|
4
|
+
import { ErrorIcon as n } from "../../primitives/Icon/icons.mjs";
|
|
5
|
+
import { useLocale as r } from "../../utilities/LocaleProvider/LocaleProvider.mjs";
|
|
6
|
+
import { VisuallyHidden as i } from "../../utilities/VisuallyHidden/VisuallyHidden.mjs";
|
|
7
|
+
import { Combobox as ee } from "../Combobox/Combobox.mjs";
|
|
8
|
+
import { useFieldControl as a } from "../Field/FieldContext.mjs";
|
|
8
9
|
import { formatTime as o, getLocaleHourCycle as te, isISOTime as s, parseISOTime as c, parseTimeText as l, timeSlots as ne } from "./timeUtils.mjs";
|
|
9
10
|
import u from "./TimePicker.module.css.mjs";
|
|
10
11
|
import { useEffect as re, useId as ie, useMemo as d, useRef as ae, useState as f } from "react";
|
|
11
12
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
|
-
|
|
13
|
+
// src/components/forms/TimePicker/TimePicker.tsx
|
|
13
14
|
var oe = "14:30";
|
|
14
15
|
function se(e, t, n, r, i) {
|
|
15
16
|
return t.reason === "unparseable" ? e.unparseable(t.example) : r && i ? e.between(n(r), n(i)) : r ? e.onOrAfter(n(r)) : e.onOrBefore(n(i));
|
|
16
17
|
}
|
|
17
18
|
var h = (e) => e.replace(/\D/g, ""), g = ({ value: s, defaultValue: g, onValueChange: ce, min: _, max: v, step: y = 30, hourCycle: le, locale: ue, size: b, name: x, clearable: de = !1, placeholder: fe, invalid: S, required: C, disabled: w, readOnly: T, placement: pe = "bottom-start", maxHeight: me = "16rem", fullWidth: E = !0, onInvalidInput: he, invalidMessage: D, formatDescription: ge, showTimesLabel: _e, hideTimesLabel: ve, id: ye, "aria-label": be, "aria-labelledby": xe, "aria-describedby": O, className: k, style: A, ref: j, onBlur: M }) => {
|
|
18
|
-
let { messages: N, locale: Se } =
|
|
19
|
+
let { messages: N, locale: Se } = r(), P = ue ?? Se, F = le ?? te(P), I = d(() => (e) => o(e, P, F), [P, F]), L = I(oe), Ce = ge ?? N.timePicker.format, R = a({
|
|
19
20
|
disabled: w,
|
|
20
21
|
readOnly: T,
|
|
21
22
|
size: b,
|
|
@@ -65,9 +66,7 @@ var h = (e) => e.replace(/\D/g, ""), g = ({ value: s, defaultValue: g, onValueCh
|
|
|
65
66
|
value: null,
|
|
66
67
|
format: I
|
|
67
68
|
}, B(null), he?.(e);
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
W(null), K(n);
|
|
69
|
+
} else W(null), K(n);
|
|
71
70
|
}, J = d(() => ne(y, _, v).map((e) => ({
|
|
72
71
|
value: e,
|
|
73
72
|
label: I(e)
|
|
@@ -91,11 +90,11 @@ var h = (e) => e.replace(/\D/g, ""), g = ({ value: s, defaultValue: g, onValueCh
|
|
|
91
90
|
$ == null ? void 0 : Q
|
|
92
91
|
].filter(Boolean).join(" ") || void 0;
|
|
93
92
|
return /* @__PURE__ */ m("div", {
|
|
94
|
-
className:
|
|
93
|
+
className: t(u.root, E && u.fullWidth, k),
|
|
95
94
|
style: A,
|
|
96
95
|
"data-size": we,
|
|
97
96
|
children: [
|
|
98
|
-
/* @__PURE__ */ p(
|
|
97
|
+
/* @__PURE__ */ p(ee, {
|
|
99
98
|
ref: j,
|
|
100
99
|
id: ye,
|
|
101
100
|
options: J,
|
|
@@ -133,7 +132,7 @@ var h = (e) => e.replace(/\D/g, ""), g = ({ value: s, defaultValue: g, onValueCh
|
|
|
133
132
|
!R.disabled && !R.readOnly && q(e.currentTarget.value), M?.(e);
|
|
134
133
|
}
|
|
135
134
|
}),
|
|
136
|
-
/* @__PURE__ */ p(
|
|
135
|
+
/* @__PURE__ */ p(i, {
|
|
137
136
|
id: Z,
|
|
138
137
|
children: Ce(L)
|
|
139
138
|
}),
|
|
@@ -148,7 +147,7 @@ var h = (e) => e.replace(/\D/g, ""), g = ({ value: s, defaultValue: g, onValueCh
|
|
|
148
147
|
children: $ != null && /* @__PURE__ */ m("p", {
|
|
149
148
|
id: Q,
|
|
150
149
|
className: u.error,
|
|
151
|
-
children: [/* @__PURE__ */ p(
|
|
150
|
+
children: [/* @__PURE__ */ p(n, {
|
|
152
151
|
size: "sm",
|
|
153
152
|
className: u.errorIcon
|
|
154
153
|
}), /* @__PURE__ */ p("span", { children: $ })]
|
|
@@ -157,5 +156,4 @@ var h = (e) => e.replace(/\D/g, ""), g = ({ value: s, defaultValue: g, onValueCh
|
|
|
157
156
|
]
|
|
158
157
|
});
|
|
159
158
|
};
|
|
160
|
-
//#endregion
|
|
161
159
|
export { g as TimePicker, o as formatTime, s as isISOTime, l as parseTimeText };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/forms/TimePicker/TimePicker.module.css
|
|
2
2
|
var e = "_root_100f0_6", t = "_fullWidth_100f0_12", n = "_error_100f0_17", r = "_errorIcon_100f0_30", i = {
|
|
3
3
|
root: e,
|
|
4
4
|
fullWidth: t,
|
|
5
5
|
error: n,
|
|
6
6
|
errorIcon: r
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { i as default, n as error, r as errorIcon, t as fullWidth, e as root };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=e=>String(e).padStart(2,`0`);function t(e){if(!e)return null;let t=/^(\d{2}):(\d{2})(?::\d{2}(?:\.\d+)?)?$/.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:n*60+r}function n(e){return t(e)!==null}function r(t){let n=(Math.round(t)%1440+1440)%1440;return`${e(Math.floor(n/60))}:${e(n%60)}`}function
|
|
1
|
+
var e=e=>String(e).padStart(2,`0`);function t(e){if(!e)return null;let t=/^(\d{2}):(\d{2})(?::\d{2}(?:\.\d+)?)?$/.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:n*60+r}function n(e){return t(e)!==null}function r(t){let n=(Math.round(t)%1440+1440)%1440;return`${e(Math.floor(n/60))}:${e(n%60)}`}var i=new Map;function a(e){let t=e??``,n=i.get(t);if(n===void 0){try{let t=new Intl.DateTimeFormat(e,{hour:`numeric`}).resolvedOptions().hourCycle;n=t===`h11`||t===`h12`?12:24}catch{n=24}i.set(t,n)}return n}var o=new Map;function s(e,t){let n=`${e??``}|${t}`,r=o.get(n);return r||(r=new Intl.DateTimeFormat(e,{hour:`numeric`,minute:`2-digit`,hourCycle:t===12?`h12`:`h23`,timeZone:`UTC`}),o.set(n,r)),r}function c(e,n,r=a(n)){let i=t(e);if(i===null)return e;let o=new Date(Date.UTC(2e3,0,1,Math.floor(i/60),i%60));return s(n,r).format(o)}var l=[1632,1776,2406,2534,3664];function u(e){let t=``;for(let n of e.normalize(`NFKC`)){let e=n.codePointAt(0),r=l.find(t=>e>=t&&e<=t+9);t+=r===void 0?n:String(e-r)}return t.toLowerCase().replace(/\./g,``).trim()}var d=new Map;function f(e){let t=e??``,n=d.get(t);if(n)return n;let r=t=>{try{return u(new Intl.DateTimeFormat(e,{hour:`numeric`,hourCycle:`h12`,timeZone:`UTC`}).formatToParts(new Date(Date.UTC(2e3,0,1,t))).find(e=>e.type===`dayPeriod`)?.value??``)}catch{return``}},i={am:[r(9),`am`].filter(Boolean),pm:[r(21),`pm`].filter(Boolean)};return d.set(t,i),i}function p(e,t){let n=u(e);if(!n)return null;let i=null,{am:a,pm:o}=f(t),s=[...a.map(e=>({m:e,p:`am`})),...o.map(e=>({m:e,p:`pm`}))].sort((e,t)=>t.m.length-e.m.length);for(let{m:e,p:t}of s)if(e&&n.includes(e)){i=t,n=n.replace(e,` `).trim();break}if(!i){let e=/^(.*\d)\s*([ap])$/.exec(n);e&&(i=e[2]===`a`?`am`:`pm`,n=e[1])}let c,l=0,d=/^(\d{1,2})(?:\s*[:h時时시]\s*(\d{1,2})?\s*(?:[:分분]\s*(?:\d{1,2})?)?)?\s*[分분]?$/.exec(n),p=/^(\d{3,4})$/.exec(n);if(d){if(c=Number(d[1]),d[2]!==void 0){if(d[2].length!==2)return null;l=Number(d[2])}}else if(p){let e=p[1].padStart(4,`0`);c=Number(e.slice(0,2)),l=Number(e.slice(2))}else return null;if(l>59)return null;if(i){if(c<1||c>12)return null;c=c%12+(i===`pm`?12:0)}else if(c>23)return null;return r(c*60+l)}function m(e,n,i){let a=Math.max(1,Math.round(e)),o=t(n)??0,s=t(i)??1439,c=[];for(let e=o;e<=s;e+=a)c.push(r(e));return c}exports.formatTime=c,exports.getLocaleHourCycle=a,exports.isISOTime=n,exports.parseISOTime=t,exports.parseTimeText=p,exports.timeSlots=m,exports.toISOTime=r;
|
|
@@ -8,7 +8,10 @@ export declare function parseISOTime(value: string | null | undefined): number |
|
|
|
8
8
|
export declare function isISOTime(value: string | null | undefined): value is ISOTime;
|
|
9
9
|
/** "HH:mm" for minutes since midnight (wraps around a day). */
|
|
10
10
|
export declare function toISOTime(minutes: number): ISOTime;
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* The locale's usual clock: 12-hour ("2:30 PM") or 24-hour ("14:30").
|
|
13
|
+
* Cached per locale: `formatTime` asks for every time it formats.
|
|
14
|
+
*/
|
|
12
15
|
export declare function getLocaleHourCycle(locale?: string): HourCycle;
|
|
13
16
|
/** Formats "HH:mm" for display in the locale ("2:30 PM", "14:30", "오후 2:30"). */
|
|
14
17
|
export declare function formatTime(value: ISOTime, locale?: string, hourCycle?: HourCycle): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/forms/TimePicker/timeUtils.ts
|
|
2
2
|
var e = (e) => String(e).padStart(2, "0");
|
|
3
3
|
function t(e) {
|
|
4
4
|
if (!e) return null;
|
|
@@ -14,52 +14,58 @@ function r(t) {
|
|
|
14
14
|
let n = (Math.round(t) % 1440 + 1440) % 1440;
|
|
15
15
|
return `${e(Math.floor(n / 60))}:${e(n % 60)}`;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
var i = /* @__PURE__ */ new Map();
|
|
18
|
+
function a(e) {
|
|
19
|
+
let t = e ?? "", n = i.get(t);
|
|
20
|
+
if (n === void 0) {
|
|
21
|
+
try {
|
|
22
|
+
let t = new Intl.DateTimeFormat(e, { hour: "numeric" }).resolvedOptions().hourCycle;
|
|
23
|
+
n = t === "h11" || t === "h12" ? 12 : 24;
|
|
24
|
+
} catch {
|
|
25
|
+
n = 24;
|
|
26
|
+
}
|
|
27
|
+
i.set(t, n);
|
|
23
28
|
}
|
|
29
|
+
return n;
|
|
24
30
|
}
|
|
25
|
-
var
|
|
26
|
-
function
|
|
27
|
-
let n = `${e ?? ""}|${t}`, r =
|
|
31
|
+
var o = /* @__PURE__ */ new Map();
|
|
32
|
+
function s(e, t) {
|
|
33
|
+
let n = `${e ?? ""}|${t}`, r = o.get(n);
|
|
28
34
|
return r || (r = new Intl.DateTimeFormat(e, {
|
|
29
35
|
hour: "numeric",
|
|
30
36
|
minute: "2-digit",
|
|
31
37
|
hourCycle: t === 12 ? "h12" : "h23",
|
|
32
38
|
timeZone: "UTC"
|
|
33
|
-
}),
|
|
39
|
+
}), o.set(n, r)), r;
|
|
34
40
|
}
|
|
35
|
-
function
|
|
36
|
-
let
|
|
37
|
-
if (
|
|
38
|
-
let
|
|
39
|
-
return
|
|
41
|
+
function c(e, n, r = a(n)) {
|
|
42
|
+
let i = t(e);
|
|
43
|
+
if (i === null) return e;
|
|
44
|
+
let o = new Date(Date.UTC(2e3, 0, 1, Math.floor(i / 60), i % 60));
|
|
45
|
+
return s(n, r).format(o);
|
|
40
46
|
}
|
|
41
|
-
var
|
|
47
|
+
var l = [
|
|
42
48
|
1632,
|
|
43
49
|
1776,
|
|
44
50
|
2406,
|
|
45
51
|
2534,
|
|
46
52
|
3664
|
|
47
53
|
];
|
|
48
|
-
function
|
|
54
|
+
function u(e) {
|
|
49
55
|
let t = "";
|
|
50
56
|
for (let n of e.normalize("NFKC")) {
|
|
51
|
-
let e = n.codePointAt(0), r =
|
|
57
|
+
let e = n.codePointAt(0), r = l.find((t) => e >= t && e <= t + 9);
|
|
52
58
|
t += r === void 0 ? n : String(e - r);
|
|
53
59
|
}
|
|
54
60
|
return t.toLowerCase().replace(/\./g, "").trim();
|
|
55
61
|
}
|
|
56
|
-
var
|
|
57
|
-
function
|
|
58
|
-
let t = e ?? "", n =
|
|
62
|
+
var d = /* @__PURE__ */ new Map();
|
|
63
|
+
function f(e) {
|
|
64
|
+
let t = e ?? "", n = d.get(t);
|
|
59
65
|
if (n) return n;
|
|
60
66
|
let r = (t) => {
|
|
61
67
|
try {
|
|
62
|
-
return
|
|
68
|
+
return u(new Intl.DateTimeFormat(e, {
|
|
63
69
|
hour: "numeric",
|
|
64
70
|
hourCycle: "h12",
|
|
65
71
|
timeZone: "UTC"
|
|
@@ -71,12 +77,12 @@ function d(e) {
|
|
|
71
77
|
am: [r(9), "am"].filter(Boolean),
|
|
72
78
|
pm: [r(21), "pm"].filter(Boolean)
|
|
73
79
|
};
|
|
74
|
-
return
|
|
80
|
+
return d.set(t, i), i;
|
|
75
81
|
}
|
|
76
|
-
function
|
|
77
|
-
let n =
|
|
82
|
+
function p(e, t) {
|
|
83
|
+
let n = u(e);
|
|
78
84
|
if (!n) return null;
|
|
79
|
-
let i = null, { am: a, pm: o } =
|
|
85
|
+
let i = null, { am: a, pm: o } = f(t), s = [...a.map((e) => ({
|
|
80
86
|
m: e,
|
|
81
87
|
p: "am"
|
|
82
88
|
})), ...o.map((e) => ({
|
|
@@ -91,27 +97,26 @@ function f(e, t) {
|
|
|
91
97
|
let e = /^(.*\d)\s*([ap])$/.exec(n);
|
|
92
98
|
e && (i = e[2] === "a" ? "am" : "pm", n = e[1]);
|
|
93
99
|
}
|
|
94
|
-
let c,
|
|
95
|
-
if (
|
|
96
|
-
if (c = Number(
|
|
97
|
-
if (
|
|
98
|
-
|
|
100
|
+
let c, l = 0, d = /^(\d{1,2})(?:\s*[:h時时시]\s*(\d{1,2})?\s*(?:[:分분]\s*(?:\d{1,2})?)?)?\s*[分분]?$/.exec(n), p = /^(\d{3,4})$/.exec(n);
|
|
101
|
+
if (d) {
|
|
102
|
+
if (c = Number(d[1]), d[2] !== void 0) {
|
|
103
|
+
if (d[2].length !== 2) return null;
|
|
104
|
+
l = Number(d[2]);
|
|
99
105
|
}
|
|
100
106
|
} else if (p) {
|
|
101
107
|
let e = p[1].padStart(4, "0");
|
|
102
|
-
c = Number(e.slice(0, 2)),
|
|
108
|
+
c = Number(e.slice(0, 2)), l = Number(e.slice(2));
|
|
103
109
|
} else return null;
|
|
104
|
-
if (
|
|
110
|
+
if (l > 59) return null;
|
|
105
111
|
if (i) {
|
|
106
112
|
if (c < 1 || c > 12) return null;
|
|
107
113
|
c = c % 12 + (i === "pm" ? 12 : 0);
|
|
108
114
|
} else if (c > 23) return null;
|
|
109
|
-
return r(c * 60 +
|
|
115
|
+
return r(c * 60 + l);
|
|
110
116
|
}
|
|
111
|
-
function
|
|
117
|
+
function m(e, n, i) {
|
|
112
118
|
let a = Math.max(1, Math.round(e)), o = t(n) ?? 0, s = t(i) ?? 1439, c = [];
|
|
113
119
|
for (let e = o; e <= s; e += a) c.push(r(e));
|
|
114
120
|
return c;
|
|
115
121
|
}
|
|
116
|
-
|
|
117
|
-
export { s as formatTime, i as getLocaleHourCycle, n as isISOTime, t as parseISOTime, f as parseTimeText, p as timeSlots, r as toISOTime };
|
|
122
|
+
export { c as formatTime, a as getLocaleHourCycle, n as isISOTime, t as parseISOTime, p as parseTimeText, m as timeSlots, r as toISOTime };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../utils/
|
|
1
|
+
"use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../utils/cx.cjs.js"),n=require("../../../utils/refs.cjs.js"),r=require("../../primitives/Icon/Icon.cjs.js"),i=require("./ToggleGroup.module.css.cjs.js");let a=require("react"),o=require("react/jsx-runtime");var s={solid:i.default.solid,soft:i.default.soft,outline:i.default.outline,ghost:i.default.ghost},c={neutral:i.default.neutral,primary:i.default.primary,accent:i.default.accent,success:i.default.success,warning:i.default.warning,danger:i.default.danger,info:i.default.info},l={sm:i.default.sm,md:i.default.md,lg:i.default.lg},u={none:i.default.radiusNone,xs:i.default.radiusXs,sm:i.default.radiusSm,md:i.default.radiusMd,lg:i.default.radiusLg,xl:i.default.radiusXl,"2xl":i.default.radius2xl,pill:i.default.radiusPill},d={0:i.default.gap0,1:i.default.gap1,2:i.default.gap2,3:i.default.gap3,4:i.default.gap4,5:i.default.gap5,6:i.default.gap6,8:i.default.gap8,10:i.default.gap10,12:i.default.gap12,16:i.default.gap16,20:i.default.gap20,24:i.default.gap24},f=(0,a.createContext)(null),p=`data-toggle-group-item`,m=`data-toggle-group`,h=({pressed:e,onToggle:n,variant:d,tone:p,size:m,radius:h,disabled:g,checkmark:_,fullWidth:v,startIcon:y,endIcon:b,icon:x,children:S,className:C,onClick:w,...T})=>{let E=(0,a.useContext)(f),D=d??E?.variant??`solid`,O=p??E?.tone??`primary`,k=m??E?.size??`md`,A=h??E?.radius,j=!!(g||E?.disabled),M=S==null&&x!=null,N=!M&&(v??E?.fullWidth??!1),P=e&&!M&&(_??E?.checkmark??!1),F=typeof S==`string`||typeof S==`number`?String(S):void 0,I=e=>{w?.(e),e.defaultPrevented||j||n()};return(0,o.jsx)(`button`,{...T,type:`button`,"aria-pressed":e,disabled:j,"data-state":e?`on`:`off`,className:t.cx(i.default.root,s[D],c[O],l[k],A?u[A]:i.default.radiusDefault,e&&i.default.pressed,M&&i.default.iconOnly,N&&i.default.fullWidth,!j&&i.default.interactive,j&&i.default.disabled,C),onClick:I,children:(0,o.jsxs)(`span`,{className:i.default.content,children:[P&&(0,o.jsx)(`span`,{className:t.cx(i.default.icon,i.default.check),"aria-hidden":`true`,children:(0,o.jsx)(r.Icon,{name:`check`,strokeWidth:3})}),M?(0,o.jsx)(`span`,{className:i.default.icon,"aria-hidden":`true`,children:x}):(0,o.jsxs)(o.Fragment,{children:[y!=null&&(0,o.jsx)(`span`,{className:i.default.icon,"aria-hidden":`true`,children:y}),S!=null&&(0,o.jsx)(`span`,{className:i.default.label,"data-text":F,children:S}),b!=null&&(0,o.jsx)(`span`,{className:i.default.icon,"aria-hidden":`true`,children:b})]})]})})},g=({pressed:t,defaultPressed:n=!1,onPressedChange:r,...i})=>{let[a,s]=e.useControllableState({value:t,defaultValue:n,onChange:r});return(0,o.jsx)(h,{...i,pressed:a,onToggle:()=>s(e=>!e)})},_=({value:e,onFocus:t,tabIndex:n,...r})=>{let i=(0,a.useContext)(f);if(!i)throw Error(`ToggleGroup.Item must be rendered inside a ToggleGroup.`);let s=n=>{t?.(n),i.setTabStop(e)};return(0,o.jsx)(h,{...r,[p]:e,pressed:i.isPressed(e),onToggle:()=>i.toggle(e),onFocus:s,tabIndex:i.rovingFocus?i.tabStop===e?0:-1:n})};function v(e){return Array.from(e.querySelectorAll(`[${p}]`)).filter(t=>!t.disabled&&t.closest(`[${m}]`)===e)}var y=Object.assign(({type:r,value:s,defaultValue:c,onValueChange:l,required:u=!1,attached:h=!1,orientation:g=`horizontal`,gap:_=2,rovingFocus:y=!0,role:b=`group`,size:x,variant:S,tone:C,radius:w,disabled:T,checkmark:E,fullWidth:D,className:O,children:k,onKeyDown:A,ref:j,...M})=>{let N=r===`multiple`,[P,F]=e.useControllableState({value:s,defaultValue:c??(N?[]:null),onChange:l}),I=(0,a.useRef)(null),L=(0,a.useCallback)(e=>{I.current=e,n.assignRef(j,e)},[j]),[R,z]=(0,a.useState)(null),B=(0,a.useMemo)(()=>Array.isArray(P)?P:typeof P==`string`?[P]:[],[P]),V=(0,a.useCallback)(e=>B.includes(e),[B]),H=(0,a.useCallback)(e=>{F(t=>{if(N){let n=Array.isArray(t)?t:[];return n.includes(e)?u&&n.length===1?t:n.filter(t=>t!==e):[...n,e]}return t===e?u?t:null:e})},[N,u,F]);(0,a.useLayoutEffect)(()=>{let e=I.current;if(!y||!e)return;let t=v(e).map(e=>e.getAttribute(p)??``);if(R!==null&&t.includes(R))return;let n=t.find(e=>B.includes(e))??t[0]??null;n!==R&&z(n)});let U=e=>{A?.(e);let t=I.current;if(e.defaultPrevented||!y||!t||e.altKey||e.ctrlKey||e.metaKey)return;let n=v(t),r=n.indexOf(e.target);if(r===-1)return;let i=g===`vertical`,a=getComputedStyle(t).direction===`rtl`,o=i?`ArrowDown`:a?`ArrowLeft`:`ArrowRight`,s=i?`ArrowUp`:a?`ArrowRight`:`ArrowLeft`,c=n.length,l=null;e.key===o?l=(r+1)%c:e.key===s?l=(r-1+c)%c:e.key===`Home`?l=0:e.key===`End`&&(l=c-1),l!==null&&(e.preventDefault(),n[l].focus())},W=(0,a.useMemo)(()=>({size:x,variant:S,tone:C,radius:w,disabled:T,checkmark:E,fullWidth:D,isPressed:V,toggle:H,rovingFocus:y,tabStop:R,setTabStop:z}),[x,S,C,w,T,E,D,V,H,y,R]),G=g===`vertical`;return(0,o.jsx)(`div`,{...M,[m]:``,ref:L,role:b,"aria-orientation":b===`toolbar`?g:void 0,"aria-disabled":T?!0:void 0,"data-orientation":g,className:t.cx(i.default.group,G&&i.default.groupVertical,h?G?i.default.attachedVertical:i.default.attachedHorizontal:d[_],h&&i.default.attached,D&&i.default.groupFullWidth,O),onKeyDown:U,children:(0,o.jsx)(f.Provider,{value:W,children:k})})},{Item:_});exports.ToggleButton=g,exports.ToggleGroup=y,exports.ToggleGroupItem=_;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { useControllableState as e } from "../../../hooks/useControllableState.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { cx as t } from "../../../utils/cx.mjs";
|
|
4
|
+
import { assignRef as n } from "../../../utils/refs.mjs";
|
|
4
5
|
import { Icon as r } from "../../primitives/Icon/Icon.mjs";
|
|
5
6
|
import i from "./ToggleGroup.module.css.mjs";
|
|
6
7
|
import { createContext as a, useCallback as o, useContext as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
7
8
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
|
-
|
|
9
|
+
// src/components/forms/ToggleGroup/ToggleGroup.tsx
|
|
9
10
|
var h = {
|
|
10
11
|
solid: i.solid,
|
|
11
12
|
soft: i.soft,
|
|
@@ -46,9 +47,9 @@ var h = {
|
|
|
46
47
|
16: i.gap16,
|
|
47
48
|
20: i.gap20,
|
|
48
49
|
24: i.gap24
|
|
49
|
-
}, b = a(null), x = "data-toggle-group-item", S = "data-toggle-group", C = ({ pressed: e, onToggle:
|
|
50
|
+
}, b = a(null), x = "data-toggle-group-item", S = "data-toggle-group", C = ({ pressed: e, onToggle: n, variant: a, tone: o, size: c, radius: l, disabled: u, checkmark: d, fullWidth: y, startIcon: x, endIcon: S, icon: C, children: w, className: T, onClick: E, ...D }) => {
|
|
50
51
|
let O = s(b), k = a ?? O?.variant ?? "solid", A = o ?? O?.tone ?? "primary", j = c ?? O?.size ?? "md", M = l ?? O?.radius, N = !!(u || O?.disabled), P = w == null && C != null, F = !P && (y ?? O?.fullWidth ?? !1), I = e && !P && (d ?? O?.checkmark ?? !1), L = typeof w == "string" || typeof w == "number" ? String(w) : void 0, R = (e) => {
|
|
51
|
-
E?.(e),
|
|
52
|
+
E?.(e), e.defaultPrevented || N || n();
|
|
52
53
|
};
|
|
53
54
|
return /* @__PURE__ */ p("button", {
|
|
54
55
|
...D,
|
|
@@ -56,12 +57,12 @@ var h = {
|
|
|
56
57
|
"aria-pressed": e,
|
|
57
58
|
disabled: N,
|
|
58
59
|
"data-state": e ? "on" : "off",
|
|
59
|
-
className:
|
|
60
|
+
className: t(i.root, h[k], g[A], _[j], M ? v[M] : i.radiusDefault, e && i.pressed, P && i.iconOnly, F && i.fullWidth, !N && i.interactive, N && i.disabled, T),
|
|
60
61
|
onClick: R,
|
|
61
62
|
children: /* @__PURE__ */ m("span", {
|
|
62
63
|
className: i.content,
|
|
63
64
|
children: [I && /* @__PURE__ */ p("span", {
|
|
64
|
-
className:
|
|
65
|
+
className: t(i.icon, i.check),
|
|
65
66
|
"aria-hidden": "true",
|
|
66
67
|
children: /* @__PURE__ */ p(r, {
|
|
67
68
|
name: "check",
|
|
@@ -125,7 +126,7 @@ var D = Object.assign(({ type: r, value: a, defaultValue: s, onValueChange: f, r
|
|
|
125
126
|
defaultValue: s ?? (L ? [] : null),
|
|
126
127
|
onChange: f
|
|
127
128
|
}), B = u(null), V = o((e) => {
|
|
128
|
-
B.current = e,
|
|
129
|
+
B.current = e, n(F, e);
|
|
129
130
|
}, [F]), [H, U] = d(null), W = l(() => Array.isArray(R) ? R : typeof R == "string" ? [R] : [], [R]), G = o((e) => W.includes(e), [W]), K = o((e) => {
|
|
130
131
|
z((t) => {
|
|
131
132
|
if (L) {
|
|
@@ -189,7 +190,7 @@ var D = Object.assign(({ type: r, value: a, defaultValue: s, onValueChange: f, r
|
|
|
189
190
|
"aria-orientation": C === "toolbar" ? g : void 0,
|
|
190
191
|
"aria-disabled": k ? !0 : void 0,
|
|
191
192
|
"data-orientation": g,
|
|
192
|
-
className:
|
|
193
|
+
className: t(i.group, Y && i.groupVertical, h ? Y ? i.attachedVertical : i.attachedHorizontal : y[_], h && i.attached, j && i.groupFullWidth, M),
|
|
193
194
|
onKeyDown: q,
|
|
194
195
|
children: /* @__PURE__ */ p(b.Provider, {
|
|
195
196
|
value: J,
|
|
@@ -197,5 +198,4 @@ var D = Object.assign(({ type: r, value: a, defaultValue: s, onValueChange: f, r
|
|
|
197
198
|
})
|
|
198
199
|
});
|
|
199
200
|
}, { Item: T });
|
|
200
|
-
//#endregion
|
|
201
201
|
export { w as ToggleButton, D as ToggleGroup, T as ToggleGroupItem };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/forms/ToggleGroup/ToggleGroup.module.css
|
|
2
2
|
var e = "_root_1x950_51", t = "_interactive_1x950_145", n = "_content_1x950_153", r = "_label_1x950_175", i = "_icon_1x950_211", a = "_check_1x950_237", o = "_pop_1x950_1", s = "_sm_1x950_269", c = "_md_1x950_285", l = "_lg_1x950_301", u = "_radiusDefault_1x950_319", d = "_radiusNone_1x950_325", f = "_radiusXs_1x950_331", p = "_radiusSm_1x950_337", m = "_radiusMd_1x950_343", h = "_radiusLg_1x950_349", g = "_radiusXl_1x950_355", _ = "_radius2xl_1x950_361", v = "_radiusPill_1x950_367", y = "_primary_1x950_383", b = "_neutral_1x950_405", x = "_accent_1x950_427", S = "_success_1x950_449", C = "_warning_1x950_471", w = "_danger_1x950_493", T = "_info_1x950_515", E = "_solid_1x950_539", D = "_outline_1x950_541", O = "_soft_1x950_549", k = "_pressed_1x950_563", A = "_ghost_1x950_557", j = "_iconOnly_1x950_699", M = "_fullWidth_1x950_713", N = "_disabled_1x950_727", P = "_group_1x950_801", F = "_groupVertical_1x950_815", I = "_groupFullWidth_1x950_827", L = "_gap0_1x950_845", R = "_gap1_1x950_851", z = "_gap2_1x950_857", B = "_gap3_1x950_863", V = "_gap4_1x950_869", H = "_gap5_1x950_875", U = "_gap6_1x950_881", W = "_gap8_1x950_887", G = "_gap10_1x950_893", K = "_gap12_1x950_899", q = "_gap16_1x950_905", J = "_gap20_1x950_911", Y = "_gap24_1x950_917", X = "_attached_1x950_927", Z = "_attachedHorizontal_1x950_965", Q = "_attachedVertical_1x950_1007", $ = {
|
|
3
3
|
root: e,
|
|
4
4
|
interactive: t,
|
|
@@ -54,5 +54,4 @@ var e = "_root_1x950_51", t = "_interactive_1x950_145", n = "_content_1x950_153"
|
|
|
54
54
|
attachedHorizontal: Z,
|
|
55
55
|
attachedVertical: Q
|
|
56
56
|
};
|
|
57
|
-
//#endregion
|
|
58
57
|
export { x as accent, X as attached, Z as attachedHorizontal, Q as attachedVertical, a as check, n as content, w as danger, $ as default, N as disabled, M as fullWidth, L as gap0, R as gap1, G as gap10, K as gap12, q as gap16, z as gap2, J as gap20, Y as gap24, B as gap3, V as gap4, H as gap5, U as gap6, W as gap8, A as ghost, P as group, I as groupFullWidth, F as groupVertical, i as icon, j as iconOnly, T as info, t as interactive, r as label, l as lg, c as md, b as neutral, D as outline, o as pop, k as pressed, y as primary, _ as radius2xl, u as radiusDefault, h as radiusLg, m as radiusMd, d as radiusNone, v as radiusPill, p as radiusSm, g as radiusXl, f as radiusXs, e as root, s as sm, O as soft, E as solid, S as success, C as warning };
|