@hanzo/ui 8.27.90 → 8.28.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/NOTICE +25 -0
- package/README.md +1 -1
- package/dist/backends/gui/alert-dialog.cjs +24 -6
- package/dist/backends/gui/alert-dialog.d.ts +11 -3
- package/dist/backends/gui/alert-dialog.d.ts.map +1 -1
- package/dist/backends/gui/alert-dialog.js +24 -6
- package/dist/backends/gui/alert-dialog.js.map +1 -1
- package/dist/backends/gui/alert.cjs +32 -1
- package/dist/backends/gui/alert.d.ts +36 -3
- package/dist/backends/gui/alert.d.ts.map +1 -1
- package/dist/backends/gui/alert.js +32 -2
- package/dist/backends/gui/alert.js.map +1 -1
- package/dist/backends/gui/avatar-group.cjs +28 -0
- package/dist/backends/gui/avatar-group.d.ts +33 -0
- package/dist/backends/gui/avatar-group.d.ts.map +1 -0
- package/dist/backends/gui/avatar-group.js +26 -0
- package/dist/backends/gui/avatar-group.js.map +1 -0
- package/dist/backends/gui/avatar.cjs +53 -3
- package/dist/backends/gui/avatar.d.ts +46 -4
- package/dist/backends/gui/avatar.d.ts.map +1 -1
- package/dist/backends/gui/avatar.js +52 -3
- package/dist/backends/gui/avatar.js.map +1 -1
- package/dist/backends/gui/badge.cjs +40 -2
- package/dist/backends/gui/badge.d.ts +7 -2
- package/dist/backends/gui/badge.d.ts.map +1 -1
- package/dist/backends/gui/badge.js +40 -2
- package/dist/backends/gui/badge.js.map +1 -1
- package/dist/backends/gui/banner.cjs +40 -1
- package/dist/backends/gui/banner.d.ts +36 -3
- package/dist/backends/gui/banner.d.ts.map +1 -1
- package/dist/backends/gui/banner.js +42 -4
- package/dist/backends/gui/banner.js.map +1 -1
- package/dist/backends/gui/breadcrumb.cjs +28 -10
- package/dist/backends/gui/breadcrumb.d.ts +20 -11
- package/dist/backends/gui/breadcrumb.d.ts.map +1 -1
- package/dist/backends/gui/breadcrumb.js +28 -10
- package/dist/backends/gui/breadcrumb.js.map +1 -1
- package/dist/backends/gui/button-group.cjs +43 -0
- package/dist/backends/gui/button-group.d.ts +48 -0
- package/dist/backends/gui/button-group.d.ts.map +1 -0
- package/dist/backends/gui/button-group.js +40 -0
- package/dist/backends/gui/button-group.js.map +1 -0
- package/dist/backends/gui/button.cjs +177 -4
- package/dist/backends/gui/button.d.ts +69 -4
- package/dist/backends/gui/button.d.ts.map +1 -1
- package/dist/backends/gui/button.js +179 -6
- package/dist/backends/gui/button.js.map +1 -1
- package/dist/backends/gui/card.cjs +50 -21
- package/dist/backends/gui/card.d.ts +16 -7
- package/dist/backends/gui/card.d.ts.map +1 -1
- package/dist/backends/gui/card.js +50 -21
- package/dist/backends/gui/card.js.map +1 -1
- package/dist/backends/gui/checkbox.cjs +86 -14
- package/dist/backends/gui/checkbox.d.ts +30 -2
- package/dist/backends/gui/checkbox.d.ts.map +1 -1
- package/dist/backends/gui/checkbox.js +87 -15
- package/dist/backends/gui/checkbox.js.map +1 -1
- package/dist/backends/gui/chip.cjs +51 -0
- package/dist/backends/gui/chip.d.ts +47 -0
- package/dist/backends/gui/chip.d.ts.map +1 -0
- package/dist/backends/gui/chip.js +49 -0
- package/dist/backends/gui/chip.js.map +1 -0
- package/dist/backends/gui/choice.cjs +18 -3
- package/dist/backends/gui/choice.d.ts +10 -2
- package/dist/backends/gui/choice.d.ts.map +1 -1
- package/dist/backends/gui/choice.js +19 -4
- package/dist/backends/gui/choice.js.map +1 -1
- package/dist/backends/gui/code-editor.cjs +16 -5
- package/dist/backends/gui/code-editor.d.ts +18 -1
- package/dist/backends/gui/code-editor.d.ts.map +1 -1
- package/dist/backends/gui/code-editor.js +16 -5
- package/dist/backends/gui/code-editor.js.map +1 -1
- package/dist/backends/gui/color-sample.cjs +24 -0
- package/dist/backends/gui/color-sample.d.ts +23 -0
- package/dist/backends/gui/color-sample.d.ts.map +1 -0
- package/dist/backends/gui/color-sample.js +22 -0
- package/dist/backends/gui/color-sample.js.map +1 -0
- package/dist/backends/gui/control.cjs +5 -3
- package/dist/backends/gui/control.d.ts +13 -3
- package/dist/backends/gui/control.d.ts.map +1 -1
- package/dist/backends/gui/control.js +5 -3
- package/dist/backends/gui/control.js.map +1 -1
- package/dist/backends/gui/country-select.cjs +69 -0
- package/dist/backends/gui/country-select.d.ts +30 -0
- package/dist/backends/gui/country-select.d.ts.map +1 -0
- package/dist/backends/gui/country-select.js +67 -0
- package/dist/backends/gui/country-select.js.map +1 -0
- package/dist/backends/gui/currency-picker.cjs +48 -0
- package/dist/backends/gui/currency-picker.d.ts +37 -0
- package/dist/backends/gui/currency-picker.d.ts.map +1 -0
- package/dist/backends/gui/currency-picker.js +46 -0
- package/dist/backends/gui/currency-picker.js.map +1 -0
- package/dist/backends/gui/density.cjs +32 -0
- package/dist/backends/gui/density.d.ts +27 -0
- package/dist/backends/gui/density.d.ts.map +1 -0
- package/dist/backends/gui/density.js +27 -0
- package/dist/backends/gui/density.js.map +1 -0
- package/dist/backends/gui/dialog.cjs +65 -7
- package/dist/backends/gui/dialog.d.ts +68 -3
- package/dist/backends/gui/dialog.d.ts.map +1 -1
- package/dist/backends/gui/dialog.js +63 -7
- package/dist/backends/gui/dialog.js.map +1 -1
- package/dist/backends/gui/dropdown-menu.cjs +361 -31
- package/dist/backends/gui/dropdown-menu.d.ts +151 -15
- package/dist/backends/gui/dropdown-menu.d.ts.map +1 -1
- package/dist/backends/gui/dropdown-menu.js +353 -34
- package/dist/backends/gui/dropdown-menu.js.map +1 -1
- package/dist/backends/gui/feedback.cjs +78 -0
- package/dist/backends/gui/feedback.d.ts +46 -0
- package/dist/backends/gui/feedback.d.ts.map +1 -0
- package/dist/backends/gui/feedback.js +74 -0
- package/dist/backends/gui/feedback.js.map +1 -0
- package/dist/backends/gui/field.cjs +71 -14
- package/dist/backends/gui/field.d.ts +43 -3
- package/dist/backends/gui/field.d.ts.map +1 -1
- package/dist/backends/gui/field.js +69 -14
- package/dist/backends/gui/field.js.map +1 -1
- package/dist/backends/gui/flag.cjs +17 -0
- package/dist/backends/gui/flag.d.ts +9 -0
- package/dist/backends/gui/flag.d.ts.map +1 -0
- package/dist/backends/gui/flag.js +14 -0
- package/dist/backends/gui/flag.js.map +1 -0
- package/dist/backends/gui/grip.cjs +35 -3
- package/dist/backends/gui/grip.d.ts +16 -1
- package/dist/backends/gui/grip.d.ts.map +1 -1
- package/dist/backends/gui/grip.js +35 -3
- package/dist/backends/gui/grip.js.map +1 -1
- package/dist/backends/gui/heading.cjs +27 -0
- package/dist/backends/gui/heading.d.ts +8 -0
- package/dist/backends/gui/heading.d.ts.map +1 -0
- package/dist/backends/gui/heading.js +25 -0
- package/dist/backends/gui/heading.js.map +1 -0
- package/dist/backends/gui/hue.cjs +49 -0
- package/dist/backends/gui/hue.d.ts +18 -0
- package/dist/backends/gui/hue.d.ts.map +1 -0
- package/dist/backends/gui/hue.js +43 -0
- package/dist/backends/gui/hue.js.map +1 -0
- package/dist/backends/gui/icon-tile.cjs +36 -0
- package/dist/backends/gui/icon-tile.d.ts +26 -0
- package/dist/backends/gui/icon-tile.d.ts.map +1 -0
- package/dist/backends/gui/icon-tile.js +32 -0
- package/dist/backends/gui/icon-tile.js.map +1 -0
- package/dist/backends/gui/image-input.cjs +78 -0
- package/dist/backends/gui/image-input.d.ts +32 -0
- package/dist/backends/gui/image-input.d.ts.map +1 -0
- package/dist/backends/gui/image-input.js +74 -0
- package/dist/backends/gui/image-input.js.map +1 -0
- package/dist/backends/gui/index.cjs +93 -7
- package/dist/backends/gui/index.d.ts +45 -2
- package/dist/backends/gui/index.d.ts.map +1 -1
- package/dist/backends/gui/index.js +35 -1
- package/dist/backends/gui/index.js.map +1 -1
- package/dist/backends/gui/input-group.cjs +49 -0
- package/dist/backends/gui/input-group.d.ts +46 -0
- package/dist/backends/gui/input-group.d.ts.map +1 -0
- package/dist/backends/gui/input-group.js +46 -0
- package/dist/backends/gui/input-group.js.map +1 -0
- package/dist/backends/gui/input.cjs +32 -4
- package/dist/backends/gui/input.d.ts +5 -1
- package/dist/backends/gui/input.d.ts.map +1 -1
- package/dist/backends/gui/input.js +33 -5
- package/dist/backends/gui/input.js.map +1 -1
- package/dist/backends/gui/item.cjs +34 -2
- package/dist/backends/gui/item.d.ts +21 -5
- package/dist/backends/gui/item.d.ts.map +1 -1
- package/dist/backends/gui/item.js +35 -3
- package/dist/backends/gui/item.js.map +1 -1
- package/dist/backends/gui/json-tree.cjs +103 -15
- package/dist/backends/gui/json-tree.d.ts +39 -3
- package/dist/backends/gui/json-tree.d.ts.map +1 -1
- package/dist/backends/gui/json-tree.js +104 -16
- package/dist/backends/gui/json-tree.js.map +1 -1
- package/dist/backends/gui/kbd.cjs +18 -2
- package/dist/backends/gui/kbd.d.ts +5 -2
- package/dist/backends/gui/kbd.d.ts.map +1 -1
- package/dist/backends/gui/kbd.js +18 -2
- package/dist/backends/gui/kbd.js.map +1 -1
- package/dist/backends/gui/label.cjs +14 -3
- package/dist/backends/gui/label.d.ts +12 -3
- package/dist/backends/gui/label.d.ts.map +1 -1
- package/dist/backends/gui/label.js +14 -3
- package/dist/backends/gui/label.js.map +1 -1
- package/dist/backends/gui/layout.cjs +5 -1
- package/dist/backends/gui/layout.d.ts +1 -1
- package/dist/backends/gui/layout.d.ts.map +1 -1
- package/dist/backends/gui/layout.js +5 -1
- package/dist/backends/gui/layout.js.map +1 -1
- package/dist/backends/gui/number-field.cjs +163 -0
- package/dist/backends/gui/number-field.d.ts +34 -0
- package/dist/backends/gui/number-field.d.ts.map +1 -0
- package/dist/backends/gui/number-field.js +160 -0
- package/dist/backends/gui/number-field.js.map +1 -0
- package/dist/backends/gui/overflowing-list.cjs +79 -0
- package/dist/backends/gui/overflowing-list.d.ts +42 -0
- package/dist/backends/gui/overflowing-list.d.ts.map +1 -0
- package/dist/backends/gui/overflowing-list.js +76 -0
- package/dist/backends/gui/overflowing-list.js.map +1 -0
- package/dist/backends/gui/phone-country-picker.cjs +60 -0
- package/dist/backends/gui/phone-country-picker.d.ts +34 -0
- package/dist/backends/gui/phone-country-picker.d.ts.map +1 -0
- package/dist/backends/gui/phone-country-picker.js +57 -0
- package/dist/backends/gui/phone-country-picker.js.map +1 -0
- package/dist/backends/gui/popover.cjs +20 -4
- package/dist/backends/gui/popover.d.ts +12 -1
- package/dist/backends/gui/popover.d.ts.map +1 -1
- package/dist/backends/gui/popover.js +21 -5
- package/dist/backends/gui/popover.js.map +1 -1
- package/dist/backends/gui/progress-ring.cjs +38 -0
- package/dist/backends/gui/progress-ring.d.ts +37 -0
- package/dist/backends/gui/progress-ring.d.ts.map +1 -0
- package/dist/backends/gui/progress-ring.js +36 -0
- package/dist/backends/gui/progress-ring.js.map +1 -0
- package/dist/backends/gui/progress.cjs +31 -7
- package/dist/backends/gui/progress.d.ts +25 -3
- package/dist/backends/gui/progress.d.ts.map +1 -1
- package/dist/backends/gui/progress.js +32 -8
- package/dist/backends/gui/progress.js.map +1 -1
- package/dist/backends/gui/radio-group.cjs +28 -2
- package/dist/backends/gui/radio-group.d.ts +20 -2
- package/dist/backends/gui/radio-group.d.ts.map +1 -1
- package/dist/backends/gui/radio-group.js +28 -2
- package/dist/backends/gui/radio-group.js.map +1 -1
- package/dist/backends/gui/search-list.cjs +62 -0
- package/dist/backends/gui/search-list.d.ts +65 -0
- package/dist/backends/gui/search-list.d.ts.map +1 -0
- package/dist/backends/gui/search-list.js +58 -0
- package/dist/backends/gui/search-list.js.map +1 -0
- package/dist/backends/gui/select.cjs +50 -16
- package/dist/backends/gui/select.d.ts +12 -3
- package/dist/backends/gui/select.d.ts.map +1 -1
- package/dist/backends/gui/select.js +51 -17
- package/dist/backends/gui/select.js.map +1 -1
- package/dist/backends/gui/shortcut.cjs +122 -0
- package/dist/backends/gui/shortcut.d.ts +58 -0
- package/dist/backends/gui/shortcut.d.ts.map +1 -0
- package/dist/backends/gui/shortcut.js +115 -0
- package/dist/backends/gui/shortcut.js.map +1 -0
- package/dist/backends/gui/skeleton.cjs +41 -10
- package/dist/backends/gui/skeleton.d.ts +46 -8
- package/dist/backends/gui/skeleton.d.ts.map +1 -1
- package/dist/backends/gui/skeleton.js +39 -8
- package/dist/backends/gui/skeleton.js.map +1 -1
- package/dist/backends/gui/snippet.cjs +12 -1
- package/dist/backends/gui/snippet.d.ts +4 -2
- package/dist/backends/gui/snippet.d.ts.map +1 -1
- package/dist/backends/gui/snippet.js +12 -1
- package/dist/backends/gui/snippet.js.map +1 -1
- package/dist/backends/gui/spinner.cjs +8 -1
- package/dist/backends/gui/spinner.d.ts +11 -2
- package/dist/backends/gui/spinner.d.ts.map +1 -1
- package/dist/backends/gui/spinner.js +9 -2
- package/dist/backends/gui/spinner.js.map +1 -1
- package/dist/backends/gui/stack-icon.cjs +17 -0
- package/dist/backends/gui/stack-icon.d.ts +15 -0
- package/dist/backends/gui/stack-icon.d.ts.map +1 -0
- package/dist/backends/gui/stack-icon.js +15 -0
- package/dist/backends/gui/stack-icon.js.map +1 -0
- package/dist/backends/gui/status.cjs +38 -1
- package/dist/backends/gui/status.d.ts +16 -2
- package/dist/backends/gui/status.d.ts.map +1 -1
- package/dist/backends/gui/status.js +38 -2
- package/dist/backends/gui/status.js.map +1 -1
- package/dist/backends/gui/stepper.cjs +73 -3
- package/dist/backends/gui/stepper.d.ts +25 -1
- package/dist/backends/gui/stepper.d.ts.map +1 -1
- package/dist/backends/gui/stepper.js +71 -5
- package/dist/backends/gui/stepper.js.map +1 -1
- package/dist/backends/gui/switch.cjs +35 -20
- package/dist/backends/gui/switch.d.ts +12 -2
- package/dist/backends/gui/switch.d.ts.map +1 -1
- package/dist/backends/gui/switch.js +35 -20
- package/dist/backends/gui/switch.js.map +1 -1
- package/dist/backends/gui/tabs.cjs +63 -17
- package/dist/backends/gui/tabs.d.ts +35 -6
- package/dist/backends/gui/tabs.d.ts.map +1 -1
- package/dist/backends/gui/tabs.js +65 -19
- package/dist/backends/gui/tabs.js.map +1 -1
- package/dist/backends/gui/tag.cjs +48 -0
- package/dist/backends/gui/tag.d.ts +53 -0
- package/dist/backends/gui/tag.d.ts.map +1 -0
- package/dist/backends/gui/tag.js +46 -0
- package/dist/backends/gui/tag.js.map +1 -0
- package/dist/backends/gui/tags.cjs +9 -2
- package/dist/backends/gui/tags.d.ts +6 -5
- package/dist/backends/gui/tags.d.ts.map +1 -1
- package/dist/backends/gui/tags.js +9 -2
- package/dist/backends/gui/tags.js.map +1 -1
- package/dist/backends/gui/textarea.cjs +22 -6
- package/dist/backends/gui/textarea.d.ts +10 -1
- package/dist/backends/gui/textarea.d.ts.map +1 -1
- package/dist/backends/gui/textarea.js +22 -6
- package/dist/backends/gui/textarea.js.map +1 -1
- package/dist/backends/gui/toaster.cjs +167 -3
- package/dist/backends/gui/toaster.d.ts +28 -2
- package/dist/backends/gui/toaster.d.ts.map +1 -1
- package/dist/backends/gui/toaster.js +167 -5
- package/dist/backends/gui/toaster.js.map +1 -1
- package/dist/backends/gui/toggle-group.cjs +13 -0
- package/dist/backends/gui/toggle-group.d.ts +7 -1
- package/dist/backends/gui/toggle-group.d.ts.map +1 -1
- package/dist/backends/gui/toggle-group.js +13 -0
- package/dist/backends/gui/toggle-group.js.map +1 -1
- package/dist/backends/gui/tooltip.cjs +29 -6
- package/dist/backends/gui/tooltip.d.ts +23 -4
- package/dist/backends/gui/tooltip.d.ts.map +1 -1
- package/dist/backends/gui/tooltip.js +31 -8
- package/dist/backends/gui/tooltip.js.map +1 -1
- package/dist/backends/gui/truncated-text.cjs +102 -0
- package/dist/backends/gui/truncated-text.d.ts +55 -0
- package/dist/backends/gui/truncated-text.d.ts.map +1 -0
- package/dist/backends/gui/truncated-text.js +97 -0
- package/dist/backends/gui/truncated-text.js.map +1 -0
- package/dist/gallery/compound.cjs +60 -0
- package/dist/gallery/compound.d.ts +2 -0
- package/dist/gallery/compound.d.ts.map +1 -0
- package/dist/gallery/compound.js +58 -0
- package/dist/gallery/compound.js.map +1 -0
- package/dist/gallery/display.cjs +47 -0
- package/dist/gallery/display.d.ts +3 -0
- package/dist/gallery/display.d.ts.map +1 -0
- package/dist/gallery/display.js +45 -0
- package/dist/gallery/display.js.map +1 -0
- package/dist/gallery/feedback.cjs +38 -0
- package/dist/gallery/feedback.d.ts +2 -0
- package/dist/gallery/feedback.d.ts.map +1 -0
- package/dist/gallery/feedback.js +36 -0
- package/dist/gallery/feedback.js.map +1 -0
- package/dist/gallery/fields.cjs +53 -0
- package/dist/gallery/fields.d.ts +2 -0
- package/dist/gallery/fields.d.ts.map +1 -0
- package/dist/gallery/fields.js +51 -0
- package/dist/gallery/fields.js.map +1 -0
- package/dist/gallery/frames.cjs +47 -0
- package/dist/gallery/frames.d.ts +2 -0
- package/dist/gallery/frames.d.ts.map +1 -0
- package/dist/gallery/frames.js +45 -0
- package/dist/gallery/frames.js.map +1 -0
- package/dist/gallery/menus.cjs +64 -0
- package/dist/gallery/menus.d.ts +15 -0
- package/dist/gallery/menus.d.ts.map +1 -0
- package/dist/gallery/menus.js +58 -0
- package/dist/gallery/menus.js.map +1 -0
- package/dist/gallery/records.cjs +33 -0
- package/dist/gallery/records.d.ts +2 -0
- package/dist/gallery/records.d.ts.map +1 -0
- package/dist/gallery/records.js +31 -0
- package/dist/gallery/records.js.map +1 -0
- package/dist/gallery/section.cjs +17 -0
- package/dist/gallery/section.d.ts +10 -0
- package/dist/gallery/section.d.ts.map +1 -0
- package/dist/gallery/section.js +14 -0
- package/dist/gallery/section.js.map +1 -0
- package/dist/gallery.cjs +8 -14
- package/dist/gallery.d.ts.map +1 -1
- package/dist/gallery.html +1613 -265
- package/dist/gallery.js +3 -9
- package/dist/gallery.js.map +1 -1
- package/dist/gui-config.cjs +37 -7
- package/dist/gui-config.d.ts +11 -3
- package/dist/gui-config.d.ts.map +1 -1
- package/dist/gui-config.js +37 -7
- package/dist/gui-config.js.map +1 -1
- package/dist/index.cjs +61 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/index.node.cjs +61 -2
- package/dist/index.node.js +7 -1
- package/dist/motion.cjs +25 -1
- package/dist/motion.d.ts +16 -1
- package/dist/motion.d.ts.map +1 -1
- package/dist/motion.js +24 -1
- package/dist/motion.js.map +1 -1
- package/dist/primitives/AvatarGroup.cjs +8 -0
- package/dist/primitives/AvatarGroup.d.ts +2 -0
- package/dist/primitives/AvatarGroup.d.ts.map +1 -0
- package/dist/primitives/AvatarGroup.js +5 -0
- package/dist/primitives/AvatarGroup.js.map +1 -0
- package/dist/primitives/BannerAction.cjs +8 -0
- package/dist/primitives/BannerAction.d.ts +2 -0
- package/dist/primitives/BannerAction.d.ts.map +1 -0
- package/dist/primitives/BannerAction.js +5 -0
- package/dist/primitives/BannerAction.js.map +1 -0
- package/dist/primitives/ButtonGroup.cjs +8 -0
- package/dist/primitives/ButtonGroup.d.ts +2 -0
- package/dist/primitives/ButtonGroup.d.ts.map +1 -0
- package/dist/primitives/ButtonGroup.js +5 -0
- package/dist/primitives/ButtonGroup.js.map +1 -0
- package/dist/primitives/ButtonGroupContext.cjs +8 -0
- package/dist/primitives/ButtonGroupContext.d.ts +2 -0
- package/dist/primitives/ButtonGroupContext.d.ts.map +1 -0
- package/dist/primitives/ButtonGroupContext.js +5 -0
- package/dist/primitives/ButtonGroupContext.js.map +1 -0
- package/dist/primitives/CalloutAction.cjs +8 -0
- package/dist/primitives/CalloutAction.d.ts +2 -0
- package/dist/primitives/CalloutAction.d.ts.map +1 -0
- package/dist/primitives/CalloutAction.js +5 -0
- package/dist/primitives/CalloutAction.js.map +1 -0
- package/dist/primitives/Chip.cjs +8 -0
- package/dist/primitives/Chip.d.ts +2 -0
- package/dist/primitives/Chip.d.ts.map +1 -0
- package/dist/primitives/Chip.js +5 -0
- package/dist/primitives/Chip.js.map +1 -0
- package/dist/primitives/ColorSample.cjs +8 -0
- package/dist/primitives/ColorSample.d.ts +2 -0
- package/dist/primitives/ColorSample.d.ts.map +1 -0
- package/dist/primitives/ColorSample.js +5 -0
- package/dist/primitives/ColorSample.js.map +1 -0
- package/dist/primitives/CountrySelect.cjs +8 -0
- package/dist/primitives/CountrySelect.d.ts +2 -0
- package/dist/primitives/CountrySelect.d.ts.map +1 -0
- package/dist/primitives/CountrySelect.js +5 -0
- package/dist/primitives/CountrySelect.js.map +1 -0
- package/dist/primitives/CurrencyPicker.cjs +8 -0
- package/dist/primitives/CurrencyPicker.d.ts +2 -0
- package/dist/primitives/CurrencyPicker.d.ts.map +1 -0
- package/dist/primitives/CurrencyPicker.js +5 -0
- package/dist/primitives/CurrencyPicker.js.map +1 -0
- package/dist/primitives/Density.cjs +8 -0
- package/dist/primitives/Density.d.ts +2 -0
- package/dist/primitives/Density.d.ts.map +1 -0
- package/dist/primitives/Density.js +5 -0
- package/dist/primitives/Density.js.map +1 -0
- package/dist/primitives/DialogBody.cjs +8 -0
- package/dist/primitives/DialogBody.d.ts +2 -0
- package/dist/primitives/DialogBody.d.ts.map +1 -0
- package/dist/primitives/DialogBody.js +5 -0
- package/dist/primitives/DialogBody.js.map +1 -0
- package/dist/primitives/DropdownMenuBack.cjs +8 -0
- package/dist/primitives/DropdownMenuBack.d.ts +2 -0
- package/dist/primitives/DropdownMenuBack.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuBack.js +5 -0
- package/dist/primitives/DropdownMenuBack.js.map +1 -0
- package/dist/primitives/DropdownMenuClose.cjs +8 -0
- package/dist/primitives/DropdownMenuClose.d.ts +2 -0
- package/dist/primitives/DropdownMenuClose.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuClose.js +5 -0
- package/dist/primitives/DropdownMenuClose.js.map +1 -0
- package/dist/primitives/DropdownMenuEmpty.cjs +8 -0
- package/dist/primitives/DropdownMenuEmpty.d.ts +2 -0
- package/dist/primitives/DropdownMenuEmpty.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuEmpty.js +5 -0
- package/dist/primitives/DropdownMenuEmpty.js.map +1 -0
- package/dist/primitives/DropdownMenuHeader.cjs +8 -0
- package/dist/primitives/DropdownMenuHeader.d.ts +2 -0
- package/dist/primitives/DropdownMenuHeader.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuHeader.js +5 -0
- package/dist/primitives/DropdownMenuHeader.js.map +1 -0
- package/dist/primitives/DropdownMenuLoading.cjs +8 -0
- package/dist/primitives/DropdownMenuLoading.d.ts +2 -0
- package/dist/primitives/DropdownMenuLoading.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuLoading.js +5 -0
- package/dist/primitives/DropdownMenuLoading.js.map +1 -0
- package/dist/primitives/DropdownMenuOptionItem.cjs +8 -0
- package/dist/primitives/DropdownMenuOptionItem.d.ts +2 -0
- package/dist/primitives/DropdownMenuOptionItem.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuOptionItem.js +5 -0
- package/dist/primitives/DropdownMenuOptionItem.js.map +1 -0
- package/dist/primitives/DropdownMenuPage.cjs +8 -0
- package/dist/primitives/DropdownMenuPage.d.ts +2 -0
- package/dist/primitives/DropdownMenuPage.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuPage.js +5 -0
- package/dist/primitives/DropdownMenuPage.js.map +1 -0
- package/dist/primitives/DropdownMenuSearch.cjs +8 -0
- package/dist/primitives/DropdownMenuSearch.d.ts +2 -0
- package/dist/primitives/DropdownMenuSearch.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuSearch.js +5 -0
- package/dist/primitives/DropdownMenuSearch.js.map +1 -0
- package/dist/primitives/DropdownMenuSection.cjs +8 -0
- package/dist/primitives/DropdownMenuSection.d.ts +2 -0
- package/dist/primitives/DropdownMenuSection.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuSection.js +5 -0
- package/dist/primitives/DropdownMenuSection.js.map +1 -0
- package/dist/primitives/DropdownMenuSelectionGroup.cjs +8 -0
- package/dist/primitives/DropdownMenuSelectionGroup.d.ts +2 -0
- package/dist/primitives/DropdownMenuSelectionGroup.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuSelectionGroup.js +5 -0
- package/dist/primitives/DropdownMenuSelectionGroup.js.map +1 -0
- package/dist/primitives/DropdownMenuTitle.cjs +8 -0
- package/dist/primitives/DropdownMenuTitle.d.ts +2 -0
- package/dist/primitives/DropdownMenuTitle.d.ts.map +1 -0
- package/dist/primitives/DropdownMenuTitle.js +5 -0
- package/dist/primitives/DropdownMenuTitle.js.map +1 -0
- package/dist/primitives/Heading.cjs +2 -2
- package/dist/primitives/Heading.d.ts +1 -1
- package/dist/primitives/Heading.d.ts.map +1 -1
- package/dist/primitives/Heading.js +1 -1
- package/dist/primitives/Heading.js.map +1 -1
- package/dist/primitives/IconTile.cjs +8 -0
- package/dist/primitives/IconTile.d.ts +2 -0
- package/dist/primitives/IconTile.d.ts.map +1 -0
- package/dist/primitives/IconTile.js +5 -0
- package/dist/primitives/IconTile.js.map +1 -0
- package/dist/primitives/ImageInput.cjs +8 -0
- package/dist/primitives/ImageInput.d.ts +2 -0
- package/dist/primitives/ImageInput.d.ts.map +1 -0
- package/dist/primitives/ImageInput.js +5 -0
- package/dist/primitives/ImageInput.js.map +1 -0
- package/dist/primitives/InputGroup.cjs +8 -0
- package/dist/primitives/InputGroup.d.ts +2 -0
- package/dist/primitives/InputGroup.d.ts.map +1 -0
- package/dist/primitives/InputGroup.js +5 -0
- package/dist/primitives/InputGroup.js.map +1 -0
- package/dist/primitives/NumberField.cjs +8 -0
- package/dist/primitives/NumberField.d.ts +2 -0
- package/dist/primitives/NumberField.d.ts.map +1 -0
- package/dist/primitives/NumberField.js +5 -0
- package/dist/primitives/NumberField.js.map +1 -0
- package/dist/primitives/OverflowingList.cjs +8 -0
- package/dist/primitives/OverflowingList.d.ts +2 -0
- package/dist/primitives/OverflowingList.d.ts.map +1 -0
- package/dist/primitives/OverflowingList.js +5 -0
- package/dist/primitives/OverflowingList.js.map +1 -0
- package/dist/primitives/PhoneCountryPicker.cjs +8 -0
- package/dist/primitives/PhoneCountryPicker.d.ts +2 -0
- package/dist/primitives/PhoneCountryPicker.d.ts.map +1 -0
- package/dist/primitives/PhoneCountryPicker.js +5 -0
- package/dist/primitives/PhoneCountryPicker.js.map +1 -0
- package/dist/primitives/ProgressRing.cjs +8 -0
- package/dist/primitives/ProgressRing.d.ts +2 -0
- package/dist/primitives/ProgressRing.d.ts.map +1 -0
- package/dist/primitives/ProgressRing.js +5 -0
- package/dist/primitives/ProgressRing.js.map +1 -0
- package/dist/primitives/RadioCircle.cjs +8 -0
- package/dist/primitives/RadioCircle.d.ts +2 -0
- package/dist/primitives/RadioCircle.d.ts.map +1 -0
- package/dist/primitives/RadioCircle.js +5 -0
- package/dist/primitives/RadioCircle.js.map +1 -0
- package/dist/primitives/SKELETON_HEIGHT.cjs +8 -0
- package/dist/primitives/SKELETON_HEIGHT.d.ts +2 -0
- package/dist/primitives/SKELETON_HEIGHT.d.ts.map +1 -0
- package/dist/primitives/SKELETON_HEIGHT.js +5 -0
- package/dist/primitives/SKELETON_HEIGHT.js.map +1 -0
- package/dist/primitives/STATUS_COLOR.cjs +8 -0
- package/dist/primitives/STATUS_COLOR.d.ts +2 -0
- package/dist/primitives/STATUS_COLOR.d.ts.map +1 -0
- package/dist/primitives/STATUS_COLOR.js +5 -0
- package/dist/primitives/STATUS_COLOR.js.map +1 -0
- package/dist/primitives/STATUS_HUE.cjs +8 -0
- package/dist/primitives/STATUS_HUE.d.ts +2 -0
- package/dist/primitives/STATUS_HUE.d.ts.map +1 -0
- package/dist/primitives/STATUS_HUE.js +5 -0
- package/dist/primitives/STATUS_HUE.js.map +1 -0
- package/dist/primitives/STATUS_PAINT.cjs +8 -0
- package/dist/primitives/STATUS_PAINT.d.ts +2 -0
- package/dist/primitives/STATUS_PAINT.d.ts.map +1 -0
- package/dist/primitives/STATUS_PAINT.js +5 -0
- package/dist/primitives/STATUS_PAINT.js.map +1 -0
- package/dist/primitives/Shortcut.cjs +8 -0
- package/dist/primitives/Shortcut.d.ts +2 -0
- package/dist/primitives/Shortcut.d.ts.map +1 -0
- package/dist/primitives/Shortcut.js +5 -0
- package/dist/primitives/Shortcut.js.map +1 -0
- package/dist/primitives/StackIcon.cjs +8 -0
- package/dist/primitives/StackIcon.d.ts +2 -0
- package/dist/primitives/StackIcon.d.ts.map +1 -0
- package/dist/primitives/StackIcon.js +5 -0
- package/dist/primitives/StackIcon.js.map +1 -0
- package/dist/primitives/TOAST_DURATION.cjs +8 -0
- package/dist/primitives/TOAST_DURATION.d.ts +2 -0
- package/dist/primitives/TOAST_DURATION.d.ts.map +1 -0
- package/dist/primitives/TOAST_DURATION.js +5 -0
- package/dist/primitives/TOAST_DURATION.js.map +1 -0
- package/dist/primitives/Tag.cjs +8 -0
- package/dist/primitives/Tag.d.ts +2 -0
- package/dist/primitives/Tag.d.ts.map +1 -0
- package/dist/primitives/Tag.js +5 -0
- package/dist/primitives/Tag.js.map +1 -0
- package/dist/primitives/ToastCard.cjs +8 -0
- package/dist/primitives/ToastCard.d.ts +2 -0
- package/dist/primitives/ToastCard.d.ts.map +1 -0
- package/dist/primitives/ToastCard.js +5 -0
- package/dist/primitives/ToastCard.js.map +1 -0
- package/dist/primitives/ToastFace.cjs +8 -0
- package/dist/primitives/ToastFace.d.ts +2 -0
- package/dist/primitives/ToastFace.d.ts.map +1 -0
- package/dist/primitives/ToastFace.js +5 -0
- package/dist/primitives/ToastFace.js.map +1 -0
- package/dist/primitives/TruncatedText.cjs +8 -0
- package/dist/primitives/TruncatedText.d.ts +2 -0
- package/dist/primitives/TruncatedText.d.ts.map +1 -0
- package/dist/primitives/TruncatedText.js +5 -0
- package/dist/primitives/TruncatedText.js.map +1 -0
- package/dist/primitives/TruncatedTextProvider.cjs +8 -0
- package/dist/primitives/TruncatedTextProvider.d.ts +2 -0
- package/dist/primitives/TruncatedTextProvider.d.ts.map +1 -0
- package/dist/primitives/TruncatedTextProvider.js +5 -0
- package/dist/primitives/TruncatedTextProvider.js.map +1 -0
- package/dist/primitives/VisuallyHidden.cjs +8 -0
- package/dist/primitives/VisuallyHidden.d.ts +2 -0
- package/dist/primitives/VisuallyHidden.d.ts.map +1 -0
- package/dist/primitives/VisuallyHidden.js +5 -0
- package/dist/primitives/VisuallyHidden.js.map +1 -0
- package/dist/primitives/fieldSize.cjs +8 -0
- package/dist/primitives/fieldSize.d.ts +2 -0
- package/dist/primitives/fieldSize.d.ts.map +1 -0
- package/dist/primitives/fieldSize.js +5 -0
- package/dist/primitives/fieldSize.js.map +1 -0
- package/dist/primitives/flag.cjs +8 -0
- package/dist/primitives/flag.d.ts +2 -0
- package/dist/primitives/flag.d.ts.map +1 -0
- package/dist/primitives/flag.js +5 -0
- package/dist/primitives/flag.js.map +1 -0
- package/dist/primitives/formatShortcut.cjs +8 -0
- package/dist/primitives/formatShortcut.d.ts +2 -0
- package/dist/primitives/formatShortcut.d.ts.map +1 -0
- package/dist/primitives/formatShortcut.js +5 -0
- package/dist/primitives/formatShortcut.js.map +1 -0
- package/dist/primitives/initialOf.cjs +8 -0
- package/dist/primitives/initialOf.d.ts +2 -0
- package/dist/primitives/initialOf.d.ts.map +1 -0
- package/dist/primitives/initialOf.js +5 -0
- package/dist/primitives/initialOf.js.map +1 -0
- package/dist/primitives/parseNumber.cjs +8 -0
- package/dist/primitives/parseNumber.d.ts +2 -0
- package/dist/primitives/parseNumber.d.ts.map +1 -0
- package/dist/primitives/parseNumber.js +5 -0
- package/dist/primitives/parseNumber.js.map +1 -0
- package/dist/primitives/speakShortcut.cjs +8 -0
- package/dist/primitives/speakShortcut.d.ts +2 -0
- package/dist/primitives/speakShortcut.d.ts.map +1 -0
- package/dist/primitives/speakShortcut.js +5 -0
- package/dist/primitives/speakShortcut.js.map +1 -0
- package/dist/primitives/tileTones.cjs +8 -0
- package/dist/primitives/tileTones.d.ts +2 -0
- package/dist/primitives/tileTones.d.ts.map +1 -0
- package/dist/primitives/tileTones.js +5 -0
- package/dist/primitives/tileTones.js.map +1 -0
- package/dist/primitives/useDensity.cjs +8 -0
- package/dist/primitives/useDensity.d.ts +2 -0
- package/dist/primitives/useDensity.d.ts.map +1 -0
- package/dist/primitives/useDensity.js +5 -0
- package/dist/primitives/useDensity.js.map +1 -0
- package/dist/primitives/useField.cjs +8 -0
- package/dist/primitives/useField.d.ts +2 -0
- package/dist/primitives/useField.d.ts.map +1 -0
- package/dist/primitives/useField.js +5 -0
- package/dist/primitives/useField.js.map +1 -0
- package/dist/product/ComboBox.cjs +25 -7
- package/dist/product/ComboBox.d.ts +3 -1
- package/dist/product/ComboBox.d.ts.map +1 -1
- package/dist/product/ComboBox.js +25 -7
- package/dist/product/ComboBox.js.map +1 -1
- package/dist/product/CommandMenu.cjs +137 -0
- package/dist/product/CommandMenu.d.ts +77 -0
- package/dist/product/CommandMenu.d.ts.map +1 -0
- package/dist/product/CommandMenu.js +134 -0
- package/dist/product/CommandMenu.js.map +1 -0
- package/dist/product/DetailPane.cjs +154 -12
- package/dist/product/DetailPane.d.ts +80 -2
- package/dist/product/DetailPane.d.ts.map +1 -1
- package/dist/product/DetailPane.js +153 -16
- package/dist/product/DetailPane.js.map +1 -1
- package/dist/product/Fact.cjs +6 -1
- package/dist/product/Fact.d.ts +16 -1
- package/dist/product/Fact.d.ts.map +1 -1
- package/dist/product/Fact.js +6 -1
- package/dist/product/Fact.js.map +1 -1
- package/dist/product/Field.cjs +14 -2
- package/dist/product/Field.d.ts +16 -1
- package/dist/product/Field.d.ts.map +1 -1
- package/dist/product/Field.js +14 -2
- package/dist/product/Field.js.map +1 -1
- package/dist/product/Filters.cjs +61 -9
- package/dist/product/Filters.d.ts +37 -6
- package/dist/product/Filters.d.ts.map +1 -1
- package/dist/product/Filters.js +62 -10
- package/dist/product/Filters.js.map +1 -1
- package/dist/product/MenuRow.cjs +81 -2
- package/dist/product/MenuRow.d.ts +76 -6
- package/dist/product/MenuRow.d.ts.map +1 -1
- package/dist/product/MenuRow.js +81 -4
- package/dist/product/MenuRow.js.map +1 -1
- package/dist/product/PrimaryButton.cjs +5 -1
- package/dist/product/PrimaryButton.d.ts +8 -0
- package/dist/product/PrimaryButton.d.ts.map +1 -1
- package/dist/product/PrimaryButton.js +5 -1
- package/dist/product/PrimaryButton.js.map +1 -1
- package/dist/product/Skeleton.cjs +7 -6
- package/dist/product/Skeleton.d.ts +3 -20
- package/dist/product/Skeleton.d.ts.map +1 -1
- package/dist/product/Skeleton.js +8 -7
- package/dist/product/Skeleton.js.map +1 -1
- package/dist/product/index.cjs +2 -0
- package/dist/product/index.d.ts +1 -0
- package/dist/product/index.d.ts.map +1 -1
- package/dist/product/index.js +2 -0
- package/dist/product/index.js.map +1 -1
- package/dist/settings/Section.cjs +11 -2
- package/dist/settings/Section.d.ts +8 -1
- package/dist/settings/Section.d.ts.map +1 -1
- package/dist/settings/Section.js +11 -2
- package/dist/settings/Section.js.map +1 -1
- package/dist/styles/motion.css +70 -0
- package/dist/styles.css +1479 -136
- package/dist/theme.css +963 -9
- package/package.json +2 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.COMMAND = void 0;
|
|
5
|
+
exports.CommandMenu = CommandMenu;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* CommandMenu — the palette as a side-panel page (twenty-ui's command menu
|
|
9
|
+
* frame, MIT, NOTICE): the search field IS the top bar, and the commands are
|
|
10
|
+
* grouped rows under it.
|
|
11
|
+
*
|
|
12
|
+
* const pane = useDetailPane()
|
|
13
|
+
* useCommandK(() => pane.open({ title: 'Command menu', bare: true, content: <CommandMenu groups={groups} /> }))
|
|
14
|
+
*
|
|
15
|
+
* Layout: the 48px pane bar holds a borderless 24px field ("Type anything…");
|
|
16
|
+
* each group opens on a 32px header row (a 24px icon slot, the label in medium
|
|
17
|
+
* ink, a hairline under it); rows are the record menu row — 32 high, a 16px
|
|
18
|
+
* icon in its well, contextual text, keycaps for the command's shortcut ("G
|
|
19
|
+
* then P"), a chevron when it opens a page — 2 apart, groups 12 apart. A query
|
|
20
|
+
* that matches nothing says so in a 64px status line.
|
|
21
|
+
*
|
|
22
|
+
* The decisions are the palette's own (`command.logic`): `score` keeps and
|
|
23
|
+
* ranks a row against the query, `step` moves the cursor. The view is drawn
|
|
24
|
+
* here as the ARIA combobox it is — the field owns focus and names the active
|
|
25
|
+
* option, the rows are options in grouped listboxes — so a screen reader hears
|
|
26
|
+
* the row the arrows land on while the caret stays in the field.
|
|
27
|
+
*
|
|
28
|
+
* Keys, from the field: ArrowDown/ArrowUp move (wrapping), Enter runs the
|
|
29
|
+
* active row, Escape clears a query (and on an empty one lets the pane close),
|
|
30
|
+
* Backspace on an empty query goes back a page.
|
|
31
|
+
*/
|
|
32
|
+
const react_1 = require("react");
|
|
33
|
+
const gui_1 = require("@hanzo/gui");
|
|
34
|
+
const command_logic_1 = require("../backends/gui/command.logic.cjs");
|
|
35
|
+
const shortcut_1 = require("../backends/gui/shortcut.cjs");
|
|
36
|
+
const slot_1 = require("../backends/gui/slot.cjs");
|
|
37
|
+
const gesture_1 = require("../backends/gui/gesture.cjs");
|
|
38
|
+
const MenuRow_1 = require("./MenuRow.cjs");
|
|
39
|
+
const DetailPane_1 = require("./DetailPane.cjs");
|
|
40
|
+
/** The frame's measures (twenty-ui's command menu, MIT). */
|
|
41
|
+
exports.COMMAND = { field: 24, header: 32, icon: 24, row: 32, rows: 2, groups: 12, empty: 64, margin: 48 };
|
|
42
|
+
function CommandMenu({ groups, placeholder = 'Type anything…', empty = 'No results found', label = 'Commands', query: controlled, onQueryChange, onBack, onClose, autoFocus = true, }) {
|
|
43
|
+
const pane = (0, DetailPane_1.usePane)();
|
|
44
|
+
const base = (0, react_1.useId)();
|
|
45
|
+
const [own, setOwn] = (0, react_1.useState)('');
|
|
46
|
+
const query = controlled ?? own;
|
|
47
|
+
const setQuery = (q) => {
|
|
48
|
+
if (controlled === undefined)
|
|
49
|
+
setOwn(q);
|
|
50
|
+
onQueryChange?.(q);
|
|
51
|
+
};
|
|
52
|
+
// The rows that survive the query, grouped, in source order.
|
|
53
|
+
const shown = (0, react_1.useMemo)(() => groups
|
|
54
|
+
.map((g) => ({
|
|
55
|
+
...g,
|
|
56
|
+
items: g.items.filter((it) => (0, command_logic_1.score)(it.label, query, [...(it.keywords ?? []), ...(it.contextual ? [it.contextual] : [])]) > 0),
|
|
57
|
+
}))
|
|
58
|
+
.filter((g) => g.items.length > 0), [groups, query]);
|
|
59
|
+
const reachable = (0, react_1.useMemo)(() => shown.flatMap((g) => g.items.filter((it) => !it.disabled)), [shown]);
|
|
60
|
+
const [active, setActive] = (0, react_1.useState)(undefined);
|
|
61
|
+
const current = reachable.find((it) => it.id === active) ?? reachable[0];
|
|
62
|
+
const optionId = (id) => `${base}-option-${id}`;
|
|
63
|
+
const listId = `${base}-list`;
|
|
64
|
+
// A cursor the arrows moved is brought into view; the first row of a group
|
|
65
|
+
// carries a scroll margin, so its header comes with it.
|
|
66
|
+
const moved = (0, react_1.useRef)(false);
|
|
67
|
+
(0, react_1.useEffect)(() => {
|
|
68
|
+
if (!moved.current || !current || typeof document === 'undefined')
|
|
69
|
+
return;
|
|
70
|
+
moved.current = false;
|
|
71
|
+
const el = document.getElementById(optionId(current.id));
|
|
72
|
+
el?.scrollIntoView?.({ block: 'nearest' });
|
|
73
|
+
});
|
|
74
|
+
const field = (0, react_1.useRef)(null);
|
|
75
|
+
(0, react_1.useEffect)(() => {
|
|
76
|
+
if (!autoFocus)
|
|
77
|
+
return;
|
|
78
|
+
const t = setTimeout(() => field.current?.focus?.(), 0);
|
|
79
|
+
return () => clearTimeout(t);
|
|
80
|
+
}, [autoFocus]);
|
|
81
|
+
const onKey = (e) => {
|
|
82
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
const at = current ? reachable.indexOf(current) : -1;
|
|
85
|
+
const next = reachable[(0, command_logic_1.step)(reachable.length, at, e.key === 'ArrowDown' ? 1 : -1, true)];
|
|
86
|
+
if (next) {
|
|
87
|
+
moved.current = true;
|
|
88
|
+
setActive(next.id);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else if (e.key === 'Enter') {
|
|
92
|
+
if (!current)
|
|
93
|
+
return;
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
current.onSelect();
|
|
96
|
+
}
|
|
97
|
+
else if (e.key === 'Escape') {
|
|
98
|
+
if (query) {
|
|
99
|
+
// Clearing the query is this key's whole job: it must not reach the pane.
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
setQuery('');
|
|
103
|
+
}
|
|
104
|
+
else if (!pane && onClose) {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
onClose();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else if (e.key === 'Backspace' && !query) {
|
|
110
|
+
const back = onBack ?? (pane && pane.depth > 1 ? pane.back : undefined);
|
|
111
|
+
if (back) {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
back();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('command-menu'), flex: 1, minH: 0, children: [(0, jsx_runtime_1.jsx)(DetailPane_1.PaneBar, { children: (0, jsx_runtime_1.jsx)(gui_1.Input, { ref: field, ...(0, slot_1.slot)('command-menu-input'), ...{
|
|
118
|
+
role: 'combobox',
|
|
119
|
+
'aria-expanded': true,
|
|
120
|
+
'aria-controls': listId,
|
|
121
|
+
'aria-autocomplete': 'list',
|
|
122
|
+
'aria-activedescendant': current ? optionId(current.id) : undefined,
|
|
123
|
+
'aria-label': label,
|
|
124
|
+
}, flex: 1, minW: 0, height: exports.COMMAND.field, px: 0, borderWidth: 0, rounded: 0, bg: "transparent", color: "$ink", fontSize: "$2", placeholder: placeholder, placeholderTextColor: "$hush", value: query, onChangeText: (t) => {
|
|
125
|
+
setQuery(t);
|
|
126
|
+
setActive(undefined);
|
|
127
|
+
}, onKeyDown: onKey,
|
|
128
|
+
// The bar is the field; its caret is the focus, so the field draws no
|
|
129
|
+
// ring of its own (inline, to outrank design's :focus-visible rule).
|
|
130
|
+
style: { outlineStyle: 'none' } }) }), (0, jsx_runtime_1.jsx)(DetailPane_1.PaneBody, { padded: false, children: (0, jsx_runtime_1.jsxs)(gui_1.YStack, { id: listId, ...(0, slot_1.slot)('command-menu-list'), px: "$2", pt: "$2", pb: "$2", gap: exports.COMMAND.groups, children: [shown.map((g) => {
|
|
131
|
+
const head = `${base}-group-${g.id}`;
|
|
132
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('command-menu-group'), gap: exports.COMMAND.rows, children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { id: head, ...(0, slot_1.slot)('command-menu-heading'), height: exports.COMMAND.header, items: "center", gap: "$1", pl: "$1", borderBottomWidth: 1, borderColor: "$borderColor", children: [(0, jsx_runtime_1.jsx)(gui_1.XStack, { width: exports.COMMAND.icon, height: exports.COMMAND.icon, items: "center", justify: "center", shrink: 0, children: g.icon }), (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", fontWeight: "500", color: "$ink", numberOfLines: 1, children: g.label })] }), (0, jsx_runtime_1.jsx)(gui_1.YStack, { role: "listbox", "aria-labelledby": head, gap: exports.COMMAND.rows, children: g.items.map((it, i) => {
|
|
133
|
+
const on = current?.id === it.id;
|
|
134
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.XStack, { id: optionId(it.id), ...(0, slot_1.slot)('command-menu-item'), ...{ role: 'option', 'aria-selected': on, 'aria-disabled': it.disabled || undefined }, "data-active": on ? '' : undefined, items: "center", gap: "$2", px: "$1", minH: exports.COMMAND.row, rounded: "$xs", cursor: it.disabled ? 'default' : 'pointer', opacity: it.disabled ? 0.5 : 1, bg: on ? '$hover' : 'transparent', hoverStyle: it.disabled ? undefined : { bg: '$hover' }, ...(0, gesture_1.touch)(exports.COMMAND.row, 44, 'y'), onHoverIn: it.disabled ? undefined : () => setActive(it.id), onPress: it.disabled ? undefined : it.onSelect, style: i === 0 ? { scrollMarginTop: exports.COMMAND.margin } : undefined, children: (0, jsx_runtime_1.jsx)(MenuRow_1.MenuRowContent, { label: it.label, icon: it.icon, iconContainer: it.icon != null, contextual: it.contextual, shortcut: it.shortcut ? (0, jsx_runtime_1.jsx)(shortcut_1.Shortcut, { keys: it.shortcut }) : undefined, submenu: it.submenu, quiet: true }) }, it.id));
|
|
135
|
+
}) })] }, g.id));
|
|
136
|
+
}), shown.length === 0 ? ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('command-menu-empty'), role: "status", "aria-live": "polite", height: exports.COMMAND.empty, items: "center", justify: "center", children: typeof empty === 'string' ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$hush", children: empty })) : (empty) })) : null] }) })] }));
|
|
137
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommandMenu — the palette as a side-panel page (twenty-ui's command menu
|
|
3
|
+
* frame, MIT, NOTICE): the search field IS the top bar, and the commands are
|
|
4
|
+
* grouped rows under it.
|
|
5
|
+
*
|
|
6
|
+
* const pane = useDetailPane()
|
|
7
|
+
* useCommandK(() => pane.open({ title: 'Command menu', bare: true, content: <CommandMenu groups={groups} /> }))
|
|
8
|
+
*
|
|
9
|
+
* Layout: the 48px pane bar holds a borderless 24px field ("Type anything…");
|
|
10
|
+
* each group opens on a 32px header row (a 24px icon slot, the label in medium
|
|
11
|
+
* ink, a hairline under it); rows are the record menu row — 32 high, a 16px
|
|
12
|
+
* icon in its well, contextual text, keycaps for the command's shortcut ("G
|
|
13
|
+
* then P"), a chevron when it opens a page — 2 apart, groups 12 apart. A query
|
|
14
|
+
* that matches nothing says so in a 64px status line.
|
|
15
|
+
*
|
|
16
|
+
* The decisions are the palette's own (`command.logic`): `score` keeps and
|
|
17
|
+
* ranks a row against the query, `step` moves the cursor. The view is drawn
|
|
18
|
+
* here as the ARIA combobox it is — the field owns focus and names the active
|
|
19
|
+
* option, the rows are options in grouped listboxes — so a screen reader hears
|
|
20
|
+
* the row the arrows land on while the caret stays in the field.
|
|
21
|
+
*
|
|
22
|
+
* Keys, from the field: ArrowDown/ArrowUp move (wrapping), Enter runs the
|
|
23
|
+
* active row, Escape clears a query (and on an empty one lets the pane close),
|
|
24
|
+
* Backspace on an empty query goes back a page.
|
|
25
|
+
*/
|
|
26
|
+
import { type ReactNode } from 'react';
|
|
27
|
+
import { type ShortcutKeys } from '../backends/gui/shortcut.js';
|
|
28
|
+
export type CommandMenuItem = {
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
/** Dimmed text after the label: an object's name, a count. */
|
|
33
|
+
contextual?: string;
|
|
34
|
+
/** More words the query matches it by. */
|
|
35
|
+
keywords?: string[];
|
|
36
|
+
/** The keys that run it outside the menu, drawn as keycaps: `['Mod', 'K']`, or `[['G'], ['P']]` for G then P. */
|
|
37
|
+
shortcut?: ShortcutKeys;
|
|
38
|
+
/** It opens a page rather than acting: a chevron at its end. */
|
|
39
|
+
submenu?: boolean;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
onSelect: () => void;
|
|
42
|
+
};
|
|
43
|
+
export type CommandMenuGroup = {
|
|
44
|
+
id: string;
|
|
45
|
+
label: string;
|
|
46
|
+
icon?: ReactNode;
|
|
47
|
+
items: CommandMenuItem[];
|
|
48
|
+
};
|
|
49
|
+
export type CommandMenuProps = {
|
|
50
|
+
groups: CommandMenuGroup[];
|
|
51
|
+
placeholder?: string;
|
|
52
|
+
/** What a query that matches nothing says. */
|
|
53
|
+
empty?: ReactNode;
|
|
54
|
+
/** The listbox's accessible name. */
|
|
55
|
+
label?: string;
|
|
56
|
+
/** The query, controlled; uncontrolled when absent. */
|
|
57
|
+
query?: string;
|
|
58
|
+
onQueryChange?: (query: string) => void;
|
|
59
|
+
/** Backspace on an empty query. Default: the pane's `back`, when there is a page under this one. */
|
|
60
|
+
onBack?: () => void;
|
|
61
|
+
/** Escape on an empty query, outside a pane (inside one, the pane closes itself). */
|
|
62
|
+
onClose?: () => void;
|
|
63
|
+
autoFocus?: boolean;
|
|
64
|
+
};
|
|
65
|
+
/** The frame's measures (twenty-ui's command menu, MIT). */
|
|
66
|
+
export declare const COMMAND: {
|
|
67
|
+
readonly field: 24;
|
|
68
|
+
readonly header: 32;
|
|
69
|
+
readonly icon: 24;
|
|
70
|
+
readonly row: 32;
|
|
71
|
+
readonly rows: 2;
|
|
72
|
+
readonly groups: 12;
|
|
73
|
+
readonly empty: 64;
|
|
74
|
+
readonly margin: 48;
|
|
75
|
+
};
|
|
76
|
+
export declare function CommandMenu({ groups, placeholder, empty, label, query: controlled, onQueryChange, onBack, onClose, autoFocus, }: CommandMenuProps): import("react").JSX.Element;
|
|
77
|
+
//# sourceMappingURL=CommandMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandMenu.d.ts","sourceRoot":"","sources":["../../src/product/CommandMenu.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAA+C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAInF,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMtE,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,iHAAiH;IACjH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,eAAe,EAAE,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,oGAAoG;IACpG,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,4DAA4D;AAC5D,eAAO,MAAM,OAAO;aAAK,KAAK,EAAE,EAAE;aAAE,MAAM,EAAE,EAAE;aAAE,IAAI,EAAE,EAAE;aAAE,GAAG,EAAE,EAAE;aAAE,IAAI,EAAE,CAAC;aAAE,MAAM,EAAE,EAAE;aAAE,KAAK,EAAE,EAAE;aAAE,MAAM,EAAE,EAAE;CAAW,CAAA;AAIxH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,WAA8B,EAC9B,KAA0B,EAC1B,KAAkB,EAClB,KAAK,EAAE,UAAU,EACjB,aAAa,EACb,MAAM,EACN,OAAO,EACP,SAAgB,GACjB,EAAE,gBAAgB,+BAgMlB"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* CommandMenu — the palette as a side-panel page (twenty-ui's command menu
|
|
5
|
+
* frame, MIT, NOTICE): the search field IS the top bar, and the commands are
|
|
6
|
+
* grouped rows under it.
|
|
7
|
+
*
|
|
8
|
+
* const pane = useDetailPane()
|
|
9
|
+
* useCommandK(() => pane.open({ title: 'Command menu', bare: true, content: <CommandMenu groups={groups} /> }))
|
|
10
|
+
*
|
|
11
|
+
* Layout: the 48px pane bar holds a borderless 24px field ("Type anything…");
|
|
12
|
+
* each group opens on a 32px header row (a 24px icon slot, the label in medium
|
|
13
|
+
* ink, a hairline under it); rows are the record menu row — 32 high, a 16px
|
|
14
|
+
* icon in its well, contextual text, keycaps for the command's shortcut ("G
|
|
15
|
+
* then P"), a chevron when it opens a page — 2 apart, groups 12 apart. A query
|
|
16
|
+
* that matches nothing says so in a 64px status line.
|
|
17
|
+
*
|
|
18
|
+
* The decisions are the palette's own (`command.logic`): `score` keeps and
|
|
19
|
+
* ranks a row against the query, `step` moves the cursor. The view is drawn
|
|
20
|
+
* here as the ARIA combobox it is — the field owns focus and names the active
|
|
21
|
+
* option, the rows are options in grouped listboxes — so a screen reader hears
|
|
22
|
+
* the row the arrows land on while the caret stays in the field.
|
|
23
|
+
*
|
|
24
|
+
* Keys, from the field: ArrowDown/ArrowUp move (wrapping), Enter runs the
|
|
25
|
+
* active row, Escape clears a query (and on an empty one lets the pane close),
|
|
26
|
+
* Backspace on an empty query goes back a page.
|
|
27
|
+
*/
|
|
28
|
+
import { useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
29
|
+
import { Input, Text, XStack, YStack } from '@hanzo/gui';
|
|
30
|
+
import { score, step } from '../backends/gui/command.logic.js';
|
|
31
|
+
import { Shortcut } from '../backends/gui/shortcut.js';
|
|
32
|
+
import { slot } from '../backends/gui/slot.js';
|
|
33
|
+
import { touch } from '../backends/gui/gesture.js';
|
|
34
|
+
import { MenuRowContent } from './MenuRow.js';
|
|
35
|
+
import { PaneBar, PaneBody, usePane } from './DetailPane.js';
|
|
36
|
+
/** The frame's measures (twenty-ui's command menu, MIT). */
|
|
37
|
+
export const COMMAND = { field: 24, header: 32, icon: 24, row: 32, rows: 2, groups: 12, empty: 64, margin: 48 };
|
|
38
|
+
export function CommandMenu({ groups, placeholder = 'Type anything…', empty = 'No results found', label = 'Commands', query: controlled, onQueryChange, onBack, onClose, autoFocus = true, }) {
|
|
39
|
+
const pane = usePane();
|
|
40
|
+
const base = useId();
|
|
41
|
+
const [own, setOwn] = useState('');
|
|
42
|
+
const query = controlled ?? own;
|
|
43
|
+
const setQuery = (q) => {
|
|
44
|
+
if (controlled === undefined)
|
|
45
|
+
setOwn(q);
|
|
46
|
+
onQueryChange?.(q);
|
|
47
|
+
};
|
|
48
|
+
// The rows that survive the query, grouped, in source order.
|
|
49
|
+
const shown = useMemo(() => groups
|
|
50
|
+
.map((g) => ({
|
|
51
|
+
...g,
|
|
52
|
+
items: g.items.filter((it) => score(it.label, query, [...(it.keywords ?? []), ...(it.contextual ? [it.contextual] : [])]) > 0),
|
|
53
|
+
}))
|
|
54
|
+
.filter((g) => g.items.length > 0), [groups, query]);
|
|
55
|
+
const reachable = useMemo(() => shown.flatMap((g) => g.items.filter((it) => !it.disabled)), [shown]);
|
|
56
|
+
const [active, setActive] = useState(undefined);
|
|
57
|
+
const current = reachable.find((it) => it.id === active) ?? reachable[0];
|
|
58
|
+
const optionId = (id) => `${base}-option-${id}`;
|
|
59
|
+
const listId = `${base}-list`;
|
|
60
|
+
// A cursor the arrows moved is brought into view; the first row of a group
|
|
61
|
+
// carries a scroll margin, so its header comes with it.
|
|
62
|
+
const moved = useRef(false);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!moved.current || !current || typeof document === 'undefined')
|
|
65
|
+
return;
|
|
66
|
+
moved.current = false;
|
|
67
|
+
const el = document.getElementById(optionId(current.id));
|
|
68
|
+
el?.scrollIntoView?.({ block: 'nearest' });
|
|
69
|
+
});
|
|
70
|
+
const field = useRef(null);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!autoFocus)
|
|
73
|
+
return;
|
|
74
|
+
const t = setTimeout(() => field.current?.focus?.(), 0);
|
|
75
|
+
return () => clearTimeout(t);
|
|
76
|
+
}, [autoFocus]);
|
|
77
|
+
const onKey = (e) => {
|
|
78
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
const at = current ? reachable.indexOf(current) : -1;
|
|
81
|
+
const next = reachable[step(reachable.length, at, e.key === 'ArrowDown' ? 1 : -1, true)];
|
|
82
|
+
if (next) {
|
|
83
|
+
moved.current = true;
|
|
84
|
+
setActive(next.id);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (e.key === 'Enter') {
|
|
88
|
+
if (!current)
|
|
89
|
+
return;
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
current.onSelect();
|
|
92
|
+
}
|
|
93
|
+
else if (e.key === 'Escape') {
|
|
94
|
+
if (query) {
|
|
95
|
+
// Clearing the query is this key's whole job: it must not reach the pane.
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
setQuery('');
|
|
99
|
+
}
|
|
100
|
+
else if (!pane && onClose) {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
onClose();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else if (e.key === 'Backspace' && !query) {
|
|
106
|
+
const back = onBack ?? (pane && pane.depth > 1 ? pane.back : undefined);
|
|
107
|
+
if (back) {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
back();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return (_jsxs(YStack, { ...slot('command-menu'), flex: 1, minH: 0, children: [_jsx(PaneBar, { children: _jsx(Input, { ref: field, ...slot('command-menu-input'), ...{
|
|
114
|
+
role: 'combobox',
|
|
115
|
+
'aria-expanded': true,
|
|
116
|
+
'aria-controls': listId,
|
|
117
|
+
'aria-autocomplete': 'list',
|
|
118
|
+
'aria-activedescendant': current ? optionId(current.id) : undefined,
|
|
119
|
+
'aria-label': label,
|
|
120
|
+
}, flex: 1, minW: 0, height: COMMAND.field, px: 0, borderWidth: 0, rounded: 0, bg: "transparent", color: "$ink", fontSize: "$2", placeholder: placeholder, placeholderTextColor: "$hush", value: query, onChangeText: (t) => {
|
|
121
|
+
setQuery(t);
|
|
122
|
+
setActive(undefined);
|
|
123
|
+
}, onKeyDown: onKey,
|
|
124
|
+
// The bar is the field; its caret is the focus, so the field draws no
|
|
125
|
+
// ring of its own (inline, to outrank design's :focus-visible rule).
|
|
126
|
+
style: { outlineStyle: 'none' } }) }), _jsx(PaneBody, { padded: false, children: _jsxs(YStack, { id: listId, ...slot('command-menu-list'), px: "$2", pt: "$2", pb: "$2", gap: COMMAND.groups, children: [shown.map((g) => {
|
|
127
|
+
const head = `${base}-group-${g.id}`;
|
|
128
|
+
return (_jsxs(YStack, { ...slot('command-menu-group'), gap: COMMAND.rows, children: [_jsxs(XStack, { id: head, ...slot('command-menu-heading'), height: COMMAND.header, items: "center", gap: "$1", pl: "$1", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(XStack, { width: COMMAND.icon, height: COMMAND.icon, items: "center", justify: "center", shrink: 0, children: g.icon }), _jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", numberOfLines: 1, children: g.label })] }), _jsx(YStack, { role: "listbox", "aria-labelledby": head, gap: COMMAND.rows, children: g.items.map((it, i) => {
|
|
129
|
+
const on = current?.id === it.id;
|
|
130
|
+
return (_jsx(XStack, { id: optionId(it.id), ...slot('command-menu-item'), ...{ role: 'option', 'aria-selected': on, 'aria-disabled': it.disabled || undefined }, "data-active": on ? '' : undefined, items: "center", gap: "$2", px: "$1", minH: COMMAND.row, rounded: "$xs", cursor: it.disabled ? 'default' : 'pointer', opacity: it.disabled ? 0.5 : 1, bg: on ? '$hover' : 'transparent', hoverStyle: it.disabled ? undefined : { bg: '$hover' }, ...touch(COMMAND.row, 44, 'y'), onHoverIn: it.disabled ? undefined : () => setActive(it.id), onPress: it.disabled ? undefined : it.onSelect, style: i === 0 ? { scrollMarginTop: COMMAND.margin } : undefined, children: _jsx(MenuRowContent, { label: it.label, icon: it.icon, iconContainer: it.icon != null, contextual: it.contextual, shortcut: it.shortcut ? _jsx(Shortcut, { keys: it.shortcut }) : undefined, submenu: it.submenu, quiet: true }) }, it.id));
|
|
131
|
+
}) })] }, g.id));
|
|
132
|
+
}), shown.length === 0 ? (_jsx(YStack, { ...slot('command-menu-empty'), role: "status", "aria-live": "polite", height: COMMAND.empty, items: "center", justify: "center", children: typeof empty === 'string' ? (_jsx(Text, { fontSize: "$2", color: "$hush", children: empty })) : (empty) })) : null] }) })] }));
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=CommandMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandMenu.js","sourceRoot":"","sources":["../../src/product/CommandMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AACnF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAqB,MAAM,0BAA0B,CAAA;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AA0CzD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,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I,IAAC,QAAQ,EAAC,IAAI,EAAC,KAAK,EAAC,OAAO,YAC9B,KAAK,GACD,CACR,CAAC,CAAC,CAAC,CACF,KAAK,CACN,GACM,CACV,CAAC,CAAC,CAAC,IAAI,IACD,GACA,IACJ,CACV,CAAA;AACH,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
'use client';"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PANE = exports.usePane = void 0;
|
|
4
5
|
exports.useDetailPane = useDetailPane;
|
|
5
6
|
exports.DetailPane = DetailPane;
|
|
7
|
+
exports.PaneBar = PaneBar;
|
|
8
|
+
exports.PaneBody = PaneBody;
|
|
9
|
+
exports.PaneFoot = PaneFoot;
|
|
6
10
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
11
|
/**
|
|
8
12
|
* DetailPane — the ONE reusable right-side pane for viewing or editing the
|
|
@@ -19,28 +23,166 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
19
23
|
* The last descriptor stays mounted through the close transition, so the exit
|
|
20
24
|
* animates with its content (no flash of empty pane). Opening a new
|
|
21
25
|
* descriptor replaces it.
|
|
26
|
+
*
|
|
27
|
+
* A pane is a STACK of pages. `open` starts a new stack, `push` lays a page on
|
|
28
|
+
* top (a relation opened from a record, a step of a flow), `back` takes it off;
|
|
29
|
+
* the top bar shows a back button while there is a page under the current one.
|
|
30
|
+
*
|
|
31
|
+
* Two modes, chosen by the shell:
|
|
32
|
+
*
|
|
33
|
+
* overlay (default) the SlideOver above the page, with its scrim — the
|
|
34
|
+
* console's contract, unchanged.
|
|
35
|
+
* docked a column in the layout row beside the page content: no scrim, the
|
|
36
|
+
* content narrows. 400 wide, resizable 320–600 from its leading edge
|
|
37
|
+
* by the kit's one resizer (Grip), the width kept per person
|
|
38
|
+
* (useSpan). The width animates 0 ↔ W while the page inside keeps the
|
|
39
|
+
* target width, so it never reflows mid-slide. Below lg it is the
|
|
40
|
+
* overlay again, full screen.
|
|
41
|
+
*
|
|
42
|
+
* A docked pane — or any pane under `<Density value="compact">` — draws the
|
|
43
|
+
* record frame (twenty-ui's side panel, MIT, NOTICE): a 48px top bar on the
|
|
44
|
+
* panel ground (back · icon + title · page actions · expand · close), a body
|
|
45
|
+
* that scrolls without chaining, and a footer on the panel ground with its
|
|
46
|
+
* actions at the end. An overlay pane at regular density keeps the header it
|
|
47
|
+
* always had. A page that draws itself (`bare`, a command menu, a search)
|
|
48
|
+
* composes the same frame from `PaneBar`, `PaneBody` and `PaneFoot`.
|
|
49
|
+
*
|
|
50
|
+
* Escape closes a docked pane while focus is inside it (the overlay's
|
|
51
|
+
* SlideOver already does); ⌘/Ctrl+Enter runs the page's `onExpand`.
|
|
22
52
|
*/
|
|
23
53
|
const react_1 = require("react");
|
|
24
54
|
const gui_1 = require("@hanzo/gui");
|
|
25
55
|
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
26
56
|
const SlideOver_1 = require("./SlideOver.cjs");
|
|
27
57
|
const color_1 = require("./color.cjs");
|
|
28
|
-
const
|
|
58
|
+
const button_1 = require("../backends/gui/button.cjs");
|
|
59
|
+
const tooltip_1 = require("../backends/gui/tooltip.cjs");
|
|
60
|
+
const grip_1 = require("../backends/gui/grip.cjs");
|
|
61
|
+
const span_1 = require("../backends/gui/span.cjs");
|
|
62
|
+
const density_1 = require("../backends/gui/density.cjs");
|
|
63
|
+
const slot_1 = require("../backends/gui/slot.cjs");
|
|
64
|
+
const Ctx = /* @__PURE__ */ (0, react_1.createContext)(null);
|
|
65
|
+
/** The page being drawn, for the bar a bare page composes. */
|
|
66
|
+
const PageCtx = /* @__PURE__ */ (0, react_1.createContext)(null);
|
|
67
|
+
/** The pane this sits in, or null outside one — for a page that adapts to being in a pane. */
|
|
68
|
+
const usePane = () => (0, react_1.useContext)(Ctx);
|
|
69
|
+
exports.usePane = usePane;
|
|
29
70
|
function useDetailPane() {
|
|
30
71
|
const ctx = (0, react_1.useContext)(Ctx);
|
|
31
72
|
if (!ctx)
|
|
32
73
|
throw new Error('useDetailPane must be used within <DetailPane>');
|
|
33
74
|
return ctx;
|
|
34
75
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
76
|
+
/** The record frame's measures (twenty-ui's side panel, MIT). */
|
|
77
|
+
exports.PANE = { w: 400, min: 320, max: 600, bar: 48, icon: 16 };
|
|
78
|
+
function DetailPane({ children, zIndex, mode = 'overlay', store = 'hanzo.pane' }) {
|
|
79
|
+
// One state, so every transition is one pure update: whether it is open, and
|
|
80
|
+
// the pages it holds (kept through a close, so the exit animates with them).
|
|
81
|
+
const [state, setState] = (0, react_1.useState)({ open: false, stack: [] });
|
|
82
|
+
const { open: isOpen, stack } = state;
|
|
83
|
+
const density = (0, density_1.useDensity)();
|
|
84
|
+
const media = (0, gui_1.useMedia)();
|
|
85
|
+
const docked = mode === 'docked' && !!media.lg;
|
|
86
|
+
const record = mode === 'docked' || density === 'compact';
|
|
87
|
+
const open = (0, react_1.useCallback)((descriptor) => setState({ open: true, stack: [descriptor] }), []);
|
|
88
|
+
const push = (0, react_1.useCallback)((descriptor) => setState((s) => ({ open: true, stack: s.open ? [...s.stack, descriptor] : [descriptor] })), []);
|
|
89
|
+
const close = (0, react_1.useCallback)(() => setState((s) => ({ ...s, open: false })), []);
|
|
90
|
+
const back = (0, react_1.useCallback)(() => setState((s) => (s.stack.length > 1 ? { ...s, stack: s.stack.slice(0, -1) } : { ...s, open: false })), []);
|
|
91
|
+
const depth = isOpen ? stack.length : 0;
|
|
92
|
+
const api = (0, react_1.useMemo)(() => ({ open, push, back, close, isOpen, depth }), [open, push, back, close, isOpen, depth]);
|
|
93
|
+
const desc = stack[stack.length - 1] ?? null;
|
|
94
|
+
const title = typeof desc?.title === 'string' ? desc.title : 'Details';
|
|
95
|
+
const page = desc ? ((0, jsx_runtime_1.jsx)(PageCtx.Provider, { value: desc, children: record || desc.bare ? (0, jsx_runtime_1.jsx)(RecordPage, { desc: desc }) : (0, jsx_runtime_1.jsx)(SheetPage, { desc: desc, close: close }) })) : null;
|
|
96
|
+
if (docked)
|
|
97
|
+
return ((0, jsx_runtime_1.jsx)(Ctx.Provider, { value: api, children: (0, jsx_runtime_1.jsxs)(gui_1.XStack, { ...(0, slot_1.slot)('detail-pane-row'), flex: 1, minW: 0, minH: 0, self: "stretch", children: [(0, jsx_runtime_1.jsx)(gui_1.YStack, { flex: 1, minW: 0, minH: 0, children: children }), (0, jsx_runtime_1.jsx)(Dock, { open: isOpen, title: title, store: store, onClose: close, onExpand: desc?.onExpand, children: page })] }) }));
|
|
98
|
+
return ((0, jsx_runtime_1.jsxs)(Ctx.Provider, { value: api, children: [children, (0, jsx_runtime_1.jsx)(SlideOver_1.SlideOver, { open: isOpen, onClose: close, side: "right", size: desc?.size ?? (record ? exports.PANE.w : 460), ariaLabel: title, zIndex: zIndex, children: record && desc ? ((0, jsx_runtime_1.jsx)(gui_1.YStack, { flex: 1, minH: 0, bg: "$background", onKeyDown: expandKey(desc.onExpand), children: page })) : (page) })] }));
|
|
99
|
+
}
|
|
100
|
+
/** ⌘/Ctrl+Enter runs `onExpand`, from anywhere inside the pane. */
|
|
101
|
+
const expandKey = (onExpand) => (e) => {
|
|
102
|
+
if (!onExpand || e.key !== 'Enter' || !(e.metaKey || e.ctrlKey))
|
|
103
|
+
return;
|
|
104
|
+
e.preventDefault?.();
|
|
105
|
+
onExpand();
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* The docked column. The OUTER box is what animates and what the Grip measures
|
|
109
|
+
* (its width is the pane's); the INNER box holds the target width throughout, so
|
|
110
|
+
* the page slides in already laid out.
|
|
111
|
+
*/
|
|
112
|
+
function Dock({ open, title, store, onClose, onExpand, children, }) {
|
|
113
|
+
const span = (0, span_1.useSpan)(store, exports.PANE.w, exports.PANE.min, exports.PANE.max);
|
|
114
|
+
const node = (0, react_1.useRef)(null);
|
|
115
|
+
const opener = (0, react_1.useRef)(null);
|
|
116
|
+
// Focus moves in when the pane opens and back to what opened it when it shuts:
|
|
117
|
+
// a docked pane is not modal, but a keyboard has to be able to reach it.
|
|
118
|
+
(0, react_1.useEffect)(() => {
|
|
119
|
+
if (!open || typeof document === 'undefined')
|
|
120
|
+
return;
|
|
121
|
+
opener.current = document.activeElement;
|
|
122
|
+
const t = window.setTimeout(() => node.current?.focus?.(), 0);
|
|
123
|
+
return () => {
|
|
124
|
+
window.clearTimeout(t);
|
|
125
|
+
const back = opener.current;
|
|
126
|
+
if (back instanceof HTMLElement && node.current?.contains(document.activeElement))
|
|
127
|
+
back.focus();
|
|
128
|
+
};
|
|
129
|
+
}, [open]);
|
|
130
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ref: ((el) => {
|
|
131
|
+
span.ref(el);
|
|
132
|
+
node.current = el instanceof HTMLElement ? el : null;
|
|
133
|
+
}), ...(0, slot_1.slot)('detail-pane'), "data-mode": "docked", "data-open": open ? '' : undefined, role: "complementary", "aria-label": title, "aria-hidden": !open, ...(!open ? { inert: true } : null), tabIndex: -1, position: "relative", shrink: 0, self: "stretch", overflow: "hidden", outlineWidth: 0, onKeyDown: ((e) => {
|
|
134
|
+
if (e.key === 'Escape' && !e.defaultPrevented) {
|
|
135
|
+
e.preventDefault?.();
|
|
136
|
+
onClose();
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
expandKey(onExpand)(e);
|
|
140
|
+
}), style: {
|
|
141
|
+
...span.style,
|
|
142
|
+
width: open ? 'var(--span)' : 0,
|
|
143
|
+
transition: 'width var(--duration-base, 300ms) var(--ease-out, ease)',
|
|
144
|
+
}, children: [(0, jsx_runtime_1.jsx)(gui_1.YStack, { width: "var(--span)", flex: 1, minH: 0, bg: "$background", borderLeftWidth: 1, borderColor: "$borderColor", children: children }), open ? ((0, jsx_runtime_1.jsx)(grip_1.Grip, { side: "right", span: span.span, floor: exports.PANE.min, ceil: exports.PANE.max, reset: exports.PANE.w, bar: "edge", label: "Resize side panel", onSpan: span.move, onKeep: span.keep, onShut: onClose })) : null] }));
|
|
145
|
+
}
|
|
146
|
+
/** The record frame of one page: the bar, the scrolling body, the footer. */
|
|
147
|
+
function RecordPage({ desc }) {
|
|
148
|
+
if (desc.bare)
|
|
149
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: desc.content });
|
|
150
|
+
const Icon = desc.icon;
|
|
151
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(PaneBar, { actions: desc.actions, children: [Icon ? (0, jsx_runtime_1.jsx)(Icon, { size: exports.PANE.icon, color: desc.iconColor ? (0, color_1.asColor)(desc.iconColor) : '$aside' }) : null, (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", fontWeight: "500", color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: desc.title }), desc.subtitle !== undefined ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$hint", numberOfLines: 1, shrink: 1, minW: 0, children: desc.subtitle })) : null] }), (0, jsx_runtime_1.jsx)(PaneBody, { children: desc.content }), desc.footer !== undefined ? (0, jsx_runtime_1.jsx)(PaneFoot, { children: desc.footer }) : null] }));
|
|
152
|
+
}
|
|
153
|
+
/** The overlay sheet's own page, as it always was: the 56px header and the body. */
|
|
154
|
+
function SheetPage({ desc, close }) {
|
|
155
|
+
const Icon = desc.icon;
|
|
156
|
+
const pane = (0, react_1.useContext)(Ctx);
|
|
157
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2.5", px: "$4", height: 56, borderBottomWidth: 1, borderColor: "$borderColor", children: [pane && pane.depth > 1 ? ((0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", chromeless: true, icon: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronLeft, { size: 18 }), onPress: pane.back, "aria-label": "Back" })) : null, Icon ? (0, jsx_runtime_1.jsx)(Icon, { size: 18, color: desc.iconColor ? (0, color_1.asColor)(desc.iconColor) : undefined }) : null, (0, jsx_runtime_1.jsxs)(gui_1.YStack, { flex: 1, minW: 0, children: [(0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$5", fontWeight: "700", color: "$color12", numberOfLines: 1, children: desc.title }), desc.subtitle !== undefined ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color10", numberOfLines: 1, children: desc.subtitle })) : null] }), (0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", chromeless: true, icon: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.X, { size: 18 }), onPress: close, "aria-label": "Close" })] }), (0, jsx_runtime_1.jsx)(gui_1.ScrollView, { flex: 1, minH: 0, children: (0, jsx_runtime_1.jsx)(gui_1.YStack, { p: "$4", gap: "$3", children: desc.content }) }), desc.footer !== undefined ? ((0, jsx_runtime_1.jsx)(gui_1.XStack, { px: "$4", py: "$3", gap: "$2", borderTopWidth: 1, borderColor: "$borderColor", bg: "$color1", children: desc.footer })) : null] }));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The record frame's top bar: 48 high on the panel ground, a hairline under
|
|
161
|
+
* it, 8 in from each side, its two clusters 16 apart and their parts 4 apart.
|
|
162
|
+
* Inside a pane it adds back (while there is a page under this one), expand
|
|
163
|
+
* (when the page can open on the main surface) and close; outside one it is the
|
|
164
|
+
* bar alone.
|
|
165
|
+
*/
|
|
166
|
+
function PaneBar({ children, actions }) {
|
|
167
|
+
const pane = (0, react_1.useContext)(Ctx);
|
|
168
|
+
const page = (0, react_1.useContext)(PageCtx);
|
|
169
|
+
const expand = page?.onExpand;
|
|
170
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { ...(0, slot_1.slot)('pane-bar'), height: exports.PANE.bar, shrink: 0, items: "center", justify: "space-between", gap: "$4", px: "$2", bg: "$panel", borderBottomWidth: 1, borderColor: "$borderColor", children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { flex: 1, minW: 0, items: "center", gap: "$1", children: [pane && pane.depth > 1 ? ((0, jsx_runtime_1.jsx)(Tool, { tip: "Back", onPress: pane.back, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronLeft, {}) })) : null, children] }), (0, jsx_runtime_1.jsxs)(gui_1.XStack, { shrink: 0, items: "center", gap: "$1", children: [actions, expand ? ((0, jsx_runtime_1.jsx)(Tool, { tip: page?.expandLabel ?? 'Open', onPress: expand, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Maximize2, {}) })) : null, pane ? ((0, jsx_runtime_1.jsx)(Tool, { tip: "Close side panel", onPress: pane.close, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.X, {}) })) : null] })] }));
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The bar's quiet 24px icon button, named by its tooltip. The tooltip's trigger
|
|
174
|
+
* IS the button (`asChild`): wrapped in a box, the trigger's `aria-expanded`
|
|
175
|
+
* lands on a div, which axe refuses (`aria-allowed-attr`), and a button may
|
|
176
|
+
* carry it.
|
|
177
|
+
*/
|
|
178
|
+
function Tool({ tip, children, ...props }) {
|
|
179
|
+
return ((0, jsx_runtime_1.jsxs)(tooltip_1.Tooltip, { delay: 1000, placement: "bottom", children: [(0, jsx_runtime_1.jsx)(tooltip_1.TooltipTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(button_1.Button, { size: "icon-xs", variant: "ghost", emphasis: "subtle", "aria-label": tip, ...props, children: children }) }), (0, jsx_runtime_1.jsx)(tooltip_1.TooltipContent, { children: tip })] }));
|
|
180
|
+
}
|
|
181
|
+
/** The record frame's body: it takes what the bar and footer leave, and scrolls without chaining to the page. */
|
|
182
|
+
function PaneBody({ children, padded = true }) {
|
|
183
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.ScrollView, { ...(0, slot_1.slot)('pane-body'), flex: 1, minH: 0, style: { overscrollBehavior: 'contain' }, children: (0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(padded ? { p: '$2' } : null), gap: "$2", children: children }) }));
|
|
184
|
+
}
|
|
185
|
+
/** The record frame's footer: the panel ground, a hairline above, its actions at the end, 8 apart. */
|
|
186
|
+
function PaneFoot({ children }) {
|
|
187
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('pane-foot'), shrink: 0, items: "center", justify: "flex-end", gap: "$2", px: "$3", py: "$2", bg: "$panel", borderTopWidth: 1, borderColor: "$borderColor", children: children }));
|
|
46
188
|
}
|