@hanzo/ui 8.27.91 → 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 +1594 -256
- package/dist/gallery.js +3 -9
- package/dist/gallery.js.map +1 -1
- package/dist/gui-config.cjs +33 -4
- package/dist/gui-config.d.ts +11 -3
- package/dist/gui-config.d.ts.map +1 -1
- package/dist/gui-config.js +33 -4
- 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 +1460 -127
- package/dist/theme.css +944 -0
- package/package.json +2 -1
package/NOTICE
CHANGED
|
@@ -23,3 +23,28 @@ The derived files are the builder workspace in pkg/ui/src/agents:
|
|
|
23
23
|
Workspace, Choice, FileTree, FileTabs, PreviewFrame, Console, Suggestions,
|
|
24
24
|
Attachments and Feedback (.tsx), and tree, log and bridge (.ts). The MIT
|
|
25
25
|
permission notice that governs them is the one in LICENSE-MIT.
|
|
26
|
+
|
|
27
|
+
This product includes software derived from Twenty's twenty-ui package
|
|
28
|
+
(https://github.com/twentyhq/twenty, packages/twenty-ui, commit
|
|
29
|
+
dd7099a02f83ddc021231b71d5344d3b83f4cf7d), licensed under MIT:
|
|
30
|
+
|
|
31
|
+
Copyright (c) 2023-present Twenty.com, PBC
|
|
32
|
+
|
|
33
|
+
The derived parts are the record kit: every file under pkg/ui/src and
|
|
34
|
+
pkg/data/src whose header names twenty-ui. Each re-expresses a twenty-ui
|
|
35
|
+
component's props, states and measured values on @hanzo/gui; no twenty-ui
|
|
36
|
+
source, stylesheet or asset is copied. "Twenty" and the Twenty logo are
|
|
37
|
+
trademarks of Twenty.com, PBC and are not licensed; neither appears in this
|
|
38
|
+
product.
|
|
39
|
+
|
|
40
|
+
This product includes the colour scales of Radix Colors
|
|
41
|
+
(https://github.com/radix-ui/colors), licensed under MIT:
|
|
42
|
+
|
|
43
|
+
Copyright (c) 2021 Radix
|
|
44
|
+
|
|
45
|
+
They are the data palette in pkg/tokens/src/data.ts: twenty-four of its
|
|
46
|
+
twenty-five pickable hues and all five tinted neutrals are Radix Colors 3.0.0
|
|
47
|
+
scales (its `blue` is Radix indigo, its `teal` Radix teal), as twenty-ui ships
|
|
48
|
+
them, converted from display-p3 to sRGB. Its `gray` is twenty-ui's own.
|
|
49
|
+
|
|
50
|
+
The MIT permission notice that governs both is the one in LICENSE-MIT.
|
package/README.md
CHANGED
|
@@ -212,7 +212,7 @@ emit({ component: 'PlanCard', action: 'select', id: 'pro' })
|
|
|
212
212
|
|
|
213
213
|
- **One home, no duplication** — components are extracted, never copied. The record layer's source of truth stays in `@hanzo/data`; `@hanzo/ui` composes it.
|
|
214
214
|
- **Host-agnostic** — data + effects injected; zero coupling to any app.
|
|
215
|
-
- **Clean-room** —
|
|
215
|
+
- **Clean-room** — our own implementation on @hanzo/gui, no GPL code; parts that re-express MIT-licensed work are credited in NOTICE.
|
|
216
216
|
- **Cross-platform** — web + native + desktop, because it's only `@hanzo/gui`.
|
|
217
217
|
|
|
218
218
|
Hanzo AI, Inc — licensed [Apache-2.0](./LICENSE-APACHE) OR [MIT](./LICENSE-MIT), at your
|
|
@@ -11,6 +11,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
11
11
|
* flattens its compound parts into the shadcn names and dresses them in the
|
|
12
12
|
* Hanzo tokens, exactly as `dialog.tsx` does for the ordinary modal.
|
|
13
13
|
*
|
|
14
|
+
* `size` gives it the record frame Dialog's `size` does (twenty-ui's
|
|
15
|
+
* AlertDialog, MIT, NOTICE): the same widths less `compact`, the same sections
|
|
16
|
+
* and scrim, from the one frame definition in dialog.tsx.
|
|
17
|
+
*
|
|
14
18
|
* `AlertDialogContent` mounts its OWN portal + overlay (so callers never wrap
|
|
15
19
|
* it) and re-applies the trigger's resolved theme inside the portal via
|
|
16
20
|
* `PortalTheme` — gui portals re-root the subtree, so React theme context does
|
|
@@ -35,6 +39,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
35
39
|
* button is `primary` and Cancel is `outline`.
|
|
36
40
|
*/
|
|
37
41
|
const gui_1 = require("@hanzo/gui");
|
|
42
|
+
const react_1 = require("react");
|
|
43
|
+
const dialog_1 = require("./dialog.cjs");
|
|
38
44
|
const portal_theme_1 = require("../../product/menu/portal-theme.cjs");
|
|
39
45
|
const button_1 = require("./button.cjs");
|
|
40
46
|
const slot_1 = require("./slot.cjs");
|
|
@@ -48,18 +54,30 @@ const AlertDialogPortal = gui_1.AlertDialog.Portal;
|
|
|
48
54
|
exports.AlertDialogPortal = AlertDialogPortal;
|
|
49
55
|
const AlertDialogOverlay = (props) => ((0, jsx_runtime_1.jsx)(gui_1.AlertDialog.Overlay, { ...(0, slot_1.slot)('alert-dialog-overlay'), bg: "rgba(0,0,0,0.5)", opacity: 0.5, ...props }));
|
|
50
56
|
exports.AlertDialogOverlay = AlertDialogOverlay;
|
|
51
|
-
const AlertDialogContent = ({ children, ...props }) => {
|
|
57
|
+
const AlertDialogContent = ({ children, size, ...props }) => {
|
|
52
58
|
const themeName = (0, portal_theme_1.useThemeName)();
|
|
53
|
-
return ((0, jsx_runtime_1.jsx)(gui_1.AlertDialog.Portal, { children: (0, jsx_runtime_1.jsxs)(portal_theme_1.PortalTheme, { name: themeName, children: [(0, jsx_runtime_1.jsx)(AlertDialogOverlay, {}), (0, jsx_runtime_1.jsx)(gui_1.AlertDialog.Content, { ...(0, slot_1.slot)('alert-dialog-content'), bg: "$background", borderWidth: 1, borderColor: "$borderColor", rounded: "$5", p: PAD, gap: "$4", width: "100%", maxW: 512, ...props, children: children })] }) }));
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.AlertDialog.Portal, { children: (0, jsx_runtime_1.jsxs)(portal_theme_1.PortalTheme, { name: themeName, children: [(0, jsx_runtime_1.jsx)(AlertDialogOverlay, { ...(size ? dialog_1.scrim : null) }), (0, jsx_runtime_1.jsx)(gui_1.AlertDialog.Content, { ...(0, slot_1.slot)('alert-dialog-content'), ...(size ? { 'data-size': size } : null), bg: "$background", borderWidth: 1, borderColor: "$borderColor", rounded: "$5", p: PAD, gap: "$4", width: "100%", maxW: 512, ...(size ? (0, dialog_1.frame)(size) : null), ...props, children: (0, jsx_runtime_1.jsx)(dialog_1.Sized.Provider, { value: size ?? null, children: children }) })] }) }));
|
|
54
60
|
};
|
|
55
61
|
exports.AlertDialogContent = AlertDialogContent;
|
|
56
|
-
const AlertDialogHeader = (props) =>
|
|
62
|
+
const AlertDialogHeader = (props) => {
|
|
63
|
+
const sized = (0, react_1.useContext)(dialog_1.Sized);
|
|
64
|
+
return (0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('alert-dialog-header'), gap: "$2", ...(sized ? dialog_1.section.header : null), ...props });
|
|
65
|
+
};
|
|
57
66
|
exports.AlertDialogHeader = AlertDialogHeader;
|
|
58
|
-
const AlertDialogFooter = (props) =>
|
|
67
|
+
const AlertDialogFooter = (props) => {
|
|
68
|
+
const sized = (0, react_1.useContext)(dialog_1.Sized);
|
|
69
|
+
return (0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('alert-dialog-footer'), gap: "$2", justify: "flex-end", items: "center", ...(sized ? dialog_1.section.footer : null), ...props });
|
|
70
|
+
};
|
|
59
71
|
exports.AlertDialogFooter = AlertDialogFooter;
|
|
60
|
-
const AlertDialogTitle = (props) =>
|
|
72
|
+
const AlertDialogTitle = (props) => {
|
|
73
|
+
const sized = (0, react_1.useContext)(dialog_1.Sized);
|
|
74
|
+
return (0, jsx_runtime_1.jsx)(gui_1.AlertDialog.Title, { ...(0, slot_1.slot)('alert-dialog-title'), size: "$5", fontWeight: "600", ...(sized ? dialog_1.section.title : null), ...props });
|
|
75
|
+
};
|
|
61
76
|
exports.AlertDialogTitle = AlertDialogTitle;
|
|
62
|
-
const AlertDialogDescription = (props) =>
|
|
77
|
+
const AlertDialogDescription = (props) => {
|
|
78
|
+
const sized = (0, react_1.useContext)(dialog_1.Sized);
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.AlertDialog.Description, { ...(0, slot_1.slot)('alert-dialog-description'), size: "$2", color: "$quiet", ...(sized ? dialog_1.section.description : null), ...props }));
|
|
80
|
+
};
|
|
63
81
|
exports.AlertDialogDescription = AlertDialogDescription;
|
|
64
82
|
/**
|
|
65
83
|
* Both buttons are the one `Button` with gui's close part as its HOST — the
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
* flattens its compound parts into the shadcn names and dresses them in the
|
|
7
7
|
* Hanzo tokens, exactly as `dialog.tsx` does for the ordinary modal.
|
|
8
8
|
*
|
|
9
|
+
* `size` gives it the record frame Dialog's `size` does (twenty-ui's
|
|
10
|
+
* AlertDialog, MIT, NOTICE): the same widths less `compact`, the same sections
|
|
11
|
+
* and scrim, from the one frame definition in dialog.tsx.
|
|
12
|
+
*
|
|
9
13
|
* `AlertDialogContent` mounts its OWN portal + overlay (so callers never wrap
|
|
10
14
|
* it) and re-applies the trigger's resolved theme inside the portal via
|
|
11
15
|
* `PortalTheme` — gui portals re-root the subtree, so React theme context does
|
|
@@ -30,7 +34,8 @@
|
|
|
30
34
|
* button is `primary` and Cancel is `outline`.
|
|
31
35
|
*/
|
|
32
36
|
import { AlertDialog as GuiAlertDialog, XStack, YStack } from '@hanzo/gui';
|
|
33
|
-
import type
|
|
37
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
38
|
+
import { type DialogSize } from './dialog.js';
|
|
34
39
|
import { type ButtonProps } from './button.js';
|
|
35
40
|
export type AlertDialogProps = ComponentProps<typeof GuiAlertDialog>;
|
|
36
41
|
declare const AlertDialog: (p: AlertDialogProps) => import("react").JSX.Element;
|
|
@@ -38,8 +43,11 @@ declare const AlertDialogTrigger: typeof GuiAlertDialog.Trigger;
|
|
|
38
43
|
declare const AlertDialogPortal: typeof GuiAlertDialog.Portal;
|
|
39
44
|
export type AlertDialogOverlayProps = ComponentProps<typeof GuiAlertDialog.Overlay>;
|
|
40
45
|
declare const AlertDialogOverlay: (props: AlertDialogOverlayProps) => import("react").JSX.Element;
|
|
41
|
-
export type AlertDialogContentProps = ComponentProps<typeof GuiAlertDialog.Content
|
|
42
|
-
|
|
46
|
+
export type AlertDialogContentProps = ComponentProps<typeof GuiAlertDialog.Content> & {
|
|
47
|
+
/** The record dialog's sizes (Dialog's, less `compact`): the same frame, scrim and sections. */
|
|
48
|
+
size?: Exclude<DialogSize, 'compact'>;
|
|
49
|
+
};
|
|
50
|
+
declare const AlertDialogContent: ({ children, size, ...props }: AlertDialogContentProps) => import("react").JSX.Element;
|
|
43
51
|
export type AlertDialogSectionProps = ComponentProps<typeof YStack> & {
|
|
44
52
|
children?: ReactNode;
|
|
45
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/alert-dialog.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/alert-dialog.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC1E,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,UAAU,CAAA;AAExE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AAMnD,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,cAAc,CAAC,CAAA;AAEpE,QAAA,MAAM,WAAW,MAAO,gBAAgB,gCAA8B,CAAA;AACtE,QAAA,MAAM,kBAAkB,EAAE,OAAO,cAAc,CAAC,OAAgC,CAAA;A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from "react/jsx-runtime";
|
|
|
8
8
|
* flattens its compound parts into the shadcn names and dresses them in the
|
|
9
9
|
* Hanzo tokens, exactly as `dialog.tsx` does for the ordinary modal.
|
|
10
10
|
*
|
|
11
|
+
* `size` gives it the record frame Dialog's `size` does (twenty-ui's
|
|
12
|
+
* AlertDialog, MIT, NOTICE): the same widths less `compact`, the same sections
|
|
13
|
+
* and scrim, from the one frame definition in dialog.tsx.
|
|
14
|
+
*
|
|
11
15
|
* `AlertDialogContent` mounts its OWN portal + overlay (so callers never wrap
|
|
12
16
|
* it) and re-applies the trigger's resolved theme inside the portal via
|
|
13
17
|
* `PortalTheme` — gui portals re-root the subtree, so React theme context does
|
|
@@ -32,6 +36,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
32
36
|
* button is `primary` and Cancel is `outline`.
|
|
33
37
|
*/
|
|
34
38
|
import { AlertDialog as GuiAlertDialog, XStack, YStack } from '@hanzo/gui';
|
|
39
|
+
import { useContext } from 'react';
|
|
40
|
+
import { Sized, frame, scrim, section } from './dialog.js';
|
|
35
41
|
import { PortalTheme, useThemeName } from '../../product/menu/portal-theme.js';
|
|
36
42
|
import { Button } from './button.js';
|
|
37
43
|
import { slot } from './slot.js';
|
|
@@ -41,14 +47,26 @@ const AlertDialog = (p) => _jsx(GuiAlertDialog, { ...p });
|
|
|
41
47
|
const AlertDialogTrigger = GuiAlertDialog.Trigger;
|
|
42
48
|
const AlertDialogPortal = GuiAlertDialog.Portal;
|
|
43
49
|
const AlertDialogOverlay = (props) => (_jsx(GuiAlertDialog.Overlay, { ...slot('alert-dialog-overlay'), bg: "rgba(0,0,0,0.5)", opacity: 0.5, ...props }));
|
|
44
|
-
const AlertDialogContent = ({ children, ...props }) => {
|
|
50
|
+
const AlertDialogContent = ({ children, size, ...props }) => {
|
|
45
51
|
const themeName = useThemeName();
|
|
46
|
-
return (_jsx(GuiAlertDialog.Portal, { children: _jsxs(PortalTheme, { name: themeName, children: [_jsx(AlertDialogOverlay, {}), _jsx(GuiAlertDialog.Content, { ...slot('alert-dialog-content'), bg: "$background", borderWidth: 1, borderColor: "$borderColor", rounded: "$5", p: PAD, gap: "$4", width: "100%", maxW: 512, ...props, children: children })] }) }));
|
|
52
|
+
return (_jsx(GuiAlertDialog.Portal, { children: _jsxs(PortalTheme, { name: themeName, children: [_jsx(AlertDialogOverlay, { ...(size ? scrim : null) }), _jsx(GuiAlertDialog.Content, { ...slot('alert-dialog-content'), ...(size ? { 'data-size': size } : null), bg: "$background", borderWidth: 1, borderColor: "$borderColor", rounded: "$5", p: PAD, gap: "$4", width: "100%", maxW: 512, ...(size ? frame(size) : null), ...props, children: _jsx(Sized.Provider, { value: size ?? null, children: children }) })] }) }));
|
|
53
|
+
};
|
|
54
|
+
const AlertDialogHeader = (props) => {
|
|
55
|
+
const sized = useContext(Sized);
|
|
56
|
+
return _jsx(YStack, { ...slot('alert-dialog-header'), gap: "$2", ...(sized ? section.header : null), ...props });
|
|
57
|
+
};
|
|
58
|
+
const AlertDialogFooter = (props) => {
|
|
59
|
+
const sized = useContext(Sized);
|
|
60
|
+
return _jsx(XStack, { ...slot('alert-dialog-footer'), gap: "$2", justify: "flex-end", items: "center", ...(sized ? section.footer : null), ...props });
|
|
61
|
+
};
|
|
62
|
+
const AlertDialogTitle = (props) => {
|
|
63
|
+
const sized = useContext(Sized);
|
|
64
|
+
return _jsx(GuiAlertDialog.Title, { ...slot('alert-dialog-title'), size: "$5", fontWeight: "600", ...(sized ? section.title : null), ...props });
|
|
65
|
+
};
|
|
66
|
+
const AlertDialogDescription = (props) => {
|
|
67
|
+
const sized = useContext(Sized);
|
|
68
|
+
return (_jsx(GuiAlertDialog.Description, { ...slot('alert-dialog-description'), size: "$2", color: "$quiet", ...(sized ? section.description : null), ...props }));
|
|
47
69
|
};
|
|
48
|
-
const AlertDialogHeader = (props) => (_jsx(YStack, { ...slot('alert-dialog-header'), gap: "$2", ...props }));
|
|
49
|
-
const AlertDialogFooter = (props) => (_jsx(XStack, { ...slot('alert-dialog-footer'), gap: "$2", justify: "flex-end", items: "center", ...props }));
|
|
50
|
-
const AlertDialogTitle = (props) => (_jsx(GuiAlertDialog.Title, { ...slot('alert-dialog-title'), size: "$5", fontWeight: "600", ...props }));
|
|
51
|
-
const AlertDialogDescription = (props) => (_jsx(GuiAlertDialog.Description, { ...slot('alert-dialog-description'), size: "$2", color: "$quiet", ...props }));
|
|
52
70
|
/**
|
|
53
71
|
* Both buttons are the one `Button` with gui's close part as its HOST — the
|
|
54
72
|
* `Button asChild` direction, the same one `Button`-as-link already takes, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.js","sourceRoot":"","sources":["../../../src/backends/gui/alert-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ
|
|
1
|
+
{"version":3,"file":"alert-dialog.js","sourceRoot":"","sources":["../../../src/backends/gui/alert-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAuC,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAmB,MAAM,UAAU,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,2EAA2E;AAC3E,MAAM,GAAG,GAAG,EAAE,CAAA;AAId,MAAM,WAAW,GAAG,CAAC,CAAmB,EAAE,EAAE,CAAC,KAAC,cAAc,OAAK,CAAC,GAAI,CAAA;AACtE,MAAM,kBAAkB,GAAkC,cAAc,CAAC,OA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,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KACpC,KAAK,GACT,CACH,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,iBAAiB,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAe,EAAE,EAAE,CAAC,CACjE,KAAC,MAAM,OAAK,IAAI,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,KAAK,KAAK,EAAE,OAAO,kBACzF,KAAC,cAAc,CAAC,MAAM,kBAAa,SAAS,YAAG,QAAQ,GAAyB,GACzE,CACV,CAAA;AAED,MAAM,iBAAiB,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAe,EAAE,EAAE,CAAC,CACjE,KAAC,MAAM,OAAK,IAAI,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,KAAK,KAAK,EAAE,OAAO,kBACzF,KAAC,cAAc,CAAC,MAAM,kBAAa,SAAS,YAAG,QAAQ,GAAyB,GACzE,CACV,CAAA;AAED,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACnB,CAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.AlertDescription = exports.AlertTitle = void 0;
|
|
5
|
+
exports.CalloutAction = CalloutAction;
|
|
5
6
|
exports.Alert = Alert;
|
|
6
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
8
|
/**
|
|
@@ -15,11 +16,25 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
15
16
|
* needs no `icon` prop and a trailing action stays in the flow. Surface, icon,
|
|
16
17
|
* title and description are four styled parts sharing one `variant` through a
|
|
17
18
|
* styled context — the surface owns the border, the other three own color.
|
|
19
|
+
*
|
|
20
|
+
* ── The callout (twenty-ui's Callout, MIT — NOTICE) ─────────────────────────
|
|
21
|
+
* Naming a `status`, a `color`, a `title`, an `action` or an `onDismiss` draws
|
|
22
|
+
* the record kit's callout: a titled card up to 512 wide (`fullWidth` lifts the
|
|
23
|
+
* cap), padding 12 12 8, 8px corners, its colour's faint ground and edge (data
|
|
24
|
+
* steps 1 and 6) and its icon in step 9 — the help circle unless one is given —
|
|
25
|
+
* a 13px medium one-line title beside a 24px dismiss, a 12px soft description
|
|
26
|
+
* indented to clear the icon, and actions at the end of a footer. The status
|
|
27
|
+
* reaches the colour through the one status map (feedback.ts), so an `error`
|
|
28
|
+
* callout and an `error` banner are the same red. Without those props an Alert
|
|
29
|
+
* renders exactly as it always has.
|
|
18
30
|
*/
|
|
19
31
|
const react_1 = require("react");
|
|
20
32
|
const gui_1 = require("@hanzo/gui");
|
|
33
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
21
34
|
const ink_1 = require("./ink.cjs");
|
|
22
35
|
const slot_1 = require("./slot.cjs");
|
|
36
|
+
const button_1 = require("./button.cjs");
|
|
37
|
+
const feedback_1 = require("./feedback.cjs");
|
|
23
38
|
const ICON = 16;
|
|
24
39
|
const ICON_GUTTER = 28;
|
|
25
40
|
const AlertContext = /* @__PURE__ */ (0, gui_1.createStyledContext)({ variant: 'default' });
|
|
@@ -92,7 +107,23 @@ const IconSlot = (0, gui_1.styled)(gui_1.SizableText, {
|
|
|
92
107
|
},
|
|
93
108
|
},
|
|
94
109
|
});
|
|
95
|
-
|
|
110
|
+
/** A callout's own action: a small ghost button at regular weight. */
|
|
111
|
+
function CalloutAction(props) {
|
|
112
|
+
return (0, jsx_runtime_1.jsx)(button_1.Button, { ...(0, slot_1.slot)('alert-action'), variant: "ghost", size: "xs", fontWeight: "400", ...props });
|
|
113
|
+
}
|
|
114
|
+
/** The callout icon: data step 9 of its hue (its ground and edge, steps 1 and 6, are the status map's). */
|
|
115
|
+
const step9 = (hue) => `var(--data-${hue}-9)`;
|
|
116
|
+
function Callout({ status, color, title, description, icon, action, onDismiss, closeLabel = 'Dismiss', fullWidth = false, children, ...props }) {
|
|
117
|
+
const hue = (0, feedback_1.colorOf)(status ?? 'info', color);
|
|
118
|
+
const lead = icon === undefined ? (0, jsx_runtime_1.jsx)(lucide_icons_2_1.CircleHelp, { size: 16, color: step9(hue) }) : icon;
|
|
119
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack
|
|
120
|
+
// A callout that is not an alarm is a note: read where it sits, not
|
|
121
|
+
// announced. gui's role union is React Native's and lacks `note`.
|
|
122
|
+
, { ...{ role: status === 'error' || status === 'warning' ? 'alert' : 'note' }, ...(0, slot_1.slot)('alert'), "data-variant": "callout", "data-color": hue, width: "100%", maxW: fullWidth ? undefined : 512, gap: "$2", pt: "$3", px: "$3", pb: "$2", rounded: "$3", borderWidth: 1, borderColor: feedback_1.STATUS_PAINT[hue].edge, bg: feedback_1.STATUS_PAINT[hue].ground, ...props, children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { ...(0, slot_1.slot)('alert-header'), items: "center", gap: "$2", minH: 24, children: [lead ? ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('alert-icon'), shrink: 0, width: 16, height: 16, items: "center", justify: "center", children: lead })) : null, (0, jsx_runtime_1.jsx)(gui_1.SizableText, { ...(0, slot_1.slot)('alert-title'), flex: 1, minW: 0, size: "$2", lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, children: title }), onDismiss ? ((0, jsx_runtime_1.jsx)(button_1.Button, { ...(0, slot_1.slot)('alert-dismiss'), variant: "ghost", size: "icon-xs", emphasis: "subtle", "aria-label": closeLabel, onPress: onDismiss, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.X, {}) })) : null] }), description || children ? ((0, jsx_runtime_1.jsxs)(gui_1.SizableText, { ...(0, slot_1.slot)('alert-description'), render: "div", size: "$1", lineHeight: 17, color: "$hint", pl: lead ? 24 : 0, pb: action ? 0 : '$2', children: [description, children] })) : null, action ? ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('alert-footer'), justify: "flex-end", gap: "$2", children: action })) : null] }));
|
|
123
|
+
}
|
|
124
|
+
function Alert({ variant = 'default', status, color, title, description, icon: lead, action, onDismiss, closeLabel, fullWidth, children, ...props }) {
|
|
125
|
+
if ([status, color, title, description, lead, action, onDismiss].some((v) => v !== undefined))
|
|
126
|
+
return ((0, jsx_runtime_1.jsx)(Callout, { status: status, color: color, title: title, description: description, icon: lead, action: action, onDismiss: onDismiss, closeLabel: closeLabel, fullWidth: fullWidth, ...props, children: children }));
|
|
96
127
|
const resolved = variant ?? 'default';
|
|
97
128
|
const items = react_1.Children.toArray(children);
|
|
98
129
|
const head = items[0];
|
|
@@ -9,8 +9,21 @@
|
|
|
9
9
|
* needs no `icon` prop and a trailing action stays in the flow. Surface, icon,
|
|
10
10
|
* title and description are four styled parts sharing one `variant` through a
|
|
11
11
|
* styled context — the surface owns the border, the other three own color.
|
|
12
|
+
*
|
|
13
|
+
* ── The callout (twenty-ui's Callout, MIT — NOTICE) ─────────────────────────
|
|
14
|
+
* Naming a `status`, a `color`, a `title`, an `action` or an `onDismiss` draws
|
|
15
|
+
* the record kit's callout: a titled card up to 512 wide (`fullWidth` lifts the
|
|
16
|
+
* cap), padding 12 12 8, 8px corners, its colour's faint ground and edge (data
|
|
17
|
+
* steps 1 and 6) and its icon in step 9 — the help circle unless one is given —
|
|
18
|
+
* a 13px medium one-line title beside a 24px dismiss, a 12px soft description
|
|
19
|
+
* indented to clear the icon, and actions at the end of a footer. The status
|
|
20
|
+
* reaches the colour through the one status map (feedback.ts), so an `error`
|
|
21
|
+
* callout and an `error` banner are the same red. Without those props an Alert
|
|
22
|
+
* renders exactly as it always has.
|
|
12
23
|
*/
|
|
13
|
-
import { type ComponentProps } from 'react';
|
|
24
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
25
|
+
import { type ButtonProps } from './button.js';
|
|
26
|
+
import { type FeedbackColor, type FeedbackStatus } from './feedback.js';
|
|
14
27
|
export type AlertVariant = 'default' | 'destructive';
|
|
15
28
|
declare const AlertFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, any, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
16
29
|
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
@@ -27,12 +40,32 @@ declare const AlertDescriptionText: import("@hanzogui/web").GuiComponent<import(
|
|
|
27
40
|
unstyled?: boolean | undefined;
|
|
28
41
|
variant?: "default" | "destructive" | undefined;
|
|
29
42
|
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
30
|
-
export type AlertProps = Omit<ComponentProps<typeof AlertFrame>, 'variant'> & {
|
|
43
|
+
export type AlertProps = Omit<ComponentProps<typeof AlertFrame>, 'variant' | 'color' | 'title'> & {
|
|
31
44
|
variant?: AlertVariant | null;
|
|
45
|
+
/** What the callout reports; picks its colour through the status map. */
|
|
46
|
+
status?: FeedbackStatus;
|
|
47
|
+
/** The colour, when it is not the status's. */
|
|
48
|
+
color?: FeedbackColor;
|
|
49
|
+
/** The callout's title (one line). */
|
|
50
|
+
title?: ReactNode;
|
|
51
|
+
/** The line under the title. */
|
|
52
|
+
description?: ReactNode;
|
|
53
|
+
/** The leading icon; the help circle by default. `null` draws none. */
|
|
54
|
+
icon?: ReactNode | null;
|
|
55
|
+
/** The footer's controls — usually `<CalloutAction>`s. */
|
|
56
|
+
action?: ReactNode;
|
|
57
|
+
/** Offer a dismiss button. */
|
|
58
|
+
onDismiss?: () => void;
|
|
59
|
+
/** The dismiss button's name. */
|
|
60
|
+
closeLabel?: string;
|
|
61
|
+
/** Lift the 512px cap. */
|
|
62
|
+
fullWidth?: boolean;
|
|
32
63
|
};
|
|
64
|
+
/** A callout's own action: a small ghost button at regular weight. */
|
|
65
|
+
export declare function CalloutAction(props: Omit<ButtonProps, 'variant' | 'size'>): import("react").JSX.Element;
|
|
33
66
|
export type AlertTitleProps = ComponentProps<typeof AlertTitleText>;
|
|
34
67
|
export type AlertDescriptionProps = ComponentProps<typeof AlertDescriptionText>;
|
|
35
|
-
declare function Alert({ variant, children, ...props }: AlertProps): import("react").JSX.Element;
|
|
68
|
+
declare function Alert({ variant, status, color, title, description, icon: lead, action, onDismiss, closeLabel, fullWidth, children, ...props }: AlertProps): import("react").JSX.Element;
|
|
36
69
|
declare const AlertTitle: (props: AlertTitleProps) => import("react").JSX.Element;
|
|
37
70
|
declare const AlertDescription: (props: AlertDescriptionProps) => import("react").JSX.Element;
|
|
38
71
|
export { Alert, AlertTitle, AlertDescription };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/alert.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/alert.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAA4B,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAKrF,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAyB,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3F,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;AAOpD,QAAA,MAAM,UAAU;;;;8CAmBd,CAAA;AAEF,QAAA,MAAM,cAAc;;;;8CAgBlB,CAAA;AAGF,QAAA,MAAM,oBAAoB;;;;8CAaxB,CAAA;AAyBF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,EAAE,SAAS,GAAG,OA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xs } from "react/jsx-runtime";
|
|
|
11
11
|
* needs no `icon` prop and a trailing action stays in the flow. Surface, icon,
|
|
12
12
|
* title and description are four styled parts sharing one `variant` through a
|
|
13
13
|
* styled context — the surface owns the border, the other three own color.
|
|
14
|
+
*
|
|
15
|
+
* ── The callout (twenty-ui's Callout, MIT — NOTICE) ─────────────────────────
|
|
16
|
+
* Naming a `status`, a `color`, a `title`, an `action` or an `onDismiss` draws
|
|
17
|
+
* the record kit's callout: a titled card up to 512 wide (`fullWidth` lifts the
|
|
18
|
+
* cap), padding 12 12 8, 8px corners, its colour's faint ground and edge (data
|
|
19
|
+
* steps 1 and 6) and its icon in step 9 — the help circle unless one is given —
|
|
20
|
+
* a 13px medium one-line title beside a 24px dismiss, a 12px soft description
|
|
21
|
+
* indented to clear the icon, and actions at the end of a footer. The status
|
|
22
|
+
* reaches the colour through the one status map (feedback.ts), so an `error`
|
|
23
|
+
* callout and an `error` banner are the same red. Without those props an Alert
|
|
24
|
+
* renders exactly as it always has.
|
|
14
25
|
*/
|
|
15
26
|
import { Children, isValidElement } from 'react';
|
|
16
|
-
import { SizableText, YStack, createStyledContext, styled } from '@hanzo/gui';
|
|
27
|
+
import { SizableText, XStack, YStack, createStyledContext, styled } from '@hanzo/gui';
|
|
28
|
+
import { CircleHelp, X } from '@hanzogui/lucide-icons-2';
|
|
17
29
|
import { ink } from './ink.js';
|
|
18
30
|
import { slot } from './slot.js';
|
|
31
|
+
import { Button } from './button.js';
|
|
32
|
+
import { colorOf, STATUS_PAINT } from './feedback.js';
|
|
19
33
|
const ICON = 16;
|
|
20
34
|
const ICON_GUTTER = 28;
|
|
21
35
|
const AlertContext = /* @__PURE__ */ createStyledContext({ variant: 'default' });
|
|
@@ -88,7 +102,23 @@ const IconSlot = styled(SizableText, {
|
|
|
88
102
|
},
|
|
89
103
|
},
|
|
90
104
|
});
|
|
91
|
-
|
|
105
|
+
/** A callout's own action: a small ghost button at regular weight. */
|
|
106
|
+
export function CalloutAction(props) {
|
|
107
|
+
return _jsx(Button, { ...slot('alert-action'), variant: "ghost", size: "xs", fontWeight: "400", ...props });
|
|
108
|
+
}
|
|
109
|
+
/** The callout icon: data step 9 of its hue (its ground and edge, steps 1 and 6, are the status map's). */
|
|
110
|
+
const step9 = (hue) => `var(--data-${hue}-9)`;
|
|
111
|
+
function Callout({ status, color, title, description, icon, action, onDismiss, closeLabel = 'Dismiss', fullWidth = false, children, ...props }) {
|
|
112
|
+
const hue = colorOf(status ?? 'info', color);
|
|
113
|
+
const lead = icon === undefined ? _jsx(CircleHelp, { size: 16, color: step9(hue) }) : icon;
|
|
114
|
+
return (_jsxs(YStack
|
|
115
|
+
// A callout that is not an alarm is a note: read where it sits, not
|
|
116
|
+
// announced. gui's role union is React Native's and lacks `note`.
|
|
117
|
+
, { ...{ role: status === 'error' || status === 'warning' ? 'alert' : 'note' }, ...slot('alert'), "data-variant": "callout", "data-color": hue, width: "100%", maxW: fullWidth ? undefined : 512, gap: "$2", pt: "$3", px: "$3", pb: "$2", rounded: "$3", borderWidth: 1, borderColor: STATUS_PAINT[hue].edge, bg: STATUS_PAINT[hue].ground, ...props, children: [_jsxs(XStack, { ...slot('alert-header'), items: "center", gap: "$2", minH: 24, children: [lead ? (_jsx(XStack, { ...slot('alert-icon'), shrink: 0, width: 16, height: 16, items: "center", justify: "center", children: lead })) : null, _jsx(SizableText, { ...slot('alert-title'), flex: 1, minW: 0, size: "$2", lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, children: title }), onDismiss ? (_jsx(Button, { ...slot('alert-dismiss'), variant: "ghost", size: "icon-xs", emphasis: "subtle", "aria-label": closeLabel, onPress: onDismiss, children: _jsx(X, {}) })) : null] }), description || children ? (_jsxs(SizableText, { ...slot('alert-description'), render: "div", size: "$1", lineHeight: 17, color: "$hint", pl: lead ? 24 : 0, pb: action ? 0 : '$2', children: [description, children] })) : null, action ? (_jsx(XStack, { ...slot('alert-footer'), justify: "flex-end", gap: "$2", children: action })) : null] }));
|
|
118
|
+
}
|
|
119
|
+
function Alert({ variant = 'default', status, color, title, description, icon: lead, action, onDismiss, closeLabel, fullWidth, children, ...props }) {
|
|
120
|
+
if ([status, color, title, description, lead, action, onDismiss].some((v) => v !== undefined))
|
|
121
|
+
return (_jsx(Callout, { status: status, color: color, title: title, description: description, icon: lead, action: action, onDismiss: onDismiss, closeLabel: closeLabel, fullWidth: fullWidth, ...props, children: children }));
|
|
92
122
|
const resolved = variant ?? 'default';
|
|
93
123
|
const items = Children.toArray(children);
|
|
94
124
|
const head = items[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../src/backends/gui/alert.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ
|
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../src/backends/gui/alert.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAuC,MAAM,OAAO,CAAA;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACrF,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,YAAY,EAA2C,MAAM,YAAY,CAAA;AAI3F,MAAM,IAAI,GAAG,EAAE,CAAA;AACf,MAAM,WAAW,GAAG,EAAE,CAAA;AAEtB,MAAM,YAAY,GAAG,eAAe,CAAC,mBAAmB,CAA4B,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAA;AAE3G,MAAM,UAAU,GAAG,MA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I,CACnE,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AvatarGroup = AvatarGroup;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* AvatarGroup — overlapping avatars with a "+N" for the rest: an event's
|
|
8
|
+
* attendees, a thread's participants, who has a record open.
|
|
9
|
+
*
|
|
10
|
+
* Each avatar after the first pulls `overlapOffset` over its neighbour on the
|
|
11
|
+
* reading direction's start side (`marginStart`), so the edge item never carries
|
|
12
|
+
* a negative margin in either direction. `overlap` decides which neighbour is on
|
|
13
|
+
* top. A server-side `total` larger than the list supplied still counts the
|
|
14
|
+
* rest. With nothing to show it renders nothing.
|
|
15
|
+
*
|
|
16
|
+
* Re-expressed from twenty-ui's AvatarGroup (MIT, see NOTICE): four visible,
|
|
17
|
+
* a 3px overlap, the overflow box on the hover rung behind a ground-coloured
|
|
18
|
+
* edge, 12px medium quiet text.
|
|
19
|
+
*/
|
|
20
|
+
const gui_1 = require("@hanzo/gui");
|
|
21
|
+
const slot_1 = require("./slot.cjs");
|
|
22
|
+
function AvatarGroup({ avatars, maxVisible = 4, total, renderOverflow, overflowShape = 'square', overlap = 'right', overlapOffset = 3, ...props }) {
|
|
23
|
+
const shown = avatars.slice(0, Math.max(0, maxVisible));
|
|
24
|
+
const hidden = Math.max(0, (total ?? avatars.length) - shown.length);
|
|
25
|
+
if (shown.length === 0 && hidden === 0)
|
|
26
|
+
return null;
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { ...(0, slot_1.slot)('avatar-group'), items: "center", self: "flex-start", ...props, children: [shown.map((avatar, i) => ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('avatar-group-item'), ...(i > 0 ? { marginStart: -overlapOffset } : null), z: overlap === 'right' ? i : shown.length - i, position: "relative", children: avatar }, i))), hidden > 0 ? ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('avatar-group-overflow'), ...(shown.length > 0 ? { marginStart: -overlapOffset } : null), z: overlap === 'right' ? shown.length : 0, position: "relative", self: "stretch", items: "center", px: "$1", bg: "$hover", borderWidth: 1, borderColor: "$background", rounded: overflowShape === 'circle' ? '$3' : '$xs', children: renderOverflow ? (renderOverflow(hidden)) : ((0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$1", lineHeight: 13, fontWeight: "500", color: "$aside", children: `+${hidden}` })) })) : null] }));
|
|
28
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AvatarGroup — overlapping avatars with a "+N" for the rest: an event's
|
|
3
|
+
* attendees, a thread's participants, who has a record open.
|
|
4
|
+
*
|
|
5
|
+
* Each avatar after the first pulls `overlapOffset` over its neighbour on the
|
|
6
|
+
* reading direction's start side (`marginStart`), so the edge item never carries
|
|
7
|
+
* a negative margin in either direction. `overlap` decides which neighbour is on
|
|
8
|
+
* top. A server-side `total` larger than the list supplied still counts the
|
|
9
|
+
* rest. With nothing to show it renders nothing.
|
|
10
|
+
*
|
|
11
|
+
* Re-expressed from twenty-ui's AvatarGroup (MIT, see NOTICE): four visible,
|
|
12
|
+
* a 3px overlap, the overflow box on the hover rung behind a ground-coloured
|
|
13
|
+
* edge, 12px medium quiet text.
|
|
14
|
+
*/
|
|
15
|
+
import { XStack } from '@hanzo/gui';
|
|
16
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
17
|
+
import type { AvatarShape } from './avatar.js';
|
|
18
|
+
export type AvatarGroupProps = Omit<ComponentProps<typeof XStack>, 'children'> & {
|
|
19
|
+
/** The avatars, in order. */
|
|
20
|
+
avatars: ReactNode[];
|
|
21
|
+
/** How many are drawn before the rest become "+N". */
|
|
22
|
+
maxVisible?: number;
|
|
23
|
+
/** Everyone, when the list supplied is a page of a larger set. */
|
|
24
|
+
total?: number;
|
|
25
|
+
/** Draw the overflow yourself, given how many are hidden. */
|
|
26
|
+
renderOverflow?: (hidden: number) => ReactNode;
|
|
27
|
+
overflowShape?: AvatarShape;
|
|
28
|
+
/** Which neighbour is on top: `right` draws each later avatar over the one before. */
|
|
29
|
+
overlap?: 'right' | 'left';
|
|
30
|
+
overlapOffset?: number;
|
|
31
|
+
};
|
|
32
|
+
export declare function AvatarGroup({ avatars, maxVisible, total, renderOverflow, overflowShape, overlap, overlapOffset, ...props }: AvatarGroupProps): import("react").JSX.Element | null;
|
|
33
|
+
//# sourceMappingURL=avatar-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar-group.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/avatar-group.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAe,MAAM,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IAC/E,6BAA6B;IAC7B,OAAO,EAAE,SAAS,EAAE,CAAA;IACpB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,SAAS,CAAA;IAC9C,aAAa,CAAC,EAAE,WAAW,CAAA;IAC3B,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,UAAc,EACd,KAAK,EACL,cAAc,EACd,aAAwB,EACxB,OAAiB,EACjB,aAAiB,EACjB,GAAG,KAAK,EACT,EAAE,gBAAgB,sCA2ClB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* AvatarGroup — overlapping avatars with a "+N" for the rest: an event's
|
|
5
|
+
* attendees, a thread's participants, who has a record open.
|
|
6
|
+
*
|
|
7
|
+
* Each avatar after the first pulls `overlapOffset` over its neighbour on the
|
|
8
|
+
* reading direction's start side (`marginStart`), so the edge item never carries
|
|
9
|
+
* a negative margin in either direction. `overlap` decides which neighbour is on
|
|
10
|
+
* top. A server-side `total` larger than the list supplied still counts the
|
|
11
|
+
* rest. With nothing to show it renders nothing.
|
|
12
|
+
*
|
|
13
|
+
* Re-expressed from twenty-ui's AvatarGroup (MIT, see NOTICE): four visible,
|
|
14
|
+
* a 3px overlap, the overflow box on the hover rung behind a ground-coloured
|
|
15
|
+
* edge, 12px medium quiet text.
|
|
16
|
+
*/
|
|
17
|
+
import { SizableText, XStack } from '@hanzo/gui';
|
|
18
|
+
import { slot } from './slot.js';
|
|
19
|
+
export function AvatarGroup({ avatars, maxVisible = 4, total, renderOverflow, overflowShape = 'square', overlap = 'right', overlapOffset = 3, ...props }) {
|
|
20
|
+
const shown = avatars.slice(0, Math.max(0, maxVisible));
|
|
21
|
+
const hidden = Math.max(0, (total ?? avatars.length) - shown.length);
|
|
22
|
+
if (shown.length === 0 && hidden === 0)
|
|
23
|
+
return null;
|
|
24
|
+
return (_jsxs(XStack, { ...slot('avatar-group'), items: "center", self: "flex-start", ...props, children: [shown.map((avatar, i) => (_jsx(XStack, { ...slot('avatar-group-item'), ...(i > 0 ? { marginStart: -overlapOffset } : null), z: overlap === 'right' ? i : shown.length - i, position: "relative", children: avatar }, i))), hidden > 0 ? (_jsx(XStack, { ...slot('avatar-group-overflow'), ...(shown.length > 0 ? { marginStart: -overlapOffset } : null), z: overlap === 'right' ? shown.length : 0, position: "relative", self: "stretch", items: "center", px: "$1", bg: "$hover", borderWidth: 1, borderColor: "$background", rounded: overflowShape === 'circle' ? '$3' : '$xs', children: renderOverflow ? (renderOverflow(hidden)) : (_jsx(SizableText, { size: "$1", lineHeight: 13, fontWeight: "500", color: "$aside", children: `+${hidden}` })) })) : null] }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=avatar-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar-group.js","sourceRoot":"","sources":["../../../src/backends/gui/avatar-group.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAkB7B,MAAM,UAAU,WAAW,CAAC,EAC1B,OAAO,EACP,UAAU,GAAG,CAAC,EACd,KAAK,EACL,cAAc,EACd,aAAa,GAAG,QAAQ,EACxB,OAAO,GAAG,OAAO,EACjB,aAAa,GAAG,CAAC,EACjB,GAAG,KAAK,EACS;IACjB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAA;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;IACpE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAEnD,OAAO,CACL,MAAC,MAAM,OAAK,IAAI,CAAC,cAAc,CAAC,EAA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,YACnE,IAAI,MAAM,EAAE,GACD,CACf,GACM,CACV,CAAC,CAAC,CAAC,IAAI,IACD,CACV,CAAA;AACH,CAAC"}
|
|
@@ -1,17 +1,67 @@
|
|
|
1
1
|
'use client';"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.AvatarFallback = exports.AvatarImage = exports.Avatar = void 0;
|
|
4
|
+
exports.AvatarFallback = exports.AvatarImage = exports.Avatar = exports.initialOf = void 0;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
/**
|
|
7
|
-
* Avatar —
|
|
7
|
+
* Avatar — an image with an initial or an icon behind it.
|
|
8
8
|
*
|
|
9
9
|
* @hanzogui/avatar owns the load/error state machine and the fallback delay, so
|
|
10
10
|
* this only names the three parts and dresses them in tokens.
|
|
11
|
+
*
|
|
12
|
+
* Two looks, one component. With no `size`, it is the account avatar every
|
|
13
|
+
* Hanzo surface already draws: a 32px circle, its fallback on the edge rung.
|
|
14
|
+
* With a `size` it is a RECORD avatar (re-expressed from twenty-ui's Avatar,
|
|
15
|
+
* MIT, see NOTICE): xs 12 · sm 14 · md 16 · lg 24 · xl 40, square by default
|
|
16
|
+
* (2px), rounded (4px) or a circle, and its initial drawn in the record's own
|
|
17
|
+
* hue — twenty-ui's string hash over `colorSeed` (a record id, so a rename keeps
|
|
18
|
+
* the colour) or `name`, the hue's step 12 on step 4 (soft) or on step 5 inside
|
|
19
|
+
* a step 6 edge (outline). Given `src` or `name` directly it draws its own
|
|
20
|
+
* image and fallback; given children it is the compound it always was.
|
|
11
21
|
*/
|
|
12
22
|
const gui_1 = require("@hanzo/gui");
|
|
23
|
+
const data_1 = require("@hanzo/tokens/data");
|
|
24
|
+
const react_1 = require("react");
|
|
25
|
+
const hue_1 = require("./hue.cjs");
|
|
26
|
+
const press_1 = require("./press.cjs");
|
|
13
27
|
const SIZE = 32;
|
|
14
|
-
|
|
28
|
+
/**
|
|
29
|
+
* The record sizes: box, and the initial's rung. xs and sm sit on Hanzo's text
|
|
30
|
+
* floor, 12px (design's --text-floor): twenty-ui draws 8 and 10px initials there,
|
|
31
|
+
* which Hanzo does not render. The box clips, so the glyph never spills.
|
|
32
|
+
*/
|
|
33
|
+
const RECORD = {
|
|
34
|
+
xs: { box: 12, font: '$1' },
|
|
35
|
+
sm: { box: 14, font: '$1' },
|
|
36
|
+
md: { box: 16, font: '$1' },
|
|
37
|
+
lg: { box: 24, font: '$2' },
|
|
38
|
+
xl: { box: 40, font: '$4' },
|
|
39
|
+
};
|
|
40
|
+
const RADIUS = { square: '$2xs', rounded: '$xs', circle: '$10' };
|
|
41
|
+
/** The first character of the trimmed name, uppercased; `-` with none. */
|
|
42
|
+
const initialOf = (name) => {
|
|
43
|
+
const first = [...(name ?? '').trim()][0];
|
|
44
|
+
return first ? first.toLocaleUpperCase() : '-';
|
|
45
|
+
};
|
|
46
|
+
exports.initialOf = initialOf;
|
|
47
|
+
const Avatar = ({ size, shape, src, name, colorSeed, icon, variant = 'soft', ring = false, pulsing = false, onPress, alt, children, style, ...props }) => {
|
|
48
|
+
const record = typeof size === 'string' && size in RECORD ? RECORD[size] : null;
|
|
49
|
+
// A box gui's Avatar takes directly: the account look at that size.
|
|
50
|
+
const box = record?.box ?? (size != null && !record ? size : SIZE);
|
|
51
|
+
const corner = RADIUS[shape ?? (record ? 'square' : 'circle')];
|
|
52
|
+
const seed = colorSeed ?? name ?? '';
|
|
53
|
+
const { style: hueStyle, tone } = (0, hue_1.useTone)((0, data_1.hueOf)(seed), [4, 5, 6, 12]);
|
|
54
|
+
const own = children == null && (src != null || name != null || icon != null);
|
|
55
|
+
const trimmed = (name ?? '').trim();
|
|
56
|
+
const fallback = own ? ((0, jsx_runtime_1.jsx)(AvatarFallback, { bg: icon ? 'transparent' : trimmed ? tone(variant === 'outline' ? 5 : 4) : '$hover', ...(variant === 'outline' && trimmed && !icon ? { borderWidth: 1, borderColor: tone(6) } : null), rounded: corner, children: icon ? ((0, react_1.isValidElement)(icon) && icon.props.size == null
|
|
57
|
+
? (0, react_1.cloneElement)(icon, { size: box })
|
|
58
|
+
: icon) : ((0, jsx_runtime_1.jsx)(gui_1.SizableText, { fontSize: (record?.font ?? '$2'), lineHeight: box, fontWeight: "500", color: trimmed ? tone(12) : '$hint', select: "none", children: (0, exports.initialOf)(name) })) })) : null;
|
|
59
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.Avatar, { "data-slot": "avatar", ...(record ? { 'data-size': size } : null), ...(onPress ? (0, press_1.press)(onPress) : null), circular: corner === '$10', size: box, ...(record || shape ? { rounded: corner } : null), shrink: 0, overflow: "hidden", ...(onPress ? { cursor: 'pointer', hoverStyle: { outlineColor: '$hover', outlineWidth: 4, outlineStyle: 'solid' }, focusVisibleStyle: press_1.RING } : null), ...(pulsing ? { 'data-motion': 'pulse' } : null), style: {
|
|
60
|
+
...(own && trimmed ? hueStyle : null),
|
|
61
|
+
...(ring ? { boxShadow: '0 0 0 1px var(--border), 0 0 0 3px var(--background)' } : null),
|
|
62
|
+
...style,
|
|
63
|
+
}, ...props, children: [own && src ? (0, jsx_runtime_1.jsx)(AvatarImage, { src: src, ...(alt ? { alt } : null) }) : null, fallback, children] }));
|
|
64
|
+
};
|
|
15
65
|
exports.Avatar = Avatar;
|
|
16
66
|
const AvatarImage = (props) => ((0, jsx_runtime_1.jsx)(gui_1.Avatar.Image, { "data-slot": "avatar-image", width: "100%", height: "100%", ...props }));
|
|
17
67
|
exports.AvatarImage = AvatarImage;
|