@mortenbrudvik/waveui 0.4.0 → 0.8.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 +1484 -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 +51 -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 +57 -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 +55 -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 +38 -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 +46 -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 +67 -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 +68 -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 +64 -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 +126 -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 +162 -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 +135 -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 +33 -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 +29 -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 +53 -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 +33 -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 +105 -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 +382 -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 +50 -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 +72 -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 +152 -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 +202 -0
- package/dist/components/feedback/MessageBar.mjs.map +1 -0
- package/dist/components/feedback/MessageBar.parts.cjs +2 -0
- package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
- package/dist/components/feedback/MessageBar.parts.mjs +84 -0
- package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
- package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
- package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
- package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
- package/dist/components/feedback/MessageBar.reflow.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 +46 -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 +73 -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 +49 -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 +61 -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.context.cjs +2 -0
- package/dist/components/feedback/Toast.context.cjs.map +1 -0
- package/dist/components/feedback/Toast.context.mjs +23 -0
- package/dist/components/feedback/Toast.context.mjs.map +1 -0
- package/dist/components/feedback/Toast.mjs +15 -0
- package/dist/components/feedback/Toast.mjs.map +1 -0
- package/dist/components/feedback/Toast.parts.cjs +2 -0
- package/dist/components/feedback/Toast.parts.cjs.map +1 -0
- package/dist/components/feedback/Toast.parts.mjs +98 -0
- package/dist/components/feedback/Toast.parts.mjs.map +1 -0
- package/dist/components/feedback/Toast.root.cjs +2 -0
- package/dist/components/feedback/Toast.root.cjs.map +1 -0
- package/dist/components/feedback/Toast.root.mjs +109 -0
- package/dist/components/feedback/Toast.root.mjs.map +1 -0
- package/dist/components/feedback/Toaster.cjs +2 -0
- package/dist/components/feedback/Toaster.cjs.map +1 -0
- package/dist/components/feedback/Toaster.mjs +564 -0
- package/dist/components/feedback/Toaster.mjs.map +1 -0
- package/dist/components/input/AlphaSlider.cjs +2 -0
- package/dist/components/input/AlphaSlider.cjs.map +1 -0
- package/dist/components/input/AlphaSlider.mjs +115 -0
- package/dist/components/input/AlphaSlider.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 +97 -0
- package/dist/components/input/Checkbox.mjs.map +1 -0
- package/dist/components/input/ColorArea.cjs +2 -0
- package/dist/components/input/ColorArea.cjs.map +1 -0
- package/dist/components/input/ColorArea.mjs +204 -0
- package/dist/components/input/ColorArea.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 +213 -0
- package/dist/components/input/ColorPicker.mjs.map +1 -0
- package/dist/components/input/ColorPicker.parts.cjs +2 -0
- package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
- package/dist/components/input/ColorPicker.parts.mjs +192 -0
- package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
- package/dist/components/input/ColorSlider.cjs +2 -0
- package/dist/components/input/ColorSlider.cjs.map +1 -0
- package/dist/components/input/ColorSlider.mjs +138 -0
- package/dist/components/input/ColorSlider.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 +192 -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 +341 -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 +131 -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 +201 -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 +82 -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 +29 -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 +171 -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 +140 -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 +197 -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 +204 -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 +34 -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 +80 -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 +158 -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 +114 -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 +93 -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 +253 -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 +33 -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 +295 -0
- package/dist/components/input/TimePicker.mjs.map +1 -0
- package/dist/components/input/colorName.cjs +2 -0
- package/dist/components/input/colorName.cjs.map +1 -0
- package/dist/components/input/colorName.mjs +30 -0
- package/dist/components/input/colorName.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 +194 -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 +237 -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 +122 -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 +206 -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 +55 -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 +63 -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 +270 -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 +40 -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 +239 -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.context.cjs +2 -0
- package/dist/components/layout/Tree.context.cjs.map +1 -0
- package/dist/components/layout/Tree.context.mjs +33 -0
- package/dist/components/layout/Tree.context.mjs.map +1 -0
- package/dist/components/layout/Tree.core.cjs +2 -0
- package/dist/components/layout/Tree.core.cjs.map +1 -0
- package/dist/components/layout/Tree.core.mjs +416 -0
- package/dist/components/layout/Tree.core.mjs.map +1 -0
- package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
- package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
- package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
- package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
- package/dist/components/layout/Tree.mjs +12 -0
- package/dist/components/layout/Tree.mjs.map +1 -0
- package/dist/components/layout/Tree.selection.cjs +2 -0
- package/dist/components/layout/Tree.selection.cjs.map +1 -0
- package/dist/components/layout/Tree.selection.mjs +73 -0
- package/dist/components/layout/Tree.selection.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 +145 -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 +60 -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 +133 -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 +47 -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 +232 -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 +309 -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 +111 -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 +52 -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 +291 -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 +118 -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 +205 -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 +181 -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 +193 -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 +367 -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 +185 -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 +161 -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 +46 -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 +52 -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 +490 -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 +100 -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 +39 -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/useMediaQuery.cjs +2 -0
- package/dist/hooks/useMediaQuery.cjs.map +1 -0
- package/dist/hooks/useMediaQuery.mjs +20 -0
- package/dist/hooks/useMediaQuery.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 +10 -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 +11086 -0
- package/dist/index.d.ts +10405 -1757
- package/dist/index.mjs +103 -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/classNames.cjs +2 -0
- package/dist/lib/classNames.cjs.map +1 -0
- package/dist/lib/classNames.mjs +415 -0
- package/dist/lib/classNames.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/color.cjs +2 -0
- package/dist/lib/color.cjs.map +1 -0
- package/dist/lib/color.mjs +86 -0
- package/dist/lib/color.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/lib/toaster.cjs +2 -0
- package/dist/lib/toaster.cjs.map +1 -0
- package/dist/lib/toaster.mjs +77 -0
- package/dist/lib/toaster.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,194 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clampUnit as e, hsvToHex as t, parseHexBytes as n, wrapHue as r } from "../../lib/color.mjs";
|
|
3
|
+
import { getArrowIntent as i } from "../../lib/direction.mjs";
|
|
4
|
+
import { getColorName as a } from "./colorName.mjs";
|
|
5
|
+
//#region src/components/input/colorUtils.ts
|
|
6
|
+
var o = "#000000", s = "#ffffff", c = /^#([0-9a-f]{6}|[0-9a-f]{8})$/i, l = /^#?[0-9a-f]{0,8}$/i;
|
|
7
|
+
function u(e, t, n) {
|
|
8
|
+
return Math.min(n, Math.max(t, e));
|
|
9
|
+
}
|
|
10
|
+
function d(e) {
|
|
11
|
+
return Math.round(u(e, 0, 255)).toString(16).padStart(2, "0");
|
|
12
|
+
}
|
|
13
|
+
function f(e) {
|
|
14
|
+
let t = n(e);
|
|
15
|
+
return t ? {
|
|
16
|
+
rgb: `#${d(t.r)}${d(t.g)}${d(t.b)}`,
|
|
17
|
+
alpha: t.alpha
|
|
18
|
+
} : null;
|
|
19
|
+
}
|
|
20
|
+
function p(e) {
|
|
21
|
+
return c.test(e.trim()) ? f(e) : null;
|
|
22
|
+
}
|
|
23
|
+
function m(e) {
|
|
24
|
+
return l.test(e.trim());
|
|
25
|
+
}
|
|
26
|
+
function h(e, t = 255) {
|
|
27
|
+
let n = Math.round(u(t, 0, 255));
|
|
28
|
+
return n === 255 ? e : e + d(n);
|
|
29
|
+
}
|
|
30
|
+
function g(e) {
|
|
31
|
+
let t = f(e);
|
|
32
|
+
return t ? h(t.rgb, t.alpha) : null;
|
|
33
|
+
}
|
|
34
|
+
function _(e) {
|
|
35
|
+
return Math.round(u(e, 0, 255) / 255 * 100);
|
|
36
|
+
}
|
|
37
|
+
function v(e) {
|
|
38
|
+
let t = e.endsWith("%"), n = Number(t ? e.slice(0, -1) : e);
|
|
39
|
+
return Number.isFinite(n) ? u(t ? n / 100 * 255 : n, 0, 255) : null;
|
|
40
|
+
}
|
|
41
|
+
function y(e) {
|
|
42
|
+
if (e === void 0) return 1;
|
|
43
|
+
let t = e.endsWith("%"), n = Number(t ? e.slice(0, -1) : e);
|
|
44
|
+
return Number.isFinite(n) ? u(t ? n / 100 : n, 0, 1) : null;
|
|
45
|
+
}
|
|
46
|
+
var b = /^rgba?\(\s*([^)]*)\)$/i;
|
|
47
|
+
function x(e) {
|
|
48
|
+
let t = e.trim(), n = f(t);
|
|
49
|
+
if (n) {
|
|
50
|
+
let e = parseInt(n.rgb.slice(1), 16);
|
|
51
|
+
return {
|
|
52
|
+
r: e >> 16 & 255,
|
|
53
|
+
g: e >> 8 & 255,
|
|
54
|
+
b: e & 255,
|
|
55
|
+
a: n.alpha / 255
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
let r = b.exec(t);
|
|
59
|
+
if (!r) return null;
|
|
60
|
+
let [i, a] = r[1].split("/"), o = (i ?? "").split(/[\s,]+/).map((e) => e.trim()).filter(Boolean), s = a?.trim();
|
|
61
|
+
if (s === void 0 && o.length === 4 && (s = o.pop()), o.length !== 3) return null;
|
|
62
|
+
let [c, l, u] = o.map(v), d = y(s);
|
|
63
|
+
return c === null || l === null || u === null || d === null ? null : {
|
|
64
|
+
r: c,
|
|
65
|
+
g: l,
|
|
66
|
+
b: u,
|
|
67
|
+
a: d
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function S(e) {
|
|
71
|
+
let t = e / 255;
|
|
72
|
+
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
73
|
+
}
|
|
74
|
+
function C(e) {
|
|
75
|
+
let t = x(e);
|
|
76
|
+
return t ? .2126 * S(t.r) + .7152 * S(t.g) + .0722 * S(t.b) : null;
|
|
77
|
+
}
|
|
78
|
+
function w(e) {
|
|
79
|
+
let t = C(e);
|
|
80
|
+
return t === null || (t + .05) / .05 >= 1.05 / (t + .05) ? {
|
|
81
|
+
glyph: o,
|
|
82
|
+
halo: s
|
|
83
|
+
} : {
|
|
84
|
+
glyph: s,
|
|
85
|
+
halo: o
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function T(e) {
|
|
89
|
+
return Number.isFinite(e) && e >= 0 && e <= 360 ? e : r(e);
|
|
90
|
+
}
|
|
91
|
+
function E(t) {
|
|
92
|
+
return {
|
|
93
|
+
h: T(t.h),
|
|
94
|
+
s: e(t.s, 0),
|
|
95
|
+
v: e(t.v, 0),
|
|
96
|
+
a: e(t.a, 1)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function D(e) {
|
|
100
|
+
return Math.round(e * 100);
|
|
101
|
+
}
|
|
102
|
+
function O(e) {
|
|
103
|
+
return `${Math.round(e * 1e4) / 100}%`;
|
|
104
|
+
}
|
|
105
|
+
function k(e, t) {
|
|
106
|
+
return e.h === t.h && e.s === t.s && e.v === t.v && (e.a ?? 1) === (t.a ?? 1);
|
|
107
|
+
}
|
|
108
|
+
function A(e, t, n, r, a) {
|
|
109
|
+
if (t.altKey || t.ctrlKey || t.metaKey) return null;
|
|
110
|
+
let o = t.shiftKey ? 10 : 1, s;
|
|
111
|
+
switch (e) {
|
|
112
|
+
case "ArrowUp":
|
|
113
|
+
s = r + o;
|
|
114
|
+
break;
|
|
115
|
+
case "ArrowDown":
|
|
116
|
+
s = r - o;
|
|
117
|
+
break;
|
|
118
|
+
case "ArrowRight":
|
|
119
|
+
case "ArrowLeft":
|
|
120
|
+
s = r + (i(e, {
|
|
121
|
+
orientation: "horizontal",
|
|
122
|
+
dir: n
|
|
123
|
+
}) === "next" ? o : -o);
|
|
124
|
+
break;
|
|
125
|
+
case "PageUp":
|
|
126
|
+
s = r + 10;
|
|
127
|
+
break;
|
|
128
|
+
case "PageDown":
|
|
129
|
+
s = r - 10;
|
|
130
|
+
break;
|
|
131
|
+
case "Home":
|
|
132
|
+
s = 0;
|
|
133
|
+
break;
|
|
134
|
+
case "End":
|
|
135
|
+
s = a;
|
|
136
|
+
break;
|
|
137
|
+
default: return null;
|
|
138
|
+
}
|
|
139
|
+
return Math.min(a, Math.max(0, s));
|
|
140
|
+
}
|
|
141
|
+
var j = (e) => e === "vertical" ? "to top" : "to right";
|
|
142
|
+
function M(e) {
|
|
143
|
+
return `linear-gradient(to top, #000000, transparent), linear-gradient(to right, #ffffff, ${t({
|
|
144
|
+
h: e,
|
|
145
|
+
s: 1,
|
|
146
|
+
v: 1
|
|
147
|
+
})})`;
|
|
148
|
+
}
|
|
149
|
+
var N = "#ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000";
|
|
150
|
+
function P(e, n, r) {
|
|
151
|
+
let i = j(r);
|
|
152
|
+
return e === "hue" ? `linear-gradient(${i}, ${N})` : e === "saturation" ? `linear-gradient(${i}, ${t({
|
|
153
|
+
h: n.h,
|
|
154
|
+
s: 0,
|
|
155
|
+
v: n.v
|
|
156
|
+
})}, ${t({
|
|
157
|
+
h: n.h,
|
|
158
|
+
s: 1,
|
|
159
|
+
v: n.v
|
|
160
|
+
})})` : `linear-gradient(${i}, #000000, ${t({
|
|
161
|
+
h: n.h,
|
|
162
|
+
s: n.s,
|
|
163
|
+
v: 1
|
|
164
|
+
})})`;
|
|
165
|
+
}
|
|
166
|
+
function F(e, n, r) {
|
|
167
|
+
let i = t({
|
|
168
|
+
h: e.h,
|
|
169
|
+
s: e.s,
|
|
170
|
+
v: e.v
|
|
171
|
+
}), a = j(r);
|
|
172
|
+
return n ? `linear-gradient(${a}, ${i}, transparent)` : `linear-gradient(${a}, transparent, ${i})`;
|
|
173
|
+
}
|
|
174
|
+
function I(e, t, n) {
|
|
175
|
+
if (n.valueText) return n.valueText(e, t);
|
|
176
|
+
let r = `${n.saturation} ${D(e.s)}%`, i = `${n.brightness} ${D(e.v)}%`, o = t === "saturation" ? `${r}, ${i}` : `${i}, ${r}`, s = (n.colorName ?? a)(e);
|
|
177
|
+
return s ? `${o}, ${s}` : o;
|
|
178
|
+
}
|
|
179
|
+
function L(e, t, n) {
|
|
180
|
+
if (n.valueText) return n.valueText(e, t);
|
|
181
|
+
if (t !== "hue") return `${D(t === "saturation" ? e.s : e.v)}%`;
|
|
182
|
+
let r = `${Math.round(e.h)}°`, i = (n.colorName ?? a)(e);
|
|
183
|
+
return i ? `${r}, ${i}` : r;
|
|
184
|
+
}
|
|
185
|
+
function R(e, t, n) {
|
|
186
|
+
if (n) return n(e, t);
|
|
187
|
+
let r = D(e.a);
|
|
188
|
+
return `${t ? 100 - r : r}%`;
|
|
189
|
+
}
|
|
190
|
+
var z = "pointer-events-none absolute size-6 rounded-full border-2 border-background bg-(--wave-color-thumb) ring-1 ring-foreground forced-colors:forced-color-adjust-none forced-colors:border-[Canvas] forced-colors:ring-[CanvasText]", B = "h-6 w-full items-center", V = "h-40 w-6 flex-col items-center [container-type:size]", H = "mx-3 h-3 flex-1 wave-rtl:-scale-x-100", U = "my-3 w-3 flex-1", W = "bg-(image:--wave-color-slider-gradient)", G = "absolute m-0 cursor-pointer appearance-none opacity-0 disabled:cursor-not-allowed [&::-webkit-slider-thumb]:size-6 [&::-webkit-slider-thumb]:appearance-none [&::-moz-range-thumb]:size-6", K = "inset-0 size-full", q = "start-1/2 top-1/2 h-6 w-[100cqh] -translate-x-1/2 wave-rtl:translate-x-1/2 -translate-y-1/2 -rotate-90", J = "pointer-events-none absolute inset-x-3 inset-y-0", Y = "pointer-events-none absolute inset-x-0 inset-y-3", X = "start-(--wave-color-slider-position) top-1/2 -translate-x-1/2 wave-rtl:translate-x-1/2 -translate-y-1/2", Z = "bottom-(--wave-color-slider-position) start-1/2 -translate-x-1/2 wave-rtl:translate-x-1/2 translate-y-1/2";
|
|
191
|
+
//#endregion
|
|
192
|
+
export { z as COLOR_THUMB_CLASSES, W as RAIL_GRADIENT, G as RAIL_INPUT_CLASSES, K as RAIL_INPUT_HORIZONTAL, q as RAIL_INPUT_VERTICAL, B as RAIL_ROOT_HORIZONTAL, V as RAIL_ROOT_VERTICAL, H as RAIL_TRACK_HORIZONTAL, U as RAIL_TRACK_VERTICAL, X as THUMB_POSITION_HORIZONTAL, Z as THUMB_POSITION_VERTICAL, J as THUMB_TRACK_HORIZONTAL, Y as THUMB_TRACK_VERTICAL, F as alphaSliderGradient, _ as alphaToOpacity, R as alphaValueText, I as areaValueText, M as colorAreaGradient, P as colorSliderGradient, E as displayColor, T as displayHue, h as formatHexColor, w as getCheckColors, C as getRelativeLuminance, m as isHexDraft, g as normalizeHexColor, x as parseCssColor, f as parseHexColor, p as parseHexInput, A as railKeyTarget, k as sameColor, L as sliderValueText, D as toPercent, O as toPosition };
|
|
193
|
+
|
|
194
|
+
//# sourceMappingURL=colorUtils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorUtils.mjs","names":["BLACK","WHITE","HEX_INPUT","HEX_DRAFT","clamp","max","min","value","toHexByte","parseHexColor","bytes","parseHexBytes","parseHexInput","text","isHexDraft","formatHexColor","byte","alpha","rgb","normalizeHexColor","parsed","alphaToOpacity","parseChannel","percent","token","parseAlpha","RGB_FUNCTION","parseCssColor","hex","n","match","channelsPart","alphaPart","tokens","t","alphaToken","r","g","b","a","linearize","c","channel","getRelativeLuminance","color","getCheckColors","luminance","displayHue","h","wrapHue","displayColor","clampUnit","toPercent","toPosition","sameColor","railKeyTarget","modifiers","step","next","key","current","getArrowIntent","toward","orientation","colorAreaGradient","hsvToHex","HUE_SPECTRUM","colorSliderGradient","direction","alphaSliderGradient","opaque","transparency","areaValueText","labels","saturation","brightness","channels","name","getColorName","sliderValueText","degrees","alphaValueText","valueText","opacity","COLOR_THUMB_CLASSES","RAIL_ROOT_HORIZONTAL","RAIL_ROOT_VERTICAL","RAIL_TRACK_HORIZONTAL","RAIL_TRACK_VERTICAL","RAIL_GRADIENT","RAIL_INPUT_CLASSES","RAIL_INPUT_HORIZONTAL","RAIL_INPUT_VERTICAL","THUMB_TRACK_HORIZONTAL","THUMB_TRACK_VERTICAL","THUMB_POSITION_HORIZONTAL","THUMB_POSITION_VERTICAL"],"sources":["../../../src/components/input/colorUtils.ts"],"sourcesContent":["/**\n * Color helpers for ColorPicker, SwatchPicker and the HSV color parts: hex parsing and\n * normalisation (on the grammar of `src/lib/color.ts`), the alpha byte ↔ opacity percentage, and\n * 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 */\nimport { clampUnit, hsvToHex, parseHexBytes, wrapHue } from '../../lib/color';\nimport { getArrowIntent, type Direction } from '../../lib/direction';\nimport type { HsvColor } from '../../lib/types';\nimport { getColorName } from './colorName';\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_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\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 bytes = parseHexBytes(value);\n return bytes\n ? {\n rgb: `#${toHexByte(bytes.r)}${toHexByte(bytes.g)}${toHexByte(bytes.b)}`,\n alpha: bytes.alpha,\n }\n : 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 return HEX_INPUT.test(text.trim()) ? parseHexColor(text) : 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\n// ---------------------------------------------------------------------------------------------\n// The HSV color parts: ColorArea, ColorSlider and AlphaSlider (spec P3-05)\n// ---------------------------------------------------------------------------------------------\n\n/** The channels of an HSV color that a part edits or names in a value text. */\nexport type ColorChannel = 'hue' | 'saturation' | 'value' | 'alpha';\n\n/** Which way a rail runs: left to right (mirrored in right-to-left layouts), or bottom to top. */\nexport type RailOrientation = 'horizontal' | 'vertical';\n\n/** The modifier keys of a key press. */\nexport interface KeyModifiers {\n shiftKey: boolean;\n altKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n}\n\n/**\n * A hue as a part shows it: 0–360 kept as given (360 is the end of a hue rail), any other finite\n * hue wrapped into [0, 360), and a hue that is not finite as 0.\n */\nexport function displayHue(h: number): number {\n return Number.isFinite(h) && h >= 0 && h <= 360 ? h : wrapHue(h);\n}\n\n/**\n * A color as a part shows it: the hue for display, saturation and brightness clamped to [0, 1]\n * (not a number: 0) and alpha clamped to [0, 1] (left out or not a number: 1).\n */\nexport function displayColor(color: HsvColor): Required<HsvColor> {\n return {\n h: displayHue(color.h),\n s: clampUnit(color.s, 0),\n v: clampUnit(color.v, 0),\n a: clampUnit(color.a, 1),\n };\n}\n\n/** A 0–1 channel as the whole percentage the range inputs and value texts use. */\nexport function toPercent(value: number): number {\n return Math.round(value * 100);\n}\n\n/** A 0–1 position as a CSS percentage with at most two decimals, for an inline custom property. */\nexport function toPosition(value: number): string {\n return `${Math.round(value * 10000) / 100}%`;\n}\n\n/** Whether two colors have the same channels (a missing alpha equals 1). */\nexport function sameColor(a: HsvColor, b: HsvColor): boolean {\n return a.h === b.h && a.s === b.s && a.v === b.v && (a.a ?? 1) === (b.a ?? 1);\n}\n\n/**\n * The value a rail (a range from 0 to `max`) moves to for a key press, or `null` for a key it\n * leaves alone: ArrowUp and ArrowDown by 1; ArrowRight and ArrowLeft by 1 toward the reading\n * direction's end and start (so mirrored in right-to-left layouts); Shift with an arrow, Page Up\n * and Page Down by 10; Home and End to 0 and `max`. A key with Alt, Ctrl or Meta belongs to the\n * browser. The result is clamped to the range.\n */\nexport function railKeyTarget(\n key: string,\n modifiers: KeyModifiers,\n dir: Direction,\n current: number,\n max: number,\n): number | null {\n if (modifiers.altKey || modifiers.ctrlKey || modifiers.metaKey) return null;\n const step = modifiers.shiftKey ? 10 : 1;\n let next: number;\n switch (key) {\n case 'ArrowUp':\n next = current + step;\n break;\n case 'ArrowDown':\n next = current - step;\n break;\n case 'ArrowRight':\n case 'ArrowLeft':\n next =\n current +\n (getArrowIntent(key, { orientation: 'horizontal', dir }) === 'next' ? step : -step);\n break;\n case 'PageUp':\n next = current + 10;\n break;\n case 'PageDown':\n next = current - 10;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = max;\n break;\n default:\n return null;\n }\n return Math.min(max, Math.max(0, next));\n}\n\nconst toward = (orientation: RailOrientation) =>\n orientation === 'vertical' ? 'to top' : 'to right';\n\n/** The field of a ColorArea at hue `h`: white to the pure hue left to right, black toward the bottom. */\nexport function colorAreaGradient(h: number): string {\n const hue = hsvToHex({ h, s: 1, v: 1 });\n // wave-allow-color: the saturation and brightness field of the user's color (runtime gradient)\n return `linear-gradient(to top, #000000, transparent), linear-gradient(to right, #ffffff, ${hue})`;\n}\n\n// wave-allow-color: the hue spectrum of a hue rail (runtime gradient data, not a theme color)\nconst HUE_SPECTRUM = '#ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000';\n\n/**\n * The rail of a ColorSlider: the hue spectrum, gray to the full color at the color's brightness\n * (saturation), or black to the color at full brightness (brightness).\n */\nexport function colorSliderGradient(\n channel: 'hue' | 'saturation' | 'value',\n color: Required<HsvColor>,\n orientation: RailOrientation,\n): string {\n const direction = toward(orientation);\n if (channel === 'hue') return `linear-gradient(${direction}, ${HUE_SPECTRUM})`;\n if (channel === 'saturation') {\n const gray = hsvToHex({ h: color.h, s: 0, v: color.v });\n const full = hsvToHex({ h: color.h, s: 1, v: color.v });\n return `linear-gradient(${direction}, ${gray}, ${full})`;\n }\n const bright = hsvToHex({ h: color.h, s: color.s, v: 1 });\n // wave-allow-color: the brightness rail runs from black to the color (runtime gradient)\n return `linear-gradient(${direction}, #000000, ${bright})`;\n}\n\n/** The rail of an AlphaSlider: transparent to the opaque color, or the reverse with `transparency`. */\nexport function alphaSliderGradient(\n color: Required<HsvColor>,\n transparency: boolean,\n orientation: RailOrientation,\n): string {\n const opaque = hsvToHex({ h: color.h, s: color.s, v: color.v });\n const direction = toward(orientation);\n return transparency\n ? `linear-gradient(${direction}, ${opaque}, transparent)`\n : `linear-gradient(${direction}, transparent, ${opaque})`;\n}\n\n/**\n * The value text of one of ColorArea's inputs: its own channel first, then the other one, then\n * the color's name (\"Saturation 72%, Brightness 40%, dark blue\"). `colorName` replaces the namer\n * (`''` leaves the name out); `valueText` replaces the whole text.\n */\nexport function areaValueText(\n color: Required<HsvColor>,\n channel: 'saturation' | 'value',\n labels: {\n saturation: string;\n brightness: string;\n colorName?: (color: HsvColor) => string;\n valueText?: (color: HsvColor, channel: 'saturation' | 'value') => string;\n },\n): string {\n if (labels.valueText) return labels.valueText(color, channel);\n const saturation = `${labels.saturation} ${toPercent(color.s)}%`;\n const brightness = `${labels.brightness} ${toPercent(color.v)}%`;\n const channels =\n channel === 'saturation' ? `${saturation}, ${brightness}` : `${brightness}, ${saturation}`;\n const name = (labels.colorName ?? getColorName)(color);\n return name ? `${channels}, ${name}` : channels;\n}\n\n/** The value text of a ColorSlider: \"210°, blue\" for hue, \"72%\" for saturation and brightness. */\nexport function sliderValueText(\n color: Required<HsvColor>,\n channel: 'hue' | 'saturation' | 'value',\n labels: {\n colorName?: (color: HsvColor) => string;\n valueText?: (color: HsvColor, channel: 'hue' | 'saturation' | 'value') => string;\n },\n): string {\n if (labels.valueText) return labels.valueText(color, channel);\n if (channel !== 'hue') return `${toPercent(channel === 'saturation' ? color.s : color.v)}%`;\n const degrees = `${Math.round(color.h)}°`;\n const name = (labels.colorName ?? getColorName)(color);\n return name ? `${degrees}, ${name}` : degrees;\n}\n\n/** The value text of an AlphaSlider: the opacity (\"40%\"), or the transparency with `transparency`. */\nexport function alphaValueText(\n color: Required<HsvColor>,\n transparency: boolean,\n valueText?: (color: HsvColor, transparency: boolean) => string,\n): string {\n if (valueText) return valueText(color, transparency);\n const opacity = toPercent(color.a);\n return `${transparency ? 100 - opacity : opacity}%`;\n}\n\n/**\n * The thumb of ColorArea, ColorSlider and AlphaSlider (decorative; the focused input is what\n * assistive technology reads): 24 px, filled from `--wave-color-thumb`, with a two-tone edge (a\n * `background` border inside a `foreground` ring) that shows on any color. Forced colors keep the\n * fill and draw the edge in system colors. Each part adds its own focus classes, keyed on its\n * named group, and its part class.\n */\nexport const COLOR_THUMB_CLASSES =\n 'pointer-events-none absolute size-6 rounded-full border-2 border-background bg-(--wave-color-thumb) ring-1 ring-foreground forced-colors:forced-color-adjust-none forced-colors:border-[Canvas] forced-colors:ring-[CanvasText]';\n\n/** The root of a horizontal ColorSlider or AlphaSlider (24 px, as tall as the thumb). */\nexport const RAIL_ROOT_HORIZONTAL = 'h-6 w-full items-center';\n/** The root of a vertical one: a size container, so the turned input can be as long as it is tall. */\nexport const RAIL_ROOT_VERTICAL = 'h-40 w-6 flex-col items-center [container-type:size]';\n/** The drawn rail, inset by half a thumb at both ends (a horizontal one mirrors in right-to-left layouts). */\nexport const RAIL_TRACK_HORIZONTAL = 'mx-3 h-3 flex-1 wave-rtl:-scale-x-100';\nexport const RAIL_TRACK_VERTICAL = 'my-3 w-3 flex-1';\n/** The rail's gradient, read from the inline `--wave-color-slider-gradient` property. */\nexport const RAIL_GRADIENT = 'bg-(image:--wave-color-slider-gradient)';\n/**\n * The native range input of a rail: over the whole slider and invisible, with its own thumb as\n * wide as the drawn one, so a press lands on the value under the drawn thumb.\n */\nexport const RAIL_INPUT_CLASSES =\n 'absolute m-0 cursor-pointer appearance-none opacity-0 disabled:cursor-not-allowed [&::-webkit-slider-thumb]:size-6 [&::-webkit-slider-thumb]:appearance-none [&::-moz-range-thumb]:size-6';\nexport const RAIL_INPUT_HORIZONTAL = 'inset-0 size-full';\n/** Turned a quarter, so its start (the minimum) is at the bottom; it carries `dir=\"ltr\"`. */\nexport const RAIL_INPUT_VERTICAL =\n 'start-1/2 top-1/2 h-6 w-[100cqh] -translate-x-1/2 wave-rtl:translate-x-1/2 -translate-y-1/2 -rotate-90';\n/** The box the thumb moves in: the rail's length, so its center meets the native thumb's. */\nexport const THUMB_TRACK_HORIZONTAL = 'pointer-events-none absolute inset-x-3 inset-y-0';\nexport const THUMB_TRACK_VERTICAL = 'pointer-events-none absolute inset-x-0 inset-y-3';\n/** The thumb's place along the rail, read from the inline `--wave-color-slider-position` property. */\nexport const THUMB_POSITION_HORIZONTAL =\n 'start-(--wave-color-slider-position) top-1/2 -translate-x-1/2 wave-rtl:translate-x-1/2 -translate-y-1/2';\nexport const THUMB_POSITION_VERTICAL =\n 'bottom-(--wave-color-slider-position) start-1/2 -translate-x-1/2 wave-rtl:translate-x-1/2 translate-y-1/2';\n"],"mappings":";;;;;AAoCA,IAAMA,IAAQ,WAERC,IAAQ,WAERC,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;AAQA,SAAgBE,EAAc,GAAgC;CAC5D,IAAMC,IAAQC,EAAcJ,CAAK;CACjC,OAAOG,IACH;EACE,KAAK,IAAIF,EAAUE,EAAM,CAAC,IAAIF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Ae,GAAGA,EAAW,IAAID,KAC1EG,KAAQJ,EAAO,aAAaK,EAAA,CAAclC,CAAK;CACrD,OAAOiC,IAAO,GAAGD,EAAS,IAAIC,MAASD;AACzC;AAGA,SAAgBG,EACd,GACA,GACA,GAIQ;CACR,IAAIN,EAAO,WAAW,OAAOA,EAAO,UAAU7B,GAAOF,CAAO;CAC5D,IAAIA,MAAY,OAAO,OAAO,GAAGU,EAAUV,MAAY,eAAeE,EAAM,IAAIA,EAAM,CAAC,EAAE;CACzF,IAAMoC,IAAU,GAAG,KAAK,MAAMpC,EAAM,CAAC,EAAE,IACjCiC,KAAQJ,EAAO,aAAaK,EAAA,CAAclC,CAAK;CACrD,OAAOiC,IAAO,GAAGG,EAAQ,IAAIH,MAASG;AACxC;AAGA,SAAgBC,EACd,GACA,GACA,GACQ;CACR,IAAIC,GAAW,OAAOA,EAAUtC,GAAO2B,CAAY;CACnD,IAAMY,IAAU/B,EAAUR,EAAM,CAAC;CACjC,OAAO,GAAG2B,IAAe,MAAMY,IAAUA,EAAQ;AACnD;AASA,IAAaC,IACX,mOAGWC,IAAuB,2BAEvBC,IAAqB,wDAErBC,IAAwB,yCACxBC,IAAsB,mBAEtBC,IAAgB,2CAKhBC,IACX,6LACWC,IAAwB,qBAExBC,IACX,0GAEWC,IAAyB,oDACzBC,IAAuB,oDAEvBC,IACX,2GACWC,IACX"}
|
|
@@ -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,KAA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AAU,EAAE,EAAI,GACnCM,EAASP,GAAS,GAAK,KAAO,KAEpC,MAAO,GADSA,EAAQ,IAAO,EAAI,GAAKA,EAAQ,GAC9B,GAAG/D,EAAIgE,EAAU,GAAI,CAAC,EAAE,GAAGM,GAC/C,CAUA,SAAgBC,EAAkB,EAAgD,CAEhF,MADI,CAAC,OAAO,SAASC,CAAI,GAAKA,GAAQ,EAAU,CAAE,KAAA,GAAyB,MAAO,EAAM,EACjF,CAAE,KAAM,KAAK,IAAI,EAAG,KAAK,MAAMA,CAAI,CAAC,EAAG,MAAO,EAAK,CAC5D,CAeA,SAAgBC,EACd,EACA,EACA,EACA,EACc,CACd,IAAMC,EAAYH,EAAkBC,CAAI,CAAC,CAAC,KACpClF,EAAMuE,EAAcc,CAAO,EAC3BpF,EAAMsE,EAAce,CAAO,EACjC,GAAI,OAAO,MAAMtF,CAAG,GAAK,OAAO,MAAMC,CAAG,GAAKD,EAAMC,EAAK,MAAO,CAAC,EACjE,IAAM6B,EAAwB,CAAC,EAC/B,IAAK,IAAI4C,EAAU1E,EAAK0E,GAAWzE,EAAK,GAAWmF,EACjDtD,EAAQ,KAAK,CAAE,MAAO+C,EAAeH,CAAO,EAAG,MAAOI,EAAcJ,EAASK,CAAM,CAAE,CAAC,EAExF,OAAOjD,CACT"}
|
|
@@ -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
|