@mortenbrudvik/waveui 0.4.0 → 0.7.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/README.md +1221 -173
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/components/button/Button.cjs +2 -0
- package/dist/components/button/Button.cjs.map +1 -0
- package/dist/components/button/Button.mjs +50 -0
- package/dist/components/button/Button.mjs.map +1 -0
- package/dist/components/button/Button.semantics.cjs +2 -0
- package/dist/components/button/Button.semantics.cjs.map +1 -0
- package/dist/components/button/Button.semantics.mjs +61 -0
- package/dist/components/button/Button.semantics.mjs.map +1 -0
- package/dist/components/button/Button.slots.cjs +2 -0
- package/dist/components/button/Button.slots.cjs.map +1 -0
- package/dist/components/button/Button.slots.mjs +47 -0
- package/dist/components/button/Button.slots.mjs.map +1 -0
- package/dist/components/button/CompoundButton.cjs +2 -0
- package/dist/components/button/CompoundButton.cjs.map +1 -0
- package/dist/components/button/CompoundButton.mjs +53 -0
- package/dist/components/button/CompoundButton.mjs.map +1 -0
- package/dist/components/button/Link.cjs +2 -0
- package/dist/components/button/Link.cjs.map +1 -0
- package/dist/components/button/Link.mjs +37 -0
- package/dist/components/button/Link.mjs.map +1 -0
- package/dist/components/button/MenuButton.cjs +2 -0
- package/dist/components/button/MenuButton.cjs.map +1 -0
- package/dist/components/button/MenuButton.mjs +45 -0
- package/dist/components/button/MenuButton.mjs.map +1 -0
- package/dist/components/button/SplitButton.cjs +2 -0
- package/dist/components/button/SplitButton.cjs.map +1 -0
- package/dist/components/button/SplitButton.mjs +66 -0
- package/dist/components/button/SplitButton.mjs.map +1 -0
- package/dist/components/button/ToggleButton.cjs +2 -0
- package/dist/components/button/ToggleButton.cjs.map +1 -0
- package/dist/components/button/ToggleButton.mjs +65 -0
- package/dist/components/button/ToggleButton.mjs.map +1 -0
- package/dist/components/button/Toolbar.cjs +2 -0
- package/dist/components/button/Toolbar.cjs.map +1 -0
- package/dist/components/button/Toolbar.context.cjs +2 -0
- package/dist/components/button/Toolbar.context.cjs.map +1 -0
- package/dist/components/button/Toolbar.context.mjs +31 -0
- package/dist/components/button/Toolbar.context.mjs.map +1 -0
- package/dist/components/button/Toolbar.mjs +63 -0
- package/dist/components/button/Toolbar.mjs.map +1 -0
- package/dist/components/button/Toolbar.parts.cjs +2 -0
- package/dist/components/button/Toolbar.parts.cjs.map +1 -0
- package/dist/components/button/Toolbar.parts.mjs +131 -0
- package/dist/components/button/Toolbar.parts.mjs.map +1 -0
- package/dist/components/button/buttonStyles.cjs +2 -0
- package/dist/components/button/buttonStyles.cjs.map +1 -0
- package/dist/components/button/buttonStyles.mjs +39 -0
- package/dist/components/button/buttonStyles.mjs.map +1 -0
- package/dist/components/data-display/Avatar.cjs +2 -0
- package/dist/components/data-display/Avatar.cjs.map +1 -0
- package/dist/components/data-display/Avatar.mjs +157 -0
- package/dist/components/data-display/Avatar.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.mjs +134 -0
- package/dist/components/data-display/AvatarGroup.mjs.map +1 -0
- package/dist/components/data-display/Badge.cjs +2 -0
- package/dist/components/data-display/Badge.cjs.map +1 -0
- package/dist/components/data-display/Badge.colors.cjs +2 -0
- package/dist/components/data-display/Badge.colors.cjs.map +1 -0
- package/dist/components/data-display/Badge.colors.mjs +58 -0
- package/dist/components/data-display/Badge.colors.mjs.map +1 -0
- package/dist/components/data-display/Badge.mjs +32 -0
- package/dist/components/data-display/Badge.mjs.map +1 -0
- package/dist/components/data-display/CounterBadge.cjs +2 -0
- package/dist/components/data-display/CounterBadge.cjs.map +1 -0
- package/dist/components/data-display/CounterBadge.mjs +28 -0
- package/dist/components/data-display/CounterBadge.mjs.map +1 -0
- package/dist/components/data-display/Divider.cjs +2 -0
- package/dist/components/data-display/Divider.cjs.map +1 -0
- package/dist/components/data-display/Divider.mjs +52 -0
- package/dist/components/data-display/Divider.mjs.map +1 -0
- package/dist/components/data-display/Image.cjs +2 -0
- package/dist/components/data-display/Image.cjs.map +1 -0
- package/dist/components/data-display/Image.mjs +32 -0
- package/dist/components/data-display/Image.mjs.map +1 -0
- package/dist/components/data-display/InfoLabel.cjs +2 -0
- package/dist/components/data-display/InfoLabel.cjs.map +1 -0
- package/dist/components/data-display/InfoLabel.mjs +104 -0
- package/dist/components/data-display/InfoLabel.mjs.map +1 -0
- package/dist/components/data-display/List.cjs +2 -0
- package/dist/components/data-display/List.cjs.map +1 -0
- package/dist/components/data-display/List.mjs +381 -0
- package/dist/components/data-display/List.mjs.map +1 -0
- package/dist/components/data-display/List.registry.cjs +2 -0
- package/dist/components/data-display/List.registry.cjs.map +1 -0
- package/dist/components/data-display/List.registry.mjs +101 -0
- package/dist/components/data-display/List.registry.mjs.map +1 -0
- package/dist/components/data-display/Persona.cjs +2 -0
- package/dist/components/data-display/Persona.cjs.map +1 -0
- package/dist/components/data-display/Persona.mjs +48 -0
- package/dist/components/data-display/Persona.mjs.map +1 -0
- package/dist/components/data-display/PresenceBadge.cjs +2 -0
- package/dist/components/data-display/PresenceBadge.cjs.map +1 -0
- package/dist/components/data-display/PresenceBadge.mjs +71 -0
- package/dist/components/data-display/PresenceBadge.mjs.map +1 -0
- package/dist/components/data-display/Tag.cjs +2 -0
- package/dist/components/data-display/Tag.cjs.map +1 -0
- package/dist/components/data-display/Tag.mjs +147 -0
- package/dist/components/data-display/Tag.mjs.map +1 -0
- package/dist/components/feedback/MessageBar.cjs +2 -0
- package/dist/components/feedback/MessageBar.cjs.map +1 -0
- package/dist/components/feedback/MessageBar.mjs +144 -0
- package/dist/components/feedback/MessageBar.mjs.map +1 -0
- package/dist/components/feedback/MessageBar.status.cjs +2 -0
- package/dist/components/feedback/MessageBar.status.cjs.map +1 -0
- package/dist/components/feedback/MessageBar.status.mjs +45 -0
- package/dist/components/feedback/MessageBar.status.mjs.map +1 -0
- package/dist/components/feedback/ProgressBar.cjs +2 -0
- package/dist/components/feedback/ProgressBar.cjs.map +1 -0
- package/dist/components/feedback/ProgressBar.mjs +72 -0
- package/dist/components/feedback/ProgressBar.mjs.map +1 -0
- package/dist/components/feedback/Skeleton.cjs +2 -0
- package/dist/components/feedback/Skeleton.cjs.map +1 -0
- package/dist/components/feedback/Skeleton.mjs +47 -0
- package/dist/components/feedback/Skeleton.mjs.map +1 -0
- package/dist/components/feedback/Spinner.cjs +2 -0
- package/dist/components/feedback/Spinner.cjs.map +1 -0
- package/dist/components/feedback/Spinner.mjs +60 -0
- package/dist/components/feedback/Spinner.mjs.map +1 -0
- package/dist/components/feedback/Toast.cjs +2 -0
- package/dist/components/feedback/Toast.cjs.map +1 -0
- package/dist/components/feedback/Toast.mjs +347 -0
- package/dist/components/feedback/Toast.mjs.map +1 -0
- package/dist/components/input/Checkbox.cjs +2 -0
- package/dist/components/input/Checkbox.cjs.map +1 -0
- package/dist/components/input/Checkbox.mjs +96 -0
- package/dist/components/input/Checkbox.mjs.map +1 -0
- package/dist/components/input/ColorPicker.cjs +6 -0
- package/dist/components/input/ColorPicker.cjs.map +1 -0
- package/dist/components/input/ColorPicker.mjs +236 -0
- package/dist/components/input/ColorPicker.mjs.map +1 -0
- package/dist/components/input/Combobox.cjs +2 -0
- package/dist/components/input/Combobox.cjs.map +1 -0
- package/dist/components/input/Combobox.expand.cjs +2 -0
- package/dist/components/input/Combobox.expand.cjs.map +1 -0
- package/dist/components/input/Combobox.expand.mjs +38 -0
- package/dist/components/input/Combobox.expand.mjs.map +1 -0
- package/dist/components/input/Combobox.mjs +187 -0
- package/dist/components/input/Combobox.mjs.map +1 -0
- package/dist/components/input/DatePicker.cjs +2 -0
- package/dist/components/input/DatePicker.cjs.map +1 -0
- package/dist/components/input/DatePicker.mjs +340 -0
- package/dist/components/input/DatePicker.mjs.map +1 -0
- package/dist/components/input/Dropdown.cjs +2 -0
- package/dist/components/input/Dropdown.cjs.map +1 -0
- package/dist/components/input/Dropdown.mjs +128 -0
- package/dist/components/input/Dropdown.mjs.map +1 -0
- package/dist/components/input/Field.cjs +2 -0
- package/dist/components/input/Field.cjs.map +1 -0
- package/dist/components/input/Field.mjs +200 -0
- package/dist/components/input/Field.mjs.map +1 -0
- package/dist/components/input/Input.cjs +2 -0
- package/dist/components/input/Input.cjs.map +1 -0
- package/dist/components/input/Input.mjs +81 -0
- package/dist/components/input/Input.mjs.map +1 -0
- package/dist/components/input/Label.cjs +2 -0
- package/dist/components/input/Label.cjs.map +1 -0
- package/dist/components/input/Label.mjs +28 -0
- package/dist/components/input/Label.mjs.map +1 -0
- package/dist/components/input/Option.cjs +2 -0
- package/dist/components/input/Option.cjs.map +1 -0
- package/dist/components/input/Option.mjs +169 -0
- package/dist/components/input/Option.mjs.map +1 -0
- package/dist/components/input/RadioGroup.cjs +2 -0
- package/dist/components/input/RadioGroup.cjs.map +1 -0
- package/dist/components/input/RadioGroup.mjs +139 -0
- package/dist/components/input/RadioGroup.mjs.map +1 -0
- package/dist/components/input/Rating.cjs +2 -0
- package/dist/components/input/Rating.cjs.map +1 -0
- package/dist/components/input/Rating.mjs +196 -0
- package/dist/components/input/Rating.mjs.map +1 -0
- package/dist/components/input/SearchBox.cjs +2 -0
- package/dist/components/input/SearchBox.cjs.map +1 -0
- package/dist/components/input/SearchBox.mjs +205 -0
- package/dist/components/input/SearchBox.mjs.map +1 -0
- package/dist/components/input/Select.cjs +2 -0
- package/dist/components/input/Select.cjs.map +1 -0
- package/dist/components/input/Select.mjs +33 -0
- package/dist/components/input/Select.mjs.map +1 -0
- package/dist/components/input/Slider.cjs +2 -0
- package/dist/components/input/Slider.cjs.map +1 -0
- package/dist/components/input/Slider.mjs +79 -0
- package/dist/components/input/Slider.mjs.map +1 -0
- package/dist/components/input/SpinButton.cjs +2 -0
- package/dist/components/input/SpinButton.cjs.map +1 -0
- package/dist/components/input/SpinButton.mjs +157 -0
- package/dist/components/input/SpinButton.mjs.map +1 -0
- package/dist/components/input/SwatchPicker.cjs +2 -0
- package/dist/components/input/SwatchPicker.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.mjs +113 -0
- package/dist/components/input/SwatchPicker.mjs.map +1 -0
- package/dist/components/input/Switch.cjs +2 -0
- package/dist/components/input/Switch.cjs.map +1 -0
- package/dist/components/input/Switch.mjs +92 -0
- package/dist/components/input/Switch.mjs.map +1 -0
- package/dist/components/input/TagPicker.cjs +2 -0
- package/dist/components/input/TagPicker.cjs.map +1 -0
- package/dist/components/input/TagPicker.mjs +249 -0
- package/dist/components/input/TagPicker.mjs.map +1 -0
- package/dist/components/input/Textarea.cjs +2 -0
- package/dist/components/input/Textarea.cjs.map +1 -0
- package/dist/components/input/Textarea.mjs +32 -0
- package/dist/components/input/Textarea.mjs.map +1 -0
- package/dist/components/input/TimePicker.cjs +2 -0
- package/dist/components/input/TimePicker.cjs.map +1 -0
- package/dist/components/input/TimePicker.mjs +292 -0
- package/dist/components/input/TimePicker.mjs.map +1 -0
- package/dist/components/input/colorUtils.cjs +2 -0
- package/dist/components/input/colorUtils.cjs.map +1 -0
- package/dist/components/input/colorUtils.mjs +96 -0
- package/dist/components/input/colorUtils.mjs.map +1 -0
- package/dist/components/input/dateUtils.cjs +2 -0
- package/dist/components/input/dateUtils.cjs.map +1 -0
- package/dist/components/input/dateUtils.mjs +250 -0
- package/dist/components/input/dateUtils.mjs.map +1 -0
- package/dist/components/input/pickerStyles.cjs +2 -0
- package/dist/components/input/pickerStyles.cjs.map +1 -0
- package/dist/components/input/pickerStyles.mjs +10 -0
- package/dist/components/input/pickerStyles.mjs.map +1 -0
- package/dist/components/internal/HiddenInput.cjs +2 -0
- package/dist/components/internal/HiddenInput.cjs.map +1 -0
- package/dist/components/internal/HiddenInput.mjs +88 -0
- package/dist/components/internal/HiddenInput.mjs.map +1 -0
- package/dist/components/layout/Accordion.cjs +2 -0
- package/dist/components/layout/Accordion.cjs.map +1 -0
- package/dist/components/layout/Accordion.mjs +236 -0
- package/dist/components/layout/Accordion.mjs.map +1 -0
- package/dist/components/layout/Card.cjs +2 -0
- package/dist/components/layout/Card.cjs.map +1 -0
- package/dist/components/layout/Card.mjs +121 -0
- package/dist/components/layout/Card.mjs.map +1 -0
- package/dist/components/layout/Carousel.cjs +2 -0
- package/dist/components/layout/Carousel.cjs.map +1 -0
- package/dist/components/layout/Carousel.mjs +205 -0
- package/dist/components/layout/Carousel.mjs.map +1 -0
- package/dist/components/layout/Flex.cjs +2 -0
- package/dist/components/layout/Flex.cjs.map +1 -0
- package/dist/components/layout/Flex.mjs +54 -0
- package/dist/components/layout/Flex.mjs.map +1 -0
- package/dist/components/layout/Grid.cjs +2 -0
- package/dist/components/layout/Grid.cjs.map +1 -0
- package/dist/components/layout/Grid.mjs +62 -0
- package/dist/components/layout/Grid.mjs.map +1 -0
- package/dist/components/layout/Overflow.cjs +2 -0
- package/dist/components/layout/Overflow.cjs.map +1 -0
- package/dist/components/layout/Overflow.mjs +269 -0
- package/dist/components/layout/Overflow.mjs.map +1 -0
- package/dist/components/layout/Stack.cjs +2 -0
- package/dist/components/layout/Stack.cjs.map +1 -0
- package/dist/components/layout/Stack.mjs +39 -0
- package/dist/components/layout/Stack.mjs.map +1 -0
- package/dist/components/layout/TabList.cjs +2 -0
- package/dist/components/layout/TabList.cjs.map +1 -0
- package/dist/components/layout/TabList.mjs +238 -0
- package/dist/components/layout/TabList.mjs.map +1 -0
- package/dist/components/layout/Tree.cjs +2 -0
- package/dist/components/layout/Tree.cjs.map +1 -0
- package/dist/components/layout/Tree.mjs +220 -0
- package/dist/components/layout/Tree.mjs.map +1 -0
- package/dist/components/layout/disclosureIds.cjs +2 -0
- package/dist/components/layout/disclosureIds.cjs.map +1 -0
- package/dist/components/layout/disclosureIds.mjs +12 -0
- package/dist/components/layout/disclosureIds.mjs.map +1 -0
- package/dist/components/motion/Presence.cjs +2 -0
- package/dist/components/motion/Presence.cjs.map +1 -0
- package/dist/components/motion/Presence.mjs +35 -0
- package/dist/components/motion/Presence.mjs.map +1 -0
- package/dist/components/navigation/Breadcrumb.cjs +2 -0
- package/dist/components/navigation/Breadcrumb.cjs.map +1 -0
- package/dist/components/navigation/Breadcrumb.mjs +144 -0
- package/dist/components/navigation/Breadcrumb.mjs.map +1 -0
- package/dist/components/navigation/Menu.cjs +2 -0
- package/dist/components/navigation/Menu.cjs.map +1 -0
- package/dist/components/navigation/Menu.context.cjs +2 -0
- package/dist/components/navigation/Menu.context.cjs.map +1 -0
- package/dist/components/navigation/Menu.context.mjs +82 -0
- package/dist/components/navigation/Menu.context.mjs.map +1 -0
- package/dist/components/navigation/Menu.group.cjs +2 -0
- package/dist/components/navigation/Menu.group.cjs.map +1 -0
- package/dist/components/navigation/Menu.group.mjs +58 -0
- package/dist/components/navigation/Menu.group.mjs.map +1 -0
- package/dist/components/navigation/Menu.items.cjs +2 -0
- package/dist/components/navigation/Menu.items.cjs.map +1 -0
- package/dist/components/navigation/Menu.items.mjs +127 -0
- package/dist/components/navigation/Menu.items.mjs.map +1 -0
- package/dist/components/navigation/Menu.link.cjs +2 -0
- package/dist/components/navigation/Menu.link.cjs.map +1 -0
- package/dist/components/navigation/Menu.link.mjs +41 -0
- package/dist/components/navigation/Menu.link.mjs.map +1 -0
- package/dist/components/navigation/Menu.mjs +27 -0
- package/dist/components/navigation/Menu.mjs.map +1 -0
- package/dist/components/navigation/Menu.popover.cjs +2 -0
- package/dist/components/navigation/Menu.popover.cjs.map +1 -0
- package/dist/components/navigation/Menu.popover.mjs +231 -0
- package/dist/components/navigation/Menu.popover.mjs.map +1 -0
- package/dist/components/navigation/Menu.root.cjs +2 -0
- package/dist/components/navigation/Menu.root.cjs.map +1 -0
- package/dist/components/navigation/Menu.root.mjs +308 -0
- package/dist/components/navigation/Menu.root.mjs.map +1 -0
- package/dist/components/navigation/Menu.selectable.cjs +2 -0
- package/dist/components/navigation/Menu.selectable.cjs.map +1 -0
- package/dist/components/navigation/Menu.selectable.mjs +89 -0
- package/dist/components/navigation/Menu.selectable.mjs.map +1 -0
- package/dist/components/navigation/Menu.shared.cjs +2 -0
- package/dist/components/navigation/Menu.shared.cjs.map +1 -0
- package/dist/components/navigation/Menu.shared.mjs +23 -0
- package/dist/components/navigation/Menu.shared.mjs.map +1 -0
- package/dist/components/navigation/Menu.splitGroup.cjs +2 -0
- package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -0
- package/dist/components/navigation/Menu.splitGroup.mjs +51 -0
- package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -0
- package/dist/components/navigation/Menu.trigger.cjs +2 -0
- package/dist/components/navigation/Menu.trigger.cjs.map +1 -0
- package/dist/components/navigation/Menu.trigger.mjs +79 -0
- package/dist/components/navigation/Menu.trigger.mjs.map +1 -0
- package/dist/components/navigation/Nav.cjs +2 -0
- package/dist/components/navigation/Nav.cjs.map +1 -0
- package/dist/components/navigation/Nav.mjs +276 -0
- package/dist/components/navigation/Nav.mjs.map +1 -0
- package/dist/components/navigation/Pagination.cjs +2 -0
- package/dist/components/navigation/Pagination.cjs.map +1 -0
- package/dist/components/navigation/Pagination.mjs +110 -0
- package/dist/components/navigation/Pagination.mjs.map +1 -0
- package/dist/components/navigation/Stepper.cjs +2 -0
- package/dist/components/navigation/Stepper.cjs.map +1 -0
- package/dist/components/navigation/Stepper.mjs +204 -0
- package/dist/components/navigation/Stepper.mjs.map +1 -0
- package/dist/components/overlays/Dialog.cjs +2 -0
- package/dist/components/overlays/Dialog.cjs.map +1 -0
- package/dist/components/overlays/Dialog.mjs +180 -0
- package/dist/components/overlays/Dialog.mjs.map +1 -0
- package/dist/components/overlays/Dialog.shared.cjs +2 -0
- package/dist/components/overlays/Dialog.shared.cjs.map +1 -0
- package/dist/components/overlays/Dialog.shared.mjs +227 -0
- package/dist/components/overlays/Dialog.shared.mjs.map +1 -0
- package/dist/components/overlays/Drawer.cjs +2 -0
- package/dist/components/overlays/Drawer.cjs.map +1 -0
- package/dist/components/overlays/Drawer.mjs +192 -0
- package/dist/components/overlays/Drawer.mjs.map +1 -0
- package/dist/components/overlays/Popover.cjs +2 -0
- package/dist/components/overlays/Popover.cjs.map +1 -0
- package/dist/components/overlays/Popover.mjs +365 -0
- package/dist/components/overlays/Popover.mjs.map +1 -0
- package/dist/components/overlays/Popover.shared.cjs +2 -0
- package/dist/components/overlays/Popover.shared.cjs.map +1 -0
- package/dist/components/overlays/Popover.shared.mjs +182 -0
- package/dist/components/overlays/Popover.shared.mjs.map +1 -0
- package/dist/components/overlays/TeachingPopover.cjs +2 -0
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -0
- package/dist/components/overlays/TeachingPopover.mjs +181 -0
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -0
- package/dist/components/overlays/Tooltip.cjs +2 -0
- package/dist/components/overlays/Tooltip.cjs.map +1 -0
- package/dist/components/overlays/Tooltip.mjs +160 -0
- package/dist/components/overlays/Tooltip.mjs.map +1 -0
- package/dist/components/portal/Portal.cjs +2 -0
- package/dist/components/portal/Portal.cjs.map +1 -0
- package/dist/components/portal/Portal.mjs +45 -0
- package/dist/components/portal/Portal.mjs.map +1 -0
- package/dist/components/provider/WaveProvider.cjs +2 -0
- package/dist/components/provider/WaveProvider.cjs.map +1 -0
- package/dist/components/provider/WaveProvider.mjs +51 -0
- package/dist/components/provider/WaveProvider.mjs.map +1 -0
- package/dist/components/table/DataGrid.cjs +2 -0
- package/dist/components/table/DataGrid.cjs.map +1 -0
- package/dist/components/table/DataGrid.mjs +489 -0
- package/dist/components/table/DataGrid.mjs.map +1 -0
- package/dist/components/table/Table.cjs +2 -0
- package/dist/components/table/Table.cjs.map +1 -0
- package/dist/components/table/Table.mjs +99 -0
- package/dist/components/table/Table.mjs.map +1 -0
- package/dist/components/table/useGridNavigation.cjs +2 -0
- package/dist/components/table/useGridNavigation.cjs.map +1 -0
- package/dist/components/table/useGridNavigation.mjs +336 -0
- package/dist/components/table/useGridNavigation.mjs.map +1 -0
- package/dist/components/typography/Text.cjs +2 -0
- package/dist/components/typography/Text.cjs.map +1 -0
- package/dist/components/typography/Text.mjs +38 -0
- package/dist/components/typography/Text.mjs.map +1 -0
- package/dist/hooks/useAnnounce.cjs +2 -0
- package/dist/hooks/useAnnounce.cjs.map +1 -0
- package/dist/hooks/useAnnounce.mjs +88 -0
- package/dist/hooks/useAnnounce.mjs.map +1 -0
- package/dist/hooks/useCheckedValues.cjs +2 -0
- package/dist/hooks/useCheckedValues.cjs.map +1 -0
- package/dist/hooks/useCheckedValues.mjs +102 -0
- package/dist/hooks/useCheckedValues.mjs.map +1 -0
- package/dist/hooks/useContextMenuAnchor.cjs +2 -0
- package/dist/hooks/useContextMenuAnchor.cjs.map +1 -0
- package/dist/hooks/useContextMenuAnchor.mjs +132 -0
- package/dist/hooks/useContextMenuAnchor.mjs.map +1 -0
- package/dist/hooks/useControllable.cjs +2 -0
- package/dist/hooks/useControllable.cjs.map +1 -0
- package/dist/hooks/useControllable.mjs +37 -0
- package/dist/hooks/useControllable.mjs.map +1 -0
- package/dist/hooks/useDirection.cjs +2 -0
- package/dist/hooks/useDirection.cjs.map +1 -0
- package/dist/hooks/useDirection.mjs +57 -0
- package/dist/hooks/useDirection.mjs.map +1 -0
- package/dist/hooks/useDismiss.cjs +2 -0
- package/dist/hooks/useDismiss.cjs.map +1 -0
- package/dist/hooks/useDismiss.mjs +57 -0
- package/dist/hooks/useDismiss.mjs.map +1 -0
- package/dist/hooks/useEventCallback.cjs +2 -0
- package/dist/hooks/useEventCallback.cjs.map +1 -0
- package/dist/hooks/useEventCallback.mjs +16 -0
- package/dist/hooks/useEventCallback.mjs.map +1 -0
- package/dist/hooks/useFieldControl.cjs +2 -0
- package/dist/hooks/useFieldControl.cjs.map +1 -0
- package/dist/hooks/useFieldControl.mjs +62 -0
- package/dist/hooks/useFieldControl.mjs.map +1 -0
- package/dist/hooks/useFocusTrap.cjs +2 -0
- package/dist/hooks/useFocusTrap.cjs.map +1 -0
- package/dist/hooks/useFocusTrap.mjs +266 -0
- package/dist/hooks/useFocusTrap.mjs.map +1 -0
- package/dist/hooks/useFormReset.cjs +2 -0
- package/dist/hooks/useFormReset.cjs.map +1 -0
- package/dist/hooks/useFormReset.mjs +33 -0
- package/dist/hooks/useFormReset.mjs.map +1 -0
- package/dist/hooks/useHoverIntent.cjs +2 -0
- package/dist/hooks/useHoverIntent.cjs.map +1 -0
- package/dist/hooks/useHoverIntent.mjs +201 -0
- package/dist/hooks/useHoverIntent.mjs.map +1 -0
- package/dist/hooks/useId.cjs +2 -0
- package/dist/hooks/useId.cjs.map +1 -0
- package/dist/hooks/useId.mjs +11 -0
- package/dist/hooks/useId.mjs.map +1 -0
- package/dist/hooks/useIsClient.cjs +2 -0
- package/dist/hooks/useIsClient.cjs.map +1 -0
- package/dist/hooks/useIsClient.mjs +19 -0
- package/dist/hooks/useIsClient.mjs.map +1 -0
- package/dist/hooks/useListbox.cjs +2 -0
- package/dist/hooks/useListbox.cjs.map +1 -0
- package/dist/hooks/useListbox.mjs +492 -0
- package/dist/hooks/useListbox.mjs.map +1 -0
- package/dist/hooks/useMergedRefs.cjs +2 -0
- package/dist/hooks/useMergedRefs.cjs.map +1 -0
- package/dist/hooks/useMergedRefs.mjs +57 -0
- package/dist/hooks/useMergedRefs.mjs.map +1 -0
- package/dist/hooks/useModalIsolation.cjs +2 -0
- package/dist/hooks/useModalIsolation.cjs.map +1 -0
- package/dist/hooks/useModalIsolation.mjs +87 -0
- package/dist/hooks/useModalIsolation.mjs.map +1 -0
- package/dist/hooks/useModalLayer.cjs +2 -0
- package/dist/hooks/useModalLayer.cjs.map +1 -0
- package/dist/hooks/useModalLayer.mjs +30 -0
- package/dist/hooks/useModalLayer.mjs.map +1 -0
- package/dist/hooks/usePopupPosition.cjs +2 -0
- package/dist/hooks/usePopupPosition.cjs.map +1 -0
- package/dist/hooks/usePopupPosition.mjs +117 -0
- package/dist/hooks/usePopupPosition.mjs.map +1 -0
- package/dist/hooks/usePrefersReducedMotion.cjs +2 -0
- package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -0
- package/dist/hooks/usePrefersReducedMotion.mjs +24 -0
- package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -0
- package/dist/hooks/usePresence.cjs +2 -0
- package/dist/hooks/usePresence.cjs.map +1 -0
- package/dist/hooks/usePresence.mjs +136 -0
- package/dist/hooks/usePresence.mjs.map +1 -0
- package/dist/hooks/usePreserveFocus.cjs +2 -0
- package/dist/hooks/usePreserveFocus.cjs.map +1 -0
- package/dist/hooks/usePreserveFocus.mjs +50 -0
- package/dist/hooks/usePreserveFocus.mjs.map +1 -0
- package/dist/hooks/useRestoreFocus.cjs +2 -0
- package/dist/hooks/useRestoreFocus.cjs.map +1 -0
- package/dist/hooks/useRestoreFocus.mjs +271 -0
- package/dist/hooks/useRestoreFocus.mjs.map +1 -0
- package/dist/hooks/useRovingTabIndex.cjs +2 -0
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -0
- package/dist/hooks/useRovingTabIndex.mjs +389 -0
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -0
- package/dist/hooks/useScrollLock.cjs +2 -0
- package/dist/hooks/useScrollLock.cjs.map +1 -0
- package/dist/hooks/useScrollLock.mjs +71 -0
- package/dist/hooks/useScrollLock.mjs.map +1 -0
- package/dist/hooks/useTriggerElement.cjs +2 -0
- package/dist/hooks/useTriggerElement.cjs.map +1 -0
- package/dist/hooks/useTriggerElement.mjs +126 -0
- package/dist/hooks/useTriggerElement.mjs.map +1 -0
- package/dist/hooks/useTypeahead.cjs +2 -0
- package/dist/hooks/useTypeahead.cjs.map +1 -0
- package/dist/hooks/useTypeahead.mjs +38 -0
- package/dist/hooks/useTypeahead.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +9099 -0
- package/dist/index.d.ts +7688 -1027
- package/dist/index.mjs +91 -5695
- package/dist/lib/aria.cjs +2 -0
- package/dist/lib/aria.cjs.map +1 -0
- package/dist/lib/aria.mjs +29 -0
- package/dist/lib/aria.mjs.map +1 -0
- package/dist/lib/children.cjs +2 -0
- package/dist/lib/children.cjs.map +1 -0
- package/dist/lib/children.mjs +37 -0
- package/dist/lib/children.mjs.map +1 -0
- package/dist/lib/cn.cjs +2 -0
- package/dist/lib/cn.cjs.map +1 -0
- package/dist/lib/cn.mjs +64 -0
- package/dist/lib/cn.mjs.map +1 -0
- package/dist/lib/composeEventHandlers.cjs +2 -0
- package/dist/lib/composeEventHandlers.cjs.map +1 -0
- package/dist/lib/composeEventHandlers.mjs +11 -0
- package/dist/lib/composeEventHandlers.mjs.map +1 -0
- package/dist/lib/dev.cjs +2 -0
- package/dist/lib/dev.cjs.map +1 -0
- package/dist/lib/dev.mjs +42 -0
- package/dist/lib/dev.mjs.map +1 -0
- package/dist/lib/direction.cjs +2 -0
- package/dist/lib/direction.cjs.map +1 -0
- package/dist/lib/direction.mjs +35 -0
- package/dist/lib/direction.mjs.map +1 -0
- package/dist/lib/events.cjs +2 -0
- package/dist/lib/events.cjs.map +1 -0
- package/dist/lib/events.mjs +31 -0
- package/dist/lib/events.mjs.map +1 -0
- package/dist/lib/focus.cjs +2 -0
- package/dist/lib/focus.cjs.map +1 -0
- package/dist/lib/focus.mjs +119 -0
- package/dist/lib/focus.mjs.map +1 -0
- package/dist/lib/globalRegistry.cjs +2 -0
- package/dist/lib/globalRegistry.cjs.map +1 -0
- package/dist/lib/globalRegistry.mjs +13 -0
- package/dist/lib/globalRegistry.mjs.map +1 -0
- package/dist/lib/icons.cjs +2 -0
- package/dist/lib/icons.cjs.map +1 -0
- package/dist/lib/icons.mjs +254 -0
- package/dist/lib/icons.mjs.map +1 -0
- package/dist/lib/labelInName.cjs +2 -0
- package/dist/lib/labelInName.cjs.map +1 -0
- package/dist/lib/labelInName.mjs +54 -0
- package/dist/lib/labelInName.mjs.map +1 -0
- package/dist/lib/layers.cjs +2 -0
- package/dist/lib/layers.cjs.map +1 -0
- package/dist/lib/layers.mjs +224 -0
- package/dist/lib/layers.mjs.map +1 -0
- package/dist/lib/mergeProps.cjs +2 -0
- package/dist/lib/mergeProps.cjs.map +1 -0
- package/dist/lib/mergeProps.mjs +21 -0
- package/dist/lib/mergeProps.mjs.map +1 -0
- package/dist/lib/mergeRefs.cjs +2 -0
- package/dist/lib/mergeRefs.cjs.map +1 -0
- package/dist/lib/mergeRefs.mjs +29 -0
- package/dist/lib/mergeRefs.mjs.map +1 -0
- package/dist/lib/renderTrigger.cjs +2 -0
- package/dist/lib/renderTrigger.cjs.map +1 -0
- package/dist/lib/renderTrigger.mjs +29 -0
- package/dist/lib/renderTrigger.mjs.map +1 -0
- package/dist/lib/slot.cjs +2 -0
- package/dist/lib/slot.cjs.map +1 -0
- package/dist/lib/slot.mjs +122 -0
- package/dist/lib/slot.mjs.map +1 -0
- package/dist/lib/styles.cjs +2 -0
- package/dist/lib/styles.cjs.map +1 -0
- package/dist/lib/styles.mjs +16 -0
- package/dist/lib/styles.mjs.map +1 -0
- package/dist/lib/theme.cjs +2 -0
- package/dist/lib/theme.cjs.map +1 -0
- package/dist/lib/theme.mjs +16 -0
- package/dist/lib/theme.mjs.map +1 -0
- package/dist/preflight.css +2 -0
- package/dist/styles.css +2 -0
- package/package.json +149 -100
- package/src/styles/animations.css +7 -39
- package/src/styles/base.css +103 -0
- package/src/styles/globals.css +10 -22
- package/src/styles/legacy-tokens.css +184 -0
- package/src/styles/preflight.css +7 -0
- package/src/styles/styles.css +32 -0
- package/src/styles/tailwind.css +17 -0
- package/src/styles/tokens.css +561 -221
- package/src/styles/variants.css +29 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorUtils.cjs","names":["BLACK","WHITE","HEX_COLOR","HEX_INPUT","HEX_DRAFT","clamp","max","min","value","toHexByte","fromDigits","lower","digits","d","parseHexColor","match","parseHexInput","text","isHexDraft","formatHexColor","byte","alpha","rgb","normalizeHexColor","parsed","alphaToOpacity","opacityToAlpha","opacity","parseChannel","percent","token","parseAlpha","RGB_FUNCTION","parseCssColor","hex","n","channelsPart","alphaPart","tokens","t","alphaToken","r","g","b","a","linearize","c","channel","getRelativeLuminance","color","getCheckColors","luminance"],"sources":["../../../src/components/input/colorUtils.ts"],"sourcesContent":["/**\n * Color helpers for ColorPicker and SwatchPicker: hex parsing/normalisation, the alpha byte ↔\n * opacity percentage, and the luminance-picked check glyph drawn on a user-supplied swatch.\n *\n * Internal (not exported from the package). Pure functions, no DOM access, so they run on the\n * server and in tests.\n */\n\n/** A parsed hex color: the `#rrggbb` part (lowercase) and the alpha byte (0–255). */\nexport interface HexColor {\n /** `#rrggbb`, lowercase. */\n rgb: string;\n /** Alpha byte, 0 (transparent) … 255 (opaque). */\n alpha: number;\n}\n\n/** An sRGB color with 0–255 channels and a 0–1 alpha. */\nexport interface RgbaColor {\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\n/** Colors of the selected-swatch check glyph: the glyph and the halo drawn under it. */\nexport interface CheckColors {\n glyph: string;\n halo: string;\n}\n\n// wave-allow-color: luminance-picked check glyph on a user swatch (C-TOKENS exception, input-pickers#16)\nconst BLACK = '#000000';\n// wave-allow-color: luminance-picked check glyph on a user swatch (C-TOKENS exception, input-pickers#16)\nconst WHITE = '#ffffff';\n\nconst HEX_COLOR = /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;\nconst HEX_INPUT = /^#([0-9a-f]{6}|[0-9a-f]{8})$/i;\nconst HEX_DRAFT = /^#?[0-9a-f]{0,8}$/i;\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value));\n}\n\nfunction toHexByte(value: number): string {\n return Math.round(clamp(value, 0, 255))\n .toString(16)\n .padStart(2, '0');\n}\n\nfunction fromDigits(digits: string): HexColor {\n const long =\n digits.length <= 4\n ? digits\n .split('')\n .map((d) => d + d)\n .join('')\n : digits;\n const lower = long.toLowerCase();\n return {\n rgb: `#${lower.slice(0, 6)}`,\n alpha: lower.length === 8 ? parseInt(lower.slice(6, 8), 16) : 255,\n };\n}\n\n/**\n * Parses a hex color (`#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`, case-insensitive, surrounding\n * whitespace ignored). Returns `null` for anything else (named colors, `rgb()`, a missing `#`).\n *\n * @example parseHexColor('#0F6CBD80') // { rgb: '#0f6cbd', alpha: 128 }\n */\nexport function parseHexColor(value: string): HexColor | null {\n const match = HEX_COLOR.exec(value.trim());\n return match ? fromDigits(match[1]) : null;\n}\n\n/**\n * Parses text typed into a hex field: only complete `#rrggbb` / `#rrggbbaa` values are accepted,\n * so the short forms a user passes through while typing (`#abc`) are never committed.\n */\nexport function parseHexInput(text: string): HexColor | null {\n const match = HEX_INPUT.exec(text.trim());\n return match ? fromDigits(match[1]) : null;\n}\n\n/**\n * Whether typed text can still become a hex color by typing more characters (an optional `#`\n * followed by at most 8 hex digits; surrounding whitespace ignored, like the parsers). `false`\n * means the text is invalid whatever follows.\n */\nexport function isHexDraft(text: string): boolean {\n return HEX_DRAFT.test(text.trim());\n}\n\n/**\n * Formats `#rrggbb` plus an alpha byte: `#rrggbb` when opaque (`alpha` 255, the default),\n * `#rrggbbaa` otherwise. The alpha byte is rounded and clamped to 0–255.\n */\nexport function formatHexColor(rgb: string, alpha = 255): string {\n const byte = Math.round(clamp(alpha, 0, 255));\n return byte === 255 ? rgb : rgb + toHexByte(byte);\n}\n\n/**\n * A hex color in the one form ColorPicker reports: `#rrggbb` in lower case, or `#rrggbbaa` when\n * the alpha byte is not 255 (short forms expanded, surrounding whitespace dropped). Returns `null`\n * for anything {@link parseHexColor} rejects.\n *\n * @example normalizeHexColor('#ABC') // '#aabbcc'\n * @example normalizeHexColor('#0f6cbdff') // '#0f6cbd'\n */\nexport function normalizeHexColor(value: string): string | null {\n const parsed = parseHexColor(value);\n return parsed ? formatHexColor(parsed.rgb, parsed.alpha) : null;\n}\n\n/** Alpha byte (0–255) → whole opacity percentage (0–100). */\nexport function alphaToOpacity(alpha: number): number {\n return Math.round((clamp(alpha, 0, 255) / 255) * 100);\n}\n\n/** Opacity percentage (0–100) → alpha byte (0–255). Inverse of {@link alphaToOpacity}. */\nexport function opacityToAlpha(opacity: number): number {\n return Math.round((clamp(opacity, 0, 100) / 100) * 255);\n}\n\nfunction parseChannel(token: string): number | null {\n const percent = token.endsWith('%');\n const n = Number(percent ? token.slice(0, -1) : token);\n if (!Number.isFinite(n)) return null;\n return clamp(percent ? (n / 100) * 255 : n, 0, 255);\n}\n\nfunction parseAlpha(token: string | undefined): number | null {\n if (token === undefined) return 1;\n const percent = token.endsWith('%');\n const n = Number(percent ? token.slice(0, -1) : token);\n if (!Number.isFinite(n)) return null;\n return clamp(percent ? n / 100 : n, 0, 1);\n}\n\nconst RGB_FUNCTION = /^rgba?\\(\\s*([^)]*)\\)$/i;\n\n/**\n * Parses the CSS colors that can be resolved without a browser: hex colors and `rgb()`/`rgba()`\n * (comma or space syntax, numbers or percentages, optional alpha). Returns `null` for named\n * colors, other color spaces and variables.\n */\nexport function parseCssColor(value: string): RgbaColor | null {\n const text = value.trim();\n const hex = parseHexColor(text);\n if (hex) {\n const n = parseInt(hex.rgb.slice(1), 16);\n return { r: (n >> 16) & 255, g: (n >> 8) & 255, b: n & 255, a: hex.alpha / 255 };\n }\n const match = RGB_FUNCTION.exec(text);\n if (!match) return null;\n const [channelsPart, alphaPart]: Array<string | undefined> = match[1].split('/');\n const tokens = (channelsPart ?? '')\n .split(/[\\s,]+/)\n .map((t) => t.trim())\n .filter(Boolean);\n let alphaToken: string | undefined = alphaPart?.trim();\n if (alphaToken === undefined && tokens.length === 4) alphaToken = tokens.pop();\n if (tokens.length !== 3) return null;\n const [r, g, b] = tokens.map(parseChannel);\n const a = parseAlpha(alphaToken);\n if (r === null || g === null || b === null || a === null) return null;\n return { r, g, b, a };\n}\n\nfunction linearize(channel: number): number {\n const c = channel / 255;\n return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n}\n\n/**\n * WCAG 2.x relative luminance (0 = black … 1 = white) of a color {@link parseCssColor} understands,\n * or `null`. Alpha is ignored (the swatch is treated as opaque).\n */\nexport function getRelativeLuminance(color: string): number | null {\n const parsed = parseCssColor(color);\n if (!parsed) return null;\n return 0.2126 * linearize(parsed.r) + 0.7152 * linearize(parsed.g) + 0.0722 * linearize(parsed.b);\n}\n\n/**\n * Colors of the check glyph drawn on a selected swatch (`input-pickers#16`): black or white,\n * whichever has the higher WCAG contrast ratio against the swatch color, with the other one as a\n * halo under it so the glyph stays visible on any color. Colors that cannot be parsed without a\n * browser (named colors, `hsl()`, variables) get a black glyph with a white halo.\n *\n * This is the one runtime-computed exception to the token rule (C-TOKENS): the glyph sits on a\n * consumer-supplied color, not on a theme surface.\n */\nexport function getCheckColors(color: string): CheckColors {\n const luminance = getRelativeLuminance(color);\n if (luminance === null) return { glyph: BLACK, halo: WHITE };\n const onBlack = (luminance + 0.05) / 0.05;\n const onWhite = 1.05 / (luminance + 0.05);\n return onBlack >= onWhite ? { glyph: BLACK, halo: WHITE } : { glyph: WHITE, halo: BLACK };\n}\n"],"mappings":"aA+BA,IAAMA,EAAQ,UAERC,EAAQ,UAERC,EAAY,wDACZC,EAAY,gCACZC,EAAY,qBAElB,SAASC,EAAM,EAAe,EAAa,EAAqB,CAC9D,OAAO,KAAK,IAAIC,EAAK,KAAK,IAAIC,EAAKC,CAAK,CAAC,CAC3C,CAEA,SAASC,EAAU,EAAuB,CACxC,OAAO,KAAK,MAAMJ,EAAMG,EAAO,EAAG,GAAG,CAAC,CAAC,CACpC,SAAS,EAAE,CAAC,CACZ,SAAS,EAAG,GAAG,CACpB,CAEA,SAASE,EAAW,EAA0B,CAQ5C,IAAMC,GANJC,EAAO,QAAU,EACbA,EACG,MAAM,EAAE,CAAC,CACT,IAAK,GAAMC,EAAIA,CAAC,CAAC,CACjB,KAAK,EAAE,EACVD,EAAA,CACa,YAAY,EAC/B,MAAO,CACL,IAAK,IAAID,EAAM,MAAM,EAAG,CAAC,IACzB,MAAOA,EAAM,SAAW,EAAI,SAASA,EAAM,MAAM,EAAG,CAAC,EAAG,EAAE,EAAI,GAChE,CACF,CAQA,SAAgBG,EAAc,EAAgC,CAC5D,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EAAUrB,EAAO,CAAC,EAD5E,IAEtB,CAWA,SAAgB0B,EAAe,EAA4B,CACzD,IAAMC,EAAYH,EAAqBC,CAAK,EAI5C,OAHIE,IAAc,OACDA,EAAY,KAAQ,KACrB,MAAQA,EAAY,KAFL,CAAE,MAAOnD,EAAO,KAAMC,CAAM,EAGC,CAAE,MAAOA,EAAO,KAAMD,CAAM,CAC1F"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/input/colorUtils.ts
|
|
3
|
+
var e = "#000000", t = "#ffffff", n = /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, r = /^#([0-9a-f]{6}|[0-9a-f]{8})$/i, i = /^#?[0-9a-f]{0,8}$/i;
|
|
4
|
+
function a(e, t, n) {
|
|
5
|
+
return Math.min(n, Math.max(t, e));
|
|
6
|
+
}
|
|
7
|
+
function o(e) {
|
|
8
|
+
return Math.round(a(e, 0, 255)).toString(16).padStart(2, "0");
|
|
9
|
+
}
|
|
10
|
+
function s(e) {
|
|
11
|
+
let t = (e.length <= 4 ? e.split("").map((e) => e + e).join("") : e).toLowerCase();
|
|
12
|
+
return {
|
|
13
|
+
rgb: `#${t.slice(0, 6)}`,
|
|
14
|
+
alpha: t.length === 8 ? parseInt(t.slice(6, 8), 16) : 255
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function c(e) {
|
|
18
|
+
let t = n.exec(e.trim());
|
|
19
|
+
return t ? s(t[1]) : null;
|
|
20
|
+
}
|
|
21
|
+
function l(e) {
|
|
22
|
+
let t = r.exec(e.trim());
|
|
23
|
+
return t ? s(t[1]) : null;
|
|
24
|
+
}
|
|
25
|
+
function u(e) {
|
|
26
|
+
return i.test(e.trim());
|
|
27
|
+
}
|
|
28
|
+
function d(e, t = 255) {
|
|
29
|
+
let n = Math.round(a(t, 0, 255));
|
|
30
|
+
return n === 255 ? e : e + o(n);
|
|
31
|
+
}
|
|
32
|
+
function f(e) {
|
|
33
|
+
let t = c(e);
|
|
34
|
+
return t ? d(t.rgb, t.alpha) : null;
|
|
35
|
+
}
|
|
36
|
+
function p(e) {
|
|
37
|
+
return Math.round(a(e, 0, 255) / 255 * 100);
|
|
38
|
+
}
|
|
39
|
+
function m(e) {
|
|
40
|
+
return Math.round(a(e, 0, 100) / 100 * 255);
|
|
41
|
+
}
|
|
42
|
+
function h(e) {
|
|
43
|
+
let t = e.endsWith("%"), n = Number(t ? e.slice(0, -1) : e);
|
|
44
|
+
return Number.isFinite(n) ? a(t ? n / 100 * 255 : n, 0, 255) : null;
|
|
45
|
+
}
|
|
46
|
+
function g(e) {
|
|
47
|
+
if (e === void 0) return 1;
|
|
48
|
+
let t = e.endsWith("%"), n = Number(t ? e.slice(0, -1) : e);
|
|
49
|
+
return Number.isFinite(n) ? a(t ? n / 100 : n, 0, 1) : null;
|
|
50
|
+
}
|
|
51
|
+
var _ = /^rgba?\(\s*([^)]*)\)$/i;
|
|
52
|
+
function v(e) {
|
|
53
|
+
let t = e.trim(), n = c(t);
|
|
54
|
+
if (n) {
|
|
55
|
+
let e = parseInt(n.rgb.slice(1), 16);
|
|
56
|
+
return {
|
|
57
|
+
r: e >> 16 & 255,
|
|
58
|
+
g: e >> 8 & 255,
|
|
59
|
+
b: e & 255,
|
|
60
|
+
a: n.alpha / 255
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
let r = _.exec(t);
|
|
64
|
+
if (!r) return null;
|
|
65
|
+
let [i, a] = r[1].split("/"), o = (i ?? "").split(/[\s,]+/).map((e) => e.trim()).filter(Boolean), s = a?.trim();
|
|
66
|
+
if (s === void 0 && o.length === 4 && (s = o.pop()), o.length !== 3) return null;
|
|
67
|
+
let [l, u, d] = o.map(h), f = g(s);
|
|
68
|
+
return l === null || u === null || d === null || f === null ? null : {
|
|
69
|
+
r: l,
|
|
70
|
+
g: u,
|
|
71
|
+
b: d,
|
|
72
|
+
a: f
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function y(e) {
|
|
76
|
+
let t = e / 255;
|
|
77
|
+
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
78
|
+
}
|
|
79
|
+
function b(e) {
|
|
80
|
+
let t = v(e);
|
|
81
|
+
return t ? .2126 * y(t.r) + .7152 * y(t.g) + .0722 * y(t.b) : null;
|
|
82
|
+
}
|
|
83
|
+
function x(n) {
|
|
84
|
+
let r = b(n);
|
|
85
|
+
return r === null || (r + .05) / .05 >= 1.05 / (r + .05) ? {
|
|
86
|
+
glyph: e,
|
|
87
|
+
halo: t
|
|
88
|
+
} : {
|
|
89
|
+
glyph: t,
|
|
90
|
+
halo: e
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { p as alphaToOpacity, d as formatHexColor, x as getCheckColors, b as getRelativeLuminance, u as isHexDraft, f as normalizeHexColor, m as opacityToAlpha, v as parseCssColor, c as parseHexColor, l as parseHexInput };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=colorUtils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorUtils.mjs","names":["BLACK","WHITE","HEX_COLOR","HEX_INPUT","HEX_DRAFT","clamp","max","min","value","toHexByte","fromDigits","lower","digits","d","parseHexColor","match","parseHexInput","text","isHexDraft","formatHexColor","byte","alpha","rgb","normalizeHexColor","parsed","alphaToOpacity","opacityToAlpha","opacity","parseChannel","percent","token","parseAlpha","RGB_FUNCTION","parseCssColor","hex","n","channelsPart","alphaPart","tokens","t","alphaToken","r","g","b","a","linearize","c","channel","getRelativeLuminance","color","getCheckColors","luminance"],"sources":["../../../src/components/input/colorUtils.ts"],"sourcesContent":["/**\n * Color helpers for ColorPicker and SwatchPicker: hex parsing/normalisation, the alpha byte ↔\n * opacity percentage, and the luminance-picked check glyph drawn on a user-supplied swatch.\n *\n * Internal (not exported from the package). Pure functions, no DOM access, so they run on the\n * server and in tests.\n */\n\n/** A parsed hex color: the `#rrggbb` part (lowercase) and the alpha byte (0–255). */\nexport interface HexColor {\n /** `#rrggbb`, lowercase. */\n rgb: string;\n /** Alpha byte, 0 (transparent) … 255 (opaque). */\n alpha: number;\n}\n\n/** An sRGB color with 0–255 channels and a 0–1 alpha. */\nexport interface RgbaColor {\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\n/** Colors of the selected-swatch check glyph: the glyph and the halo drawn under it. */\nexport interface CheckColors {\n glyph: string;\n halo: string;\n}\n\n// wave-allow-color: luminance-picked check glyph on a user swatch (C-TOKENS exception, input-pickers#16)\nconst BLACK = '#000000';\n// wave-allow-color: luminance-picked check glyph on a user swatch (C-TOKENS exception, input-pickers#16)\nconst WHITE = '#ffffff';\n\nconst HEX_COLOR = /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;\nconst HEX_INPUT = /^#([0-9a-f]{6}|[0-9a-f]{8})$/i;\nconst HEX_DRAFT = /^#?[0-9a-f]{0,8}$/i;\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value));\n}\n\nfunction toHexByte(value: number): string {\n return Math.round(clamp(value, 0, 255))\n .toString(16)\n .padStart(2, '0');\n}\n\nfunction fromDigits(digits: string): HexColor {\n const long =\n digits.length <= 4\n ? digits\n .split('')\n .map((d) => d + d)\n .join('')\n : digits;\n const lower = long.toLowerCase();\n return {\n rgb: `#${lower.slice(0, 6)}`,\n alpha: lower.length === 8 ? parseInt(lower.slice(6, 8), 16) : 255,\n };\n}\n\n/**\n * Parses a hex color (`#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`, case-insensitive, surrounding\n * whitespace ignored). Returns `null` for anything else (named colors, `rgb()`, a missing `#`).\n *\n * @example parseHexColor('#0F6CBD80') // { rgb: '#0f6cbd', alpha: 128 }\n */\nexport function parseHexColor(value: string): HexColor | null {\n const match = HEX_COLOR.exec(value.trim());\n return match ? fromDigits(match[1]) : null;\n}\n\n/**\n * Parses text typed into a hex field: only complete `#rrggbb` / `#rrggbbaa` values are accepted,\n * so the short forms a user passes through while typing (`#abc`) are never committed.\n */\nexport function parseHexInput(text: string): HexColor | null {\n const match = HEX_INPUT.exec(text.trim());\n return match ? fromDigits(match[1]) : null;\n}\n\n/**\n * Whether typed text can still become a hex color by typing more characters (an optional `#`\n * followed by at most 8 hex digits; surrounding whitespace ignored, like the parsers). `false`\n * means the text is invalid whatever follows.\n */\nexport function isHexDraft(text: string): boolean {\n return HEX_DRAFT.test(text.trim());\n}\n\n/**\n * Formats `#rrggbb` plus an alpha byte: `#rrggbb` when opaque (`alpha` 255, the default),\n * `#rrggbbaa` otherwise. The alpha byte is rounded and clamped to 0–255.\n */\nexport function formatHexColor(rgb: string, alpha = 255): string {\n const byte = Math.round(clamp(alpha, 0, 255));\n return byte === 255 ? rgb : rgb + toHexByte(byte);\n}\n\n/**\n * A hex color in the one form ColorPicker reports: `#rrggbb` in lower case, or `#rrggbbaa` when\n * the alpha byte is not 255 (short forms expanded, surrounding whitespace dropped). Returns `null`\n * for anything {@link parseHexColor} rejects.\n *\n * @example normalizeHexColor('#ABC') // '#aabbcc'\n * @example normalizeHexColor('#0f6cbdff') // '#0f6cbd'\n */\nexport function normalizeHexColor(value: string): string | null {\n const parsed = parseHexColor(value);\n return parsed ? formatHexColor(parsed.rgb, parsed.alpha) : null;\n}\n\n/** Alpha byte (0–255) → whole opacity percentage (0–100). */\nexport function alphaToOpacity(alpha: number): number {\n return Math.round((clamp(alpha, 0, 255) / 255) * 100);\n}\n\n/** Opacity percentage (0–100) → alpha byte (0–255). Inverse of {@link alphaToOpacity}. */\nexport function opacityToAlpha(opacity: number): number {\n return Math.round((clamp(opacity, 0, 100) / 100) * 255);\n}\n\nfunction parseChannel(token: string): number | null {\n const percent = token.endsWith('%');\n const n = Number(percent ? token.slice(0, -1) : token);\n if (!Number.isFinite(n)) return null;\n return clamp(percent ? (n / 100) * 255 : n, 0, 255);\n}\n\nfunction parseAlpha(token: string | undefined): number | null {\n if (token === undefined) return 1;\n const percent = token.endsWith('%');\n const n = Number(percent ? token.slice(0, -1) : token);\n if (!Number.isFinite(n)) return null;\n return clamp(percent ? n / 100 : n, 0, 1);\n}\n\nconst RGB_FUNCTION = /^rgba?\\(\\s*([^)]*)\\)$/i;\n\n/**\n * Parses the CSS colors that can be resolved without a browser: hex colors and `rgb()`/`rgba()`\n * (comma or space syntax, numbers or percentages, optional alpha). Returns `null` for named\n * colors, other color spaces and variables.\n */\nexport function parseCssColor(value: string): RgbaColor | null {\n const text = value.trim();\n const hex = parseHexColor(text);\n if (hex) {\n const n = parseInt(hex.rgb.slice(1), 16);\n return { r: (n >> 16) & 255, g: (n >> 8) & 255, b: n & 255, a: hex.alpha / 255 };\n }\n const match = RGB_FUNCTION.exec(text);\n if (!match) return null;\n const [channelsPart, alphaPart]: Array<string | undefined> = match[1].split('/');\n const tokens = (channelsPart ?? '')\n .split(/[\\s,]+/)\n .map((t) => t.trim())\n .filter(Boolean);\n let alphaToken: string | undefined = alphaPart?.trim();\n if (alphaToken === undefined && tokens.length === 4) alphaToken = tokens.pop();\n if (tokens.length !== 3) return null;\n const [r, g, b] = tokens.map(parseChannel);\n const a = parseAlpha(alphaToken);\n if (r === null || g === null || b === null || a === null) return null;\n return { r, g, b, a };\n}\n\nfunction linearize(channel: number): number {\n const c = channel / 255;\n return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n}\n\n/**\n * WCAG 2.x relative luminance (0 = black … 1 = white) of a color {@link parseCssColor} understands,\n * or `null`. Alpha is ignored (the swatch is treated as opaque).\n */\nexport function getRelativeLuminance(color: string): number | null {\n const parsed = parseCssColor(color);\n if (!parsed) return null;\n return 0.2126 * linearize(parsed.r) + 0.7152 * linearize(parsed.g) + 0.0722 * linearize(parsed.b);\n}\n\n/**\n * Colors of the check glyph drawn on a selected swatch (`input-pickers#16`): black or white,\n * whichever has the higher WCAG contrast ratio against the swatch color, with the other one as a\n * halo under it so the glyph stays visible on any color. Colors that cannot be parsed without a\n * browser (named colors, `hsl()`, variables) get a black glyph with a white halo.\n *\n * This is the one runtime-computed exception to the token rule (C-TOKENS): the glyph sits on a\n * consumer-supplied color, not on a theme surface.\n */\nexport function getCheckColors(color: string): CheckColors {\n const luminance = getRelativeLuminance(color);\n if (luminance === null) return { glyph: BLACK, halo: WHITE };\n const onBlack = (luminance + 0.05) / 0.05;\n const onWhite = 1.05 / (luminance + 0.05);\n return onBlack >= onWhite ? { glyph: BLACK, halo: WHITE } : { glyph: WHITE, halo: BLACK };\n}\n"],"mappings":";;AA+BA,IAAMA,IAAQ,WAERC,IAAQ,WAERC,IAAY,yDACZC,IAAY,iCACZC,IAAY;AAElB,SAASC,EAAM,GAAe,GAAa,GAAqB;CAC9D,OAAO,KAAK,IAAIC,GAAK,KAAK,IAAIC,GAAKC,CAAK,CAAC;AAC3C;AAEA,SAASC,EAAU,GAAuB;CACxC,OAAO,KAAK,MAAMJ,EAAMG,GAAO,GAAG,GAAG,CAAC,CAAC,CACpC,SAAS,EAAE,CAAC,CACZ,SAAS,GAAG,GAAG;AACpB;AAEA,SAASE,EAAW,GAA0B;CAQ5C,IAAMC,KANJC,EAAO,UAAU,IACbA,EACG,MAAM,EAAE,CAAC,CACT,KAAK,MAAMC,IAAIA,CAAC,CAAC,CACjB,KAAK,EAAE,IACVD,EAAA,CACa,YAAY;CAC/B,OAAO;EACL,KAAK,IAAID,EAAM,MAAM,GAAG,CAAC;EACzB,OAAOA,EAAM,WAAW,IAAI,SAASA,EAAM,MAAM,GAAG,CAAC,GAAG,EAAE,IAAI;CAChE;AACF;AAQA,SAAgBG,EAAc,GAAgC;CAC5D,IAAMC,IAAQb,EAAU,KAAKM,EAAM,KAAK,CAAC;CACzC,OAAOO,IAAQL,EAAWK,EAAM,EAAE,IAAI;AACxC;AAMA,SAAgBC,EAAc,GAA+B;CAC3D,IAAMD,IAAQZ,EAAU,KAAKc,EAAK,KAAK,CAAC;CACxC,OAAOF,IAAQL,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C;EAAE,OAAOA;EAAO,MAAMD;CAAM;AAC1F"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";function e(e,t,n){let r=new Date(2e3,0,1);return r.setFullYear(e,t,n),r.setHours(0,0,0,0),r}function t(t){return e(t.getFullYear(),t.getMonth(),t.getDate())}function n(t){return e(t.getFullYear(),t.getMonth(),1)}function r(t,n){return e(t,n+1,0).getDate()}function i(t,n){return e(t.getFullYear(),t.getMonth(),t.getDate()+n)}function a(t,n){let i=e(t.getFullYear(),t.getMonth()+n,1),a=Math.min(t.getDate(),r(i.getFullYear(),i.getMonth()));return e(i.getFullYear(),i.getMonth(),a)}function o(e,t){return!!e&&!!t&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function s(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function c(e,n,r){let i=t(e).getTime();return!(n&&i<t(n).getTime()||r&&i>t(r).getTime())}function l(e,n,r){let i=t(e);return n&&i.getTime()<t(n).getTime()?t(n):r&&i.getTime()>t(r).getTime()?t(r):i}function u(e,t){let r=n(e),a=(r.getDay()-t+7)%7,o=[];for(let e=0;e<42;e++)o.push(i(r,e-a));return o}function d(e,t){return String(e).padStart(t,`0`)}function f(e){return`${d(e.getFullYear(),4)}-${d(e.getMonth()+1,2)}-${d(e.getDate(),2)}`}function p(t,n,i){return!Number.isInteger(t)||t<1||t>9999||!Number.isInteger(n)||n<1||n>12||!Number.isInteger(i)||i<1||i>r(t,n-1)?null:e(t,n-1,i)}function m(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());return t?p(Number(t[1]),Number(t[2]),Number(t[3])):null}function h(e){try{return Intl.getCanonicalLocales(e),!0}catch{return!1}}var g={year:`numeric`,month:`2-digit`,day:`2-digit`},_=new Set([`gregory`,`buddhist`]),v=new Map;function y(e){let t=e??``,n=v.get(t);if(n===void 0){let r;try{r=new Intl.DateTimeFormat(e).resolvedOptions().calendar}catch{r=new Intl.DateTimeFormat().resolvedOptions().calendar}n=_.has(r)?r:`gregory`,v.set(t,n)}return n}var b=new Map;function x(e,t){let n=`${e??``}|${JSON.stringify(t)}`,r=b.get(n);if(!r){let i={...t,calendar:y(e)};try{r=new Intl.DateTimeFormat(e,i)}catch{r=new Intl.DateTimeFormat(void 0,i)}b.set(n,r)}return r}var S=/[\u061c\u200b-\u200f\u202a-\u202e\u2066-\u2069]/g,C=new Map,w=e(2001,10,23);function T(e,t){let n=``;for(let r of e.replace(S,``))n+=t.get(r)??r;return n}function E(e){let t=e??``,n=C.get(t);if(n)return n;let r=new Map,i;try{i=new Intl.NumberFormat(e,{useGrouping:!1})}catch{i=new Intl.NumberFormat(void 0,{useGrouping:!1})}for(let e=0;e<=9;e++)r.set(i.format(e),String(e));let a=x(e,g).formatToParts(w),o=[],s=new Set,c=``,l=0,u=4;for(let e of a)if(e.type===`day`||e.type===`month`||e.type===`year`){if(o.push(e.type),e.type===`year`){let t=T(e.value,r);u=t.length,l=Number(t)-w.getFullYear()}c+=e.type===`day`?`DD`:e.type===`month`?`MM`:`YYYY`}else{let t=e.value.replace(S,``);c+=t;for(let e of t)s.add(e)}let d={order:o,pattern:c.trim(),literals:s,digits:r,yearOffset:l,yearLength:u};return C.set(t,d),d}function D(e){let{order:t,pattern:n}=E(e);return{order:[...t],pattern:n}}function O(e,t){return x(t,g).format(e)}function k(e,t){let n=T(e.trim(),t.digits),r=n.match(/\d+/g);if(!r)return null;for(let e of n.replace(/\d+/g,``))if(!(/\s/.test(e)||t.literals.has(e)||`/.-`.includes(e)))return null;return r}function A(e,t){if(!e.trim())return null;let n=m(e);if(n)return n;let r=E(t);if(r.order.length!==3)return null;let i=k(e,r);if(!i||i.length!==3)return null;let a={};for(let e=0;e<3;e++){let t=r.order[e];if(t===`year`&&i[e].length<r.yearLength)return null;a[t]=Number(i[e])}let o=p((a.year??NaN)-r.yearOffset,a.month??NaN,a.day??NaN);if(!o)return null;let s=k(O(o,t),r);return!s||s.some((e,t)=>Number(e)!==Number(i[t]))?null:o}function j(t,n=0){let r=x(t,{weekday:`short`}),i=x(t,{weekday:`long`});return Array.from({length:7},(t,a)=>{let o=e(2023,0,1+(n+a)%7);return{short:r.format(o),long:i.format(o)}})}function M(e,t){return x(t,{month:`long`,year:`numeric`}).format(e)}function N(e,t){return x(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`}).format(e)}var P=new Map;function F(e,t){let n=t??``,r=P.get(n);if(!r){try{r=new Intl.NumberFormat(t,{useGrouping:!1})}catch{r=new Intl.NumberFormat(void 0,{useGrouping:!1})}P.set(n,r)}return r.format(e.getDate())}var I=/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/,L=/^(\d{1,2}):(\d{2})(?::(\d{2}))?\s*([ap])\.?\s*m\.?$/i;function R(e){let t=e.trim(),n=L.exec(t),r=n??I.exec(t);if(!r)return NaN;let i=Number(r[1]),a=Number(r[2]),o=r[3]===void 0?0:Number(r[3]);if(a>59||o>59)return NaN;if(n){if(i<1||i>12)return NaN;let e=r[4].toLowerCase()===`p`;i=i%12+(e?12:0)}else if(i>23)return NaN;return i*60+a}function z(e){return`${d(Math.floor(e/60)%24,2)}:${d(e%60,2)}`}function B(e,t){if(t===`24h`)return z(e);let n=Math.floor(e/60)%24,r=n>=12?`PM`:`AM`;return`${n%12==0?12:n%12}:${d(e%60,2)} ${r}`}function V(e){return!Number.isFinite(e)||e<=0?{step:30,valid:!1}:{step:Math.max(1,Math.floor(e)),valid:!0}}function H(e,t,n,r){let i=V(e).step,a=R(t),o=R(n);if(Number.isNaN(a)||Number.isNaN(o)||a>o)return[];let s=[];for(let e=a;e<=o;e+=i)s.push({value:z(e),label:B(e,r)});return s}exports.addDays=i,exports.addMonths=a,exports.clampDate=l,exports.formatDate=O,exports.formatDayLabel=N,exports.formatDayNumber=F,exports.formatISODate=f,exports.formatMonthYear=M,exports.generateTimeOptions=H,exports.getCalendarDays=u,exports.getLocaleDateFormat=D,exports.getWeekdayNames=j,exports.isDateInRange=c,exports.isSameDay=o,exports.isSameMonth=s,exports.isValidLocaleTag=h,exports.minutesToTime=B,exports.minutesToValue=z,exports.normalizeTimeStep=V,exports.parseDate=A,exports.parseISODate=m,exports.startOfDay=t,exports.startOfMonth=n,exports.timeToMinutes=R;
|
|
2
|
+
//# sourceMappingURL=dateUtils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateUtils.cjs","names":["makeDate","date","year","monthIndex","day","startOfDay","startOfMonth","daysInMonth","addDays","amount","addMonths","target","isSameDay","a","b","isSameMonth","isDateInRange","min","max","clampDate","getCalendarDays","first","viewMonth","offset","firstDayOfWeek","days","i","pad","value","length","formatISODate","fromFields","month","parseISODate","match","text","isValidLocaleTag","locale","DEFAULT_DATE_OPTIONS","GRID_CALENDARS","calendarCache","getCalendar","key","calendar","resolved","formatterCache","getFormatter","options","formatter","withCalendar","BIDI_MARKS","infoCache","SAMPLE_DATE","toAsciiDigits","out","char","digits","getLocaleInfo","cached","numberFormat","parts","order","literals","pattern","yearOffset","yearLength","part","info","getLocaleDateFormat","formatDate","digitGroups","normalized","groups","parseDate","iso","values","field","roundTrip","group","getWeekdayNames","short","long","formatMonthYear","formatDayLabel","numberFormatCache","formatDayNumber","TIME_24H","TIME_12H","timeToMinutes","twelve","hours","minutes","seconds","pm","minutesToValue","minutesToTime","format","period","normalizeTimeStep","step","generateTimeOptions","increment","minTime","maxTime"],"sources":["../../../src/components/input/dateUtils.ts"],"sourcesContent":["/**\n * Date and time helpers shared by `DatePicker` and `TimePicker` (spec §5.6).\n *\n * - Every date these helpers return is a **local-midnight** `Date` (the start of a calendar day in\n * the runtime's time zone). Comparisons are by calendar day, never by time of day.\n * - The default display format is `Intl.DateTimeFormat(locale, { year: 'numeric', month:\n * '2-digit', day: '2-digit' })`, and {@link parseDate} is its exact inverse for the same\n * `locale` (field order from `formatToParts`), so a formatted date always parses back to the\n * same day. ISO `yyyy-mm-dd` text is accepted too.\n * - Every formatter uses the locale's calendar only when it has the Gregorian months and days of\n * the grid (Gregorian, or the Buddhist calendar of `th-TH`, whose years are offset); any other\n * calendar (the Persian default of `fa-IR`, `-u-ca-islamic`, Japanese eras) is replaced by the\n * Gregorian one, so the text, the heading and the day labels name the day the grid shows.\n * - Pass an explicit `locale` when rendering on the server: the runtime default locale of the\n * server and the browser may differ, which would change the formatted text between them.\n *\n * Internal module (not exported from the package).\n */\n\n/* ------------------------------------------------------------------ */\n/* Day arithmetic */\n/* ------------------------------------------------------------------ */\n\n/**\n * Builds a local-midnight date without the `new Date(y, …)` two-digit-year mapping (years 0–99\n * would otherwise become 1900–1999).\n */\nfunction makeDate(year: number, monthIndex: number, day: number): Date {\n const date = new Date(2000, 0, 1);\n date.setFullYear(year, monthIndex, day);\n date.setHours(0, 0, 0, 0);\n return date;\n}\n\n/** The start (local midnight) of `date`'s calendar day, as a new `Date`. */\nexport function startOfDay(date: Date): Date {\n return makeDate(date.getFullYear(), date.getMonth(), date.getDate());\n}\n\n/** The first day (local midnight) of `date`'s month. */\nexport function startOfMonth(date: Date): Date {\n return makeDate(date.getFullYear(), date.getMonth(), 1);\n}\n\n/** The number of days in the given month (`monthIndex` may be out of range; it is normalized). */\nfunction daysInMonth(year: number, monthIndex: number): number {\n return makeDate(year, monthIndex + 1, 0).getDate();\n}\n\n/** `date` plus `amount` calendar days, at local midnight (month/year boundaries included). */\nexport function addDays(date: Date, amount: number): Date {\n return makeDate(date.getFullYear(), date.getMonth(), date.getDate() + amount);\n}\n\n/**\n * `date` plus `amount` months, at local midnight. The day is clamped to the length of the target\n * month, so Jan 31 + 1 month is Feb 28 (29 in a leap year) and Mar 31 − 1 month is Feb 28/29 —\n * never a day of the following month.\n */\nexport function addMonths(date: Date, amount: number): Date {\n const target = makeDate(date.getFullYear(), date.getMonth() + amount, 1);\n const day = Math.min(date.getDate(), daysInMonth(target.getFullYear(), target.getMonth()));\n return makeDate(target.getFullYear(), target.getMonth(), day);\n}\n\n/** Whether both dates are on the same calendar day. `false` when either is missing. */\nexport function isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean {\n return (\n !!a &&\n !!b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/** Whether both dates are in the same month of the same year. */\nexport function isSameMonth(a: Date, b: Date): boolean {\n return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();\n}\n\n/**\n * Whether `date`'s day lies within `[min, max]`, comparing calendar days (a `max` with a time of\n * day still includes that whole day). Missing bounds are open.\n */\nexport function isDateInRange(date: Date, min?: Date | null, max?: Date | null): boolean {\n const day = startOfDay(date).getTime();\n if (min && day < startOfDay(min).getTime()) return false;\n if (max && day > startOfDay(max).getTime()) return false;\n return true;\n}\n\n/** `date`'s day clamped into `[min, max]` (calendar days), at local midnight. */\nexport function clampDate(date: Date, min?: Date | null, max?: Date | null): Date {\n const day = startOfDay(date);\n if (min && day.getTime() < startOfDay(min).getTime()) return startOfDay(min);\n if (max && day.getTime() > startOfDay(max).getTime()) return startOfDay(max);\n return day;\n}\n\n/**\n * The 42 days (6 weeks) of the calendar grid showing `viewMonth`'s month: the first row starts on\n * `firstDayOfWeek` (0 = Sunday) on or before the 1st.\n */\nexport function getCalendarDays(viewMonth: Date, firstDayOfWeek: number): Date[] {\n const first = startOfMonth(viewMonth);\n const offset = (first.getDay() - firstDayOfWeek + 7) % 7;\n const days: Date[] = [];\n for (let i = 0; i < 42; i++) days.push(addDays(first, i - offset));\n return days;\n}\n\n/* ------------------------------------------------------------------ */\n/* ISO dates */\n/* ------------------------------------------------------------------ */\n\nfunction pad(value: number, length: number): string {\n return String(value).padStart(length, '0');\n}\n\n/** `yyyy-mm-dd` from the **local** calendar fields (the `HiddenInput` form value). */\nexport function formatISODate(date: Date): string {\n return `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1, 2)}-${pad(date.getDate(), 2)}`;\n}\n\n/** Builds a date from calendar fields; `null` when they do not name a real day. */\nfunction fromFields(year: number, month: number, day: number): Date | null {\n if (!Number.isInteger(year) || year < 1 || year > 9999) return null;\n if (!Number.isInteger(month) || month < 1 || month > 12) return null;\n if (!Number.isInteger(day) || day < 1 || day > daysInMonth(year, month - 1)) return null;\n return makeDate(year, month - 1, day);\n}\n\n/** Parses `yyyy-mm-dd` (surrounding whitespace allowed) to local midnight; `null` otherwise. */\nexport function parseISODate(text: string): Date | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(text.trim());\n if (!match) return null;\n return fromFields(Number(match[1]), Number(match[2]), Number(match[3]));\n}\n\n/* ------------------------------------------------------------------ */\n/* Locale formats */\n/* ------------------------------------------------------------------ */\n\n/** A numeric date field. */\nexport type DateField = 'year' | 'month' | 'day';\n\n/** How a locale writes the default (numeric) date format. */\nexport interface LocaleDateFormat {\n /** The order of the fields, e.g. `['day', 'month', 'year']` for `en-GB`. */\n order: DateField[];\n /** A readable pattern with the locale's own separators, e.g. `DD/MM/YYYY`. */\n pattern: string;\n}\n\n/**\n * Whether `Intl` accepts `locale` as a language tag. Every helper below falls back to the runtime\n * default locale for a tag it rejects (the POSIX `de_DE`, `''`, a typo), so DatePicker warns about\n * one in development.\n */\nexport function isValidLocaleTag(locale: string): boolean {\n try {\n Intl.getCanonicalLocales(locale);\n return true;\n } catch {\n return false;\n }\n}\n\nconst DEFAULT_DATE_OPTIONS: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n};\n\n/**\n * Calendars with the Gregorian months and days, which the grid shows (`getCalendarDays`): a locale\n * whose calendar is one of these keeps it. The Buddhist calendar (default of `th-TH`) only numbers\n * the years differently.\n */\nconst GRID_CALENDARS = new Set(['gregory', 'buddhist']);\n\nconst calendarCache = new Map<string, string>();\n\n/**\n * The calendar every date helper formats `locale` in: the locale's own (its default or a `-u-ca-`\n * extension) when it has the Gregorian months and days, else `'gregory'`. So a Persian default\n * (`fa-IR`, `fa-AF`, `ps-AF`), an explicit `-u-ca-islamic` or the Japanese eras never label the\n * Gregorian grid with other months or years, and the text stays parseable; the locale's digits\n * stay. An invalid locale tag uses the runtime default's.\n */\nfunction getCalendar(locale: string | undefined): string {\n const key = locale ?? '';\n let calendar = calendarCache.get(key);\n if (calendar === undefined) {\n let resolved: string;\n try {\n resolved = new Intl.DateTimeFormat(locale).resolvedOptions().calendar;\n } catch {\n resolved = new Intl.DateTimeFormat().resolvedOptions().calendar;\n }\n calendar = GRID_CALENDARS.has(resolved) ? resolved : 'gregory';\n calendarCache.set(key, calendar);\n }\n return calendar;\n}\n\nconst formatterCache = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * A cached `Intl.DateTimeFormat` in the calendar of {@link getCalendar}; an invalid locale tag falls\n * back to the runtime default.\n */\nfunction getFormatter(\n locale: string | undefined,\n options: Intl.DateTimeFormatOptions,\n): Intl.DateTimeFormat {\n const key = `${locale ?? ''}|${JSON.stringify(options)}`;\n let formatter = formatterCache.get(key);\n if (!formatter) {\n const withCalendar = { ...options, calendar: getCalendar(locale) };\n try {\n formatter = new Intl.DateTimeFormat(locale, withCalendar);\n } catch {\n formatter = new Intl.DateTimeFormat(undefined, withCalendar);\n }\n formatterCache.set(key, formatter);\n }\n return formatter;\n}\n\n/** Bidirectional control characters Intl inserts around fields (Arabic, Hebrew locales). */\nconst BIDI_MARKS = /[\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2066-\\u2069]/g;\n\ninterface LocaleInfo extends LocaleDateFormat {\n /** Non-digit characters of the formatted date (allowed between the typed fields). */\n literals: Set<string>;\n /** Locale digit → ASCII digit (for non-Latin numbering systems). */\n digits: Map<string, string>;\n /** Formatted year minus the Gregorian year (e.g. 543 for the Buddhist calendar). */\n yearOffset: number;\n /** Digit count of a formatted year: shorter typed years are rejected (`25` is not 2025). */\n yearLength: number;\n}\n\nconst infoCache = new Map<string, LocaleInfo>();\nconst SAMPLE_DATE = makeDate(2001, 10, 23); // 23 Nov 2001: every field distinct\n\nfunction toAsciiDigits(text: string, digits: Map<string, string>): string {\n let out = '';\n for (const char of text.replace(BIDI_MARKS, '')) out += digits.get(char) ?? char;\n return out;\n}\n\nfunction getLocaleInfo(locale: string | undefined): LocaleInfo {\n const key = locale ?? '';\n const cached = infoCache.get(key);\n if (cached) return cached;\n\n const digits = new Map<string, string>();\n let numberFormat: Intl.NumberFormat;\n try {\n numberFormat = new Intl.NumberFormat(locale, { useGrouping: false });\n } catch {\n numberFormat = new Intl.NumberFormat(undefined, { useGrouping: false });\n }\n for (let i = 0; i <= 9; i++) digits.set(numberFormat.format(i), String(i));\n\n const parts = getFormatter(locale, DEFAULT_DATE_OPTIONS).formatToParts(SAMPLE_DATE);\n const order: DateField[] = [];\n const literals = new Set<string>();\n let pattern = '';\n let yearOffset = 0;\n let yearLength = 4;\n for (const part of parts) {\n if (part.type === 'day' || part.type === 'month' || part.type === 'year') {\n order.push(part.type);\n if (part.type === 'year') {\n const year = toAsciiDigits(part.value, digits);\n yearLength = year.length;\n yearOffset = Number(year) - SAMPLE_DATE.getFullYear();\n }\n pattern += part.type === 'day' ? 'DD' : part.type === 'month' ? 'MM' : 'YYYY';\n } else {\n const text = part.value.replace(BIDI_MARKS, '');\n pattern += text;\n for (const char of text) literals.add(char);\n }\n }\n const info: LocaleInfo = {\n order,\n pattern: pattern.trim(),\n literals,\n digits,\n yearOffset,\n yearLength,\n };\n infoCache.set(key, info);\n return info;\n}\n\n/**\n * The field order and a readable pattern (`DD/MM/YYYY`, `MM/DD/YYYY`, `DD.MM.YYYY`, …) of the\n * default date format for `locale` (runtime default when omitted).\n */\nexport function getLocaleDateFormat(locale?: string): LocaleDateFormat {\n const { order, pattern } = getLocaleInfo(locale);\n return { order: [...order], pattern };\n}\n\n/**\n * The default DatePicker display text: `Intl.DateTimeFormat(locale, { year: 'numeric', month:\n * '2-digit', day: '2-digit' })` in the grid-compatible calendar of {@link getCalendar} (`fa-IR`:\n * `۲۰۲۵/۰۶/۱۵`, not the Persian `۱۴۰۴/۰۳/۲۵`). {@link parseDate} with the same `locale` reverses it.\n */\nexport function formatDate(date: Date, locale?: string): string {\n return getFormatter(locale, DEFAULT_DATE_OPTIONS).format(date);\n}\n\n/** The numeric fields of `text` in order, or `null` when anything but separators surrounds them. */\nfunction digitGroups(text: string, info: LocaleInfo): string[] | null {\n const normalized = toAsciiDigits(text.trim(), info.digits);\n const groups = normalized.match(/\\d+/g);\n if (!groups) return null;\n for (const char of normalized.replace(/\\d+/g, '')) {\n if (/\\s/.test(char) || info.literals.has(char) || '/.-'.includes(char)) continue;\n return null;\n }\n return groups;\n}\n\n/**\n * Parses text typed in the default display format of `locale` — the exact inverse of\n * {@link formatDate} for the same locale — to local midnight. Also accepts single-digit day/month\n * fields, `/`, `.` and `-` separators, and ISO `yyyy-mm-dd`. Returns `null` for anything else:\n * impossible dates (31/02), a year shorter than the locale writes it (`25`), letters or extra\n * fields.\n */\nexport function parseDate(text: string, locale?: string): Date | null {\n if (!text.trim()) return null;\n const iso = parseISODate(text);\n if (iso) return iso;\n\n const info = getLocaleInfo(locale);\n if (info.order.length !== 3) return null;\n const groups = digitGroups(text, info);\n if (!groups || groups.length !== 3) return null;\n\n const values: Partial<Record<DateField, number>> = {};\n for (let i = 0; i < 3; i++) {\n const field = info.order[i];\n if (field === 'year' && groups[i].length < info.yearLength) return null;\n values[field] = Number(groups[i]);\n }\n const date = fromFields(\n (values.year ?? NaN) - info.yearOffset,\n values.month ?? NaN,\n values.day ?? NaN,\n );\n if (!date) return null;\n\n // Exact inverse: formatting the result must give back the typed numbers (guards calendars\n // whose months or days differ from the Gregorian ones).\n const roundTrip = digitGroups(formatDate(date, locale), info);\n if (!roundTrip || roundTrip.some((group, i) => Number(group) !== Number(groups[i]))) return null;\n return date;\n}\n\n/** The 12 long month names of `locale` (January … December). */\nexport function getMonthNames(locale?: string): string[] {\n const formatter = getFormatter(locale, { month: 'long' });\n return Array.from({ length: 12 }, (_, month) => formatter.format(makeDate(2001, month, 1)));\n}\n\n/** A weekday name in both lengths. */\nexport interface WeekdayName {\n /** Short name for the column header (`Mon`). */\n short: string;\n /** Full name for assistive technology (`Monday`). */\n long: string;\n}\n\n/** The seven weekday names of `locale`, starting at `firstDayOfWeek` (0 = Sunday). */\nexport function getWeekdayNames(locale: string | undefined, firstDayOfWeek = 0): WeekdayName[] {\n const short = getFormatter(locale, { weekday: 'short' });\n const long = getFormatter(locale, { weekday: 'long' });\n // 1 January 2023 was a Sunday.\n return Array.from({ length: 7 }, (_, i) => {\n const day = makeDate(2023, 0, 1 + ((firstDayOfWeek + i) % 7));\n return { short: short.format(day), long: long.format(day) };\n });\n}\n\n/** The calendar heading, e.g. `May 2025` / `Mai 2025`. */\nexport function formatMonthYear(date: Date, locale?: string): string {\n return getFormatter(locale, { month: 'long', year: 'numeric' }).format(date);\n}\n\n/** The accessible name of a day cell, e.g. `Monday, May 26, 2025`. */\nexport function formatDayLabel(date: Date, locale?: string): string {\n return getFormatter(locale, {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n }).format(date);\n}\n\nconst numberFormatCache = new Map<string, Intl.NumberFormat>();\n\n/** The day-of-month number in the locale's digits, without suffixes (`3`, not `3日`). */\nexport function formatDayNumber(date: Date, locale?: string): string {\n const key = locale ?? '';\n let formatter = numberFormatCache.get(key);\n if (!formatter) {\n try {\n formatter = new Intl.NumberFormat(locale, { useGrouping: false });\n } catch {\n formatter = new Intl.NumberFormat(undefined, { useGrouping: false });\n }\n numberFormatCache.set(key, formatter);\n }\n return formatter.format(date.getDate());\n}\n\n/* ------------------------------------------------------------------ */\n/* Time */\n/* ------------------------------------------------------------------ */\n\n/** TimePicker label style. */\nexport type TimeFormat = '12h' | '24h';\n\nconst TIME_24H = /^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/;\nconst TIME_12H = /^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?\\s*([ap])\\.?\\s*m\\.?$/i;\n\n/**\n * Minutes since midnight of a time string: `HH:mm`, `H:mm`, `HH:mm:ss` (seconds ignored) or a\n * 12-hour time such as `9:00 AM`, `12:30 pm`, `11:59 p.m.`. `NaN` when invalid.\n */\nexport function timeToMinutes(text: string): number {\n const value = text.trim();\n const twelve = TIME_12H.exec(value);\n const match = twelve ?? TIME_24H.exec(value);\n if (!match) return NaN;\n let hours = Number(match[1]);\n const minutes = Number(match[2]);\n const seconds = match[3] === undefined ? 0 : Number(match[3]);\n if (minutes > 59 || seconds > 59) return NaN;\n if (twelve) {\n if (hours < 1 || hours > 12) return NaN;\n const pm = match[4].toLowerCase() === 'p';\n hours = (hours % 12) + (pm ? 12 : 0);\n } else if (hours > 23) {\n return NaN;\n }\n return hours * 60 + minutes;\n}\n\n/** `HH:mm` (24-hour, zero-padded): the TimePicker value format. */\nexport function minutesToValue(minutes: number): string {\n const hours = Math.floor(minutes / 60) % 24;\n return `${pad(hours, 2)}:${pad(minutes % 60, 2)}`;\n}\n\n/** Display text of a time: `13:00` (`'24h'`) or `1:00 PM` (`'12h'`). */\nexport function minutesToTime(minutes: number, format: TimeFormat): string {\n if (format === '24h') return minutesToValue(minutes);\n const hours = Math.floor(minutes / 60) % 24;\n const period = hours >= 12 ? 'PM' : 'AM';\n const hours12 = hours % 12 === 0 ? 12 : hours % 12;\n return `${hours12}:${pad(minutes % 60, 2)} ${period}`;\n}\n\n/** The TimePicker step fallback for invalid values. */\nexport const DEFAULT_TIME_STEP = 30;\n\n/**\n * Guards a TimePicker `step`: a non-finite or non-positive step falls back to\n * {@link DEFAULT_TIME_STEP} (`valid: false`, so the component can report it); fractions are\n * floored to a whole number of minutes, at least 1.\n */\nexport function normalizeTimeStep(step: number): { step: number; valid: boolean } {\n if (!Number.isFinite(step) || step <= 0) return { step: DEFAULT_TIME_STEP, valid: false };\n return { step: Math.max(1, Math.floor(step)), valid: true };\n}\n\n/** One generated TimePicker option. */\nexport interface TimeOption {\n /** `HH:mm`. */\n value: string;\n /** Display text in the requested format. */\n label: string;\n}\n\n/**\n * The options from `minTime` to `maxTime` (inclusive) every `step` minutes. The step is guarded\n * with {@link normalizeTimeStep} (the loop always terminates); invalid or reversed bounds give\n * `[]`.\n */\nexport function generateTimeOptions(\n step: number,\n minTime: string,\n maxTime: string,\n format: TimeFormat,\n): TimeOption[] {\n const increment = normalizeTimeStep(step).step;\n const min = timeToMinutes(minTime);\n const max = timeToMinutes(maxTime);\n if (Number.isNaN(min) || Number.isNaN(max) || min > max) return [];\n const options: TimeOption[] = [];\n for (let minutes = min; minutes <= max; minutes += increment) {\n options.push({ value: minutesToValue(minutes), label: minutesToTime(minutes, format) });\n }\n return options;\n}\n"],"mappings":"aA2BA,SAASA,EAAS,EAAc,EAAoB,EAAmB,CACrE,IAAMC,EAAO,IAAI,KAAK,IAAM,EAAG,CAAC,EAGhC,OAFAA,EAAK,YAAYC,EAAMC,EAAYC,CAAG,EACtCH,EAAK,SAAS,EAAG,EAAG,EAAG,CAAC,EACjBA,CACT,CAGA,SAAgBI,EAAW,EAAkB,CAC3C,OAAOL,EAASC,EAAK,YAAY,EAAGA,EAAK,SAAS,EAAGA,EAAK,QAAQ,CAAC,CACrE,CAGA,SAAgBK,EAAa,EAAkB,CAC7C,OAAON,EAASC,EAAK,YAAY,EAAGA,EAAK,SAAS,EAAG,CAAC,CACxD,CAGA,SAASM,EAAY,EAAc,EAA4B,CAC7D,OAAOP,EAASE,EAAMC,EAAa,EAAG,CAAC,CAAC,CAAC,QAAQ,CACnD,CAGA,SAAgBK,EAAQ,EAAY,EAAsB,CACxD,OAAOR,EAASC,EAAK,YAAY,EAAGA,EAAK,SAAS,EAAGA,EAAK,QAAQ,EAAIQ,CAAM,CAC9E,CAOA,SAAgBC,EAAU,EAAY,EAAsB,CAC1D,IAAMC,EAASX,EAASC,EAAK,YAAY,EAAGA,EAAK,SAAS,EAAIQ,EAAQ,CAAC,EACjEL,EAAM,KAAK,IAAIH,EAAK,QAAQ,EAAGM,EAAYI,EAAO,YAAY,EAAGA,EAAO,SAAS,CAAC,CAAC,EACzF,OAAOX,EAASW,EAAO,YAAY,EAA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
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/input/dateUtils.ts
|
|
3
|
+
function e(e, t, n) {
|
|
4
|
+
let r = new Date(2e3, 0, 1);
|
|
5
|
+
return r.setFullYear(e, t, n), r.setHours(0, 0, 0, 0), r;
|
|
6
|
+
}
|
|
7
|
+
function t(t) {
|
|
8
|
+
return e(t.getFullYear(), t.getMonth(), t.getDate());
|
|
9
|
+
}
|
|
10
|
+
function n(t) {
|
|
11
|
+
return e(t.getFullYear(), t.getMonth(), 1);
|
|
12
|
+
}
|
|
13
|
+
function r(t, n) {
|
|
14
|
+
return e(t, n + 1, 0).getDate();
|
|
15
|
+
}
|
|
16
|
+
function i(t, n) {
|
|
17
|
+
return e(t.getFullYear(), t.getMonth(), t.getDate() + n);
|
|
18
|
+
}
|
|
19
|
+
function a(t, n) {
|
|
20
|
+
let i = e(t.getFullYear(), t.getMonth() + n, 1), a = Math.min(t.getDate(), r(i.getFullYear(), i.getMonth()));
|
|
21
|
+
return e(i.getFullYear(), i.getMonth(), a);
|
|
22
|
+
}
|
|
23
|
+
function o(e, t) {
|
|
24
|
+
return !!e && !!t && e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
25
|
+
}
|
|
26
|
+
function s(e, t) {
|
|
27
|
+
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth();
|
|
28
|
+
}
|
|
29
|
+
function c(e, n, r) {
|
|
30
|
+
let i = t(e).getTime();
|
|
31
|
+
return !(n && i < t(n).getTime() || r && i > t(r).getTime());
|
|
32
|
+
}
|
|
33
|
+
function l(e, n, r) {
|
|
34
|
+
let i = t(e);
|
|
35
|
+
return n && i.getTime() < t(n).getTime() ? t(n) : r && i.getTime() > t(r).getTime() ? t(r) : i;
|
|
36
|
+
}
|
|
37
|
+
function u(e, t) {
|
|
38
|
+
let r = n(e), a = (r.getDay() - t + 7) % 7, o = [];
|
|
39
|
+
for (let e = 0; e < 42; e++) o.push(i(r, e - a));
|
|
40
|
+
return o;
|
|
41
|
+
}
|
|
42
|
+
function d(e, t) {
|
|
43
|
+
return String(e).padStart(t, "0");
|
|
44
|
+
}
|
|
45
|
+
function f(e) {
|
|
46
|
+
return `${d(e.getFullYear(), 4)}-${d(e.getMonth() + 1, 2)}-${d(e.getDate(), 2)}`;
|
|
47
|
+
}
|
|
48
|
+
function p(t, n, i) {
|
|
49
|
+
return !Number.isInteger(t) || t < 1 || t > 9999 || !Number.isInteger(n) || n < 1 || n > 12 || !Number.isInteger(i) || i < 1 || i > r(t, n - 1) ? null : e(t, n - 1, i);
|
|
50
|
+
}
|
|
51
|
+
function m(e) {
|
|
52
|
+
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());
|
|
53
|
+
return t ? p(Number(t[1]), Number(t[2]), Number(t[3])) : null;
|
|
54
|
+
}
|
|
55
|
+
function h(e) {
|
|
56
|
+
try {
|
|
57
|
+
return Intl.getCanonicalLocales(e), !0;
|
|
58
|
+
} catch {
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
var g = {
|
|
63
|
+
year: "numeric",
|
|
64
|
+
month: "2-digit",
|
|
65
|
+
day: "2-digit"
|
|
66
|
+
}, _ = /* @__PURE__ */ new Set(["gregory", "buddhist"]), v = /* @__PURE__ */ new Map();
|
|
67
|
+
function y(e) {
|
|
68
|
+
let t = e ?? "", n = v.get(t);
|
|
69
|
+
if (n === void 0) {
|
|
70
|
+
let r;
|
|
71
|
+
try {
|
|
72
|
+
r = new Intl.DateTimeFormat(e).resolvedOptions().calendar;
|
|
73
|
+
} catch {
|
|
74
|
+
r = new Intl.DateTimeFormat().resolvedOptions().calendar;
|
|
75
|
+
}
|
|
76
|
+
n = _.has(r) ? r : "gregory", v.set(t, n);
|
|
77
|
+
}
|
|
78
|
+
return n;
|
|
79
|
+
}
|
|
80
|
+
var b = /* @__PURE__ */ new Map();
|
|
81
|
+
function x(e, t) {
|
|
82
|
+
let n = `${e ?? ""}|${JSON.stringify(t)}`, r = b.get(n);
|
|
83
|
+
if (!r) {
|
|
84
|
+
let i = {
|
|
85
|
+
...t,
|
|
86
|
+
calendar: y(e)
|
|
87
|
+
};
|
|
88
|
+
try {
|
|
89
|
+
r = new Intl.DateTimeFormat(e, i);
|
|
90
|
+
} catch {
|
|
91
|
+
r = new Intl.DateTimeFormat(void 0, i);
|
|
92
|
+
}
|
|
93
|
+
b.set(n, r);
|
|
94
|
+
}
|
|
95
|
+
return r;
|
|
96
|
+
}
|
|
97
|
+
var S = /[\u061c\u200b-\u200f\u202a-\u202e\u2066-\u2069]/g, C = /* @__PURE__ */ new Map(), w = e(2001, 10, 23);
|
|
98
|
+
function T(e, t) {
|
|
99
|
+
let n = "";
|
|
100
|
+
for (let r of e.replace(S, "")) n += t.get(r) ?? r;
|
|
101
|
+
return n;
|
|
102
|
+
}
|
|
103
|
+
function E(e) {
|
|
104
|
+
let t = e ?? "", n = C.get(t);
|
|
105
|
+
if (n) return n;
|
|
106
|
+
let r = /* @__PURE__ */ new Map(), i;
|
|
107
|
+
try {
|
|
108
|
+
i = new Intl.NumberFormat(e, { useGrouping: !1 });
|
|
109
|
+
} catch {
|
|
110
|
+
i = new Intl.NumberFormat(void 0, { useGrouping: !1 });
|
|
111
|
+
}
|
|
112
|
+
for (let e = 0; e <= 9; e++) r.set(i.format(e), String(e));
|
|
113
|
+
let a = x(e, g).formatToParts(w), o = [], s = /* @__PURE__ */ new Set(), c = "", l = 0, u = 4;
|
|
114
|
+
for (let e of a) if (e.type === "day" || e.type === "month" || e.type === "year") {
|
|
115
|
+
if (o.push(e.type), e.type === "year") {
|
|
116
|
+
let t = T(e.value, r);
|
|
117
|
+
u = t.length, l = Number(t) - w.getFullYear();
|
|
118
|
+
}
|
|
119
|
+
c += e.type === "day" ? "DD" : e.type === "month" ? "MM" : "YYYY";
|
|
120
|
+
} else {
|
|
121
|
+
let t = e.value.replace(S, "");
|
|
122
|
+
c += t;
|
|
123
|
+
for (let e of t) s.add(e);
|
|
124
|
+
}
|
|
125
|
+
let d = {
|
|
126
|
+
order: o,
|
|
127
|
+
pattern: c.trim(),
|
|
128
|
+
literals: s,
|
|
129
|
+
digits: r,
|
|
130
|
+
yearOffset: l,
|
|
131
|
+
yearLength: u
|
|
132
|
+
};
|
|
133
|
+
return C.set(t, d), d;
|
|
134
|
+
}
|
|
135
|
+
function D(e) {
|
|
136
|
+
let { order: t, pattern: n } = E(e);
|
|
137
|
+
return {
|
|
138
|
+
order: [...t],
|
|
139
|
+
pattern: n
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function O(e, t) {
|
|
143
|
+
return x(t, g).format(e);
|
|
144
|
+
}
|
|
145
|
+
function k(e, t) {
|
|
146
|
+
let n = T(e.trim(), t.digits), r = n.match(/\d+/g);
|
|
147
|
+
if (!r) return null;
|
|
148
|
+
for (let e of n.replace(/\d+/g, "")) if (!(/\s/.test(e) || t.literals.has(e) || "/.-".includes(e))) return null;
|
|
149
|
+
return r;
|
|
150
|
+
}
|
|
151
|
+
function A(e, t) {
|
|
152
|
+
if (!e.trim()) return null;
|
|
153
|
+
let n = m(e);
|
|
154
|
+
if (n) return n;
|
|
155
|
+
let r = E(t);
|
|
156
|
+
if (r.order.length !== 3) return null;
|
|
157
|
+
let i = k(e, r);
|
|
158
|
+
if (!i || i.length !== 3) return null;
|
|
159
|
+
let a = {};
|
|
160
|
+
for (let e = 0; e < 3; e++) {
|
|
161
|
+
let t = r.order[e];
|
|
162
|
+
if (t === "year" && i[e].length < r.yearLength) return null;
|
|
163
|
+
a[t] = Number(i[e]);
|
|
164
|
+
}
|
|
165
|
+
let o = p((a.year ?? NaN) - r.yearOffset, a.month ?? NaN, a.day ?? NaN);
|
|
166
|
+
if (!o) return null;
|
|
167
|
+
let s = k(O(o, t), r);
|
|
168
|
+
return !s || s.some((e, t) => Number(e) !== Number(i[t])) ? null : o;
|
|
169
|
+
}
|
|
170
|
+
function j(t, n = 0) {
|
|
171
|
+
let r = x(t, { weekday: "short" }), i = x(t, { weekday: "long" });
|
|
172
|
+
return Array.from({ length: 7 }, (t, a) => {
|
|
173
|
+
let o = e(2023, 0, 1 + (n + a) % 7);
|
|
174
|
+
return {
|
|
175
|
+
short: r.format(o),
|
|
176
|
+
long: i.format(o)
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function M(e, t) {
|
|
181
|
+
return x(t, {
|
|
182
|
+
month: "long",
|
|
183
|
+
year: "numeric"
|
|
184
|
+
}).format(e);
|
|
185
|
+
}
|
|
186
|
+
function N(e, t) {
|
|
187
|
+
return x(t, {
|
|
188
|
+
weekday: "long",
|
|
189
|
+
year: "numeric",
|
|
190
|
+
month: "long",
|
|
191
|
+
day: "numeric"
|
|
192
|
+
}).format(e);
|
|
193
|
+
}
|
|
194
|
+
var P = /* @__PURE__ */ new Map();
|
|
195
|
+
function F(e, t) {
|
|
196
|
+
let n = t ?? "", r = P.get(n);
|
|
197
|
+
if (!r) {
|
|
198
|
+
try {
|
|
199
|
+
r = new Intl.NumberFormat(t, { useGrouping: !1 });
|
|
200
|
+
} catch {
|
|
201
|
+
r = new Intl.NumberFormat(void 0, { useGrouping: !1 });
|
|
202
|
+
}
|
|
203
|
+
P.set(n, r);
|
|
204
|
+
}
|
|
205
|
+
return r.format(e.getDate());
|
|
206
|
+
}
|
|
207
|
+
var I = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/, L = /^(\d{1,2}):(\d{2})(?::(\d{2}))?\s*([ap])\.?\s*m\.?$/i;
|
|
208
|
+
function R(e) {
|
|
209
|
+
let t = e.trim(), n = L.exec(t), r = n ?? I.exec(t);
|
|
210
|
+
if (!r) return NaN;
|
|
211
|
+
let i = Number(r[1]), a = Number(r[2]), o = r[3] === void 0 ? 0 : Number(r[3]);
|
|
212
|
+
if (a > 59 || o > 59) return NaN;
|
|
213
|
+
if (n) {
|
|
214
|
+
if (i < 1 || i > 12) return NaN;
|
|
215
|
+
let e = r[4].toLowerCase() === "p";
|
|
216
|
+
i = i % 12 + (e ? 12 : 0);
|
|
217
|
+
} else if (i > 23) return NaN;
|
|
218
|
+
return i * 60 + a;
|
|
219
|
+
}
|
|
220
|
+
function z(e) {
|
|
221
|
+
return `${d(Math.floor(e / 60) % 24, 2)}:${d(e % 60, 2)}`;
|
|
222
|
+
}
|
|
223
|
+
function B(e, t) {
|
|
224
|
+
if (t === "24h") return z(e);
|
|
225
|
+
let n = Math.floor(e / 60) % 24, r = n >= 12 ? "PM" : "AM";
|
|
226
|
+
return `${n % 12 == 0 ? 12 : n % 12}:${d(e % 60, 2)} ${r}`;
|
|
227
|
+
}
|
|
228
|
+
function V(e) {
|
|
229
|
+
return !Number.isFinite(e) || e <= 0 ? {
|
|
230
|
+
step: 30,
|
|
231
|
+
valid: !1
|
|
232
|
+
} : {
|
|
233
|
+
step: Math.max(1, Math.floor(e)),
|
|
234
|
+
valid: !0
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function H(e, t, n, r) {
|
|
238
|
+
let i = V(e).step, a = R(t), o = R(n);
|
|
239
|
+
if (Number.isNaN(a) || Number.isNaN(o) || a > o) return [];
|
|
240
|
+
let s = [];
|
|
241
|
+
for (let e = a; e <= o; e += i) s.push({
|
|
242
|
+
value: z(e),
|
|
243
|
+
label: B(e, r)
|
|
244
|
+
});
|
|
245
|
+
return s;
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
export { i as addDays, a as addMonths, l as clampDate, O as formatDate, N as formatDayLabel, F as formatDayNumber, f as formatISODate, M as formatMonthYear, H as generateTimeOptions, u as getCalendarDays, D as getLocaleDateFormat, j as getWeekdayNames, c as isDateInRange, o as isSameDay, s as isSameMonth, h as isValidLocaleTag, B as minutesToTime, z as minutesToValue, V as normalizeTimeStep, A as parseDate, m as parseISODate, t as startOfDay, n as startOfMonth, R as timeToMinutes };
|
|
249
|
+
|
|
250
|
+
//# sourceMappingURL=dateUtils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateUtils.mjs","names":["makeDate","date","year","monthIndex","day","startOfDay","startOfMonth","daysInMonth","addDays","amount","addMonths","target","isSameDay","a","b","isSameMonth","isDateInRange","min","max","clampDate","getCalendarDays","first","viewMonth","offset","firstDayOfWeek","days","i","pad","value","length","formatISODate","fromFields","month","parseISODate","match","text","isValidLocaleTag","locale","DEFAULT_DATE_OPTIONS","GRID_CALENDARS","calendarCache","getCalendar","key","calendar","resolved","formatterCache","getFormatter","options","formatter","withCalendar","BIDI_MARKS","infoCache","SAMPLE_DATE","toAsciiDigits","out","char","digits","getLocaleInfo","cached","numberFormat","parts","order","literals","pattern","yearOffset","yearLength","part","info","getLocaleDateFormat","formatDate","digitGroups","normalized","groups","parseDate","iso","values","field","roundTrip","group","getWeekdayNames","short","long","formatMonthYear","formatDayLabel","numberFormatCache","formatDayNumber","TIME_24H","TIME_12H","timeToMinutes","twelve","hours","minutes","seconds","pm","minutesToValue","minutesToTime","format","period","normalizeTimeStep","step","generateTimeOptions","increment","minTime","maxTime"],"sources":["../../../src/components/input/dateUtils.ts"],"sourcesContent":["/**\n * Date and time helpers shared by `DatePicker` and `TimePicker` (spec §5.6).\n *\n * - Every date these helpers return is a **local-midnight** `Date` (the start of a calendar day in\n * the runtime's time zone). Comparisons are by calendar day, never by time of day.\n * - The default display format is `Intl.DateTimeFormat(locale, { year: 'numeric', month:\n * '2-digit', day: '2-digit' })`, and {@link parseDate} is its exact inverse for the same\n * `locale` (field order from `formatToParts`), so a formatted date always parses back to the\n * same day. ISO `yyyy-mm-dd` text is accepted too.\n * - Every formatter uses the locale's calendar only when it has the Gregorian months and days of\n * the grid (Gregorian, or the Buddhist calendar of `th-TH`, whose years are offset); any other\n * calendar (the Persian default of `fa-IR`, `-u-ca-islamic`, Japanese eras) is replaced by the\n * Gregorian one, so the text, the heading and the day labels name the day the grid shows.\n * - Pass an explicit `locale` when rendering on the server: the runtime default locale of the\n * server and the browser may differ, which would change the formatted text between them.\n *\n * Internal module (not exported from the package).\n */\n\n/* ------------------------------------------------------------------ */\n/* Day arithmetic */\n/* ------------------------------------------------------------------ */\n\n/**\n * Builds a local-midnight date without the `new Date(y, …)` two-digit-year mapping (years 0–99\n * would otherwise become 1900–1999).\n */\nfunction makeDate(year: number, monthIndex: number, day: number): Date {\n const date = new Date(2000, 0, 1);\n date.setFullYear(year, monthIndex, day);\n date.setHours(0, 0, 0, 0);\n return date;\n}\n\n/** The start (local midnight) of `date`'s calendar day, as a new `Date`. */\nexport function startOfDay(date: Date): Date {\n return makeDate(date.getFullYear(), date.getMonth(), date.getDate());\n}\n\n/** The first day (local midnight) of `date`'s month. */\nexport function startOfMonth(date: Date): Date {\n return makeDate(date.getFullYear(), date.getMonth(), 1);\n}\n\n/** The number of days in the given month (`monthIndex` may be out of range; it is normalized). */\nfunction daysInMonth(year: number, monthIndex: number): number {\n return makeDate(year, monthIndex + 1, 0).getDate();\n}\n\n/** `date` plus `amount` calendar days, at local midnight (month/year boundaries included). */\nexport function addDays(date: Date, amount: number): Date {\n return makeDate(date.getFullYear(), date.getMonth(), date.getDate() + amount);\n}\n\n/**\n * `date` plus `amount` months, at local midnight. The day is clamped to the length of the target\n * month, so Jan 31 + 1 month is Feb 28 (29 in a leap year) and Mar 31 − 1 month is Feb 28/29 —\n * never a day of the following month.\n */\nexport function addMonths(date: Date, amount: number): Date {\n const target = makeDate(date.getFullYear(), date.getMonth() + amount, 1);\n const day = Math.min(date.getDate(), daysInMonth(target.getFullYear(), target.getMonth()));\n return makeDate(target.getFullYear(), target.getMonth(), day);\n}\n\n/** Whether both dates are on the same calendar day. `false` when either is missing. */\nexport function isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean {\n return (\n !!a &&\n !!b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/** Whether both dates are in the same month of the same year. */\nexport function isSameMonth(a: Date, b: Date): boolean {\n return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();\n}\n\n/**\n * Whether `date`'s day lies within `[min, max]`, comparing calendar days (a `max` with a time of\n * day still includes that whole day). Missing bounds are open.\n */\nexport function isDateInRange(date: Date, min?: Date | null, max?: Date | null): boolean {\n const day = startOfDay(date).getTime();\n if (min && day < startOfDay(min).getTime()) return false;\n if (max && day > startOfDay(max).getTime()) return false;\n return true;\n}\n\n/** `date`'s day clamped into `[min, max]` (calendar days), at local midnight. */\nexport function clampDate(date: Date, min?: Date | null, max?: Date | null): Date {\n const day = startOfDay(date);\n if (min && day.getTime() < startOfDay(min).getTime()) return startOfDay(min);\n if (max && day.getTime() > startOfDay(max).getTime()) return startOfDay(max);\n return day;\n}\n\n/**\n * The 42 days (6 weeks) of the calendar grid showing `viewMonth`'s month: the first row starts on\n * `firstDayOfWeek` (0 = Sunday) on or before the 1st.\n */\nexport function getCalendarDays(viewMonth: Date, firstDayOfWeek: number): Date[] {\n const first = startOfMonth(viewMonth);\n const offset = (first.getDay() - firstDayOfWeek + 7) % 7;\n const days: Date[] = [];\n for (let i = 0; i < 42; i++) days.push(addDays(first, i - offset));\n return days;\n}\n\n/* ------------------------------------------------------------------ */\n/* ISO dates */\n/* ------------------------------------------------------------------ */\n\nfunction pad(value: number, length: number): string {\n return String(value).padStart(length, '0');\n}\n\n/** `yyyy-mm-dd` from the **local** calendar fields (the `HiddenInput` form value). */\nexport function formatISODate(date: Date): string {\n return `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1, 2)}-${pad(date.getDate(), 2)}`;\n}\n\n/** Builds a date from calendar fields; `null` when they do not name a real day. */\nfunction fromFields(year: number, month: number, day: number): Date | null {\n if (!Number.isInteger(year) || year < 1 || year > 9999) return null;\n if (!Number.isInteger(month) || month < 1 || month > 12) return null;\n if (!Number.isInteger(day) || day < 1 || day > daysInMonth(year, month - 1)) return null;\n return makeDate(year, month - 1, day);\n}\n\n/** Parses `yyyy-mm-dd` (surrounding whitespace allowed) to local midnight; `null` otherwise. */\nexport function parseISODate(text: string): Date | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(text.trim());\n if (!match) return null;\n return fromFields(Number(match[1]), Number(match[2]), Number(match[3]));\n}\n\n/* ------------------------------------------------------------------ */\n/* Locale formats */\n/* ------------------------------------------------------------------ */\n\n/** A numeric date field. */\nexport type DateField = 'year' | 'month' | 'day';\n\n/** How a locale writes the default (numeric) date format. */\nexport interface LocaleDateFormat {\n /** The order of the fields, e.g. `['day', 'month', 'year']` for `en-GB`. */\n order: DateField[];\n /** A readable pattern with the locale's own separators, e.g. `DD/MM/YYYY`. */\n pattern: string;\n}\n\n/**\n * Whether `Intl` accepts `locale` as a language tag. Every helper below falls back to the runtime\n * default locale for a tag it rejects (the POSIX `de_DE`, `''`, a typo), so DatePicker warns about\n * one in development.\n */\nexport function isValidLocaleTag(locale: string): boolean {\n try {\n Intl.getCanonicalLocales(locale);\n return true;\n } catch {\n return false;\n }\n}\n\nconst DEFAULT_DATE_OPTIONS: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n};\n\n/**\n * Calendars with the Gregorian months and days, which the grid shows (`getCalendarDays`): a locale\n * whose calendar is one of these keeps it. The Buddhist calendar (default of `th-TH`) only numbers\n * the years differently.\n */\nconst GRID_CALENDARS = new Set(['gregory', 'buddhist']);\n\nconst calendarCache = new Map<string, string>();\n\n/**\n * The calendar every date helper formats `locale` in: the locale's own (its default or a `-u-ca-`\n * extension) when it has the Gregorian months and days, else `'gregory'`. So a Persian default\n * (`fa-IR`, `fa-AF`, `ps-AF`), an explicit `-u-ca-islamic` or the Japanese eras never label the\n * Gregorian grid with other months or years, and the text stays parseable; the locale's digits\n * stay. An invalid locale tag uses the runtime default's.\n */\nfunction getCalendar(locale: string | undefined): string {\n const key = locale ?? '';\n let calendar = calendarCache.get(key);\n if (calendar === undefined) {\n let resolved: string;\n try {\n resolved = new Intl.DateTimeFormat(locale).resolvedOptions().calendar;\n } catch {\n resolved = new Intl.DateTimeFormat().resolvedOptions().calendar;\n }\n calendar = GRID_CALENDARS.has(resolved) ? resolved : 'gregory';\n calendarCache.set(key, calendar);\n }\n return calendar;\n}\n\nconst formatterCache = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * A cached `Intl.DateTimeFormat` in the calendar of {@link getCalendar}; an invalid locale tag falls\n * back to the runtime default.\n */\nfunction getFormatter(\n locale: string | undefined,\n options: Intl.DateTimeFormatOptions,\n): Intl.DateTimeFormat {\n const key = `${locale ?? ''}|${JSON.stringify(options)}`;\n let formatter = formatterCache.get(key);\n if (!formatter) {\n const withCalendar = { ...options, calendar: getCalendar(locale) };\n try {\n formatter = new Intl.DateTimeFormat(locale, withCalendar);\n } catch {\n formatter = new Intl.DateTimeFormat(undefined, withCalendar);\n }\n formatterCache.set(key, formatter);\n }\n return formatter;\n}\n\n/** Bidirectional control characters Intl inserts around fields (Arabic, Hebrew locales). */\nconst BIDI_MARKS = /[\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2066-\\u2069]/g;\n\ninterface LocaleInfo extends LocaleDateFormat {\n /** Non-digit characters of the formatted date (allowed between the typed fields). */\n literals: Set<string>;\n /** Locale digit → ASCII digit (for non-Latin numbering systems). */\n digits: Map<string, string>;\n /** Formatted year minus the Gregorian year (e.g. 543 for the Buddhist calendar). */\n yearOffset: number;\n /** Digit count of a formatted year: shorter typed years are rejected (`25` is not 2025). */\n yearLength: number;\n}\n\nconst infoCache = new Map<string, LocaleInfo>();\nconst SAMPLE_DATE = makeDate(2001, 10, 23); // 23 Nov 2001: every field distinct\n\nfunction toAsciiDigits(text: string, digits: Map<string, string>): string {\n let out = '';\n for (const char of text.replace(BIDI_MARKS, '')) out += digits.get(char) ?? char;\n return out;\n}\n\nfunction getLocaleInfo(locale: string | undefined): LocaleInfo {\n const key = locale ?? '';\n const cached = infoCache.get(key);\n if (cached) return cached;\n\n const digits = new Map<string, string>();\n let numberFormat: Intl.NumberFormat;\n try {\n numberFormat = new Intl.NumberFormat(locale, { useGrouping: false });\n } catch {\n numberFormat = new Intl.NumberFormat(undefined, { useGrouping: false });\n }\n for (let i = 0; i <= 9; i++) digits.set(numberFormat.format(i), String(i));\n\n const parts = getFormatter(locale, DEFAULT_DATE_OPTIONS).formatToParts(SAMPLE_DATE);\n const order: DateField[] = [];\n const literals = new Set<string>();\n let pattern = '';\n let yearOffset = 0;\n let yearLength = 4;\n for (const part of parts) {\n if (part.type === 'day' || part.type === 'month' || part.type === 'year') {\n order.push(part.type);\n if (part.type === 'year') {\n const year = toAsciiDigits(part.value, digits);\n yearLength = year.length;\n yearOffset = Number(year) - SAMPLE_DATE.getFullYear();\n }\n pattern += part.type === 'day' ? 'DD' : part.type === 'month' ? 'MM' : 'YYYY';\n } else {\n const text = part.value.replace(BIDI_MARKS, '');\n pattern += text;\n for (const char of text) literals.add(char);\n }\n }\n const info: LocaleInfo = {\n order,\n pattern: pattern.trim(),\n literals,\n digits,\n yearOffset,\n yearLength,\n };\n infoCache.set(key, info);\n return info;\n}\n\n/**\n * The field order and a readable pattern (`DD/MM/YYYY`, `MM/DD/YYYY`, `DD.MM.YYYY`, …) of the\n * default date format for `locale` (runtime default when omitted).\n */\nexport function getLocaleDateFormat(locale?: string): LocaleDateFormat {\n const { order, pattern } = getLocaleInfo(locale);\n return { order: [...order], pattern };\n}\n\n/**\n * The default DatePicker display text: `Intl.DateTimeFormat(locale, { year: 'numeric', month:\n * '2-digit', day: '2-digit' })` in the grid-compatible calendar of {@link getCalendar} (`fa-IR`:\n * `۲۰۲۵/۰۶/۱۵`, not the Persian `۱۴۰۴/۰۳/۲۵`). {@link parseDate} with the same `locale` reverses it.\n */\nexport function formatDate(date: Date, locale?: string): string {\n return getFormatter(locale, DEFAULT_DATE_OPTIONS).format(date);\n}\n\n/** The numeric fields of `text` in order, or `null` when anything but separators surrounds them. */\nfunction digitGroups(text: string, info: LocaleInfo): string[] | null {\n const normalized = toAsciiDigits(text.trim(), info.digits);\n const groups = normalized.match(/\\d+/g);\n if (!groups) return null;\n for (const char of normalized.replace(/\\d+/g, '')) {\n if (/\\s/.test(char) || info.literals.has(char) || '/.-'.includes(char)) continue;\n return null;\n }\n return groups;\n}\n\n/**\n * Parses text typed in the default display format of `locale` — the exact inverse of\n * {@link formatDate} for the same locale — to local midnight. Also accepts single-digit day/month\n * fields, `/`, `.` and `-` separators, and ISO `yyyy-mm-dd`. Returns `null` for anything else:\n * impossible dates (31/02), a year shorter than the locale writes it (`25`), letters or extra\n * fields.\n */\nexport function parseDate(text: string, locale?: string): Date | null {\n if (!text.trim()) return null;\n const iso = parseISODate(text);\n if (iso) return iso;\n\n const info = getLocaleInfo(locale);\n if (info.order.length !== 3) return null;\n const groups = digitGroups(text, info);\n if (!groups || groups.length !== 3) return null;\n\n const values: Partial<Record<DateField, number>> = {};\n for (let i = 0; i < 3; i++) {\n const field = info.order[i];\n if (field === 'year' && groups[i].length < info.yearLength) return null;\n values[field] = Number(groups[i]);\n }\n const date = fromFields(\n (values.year ?? NaN) - info.yearOffset,\n values.month ?? NaN,\n values.day ?? NaN,\n );\n if (!date) return null;\n\n // Exact inverse: formatting the result must give back the typed numbers (guards calendars\n // whose months or days differ from the Gregorian ones).\n const roundTrip = digitGroups(formatDate(date, locale), info);\n if (!roundTrip || roundTrip.some((group, i) => Number(group) !== Number(groups[i]))) return null;\n return date;\n}\n\n/** The 12 long month names of `locale` (January … December). */\nexport function getMonthNames(locale?: string): string[] {\n const formatter = getFormatter(locale, { month: 'long' });\n return Array.from({ length: 12 }, (_, month) => formatter.format(makeDate(2001, month, 1)));\n}\n\n/** A weekday name in both lengths. */\nexport interface WeekdayName {\n /** Short name for the column header (`Mon`). */\n short: string;\n /** Full name for assistive technology (`Monday`). */\n long: string;\n}\n\n/** The seven weekday names of `locale`, starting at `firstDayOfWeek` (0 = Sunday). */\nexport function getWeekdayNames(locale: string | undefined, firstDayOfWeek = 0): WeekdayName[] {\n const short = getFormatter(locale, { weekday: 'short' });\n const long = getFormatter(locale, { weekday: 'long' });\n // 1 January 2023 was a Sunday.\n return Array.from({ length: 7 }, (_, i) => {\n const day = makeDate(2023, 0, 1 + ((firstDayOfWeek + i) % 7));\n return { short: short.format(day), long: long.format(day) };\n });\n}\n\n/** The calendar heading, e.g. `May 2025` / `Mai 2025`. */\nexport function formatMonthYear(date: Date, locale?: string): string {\n return getFormatter(locale, { month: 'long', year: 'numeric' }).format(date);\n}\n\n/** The accessible name of a day cell, e.g. `Monday, May 26, 2025`. */\nexport function formatDayLabel(date: Date, locale?: string): string {\n return getFormatter(locale, {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n }).format(date);\n}\n\nconst numberFormatCache = new Map<string, Intl.NumberFormat>();\n\n/** The day-of-month number in the locale's digits, without suffixes (`3`, not `3日`). */\nexport function formatDayNumber(date: Date, locale?: string): string {\n const key = locale ?? '';\n let formatter = numberFormatCache.get(key);\n if (!formatter) {\n try {\n formatter = new Intl.NumberFormat(locale, { useGrouping: false });\n } catch {\n formatter = new Intl.NumberFormat(undefined, { useGrouping: false });\n }\n numberFormatCache.set(key, formatter);\n }\n return formatter.format(date.getDate());\n}\n\n/* ------------------------------------------------------------------ */\n/* Time */\n/* ------------------------------------------------------------------ */\n\n/** TimePicker label style. */\nexport type TimeFormat = '12h' | '24h';\n\nconst TIME_24H = /^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/;\nconst TIME_12H = /^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?\\s*([ap])\\.?\\s*m\\.?$/i;\n\n/**\n * Minutes since midnight of a time string: `HH:mm`, `H:mm`, `HH:mm:ss` (seconds ignored) or a\n * 12-hour time such as `9:00 AM`, `12:30 pm`, `11:59 p.m.`. `NaN` when invalid.\n */\nexport function timeToMinutes(text: string): number {\n const value = text.trim();\n const twelve = TIME_12H.exec(value);\n const match = twelve ?? TIME_24H.exec(value);\n if (!match) return NaN;\n let hours = Number(match[1]);\n const minutes = Number(match[2]);\n const seconds = match[3] === undefined ? 0 : Number(match[3]);\n if (minutes > 59 || seconds > 59) return NaN;\n if (twelve) {\n if (hours < 1 || hours > 12) return NaN;\n const pm = match[4].toLowerCase() === 'p';\n hours = (hours % 12) + (pm ? 12 : 0);\n } else if (hours > 23) {\n return NaN;\n }\n return hours * 60 + minutes;\n}\n\n/** `HH:mm` (24-hour, zero-padded): the TimePicker value format. */\nexport function minutesToValue(minutes: number): string {\n const hours = Math.floor(minutes / 60) % 24;\n return `${pad(hours, 2)}:${pad(minutes % 60, 2)}`;\n}\n\n/** Display text of a time: `13:00` (`'24h'`) or `1:00 PM` (`'12h'`). */\nexport function minutesToTime(minutes: number, format: TimeFormat): string {\n if (format === '24h') return minutesToValue(minutes);\n const hours = Math.floor(minutes / 60) % 24;\n const period = hours >= 12 ? 'PM' : 'AM';\n const hours12 = hours % 12 === 0 ? 12 : hours % 12;\n return `${hours12}:${pad(minutes % 60, 2)} ${period}`;\n}\n\n/** The TimePicker step fallback for invalid values. */\nexport const DEFAULT_TIME_STEP = 30;\n\n/**\n * Guards a TimePicker `step`: a non-finite or non-positive step falls back to\n * {@link DEFAULT_TIME_STEP} (`valid: false`, so the component can report it); fractions are\n * floored to a whole number of minutes, at least 1.\n */\nexport function normalizeTimeStep(step: number): { step: number; valid: boolean } {\n if (!Number.isFinite(step) || step <= 0) return { step: DEFAULT_TIME_STEP, valid: false };\n return { step: Math.max(1, Math.floor(step)), valid: true };\n}\n\n/** One generated TimePicker option. */\nexport interface TimeOption {\n /** `HH:mm`. */\n value: string;\n /** Display text in the requested format. */\n label: string;\n}\n\n/**\n * The options from `minTime` to `maxTime` (inclusive) every `step` minutes. The step is guarded\n * with {@link normalizeTimeStep} (the loop always terminates); invalid or reversed bounds give\n * `[]`.\n */\nexport function generateTimeOptions(\n step: number,\n minTime: string,\n maxTime: string,\n format: TimeFormat,\n): TimeOption[] {\n const increment = normalizeTimeStep(step).step;\n const min = timeToMinutes(minTime);\n const max = timeToMinutes(maxTime);\n if (Number.isNaN(min) || Number.isNaN(max) || min > max) return [];\n const options: TimeOption[] = [];\n for (let minutes = min; minutes <= max; minutes += increment) {\n options.push({ value: minutesToValue(minutes), label: minutesToTime(minutes, format) });\n }\n return options;\n}\n"],"mappings":";;AA2BA,SAASA,EAAS,GAAc,GAAoB,GAAmB;CACrE,IAAMC,IAAO,IAAI,KAAK,KAAM,GAAG,CAAC;CAGhC,OAFAA,EAAK,YAAYC,GAAMC,GAAYC,CAAG,GACtCH,EAAK,SAAS,GAAG,GAAG,GAAG,CAAC,GACjBA;AACT;AAGA,SAAgBI,EAAW,GAAkB;CAC3C,OAAOL,EAASC,EAAK,YAAY,GAAGA,EAAK,SAAS,GAAGA,EAAK,QAAQ,CAAC;AACrE;AAGA,SAAgBK,EAAa,GAAkB;CAC7C,OAAON,EAASC,EAAK,YAAY,GAAGA,EAAK,SAAS,GAAG,CAAC;AACxD;AAGA,SAASM,EAAY,GAAc,GAA4B;CAC7D,OAAOP,EAASE,GAAMC,IAAa,GAAG,CAAC,CAAC,CAAC,QAAQ;AACnD;AAGA,SAAgBK,EAAQ,GAAY,GAAsB;CACxD,OAAOR,EAASC,EAAK,YAAY,GAAGA,EAAK,SAAS,GAAGA,EAAK,QAAQ,IAAIQ,CAAM;AAC9E;AAOA,SAAgBC,EAAU,GAAY,GAAsB;CAC1D,IAAMC,IAASX,EAASC,EAAK,YAAY,GAAGA,EAAK,SAAS,IAAIQ,GAAQ,CAAC,GACjEL,IAAM,KAAK,IAAIH,EAAK,QAAQ,GAAGM,EAAYI,EAAO,YAAY,GAAGA,EAAO,SAAS,CAAC,CAAC;CACzF,OAAOX,EAASW,EAAO,YAAY,GAAGA,EAAO,SAAS,GAAGP,CAAG;AAC9D;AAGA,SAAgBQ,EAAU,GAA4B,GAAqC;CACzF,OACE,CAAC,CAACC,KACF,CAAC,CAACC,KACFD,EAAE,YAAY,MAAMC,EAAE,YAAY,KAClCD,EAAE,SAAS,MAAMC,EAAE,SAAS,KAC5BD,EAAE,QAAQ,MAAMC,EAAE,QA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AgBG,EAAe,GAAyB;CAEtD,OAAO,GAAGnE,EADI,KAAK,MAAMgE,IAAU,EAAE,IAAI,IACpB,CAAC,EAAE,GAAGhE,EAAIgE,IAAU,IAAI,CAAC;AAChD;AAGA,SAAgBI,EAAc,GAAiB,GAA4B;CACzE,IAAIC,MAAW,OAAO,OAAOF,EAAeH,CAAO;CACnD,IAAMD,IAAQ,KAAK,MAAMC,IAAU,EAAE,IAAI,IACnCM,IAASP,KAAS,KAAK,OAAO;CAEpC,OAAO,GADSA,IAAQ,MAAO,IAAI,KAAKA,IAAQ,GAC9B,GAAG/D,EAAIgE,IAAU,IAAI,CAAC,EAAE,GAAGM;AAC/C;AAUA,SAAgBC,EAAkB,GAAgD;CAEhF,OADI,CAAC,OAAO,SAASC,CAAI,KAAKA,KAAQ,IAAU;EAAE,MAAA;EAAyB,OAAO;CAAM,IACjF;EAAE,MAAM,KAAK,IAAI,GAAG,KAAK,MAAMA,CAAI,CAAC;EAAG,OAAO;CAAK;AAC5D;AAeA,SAAgBC,EACd,GACA,GACA,GACA,GACc;CACd,IAAMC,IAAYH,EAAkBC,CAAI,CAAC,CAAC,MACpClF,IAAMuE,EAAcc,CAAO,GAC3BpF,IAAMsE,EAAce,CAAO;CACjC,IAAI,OAAO,MAAMtF,CAAG,KAAK,OAAO,MAAMC,CAAG,KAAKD,IAAMC,GAAK,OAAO,CAAC;CACjE,IAAM6B,IAAwB,CAAC;CAC/B,KAAK,IAAI4C,IAAU1E,GAAK0E,KAAWzE,GAAK,KAAWmF,GACjD,EAAQ,KAAK;EAAE,OAAOP,EAAeH,CAAO;EAAG,OAAOI,EAAcJ,GAASK,CAAM;CAAE,CAAC;CAExF,OAAOjD;AACT"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";var e=`absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground`;function t(e){return e>=2?`pe-14`:e===1?`pe-8`:void 0}exports.PICKER_ICON_BUTTON_CLASSES=e,exports.pickerEndPadding=t;
|
|
2
|
+
//# sourceMappingURL=pickerStyles.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickerStyles.cjs","names":["PICKER_ICON_BUTTON_CLASSES","pickerEndPadding","buttons"],"sources":["../../../src/components/input/pickerStyles.ts"],"sourcesContent":["/**\n * Classes shared by the pickers of the combobox family (Combobox, Dropdown, TimePicker).\n * Component-private: not exported from the package.\n */\n\n/**\n * An icon button at the end of a picker's control (its clear and expand buttons): a 24×24px\n * target that the caller positions (`end-1`, `end-7`) and gives `focusRing` and `disabledStyles`.\n * It sets its own padding and background (C-NATIVE: an app-wide `button` rule would otherwise pad\n * and fill it) and gates its hover colors on the enabled state.\n */\nexport const PICKER_ICON_BUTTON_CLASSES =\n 'absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground';\n\n/**\n * The end padding that keeps a picker's text clear of the buttons at its end: `pe-8` for one\n * button, `pe-14` for two, nothing without one.\n */\nexport function pickerEndPadding(buttons: number): string | undefined {\n if (buttons >= 2) return 'pe-14';\n return buttons === 1 ? 'pe-8' : undefined;\n}\n"],"mappings":"aAWA,IAAaA,EACX,+MAMF,SAAgBC,EAAiB,EAAqC,CAEpE,OADIC,GAAW,EAAU,QAClBA,IAAY,EAAI,OAAS,IAAA,EAClC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/input/pickerStyles.ts
|
|
3
|
+
var e = "absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground";
|
|
4
|
+
function t(e) {
|
|
5
|
+
return e >= 2 ? "pe-14" : e === 1 ? "pe-8" : void 0;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { e as PICKER_ICON_BUTTON_CLASSES, t as pickerEndPadding };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=pickerStyles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickerStyles.mjs","names":["PICKER_ICON_BUTTON_CLASSES","pickerEndPadding","buttons"],"sources":["../../../src/components/input/pickerStyles.ts"],"sourcesContent":["/**\n * Classes shared by the pickers of the combobox family (Combobox, Dropdown, TimePicker).\n * Component-private: not exported from the package.\n */\n\n/**\n * An icon button at the end of a picker's control (its clear and expand buttons): a 24×24px\n * target that the caller positions (`end-1`, `end-7`) and gives `focusRing` and `disabledStyles`.\n * It sets its own padding and background (C-NATIVE: an app-wide `button` rule would otherwise pad\n * and fill it) and gates its hover colors on the enabled state.\n */\nexport const PICKER_ICON_BUTTON_CLASSES =\n 'absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground';\n\n/**\n * The end padding that keeps a picker's text clear of the buttons at its end: `pe-8` for one\n * button, `pe-14` for two, nothing without one.\n */\nexport function pickerEndPadding(buttons: number): string | undefined {\n if (buttons >= 2) return 'pe-14';\n return buttons === 1 ? 'pe-8' : undefined;\n}\n"],"mappings":";;AAWA,IAAaA,IACX;AAMF,SAAgBC,EAAiB,GAAqC;CAEpE,OADIC,KAAW,IAAU,UAClBA,MAAY,IAAI,SAAS,KAAA;AAClC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../hooks/useId.cjs"),n=require("../../lib/focus.cjs");require("../../hooks/useFormReset.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("react/jsx-runtime");var a={position:`absolute`,insetInlineStart:0,bottom:0,width:1,height:1,margin:0,padding:0,border:0,opacity:0,pointerEvents:`none`};function o(){}function s(e){let t=e.currentTarget,r=t.parentElement;if(!r)return;let i=e.relatedTarget,a=i instanceof HTMLElement&&i!==t&&r.contains(i)?i:n.getFirstTabbable(r);a&&a!==t&&a.focus()}function c(e){return e==null?null:typeof e==`string`?e:e[0]??null}function l(e){return e==null?[``]:typeof e==`string`?[e]:e}function u(e){let{name:n,form:r,disabled:u,value:d,type:f=`hidden`,checked:p,required:m=!1,onInvalid:h}=e,g=t.useId(`wave-required`);if(!n&&!m)return null;let _=f===`checkbox`||f===`radio`,v=c(d),y=f===`checkbox`?p??!1:p??(v!==null&&v!==``),b=f===`checkbox`?v??`on`:v??``;if(!m){let e=_?y?[b]:[]:l(d);return(0,i.jsx)(i.Fragment,{children:e.map((e,t)=>(0,i.jsx)(`input`,{type:`hidden`,name:n,form:r,disabled:u,value:e,"data-wave-hidden-input":``},`${t}:${e}`))})}let x={form:r,disabled:u,required:!0,"aria-hidden":!0,tabIndex:-1,style:a,onChange:o,onInvalid:h,onFocus:s,"data-wave-hidden-input":``};if(_){let e=n||(f===`radio`&&!y?g:void 0);return(0,i.jsx)(`input`,{...x,type:f,name:e,value:b,checked:y})}let S=l(d);return S.length===0?(0,i.jsx)(`input`,{...x,type:`text`,autoComplete:`off`,value:``}):(0,i.jsx)(i.Fragment,{children:S.map((e,t)=>(0,i.jsx)(`input`,{...x,type:`text`,autoComplete:`off`,name:n,value:e},`${t}:${e}`))})}u.displayName=`HiddenInput`,exports.HiddenInput=u;
|
|
2
|
+
//# sourceMappingURL=HiddenInput.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HiddenInput.cjs","names":["getFirstTabbable","useId","_Fragment","require_runtime","require_useId","require_focus","react","react_jsx_runtime","REQUIRED_STYLE","noop","redirectFocus","input","event","root","from","target","firstValue","value","valueList","HiddenInput","props","radioGroupName","name","required","choice","type","single","isChecked","checked","choiceValue","values","v","index","common","inputName"],"sources":["../../../src/components/internal/HiddenInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useId } from '../../hooks/useId';\nimport { getFirstTabbable } from '../../lib/focus';\n\nexport { useFormReset } from '../../hooks/useFormReset';\n\n/** Properties of {@link HiddenInput} (internal; spec §2.5, C-FORMS). */\nexport interface HiddenInputProps {\n /** Field name. Without `name` (and without `required`) nothing is rendered. */\n name?: string;\n /** Id of the form the input belongs to, when the control is outside it. */\n form?: string;\n /** Disabled inputs are neither submitted nor validated. */\n disabled?: boolean;\n /**\n * The submitted value. Arrays → one input per value (an empty array submits nothing).\n * `null`/`undefined` → `''` for free values; for checkbox/radio kinds the input's `value`.\n */\n value: string | readonly string[] | null | undefined;\n /**\n * The kind of control. Without `required` every kind renders native `type=\"hidden\"` inputs.\n * With `required` a real (visually hidden) input validates natively:\n * `'radio'` for single-choice groups (RadioGroup, Rating, SwatchPicker — the browser says\n * \"select one of these options\"), `'checkbox'` for booleans (Checkbox, Switch), `'text'` for free\n * values (pickers, SpinButton). `'hidden'` with `required` behaves like `'text'`.\n * @default 'hidden'\n */\n type?: 'hidden' | 'text' | 'checkbox' | 'radio';\n /**\n * Checkbox kind: whether the value is submitted / the requirement is met (default `false`).\n * Radio kind: default \"a non-empty value is given\".\n */\n checked?: boolean;\n /** Renders a real input that takes part in native constraint validation. */\n required?: boolean;\n /** Called when the form's validation fails on this input — focus the visible control here. */\n onInvalid?: (event: React.FormEvent<HTMLInputElement>) => void;\n}\n\n/**\n * Required inputs sit at the control's inline-start bottom corner inside its `relative` root, so the\n * browser's validation bubble and scroll-into-view point at the control (spec §2.5).\n */\nconst REQUIRED_STYLE: React.CSSProperties = {\n position: 'absolute',\n insetInlineStart: 0,\n bottom: 0,\n width: 1,\n height: 1,\n margin: 0,\n padding: 0,\n border: 0,\n opacity: 0,\n pointerEvents: 'none',\n};\n\nfunction noop() {}\n\n/**\n * The browser focuses an invalid input when it reports the problem, after the `invalid` event (so\n * after `onInvalid` focused the control). This input is `aria-hidden` and invisible, so focus goes\n * straight back to the visible control: the element it came from when that is part of the same\n * control root, else the root's first tabbable element.\n *\n * The redirect must complete inside the browser's `focus()` call. Firefox\n * (`FormValidationChild.notifyInvalidSubmit`) calls `element.focus()`, then adds the `blur` listener\n * that hides its popup, then shows the popup; Chromium focuses the input, then shows the bubble,\n * which a later blur hides. Checked in Chromium 153 and Firefox 155 with a real submit click: a\n * synchronous redirect keeps the message and leaves focus on the control; without a redirect focus\n * stays on this invisible input; a deferred redirect (timer, next key) hides the message. Firefox\n * then closes its popup on the next click, scroll or zoom rather than on the control's blur.\n */\nfunction redirectFocus(event: React.FocusEvent<HTMLInputElement>) {\n const input = event.currentTarget;\n const root = input.parentElement;\n if (!root) return;\n const from = event.relatedTarget;\n const target =\n from instanceof HTMLElement && from !== input && root.contains(from)\n ? from\n : getFirstTabbable(root);\n if (target && target !== input) target.focus();\n}\n\nfunction firstValue(value: HiddenInputProps['value']): string | null {\n if (value == null) return null;\n if (typeof value === 'string') return value;\n return value[0] ?? null;\n}\n\nfunction valueList(value: HiddenInputProps['value']): readonly string[] {\n if (value == null) return [''];\n if (typeof value === 'string') return [value];\n return value;\n}\n\n/**\n * Native form participation for controls built on buttons and divs (C-FORMS). Renders `null`\n * unless the consumer passes `name` or `required` — components never invent a default name, so a\n * control inside an existing form adds no field of its own.\n *\n * - Without `required`: `type=\"hidden\"` inputs carry the value (arrays: one per value; checkbox\n * and radio kinds only while checked/chosen).\n * - With `required`: real inputs (`aria-hidden`, `tabIndex={-1}`, `pointer-events: none`,\n * opacity 0, a no-op `onChange`) absolutely positioned inside the control's **`relative`\n * root**, so native validation blocks submission with the right message and points at the\n * control. `onInvalid` should focus the visible control; focus the browser moves to the input\n * is sent back to the control. Browsers never report an unnamed radio as missing, so a required\n * radio without `name` gets a unique group name while nothing is chosen (unchecked radios are\n * not submitted, and the name is dropped once checked, so it never reaches `FormData`).\n *\n * Form reset is wired on the control with `useFormReset` (re-exported here), not by this input, so\n * uncontrolled controls without a name reset too.\n *\n * Internal (not exported from the package).\n */\nexport function HiddenInput(props: HiddenInputProps): React.ReactElement | null {\n const {\n name,\n form,\n disabled,\n value,\n type = 'hidden',\n checked,\n required = false,\n onInvalid,\n } = props;\n const radioGroupName = useId('wave-required');\n if (!name && !required) return null;\n\n const choice = type === 'checkbox' || type === 'radio';\n const single = firstValue(value);\n const isChecked =\n type === 'checkbox' ? (checked ?? false) : (checked ?? (single !== null && single !== ''));\n const choiceValue = type === 'checkbox' ? (single ?? 'on') : (single ?? '');\n\n if (!required) {\n const values = choice ? (isChecked ? [choiceValue] : []) : valueList(value);\n return (\n <>\n {values.map((v, index) => (\n <input\n key={`${index}:${v}`}\n type=\"hidden\"\n name={name}\n form={form}\n disabled={disabled}\n value={v}\n data-wave-hidden-input=\"\"\n />\n ))}\n </>\n );\n }\n\n const common = {\n form,\n disabled,\n required: true,\n 'aria-hidden': true,\n tabIndex: -1,\n style: REQUIRED_STYLE,\n onChange: noop,\n onInvalid,\n onFocus: redirectFocus,\n 'data-wave-hidden-input': '',\n } as const;\n\n if (choice) {\n // Chrome and Firefox treat an unnamed required radio as never missing; a unique group name\n // (only while unchecked, so it is never submitted) restores \"select one of these options\".\n const inputName = name || (type === 'radio' && !isChecked ? radioGroupName : undefined);\n return (\n <input {...common} type={type} name={inputName} value={choiceValue} checked={isChecked} />\n );\n }\n\n const values = valueList(value);\n if (values.length === 0) {\n // Nothing chosen: one empty, unnamed input keeps the requirement without submitting a value.\n return <input {...common} type=\"text\" autoComplete=\"off\" value=\"\" />;\n }\n return (\n <>\n {values.map((v, index) => (\n <input\n key={`${index}:${v}`}\n {...common}\n type=\"text\"\n autoComplete=\"off\"\n name={name}\n value={v}\n />\n ))}\n </>\n );\n}\n\nHiddenInput.displayName = 'HiddenInput';\n"],"mappings":"4PA2CA,IAAMQ,EAAsC,CAC1C,SAAU,WACV,iBAAkB,EAClB,OAAQ,EACR,MAAO,EACP,OAAQ,EACR,OAAQ,EACR,QAAS,EACT,OAAQ,EACR,QAAS,EACT,cAAe,MACjB,EAEA,SAASC,GAAO,CAAC,CAgBjB,S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