@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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/slot.cjs"),a=require("../../hooks/useId.cjs"),
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/slot.cjs"),a=require("../../lib/classNames.cjs"),o=require("../../hooks/useId.cjs"),s=require("../../hooks/useMergedRefs.cjs"),c=require("../../hooks/useIsClient.cjs"),ee=require("../portal/Portal.cjs"),te=require("../button/Button.cjs"),l=require("../../lib/icons.cjs"),ne=require("../../hooks/useModalLayer.cjs"),u=require("./Dialog.shared.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=d.createContext(null);p.displayName=`DrawerContext`;var m={open:!1,requestOpen:()=>{},trigger:u.inertModalTrigger,panelId:``,inPanel:!1};function h(e){return u.useRequiredContext(p,e,`Drawer`,()=>m)}var g={start:`start-0 border-e`,end:`end-0 border-s`,left:`left-0 border-r`,right:`right-0 border-l`},_=`Drawer.Trigger:nested`,v="Drawer.Trigger must be a direct child of Drawer (a Fragment is fine). Inside another element or a component it is rendered as panel content, which exists only while the drawer is open, so it cannot open the drawer. Make it a direct child, put wrappers such as a Tooltip inside the trigger, or control the Drawer with `open`/`onOpenChange` and open it from your own button.",y=`Drawer:unreachable`,b="Drawer has no way to open: a second after mounting it is still uncontrolled (no `open` prop), closed, and has no Drawer.Trigger as a direct child (or in a Fragment there). A Drawer.Trigger rendered by a component or nested in an element is panel content, which exists only while the drawer is open. Make the trigger a direct child of Drawer, or control the Drawer with `open`/`onOpenChange`.",x=1e3,S=e=>{let{open:t,requestOpen:n,trigger:i,panelId:a,inPanel:o}=h(`Drawer.Trigger`);return d.useEffect(()=>{o&&r.warnOnce(_,v)},[o]),u.useModalTriggerPart({open:t,requestOpen:n,trigger:i,controlsId:a},e,`Drawer.Trigger`)};S.displayName=`DrawerTrigger`;var C=e=>{let{requestOpen:t}=h(`Drawer.Close`);return u.useModalClosePart(t,e,`Drawer.Close`)};C.displayName=`DrawerClose`;var w=({id:e,className:n,children:r,ref:i,...o})=>{let{id:s,ref:c}=u.useModalTitle(`Drawer.Title`,`Drawer`,e,i);return(0,f.jsx)(`h2`,{...o,id:s,ref:c,className:t.cn(a.drawerTitleClassNames.root,`text-subtitle-1 font-semibold text-foreground`,n),children:r})};w.displayName=`DrawerTitle`;var T=32;function E(e){let t=(e,r,i)=>{if(i>T||typeof e!=`object`||!e)return!1;if(Array.isArray(e))return e.some(e=>t(e,r,i));if(!d.isValidElement(e))return!1;let a=n.getElementType(e,{suspend:!1});if(a===S)return r>0;let o=a===d.Fragment;if(typeof a!=`string`&&!o)return!1;let{children:s}=e.props;return t(s,o?r:r+1,i+1)};return t(e,0,0)}function re(e){let t=[],r=[];for(let{key:i,node:a}of n.flattenChildren(e)){let e=d.isValidElement(a)?d.cloneElement(a,{key:i}):a;n.isElementOfType(a,S)?t.push(e):r.push(e)}return{triggers:t,content:r}}var D=({open:e,defaultOpen:n,onOpenChange:m,position:h=`end`,title:S,closeLabel:C=`Close`,finalFocusRef:w,children:T,className:D,id:O,ref:k,...A})=>{let[j,M]=u.useModalOpenState(e,n,m),ie=c.useIsClient(),N=j&&ie,P=u.useModalTrigger(),F=o.useId(`wave-drawer`),I=O??F,L=o.useId(`wave-drawer-title`),R=u.useTitleRegistry(),[z,B]=d.useState(null),V=d.useRef(null),H=d.useCallback(e=>{V.current=e,B(e)},[]),U=s.useMergedRefs(k,H),W=u.useBackdropPress(V,!0),G=u.useModalDismiss(M,`Drawer`,W.afterOutsidePress),K=ne.useModalLayer({open:N,onDismiss:G,refs:[V],container:z,triggerRef:P.focusRef,finalFocusRef:w});u.useModalTriggerSession(P,N),u.useUnnamedModalWarning(N?z:null,R.hasTitle,`Drawer`,`Drawer.Title`);let{triggers:q,content:J}=re(T),Y=d.useRef(!1);d.useEffect(()=>{r.isDev&&!Y.current&&E(T)&&(Y.current=!0,r.warnOnce(_,v))},[T]);let X=e===void 0&&!n&&q.length===0,Z=d.useRef({unreachable:X,children:T});d.useLayoutEffect(()=>{Z.current={unreachable:X,children:T}}),d.useEffect(()=>{if(!r.isDev||!Z.current.unreachable)return;let e=setTimeout(()=>{let e=Z.current;e.unreachable&&!E(e.children)&&r.warnOnce(y,b)},x);return()=>clearTimeout(e)},[]);let Q=d.useMemo(()=>({open:N,requestOpen:M,trigger:P,panelId:I,inPanel:!1}),[N,M,P,I]),ae=d.useMemo(()=>({...Q,inPanel:!0}),[Q]),$=i.slotRendersContent(S);return(0,f.jsxs)(p.Provider,{value:Q,children:[q,N&&(0,f.jsx)(ee.Portal,{layerId:K.layerId,children:(0,f.jsx)(`div`,{className:t.cn(a.drawerClassNames.backdrop,`fixed inset-0 bg-backdrop`),onMouseDown:W.onMouseDown,children:(0,f.jsx)(`div`,{ref:U,role:`dialog`,id:I,"aria-labelledby":$?L:R.titleId,tabIndex:-1,...A,className:t.cn(a.drawerClassNames.root,`fixed top-0 flex h-full w-80 max-w-full flex-col border-border bg-background text-foreground shadow-64`,g[h],D),children:(0,f.jsx)(p.Provider,{value:ae,children:(0,f.jsxs)(u.ModalSurfaceContext.Provider,{value:R.context,children:[(0,f.jsxs)(`div`,{className:t.cn(a.drawerClassNames.header,`flex items-center justify-between gap-2 border-b border-border p-4`),children:[$&&(0,f.jsx)(`h2`,{id:L,className:t.cn(a.drawerTitleClassNames.root,`text-subtitle-1 font-semibold`),children:S}),(0,f.jsx)(te.Button,{appearance:`subtle`,size:`small`,icon:(0,f.jsx)(l.DismissIcon,{}),"aria-label":C,onClick:e=>M(!1,{reason:`close-button`,event:e.nativeEvent}),className:t.cn(a.drawerClassNames.closeButton,`ms-auto text-muted-foreground`)})]}),(0,f.jsx)(`div`,{className:t.cn(a.drawerClassNames.body,`min-h-0 flex-1 overflow-y-auto p-4`),children:J})]})})})})})]})};D.displayName=`Drawer`;var O=Object.assign(D,{Trigger:S,Close:C,Title:w});exports.Drawer=O,exports.DrawerClose=C,exports.DrawerTitle=w,exports.DrawerTrigger=S;
|
|
2
2
|
//# sourceMappingURL=Drawer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.cjs","names":["React","inertModalTrigger","useRequiredContext","useModalTriggerPart","useModalClosePart","useModalTitle","cn","getElementType","flattenChildren","isElementOfType","useModalOpenState","useIsClient","useModalTrigger","useId","useTitleRegistry","useMergedRefs","useBackdropPress","useModalDismiss","useModalLayer","isDev","slotRendersContent","Portal","ModalSurfaceContext","Button","DismissIcon","require_runtime","require_cn","require_children","require_dev","require_slot","require_useId","require_useMergedRefs","require_useIsClient","require_Portal","require_Button","require_icons","require_useModalLayer","require_Dialog_shared","react","react_jsx_runtime","DrawerContext","inertDrawerContext","useDrawerContext","componentName","positionClasses","NESTED_TRIGGER_WARNING_KEY","NESTED_TRIGGER_WARNING","UNREACHABLE_WARNING_KEY","UNREACHABLE_WARNING","REACHABILITY_CHECK_DELAY","DrawerTrigger","inPanel","panelId","props","DrawerClose","requestOpen","DrawerTitle","rest","titleId","titleRef","id","ref","className","NESTED_TRIGGER_MAX_DEPTH","hasNestedTrigger","visit","level","node","item","depth","type","isFragment","nested","children","splitChildren","triggers","content","keyed","DrawerRoot","openProp","openState","defaultOpen","onOpenChange","isClient","open","trigger","generatedId","propTitleId","titles","panel","setPanel","panelRef","attachPanel","mergedRef","backdropPress","onDismiss","layer","nestedWarnedRef","unreachable","latestRef","timer","latest","context","panelContext","hasTitle","title","position","closeLabel","event","Drawer"],"sources":["../../../src/components/overlays/Drawer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, getElementType, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { isDev, warnOnce } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport { slotRendersContent } from '../../lib/slot';\nimport type { ModalOpenChangeReason, OpenChangeDetails } from '../../lib/types';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useModalLayer } from '../../hooks/useModalLayer';\nimport { Button } from '../button/Button';\nimport { Portal } from '../portal/Portal';\nimport {\n inertModalTrigger,\n ModalSurfaceContext,\n useBackdropPress,\n useModalClosePart,\n useModalDismiss,\n useModalOpenState,\n useModalTitle,\n useModalTrigger,\n useModalTriggerPart,\n useModalTriggerSession,\n useRequiredContext,\n useTitleRegistry,\n useUnnamedModalWarning,\n type ModalRequestOpen,\n type ModalTrigger,\n} from './Dialog.shared';\n\n/**\n * Side of the screen the drawer is attached to. `start`/`end` follow the text direction (in a\n * right-to-left layout `end` is the left edge); `left`/`right` are physical sides.\n */\nexport type DrawerPosition = 'start' | 'end' | 'left' | 'right';\n\n/**\n * Why a {@link Drawer} asks to open or close: `trigger` (`Drawer.Trigger`), `close`\n * (`Drawer.Close`), `close-button` (the built-in Close button), `escape`, `outside-press` (the\n * backdrop). The shared `ModalOpenChangeReason`, as for Dialog.\n */\nexport type DrawerOpenChangeReason = ModalOpenChangeReason;\n\n/** The second argument of a {@link Drawer}'s `onOpenChange`: the reason and the DOM event. */\nexport type DrawerOpenChangeDetails = OpenChangeDetails<DrawerOpenChangeReason>;\n\n/** Properties for the Drawer component. */\nexport interface DrawerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n /**\n * Controlled open state of the drawer. The panel renders only in the browser: an open drawer\n * is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Default open state for uncontrolled usage. The panel renders only in the browser: a drawer\n * open by default is closed in the server HTML and opens once it has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Called with the new open state when it changes. `details.reason` tells how — `trigger`,\n * `close` (a `.Close` part), `close-button` (the built-in Close button), `escape` or\n * `outside-press` (the backdrop) — so a controlled drawer can refuse only some ways of closing\n * (for example keep a form with unsaved changes open on `outside-press`); `details.event` is the\n * DOM event behind the request. WaveUI always passes `details`; it is typed optional until 1.0\n * so that code which calls this prop itself keeps compiling.\n *\n * Fires only when the value changes; a controlled drawer stays as it is until the parent updates\n * `open`.\n */\n onOpenChange?: (open: boolean, details?: DrawerOpenChangeDetails) => void;\n /**\n * Side of the screen the drawer is attached to. `start`/`end` follow the text direction;\n * `left`/`right` are physical sides.\n * @default 'end'\n */\n position?: DrawerPosition;\n /**\n * Title displayed in the drawer header; it names the drawer (`aria-labelledby`). Without it,\n * render a `Drawer.Title` or pass `aria-label`/`aria-labelledby`. A title that renders nothing\n * (`''`, `[]`, `true`) counts as none.\n */\n title?: React.ReactNode;\n /**\n * Accessible name of the built-in Close button (an icon-only button). Localize it with the\n * page's language.\n * @default 'Close'\n */\n closeLabel?: string;\n /**\n * Where focus goes when the drawer closes, if it can take focus. Otherwise focus returns to the\n * element that had focus when the drawer opened, then to the trigger, then to an element next to\n * where that opener was.\n */\n finalFocusRef?: React.RefObject<HTMLElement | null>;\n /**\n * The drawer body. `Drawer.Trigger` children placed directly inside the Drawer, or in a Fragment\n * there (`{isMobile && <>…</>}`), render in place (outside the panel); everything else renders in\n * the panel's scrolling body. A `Drawer.Trigger` nested in another element, or rendered by a\n * component, is panel content, so it only exists while the drawer is open (development warnings\n * say so, also when an uncontrolled drawer still has no direct trigger a second after it mounts\n * and therefore cannot open; a controlled drawer whose trigger a component such as a Tooltip\n * wraps warns only once it opens).\n * Put wrappers inside the trigger instead: see `Drawer.Trigger`.\n */\n children: React.ReactNode;\n /** Ref to the drawer panel (`role=\"dialog\"`). */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Props a `Drawer.Trigger` puts on its element (and passes to a render-prop child). */\nexport interface DrawerTriggerRenderProps extends React.HTMLAttributes<HTMLElement> {\n 'aria-haspopup': 'dialog';\n 'aria-expanded': boolean;\n /** The panel's id, while the drawer is open. */\n 'aria-controls'?: string;\n onClick: React.MouseEventHandler<HTMLElement>;\n /** A callback ref, so the props spread onto any element type. */\n ref: React.RefCallback<HTMLElement>;\n}\n\n/** Properties for the DrawerTrigger sub-component. */\nexport interface DrawerTriggerProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * The element that opens the drawer. A single element receives the trigger props (merged with its\n * own); a function receives them.\n */\n children: React.ReactNode | ((props: DrawerTriggerRenderProps) => React.ReactNode);\n /**\n * `false` renders a wrapper `<span>` around the children instead of merging the trigger props\n * onto the child. The span carries the click handler; `aria-haspopup`, `aria-expanded` and\n * `aria-controls` go to the first element in the tab order inside it.\n * @default true\n */\n asChild?: boolean;\n /** Ref to the trigger element (the child, or the wrapper span). */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** Props a `Drawer.Close` puts on its element (and passes to a render-prop child). */\nexport interface DrawerCloseRenderProps extends React.HTMLAttributes<HTMLElement> {\n onClick: React.MouseEventHandler<HTMLElement>;\n /** A callback ref, so the props spread onto any element type. */\n ref: React.RefCallback<HTMLElement>;\n}\n\n/** Properties for the DrawerClose sub-component. */\nexport interface DrawerCloseProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * The element that closes the drawer. A single element receives an `onClick` composed with its own\n * (its handler runs first; `preventDefault()` keeps the drawer open); a function receives the\n * props.\n */\n children: React.ReactNode | ((props: DrawerCloseRenderProps) => React.ReactNode);\n /** `false` renders a wrapper `<span>` that closes the drawer on click. @default true */\n asChild?: boolean;\n /** Ref to the close element (the child, or the wrapper span). */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** Properties for the DrawerTitle sub-component. */\nexport interface DrawerTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n /** The title; any content. */\n children: React.ReactNode;\n /** Ref to the heading element. */\n ref?: React.Ref<HTMLHeadingElement>;\n}\n\ninterface DrawerContextValue {\n open: boolean;\n /** Asks the root to open or close, with the reason and event for `onOpenChange`. */\n requestOpen: ModalRequestOpen;\n /** The trigger element (`attach`) and the focus-restore target resolved from it (`focusRef`). */\n trigger: ModalTrigger;\n /** The panel's id (for the trigger's `aria-controls`). */\n panelId: string;\n /** `true` for sub-components rendered inside the panel (a `Drawer.Trigger` there is misplaced). */\n inPanel: boolean;\n}\n\nconst DrawerContext = React.createContext<DrawerContextValue | null>(null);\nDrawerContext.displayName = 'DrawerContext';\n\nconst inertDrawerContext: DrawerContextValue = {\n open: false,\n requestOpen: () => {},\n trigger: inertModalTrigger,\n panelId: '',\n inPanel: false,\n};\n\nfunction useDrawerContext(componentName: string): DrawerContextValue {\n return useRequiredContext(DrawerContext, componentName, 'Drawer', () => inertDrawerContext);\n}\n\n/**\n * The side the panel is pinned to, and a border on its inner edge (the one facing the page): it\n * marks the panel where the shadow cannot, in high contrast (page, backdrop and panel are black)\n * and in forced colors (which drop shadows).\n */\nconst positionClasses: Record<DrawerPosition, string> = {\n start: 'start-0 border-e',\n end: 'end-0 border-s',\n left: 'left-0 border-r', // wave-allow-physical: the consumer asked for the physical left edge\n right: 'right-0 border-l', // wave-allow-physical: the consumer asked for the physical right edge\n};\n\nconst NESTED_TRIGGER_WARNING_KEY = 'Drawer.Trigger:nested';\nconst NESTED_TRIGGER_WARNING =\n 'Drawer.Trigger must be a direct child of Drawer (a Fragment is fine). Inside another element or a component it is rendered as panel content, which exists only while the drawer is open, so it cannot open the drawer. Make it a direct child, put wrappers such as a Tooltip inside the trigger, or control the Drawer with `open`/`onOpenChange` and open it from your own button.';\n\nconst UNREACHABLE_WARNING_KEY = 'Drawer:unreachable';\nconst UNREACHABLE_WARNING =\n 'Drawer has no way to open: a second after mounting it is still uncontrolled (no `open` prop), closed, and has no Drawer.Trigger as a direct child (or in a Fragment there). A Drawer.Trigger rendered by a component or nested in an element is panel content, which exists only while the drawer is open. Make the trigger a direct child of Drawer, or control the Drawer with `open`/`onOpenChange`.';\n\n/**\n * How long after mount (ms) the development check for a drawer without a trigger waits: long\n * enough for a trigger that a conditional Fragment renders once the page knows its layout.\n */\nconst REACHABILITY_CHECK_DELAY = 1000;\n\n/**\n * Opens the drawer. Place it directly inside `Drawer`, or in a Fragment there (not inside a wrapper\n * element or a component of your own): it renders in place, not in the panel; a misplaced one warns\n * in development. A Drawer may have several triggers: focus returns to the one that opened it. Puts\n * `aria-haspopup=\"dialog\"`, `aria-expanded`, `aria-controls` (while open), a click handler and a\n * ref on its single child, or passes them to a render-prop child. A custom child component must\n * forward `ref` and spread its props; one that does not is wrapped in a `<span>` automatically\n * (with a development warning), the span that `asChild={false}` renders. Focus returns to the\n * trigger when the drawer closes. On the span, the state ARIA goes to the first element in the tab\n * order inside it, and focus returns to that element (to the span when you made it the trigger\n * with a `role` such as `button` and `tabIndex={0}`, or when nothing inside it can take focus).\n *\n * A Tooltip (or any other wrapper) goes inside the trigger, not around it. Use a render-prop child\n * so the trigger props land on the button and the Tooltip describes that same button:\n *\n * @example\n * <Drawer title=\"Filters\">\n * <Drawer.Trigger>\n * {(triggerProps) => (\n * <Tooltip content=\"Narrow the list\">\n * <Button {...triggerProps}>Filters</Button>\n * </Tooltip>\n * )}\n * </Drawer.Trigger>\n * <FilterForm />\n * </Drawer>\n */\nexport const DrawerTrigger = (props: DrawerTriggerProps) => {\n const { open, requestOpen, trigger, panelId, inPanel } = useDrawerContext('Drawer.Trigger');\n\n // Rendered inside its own drawer's panel (e.g. by a component): it only exists while open.\n React.useEffect(() => {\n if (inPanel) warnOnce(NESTED_TRIGGER_WARNING_KEY, NESTED_TRIGGER_WARNING);\n }, [inPanel]);\n\n return useModalTriggerPart<DrawerTriggerRenderProps>(\n { open, requestOpen, trigger, controlsId: panelId },\n props,\n 'Drawer.Trigger',\n );\n};\nDrawerTrigger.displayName = 'DrawerTrigger';\n\n/**\n * Closes the drawer: composes a click handler onto its single child (its own `onClick` runs first;\n * calling `preventDefault()` there keeps the drawer open), or passes it to a render-prop child.\n */\nexport const DrawerClose = (props: DrawerCloseProps) => {\n const { requestOpen } = useDrawerContext('Drawer.Close');\n return useModalClosePart<DrawerCloseRenderProps>(requestOpen, props, 'Drawer.Close');\n};\nDrawerClose.displayName = 'DrawerClose';\n\n/**\n * A heading that names the drawer (`aria-labelledby`), for rich titles or custom layouts. Render it\n * inside the Drawer's content (instead of the `title` prop).\n */\nexport const DrawerTitle = ({ id, className, children, ref, ...rest }: DrawerTitleProps) => {\n const { id: titleId, ref: titleRef } = useModalTitle('Drawer.Title', 'Drawer', id, ref);\n return (\n <h2\n {...rest}\n id={titleId}\n ref={titleRef}\n className={cn('text-subtitle-1 font-semibold text-foreground', className)}\n >\n {children}\n </h2>\n );\n};\nDrawerTitle.displayName = 'DrawerTitle';\n\n/** Deepest element level the development check for nested triggers looks at. */\nconst NESTED_TRIGGER_MAX_DEPTH = 32;\n\n/**\n * Development check: whether the Drawer's children hold a `Drawer.Trigger` inside a host element\n * (at any depth, also through Fragments), which would become panel content; a trigger inside\n * Fragments only is direct (see `splitChildren`). Walks the element tree the consumer wrote, not\n * rendered output, so it descends only into host elements (`<div>`, `<span>`, …) and Fragments,\n * which render their `children` as written. A component's\n * output is unknown here — a wrapper that renders its own Drawer around its children, for one —\n * so components are not walked; a trigger rendered by a component is caught when it renders in the\n * open panel, or, while the drawer cannot open, by the unreachable-drawer check.\n */\nfunction hasNestedTrigger(children: React.ReactNode): boolean {\n // `depth` counts host elements only: a Fragment adds no level, as `splitChildren` flattens it.\n const visit = (node: unknown, depth: number, level: number): boolean => {\n if (level > NESTED_TRIGGER_MAX_DEPTH || typeof node !== 'object' || node === null) return false;\n if (Array.isArray(node)) return node.some((item) => visit(item, depth, level));\n if (!React.isValidElement(node)) return false;\n // A part written in a Server Component has a lazy type. The walk runs in effects, outside\n // render: a lazy part that is still loading must not throw its thenable there, so it counts\n // as no trigger (`suspend: false` returns the lazy itself, which matches nothing).\n const type = getElementType(node, { suspend: false });\n if (type === DrawerTrigger) return depth > 0;\n const isFragment = type === React.Fragment;\n if (typeof type !== 'string' && !isFragment) return false;\n const { children: nested } = node.props as { children?: unknown };\n return visit(nested, isFragment ? depth : depth + 1, level + 1);\n };\n return visit(children, 0, 0);\n}\n\n/**\n * Splits the Drawer's children into its direct `Drawer.Trigger` elements and the panel content.\n * Fragments are flattened (recursively), so a `Drawer.Trigger` in a Fragment —\n * `{isMobile && <><Drawer.Trigger>…</Drawer.Trigger><Filters /></>}` — counts as a direct child.\n * Every element keeps the key `flattenChildren` gives it: unique across Fragments and stable when a\n * sibling Fragment toggles, so panel content keeps its state. A trigger is recognised also when it\n * was written in a Server Component (a lazy type).\n */\nfunction splitChildren(children: React.ReactNode): {\n triggers: React.ReactNode[];\n content: React.ReactNode[];\n} {\n const triggers: React.ReactNode[] = [];\n const content: React.ReactNode[] = [];\n for (const { key, node } of flattenChildren(children)) {\n const keyed = React.isValidElement(node) ? React.cloneElement(node, { key }) : node;\n if (isElementOfType(node, DrawerTrigger)) triggers.push(keyed);\n else content.push(keyed);\n }\n return { triggers, content };\n}\n\n// The root of `Drawer` (documented on the export below).\nconst DrawerRoot = ({\n open: openProp,\n defaultOpen,\n onOpenChange,\n position = 'end',\n title,\n closeLabel = 'Close',\n finalFocusRef,\n children,\n className,\n id,\n ref,\n ...rest\n}: DrawerProps) => {\n const [openState, requestOpen] = useModalOpenState(openProp, defaultOpen, onOpenChange);\n // The panel lives in a portal, which renders only in the browser: until then (the server HTML,\n // hydration) the drawer reports itself closed, so the trigger's aria-expanded and aria-controls\n // never describe a panel that is not there.\n const isClient = useIsClient();\n const open = openState && isClient;\n const trigger = useModalTrigger();\n const generatedId = useId('wave-drawer');\n const panelId = id ?? generatedId;\n const propTitleId = useId('wave-drawer-title');\n const titles = useTitleRegistry();\n\n const [panel, setPanel] = React.useState<HTMLDivElement | null>(null);\n const panelRef = React.useRef<HTMLDivElement | null>(null);\n const attachPanel = React.useCallback((node: HTMLDivElement | null) => {\n panelRef.current = node;\n setPanel(node);\n }, []);\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, attachPanel);\n\n // Every backdrop press asks the drawer to close.\n const backdropPress = useBackdropPress(panelRef, true);\n const onDismiss = useModalDismiss(requestOpen, 'Drawer', backdropPress.afterOutsidePress);\n const layer = useModalLayer({\n open,\n onDismiss,\n refs: [panelRef],\n container: panel,\n triggerRef: trigger.focusRef,\n finalFocusRef,\n });\n // After useModalLayer's focus restore (effects run in order), start the trigger session, or end\n // it and forget the trigger that opened it.\n useModalTriggerSession(trigger, open);\n useUnnamedModalWarning(open ? panel : null, titles.hasTitle, 'Drawer', 'Drawer.Title');\n\n const { triggers, content } = splitChildren(children);\n\n // A trigger nested in the children is panel content: never rendered while the drawer is closed.\n // The children change on every parent render; once this drawer has warned, it stops walking.\n const nestedWarnedRef = React.useRef(false);\n React.useEffect(() => {\n if (!isDev || nestedWarnedRef.current || !hasNestedTrigger(children)) return;\n nestedWarnedRef.current = true;\n warnOnce(NESTED_TRIGGER_WARNING_KEY, NESTED_TRIGGER_WARNING);\n }, [children]);\n\n // An uncontrolled closed drawer without a direct trigger cannot open (e.g.\n // `<Drawer><FilterTrigger /></Drawer>`, whose trigger is panel content). Checked once, a moment\n // after mount, against the latest render: a trigger that a conditional Fragment adds right after\n // mount (`{isMobile && <>…</>}` with an SSR-safe media query) counts. A trigger nested in an\n // element already has the more specific warning above.\n const unreachable = openProp === undefined && !defaultOpen && triggers.length === 0;\n const latestRef = React.useRef({ unreachable, children });\n React.useLayoutEffect(() => {\n latestRef.current = { unreachable, children };\n });\n React.useEffect(() => {\n if (!isDev || !latestRef.current.unreachable) return;\n const timer = setTimeout(() => {\n const latest = latestRef.current;\n if (latest.unreachable && !hasNestedTrigger(latest.children)) {\n warnOnce(UNREACHABLE_WARNING_KEY, UNREACHABLE_WARNING);\n }\n }, REACHABILITY_CHECK_DELAY);\n return () => clearTimeout(timer);\n }, []);\n\n const context = React.useMemo<DrawerContextValue>(\n () => ({ open, requestOpen, trigger, panelId, inPanel: false }),\n [open, requestOpen, trigger, panelId],\n );\n const panelContext = React.useMemo<DrawerContextValue>(\n () => ({ ...context, inPanel: true }),\n [context],\n );\n\n const hasTitle = slotRendersContent(title);\n\n return (\n <DrawerContext.Provider value={context}>\n {triggers}\n {open && (\n <Portal layerId={layer.layerId}>\n <div className=\"fixed inset-0 bg-backdrop\" onMouseDown={backdropPress.onMouseDown}>\n <div\n ref={mergedRef}\n role=\"dialog\"\n id={panelId}\n aria-labelledby={hasTitle ? propTitleId : titles.titleId}\n tabIndex={-1}\n {...rest}\n className={cn(\n 'fixed top-0 flex h-full w-80 max-w-full flex-col border-border bg-background text-foreground shadow-64',\n positionClasses[position],\n className,\n )}\n >\n <DrawerContext.Provider value={panelContext}>\n <ModalSurfaceContext.Provider value={titles.context}>\n <div className=\"flex items-center justify-between gap-2 border-b border-border p-4\">\n {hasTitle && (\n <h2 id={propTitleId} className=\"text-subtitle-1 font-semibold\">\n {title}\n </h2>\n )}\n <Button\n appearance=\"subtle\"\n size=\"small\"\n icon={<DismissIcon />}\n aria-label={closeLabel}\n onClick={(event) =>\n requestOpen(false, { reason: 'close-button', event: event.nativeEvent })\n }\n className=\"ms-auto text-muted-foreground\"\n />\n </div>\n <div className=\"min-h-0 flex-1 overflow-y-auto p-4\">{content}</div>\n </ModalSurfaceContext.Provider>\n </DrawerContext.Provider>\n </div>\n </div>\n </Portal>\n )}\n </DrawerContext.Provider>\n );\n};\nDrawerRoot.displayName = 'Drawer';\n\n/**\n * A modal panel attached to a side of the screen (Fluent UI v2 style), rendered in a portal\n * (inheriting the WaveProvider theme) while open.\n *\n * - **Opening**: controlled (`open`), or uncontrolled with a `Drawer.Trigger` placed directly inside\n * the Drawer or in a Fragment there (it renders in place, outside the panel).\n * - **Modal**: focus moves into the panel and Tab stays inside it (toasts included), the rest of the\n * page is `inert` (instead of `aria-modal`), and the page does not scroll.\n * - **Closing**: Escape (only the topmost layer: a popup opened inside closes first), a click on the\n * backdrop (a drag that starts inside does not close it), the Close button and `Drawer.Close`.\n * `onOpenChange` gets the reason as its second argument (`details.reason`), so a controlled\n * drawer can refuse some of them. A backdrop press blurs the focused field before the drawer\n * closes, so a typed value is committed as with the Close button; when a controlled drawer\n * refuses the press, the field gets focus back. Focus returns to the first of these that can\n * take focus: `finalFocusRef`, the element that had focus when the drawer opened, the trigger,\n * an element next to where that opener was.\n * - **Position**: `end` (default) and `start` follow the text direction.\n *\n * The sub-components are also exported under flat names (`DrawerTrigger`, `DrawerClose`,\n * `DrawerTitle`) for React Server Components, which cannot use the dotted form; dotted access\n * (`Drawer.Trigger`) needs a client file.\n *\n * @example\n * <Drawer title=\"Filters\">\n * <Drawer.Trigger><Button>Filters</Button></Drawer.Trigger>\n * <FilterForm />\n * <Drawer.Close><Button appearance=\"primary\">Apply</Button></Drawer.Close>\n * </Drawer>\n */\nexport const Drawer = /* @__PURE__ */ Object.assign(DrawerRoot, {\n Trigger: DrawerTrigger,\n Close: DrawerClose,\n Title: DrawerTitle,\n});\n"],"mappings":"2jBAqLA,IAAMwC,EAAgBxC,EAAM,cAAyC,IAAI,EACzE,EAAc,YAAc,gBAE5B,IAAMyC,EAAyC,CAC7C,KAAM,GACN,gBAAmB,CAAC,EACpB,QAASxC,EAAAA,kBACT,QAAS,GACT,QAAS,EACX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,GAAO,CAAE,OAAQ,eAAgB,MAAOqD,EAAM,WAAY,CAAC,EAEzE,UAAU,+BACX,CAAA,CACE,CACL,CAAA,GAAA,EAAArE,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,qCAAsC,SAAAqC,EAAa,CAAA,CACtC,GACR,CAAA,CACrB,CAAA,CACF,CAAA,CACC,CAAA,CAEY,GAE5B,EACA,EAAW,YAAc,SA+BzB,IAAaiC,EAAyB,OAAO,OAAO/B,EAAY,CAC9D,QAAS5B,EACT,MAAOI,EACP,MAAOE,CACT,CAAC"}
|
|
1
|
+
{"version":3,"file":"Drawer.cjs","names":["React","inertModalTrigger","useRequiredContext","useModalTriggerPart","useModalClosePart","useModalTitle","cn","drawerTitleClassNames","getElementType","flattenChildren","isElementOfType","useModalOpenState","useIsClient","useModalTrigger","useId","useTitleRegistry","useMergedRefs","useBackdropPress","useModalDismiss","useModalLayer","isDev","slotRendersContent","Portal","drawerClassNames","ModalSurfaceContext","Button","DismissIcon","require_runtime","require_cn","require_children","require_dev","require_slot","require_classNames","require_useId","require_useMergedRefs","require_useIsClient","require_Portal","require_Button","require_icons","require_useModalLayer","require_Dialog_shared","react","react_jsx_runtime","DrawerContext","inertDrawerContext","useDrawerContext","componentName","positionClasses","NESTED_TRIGGER_WARNING_KEY","NESTED_TRIGGER_WARNING","UNREACHABLE_WARNING_KEY","UNREACHABLE_WARNING","REACHABILITY_CHECK_DELAY","DrawerTrigger","inPanel","panelId","props","DrawerClose","requestOpen","DrawerTitle","rest","titleId","titleRef","id","ref","className","NESTED_TRIGGER_MAX_DEPTH","hasNestedTrigger","visit","level","node","item","depth","type","isFragment","nested","children","splitChildren","triggers","content","keyed","DrawerRoot","openProp","openState","defaultOpen","onOpenChange","isClient","open","trigger","generatedId","propTitleId","titles","panel","setPanel","panelRef","attachPanel","mergedRef","backdropPress","onDismiss","layer","nestedWarnedRef","unreachable","latestRef","timer","latest","context","panelContext","hasTitle","title","position","closeLabel","event","Drawer"],"sources":["../../../src/components/overlays/Drawer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, getElementType, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { drawerClassNames, drawerTitleClassNames } from '../../lib/classNames';\nimport { isDev, warnOnce } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport { slotRendersContent } from '../../lib/slot';\nimport type { ModalOpenChangeReason, OpenChangeDetails } from '../../lib/types';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useModalLayer } from '../../hooks/useModalLayer';\nimport { Button } from '../button/Button';\nimport { Portal } from '../portal/Portal';\nimport {\n inertModalTrigger,\n ModalSurfaceContext,\n useBackdropPress,\n useModalClosePart,\n useModalDismiss,\n useModalOpenState,\n useModalTitle,\n useModalTrigger,\n useModalTriggerPart,\n useModalTriggerSession,\n useRequiredContext,\n useTitleRegistry,\n useUnnamedModalWarning,\n type ModalRequestOpen,\n type ModalTrigger,\n} from './Dialog.shared';\n\n/**\n * Side of the screen the drawer is attached to. `start`/`end` follow the text direction (in a\n * right-to-left layout `end` is the left edge); `left`/`right` are physical sides.\n */\nexport type DrawerPosition = 'start' | 'end' | 'left' | 'right';\n\n/**\n * Why a {@link Drawer} asks to open or close: `trigger` (`Drawer.Trigger`), `close`\n * (`Drawer.Close`), `close-button` (the built-in Close button), `escape`, `outside-press` (the\n * backdrop). The shared `ModalOpenChangeReason`, as for Dialog.\n */\nexport type DrawerOpenChangeReason = ModalOpenChangeReason;\n\n/** The second argument of a {@link Drawer}'s `onOpenChange`: the reason and the DOM event. */\nexport type DrawerOpenChangeDetails = OpenChangeDetails<DrawerOpenChangeReason>;\n\n/** Properties for the Drawer component. */\nexport interface DrawerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n /**\n * Controlled open state of the drawer. The panel renders only in the browser: an open drawer\n * is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Default open state for uncontrolled usage. The panel renders only in the browser: a drawer\n * open by default is closed in the server HTML and opens once it has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Called with the new open state when it changes. `details.reason` tells how — `trigger`,\n * `close` (a `.Close` part), `close-button` (the built-in Close button), `escape` or\n * `outside-press` (the backdrop) — so a controlled drawer can refuse only some ways of closing\n * (for example keep a form with unsaved changes open on `outside-press`); `details.event` is the\n * DOM event behind the request. WaveUI always passes `details`; it is typed optional until 1.0\n * so that code which calls this prop itself keeps compiling.\n *\n * Fires only when the value changes; a controlled drawer stays as it is until the parent updates\n * `open`.\n */\n onOpenChange?: (open: boolean, details?: DrawerOpenChangeDetails) => void;\n /**\n * Side of the screen the drawer is attached to. `start`/`end` follow the text direction;\n * `left`/`right` are physical sides.\n * @default 'end'\n */\n position?: DrawerPosition;\n /**\n * Title displayed in the drawer header; it names the drawer (`aria-labelledby`). Without it,\n * render a `Drawer.Title` or pass `aria-label`/`aria-labelledby`. A title that renders nothing\n * (`''`, `[]`, `true`) counts as none.\n */\n title?: React.ReactNode;\n /**\n * Accessible name of the built-in Close button (an icon-only button). Localize it with the\n * page's language.\n * @default 'Close'\n */\n closeLabel?: string;\n /**\n * Where focus goes when the drawer closes, if it can take focus. Otherwise focus returns to the\n * element that had focus when the drawer opened, then to the trigger, then to an element next to\n * where that opener was.\n */\n finalFocusRef?: React.RefObject<HTMLElement | null>;\n /**\n * The drawer body. `Drawer.Trigger` children placed directly inside the Drawer, or in a Fragment\n * there (`{isMobile && <>…</>}`), render in place (outside the panel); everything else renders in\n * the panel's scrolling body. A `Drawer.Trigger` nested in another element, or rendered by a\n * component, is panel content, so it only exists while the drawer is open (development warnings\n * say so, also when an uncontrolled drawer still has no direct trigger a second after it mounts\n * and therefore cannot open; a controlled drawer whose trigger a component such as a Tooltip\n * wraps warns only once it opens).\n * Put wrappers inside the trigger instead: see `Drawer.Trigger`.\n */\n children: React.ReactNode;\n /** Ref to the drawer panel (`role=\"dialog\"`). */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Props a `Drawer.Trigger` puts on its element (and passes to a render-prop child). */\nexport interface DrawerTriggerRenderProps extends React.HTMLAttributes<HTMLElement> {\n 'aria-haspopup': 'dialog';\n 'aria-expanded': boolean;\n /** The panel's id, while the drawer is open. */\n 'aria-controls'?: string;\n onClick: React.MouseEventHandler<HTMLElement>;\n /** A callback ref, so the props spread onto any element type. */\n ref: React.RefCallback<HTMLElement>;\n}\n\n/** Properties for the DrawerTrigger sub-component. */\nexport interface DrawerTriggerProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * The element that opens the drawer. A single element receives the trigger props (merged with its\n * own); a function receives them.\n */\n children: React.ReactNode | ((props: DrawerTriggerRenderProps) => React.ReactNode);\n /**\n * `false` renders a wrapper `<span>` around the children instead of merging the trigger props\n * onto the child. The span carries the click handler; `aria-haspopup`, `aria-expanded` and\n * `aria-controls` go to the first element in the tab order inside it.\n * @default true\n */\n asChild?: boolean;\n /** Ref to the trigger element (the child, or the wrapper span). */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** Props a `Drawer.Close` puts on its element (and passes to a render-prop child). */\nexport interface DrawerCloseRenderProps extends React.HTMLAttributes<HTMLElement> {\n onClick: React.MouseEventHandler<HTMLElement>;\n /** A callback ref, so the props spread onto any element type. */\n ref: React.RefCallback<HTMLElement>;\n}\n\n/** Properties for the DrawerClose sub-component. */\nexport interface DrawerCloseProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * The element that closes the drawer. A single element receives an `onClick` composed with its own\n * (its handler runs first; `preventDefault()` keeps the drawer open); a function receives the\n * props.\n */\n children: React.ReactNode | ((props: DrawerCloseRenderProps) => React.ReactNode);\n /** `false` renders a wrapper `<span>` that closes the drawer on click. @default true */\n asChild?: boolean;\n /** Ref to the close element (the child, or the wrapper span). */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** Properties for the DrawerTitle sub-component. */\nexport interface DrawerTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n /** The title; any content. */\n children: React.ReactNode;\n /** Ref to the heading element. */\n ref?: React.Ref<HTMLHeadingElement>;\n}\n\ninterface DrawerContextValue {\n open: boolean;\n /** Asks the root to open or close, with the reason and event for `onOpenChange`. */\n requestOpen: ModalRequestOpen;\n /** The trigger element (`attach`) and the focus-restore target resolved from it (`focusRef`). */\n trigger: ModalTrigger;\n /** The panel's id (for the trigger's `aria-controls`). */\n panelId: string;\n /** `true` for sub-components rendered inside the panel (a `Drawer.Trigger` there is misplaced). */\n inPanel: boolean;\n}\n\nconst DrawerContext = React.createContext<DrawerContextValue | null>(null);\nDrawerContext.displayName = 'DrawerContext';\n\nconst inertDrawerContext: DrawerContextValue = {\n open: false,\n requestOpen: () => {},\n trigger: inertModalTrigger,\n panelId: '',\n inPanel: false,\n};\n\nfunction useDrawerContext(componentName: string): DrawerContextValue {\n return useRequiredContext(DrawerContext, componentName, 'Drawer', () => inertDrawerContext);\n}\n\n/**\n * The side the panel is pinned to, and a border on its inner edge (the one facing the page): it\n * marks the panel where the shadow cannot, in high contrast (page, backdrop and panel are black)\n * and in forced colors (which drop shadows).\n */\nconst positionClasses: Record<DrawerPosition, string> = {\n start: 'start-0 border-e',\n end: 'end-0 border-s',\n left: 'left-0 border-r', // wave-allow-physical: the consumer asked for the physical left edge\n right: 'right-0 border-l', // wave-allow-physical: the consumer asked for the physical right edge\n};\n\nconst NESTED_TRIGGER_WARNING_KEY = 'Drawer.Trigger:nested';\nconst NESTED_TRIGGER_WARNING =\n 'Drawer.Trigger must be a direct child of Drawer (a Fragment is fine). Inside another element or a component it is rendered as panel content, which exists only while the drawer is open, so it cannot open the drawer. Make it a direct child, put wrappers such as a Tooltip inside the trigger, or control the Drawer with `open`/`onOpenChange` and open it from your own button.';\n\nconst UNREACHABLE_WARNING_KEY = 'Drawer:unreachable';\nconst UNREACHABLE_WARNING =\n 'Drawer has no way to open: a second after mounting it is still uncontrolled (no `open` prop), closed, and has no Drawer.Trigger as a direct child (or in a Fragment there). A Drawer.Trigger rendered by a component or nested in an element is panel content, which exists only while the drawer is open. Make the trigger a direct child of Drawer, or control the Drawer with `open`/`onOpenChange`.';\n\n/**\n * How long after mount (ms) the development check for a drawer without a trigger waits: long\n * enough for a trigger that a conditional Fragment renders once the page knows its layout.\n */\nconst REACHABILITY_CHECK_DELAY = 1000;\n\n/**\n * Opens the drawer. Place it directly inside `Drawer`, or in a Fragment there (not inside a wrapper\n * element or a component of your own): it renders in place, not in the panel; a misplaced one warns\n * in development. A Drawer may have several triggers: focus returns to the one that opened it. Puts\n * `aria-haspopup=\"dialog\"`, `aria-expanded`, `aria-controls` (while open), a click handler and a\n * ref on its single child, or passes them to a render-prop child. A custom child component must\n * forward `ref` and spread its props; one that does not is wrapped in a `<span>` automatically\n * (with a development warning), the span that `asChild={false}` renders. Focus returns to the\n * trigger when the drawer closes. On the span, the state ARIA goes to the first element in the tab\n * order inside it, and focus returns to that element (to the span when you made it the trigger\n * with a `role` such as `button` and `tabIndex={0}`, or when nothing inside it can take focus).\n *\n * A Tooltip (or any other wrapper) goes inside the trigger, not around it. Use a render-prop child\n * so the trigger props land on the button and the Tooltip describes that same button:\n *\n * @example\n * <Drawer title=\"Filters\">\n * <Drawer.Trigger>\n * {(triggerProps) => (\n * <Tooltip content=\"Narrow the list\">\n * <Button {...triggerProps}>Filters</Button>\n * </Tooltip>\n * )}\n * </Drawer.Trigger>\n * <FilterForm />\n * </Drawer>\n */\nexport const DrawerTrigger = (props: DrawerTriggerProps) => {\n const { open, requestOpen, trigger, panelId, inPanel } = useDrawerContext('Drawer.Trigger');\n\n // Rendered inside its own drawer's panel (e.g. by a component): it only exists while open.\n React.useEffect(() => {\n if (inPanel) warnOnce(NESTED_TRIGGER_WARNING_KEY, NESTED_TRIGGER_WARNING);\n }, [inPanel]);\n\n return useModalTriggerPart<DrawerTriggerRenderProps>(\n { open, requestOpen, trigger, controlsId: panelId },\n props,\n 'Drawer.Trigger',\n );\n};\nDrawerTrigger.displayName = 'DrawerTrigger';\n\n/**\n * Closes the drawer: composes a click handler onto its single child (its own `onClick` runs first;\n * calling `preventDefault()` there keeps the drawer open), or passes it to a render-prop child.\n */\nexport const DrawerClose = (props: DrawerCloseProps) => {\n const { requestOpen } = useDrawerContext('Drawer.Close');\n return useModalClosePart<DrawerCloseRenderProps>(requestOpen, props, 'Drawer.Close');\n};\nDrawerClose.displayName = 'DrawerClose';\n\n/**\n * A heading that names the drawer (`aria-labelledby`), for rich titles or custom layouts. Render it\n * inside the Drawer's content (instead of the `title` prop).\n */\nexport const DrawerTitle = ({ id, className, children, ref, ...rest }: DrawerTitleProps) => {\n const { id: titleId, ref: titleRef } = useModalTitle('Drawer.Title', 'Drawer', id, ref);\n return (\n <h2\n {...rest}\n id={titleId}\n ref={titleRef}\n className={cn(\n drawerTitleClassNames.root,\n 'text-subtitle-1 font-semibold text-foreground',\n className,\n )}\n >\n {children}\n </h2>\n );\n};\nDrawerTitle.displayName = 'DrawerTitle';\n\n/** Deepest element level the development check for nested triggers looks at. */\nconst NESTED_TRIGGER_MAX_DEPTH = 32;\n\n/**\n * Development check: whether the Drawer's children hold a `Drawer.Trigger` inside a host element\n * (at any depth, also through Fragments), which would become panel content; a trigger inside\n * Fragments only is direct (see `splitChildren`). Walks the element tree the consumer wrote, not\n * rendered output, so it descends only into host elements (`<div>`, `<span>`, …) and Fragments,\n * which render their `children` as written. A component's\n * output is unknown here — a wrapper that renders its own Drawer around its children, for one —\n * so components are not walked; a trigger rendered by a component is caught when it renders in the\n * open panel, or, while the drawer cannot open, by the unreachable-drawer check.\n */\nfunction hasNestedTrigger(children: React.ReactNode): boolean {\n // `depth` counts host elements only: a Fragment adds no level, as `splitChildren` flattens it.\n const visit = (node: unknown, depth: number, level: number): boolean => {\n if (level > NESTED_TRIGGER_MAX_DEPTH || typeof node !== 'object' || node === null) return false;\n if (Array.isArray(node)) return node.some((item) => visit(item, depth, level));\n if (!React.isValidElement(node)) return false;\n // A part written in a Server Component has a lazy type. The walk runs in effects, outside\n // render: a lazy part that is still loading must not throw its thenable there, so it counts\n // as no trigger (`suspend: false` returns the lazy itself, which matches nothing).\n const type = getElementType(node, { suspend: false });\n if (type === DrawerTrigger) return depth > 0;\n const isFragment = type === React.Fragment;\n if (typeof type !== 'string' && !isFragment) return false;\n const { children: nested } = node.props as { children?: unknown };\n return visit(nested, isFragment ? depth : depth + 1, level + 1);\n };\n return visit(children, 0, 0);\n}\n\n/**\n * Splits the Drawer's children into its direct `Drawer.Trigger` elements and the panel content.\n * Fragments are flattened (recursively), so a `Drawer.Trigger` in a Fragment —\n * `{isMobile && <><Drawer.Trigger>…</Drawer.Trigger><Filters /></>}` — counts as a direct child.\n * Every element keeps the key `flattenChildren` gives it: unique across Fragments and stable when a\n * sibling Fragment toggles, so panel content keeps its state. A trigger is recognised also when it\n * was written in a Server Component (a lazy type).\n */\nfunction splitChildren(children: React.ReactNode): {\n triggers: React.ReactNode[];\n content: React.ReactNode[];\n} {\n const triggers: React.ReactNode[] = [];\n const content: React.ReactNode[] = [];\n for (const { key, node } of flattenChildren(children)) {\n const keyed = React.isValidElement(node) ? React.cloneElement(node, { key }) : node;\n if (isElementOfType(node, DrawerTrigger)) triggers.push(keyed);\n else content.push(keyed);\n }\n return { triggers, content };\n}\n\n// The root of `Drawer` (documented on the export below).\nconst DrawerRoot = ({\n open: openProp,\n defaultOpen,\n onOpenChange,\n position = 'end',\n title,\n closeLabel = 'Close',\n finalFocusRef,\n children,\n className,\n id,\n ref,\n ...rest\n}: DrawerProps) => {\n const [openState, requestOpen] = useModalOpenState(openProp, defaultOpen, onOpenChange);\n // The panel lives in a portal, which renders only in the browser: until then (the server HTML,\n // hydration) the drawer reports itself closed, so the trigger's aria-expanded and aria-controls\n // never describe a panel that is not there.\n const isClient = useIsClient();\n const open = openState && isClient;\n const trigger = useModalTrigger();\n const generatedId = useId('wave-drawer');\n const panelId = id ?? generatedId;\n const propTitleId = useId('wave-drawer-title');\n const titles = useTitleRegistry();\n\n const [panel, setPanel] = React.useState<HTMLDivElement | null>(null);\n const panelRef = React.useRef<HTMLDivElement | null>(null);\n const attachPanel = React.useCallback((node: HTMLDivElement | null) => {\n panelRef.current = node;\n setPanel(node);\n }, []);\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, attachPanel);\n\n // Every backdrop press asks the drawer to close.\n const backdropPress = useBackdropPress(panelRef, true);\n const onDismiss = useModalDismiss(requestOpen, 'Drawer', backdropPress.afterOutsidePress);\n const layer = useModalLayer({\n open,\n onDismiss,\n refs: [panelRef],\n container: panel,\n triggerRef: trigger.focusRef,\n finalFocusRef,\n });\n // After useModalLayer's focus restore (effects run in order), start the trigger session, or end\n // it and forget the trigger that opened it.\n useModalTriggerSession(trigger, open);\n useUnnamedModalWarning(open ? panel : null, titles.hasTitle, 'Drawer', 'Drawer.Title');\n\n const { triggers, content } = splitChildren(children);\n\n // A trigger nested in the children is panel content: never rendered while the drawer is closed.\n // The children change on every parent render; once this drawer has warned, it stops walking.\n const nestedWarnedRef = React.useRef(false);\n React.useEffect(() => {\n if (!isDev || nestedWarnedRef.current || !hasNestedTrigger(children)) return;\n nestedWarnedRef.current = true;\n warnOnce(NESTED_TRIGGER_WARNING_KEY, NESTED_TRIGGER_WARNING);\n }, [children]);\n\n // An uncontrolled closed drawer without a direct trigger cannot open (e.g.\n // `<Drawer><FilterTrigger /></Drawer>`, whose trigger is panel content). Checked once, a moment\n // after mount, against the latest render: a trigger that a conditional Fragment adds right after\n // mount (`{isMobile && <>…</>}` with an SSR-safe media query) counts. A trigger nested in an\n // element already has the more specific warning above.\n const unreachable = openProp === undefined && !defaultOpen && triggers.length === 0;\n const latestRef = React.useRef({ unreachable, children });\n React.useLayoutEffect(() => {\n latestRef.current = { unreachable, children };\n });\n React.useEffect(() => {\n if (!isDev || !latestRef.current.unreachable) return;\n const timer = setTimeout(() => {\n const latest = latestRef.current;\n if (latest.unreachable && !hasNestedTrigger(latest.children)) {\n warnOnce(UNREACHABLE_WARNING_KEY, UNREACHABLE_WARNING);\n }\n }, REACHABILITY_CHECK_DELAY);\n return () => clearTimeout(timer);\n }, []);\n\n const context = React.useMemo<DrawerContextValue>(\n () => ({ open, requestOpen, trigger, panelId, inPanel: false }),\n [open, requestOpen, trigger, panelId],\n );\n const panelContext = React.useMemo<DrawerContextValue>(\n () => ({ ...context, inPanel: true }),\n [context],\n );\n\n const hasTitle = slotRendersContent(title);\n\n return (\n <DrawerContext.Provider value={context}>\n {triggers}\n {open && (\n <Portal layerId={layer.layerId}>\n <div\n className={cn(drawerClassNames.backdrop, 'fixed inset-0 bg-backdrop')}\n onMouseDown={backdropPress.onMouseDown}\n >\n <div\n ref={mergedRef}\n role=\"dialog\"\n id={panelId}\n aria-labelledby={hasTitle ? propTitleId : titles.titleId}\n tabIndex={-1}\n {...rest}\n className={cn(\n drawerClassNames.root,\n 'fixed top-0 flex h-full w-80 max-w-full flex-col border-border bg-background text-foreground shadow-64',\n positionClasses[position],\n className,\n )}\n >\n <DrawerContext.Provider value={panelContext}>\n <ModalSurfaceContext.Provider value={titles.context}>\n <div\n className={cn(\n drawerClassNames.header,\n 'flex items-center justify-between gap-2 border-b border-border p-4',\n )}\n >\n {hasTitle && (\n <h2\n id={propTitleId}\n className={cn(drawerTitleClassNames.root, 'text-subtitle-1 font-semibold')}\n >\n {title}\n </h2>\n )}\n <Button\n appearance=\"subtle\"\n size=\"small\"\n icon={<DismissIcon />}\n aria-label={closeLabel}\n onClick={(event) =>\n requestOpen(false, { reason: 'close-button', event: event.nativeEvent })\n }\n className={cn(drawerClassNames.closeButton, 'ms-auto text-muted-foreground')}\n />\n </div>\n <div className={cn(drawerClassNames.body, 'min-h-0 flex-1 overflow-y-auto p-4')}>\n {content}\n </div>\n </ModalSurfaceContext.Provider>\n </DrawerContext.Provider>\n </div>\n </div>\n </Portal>\n )}\n </DrawerContext.Provider>\n );\n};\nDrawerRoot.displayName = 'Drawer';\n\n/**\n * A modal panel attached to a side of the screen (Fluent UI v2 style), rendered in a portal\n * (inheriting the WaveProvider theme) while open.\n *\n * - **Opening**: controlled (`open`), or uncontrolled with a `Drawer.Trigger` placed directly inside\n * the Drawer or in a Fragment there (it renders in place, outside the panel).\n * - **Modal**: focus moves into the panel and Tab stays inside it (toasts included), the rest of the\n * page is `inert` (instead of `aria-modal`), and the page does not scroll.\n * - **Closing**: Escape (only the topmost layer: a popup opened inside closes first), a click on the\n * backdrop (a drag that starts inside does not close it), the Close button and `Drawer.Close`.\n * `onOpenChange` gets the reason as its second argument (`details.reason`), so a controlled\n * drawer can refuse some of them. A backdrop press blurs the focused field before the drawer\n * closes, so a typed value is committed as with the Close button; when a controlled drawer\n * refuses the press, the field gets focus back. Focus returns to the first of these that can\n * take focus: `finalFocusRef`, the element that had focus when the drawer opened, the trigger,\n * an element next to where that opener was.\n * - **Position**: `end` (default) and `start` follow the text direction.\n *\n * The sub-components are also exported under flat names (`DrawerTrigger`, `DrawerClose`,\n * `DrawerTitle`) for React Server Components, which cannot use the dotted form; dotted access\n * (`Drawer.Trigger`) needs a client file.\n *\n * @example\n * <Drawer title=\"Filters\">\n * <Drawer.Trigger><Button>Filters</Button></Drawer.Trigger>\n * <FilterForm />\n * <Drawer.Close><Button appearance=\"primary\">Apply</Button></Drawer.Close>\n * </Drawer>\n */\nexport const Drawer = /* @__PURE__ */ Object.assign(DrawerRoot, {\n Trigger: DrawerTrigger,\n Close: DrawerClose,\n Title: DrawerTitle,\n});\n"],"mappings":"kmBAsLA,IAAM2C,EAAgB3C,EAAM,cAAyC,IAAI,EACzE,EAAc,YAAc,gBAE5B,IAAM4C,EAAyC,CAC7C,KAAM,GACN,gBAAmB,CAAC,EACpB,QAAS3C,EAAAA,kBACT,QAAS,GACT,QAAS,EACX,EAEA,SAAS4C,EAAiB,EAA2C,CACnE,OAAO3C,EAAAA,mBAAmByC,EAAeG,EAAe,aAAgBF,CAAkB,CAC5F,CAOA,IAAMG,EAAkD,CACtD,MAAO,mBACP,IAAK,iBACL,KAAM,kBACN,MA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AU,GACRpD,EAAY,GAAO,CAAE,OAAQ,eAAgB,MAAOqD,EAAM,WAAY,CAAC,EAEzE,UAAWzG,EAAAA,GAAGiB,EAAAA,iBAAiB,YAAa,+BAA+B,CAC5E,CAAA,CACE,CACL,CAAA,GAAA,EAAAmB,EAAA,IAAA,CAAC,MAAD,CAAK,UAAWpC,EAAAA,GAAGiB,EAAAA,iBAAiB,KAAM,oCAAoC,EAC3E,SAAAwD,CACE,CAAA,CACuB,GACR,CAAA,CACrB,CAAA,CACF,CAAA,CACC,CAAA,CAEY,GAE5B,EACA,EAAW,YAAc,SA+BzB,IAAaiC,EAAyB,OAAO,OAAO/B,EAAY,CAC9D,QAAS5B,EACT,MAAOI,EACP,MAAOE,CACT,CAAC"}
|
|
@@ -3,175 +3,176 @@ import { cn as e } from "../../lib/cn.mjs";
|
|
|
3
3
|
import { flattenChildren as t, getElementType as n, isElementOfType as r } from "../../lib/children.mjs";
|
|
4
4
|
import { isDev as i, warnOnce as a } from "../../lib/dev.mjs";
|
|
5
5
|
import { slotRendersContent as o } from "../../lib/slot.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
6
|
+
import { drawerClassNames as s, drawerTitleClassNames as c } from "../../lib/classNames.mjs";
|
|
7
|
+
import { useId as l } from "../../hooks/useId.mjs";
|
|
8
|
+
import { useMergedRefs as u } from "../../hooks/useMergedRefs.mjs";
|
|
9
|
+
import { useIsClient as ee } from "../../hooks/useIsClient.mjs";
|
|
10
|
+
import { Portal as d } from "../portal/Portal.mjs";
|
|
11
|
+
import { Button as te } from "../button/Button.mjs";
|
|
12
|
+
import { DismissIcon as f } from "../../lib/icons.mjs";
|
|
13
|
+
import { useModalLayer as p } from "../../hooks/useModalLayer.mjs";
|
|
14
|
+
import { ModalSurfaceContext as ne, inertModalTrigger as m, useBackdropPress as re, useModalClosePart as h, useModalDismiss as g, useModalOpenState as _, useModalTitle as v, useModalTrigger as y, useModalTriggerPart as b, useModalTriggerSession as ie, useRequiredContext as x, useTitleRegistry as ae, useUnnamedModalWarning as S } from "./Dialog.shared.mjs";
|
|
15
|
+
import * as C from "react";
|
|
16
|
+
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
16
17
|
//#region src/components/overlays/Drawer.tsx
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
var
|
|
18
|
+
var E = C.createContext(null);
|
|
19
|
+
E.displayName = "DrawerContext";
|
|
20
|
+
var D = {
|
|
20
21
|
open: !1,
|
|
21
22
|
requestOpen: () => {},
|
|
22
|
-
trigger:
|
|
23
|
+
trigger: m,
|
|
23
24
|
panelId: "",
|
|
24
25
|
inPanel: !1
|
|
25
26
|
};
|
|
26
|
-
function
|
|
27
|
-
return
|
|
27
|
+
function O(e) {
|
|
28
|
+
return x(E, e, "Drawer", () => D);
|
|
28
29
|
}
|
|
29
|
-
var
|
|
30
|
+
var k = {
|
|
30
31
|
start: "start-0 border-e",
|
|
31
32
|
end: "end-0 border-s",
|
|
32
33
|
left: "left-0 border-r",
|
|
33
34
|
right: "right-0 border-l"
|
|
34
|
-
},
|
|
35
|
-
let { open: t, requestOpen: n, trigger: r, panelId: i, inPanel: o } =
|
|
36
|
-
return
|
|
37
|
-
o && a(
|
|
38
|
-
}, [o]),
|
|
35
|
+
}, A = "Drawer.Trigger:nested", j = "Drawer.Trigger must be a direct child of Drawer (a Fragment is fine). Inside another element or a component it is rendered as panel content, which exists only while the drawer is open, so it cannot open the drawer. Make it a direct child, put wrappers such as a Tooltip inside the trigger, or control the Drawer with `open`/`onOpenChange` and open it from your own button.", oe = "Drawer:unreachable", se = "Drawer has no way to open: a second after mounting it is still uncontrolled (no `open` prop), closed, and has no Drawer.Trigger as a direct child (or in a Fragment there). A Drawer.Trigger rendered by a component or nested in an element is panel content, which exists only while the drawer is open. Make the trigger a direct child of Drawer, or control the Drawer with `open`/`onOpenChange`.", ce = 1e3, M = (e) => {
|
|
36
|
+
let { open: t, requestOpen: n, trigger: r, panelId: i, inPanel: o } = O("Drawer.Trigger");
|
|
37
|
+
return C.useEffect(() => {
|
|
38
|
+
o && a(A, j);
|
|
39
|
+
}, [o]), b({
|
|
39
40
|
open: t,
|
|
40
41
|
requestOpen: n,
|
|
41
42
|
trigger: r,
|
|
42
43
|
controlsId: i
|
|
43
44
|
}, e, "Drawer.Trigger");
|
|
44
45
|
};
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
let { requestOpen: t } =
|
|
48
|
-
return
|
|
46
|
+
M.displayName = "DrawerTrigger";
|
|
47
|
+
var N = (e) => {
|
|
48
|
+
let { requestOpen: t } = O("Drawer.Close");
|
|
49
|
+
return h(t, e, "Drawer.Close");
|
|
49
50
|
};
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
let { id: o, ref: s } =
|
|
53
|
-
return /* @__PURE__ */
|
|
51
|
+
N.displayName = "DrawerClose";
|
|
52
|
+
var P = ({ id: t, className: n, children: r, ref: i, ...a }) => {
|
|
53
|
+
let { id: o, ref: s } = v("Drawer.Title", "Drawer", t, i);
|
|
54
|
+
return /* @__PURE__ */ w("h2", {
|
|
54
55
|
...a,
|
|
55
56
|
id: o,
|
|
56
57
|
ref: s,
|
|
57
|
-
className: e("text-subtitle-1 font-semibold text-foreground", n),
|
|
58
|
+
className: e(c.root, "text-subtitle-1 font-semibold text-foreground", n),
|
|
58
59
|
children: r
|
|
59
60
|
});
|
|
60
61
|
};
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
function
|
|
62
|
+
P.displayName = "DrawerTitle";
|
|
63
|
+
var F = 32;
|
|
64
|
+
function I(e) {
|
|
64
65
|
let t = (e, r, i) => {
|
|
65
|
-
if (i >
|
|
66
|
+
if (i > F || typeof e != "object" || !e) return !1;
|
|
66
67
|
if (Array.isArray(e)) return e.some((e) => t(e, r, i));
|
|
67
|
-
if (!
|
|
68
|
+
if (!C.isValidElement(e)) return !1;
|
|
68
69
|
let a = n(e, { suspend: !1 });
|
|
69
|
-
if (a ===
|
|
70
|
-
let o = a ===
|
|
70
|
+
if (a === M) return r > 0;
|
|
71
|
+
let o = a === C.Fragment;
|
|
71
72
|
if (typeof a != "string" && !o) return !1;
|
|
72
73
|
let { children: s } = e.props;
|
|
73
74
|
return t(s, o ? r : r + 1, i + 1);
|
|
74
75
|
};
|
|
75
76
|
return t(e, 0, 0);
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function L(e) {
|
|
78
79
|
let n = [], i = [];
|
|
79
80
|
for (let { key: a, node: o } of t(e)) {
|
|
80
|
-
let e =
|
|
81
|
-
r(o,
|
|
81
|
+
let e = C.isValidElement(o) ? C.cloneElement(o, { key: a }) : o;
|
|
82
|
+
r(o, M) ? n.push(e) : i.push(e);
|
|
82
83
|
}
|
|
83
84
|
return {
|
|
84
85
|
triggers: n,
|
|
85
86
|
content: i
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
|
-
var
|
|
89
|
-
let [
|
|
90
|
-
|
|
91
|
-
}, []),
|
|
92
|
-
open:
|
|
93
|
-
onDismiss:
|
|
94
|
-
refs: [
|
|
95
|
-
container:
|
|
96
|
-
triggerRef:
|
|
97
|
-
finalFocusRef:
|
|
89
|
+
var R = ({ open: t, defaultOpen: n, onOpenChange: r, position: m = "end", title: h, closeLabel: v = "Close", finalFocusRef: b, children: x, className: D, id: O, ref: M, ...N }) => {
|
|
90
|
+
let [P, F] = _(t, n, r), R = ee(), z = P && R, B = y(), V = l("wave-drawer"), H = O ?? V, U = l("wave-drawer-title"), W = ae(), [G, le] = C.useState(null), K = C.useRef(null), ue = C.useCallback((e) => {
|
|
91
|
+
K.current = e, le(e);
|
|
92
|
+
}, []), de = u(M, ue), q = re(K, !0), fe = g(F, "Drawer", q.afterOutsidePress), pe = p({
|
|
93
|
+
open: z,
|
|
94
|
+
onDismiss: fe,
|
|
95
|
+
refs: [K],
|
|
96
|
+
container: G,
|
|
97
|
+
triggerRef: B.focusRef,
|
|
98
|
+
finalFocusRef: b
|
|
98
99
|
});
|
|
99
|
-
|
|
100
|
-
let { triggers:
|
|
101
|
-
|
|
102
|
-
i && !Y.current &&
|
|
103
|
-
}, [
|
|
104
|
-
let X = t === void 0 && !n &&
|
|
100
|
+
ie(B, z), S(z ? G : null, W.hasTitle, "Drawer", "Drawer.Title");
|
|
101
|
+
let { triggers: J, content: me } = L(x), Y = C.useRef(!1);
|
|
102
|
+
C.useEffect(() => {
|
|
103
|
+
i && !Y.current && I(x) && (Y.current = !0, a(A, j));
|
|
104
|
+
}, [x]);
|
|
105
|
+
let X = t === void 0 && !n && J.length === 0, Z = C.useRef({
|
|
105
106
|
unreachable: X,
|
|
106
|
-
children:
|
|
107
|
+
children: x
|
|
107
108
|
});
|
|
108
|
-
|
|
109
|
+
C.useLayoutEffect(() => {
|
|
109
110
|
Z.current = {
|
|
110
111
|
unreachable: X,
|
|
111
|
-
children:
|
|
112
|
+
children: x
|
|
112
113
|
};
|
|
113
|
-
}),
|
|
114
|
+
}), C.useEffect(() => {
|
|
114
115
|
if (!i || !Z.current.unreachable) return;
|
|
115
116
|
let e = setTimeout(() => {
|
|
116
117
|
let e = Z.current;
|
|
117
|
-
e.unreachable && !
|
|
118
|
+
e.unreachable && !I(e.children) && a(oe, se);
|
|
118
119
|
}, ce);
|
|
119
120
|
return () => clearTimeout(e);
|
|
120
121
|
}, []);
|
|
121
|
-
let Q =
|
|
122
|
-
open:
|
|
123
|
-
requestOpen:
|
|
124
|
-
trigger:
|
|
125
|
-
panelId:
|
|
122
|
+
let Q = C.useMemo(() => ({
|
|
123
|
+
open: z,
|
|
124
|
+
requestOpen: F,
|
|
125
|
+
trigger: B,
|
|
126
|
+
panelId: H,
|
|
126
127
|
inPanel: !1
|
|
127
128
|
}), [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
]),
|
|
129
|
+
z,
|
|
130
|
+
F,
|
|
131
|
+
B,
|
|
132
|
+
H
|
|
133
|
+
]), he = C.useMemo(() => ({
|
|
133
134
|
...Q,
|
|
134
135
|
inPanel: !0
|
|
135
|
-
}), [Q]), $ = o(
|
|
136
|
-
return /* @__PURE__ */
|
|
136
|
+
}), [Q]), $ = o(h);
|
|
137
|
+
return /* @__PURE__ */ T(E.Provider, {
|
|
137
138
|
value: Q,
|
|
138
|
-
children: [
|
|
139
|
-
layerId:
|
|
140
|
-
children: /* @__PURE__ */
|
|
141
|
-
className: "fixed inset-0 bg-backdrop",
|
|
142
|
-
onMouseDown:
|
|
143
|
-
children: /* @__PURE__ */
|
|
144
|
-
ref:
|
|
139
|
+
children: [J, z && /* @__PURE__ */ w(d, {
|
|
140
|
+
layerId: pe.layerId,
|
|
141
|
+
children: /* @__PURE__ */ w("div", {
|
|
142
|
+
className: e(s.backdrop, "fixed inset-0 bg-backdrop"),
|
|
143
|
+
onMouseDown: q.onMouseDown,
|
|
144
|
+
children: /* @__PURE__ */ w("div", {
|
|
145
|
+
ref: de,
|
|
145
146
|
role: "dialog",
|
|
146
|
-
id:
|
|
147
|
-
"aria-labelledby": $ ?
|
|
147
|
+
id: H,
|
|
148
|
+
"aria-labelledby": $ ? U : W.titleId,
|
|
148
149
|
tabIndex: -1,
|
|
149
|
-
...
|
|
150
|
-
className: e("fixed top-0 flex h-full w-80 max-w-full flex-col border-border bg-background text-foreground shadow-64",
|
|
151
|
-
children: /* @__PURE__ */
|
|
152
|
-
value:
|
|
153
|
-
children: /* @__PURE__ */
|
|
154
|
-
value:
|
|
155
|
-
children: [/* @__PURE__ */
|
|
156
|
-
className: "flex items-center justify-between gap-2 border-b border-border p-4",
|
|
157
|
-
children: [$ && /* @__PURE__ */
|
|
158
|
-
id:
|
|
159
|
-
className: "text-subtitle-1 font-semibold",
|
|
160
|
-
children:
|
|
161
|
-
}), /* @__PURE__ */
|
|
150
|
+
...N,
|
|
151
|
+
className: e(s.root, "fixed top-0 flex h-full w-80 max-w-full flex-col border-border bg-background text-foreground shadow-64", k[m], D),
|
|
152
|
+
children: /* @__PURE__ */ w(E.Provider, {
|
|
153
|
+
value: he,
|
|
154
|
+
children: /* @__PURE__ */ T(ne.Provider, {
|
|
155
|
+
value: W.context,
|
|
156
|
+
children: [/* @__PURE__ */ T("div", {
|
|
157
|
+
className: e(s.header, "flex items-center justify-between gap-2 border-b border-border p-4"),
|
|
158
|
+
children: [$ && /* @__PURE__ */ w("h2", {
|
|
159
|
+
id: U,
|
|
160
|
+
className: e(c.root, "text-subtitle-1 font-semibold"),
|
|
161
|
+
children: h
|
|
162
|
+
}), /* @__PURE__ */ w(te, {
|
|
162
163
|
appearance: "subtle",
|
|
163
164
|
size: "small",
|
|
164
|
-
icon: /* @__PURE__ */
|
|
165
|
-
"aria-label":
|
|
166
|
-
onClick: (e) =>
|
|
165
|
+
icon: /* @__PURE__ */ w(f, {}),
|
|
166
|
+
"aria-label": v,
|
|
167
|
+
onClick: (e) => F(!1, {
|
|
167
168
|
reason: "close-button",
|
|
168
169
|
event: e.nativeEvent
|
|
169
170
|
}),
|
|
170
|
-
className: "ms-auto text-muted-foreground"
|
|
171
|
+
className: e(s.closeButton, "ms-auto text-muted-foreground")
|
|
171
172
|
})]
|
|
172
|
-
}), /* @__PURE__ */
|
|
173
|
-
className: "min-h-0 flex-1 overflow-y-auto p-4",
|
|
174
|
-
children:
|
|
173
|
+
}), /* @__PURE__ */ w("div", {
|
|
174
|
+
className: e(s.body, "min-h-0 flex-1 overflow-y-auto p-4"),
|
|
175
|
+
children: me
|
|
175
176
|
})]
|
|
176
177
|
})
|
|
177
178
|
})
|
|
@@ -180,13 +181,13 @@ var I = ({ open: t, defaultOpen: n, onOpenChange: r, position: f = "end", title:
|
|
|
180
181
|
})]
|
|
181
182
|
});
|
|
182
183
|
};
|
|
183
|
-
|
|
184
|
-
var
|
|
185
|
-
Trigger:
|
|
186
|
-
Close:
|
|
187
|
-
Title:
|
|
184
|
+
R.displayName = "Drawer";
|
|
185
|
+
var z = /* @__PURE__ */ Object.assign(R, {
|
|
186
|
+
Trigger: M,
|
|
187
|
+
Close: N,
|
|
188
|
+
Title: P
|
|
188
189
|
});
|
|
189
190
|
//#endregion
|
|
190
|
-
export {
|
|
191
|
+
export { z as Drawer, N as DrawerClose, P as DrawerTitle, M as DrawerTrigger };
|
|
191
192
|
|
|
192
193
|
//# sourceMappingURL=Drawer.mjs.map
|