@mortenbrudvik/waveui 0.7.0 → 0.9.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 +564 -155
- package/dist/components/button/Button.cjs +1 -1
- package/dist/components/button/Button.cjs.map +1 -1
- package/dist/components/button/Button.mjs +36 -35
- package/dist/components/button/Button.mjs.map +1 -1
- package/dist/components/button/Button.slots.cjs +1 -1
- package/dist/components/button/Button.slots.cjs.map +1 -1
- package/dist/components/button/Button.slots.mjs +31 -21
- package/dist/components/button/Button.slots.mjs.map +1 -1
- package/dist/components/button/CompoundButton.cjs +1 -1
- package/dist/components/button/CompoundButton.cjs.map +1 -1
- package/dist/components/button/CompoundButton.mjs +31 -29
- package/dist/components/button/CompoundButton.mjs.map +1 -1
- package/dist/components/button/Link.cjs +1 -1
- package/dist/components/button/Link.cjs.map +1 -1
- package/dist/components/button/Link.mjs +24 -23
- package/dist/components/button/Link.mjs.map +1 -1
- package/dist/components/button/MenuButton.cjs +1 -1
- package/dist/components/button/MenuButton.cjs.map +1 -1
- package/dist/components/button/MenuButton.mjs +29 -28
- package/dist/components/button/MenuButton.mjs.map +1 -1
- package/dist/components/button/SplitButton.cjs +1 -1
- package/dist/components/button/SplitButton.cjs.map +1 -1
- package/dist/components/button/SplitButton.mjs +46 -45
- package/dist/components/button/SplitButton.mjs.map +1 -1
- package/dist/components/button/ToggleButton.cjs +1 -1
- package/dist/components/button/ToggleButton.cjs.map +1 -1
- package/dist/components/button/ToggleButton.mjs +38 -35
- package/dist/components/button/ToggleButton.mjs.map +1 -1
- package/dist/components/button/Toolbar.cjs +1 -1
- package/dist/components/button/Toolbar.cjs.map +1 -1
- package/dist/components/button/Toolbar.mjs +43 -42
- package/dist/components/button/Toolbar.mjs.map +1 -1
- package/dist/components/button/Toolbar.parts.cjs +1 -1
- package/dist/components/button/Toolbar.parts.cjs.map +1 -1
- package/dist/components/button/Toolbar.parts.mjs +76 -81
- package/dist/components/button/Toolbar.parts.mjs.map +1 -1
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.mjs +72 -67
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.mjs +89 -88
- package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
- package/dist/components/data-display/Badge.cjs +1 -1
- package/dist/components/data-display/Badge.cjs.map +1 -1
- package/dist/components/data-display/Badge.mjs +17 -16
- package/dist/components/data-display/Badge.mjs.map +1 -1
- package/dist/components/data-display/CounterBadge.cjs +1 -1
- package/dist/components/data-display/CounterBadge.cjs.map +1 -1
- package/dist/components/data-display/CounterBadge.mjs +18 -17
- package/dist/components/data-display/CounterBadge.mjs.map +1 -1
- package/dist/components/data-display/Divider.cjs +1 -1
- package/dist/components/data-display/Divider.cjs.map +1 -1
- package/dist/components/data-display/Divider.mjs +31 -30
- package/dist/components/data-display/Divider.mjs.map +1 -1
- package/dist/components/data-display/Image.cjs +1 -1
- package/dist/components/data-display/Image.cjs.map +1 -1
- package/dist/components/data-display/Image.mjs +16 -15
- package/dist/components/data-display/Image.mjs.map +1 -1
- package/dist/components/data-display/InfoButton.cjs +2 -0
- package/dist/components/data-display/InfoButton.cjs.map +1 -0
- package/dist/components/data-display/InfoButton.mjs +173 -0
- package/dist/components/data-display/InfoButton.mjs.map +1 -0
- package/dist/components/data-display/InfoLabel.cjs +1 -1
- package/dist/components/data-display/InfoLabel.cjs.map +1 -1
- package/dist/components/data-display/InfoLabel.mjs +36 -92
- package/dist/components/data-display/InfoLabel.mjs.map +1 -1
- package/dist/components/data-display/List.cjs +1 -1
- package/dist/components/data-display/List.cjs.map +1 -1
- package/dist/components/data-display/List.mjs +175 -174
- package/dist/components/data-display/List.mjs.map +1 -1
- package/dist/components/data-display/Persona.cjs +1 -1
- package/dist/components/data-display/Persona.cjs.map +1 -1
- package/dist/components/data-display/Persona.mjs +31 -29
- package/dist/components/data-display/Persona.mjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.cjs +1 -1
- package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.mjs +25 -24
- package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +87 -82
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/feedback/MessageBar.cjs +1 -1
- package/dist/components/feedback/MessageBar.cjs.map +1 -1
- package/dist/components/feedback/MessageBar.mjs +129 -71
- package/dist/components/feedback/MessageBar.mjs.map +1 -1
- 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 +1 -1
- package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
- package/dist/components/feedback/MessageBar.status.mjs +2 -1
- package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
- package/dist/components/feedback/ProgressBar.cjs +1 -1
- package/dist/components/feedback/ProgressBar.cjs.map +1 -1
- package/dist/components/feedback/ProgressBar.mjs +44 -43
- package/dist/components/feedback/ProgressBar.mjs.map +1 -1
- package/dist/components/feedback/Skeleton.cjs +1 -1
- package/dist/components/feedback/Skeleton.cjs.map +1 -1
- package/dist/components/feedback/Skeleton.mjs +26 -24
- package/dist/components/feedback/Skeleton.mjs.map +1 -1
- package/dist/components/feedback/Spinner.cjs +1 -1
- package/dist/components/feedback/Spinner.cjs.map +1 -1
- package/dist/components/feedback/Spinner.mjs +32 -31
- package/dist/components/feedback/Spinner.mjs.map +1 -1
- package/dist/components/feedback/Toast.cjs +1 -1
- package/dist/components/feedback/Toast.cjs.map +1 -1
- 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 +10 -342
- package/dist/components/feedback/Toast.mjs.map +1 -1
- 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 +1 -1
- package/dist/components/input/Checkbox.cjs.map +1 -1
- package/dist/components/input/Checkbox.mjs +87 -70
- package/dist/components/input/Checkbox.mjs.map +1 -1
- 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 +5 -5
- package/dist/components/input/ColorPicker.cjs.map +1 -1
- package/dist/components/input/ColorPicker.mjs +142 -165
- package/dist/components/input/ColorPicker.mjs.map +1 -1
- 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 +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +22 -22
- package/dist/components/input/Combobox.expand.mjs.map +1 -1
- package/dist/components/input/Combobox.mjs +151 -141
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +239 -234
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +109 -100
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Field.cjs +1 -1
- package/dist/components/input/Field.cjs.map +1 -1
- package/dist/components/input/Field.mjs +139 -105
- package/dist/components/input/Field.mjs.map +1 -1
- package/dist/components/input/Input.cjs +1 -1
- package/dist/components/input/Input.cjs.map +1 -1
- package/dist/components/input/Input.mjs +80 -55
- package/dist/components/input/Input.mjs.map +1 -1
- package/dist/components/input/Label.cjs +1 -1
- package/dist/components/input/Label.cjs.map +1 -1
- package/dist/components/input/Label.mjs +19 -12
- package/dist/components/input/Label.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +100 -98
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/RadioGroup.cjs +1 -1
- package/dist/components/input/RadioGroup.cjs.map +1 -1
- package/dist/components/input/RadioGroup.mjs +89 -88
- package/dist/components/input/RadioGroup.mjs.map +1 -1
- package/dist/components/input/Rating.cjs +1 -1
- package/dist/components/input/Rating.cjs.map +1 -1
- package/dist/components/input/Rating.item.cjs +2 -0
- package/dist/components/input/Rating.item.cjs.map +1 -0
- package/dist/components/input/Rating.item.mjs +255 -0
- package/dist/components/input/Rating.item.mjs.map +1 -0
- package/dist/components/input/Rating.mjs +152 -152
- package/dist/components/input/Rating.mjs.map +1 -1
- package/dist/components/input/SearchBox.cjs +1 -1
- package/dist/components/input/SearchBox.cjs.map +1 -1
- package/dist/components/input/SearchBox.mjs +162 -132
- package/dist/components/input/SearchBox.mjs.map +1 -1
- package/dist/components/input/Select.cjs +1 -1
- package/dist/components/input/Select.cjs.map +1 -1
- package/dist/components/input/Select.mjs +34 -24
- package/dist/components/input/Select.mjs.map +1 -1
- package/dist/components/input/Slider.cjs +1 -1
- package/dist/components/input/Slider.cjs.map +1 -1
- package/dist/components/input/Slider.mjs +78 -54
- package/dist/components/input/Slider.mjs.map +1 -1
- package/dist/components/input/SpinButton.cjs +1 -1
- package/dist/components/input/SpinButton.cjs.map +1 -1
- package/dist/components/input/SpinButton.mjs +202 -99
- package/dist/components/input/SpinButton.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.mjs +38 -37
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/Switch.cjs +1 -1
- package/dist/components/input/Switch.cjs.map +1 -1
- package/dist/components/input/Switch.mjs +75 -58
- package/dist/components/input/Switch.mjs.map +1 -1
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.mjs +199 -169
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/Textarea.cjs +1 -1
- package/dist/components/input/Textarea.cjs.map +1 -1
- package/dist/components/input/Textarea.mjs +31 -23
- package/dist/components/input/Textarea.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +185 -177
- package/dist/components/input/TimePicker.mjs.map +1 -1
- 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 +1 -1
- package/dist/components/input/colorUtils.cjs.map +1 -1
- package/dist/components/input/colorUtils.mjs +154 -56
- package/dist/components/input/colorUtils.mjs.map +1 -1
- package/dist/components/input/fieldLabel.cjs +2 -0
- package/dist/components/input/fieldLabel.cjs.map +1 -0
- package/dist/components/input/fieldLabel.mjs +17 -0
- package/dist/components/input/fieldLabel.mjs.map +1 -0
- package/dist/components/input/inputLook.cjs +2 -0
- package/dist/components/input/inputLook.cjs.map +1 -0
- package/dist/components/input/inputLook.mjs +28 -0
- package/dist/components/input/inputLook.mjs.map +1 -0
- package/dist/components/input/pickerStyles.cjs +1 -1
- package/dist/components/input/pickerStyles.cjs.map +1 -1
- package/dist/components/input/pickerStyles.mjs +42 -4
- package/dist/components/input/pickerStyles.mjs.map +1 -1
- package/dist/components/layout/Accordion.cjs +1 -1
- package/dist/components/layout/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs +130 -129
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/layout/Card.cjs +1 -1
- package/dist/components/layout/Card.cjs.map +1 -1
- package/dist/components/layout/Card.mjs +78 -77
- package/dist/components/layout/Card.mjs.map +1 -1
- package/dist/components/layout/Carousel.cjs +1 -1
- package/dist/components/layout/Carousel.cjs.map +1 -1
- package/dist/components/layout/Carousel.mjs +111 -110
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/Flex.cjs +1 -1
- package/dist/components/layout/Flex.cjs.map +1 -1
- package/dist/components/layout/Flex.mjs +22 -21
- package/dist/components/layout/Flex.mjs.map +1 -1
- package/dist/components/layout/Grid.cjs +1 -1
- package/dist/components/layout/Grid.cjs.map +1 -1
- package/dist/components/layout/Grid.mjs +19 -18
- package/dist/components/layout/Grid.mjs.map +1 -1
- package/dist/components/layout/Overflow.cjs +1 -1
- package/dist/components/layout/Overflow.cjs.map +1 -1
- package/dist/components/layout/Overflow.mjs +92 -91
- package/dist/components/layout/Overflow.mjs.map +1 -1
- package/dist/components/layout/Stack.cjs +1 -1
- package/dist/components/layout/Stack.cjs.map +1 -1
- package/dist/components/layout/Stack.mjs +14 -13
- package/dist/components/layout/Stack.mjs.map +1 -1
- package/dist/components/layout/TabList.cjs +1 -1
- package/dist/components/layout/TabList.cjs.map +1 -1
- package/dist/components/layout/TabList.mjs +118 -117
- package/dist/components/layout/TabList.mjs.map +1 -1
- package/dist/components/layout/Tree.cjs +1 -1
- package/dist/components/layout/Tree.cjs.map +1 -1
- 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 +7 -215
- package/dist/components/layout/Tree.mjs.map +1 -1
- 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/navigation/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
- package/dist/components/navigation/Breadcrumb.mjs +76 -75
- package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
- package/dist/components/navigation/Menu.group.cjs +1 -1
- package/dist/components/navigation/Menu.group.cjs.map +1 -1
- package/dist/components/navigation/Menu.group.mjs +39 -37
- package/dist/components/navigation/Menu.group.mjs.map +1 -1
- package/dist/components/navigation/Menu.items.cjs +1 -1
- package/dist/components/navigation/Menu.items.cjs.map +1 -1
- package/dist/components/navigation/Menu.items.mjs +67 -61
- package/dist/components/navigation/Menu.items.mjs.map +1 -1
- package/dist/components/navigation/Menu.link.cjs +1 -1
- package/dist/components/navigation/Menu.link.cjs.map +1 -1
- package/dist/components/navigation/Menu.link.mjs +34 -28
- package/dist/components/navigation/Menu.link.mjs.map +1 -1
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +114 -113
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +171 -170
- package/dist/components/navigation/Menu.root.mjs.map +1 -1
- package/dist/components/navigation/Menu.selectable.cjs +1 -1
- package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
- package/dist/components/navigation/Menu.selectable.mjs +85 -63
- package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
- package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
- package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
- package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
- package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
- package/dist/components/navigation/Menu.trigger.cjs +1 -1
- package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
- package/dist/components/navigation/Menu.trigger.mjs +6 -6
- package/dist/components/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.mjs +170 -155
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination.cjs.map +1 -1
- package/dist/components/navigation/Pagination.mjs +73 -65
- package/dist/components/navigation/Pagination.mjs.map +1 -1
- package/dist/components/navigation/Stepper.cjs +1 -1
- package/dist/components/navigation/Stepper.cjs.map +1 -1
- package/dist/components/navigation/Stepper.mjs +110 -109
- package/dist/components/navigation/Stepper.mjs.map +1 -1
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +109 -108
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Drawer.cjs +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.mjs +110 -109
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +148 -151
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/Popover.shared.cjs +1 -1
- package/dist/components/overlays/Popover.shared.cjs.map +1 -1
- package/dist/components/overlays/Popover.shared.mjs +82 -77
- package/dist/components/overlays/Popover.shared.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs +41 -37
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +87 -86
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +33 -32
- package/dist/components/portal/Portal.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +36 -29
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.mjs +228 -227
- package/dist/components/table/DataGrid.mjs.map +1 -1
- package/dist/components/table/Table.cjs +1 -1
- package/dist/components/table/Table.cjs.map +1 -1
- package/dist/components/table/Table.mjs +60 -59
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/typography/Text.cjs +1 -1
- package/dist/components/typography/Text.cjs.map +1 -1
- package/dist/components/typography/Text.mjs +12 -11
- package/dist/components/typography/Text.mjs.map +1 -1
- package/dist/hooks/useFieldControl.cjs.map +1 -1
- package/dist/hooks/useFieldControl.mjs.map +1 -1
- 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/usePrefersReducedMotion.cjs +1 -1
- package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
- package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
- package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +3 -3
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2890 -197
- package/dist/index.d.ts +2890 -197
- package/dist/index.mjs +101 -87
- package/dist/lib/classNames.cjs +2 -0
- package/dist/lib/classNames.cjs.map +1 -0
- package/dist/lib/classNames.mjs +423 -0
- package/dist/lib/classNames.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/globalRegistry.cjs.map +1 -1
- package/dist/lib/globalRegistry.mjs.map +1 -1
- package/dist/lib/styles.cjs +1 -1
- package/dist/lib/styles.cjs.map +1 -1
- package/dist/lib/styles.mjs +21 -4
- package/dist/lib/styles.mjs.map +1 -1
- 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/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +13 -0
|
@@ -2,186 +2,196 @@
|
|
|
2
2
|
import { cn as e } from "../../lib/cn.mjs";
|
|
3
3
|
import { warnDeprecated as t } from "../../lib/dev.mjs";
|
|
4
4
|
import { composeEventHandlers as n } from "../../lib/composeEventHandlers.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { comboboxClassNames as r } from "../../lib/classNames.mjs";
|
|
6
|
+
import { useControllable as i } from "../../hooks/useControllable.mjs";
|
|
7
|
+
import { useMergedRefs as a } from "../../hooks/useMergedRefs.mjs";
|
|
7
8
|
import { useFieldContext as ee, useFieldControl as te } from "../../hooks/useFieldControl.mjs";
|
|
8
|
-
import { disabledStyles as ne,
|
|
9
|
-
import { DismissIcon as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
9
|
+
import { disabledStyles as ne, inputAppearanceClasses as re, inputFocus as ie, inputHeightClasses as ae, inputPaddingClasses as oe, inputTextClasses as o } from "../../lib/styles.mjs";
|
|
10
|
+
import { DismissIcon as se } from "../../lib/icons.mjs";
|
|
11
|
+
import { useInputLook as ce } from "./inputLook.mjs";
|
|
12
|
+
import { isInvalidLook as le } from "./Input.mjs";
|
|
13
|
+
import { useFormReset as ue } from "../../hooks/useFormReset.mjs";
|
|
14
|
+
import { HiddenInput as de } from "../internal/HiddenInput.mjs";
|
|
15
|
+
import { collectOptionLabels as fe, useListbox as s } from "../../hooks/useListbox.mjs";
|
|
16
|
+
import { pickerButtonOffset as pe, pickerEndPadding as me, pickerGlyphSize as he, pickerIconButtonClasses as ge } from "./pickerStyles.mjs";
|
|
17
|
+
import { PickerExpandButton as _e, showsExpandButton as ve } from "./Combobox.expand.mjs";
|
|
18
|
+
import { ListboxSurface as ye, Option as c, OptionGroup as l, useListboxPopup as be } from "./Option.mjs";
|
|
19
|
+
import * as u from "react";
|
|
20
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
19
21
|
//#region src/components/input/Combobox.tsx
|
|
20
|
-
function
|
|
22
|
+
function xe(e, t) {
|
|
21
23
|
return (e.textValue ?? e.label).toLowerCase().includes(t.toLowerCase());
|
|
22
24
|
}
|
|
23
|
-
var
|
|
24
|
-
let { value:
|
|
25
|
-
|
|
26
|
-
let
|
|
27
|
-
id:
|
|
28
|
-
"aria-label":
|
|
29
|
-
"aria-labelledby":
|
|
30
|
-
"aria-describedby":
|
|
31
|
-
"aria-invalid":
|
|
32
|
-
"aria-required":
|
|
33
|
-
}),
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, [
|
|
39
|
-
let [
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} :
|
|
47
|
-
let
|
|
48
|
-
open:
|
|
25
|
+
var p = (c) => {
|
|
26
|
+
let { value: l, defaultValue: p, onValueChange: m, onOptionSelect: h, open: g, defaultOpen: Se, onOpenChange: Ce, placeholder: we, disabled: _ = !1, size: Te, appearance: Ee, freeform: v = !1, name: De, form: y, required: b, autoComplete: Oe = "off", autoCapitalize: ke, autoCorrect: Ae, maxLength: x, readOnly: S, clearable: C = !1, expandIcon: w, labels: T, inputMode: je, spellCheck: Me, enterKeyHint: Ne, autoFocus: Pe, tabIndex: Fe, id: Ie, "aria-label": Le, "aria-labelledby": Re, "aria-describedby": ze, "aria-invalid": Be, "aria-required": Ve, "aria-errormessage": He, "aria-details": Ue, onFocus: We, onBlur: Ge, onKeyDown: Ke, onKeyUp: qe, controlRef: Je, className: Ye, children: E, ref: Xe, ...Ze } = c;
|
|
27
|
+
h !== void 0 && t("Combobox", "onOptionSelect", "onValueChange");
|
|
28
|
+
let D = ee(), Qe = (b ?? D?.required ?? !1) && !S, O = te({
|
|
29
|
+
id: Ie,
|
|
30
|
+
"aria-label": Le,
|
|
31
|
+
"aria-labelledby": Re,
|
|
32
|
+
"aria-describedby": ze,
|
|
33
|
+
"aria-invalid": Be,
|
|
34
|
+
"aria-required": Ve ?? b
|
|
35
|
+
}), $e = le(!1, O["aria-invalid"]), { size: k, appearance: A } = ce(Te, Ee), [j, M] = i(l, p ?? "", m), N = !_ && !S, [P, F] = i(g, (Se ?? !1) && N, Ce), I = P && N, [L, R] = u.useState(null), [et, tt] = u.useState(N);
|
|
36
|
+
et !== N && (tt(N), N || R(null));
|
|
37
|
+
let z = !N && P;
|
|
38
|
+
u.useEffect(() => {
|
|
39
|
+
z && F(!1);
|
|
40
|
+
}, [z, F]);
|
|
41
|
+
let [nt, B] = u.useState(null), V = u.useRef(null), H = u.useRef(null), rt = u.useMemo(() => fe(E), [E]), it = u.useMemo(() => L ? (e) => xe(e, L) : void 0, [L]), U = (e) => {
|
|
42
|
+
B(e), M(e), h?.(e);
|
|
43
|
+
}, W = () => {
|
|
44
|
+
F(!1), R(null);
|
|
45
|
+
}, G;
|
|
46
|
+
v ? G = () => {
|
|
47
|
+
R(null), U("");
|
|
48
|
+
} : L && (G = () => R(null));
|
|
49
|
+
let K = s({
|
|
50
|
+
open: I,
|
|
49
51
|
onOpenChange: (e) => {
|
|
50
|
-
e ?
|
|
52
|
+
e ? F(!0) : W();
|
|
51
53
|
},
|
|
52
54
|
mode: "editable",
|
|
53
|
-
selectedValues:
|
|
55
|
+
selectedValues: j ? [j] : [],
|
|
54
56
|
onSelect: (e) => {
|
|
55
|
-
|
|
57
|
+
M(e), h?.(e), R(null), B(null);
|
|
56
58
|
},
|
|
57
|
-
filter:
|
|
58
|
-
autoHighlight: !
|
|
59
|
+
filter: it,
|
|
60
|
+
autoHighlight: !v && L ? "first" : !1,
|
|
59
61
|
idPrefix: "combobox-listbox",
|
|
60
|
-
onClearDraft:
|
|
61
|
-
}),
|
|
62
|
-
|
|
63
|
-
let
|
|
64
|
-
open:
|
|
65
|
-
surfaceOpen:
|
|
66
|
-
onDismiss:
|
|
67
|
-
rootRef:
|
|
68
|
-
anchorRef:
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
let
|
|
74
|
-
if (e.key === "Escape" &&
|
|
75
|
-
|
|
62
|
+
onClearDraft: G
|
|
63
|
+
}), q = j ? K.getItem(j)?.label ?? rt.get(j) : void 0, J;
|
|
64
|
+
J = v ? j === nt ? j : q ?? j : L ?? q ?? "", v && L !== null && L !== J && R(J);
|
|
65
|
+
let Y = I && K.items.length > 0, X = T?.noMatches ?? "No matches", Z = I && (Y || !!L), at = Z && !Y, { layerId: ot, setReference: st, surfaceRef: ct, floatingProps: lt } = be({
|
|
66
|
+
open: I,
|
|
67
|
+
surfaceOpen: Z,
|
|
68
|
+
onDismiss: W,
|
|
69
|
+
rootRef: V,
|
|
70
|
+
anchorRef: H
|
|
71
|
+
}), ut = a(V, Xe), dt = a(H, Je, st);
|
|
72
|
+
ue(H, () => {
|
|
73
|
+
M(p ?? ""), R(null), B(null);
|
|
74
|
+
}, y);
|
|
75
|
+
let ft = (e) => {
|
|
76
|
+
if (e.key === "Escape" && I && !Z && !e.nativeEvent.isComposing) {
|
|
77
|
+
W(), G && e.currentTarget.value !== "" && (e.preventDefault(), G());
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
+
K.onKeyDown(e);
|
|
81
|
+
}, pt = (e) => {
|
|
80
82
|
let t = e.target.value;
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
}, Q =
|
|
87
|
-
return /* @__PURE__ */
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
R(t), I || F(!0), v && U(t);
|
|
84
|
+
}, mt = () => {
|
|
85
|
+
N && (I ? W() : F(!0), H.current?.focus());
|
|
86
|
+
}, ht = () => {
|
|
87
|
+
M(""), B(null), R(null), F(!1), H.current?.focus();
|
|
88
|
+
}, Q = ve(w), $ = C && j !== "" && !S, gt = O["aria-label"] === void 0 ? O["aria-labelledby"] ?? D?.labelId : O["aria-labelledby"];
|
|
89
|
+
return /* @__PURE__ */ f("div", {
|
|
90
|
+
"data-size": k,
|
|
91
|
+
"data-appearance": A,
|
|
92
|
+
...Ze,
|
|
93
|
+
ref: ut,
|
|
94
|
+
className: e(r.root, "relative inline-flex flex-col", Ye),
|
|
91
95
|
children: [
|
|
92
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ f("div", {
|
|
93
97
|
className: "relative flex items-center",
|
|
94
98
|
children: [
|
|
95
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ d("input", {
|
|
96
100
|
type: "text",
|
|
97
|
-
autoComplete:
|
|
98
|
-
...
|
|
99
|
-
...
|
|
100
|
-
"aria-expanded":
|
|
101
|
-
"aria-errormessage":
|
|
102
|
-
"aria-details":
|
|
103
|
-
ref:
|
|
104
|
-
disabled:
|
|
105
|
-
readOnly:
|
|
106
|
-
placeholder:
|
|
107
|
-
autoCapitalize:
|
|
108
|
-
autoCorrect:
|
|
109
|
-
maxLength:
|
|
110
|
-
inputMode:
|
|
111
|
-
spellCheck:
|
|
112
|
-
enterKeyHint:
|
|
113
|
-
autoFocus:
|
|
114
|
-
tabIndex:
|
|
115
|
-
value:
|
|
116
|
-
onChange:
|
|
101
|
+
autoComplete: Oe,
|
|
102
|
+
...O,
|
|
103
|
+
...K.getComboboxProps(),
|
|
104
|
+
"aria-expanded": Y,
|
|
105
|
+
"aria-errormessage": He,
|
|
106
|
+
"aria-details": Ue,
|
|
107
|
+
ref: dt,
|
|
108
|
+
disabled: _,
|
|
109
|
+
readOnly: S,
|
|
110
|
+
placeholder: we,
|
|
111
|
+
autoCapitalize: ke,
|
|
112
|
+
autoCorrect: Ae,
|
|
113
|
+
maxLength: x,
|
|
114
|
+
inputMode: je,
|
|
115
|
+
spellCheck: Me,
|
|
116
|
+
enterKeyHint: Ne,
|
|
117
|
+
autoFocus: Pe,
|
|
118
|
+
tabIndex: Fe,
|
|
119
|
+
value: J,
|
|
120
|
+
onChange: pt,
|
|
117
121
|
onClick: () => {
|
|
118
|
-
!
|
|
122
|
+
!I && N && F(!0);
|
|
119
123
|
},
|
|
120
|
-
onKeyDown: n(
|
|
121
|
-
onKeyUp: n(
|
|
122
|
-
onFocus:
|
|
123
|
-
onBlur: n(
|
|
124
|
-
className: e(re, "
|
|
124
|
+
onKeyDown: n(Ke, S ? void 0 : ft),
|
|
125
|
+
onKeyUp: n(qe, K.onKeyUp),
|
|
126
|
+
onFocus: We,
|
|
127
|
+
onBlur: n(Ge, () => R(null), { checkDefaultPrevented: !1 }),
|
|
128
|
+
className: e(r.input, ae[k], "w-full", oe[k], o[k], re[A], "text-foreground placeholder:text-muted-foreground", ie, ne, $e && "border-destructive", me(Number($) + Number(Q), k))
|
|
125
129
|
}),
|
|
126
|
-
$ && /* @__PURE__ */
|
|
130
|
+
$ && /* @__PURE__ */ d("button", {
|
|
127
131
|
type: "button",
|
|
128
|
-
"aria-label":
|
|
129
|
-
disabled:
|
|
132
|
+
"aria-label": T?.clear ?? "Clear selection",
|
|
133
|
+
disabled: _,
|
|
130
134
|
onMouseDown: (e) => e.preventDefault(),
|
|
131
|
-
onClick:
|
|
132
|
-
className: e(
|
|
133
|
-
children: /* @__PURE__ */
|
|
135
|
+
onClick: ht,
|
|
136
|
+
className: e(r.clearButton, ge(k, A), pe(k, Q ? 2 : 1), "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", "disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100"),
|
|
137
|
+
children: /* @__PURE__ */ d(se, { size: he(k, "icon") })
|
|
134
138
|
}),
|
|
135
|
-
Q && /* @__PURE__ */
|
|
139
|
+
Q && /* @__PURE__ */ d(_e, {
|
|
136
140
|
component: "Combobox",
|
|
137
|
-
expandIcon:
|
|
138
|
-
label:
|
|
139
|
-
expanded:
|
|
140
|
-
listboxId:
|
|
141
|
-
disabled:
|
|
142
|
-
onToggle:
|
|
141
|
+
expandIcon: w,
|
|
142
|
+
label: T?.expand ?? "Show options",
|
|
143
|
+
expanded: Y,
|
|
144
|
+
listboxId: K.listboxId,
|
|
145
|
+
disabled: _ || !!S,
|
|
146
|
+
onToggle: mt,
|
|
147
|
+
size: k,
|
|
148
|
+
appearance: A,
|
|
149
|
+
className: r.expandButton,
|
|
150
|
+
iconClassName: r.expandIcon
|
|
143
151
|
})
|
|
144
152
|
]
|
|
145
153
|
}),
|
|
146
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ d("span", {
|
|
147
155
|
role: "status",
|
|
148
156
|
className: "sr-only",
|
|
149
|
-
children:
|
|
157
|
+
children: at && X
|
|
150
158
|
}),
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
-
listbox:
|
|
153
|
-
layerId:
|
|
154
|
-
surfaceRef:
|
|
155
|
-
floatingProps:
|
|
156
|
-
open:
|
|
157
|
-
expanded:
|
|
158
|
-
|
|
159
|
+
/* @__PURE__ */ d(ye, {
|
|
160
|
+
listbox: K,
|
|
161
|
+
layerId: ot,
|
|
162
|
+
surfaceRef: ct,
|
|
163
|
+
floatingProps: lt,
|
|
164
|
+
open: I,
|
|
165
|
+
expanded: Y,
|
|
166
|
+
listboxClassName: r.listbox,
|
|
167
|
+
surfaceClassName: r.surface,
|
|
168
|
+
emptyContent: L ? /* @__PURE__ */ d("div", {
|
|
159
169
|
"aria-hidden": "true",
|
|
160
|
-
className: "px-3 py-1.5 text-body-1 text-muted-foreground",
|
|
161
|
-
children:
|
|
170
|
+
className: e(r.emptyMessage, "px-3 py-1.5 text-body-1 text-muted-foreground"),
|
|
171
|
+
children: X
|
|
162
172
|
}) : void 0,
|
|
163
|
-
"aria-label":
|
|
164
|
-
"aria-labelledby":
|
|
165
|
-
children:
|
|
173
|
+
"aria-label": O["aria-label"],
|
|
174
|
+
"aria-labelledby": gt,
|
|
175
|
+
children: E
|
|
166
176
|
}),
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
name:
|
|
169
|
-
form:
|
|
170
|
-
disabled:
|
|
171
|
-
value:
|
|
177
|
+
/* @__PURE__ */ d(de, {
|
|
178
|
+
name: De,
|
|
179
|
+
form: y,
|
|
180
|
+
disabled: _,
|
|
181
|
+
value: j,
|
|
172
182
|
type: "text",
|
|
173
|
-
required:
|
|
174
|
-
onInvalid: () =>
|
|
183
|
+
required: Qe,
|
|
184
|
+
onInvalid: () => H.current?.focus()
|
|
175
185
|
})
|
|
176
186
|
]
|
|
177
187
|
});
|
|
178
188
|
};
|
|
179
|
-
|
|
180
|
-
var
|
|
181
|
-
Option:
|
|
182
|
-
OptionGroup:
|
|
189
|
+
p.displayName = "Combobox";
|
|
190
|
+
var m = c, h = l, g = /* @__PURE__ */ Object.assign(p, {
|
|
191
|
+
Option: c,
|
|
192
|
+
OptionGroup: l
|
|
183
193
|
});
|
|
184
194
|
//#endregion
|
|
185
|
-
export {
|
|
195
|
+
export { g as Combobox, m as ComboboxOption, h as ComboboxOptionGroup, c as Option, l as OptionGroup };
|
|
186
196
|
|
|
187
197
|
//# sourceMappingURL=Combobox.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.mjs","names":["React","matchesText","item","text","ComboboxRoot","valueProp","openProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onOptionSelect","warnDeprecated","field","useFieldContext","validates","required","readOnly","fieldProps","useFieldControl","invalidLook","isInvalidLook","value","setValue","useControllable","defaultValue","onValueChange","interactive","disabled","openState","setOpen","defaultOpen","onOpenChange","open","draft","setDraft","wasInteractive","setWasInteractive","lockedOpen","typedValue","setTypedValue","rootRef","inputRef","optionLabels","collectOptionLabels","children","filter","commitText","close","clearDraft","freeform","listbox","useListbox","next","optionLabel","inputText","expanded","noMatchesText","labels","surfaceOpen","noMatches","useListboxPopup","rootMergedRef","useMergedRefs","ref","inputMergedRef","controlRef","setReference","form","handleKeyDown","event","handleChange","handleExpandClick","handleClear","showExpand","showsExpandButton","expandIcon","showClear","clearable","listLabelledBy","cn","className","composeEventHandlers","onKeyDown","onKeyUp","onBlur","inputBase","inputFocus","disabledStyles","pickerEndPadding","DismissIcon","PickerExpandButton","ListboxSurface","HiddenInput","ComboboxOption","Option","ComboboxOptionGroup","OptionGroup","Combobox"],"sources":["../../../src/components/input/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnDeprecated } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport type { Slot } from '../../lib/slot';\nimport { disabledStyles, focusRing, inputBase, inputFocus, inputInvalid } from '../../lib/styles';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { collectOptionLabels, useListbox, type ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { PickerExpandButton, showsExpandButton } from './Combobox.expand';\nimport { isInvalidLook } from './Input';\nimport { ListboxSurface, Option, OptionGroup, useListboxPopup } from './Option';\nimport { PICKER_ICON_BUTTON_CLASSES, pickerEndPadding } from './pickerStyles';\nimport type { RoutedHandlers } from './routedHandlers';\n\nexport { Option, OptionGroup } from './Option';\nexport type { OptionProps, OptionGroupProps } from './Option';\n\n/* ------------------------------------------------------------------ */\n/* Combobox */\n/* ------------------------------------------------------------------ */\n\n/**\n * The Combobox's built-in texts, for localization. Each member is optional and falls back to its\n * English default.\n */\nexport interface ComboboxLabels {\n /** Status text (announced, and shown in the popup) when the typed text matches no option.\n * @default 'No matches'\n */\n noMatches?: string;\n /** Name of the clear button (`clearable`).\n * @default 'Clear selection'\n */\n clear?: string;\n /** Name of the expand button at the end of the input.\n * @default 'Show options'\n */\n expand?: string;\n}\n\n/** Properties for the Combobox component. */\nexport interface ComboboxProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | RoutedHandlers\n> {\n /** Controlled selected value (`''` for none). */\n value?: string;\n /**\n * Initial selected value for uncontrolled usage.\n * @default ''\n */\n defaultValue?: string;\n /**\n * Called with the new value when it changes: an option is selected, or (with `freeform`) the\n * text changes. Not called when the current option is selected again.\n */\n onValueChange?: (value: string) => void;\n /**\n * Called on every option activation, also when the current option is selected again (and, with\n * `freeform`, on every text change).\n * @deprecated Use `onValueChange`.\n */\n onOptionSelect?: (value: string) => void;\n /**\n * Controlled open state of the listbox. The list renders only in the browser: an open combobox\n * is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state for uncontrolled usage. A combobox that starts disabled or read-only\n * starts closed. The list renders only in the browser: it is closed in the server HTML and opens\n * once the combobox has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the listbox opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Placeholder text shown when no value is selected. */\n placeholder?: string;\n /**\n * Whether the combobox is disabled and non-interactive.\n * @default false\n */\n disabled?: boolean;\n /**\n * Whether the typed text is itself the value. Without it, typing only filters the options (the\n * first match becomes active, so Enter selects it) and the input shows the selected option's\n * label again when the listbox closes or loses focus. With it, the input shows typed text as\n * typed (also when it equals an option's value), a selected option's label, and a controlled\n * `value` as soon as the parent sets it (a parent that normalizes or rejects the text).\n * @default false\n */\n freeform?: boolean;\n /** Name of the value in form submissions (renders a hidden input). */\n name?: string;\n /** Id of the form the value belongs to, when the Combobox is outside it. */\n form?: string;\n /**\n * A value is required to submit the form (native constraint validation). Like a native readonly\n * input, a `readOnly` Combobox does not block submission.\n */\n required?: boolean;\n /**\n * The `autocomplete` attribute of the `<input role=\"combobox\">`. Browser autofill is off unless\n * you set it (for example `'on'`).\n * @default 'off'\n */\n autoComplete?: string;\n /** The maximum length of the typed text (`maxlength` of the `<input role=\"combobox\">`). */\n maxLength?: number;\n /**\n * The value cannot be changed: the input is read-only and the listbox neither opens (click,\n * keyboard, a controlled `open`) nor commits; Escape is left to the page. Turning it (or\n * `disabled`) on while the listbox is open closes it (`onOpenChange(false)`).\n */\n readOnly?: boolean;\n /**\n * Shows a clear button while a value is selected (not while `readOnly`; while `disabled` it is\n * shown disabled, as in DatePicker and TimePicker). It clears the value\n * (`onValueChange('')`), drops typed text, closes the list and moves focus to the input. It is\n * a tab stop after the input.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the input (default: a chevron). The button\n * opens and closes the list without moving focus out of the input and is not a tab stop\n * (Alt+ArrowDown opens the list from the keyboard). `null` or `undefined` keep the chevron;\n * `false`, or a value that renders nothing, hides the button. Decorative content rendered\n * inside the built-in button: a `<button>` or `Button` passed here is not nested (its children\n * become the glyph, with a development warning).\n */\n expandIcon?: Slot<'span'>;\n /**\n * The built-in texts (the \"No matches\" status and the names of the clear and expand buttons),\n * for localization. Unset members keep their English defaults.\n */\n labels?: ComboboxLabels;\n /** Called when the `<input role=\"combobox\">` receives focus (the root keeps other handlers). */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Called when the `<input role=\"combobox\">` loses focus. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /**\n * Called on a key press in the `<input role=\"combobox\">`, before the built-in listbox keys;\n * `event.preventDefault()` skips them.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Called when a key is released in the `<input role=\"combobox\">`. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Ref to the `<input role=\"combobox\">` (the focusable element). */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nfunction matchesText(item: ListboxItem, text: string): boolean {\n return (item.textValue ?? item.label).toLowerCase().includes(text.toLowerCase());\n}\n\nconst ComboboxRoot = (props: ComboboxProps) => {\n const {\n value: valueProp,\n defaultValue,\n onValueChange,\n onOptionSelect,\n open: openProp,\n defaultOpen,\n onOpenChange,\n placeholder,\n disabled = false,\n freeform = false,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n readOnly,\n clearable = false,\n expandIcon,\n labels,\n inputMode,\n spellCheck,\n enterKeyHint,\n autoFocus,\n tabIndex,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n children,\n ref,\n ...rest\n } = props;\n\n if (onOptionSelect !== undefined) warnDeprecated('Combobox', 'onOptionSelect', 'onValueChange');\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n const validates = isRequired && !readOnly;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n // The error look follows the resolved state: the consumer's `aria-invalid` or the Field's.\n const invalidLook = isInvalidLook(false, fieldProps['aria-invalid']);\n\n const [value, setValue] = useControllable(valueProp, defaultValue ?? '', onValueChange);\n const interactive = !disabled && !readOnly;\n // A combobox that starts disabled or read-only never shows its list, so it starts closed (no\n // close to report later).\n const [openState, setOpen] = useControllable(\n openProp,\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n const open = openState && interactive;\n // Text typed since the last commit, the filter; `null` shows the committed value's label\n // (input-pickers#7). Freeform: the input shows the value, and the draft follows that text.\n const [draft, setDraft] = React.useState<string | null>(null);\n // Locking the control (readOnly/disabled) while typing drops the draft, so the input shows the\n // committed value again (adjust-during-render pattern, C-HOOKS).\n const [wasInteractive, setWasInteractive] = React.useState(interactive);\n if (wasInteractive !== interactive) {\n setWasInteractive(interactive);\n if (!interactive) setDraft(null);\n }\n // Locking also closes the list itself, not only the derived `open`, so unlocking does not reopen\n // it without a user action. The close is reported through onOpenChange (a consumer callback from\n // an effect, C-HOOKS); a controlled `open` that stays true is still not shown while locked.\n const lockedOpen = !interactive && openState;\n React.useEffect(() => {\n if (lockedOpen) setOpen(false);\n }, [lockedOpen, setOpen]);\n\n // Freeform: the value the user typed last. While the value still equals it, the input shows it\n // as typed, even when it equals an option's value (not that option's label).\n const [typedValue, setTypedValue] = React.useState<string | null>(null);\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n\n const optionLabels = React.useMemo(() => collectOptionLabels(children), [children]);\n const filter = React.useMemo(\n () => (draft ? (item: ListboxItem) => matchesText(item, draft) : undefined),\n [draft],\n );\n\n const commitText = (text: string) => {\n setTypedValue(text);\n setValue(text);\n onOptionSelect?.(text);\n };\n\n const close = () => {\n setOpen(false);\n setDraft(null);\n };\n\n // APG: Escape on a closed listbox clears the textbox. Freeform: the text is the value, so it is\n // cleared. Otherwise only a typed filter is dropped (the input shows the selected label again);\n // without one there is nothing to clear and Escape is left to the page.\n let clearDraft: (() => void) | undefined;\n if (freeform) {\n clearDraft = () => {\n setDraft(null);\n commitText('');\n };\n } else if (draft) {\n clearDraft = () => setDraft(null);\n }\n\n const listbox = useListbox({\n open,\n onOpenChange: (next) => {\n if (next) setOpen(true);\n else close();\n },\n mode: 'editable',\n selectedValues: value ? [value] : [],\n onSelect: (next) => {\n setValue(next);\n onOptionSelect?.(next);\n setDraft(null);\n setTypedValue(null);\n },\n filter,\n // Typing a filter makes its first match active (like Fluent's Combobox), so Enter selects what\n // the list shows instead of submitting the form. Nothing is active on open or with the text\n // cleared. Freeform: the text is the value, so Enter keeps it unless the user moved to an\n // option.\n autoHighlight: !freeform && draft ? 'first' : false,\n idPrefix: 'combobox-listbox',\n onClearDraft: clearDraft,\n });\n\n // The input text. Freeform: the value as typed while it is the value the user typed last, else\n // the label of the option with that value, else the value itself — so the text follows a\n // controlled parent that normalizes or rejects what was typed while the input still has focus.\n // Otherwise: the typed filter, else the selected option's label.\n const optionLabel = value\n ? (listbox.getItem(value)?.label ?? optionLabels.get(value))\n : undefined;\n let inputText: string;\n if (freeform) inputText = value === typedValue ? value : (optionLabel ?? value);\n else inputText = draft ?? optionLabel ?? '';\n // Freeform: the filter follows the text (adjust-during-render pattern, C-HOOKS; the text does not\n // depend on the filter, so this settles in one pass).\n if (freeform && draft !== null && draft !== inputText) setDraft(inputText);\n\n const expanded = open && listbox.items.length > 0;\n const noMatchesText = labels?.noMatches ?? 'No matches';\n // The popup shows the list, or \"No matches\" for a draft.\n const surfaceOpen = open && (expanded || !!draft);\n const noMatches = surfaceOpen && !expanded;\n const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({\n open,\n surfaceOpen,\n onDismiss: close,\n rootRef,\n anchorRef: inputRef,\n });\n\n const rootMergedRef = useMergedRefs<HTMLDivElement>(rootRef, ref);\n const inputMergedRef = useMergedRefs<HTMLInputElement>(inputRef, controlRef, setReference);\n\n useFormReset(\n inputRef,\n () => {\n setValue(defaultValue ?? '');\n setDraft(null);\n setTypedValue(null);\n },\n form,\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape' && open && !surfaceOpen && !event.nativeEvent.isComposing) {\n // Open with nothing shown (no options): close as a closed list would handle Escape — clear\n // the text if there is any, otherwise leave the key to an enclosing layer (overlays#1).\n close();\n if (clearDraft && event.currentTarget.value !== '') {\n event.preventDefault();\n clearDraft();\n }\n return;\n }\n listbox.onKeyDown(event);\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const text = event.target.value;\n setDraft(text);\n if (!open) setOpen(true);\n if (freeform) commitText(text);\n };\n\n // The expand button opens and closes the list like the input's own keys; focus stays in (or\n // returns to) the input.\n const handleExpandClick = () => {\n if (!interactive) return;\n if (open) close();\n else setOpen(true);\n inputRef.current?.focus();\n };\n\n // Clearing is not an option activation: the state is set directly, not through `commitText`\n // (which calls the deprecated `onOptionSelect` in freeform mode). The button disappears with the\n // value, so focus moves to the input explicitly (C-DISABLED).\n const handleClear = () => {\n setValue('');\n setTypedValue(null);\n setDraft(null);\n setOpen(false);\n inputRef.current?.focus();\n };\n\n const showExpand = showsExpandButton(expandIcon);\n // Read-only comboboxes offer no clear action (the value cannot change).\n const showClear = clearable && value !== '' && !readOnly;\n\n const listLabelledBy =\n fieldProps['aria-label'] === undefined\n ? (fieldProps['aria-labelledby'] ?? field?.labelId)\n : fieldProps['aria-labelledby'];\n\n return (\n <div {...rest} ref={rootMergedRef} className={cn('relative inline-flex flex-col', className)}>\n <div className=\"relative flex items-center\">\n <input\n type=\"text\"\n autoComplete={autoComplete}\n {...fieldProps}\n {...listbox.getComboboxProps()}\n aria-expanded={expanded}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n ref={inputMergedRef}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n maxLength={maxLength}\n inputMode={inputMode}\n spellCheck={spellCheck}\n enterKeyHint={enterKeyHint}\n autoFocus={autoFocus}\n tabIndex={tabIndex}\n value={inputText}\n onChange={handleChange}\n onClick={() => {\n if (!open && interactive) setOpen(true);\n }}\n // Read-only: no listbox keys at all (they would open, commit or clear the value).\n onKeyDown={composeEventHandlers(onKeyDown, readOnly ? undefined : handleKeyDown)}\n onKeyUp={composeEventHandlers(onKeyUp, listbox.onKeyUp)}\n onFocus={onFocus}\n onBlur={composeEventHandlers(onBlur, () => setDraft(null), {\n checkDefaultPrevented: false,\n })}\n className={cn(\n inputBase,\n 'border-b-stroke-accessible',\n inputFocus,\n disabledStyles,\n invalidLook && inputInvalid,\n pickerEndPadding(Number(showClear) + Number(showExpand)),\n )}\n />\n {showClear && (\n <button\n type=\"button\"\n aria-label={labels?.clear ?? 'Clear selection'}\n disabled={disabled}\n // Keeps focus in the input, so its blur does not act on a draft before the clear.\n onMouseDown={(event) => event.preventDefault()}\n onClick={handleClear}\n className={cn(\n PICKER_ICON_BUTTON_CLASSES,\n showExpand ? 'end-7' : 'end-1',\n focusRing,\n disabledStyles,\n )}\n >\n <DismissIcon />\n </button>\n )}\n {showExpand && (\n <PickerExpandButton\n component=\"Combobox\"\n expandIcon={expandIcon}\n label={labels?.expand ?? 'Show options'}\n expanded={expanded}\n listboxId={listbox.listboxId}\n disabled={disabled || !!readOnly}\n onToggle={handleExpandClick}\n />\n )}\n </div>\n {/* Mounted before its text: a live region added together with its text is not announced by\n every screen reader. The row in the popup is the visible copy. */}\n <span role=\"status\" className=\"sr-only\">\n {noMatches && noMatchesText}\n </span>\n <ListboxSurface\n listbox={listbox}\n layerId={layerId}\n surfaceRef={surfaceRef}\n floatingProps={floatingProps}\n open={open}\n expanded={expanded}\n emptyContent={\n draft ? (\n <div aria-hidden=\"true\" className=\"px-3 py-1.5 text-body-1 text-muted-foreground\">\n {noMatchesText}\n </div>\n ) : undefined\n }\n aria-label={fieldProps['aria-label']}\n aria-labelledby={listLabelledBy}\n >\n {children}\n </ListboxSurface>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={value}\n type=\"text\"\n // Like a native readonly input, a read-only Combobox is barred from constraint validation\n // (the user could not fix it); its value is still submitted.\n required={validates}\n onInvalid={() => inputRef.current?.focus()}\n />\n </div>\n );\n};\nComboboxRoot.displayName = 'Combobox';\n\n/** Flat name of `Combobox.Option` for React Server Components. */\nexport const ComboboxOption = Option;\n/** Flat name of `Combobox.OptionGroup` for React Server Components. */\nexport const ComboboxOptionGroup = OptionGroup;\n\n/**\n * An editable combobox: a text input with a filterable listbox of `Option`s (APG combobox with\n * list autocomplete). Typing filters the options; ArrowDown/ArrowUp move the highlight\n * (`aria-activedescendant`), Enter selects, Escape closes. Without `freeform` the text is only a\n * filter: its first match becomes active while typing, and the input shows the selected option's\n * label again when the listbox closes. With `freeform` the text itself is the value. Text that\n * matches no option shows \"No matches\" (`labels.noMatches`), announced through a status region.\n * The expand button at the end of the input (a chevron, see `expandIcon`) opens and closes the\n * list without taking focus from the input and is not a tab stop; `clearable` adds a clear button,\n * a tab stop after the input. Both sit with the input in a wrapper `<div>` inside the root.\n *\n * The `<input>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,\n * `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`,\n * `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes `autoComplete`,\n * `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and `enterKeyHint`.\n * `ref`, `className`, `style`, other `aria-*` attributes and the remaining props stay on the root\n * `<div>`. Inside a `Field` the input is labelled and described by it. It shows the error look\n * whenever it ends up `aria-invalid` (its own `aria-invalid` or a `Field` error). With\n * `name`/`required` the value takes part in form submission, validation and reset. The open\n * listbox renders in a portal; while closed it stays in the DOM, hidden.\n *\n * Sub-components: `Combobox.Option`, `Combobox.OptionGroup`. React Server Components import the\n * flat names `ComboboxOption` / `ComboboxOptionGroup` (dotted access needs a client file).\n */\nexport const Combobox = /* @__PURE__ */ Object.assign(ComboboxRoot, {\n Option,\n OptionGroup,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgKA,SAASC,GAAY,GAAmB,GAAuB;CAC7D,QAAQC,EAAK,aAAaA,EAAK,MAAA,CAAO,YAAY,CAAC,CAAC,SAASC,EAAK,YAAY,CAAC;AACjF;AAEA,IAAMC,KAAgB,MAAyB;CAC7C,IAAM,EACJ,OAAOC,GACP,iBACA,kBACA,mBACA,MAAMC,GACN,iBACA,kBACA,iBACA,cAAW,IACX,cAAW,IACX,UACA,SACA,aACA,mBAAe,OACf,oBACA,iBACA,eACA,aACA,gBAAY,IACZ,eACA,WACA,eACA,gBACA,iBACA,cACA,aACA,OACA,cAAcC,GACd,mBAAmBC,GACnB,oBAAoBC,IACpB,gBAAgBC,IAChB,iBAAiBC,IACjB,qBAAqBC,IACrB,gBAAgBC,IAChB,aACA,YACA,eACA,aACA,gBACA,eACA,aACA,SACA,GAAGC,OACDC;CAEJ,AAAIC,MAAmB,KAAA,KAAWC,EAAe,YAAY,kBAAkB,eAAe;CAE9F,IAAMC,IAAQC,GAAgB,GAExBC,MADaC,KAAYH,GAAO,YAAY,OAClB,CAACI,GAC3BC,IAAaC,GAAgB;EACjC;EACA,cAAcjB;EACd,mBAAmBC;EACnB,oBAAoBC;EACpB,gBAAgBC;EAGhB,iBAAiBC,MAAgBU;CACnC,CAAC,GAEKI,KAAcC,GAAc,IAAOH,EAAW,eAAe,GAE7D,CAACI,GAAOC,KAAYC,EAAgBxB,GAAWyB,KAAgB,IAAIC,CAAa,GAChFC,IAAc,CAACC,KAAY,CAACX,GAG5B,CAACY,GAAWC,KAAWN,EAC3BvB,IACC8B,MAAe,OAAUJ,GAC1BK,EACF,GACMC,IAAOJ,KAAaF,GAGpB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AOjC,GAAQ,UAAU;MACf;MACV,WAAWP,EAAQ;MACnB,UAAUvB,KAAY,CAAC,CAACX;MACxB,UAAUuD;KACX,CAAA;IAEA;;GAGL,kBAAC,QAAD;IAAM,MAAK;IAAS,WAAU;IAC3B,UAAAZ,MAAaH;GACV,CAAA;GACN,kBAACmC,IAAD;IACW;IACA;IACG;IACG;IACT;IACI;IACV,cACE1D,IACE,kBAAC,OAAD;KAAK,eAAY;KAAO,WAAU;KAC/B,UAAAuB;IACE,CAAA,IACH,KAAA;IAEN,cAAYvC,EAAW;IACvB,mBAAiB6D;IAEhB;GACa,CAAA;GAChB,kBAACc,IAAD;IACQ;IACA;IACI;IACH;IACP,MAAK;IAGL,UAAU9E;IACV,iBAAiB2B,EAAS,SAAS,MAAM;GAC1C,CAAA;EACE;;AAET;AACA,EAAa,cAAc;AAG3B,IAAaoD,IAAiBC,GAEjBC,IAAsBC,GA0BtBC,IAA2B,uBAAO,OAAOnG,GAAc;CAClE;CACA;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"Combobox.mjs","names":["React","matchesText","item","text","ComboboxRoot","valueProp","openProp","sizeProp","appearanceProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onOptionSelect","warnDeprecated","field","useFieldContext","validates","required","readOnly","fieldProps","useFieldControl","invalidLook","isInvalidLook","useInputLook","value","setValue","useControllable","defaultValue","onValueChange","interactive","disabled","openState","setOpen","defaultOpen","onOpenChange","open","draft","setDraft","wasInteractive","setWasInteractive","lockedOpen","typedValue","setTypedValue","rootRef","inputRef","optionLabels","collectOptionLabels","children","filter","commitText","close","clearDraft","freeform","listbox","useListbox","next","optionLabel","inputText","expanded","noMatchesText","labels","surfaceOpen","noMatches","useListboxPopup","rootMergedRef","useMergedRefs","ref","inputMergedRef","controlRef","setReference","form","handleKeyDown","event","handleChange","handleExpandClick","handleClear","showExpand","showsExpandButton","expandIcon","showClear","clearable","listLabelledBy","size","appearance","cn","comboboxClassNames","className","composeEventHandlers","onKeyDown","onKeyUp","onBlur","inputHeightClasses","inputPaddingClasses","inputTextClasses","inputAppearanceClasses","inputFocus","disabledStyles","pickerEndPadding","pickerIconButtonClasses","pickerButtonOffset","DismissIcon","pickerGlyphSize","PickerExpandButton","ListboxSurface","HiddenInput","ComboboxOption","Option","ComboboxOptionGroup","OptionGroup","Combobox"],"sources":["../../../src/components/input/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { comboboxClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnDeprecated } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport type { Slot } from '../../lib/slot';\nimport {\n disabledStyles,\n focusRing,\n inputAppearanceClasses,\n inputFocus,\n inputHeightClasses,\n inputInvalid,\n inputPaddingClasses,\n inputTextClasses,\n} from '../../lib/styles';\nimport type { CoreSize, InputAppearance } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { collectOptionLabels, useListbox, type ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { PickerExpandButton, showsExpandButton } from './Combobox.expand';\nimport { useInputLook } from './inputLook';\nimport { isInvalidLook } from './Input';\nimport { ListboxSurface, Option, OptionGroup, useListboxPopup } from './Option';\nimport {\n pickerButtonOffset,\n pickerEndPadding,\n pickerGlyphSize,\n pickerIconButtonClasses,\n} from './pickerStyles';\nimport type { RoutedHandlers } from './routedHandlers';\n\nexport { Option, OptionGroup } from './Option';\nexport type { OptionProps, OptionGroupProps } from './Option';\n\n/* ------------------------------------------------------------------ */\n/* Combobox */\n/* ------------------------------------------------------------------ */\n\n/**\n * The Combobox's built-in texts, for localization. Each member is optional and falls back to its\n * English default.\n */\nexport interface ComboboxLabels {\n /** Status text (announced, and shown in the popup) when the typed text matches no option.\n * @default 'No matches'\n */\n noMatches?: string;\n /** Name of the clear button (`clearable`).\n * @default 'Clear selection'\n */\n clear?: string;\n /** Name of the expand button at the end of the input.\n * @default 'Show options'\n */\n expand?: string;\n}\n\n/** Properties for the Combobox component. */\nexport interface ComboboxProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | RoutedHandlers\n> {\n /** Controlled selected value (`''` for none). */\n value?: string;\n /**\n * Initial selected value for uncontrolled usage.\n * @default ''\n */\n defaultValue?: string;\n /**\n * Called with the new value when it changes: an option is selected, or (with `freeform`) the\n * text changes. Not called when the current option is selected again.\n */\n onValueChange?: (value: string) => void;\n /**\n * Called on every option activation, also when the current option is selected again (and, with\n * `freeform`, on every text change).\n * @deprecated Use `onValueChange`.\n */\n onOptionSelect?: (value: string) => void;\n /**\n * Controlled open state of the listbox. The list renders only in the browser: an open combobox\n * is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state for uncontrolled usage. A combobox that starts disabled or read-only\n * starts closed. The list renders only in the browser: it is closed in the server HTML and opens\n * once the combobox has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the listbox opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Placeholder text shown when no value is selected. */\n placeholder?: string;\n /**\n * Whether the combobox is disabled and non-interactive.\n * @default false\n */\n disabled?: boolean;\n /**\n * Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the\n * surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`. The\n * listbox keeps its size.\n */\n size?: CoreSize;\n /**\n * Look of the field: `outline` (a full border), `underline` (a bottom stroke only),\n * `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible\n * label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.\n */\n appearance?: InputAppearance;\n /**\n * Whether the typed text is itself the value. Without it, typing only filters the options (the\n * first match becomes active, so Enter selects it) and the input shows the selected option's\n * label again when the listbox closes or loses focus. With it, the input shows typed text as\n * typed (also when it equals an option's value), a selected option's label, and a controlled\n * `value` as soon as the parent sets it (a parent that normalizes or rejects the text).\n * @default false\n */\n freeform?: boolean;\n /** Name of the value in form submissions (renders a hidden input). */\n name?: string;\n /** Id of the form the value belongs to, when the Combobox is outside it. */\n form?: string;\n /**\n * A value is required to submit the form (native constraint validation). Like a native readonly\n * input, a `readOnly` Combobox does not block submission.\n */\n required?: boolean;\n /**\n * The `autocomplete` attribute of the `<input role=\"combobox\">`. Browser autofill is off unless\n * you set it (for example `'on'`).\n * @default 'off'\n */\n autoComplete?: string;\n /** The maximum length of the typed text (`maxlength` of the `<input role=\"combobox\">`). */\n maxLength?: number;\n /**\n * The value cannot be changed: the input is read-only and the listbox neither opens (click,\n * keyboard, a controlled `open`) nor commits; Escape is left to the page. Turning it (or\n * `disabled`) on while the listbox is open closes it (`onOpenChange(false)`).\n */\n readOnly?: boolean;\n /**\n * Shows a clear button while a value is selected (not while `readOnly`; while `disabled` it is\n * shown disabled, as in DatePicker and TimePicker). It clears the value\n * (`onValueChange('')`), drops typed text, closes the list and moves focus to the input. It is\n * a tab stop after the input.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the input (default: a chevron). The button\n * opens and closes the list without moving focus out of the input and is not a tab stop\n * (Alt+ArrowDown opens the list from the keyboard). `null` or `undefined` keep the chevron;\n * `false`, or a value that renders nothing, hides the button. Decorative content rendered\n * inside the built-in button: a `<button>` or `Button` passed here is not nested (its children\n * become the glyph, with a development warning).\n */\n expandIcon?: Slot<'span'>;\n /**\n * The built-in texts (the \"No matches\" status and the names of the clear and expand buttons),\n * for localization. Unset members keep their English defaults.\n */\n labels?: ComboboxLabels;\n /** Called when the `<input role=\"combobox\">` receives focus (the root keeps other handlers). */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Called when the `<input role=\"combobox\">` loses focus. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /**\n * Called on a key press in the `<input role=\"combobox\">`, before the built-in listbox keys;\n * `event.preventDefault()` skips them.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Called when a key is released in the `<input role=\"combobox\">`. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Ref to the `<input role=\"combobox\">` (the focusable element). */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nfunction matchesText(item: ListboxItem, text: string): boolean {\n return (item.textValue ?? item.label).toLowerCase().includes(text.toLowerCase());\n}\n\nconst ComboboxRoot = (props: ComboboxProps) => {\n const {\n value: valueProp,\n defaultValue,\n onValueChange,\n onOptionSelect,\n open: openProp,\n defaultOpen,\n onOpenChange,\n placeholder,\n disabled = false,\n size: sizeProp,\n appearance: appearanceProp,\n freeform = false,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n readOnly,\n clearable = false,\n expandIcon,\n labels,\n inputMode,\n spellCheck,\n enterKeyHint,\n autoFocus,\n tabIndex,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n children,\n ref,\n ...rest\n } = props;\n\n if (onOptionSelect !== undefined) warnDeprecated('Combobox', 'onOptionSelect', 'onValueChange');\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n const validates = isRequired && !readOnly;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n // The error look follows the resolved state: the consumer's `aria-invalid` or the Field's.\n const invalidLook = isInvalidLook(false, fieldProps['aria-invalid']);\n const { size, appearance } = useInputLook(sizeProp, appearanceProp);\n\n const [value, setValue] = useControllable(valueProp, defaultValue ?? '', onValueChange);\n const interactive = !disabled && !readOnly;\n // A combobox that starts disabled or read-only never shows its list, so it starts closed (no\n // close to report later).\n const [openState, setOpen] = useControllable(\n openProp,\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n const open = openState && interactive;\n // Text typed since the last commit, the filter; `null` shows the committed value's label\n // (input-pickers#7). Freeform: the input shows the value, and the draft follows that text.\n const [draft, setDraft] = React.useState<string | null>(null);\n // Locking the control (readOnly/disabled) while typing drops the draft, so the input shows the\n // committed value again (adjust-during-render pattern, C-HOOKS).\n const [wasInteractive, setWasInteractive] = React.useState(interactive);\n if (wasInteractive !== interactive) {\n setWasInteractive(interactive);\n if (!interactive) setDraft(null);\n }\n // Locking also closes the list itself, not only the derived `open`, so unlocking does not reopen\n // it without a user action. The close is reported through onOpenChange (a consumer callback from\n // an effect, C-HOOKS); a controlled `open` that stays true is still not shown while locked.\n const lockedOpen = !interactive && openState;\n React.useEffect(() => {\n if (lockedOpen) setOpen(false);\n }, [lockedOpen, setOpen]);\n\n // Freeform: the value the user typed last. While the value still equals it, the input shows it\n // as typed, even when it equals an option's value (not that option's label).\n const [typedValue, setTypedValue] = React.useState<string | null>(null);\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n\n const optionLabels = React.useMemo(() => collectOptionLabels(children), [children]);\n const filter = React.useMemo(\n () => (draft ? (item: ListboxItem) => matchesText(item, draft) : undefined),\n [draft],\n );\n\n const commitText = (text: string) => {\n setTypedValue(text);\n setValue(text);\n onOptionSelect?.(text);\n };\n\n const close = () => {\n setOpen(false);\n setDraft(null);\n };\n\n // APG: Escape on a closed listbox clears the textbox. Freeform: the text is the value, so it is\n // cleared. Otherwise only a typed filter is dropped (the input shows the selected label again);\n // without one there is nothing to clear and Escape is left to the page.\n let clearDraft: (() => void) | undefined;\n if (freeform) {\n clearDraft = () => {\n setDraft(null);\n commitText('');\n };\n } else if (draft) {\n clearDraft = () => setDraft(null);\n }\n\n const listbox = useListbox({\n open,\n onOpenChange: (next) => {\n if (next) setOpen(true);\n else close();\n },\n mode: 'editable',\n selectedValues: value ? [value] : [],\n onSelect: (next) => {\n setValue(next);\n onOptionSelect?.(next);\n setDraft(null);\n setTypedValue(null);\n },\n filter,\n // Typing a filter makes its first match active (like Fluent's Combobox), so Enter selects what\n // the list shows instead of submitting the form. Nothing is active on open or with the text\n // cleared. Freeform: the text is the value, so Enter keeps it unless the user moved to an\n // option.\n autoHighlight: !freeform && draft ? 'first' : false,\n idPrefix: 'combobox-listbox',\n onClearDraft: clearDraft,\n });\n\n // The input text. Freeform: the value as typed while it is the value the user typed last, else\n // the label of the option with that value, else the value itself — so the text follows a\n // controlled parent that normalizes or rejects what was typed while the input still has focus.\n // Otherwise: the typed filter, else the selected option's label.\n const optionLabel = value\n ? (listbox.getItem(value)?.label ?? optionLabels.get(value))\n : undefined;\n let inputText: string;\n if (freeform) inputText = value === typedValue ? value : (optionLabel ?? value);\n else inputText = draft ?? optionLabel ?? '';\n // Freeform: the filter follows the text (adjust-during-render pattern, C-HOOKS; the text does not\n // depend on the filter, so this settles in one pass).\n if (freeform && draft !== null && draft !== inputText) setDraft(inputText);\n\n const expanded = open && listbox.items.length > 0;\n const noMatchesText = labels?.noMatches ?? 'No matches';\n // The popup shows the list, or \"No matches\" for a draft.\n const surfaceOpen = open && (expanded || !!draft);\n const noMatches = surfaceOpen && !expanded;\n const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({\n open,\n surfaceOpen,\n onDismiss: close,\n rootRef,\n anchorRef: inputRef,\n });\n\n const rootMergedRef = useMergedRefs<HTMLDivElement>(rootRef, ref);\n const inputMergedRef = useMergedRefs<HTMLInputElement>(inputRef, controlRef, setReference);\n\n useFormReset(\n inputRef,\n () => {\n setValue(defaultValue ?? '');\n setDraft(null);\n setTypedValue(null);\n },\n form,\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape' && open && !surfaceOpen && !event.nativeEvent.isComposing) {\n // Open with nothing shown (no options): close as a closed list would handle Escape — clear\n // the text if there is any, otherwise leave the key to an enclosing layer (overlays#1).\n close();\n if (clearDraft && event.currentTarget.value !== '') {\n event.preventDefault();\n clearDraft();\n }\n return;\n }\n listbox.onKeyDown(event);\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const text = event.target.value;\n setDraft(text);\n if (!open) setOpen(true);\n if (freeform) commitText(text);\n };\n\n // The expand button opens and closes the list like the input's own keys; focus stays in (or\n // returns to) the input.\n const handleExpandClick = () => {\n if (!interactive) return;\n if (open) close();\n else setOpen(true);\n inputRef.current?.focus();\n };\n\n // Clearing is not an option activation: the state is set directly, not through `commitText`\n // (which calls the deprecated `onOptionSelect` in freeform mode). The button disappears with the\n // value, so focus moves to the input explicitly (C-DISABLED).\n const handleClear = () => {\n setValue('');\n setTypedValue(null);\n setDraft(null);\n setOpen(false);\n inputRef.current?.focus();\n };\n\n const showExpand = showsExpandButton(expandIcon);\n // Read-only comboboxes offer no clear action (the value cannot change).\n const showClear = clearable && value !== '' && !readOnly;\n\n const listLabelledBy =\n fieldProps['aria-label'] === undefined\n ? (fieldProps['aria-labelledby'] ?? field?.labelId)\n : fieldProps['aria-labelledby'];\n\n return (\n <div\n data-size={size}\n data-appearance={appearance}\n {...rest}\n ref={rootMergedRef}\n className={cn(comboboxClassNames.root, 'relative inline-flex flex-col', className)}\n >\n <div className=\"relative flex items-center\">\n <input\n type=\"text\"\n autoComplete={autoComplete}\n {...fieldProps}\n {...listbox.getComboboxProps()}\n aria-expanded={expanded}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n ref={inputMergedRef}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n maxLength={maxLength}\n inputMode={inputMode}\n spellCheck={spellCheck}\n enterKeyHint={enterKeyHint}\n autoFocus={autoFocus}\n tabIndex={tabIndex}\n value={inputText}\n onChange={handleChange}\n onClick={() => {\n if (!open && interactive) setOpen(true);\n }}\n // Read-only: no listbox keys at all (they would open, commit or clear the value).\n onKeyDown={composeEventHandlers(onKeyDown, readOnly ? undefined : handleKeyDown)}\n onKeyUp={composeEventHandlers(onKeyUp, listbox.onKeyUp)}\n onFocus={onFocus}\n onBlur={composeEventHandlers(onBlur, () => setDraft(null), {\n checkDefaultPrevented: false,\n })}\n className={cn(\n comboboxClassNames.input,\n inputHeightClasses[size],\n 'w-full',\n inputPaddingClasses[size],\n inputTextClasses[size],\n inputAppearanceClasses[appearance],\n 'text-foreground placeholder:text-muted-foreground',\n inputFocus,\n disabledStyles,\n invalidLook && inputInvalid,\n pickerEndPadding(Number(showClear) + Number(showExpand), size),\n )}\n />\n {showClear && (\n <button\n type=\"button\"\n aria-label={labels?.clear ?? 'Clear selection'}\n disabled={disabled}\n // Keeps focus in the input, so its blur does not act on a draft before the clear.\n onMouseDown={(event) => event.preventDefault()}\n onClick={handleClear}\n className={cn(\n comboboxClassNames.clearButton,\n pickerIconButtonClasses(size, appearance),\n pickerButtonOffset(size, showExpand ? 2 : 1),\n focusRing,\n disabledStyles,\n )}\n >\n <DismissIcon size={pickerGlyphSize(size, 'icon')} />\n </button>\n )}\n {showExpand && (\n <PickerExpandButton\n component=\"Combobox\"\n expandIcon={expandIcon}\n label={labels?.expand ?? 'Show options'}\n expanded={expanded}\n listboxId={listbox.listboxId}\n disabled={disabled || !!readOnly}\n onToggle={handleExpandClick}\n size={size}\n appearance={appearance}\n className={comboboxClassNames.expandButton}\n iconClassName={comboboxClassNames.expandIcon}\n />\n )}\n </div>\n {/* Mounted before its text: a live region added together with its text is not announced by\n every screen reader. The row in the popup is the visible copy. */}\n <span role=\"status\" className=\"sr-only\">\n {noMatches && noMatchesText}\n </span>\n <ListboxSurface\n listbox={listbox}\n layerId={layerId}\n surfaceRef={surfaceRef}\n floatingProps={floatingProps}\n open={open}\n expanded={expanded}\n listboxClassName={comboboxClassNames.listbox}\n surfaceClassName={comboboxClassNames.surface}\n emptyContent={\n draft ? (\n <div\n aria-hidden=\"true\"\n className={cn(\n comboboxClassNames.emptyMessage,\n 'px-3 py-1.5 text-body-1 text-muted-foreground',\n )}\n >\n {noMatchesText}\n </div>\n ) : undefined\n }\n aria-label={fieldProps['aria-label']}\n aria-labelledby={listLabelledBy}\n >\n {children}\n </ListboxSurface>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={value}\n type=\"text\"\n // Like a native readonly input, a read-only Combobox is barred from constraint validation\n // (the user could not fix it); its value is still submitted.\n required={validates}\n onInvalid={() => inputRef.current?.focus()}\n />\n </div>\n );\n};\nComboboxRoot.displayName = 'Combobox';\n\n/** Flat name of `Combobox.Option` for React Server Components. */\nexport const ComboboxOption = Option;\n/** Flat name of `Combobox.OptionGroup` for React Server Components. */\nexport const ComboboxOptionGroup = OptionGroup;\n\n/**\n * An editable combobox: a text input with a filterable listbox of `Option`s (APG combobox with\n * list autocomplete). Typing filters the options; ArrowDown/ArrowUp move the highlight\n * (`aria-activedescendant`), Enter selects, Escape closes. Without `freeform` the text is only a\n * filter: its first match becomes active while typing, and the input shows the selected option's\n * label again when the listbox closes. With `freeform` the text itself is the value. Text that\n * matches no option shows \"No matches\" (`labels.noMatches`), announced through a status region.\n * The expand button at the end of the input (a chevron, see `expandIcon`) opens and closes the\n * list without taking focus from the input and is not a tab stop; `clearable` adds a clear button,\n * a tab stop after the input. Both sit with the input in a wrapper `<div>` inside the root.\n *\n * The `<input>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,\n * `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`,\n * `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes `autoComplete`,\n * `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and `enterKeyHint`.\n * `ref`, `className`, `style`, other `aria-*` attributes and the remaining props stay on the root\n * `<div>`. Inside a `Field` the input is labelled and described by it. It shows the error look\n * whenever it ends up `aria-invalid` (its own `aria-invalid` or a `Field` error). With\n * `name`/`required` the value takes part in form submission, validation and reset. The open\n * listbox renders in a portal; while closed it stays in the DOM, hidden.\n *\n * **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s\n * `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own prop,\n * then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as `data-size` and\n * `data-appearance` on the root `<div>`. The listbox keeps its size.\n *\n * Sub-components: `Combobox.Option`, `Combobox.OptionGroup`. React Server Components import the\n * flat names `ComboboxOption` / `ComboboxOptionGroup` (dotted access needs a client file).\n */\nexport const Combobox = /* @__PURE__ */ Object.assign(ComboboxRoot, {\n Option,\n OptionGroup,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6LA,SAASC,GAAY,GAAmB,GAAuB;CAC7D,QAAQC,EAAK,aAAaA,EAAK,MAAA,CAAO,YAAY,CAAC,CAAC,SAASC,EAAK,YAAY,CAAC;AACjF;AAEA,IAAMC,KAAgB,MAAyB;CAC7C,IAAM,EACJ,OAAOC,GACP,iBACA,kBACA,mBACA,MAAMC,GACN,iBACA,kBACA,iBACA,cAAW,IACX,MAAMC,IACN,YAAYC,IACZ,cAAW,IACX,UACA,SACA,aACA,mBAAe,OACf,oBACA,iBACA,cACA,aACA,eAAY,IACZ,eACA,WACA,eACA,gBACA,kBACA,eACA,cACA,QACA,cAAcC,IACd,mBAAmBC,IACnB,oBAAoBC,IACpB,gBAAgBC,IAChB,iBAAiBC,IACjB,qBAAqBC,IACrB,gBAAgBC,IAChB,aACA,YACA,eACA,aACA,gBACA,eACA,aACA,SACA,GAAGC,OACDC;CA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IAEN,cAAYxC,EAAW;IACvB,mBAAiB8D;IAEhB;GACa,CAAA;GAChB,kBAACuB,IAAD;IACQ;IACA;IACI;IACH;IACP,MAAK;IAGL,UAAUxF;IACV,iBAAiB4B,EAAS,SAAS,MAAM;GAC1C,CAAA;EACE;;AAET;AACA,EAAa,cAAc;AAG3B,IAAa6D,IAAiBC,GAEjBC,IAAsBC,GA+BtBC,IAA2B,uBAAO,OAAO/G,GAAc;CAClE;CACA;AACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/composeEventHandlers.cjs"),i=require("../../hooks/useControllable.cjs"),a=require("../../hooks/useId.cjs"),o=require("../../lib/direction.cjs"),ee=require("../../lib/focus.cjs"),te=require("../../hooks/useMergedRefs.cjs"),ne=require("../../hooks/useIsClient.cjs"),s=require("../../lib/aria.cjs"),re=require("../../hooks/useFieldControl.cjs"),ie=require("../../hooks/useDismiss.cjs"),ae=require("../portal/Portal.cjs"),c=require("../../lib/styles.cjs"),l=require("../../lib/icons.cjs"),oe=require("./Input.cjs"),se=require("../../hooks/useFormReset.cjs"),ce=require("../internal/HiddenInput.cjs"),le=require("../../hooks/usePopupPosition.cjs"),u=require("./dateUtils.cjs"),ue=require("../../hooks/useFocusTrap.cjs"),de=require("../../hooks/useRestoreFocus.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("react/jsx-runtime"),fe=require("react-dom");var pe=e=>e?`Enter a date in the format ${e}.`:`Enter a valid date.`,me=(e,t)=>e!==void 0&&t!==void 0?`Enter a date between ${e} and ${t}.`:e===void 0?`Enter a date on or before ${t}.`:`Enter a date on or after ${e}.`,he=`absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground`,ge=`flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover`,_e=`flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through`;function ve(e){let t=[];for(let n=0;n<e.length;n+=7)t.push(e.slice(n,n+7));return t}var p=e=>{let{value:p,defaultValue:ye,onValueChange:be,onChange:xe,formatDate:m,parseDate:Se,locale:h,minDate:g,maxDate:_,disabledDates:Ce,placeholder:we=`Select a date`,disabled:v=!1,readOnly:y,clearable:Te=!1,firstDayOfWeek:b=0,open:Ee,defaultOpen:De,onOpenChange:Oe,onInvalidInput:ke,labels:x,name:Ae,form:je,required:Me,autoComplete:Ne=`off`,autoCapitalize:Pe,autoCorrect:Fe,enterKeyHint:Ie,inputMode:Le,spellCheck:Re,autoFocus:ze,tabIndex:Be,id:Ve,"aria-label":He,"aria-labelledby":Ue,"aria-describedby":We,"aria-invalid":Ge,"aria-required":Ke,"aria-errormessage":qe,"aria-details":Je,onFocus:Ye,onBlur:Xe,onKeyDown:Ze,onKeyUp:Qe,controlRef:$e,className:et,ref:tt,...nt}=e;xe!==void 0&&n.warnDeprecated(`DatePicker`,`onChange`,`onValueChange`);let rt=m!==void 0,S=Se!==void 0;d.useEffect(()=>{rt&&!S&&n.warnOnce(`DatePicker:formatDate-without-parseDate`,"DatePicker: `formatDate` is set without `parseDate`. Typed dates are parsed with the default parser for `locale` (its numeric format or yyyy-mm-dd), which may not read your format; pass `parseDate` as the inverse of `formatDate`.")},[rt,S]),d.useEffect(()=>{h!==void 0&&!u.isValidLocaleTag(h)&&n.warnOnce(`DatePicker:invalid-locale:${h}`,`DatePicker: \`locale\` "${h}" is not a valid BCP 47 language tag (use hyphens, as in "en-US"). The runtime default locale formats and parses the dates instead, so the server and the browser may render different text.`)},[h]);let[C,it]=i.useControllable(p,ye??null,e=>{be?.(e),xe?.(e)}),w=!v&&!y,[T,E]=i.useControllable(Ee,(De??!1)&&w,Oe),at=ne.useIsClient(),D=T&&w&&at,ot=Ee!==void 0;d.useEffect(()=>{!w&&T&&!ot&&E(!1)},[w,T,ot,E]);let O=e=>m?m(e):u.formatDate(e,h),st=e=>Se?Se(e):u.parseDate(e,h),[k,A]=d.useState(null),[j,M]=d.useState(null),[ct,lt]=d.useState(w);ct!==w&&(lt(w),w||(A(null),M(null)));let N=C?u.formatISODate(C):``,[ut,dt]=d.useState(N);ut!==N&&(dt(N),j!==null&&(A(null),M(null)));let ft=e=>!u.isDateInRange(e,g,_)||!!Ce?.(u.startOfDay(e)),P=e=>{let t=e?u.startOfDay(e):null;(t?u.isSameDay(t,C):C===null)||it(t),A(null),M(null)},F=e=>{if(!e.trim())return P(null),!0;let t=st(e),n=null;if(!t||Number.isNaN(t.getTime())?n=`unparseable`:u.isDateInRange(t,g,_)?Ce?.(u.startOfDay(t))&&(n=`disabled`):n=`out-of-range`,n||!t){let t=n??`unparseable`;return M(t),ke?.(e,t),!1}return P(t),!0},I=u.startOfDay(new Date),pt=()=>u.startOfMonth(u.clampDate(C??I,g,_)),[L,R]=d.useState(pt),[mt,z]=d.useState(null),[B,V]=d.useState(!1),[ht,gt]=d.useState(D);ht!==D&&(gt(D),D&&(R(pt()),z(null))),B&&!D&&V(!1);let H=d.useMemo(()=>ve(u.getCalendarDays(L,b)),[L,b]),U=e=>!!e&&u.isSameMonth(e,L),_t=e=>!!e&&e>=H[0][0]&&e<=H[H.length-1][6],vt=u.clampDate(I,g,_),yt=u.clampDate(L,g,_),W=_t(mt)?mt:U(C)?u.startOfDay(C):U(vt)?vt:U(yt)?yt:L,G=u.formatISODate(W),bt=e=>{let t=u.clampDate(e,g,_);z(t),u.isSameMonth(t,L)||R(u.startOfMonth(t))},xt=e=>{let t=u.addMonths(L,e),n=u.clampDate(u.addMonths(W,e),g,_);R(t),z(u.isSameMonth(n,t)?n:null)},St=e=>{u.isSameDay(e,W)||z(e)},Ct=!!g&&u.addDays(L,-1)<u.startOfDay(g),wt=!!_&&u.addMonths(L,1)>u.startOfDay(_),Tt=d.useMemo(()=>u.getWeekdayNames(h,b),[h,b]),K=d.useRef(null),q=d.useRef(null),J=d.useRef(null),Et=d.useRef(null),Y=d.useRef(null),[Dt,Ot]=d.useState(null),kt=te.useMergedRefs($e,K),At=a.useId(`datepicker-dialog`),X=a.useId(`datepicker-heading`),Z=a.useId(`datepicker-grid`),jt=a.useId(`datepicker-error`),Mt=e=>{Y.current=e,E(!1)},{layerId:Nt}=ie.useDismiss({open:D,onDismiss:(e,t)=>{let n=e===`outside-press`&&t.target instanceof Element?t.target.closest(ee.FOCUSABLE_SELECTOR):null;Mt(n??(B?K.current:null))},refs:[Et,q],anchorRef:q,kind:`modal`}),{setReference:Pt,setFloating:Ft,floatingProps:It}=le.usePopupPosition({open:D,side:`bottom`,align:`start`}),Lt=te.useMergedRefs(Et,Ot,Ft);ue.useFocusTrap(Dt,{enabled:D,layerId:Nt,initialFocus:()=>J.current?.querySelector(`button[tabindex="0"]`)??null}),de.useRestoreFocus({enabled:D,container:Dt,triggerRef:q,finalFocusRef:Y,onlyIfFocusInside:!0}),d.useLayoutEffect(()=>{D&&(Y.current=null)},[D]),d.useLayoutEffect(()=>{let e=J.current;if(!e)return;let t=e.ownerDocument.activeElement;if(!t||!e.contains(t))return;let n=e.querySelector(`button[data-date="${G}"]`);n&&n!==t&&n.focus()},[G]);let Rt=re.useFieldContext(),zt=(Me??Rt?.required??!1)&&!y,Bt=j!==null&&!Rt?.hasErrorMessage,Vt=re.useFieldControl({id:Ve,"aria-label":He,"aria-labelledby":Ue,"aria-describedby":s.joinIds(We,Bt?jt:void 0),"aria-invalid":j!==null||Ge,"aria-required":Ke??Me}),Ht=oe.isInvalidLook(!1,Vt[`aria-invalid`]);se.useFormReset(K,()=>P(ye??null),je);let Q=Te&&!y&&C!==null,Ut=e=>{w&&(A(e.target.value),M(null))},Wt=r.composeEventHandlers(Ze,e=>{w&&!e.nativeEvent.isComposing&&(e.key===`Enter`&&k!==null?(e.preventDefault(),F(k)):e.key===`Tab`&&!e.shiftKey&&Q&&k!==null&&!k.trim()?(0,fe.flushSync)(()=>F(k)):e.key===`ArrowDown`&&e.altKey&&!D&&(e.preventDefault(),k!==null&&j===null&&F(k),V(!0),E(!0)))}),Gt=r.composeEventHandlers(Xe,()=>{w&&k!==null&&j===null&&F(k)}),Kt=()=>{w&&(Y.current=null,V(!1),E(!D))},qt=()=>{w&&(P(null),K.current?.focus())},Jt=e=>{e.preventDefault()},Yt=e=>{w&&!ft(e)&&(P(e),Mt(K.current))},Xt=e=>{e.key!==`Escape`||e.defaultPrevented||e.nativeEvent.isComposing||(e.preventDefault(),Mt(B?K.current:null))},Zt=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=(W.getDay()-b+7)%7,n;switch(e.key){case`ArrowLeft`:case`ArrowRight`:{let t=o.getArrowIntent(e.key,{orientation:`horizontal`,dir:o.getDirection(e.currentTarget)});n=u.addDays(W,t===`next`?1:-1);break}case`ArrowDown`:n=u.addDays(W,7);break;case`ArrowUp`:n=u.addDays(W,-7);break;case`PageDown`:n=u.addMonths(W,e.shiftKey?12:1);break;case`PageUp`:n=u.addMonths(W,e.shiftKey?-12:-1);break;case`Home`:n=u.addDays(W,-t);break;case`End`:n=u.addDays(W,6-t);break;default:return}e.preventDefault(),bt(n)},Qt=k??(C?O(C):``),$=``;return j===`unparseable`?$=(x?.invalidDate??pe)(S?void 0:u.getLocaleDateFormat(h).pattern):j===`out-of-range`&&(g||_)?$=(x?.outOfRange??me)(g?O(u.startOfDay(g)):void 0,_?O(u.startOfDay(_)):void 0):j===`disabled`&&($=x?.unavailableDate??`This date is not available.`),(0,f.jsxs)(`div`,{...nt,ref:tt,className:t.cn(`relative inline-flex flex-col`,et),children:[(0,f.jsxs)(`div`,{ref:Pt,className:`relative flex items-center`,children:[(0,f.jsx)(`input`,{ref:kt,type:`text`,...Vt,"aria-errormessage":qe,"aria-details":Je,value:Qt,onChange:Ut,onFocus:Ye,onBlur:Gt,onKeyDown:Wt,onKeyUp:Qe,placeholder:we,disabled:v,readOnly:y,autoComplete:Ne,autoCapitalize:Pe,autoCorrect:Fe,enterKeyHint:Ie,inputMode:Le,spellCheck:Re,autoFocus:ze,tabIndex:Be,className:t.cn(c.inputBase,`border-b-stroke-accessible`,c.inputFocus,c.disabledStyles,Ht&&`border-destructive focus:border-b-destructive`,Q?`pe-14`:`pe-8`)}),Q&&(0,f.jsx)(`button`,{type:`button`,"aria-label":x?.clear??`Clear date`,disabled:v,onMouseDown:Jt,onClick:qt,className:t.cn(he,`end-7`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,f.jsx)(l.DismissIcon,{})}),(0,f.jsx)(`button`,{ref:q,type:`button`,"aria-label":x?.openCalendar??`Open calendar`,"aria-haspopup":`dialog`,"aria-expanded":D,"aria-controls":D?At:void 0,disabled:v||y,onClick:Kt,className:t.cn(he,`end-1`,c.focusRing,c.disabledStyles),children:(0,f.jsx)(l.CalendarIcon,{})})]}),Bt&&(0,f.jsx)(`p`,{id:jt,role:`alert`,className:`mt-1 text-caption-1 text-error`,children:$}),(0,f.jsx)(ce.HiddenInput,{name:Ae,form:je,disabled:v,value:C?u.formatISODate(C):``,type:`text`,required:zt,onInvalid:()=>K.current?.focus()}),D&&(0,f.jsx)(ae.Portal,{layerId:Nt,children:(0,f.jsxs)(`div`,{ref:Lt,id:At,role:`dialog`,"aria-modal":`true`,"aria-labelledby":X,...It,"data-state":`open`,onKeyDown:Xt,className:`rounded-md border border-border bg-background p-3 text-foreground shadow-16`,children:[(0,f.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":x?.previousMonth??`Previous month`,"aria-controls":Z,...s.focusableDisabledProps(Ct),onClick:s.preventIfDisabled(Ct,()=>xt(-1)),className:t.cn(ge,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,f.jsx)(l.ChevronLeftIcon,{className:`wave-rtl:-scale-x-100`})}),(0,f.jsx)(`h2`,{id:X,"aria-live":`polite`,className:`text-body-1 font-semibold`,children:u.formatMonthYear(L,h)}),(0,f.jsx)(`button`,{type:`button`,"aria-label":x?.nextMonth??`Next month`,"aria-controls":Z,...s.focusableDisabledProps(wt),onClick:s.preventIfDisabled(wt,()=>xt(1)),className:t.cn(ge,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,f.jsx)(l.ChevronRightIcon,{className:`wave-rtl:-scale-x-100`})})]}),(0,f.jsxs)(`table`,{ref:J,id:Z,role:`grid`,"aria-labelledby":X,onKeyDown:Zt,className:`border-collapse`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsx)(`tr`,{children:Tt.map(e=>(0,f.jsxs)(`th`,{scope:`col`,abbr:e.long,"aria-label":e.long,className:`h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground`,children:[(0,f.jsx)(`span`,{"aria-hidden":`true`,children:e.short}),(0,f.jsx)(`span`,{className:`sr-only`,children:e.long})]},e.long))})}),(0,f.jsx)(`tbody`,{children:H.map((e,n)=>(0,f.jsx)(`tr`,{children:e.map((e,n)=>{let r=u.formatISODate(e),i=u.isSameDay(e,C),a=u.isSameDay(e,I),o=r===G,ee=ft(e);return(0,f.jsx)(`td`,{role:`gridcell`,"aria-selected":i,className:`p-0`,children:(0,f.jsx)(`button`,{type:`button`,tabIndex:o?0:-1,"aria-label":u.formatDayLabel(e,h),"aria-pressed":i||void 0,"aria-current":a?`date`:void 0,...s.focusableDisabledProps(ee),"data-date":r,"data-selected":i?``:void 0,"data-today":a?``:void 0,"data-outside":u.isSameMonth(e,L)?void 0:``,onFocus:()=>St(e),onClick:()=>Yt(e),className:t.cn(_e,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`,i&&c.forcedColors.selectedLeaf),children:u.formatDayNumber(e,h)})},n)})},n))})]})]})})]})};p.displayName=`DatePicker`,exports.DatePicker=p;
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/composeEventHandlers.cjs"),i=require("../../lib/classNames.cjs"),a=require("../../hooks/useControllable.cjs"),o=require("../../hooks/useId.cjs"),s=require("../../lib/direction.cjs"),ee=require("../../lib/focus.cjs"),te=require("../../hooks/useMergedRefs.cjs"),ne=require("../../hooks/useIsClient.cjs"),c=require("../../lib/aria.cjs"),re=require("../../hooks/useFieldControl.cjs"),ie=require("../../hooks/useDismiss.cjs"),ae=require("../portal/Portal.cjs"),l=require("../../lib/styles.cjs"),u=require("../../lib/icons.cjs"),oe=require("./inputLook.cjs"),se=require("./Input.cjs"),ce=require("../../hooks/useFormReset.cjs"),le=require("../internal/HiddenInput.cjs"),d=require("./pickerStyles.cjs"),ue=require("../../hooks/usePopupPosition.cjs"),f=require("./dateUtils.cjs"),de=require("../../hooks/useFocusTrap.cjs"),fe=require("../../hooks/useRestoreFocus.cjs");let p=require("react");p=e.__toESM(p,1);let m=require("react/jsx-runtime"),pe=require("react-dom");var me=e=>e?`Enter a date in the format ${e}.`:`Enter a valid date.`,he=(e,t)=>e!==void 0&&t!==void 0?`Enter a date between ${e} and ${t}.`:e===void 0?`Enter a date on or before ${t}.`:`Enter a date on or after ${e}.`,ge=`flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover`,_e=`flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through`;function ve(e){let t=[];for(let n=0;n<e.length;n+=7)t.push(e.slice(n,n+7));return t}var h=e=>{let{value:h,defaultValue:ye,onValueChange:be,onChange:xe,formatDate:g,parseDate:_,locale:v,minDate:y,maxDate:b,disabledDates:Se,placeholder:Ce=`Select a date`,disabled:x=!1,size:we,appearance:Te,readOnly:S,clearable:Ee=!1,firstDayOfWeek:C=0,open:De,defaultOpen:Oe,onOpenChange:ke,onInvalidInput:Ae,labels:w,name:je,form:Me,required:Ne,autoComplete:Pe=`off`,autoCapitalize:Fe,autoCorrect:Ie,enterKeyHint:Le,inputMode:Re,spellCheck:ze,autoFocus:Be,tabIndex:Ve,id:He,"aria-label":Ue,"aria-labelledby":We,"aria-describedby":Ge,"aria-invalid":Ke,"aria-required":qe,"aria-errormessage":Je,"aria-details":Ye,onFocus:Xe,onBlur:Ze,onKeyDown:Qe,onKeyUp:$e,controlRef:et,className:tt,ref:nt,...rt}=e;xe!==void 0&&n.warnDeprecated(`DatePicker`,`onChange`,`onValueChange`);let{size:T,appearance:E}=oe.useInputLook(we,Te),it=g!==void 0,at=_!==void 0;p.useEffect(()=>{it&&!at&&n.warnOnce(`DatePicker:formatDate-without-parseDate`,"DatePicker: `formatDate` is set without `parseDate`. Typed dates are parsed with the default parser for `locale` (its numeric format or yyyy-mm-dd), which may not read your format; pass `parseDate` as the inverse of `formatDate`.")},[it,at]),p.useEffect(()=>{v!==void 0&&!f.isValidLocaleTag(v)&&n.warnOnce(`DatePicker:invalid-locale:${v}`,`DatePicker: \`locale\` "${v}" is not a valid BCP 47 language tag (use hyphens, as in "en-US"). The runtime default locale formats and parses the dates instead, so the server and the browser may render different text.`)},[v]);let[D,ot]=a.useControllable(h,ye??null,e=>{be?.(e),xe?.(e)}),O=!x&&!S,[k,A]=a.useControllable(De,(Oe??!1)&&O,ke),st=ne.useIsClient(),j=k&&O&&st,ct=De!==void 0;p.useEffect(()=>{!O&&k&&!ct&&A(!1)},[O,k,ct,A]);let M=e=>g?g(e):f.formatDate(e,v),lt=e=>_?_(e):f.parseDate(e,v),[N,P]=p.useState(null),[F,I]=p.useState(null),[ut,dt]=p.useState(O);ut!==O&&(dt(O),O||(P(null),I(null)));let L=D?f.formatISODate(D):``,[ft,pt]=p.useState(L);ft!==L&&(pt(L),F!==null&&(P(null),I(null)));let mt=e=>!f.isDateInRange(e,y,b)||!!Se?.(f.startOfDay(e)),R=e=>{let t=e?f.startOfDay(e):null;(t?f.isSameDay(t,D):D===null)||ot(t),P(null),I(null)},z=e=>{if(!e.trim())return R(null),!0;let t=lt(e),n=null;if(!t||Number.isNaN(t.getTime())?n=`unparseable`:f.isDateInRange(t,y,b)?Se?.(f.startOfDay(t))&&(n=`disabled`):n=`out-of-range`,n||!t){let t=n??`unparseable`;return I(t),Ae?.(e,t),!1}return R(t),!0},B=f.startOfDay(new Date),ht=()=>f.startOfMonth(f.clampDate(D??B,y,b)),[V,H]=p.useState(ht),[gt,U]=p.useState(null),[W,G]=p.useState(!1),[_t,vt]=p.useState(j);_t!==j&&(vt(j),j&&(H(ht()),U(null))),W&&!j&&G(!1);let K=p.useMemo(()=>ve(f.getCalendarDays(V,C)),[V,C]),q=e=>!!e&&f.isSameMonth(e,V),yt=e=>!!e&&e>=K[0][0]&&e<=K[K.length-1][6],bt=f.clampDate(B,y,b),xt=f.clampDate(V,y,b),J=yt(gt)?gt:q(D)?f.startOfDay(D):q(bt)?bt:q(xt)?xt:V,Y=f.formatISODate(J),St=e=>{let t=f.clampDate(e,y,b);U(t),f.isSameMonth(t,V)||H(f.startOfMonth(t))},Ct=e=>{let t=f.addMonths(V,e),n=f.clampDate(f.addMonths(J,e),y,b);H(t),U(f.isSameMonth(n,t)?n:null)},wt=e=>{f.isSameDay(e,J)||U(e)},Tt=!!y&&f.addDays(V,-1)<f.startOfDay(y),Et=!!b&&f.addMonths(V,1)>f.startOfDay(b),Dt=p.useMemo(()=>f.getWeekdayNames(v,C),[v,C]),X=p.useRef(null),Z=p.useRef(null),Ot=p.useRef(null),kt=p.useRef(null),Q=p.useRef(null),[At,jt]=p.useState(null),Mt=te.useMergedRefs(et,X),Nt=o.useId(`datepicker-dialog`),Pt=o.useId(`datepicker-heading`),Ft=o.useId(`datepicker-grid`),It=o.useId(`datepicker-error`),Lt=e=>{Q.current=e,A(!1)},{layerId:Rt}=ie.useDismiss({open:j,onDismiss:(e,t)=>{let n=e===`outside-press`&&t.target instanceof Element?t.target.closest(ee.FOCUSABLE_SELECTOR):null;Lt(n??(W?X.current:null))},refs:[kt,Z],anchorRef:Z,kind:`modal`}),{setReference:zt,setFloating:Bt,floatingProps:Vt}=ue.usePopupPosition({open:j,side:`bottom`,align:`start`}),Ht=te.useMergedRefs(kt,jt,Bt);de.useFocusTrap(At,{enabled:j,layerId:Rt,initialFocus:()=>Ot.current?.querySelector(`button[tabindex="0"]`)??null}),fe.useRestoreFocus({enabled:j,container:At,triggerRef:Z,finalFocusRef:Q,onlyIfFocusInside:!0}),p.useLayoutEffect(()=>{j&&(Q.current=null)},[j]),p.useLayoutEffect(()=>{let e=Ot.current;if(!e)return;let t=e.ownerDocument.activeElement;if(!t||!e.contains(t))return;let n=e.querySelector(`button[data-date="${Y}"]`);n&&n!==t&&n.focus()},[Y]);let Ut=re.useFieldContext(),Wt=(Ne??Ut?.required??!1)&&!S,Gt=F!==null&&!Ut?.hasErrorMessage,Kt=re.useFieldControl({id:He,"aria-label":Ue,"aria-labelledby":We,"aria-describedby":c.joinIds(Ge,Gt?It:void 0),"aria-invalid":F!==null||Ke,"aria-required":qe??Ne}),qt=se.isInvalidLook(!1,Kt[`aria-invalid`]);ce.useFormReset(X,()=>R(ye??null),Me);let Jt=Ee&&!S&&D!==null,Yt=e=>{O&&(P(e.target.value),I(null))},Xt=r.composeEventHandlers(Qe,e=>{O&&!e.nativeEvent.isComposing&&(e.key===`Enter`&&N!==null?(e.preventDefault(),z(N)):e.key===`Tab`&&!e.shiftKey&&Jt&&N!==null&&!N.trim()?(0,pe.flushSync)(()=>z(N)):e.key===`ArrowDown`&&e.altKey&&!j&&(e.preventDefault(),N!==null&&F===null&&z(N),G(!0),A(!0)))}),Zt=r.composeEventHandlers(Ze,()=>{O&&N!==null&&F===null&&z(N)}),Qt=()=>{O&&(Q.current=null,G(!1),A(!j))},$t=()=>{O&&(R(null),X.current?.focus())},en=e=>{e.preventDefault()},tn=e=>{O&&!mt(e)&&(R(e),Lt(X.current))},nn=e=>{e.key!==`Escape`||e.defaultPrevented||e.nativeEvent.isComposing||(e.preventDefault(),Lt(W?X.current:null))},rn=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=(J.getDay()-C+7)%7,n;switch(e.key){case`ArrowLeft`:case`ArrowRight`:{let t=s.getArrowIntent(e.key,{orientation:`horizontal`,dir:s.getDirection(e.currentTarget)});n=f.addDays(J,t===`next`?1:-1);break}case`ArrowDown`:n=f.addDays(J,7);break;case`ArrowUp`:n=f.addDays(J,-7);break;case`PageDown`:n=f.addMonths(J,e.shiftKey?12:1);break;case`PageUp`:n=f.addMonths(J,e.shiftKey?-12:-1);break;case`Home`:n=f.addDays(J,-t);break;case`End`:n=f.addDays(J,6-t);break;default:return}e.preventDefault(),St(n)},an=N??(D?M(D):``),$=``;return F===`unparseable`?$=(w?.invalidDate??me)(at?void 0:f.getLocaleDateFormat(v).pattern):F===`out-of-range`&&(y||b)?$=(w?.outOfRange??he)(y?M(f.startOfDay(y)):void 0,b?M(f.startOfDay(b)):void 0):F===`disabled`&&($=w?.unavailableDate??`This date is not available.`),(0,m.jsxs)(`div`,{"data-size":T,"data-appearance":E,...rt,ref:nt,className:t.cn(i.datePickerClassNames.root,`relative inline-flex flex-col`,tt),children:[(0,m.jsxs)(`div`,{ref:zt,className:`relative flex items-center`,children:[(0,m.jsx)(`input`,{ref:Mt,type:`text`,...Kt,"aria-errormessage":Je,"aria-details":Ye,value:an,onChange:Yt,onFocus:Xe,onBlur:Zt,onKeyDown:Xt,onKeyUp:$e,placeholder:Ce,disabled:x,readOnly:S,autoComplete:Pe,autoCapitalize:Fe,autoCorrect:Ie,enterKeyHint:Le,inputMode:Re,spellCheck:ze,autoFocus:Be,tabIndex:Ve,className:t.cn(i.datePickerClassNames.input,l.inputHeightClasses[T],`w-full`,l.inputPaddingClasses[T],l.inputTextClasses[T],l.inputAppearanceClasses[E],`text-foreground placeholder:text-muted-foreground`,l.inputFocus,l.disabledStyles,qt&&`border-destructive`,d.pickerEndPadding(Jt?2:1,T))}),Jt&&(0,m.jsx)(`button`,{type:`button`,"aria-label":w?.clear??`Clear date`,disabled:x,onMouseDown:en,onClick:$t,className:t.cn(i.datePickerClassNames.clearButton,d.pickerIconButtonClasses(T,E),d.pickerButtonOffset(T,2),`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,m.jsx)(u.DismissIcon,{size:d.pickerGlyphSize(T,`icon`)})}),(0,m.jsx)(`button`,{ref:Z,type:`button`,"aria-label":w?.openCalendar??`Open calendar`,"aria-haspopup":`dialog`,"aria-expanded":j,"aria-controls":j?Nt:void 0,disabled:x||S,onClick:Qt,className:t.cn(i.datePickerClassNames.openCalendarButton,d.pickerIconButtonClasses(T,E),d.pickerButtonOffset(T,1),l.focusRing,l.disabledStyles),children:(0,m.jsx)(u.CalendarIcon,{size:d.pickerGlyphSize(T,`icon`)})})]}),Gt&&(0,m.jsx)(`p`,{id:It,role:`alert`,className:t.cn(i.datePickerClassNames.errorMessage,`mt-1 text-caption-1 text-error`),children:$}),(0,m.jsx)(le.HiddenInput,{name:je,form:Me,disabled:x,value:D?f.formatISODate(D):``,type:`text`,required:Wt,onInvalid:()=>X.current?.focus()}),j&&(0,m.jsx)(ae.Portal,{layerId:Rt,children:(0,m.jsxs)(`div`,{ref:Ht,id:Nt,role:`dialog`,"aria-modal":`true`,"aria-labelledby":Pt,...Vt,"data-state":`open`,onKeyDown:nn,className:t.cn(i.datePickerClassNames.surface,`rounded-md border border-border bg-background p-3 text-foreground shadow-16`),children:[(0,m.jsxs)(`div`,{className:t.cn(i.datePickerClassNames.header,`mb-2 flex items-center justify-between gap-2`),children:[(0,m.jsx)(`button`,{type:`button`,"aria-label":w?.previousMonth??`Previous month`,"aria-controls":Ft,...c.focusableDisabledProps(Tt),onClick:c.preventIfDisabled(Tt,()=>Ct(-1)),className:t.cn(i.datePickerClassNames.previousMonthButton,ge,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,m.jsx)(u.ChevronLeftIcon,{className:`wave-rtl:-scale-x-100`})}),(0,m.jsx)(`h2`,{id:Pt,"aria-live":`polite`,className:t.cn(i.datePickerClassNames.heading,`text-body-1 font-semibold`),children:f.formatMonthYear(V,v)}),(0,m.jsx)(`button`,{type:`button`,"aria-label":w?.nextMonth??`Next month`,"aria-controls":Ft,...c.focusableDisabledProps(Et),onClick:c.preventIfDisabled(Et,()=>Ct(1)),className:t.cn(i.datePickerClassNames.nextMonthButton,ge,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,m.jsx)(u.ChevronRightIcon,{className:`wave-rtl:-scale-x-100`})})]}),(0,m.jsxs)(`table`,{ref:Ot,id:Ft,role:`grid`,"aria-labelledby":Pt,onKeyDown:rn,className:t.cn(i.datePickerClassNames.grid,`border-collapse`),children:[(0,m.jsx)(`thead`,{children:(0,m.jsx)(`tr`,{children:Dt.map(e=>(0,m.jsxs)(`th`,{scope:`col`,abbr:e.long,"aria-label":e.long,className:t.cn(i.datePickerClassNames.weekday,`h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground`),children:[(0,m.jsx)(`span`,{"aria-hidden":`true`,children:e.short}),(0,m.jsx)(`span`,{className:`sr-only`,children:e.long})]},e.long))})}),(0,m.jsx)(`tbody`,{children:K.map((e,n)=>(0,m.jsx)(`tr`,{children:e.map((e,n)=>{let r=f.formatISODate(e),a=f.isSameDay(e,D),o=f.isSameDay(e,B),s=r===Y,ee=mt(e);return(0,m.jsx)(`td`,{role:`gridcell`,"aria-selected":a,className:`p-0`,children:(0,m.jsx)(`button`,{type:`button`,tabIndex:s?0:-1,"aria-label":f.formatDayLabel(e,v),"aria-pressed":a||void 0,"aria-current":o?`date`:void 0,...c.focusableDisabledProps(ee),"data-date":r,"data-selected":a?``:void 0,"data-today":o?``:void 0,"data-outside":f.isSameMonth(e,V)?void 0:``,onFocus:()=>wt(e),onClick:()=>tn(e),className:t.cn(i.datePickerClassNames.day,_e,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`,a&&l.forcedColors.selectedLeaf),children:f.formatDayNumber(e,v)})},n)})},n))})]})]})})]})};h.displayName=`DatePicker`,exports.DatePicker=h;
|
|
2
2
|
//# sourceMappingURL=DatePicker.cjs.map
|