@funstack/ui 0.1.0-alpha.15 → 0.1.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -1
- package/dist/accordion/accordion-item.d.mts +19 -0
- package/dist/accordion/accordion-item.d.mts.map +1 -1
- package/dist/accordion/accordion-item.mjs +2 -0
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.d.mts +16 -0
- package/dist/accordion/accordion-panel.d.mts.map +1 -1
- package/dist/accordion/accordion-panel.mjs +2 -0
- package/dist/accordion/accordion-panel.mjs.map +1 -1
- package/dist/accordion/accordion-root.d.mts +36 -2
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +2 -0
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.d.mts +9 -0
- package/dist/accordion/accordion-trigger.d.mts.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +2 -0
- package/dist/accordion/accordion-trigger.mjs.map +1 -1
- package/dist/accordion/index.d.mts +2 -0
- package/dist/accordion/index.d.mts.map +1 -1
- package/dist/accordion/index.mjs +2 -0
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/bin/skill-installer.d.mts +1 -0
- package/dist/bin/skill-installer.mjs +12 -0
- package/dist/bin/skill-installer.mjs.map +1 -0
- package/dist/button/button.d.mts +25 -7
- package/dist/button/button.d.mts.map +1 -1
- package/dist/button/button.mjs +2 -0
- package/dist/button/button.mjs.map +1 -1
- package/dist/checkbox/checkbox.d.mts +25 -3
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +2 -0
- package/dist/checkbox/checkbox.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts +15 -0
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.d.mts +10 -0
- package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.d.mts +19 -1
- package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +31 -4
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
- package/dist/checkbox-group/index.d.mts +2 -0
- package/dist/checkbox-group/index.d.mts.map +1 -1
- package/dist/checkbox-group/index.mjs +2 -0
- package/dist/checkbox-group/index.mjs.map +1 -1
- package/dist/combobox/combobox-clear.d.mts +18 -0
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +2 -0
- package/dist/combobox/combobox-clear.mjs.map +1 -1
- package/dist/combobox/combobox-group.d.mts +49 -1
- package/dist/combobox/combobox-group.d.mts.map +1 -1
- package/dist/combobox/combobox-group.mjs +11 -1
- package/dist/combobox/combobox-group.mjs.map +1 -1
- package/dist/combobox/combobox-input.d.mts +11 -0
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +2 -0
- package/dist/combobox/combobox-input.mjs.map +1 -1
- package/dist/combobox/combobox-label.d.mts +16 -0
- package/dist/combobox/combobox-label.d.mts.map +1 -1
- package/dist/combobox/combobox-label.mjs +2 -0
- package/dist/combobox/combobox-label.mjs.map +1 -1
- package/dist/combobox/combobox-list.d.mts +14 -0
- package/dist/combobox/combobox-list.d.mts.map +1 -1
- package/dist/combobox/combobox-list.mjs +2 -0
- package/dist/combobox/combobox-list.mjs.map +1 -1
- package/dist/combobox/combobox-option.d.mts +25 -3
- package/dist/combobox/combobox-option.d.mts.map +1 -1
- package/dist/combobox/combobox-option.mjs +2 -0
- package/dist/combobox/combobox-option.mjs.map +1 -1
- package/dist/combobox/combobox-popup.d.mts +16 -0
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +2 -0
- package/dist/combobox/combobox-popup.mjs.map +1 -1
- package/dist/combobox/combobox-root.d.mts +49 -12
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +2 -0
- package/dist/combobox/combobox-root.mjs.map +1 -1
- package/dist/combobox/combobox-trigger.d.mts +16 -0
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +2 -0
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/combobox/index.d.mts +2 -0
- package/dist/combobox/index.d.mts.map +1 -1
- package/dist/combobox/index.mjs +2 -0
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/csp/csp-provider.d.mts +8 -0
- package/dist/csp/csp-provider.d.mts.map +1 -1
- package/dist/csp/csp-provider.mjs +2 -0
- package/dist/csp/csp-provider.mjs.map +1 -1
- package/dist/csp/style-hashes.d.mts +2 -0
- package/dist/csp/style-hashes.d.mts.map +1 -1
- package/dist/csp/style-hashes.mjs +2 -0
- package/dist/csp/style-hashes.mjs.map +1 -1
- package/dist/dialog/dialog-close.d.mts +18 -0
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +2 -0
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-description.d.mts +12 -0
- package/dist/dialog/dialog-description.d.mts.map +1 -1
- package/dist/dialog/dialog-description.mjs +2 -0
- package/dist/dialog/dialog-description.mjs.map +1 -1
- package/dist/dialog/dialog-form.d.mts +18 -1
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +2 -0
- package/dist/dialog/dialog-form.mjs.map +1 -1
- package/dist/dialog/dialog-popup.d.mts +25 -4
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +2 -0
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts +15 -1
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +2 -0
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-title.d.mts +11 -0
- package/dist/dialog/dialog-title.d.mts.map +1 -1
- package/dist/dialog/dialog-title.mjs +2 -0
- package/dist/dialog/dialog-title.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +16 -0
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +2 -0
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/dialog/index.d.mts +2 -0
- package/dist/dialog/index.d.mts.map +1 -1
- package/dist/dialog/index.mjs +2 -0
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/docs/components/accordion.md +426 -0
- package/dist/docs/components/button.md +464 -0
- package/dist/docs/components/checkbox-group.md +474 -0
- package/dist/docs/components/checkbox.md +373 -0
- package/dist/docs/components/combobox.md +635 -0
- package/dist/docs/components/context-menu.md +524 -0
- package/dist/docs/components/dialog.md +686 -0
- package/dist/docs/components/field.md +587 -0
- package/dist/docs/components/menu.md +589 -0
- package/dist/docs/components/meter.md +313 -0
- package/dist/docs/components/number-field.md +528 -0
- package/dist/docs/components/popover.md +591 -0
- package/dist/docs/components/progress.md +450 -0
- package/dist/docs/components/radio-group.md +457 -0
- package/dist/docs/components/select.md +662 -0
- package/dist/docs/components/slider.md +558 -0
- package/dist/docs/components/switch.md +311 -0
- package/dist/docs/components/tabs.md +473 -0
- package/dist/docs/components/toast.md +576 -0
- package/dist/docs/components/toggle-group.md +341 -0
- package/dist/docs/components/toggle.md +245 -0
- package/dist/docs/components/toolbar.md +389 -0
- package/dist/docs/components/tooltip.md +494 -0
- package/dist/docs/concepts/action-props.md +251 -0
- package/dist/docs/concepts/ai-agents.md +56 -0
- package/dist/docs/concepts/browser-owned-state.md +118 -0
- package/dist/docs/concepts/content-security-policy.md +69 -0
- package/dist/docs/concepts/experimental.md +36 -0
- package/dist/docs/concepts/pending-and-optimistic.md +250 -0
- package/dist/docs/concepts/server-components.md +118 -0
- package/dist/docs/concepts/suspense.md +124 -0
- package/dist/docs/concepts/transitions.md +118 -0
- package/dist/docs/getting-started.md +115 -0
- package/dist/docs/index.md +181 -0
- package/dist/docs/roadmap.md +74 -0
- package/dist/docs/why.md +100 -0
- package/dist/field/field-control.d.mts +26 -3
- package/dist/field/field-control.d.mts.map +1 -1
- package/dist/field/field-control.mjs +2 -0
- package/dist/field/field-control.mjs.map +1 -1
- package/dist/field/field-description.d.mts +11 -0
- package/dist/field/field-description.d.mts.map +1 -1
- package/dist/field/field-description.mjs +2 -0
- package/dist/field/field-description.mjs.map +1 -1
- package/dist/field/field-error.d.mts +14 -2
- package/dist/field/field-error.d.mts.map +1 -1
- package/dist/field/field-error.mjs +2 -0
- package/dist/field/field-error.mjs.map +1 -1
- package/dist/field/field-label.d.mts +10 -0
- package/dist/field/field-label.d.mts.map +1 -1
- package/dist/field/field-label.mjs +2 -0
- package/dist/field/field-label.mjs.map +1 -1
- package/dist/field/field-root.d.mts +21 -2
- package/dist/field/field-root.d.mts.map +1 -1
- package/dist/field/field-root.mjs +2 -0
- package/dist/field/field-root.mjs.map +1 -1
- package/dist/field/index.d.mts +9 -0
- package/dist/field/index.d.mts.map +1 -1
- package/dist/field/index.mjs +9 -0
- package/dist/field/index.mjs.map +1 -1
- package/dist/form/form-root.d.mts +17 -1
- package/dist/form/form-root.d.mts.map +1 -1
- package/dist/form/form-root.mjs +2 -0
- package/dist/form/form-root.mjs.map +1 -1
- package/dist/form/form-submit.d.mts +18 -0
- package/dist/form/form-submit.d.mts.map +1 -1
- package/dist/form/form-submit.mjs +2 -0
- package/dist/form/form-submit.mjs.map +1 -1
- package/dist/form/index.d.mts +7 -0
- package/dist/form/index.d.mts.map +1 -1
- package/dist/form/index.mjs +7 -0
- package/dist/form/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/internal/types.d.mts +3 -0
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-popover-trigger.d.mts +1 -0
- package/dist/internal/use-popover-trigger.d.mts.map +1 -1
- package/dist/internal/use-popover-trigger.mjs.map +1 -1
- package/dist/internal/validity.d.mts +11 -0
- package/dist/internal/validity.d.mts.map +1 -1
- package/dist/internal/validity.mjs.map +1 -1
- package/dist/menu/index.d.mts +2 -0
- package/dist/menu/index.d.mts.map +1 -1
- package/dist/menu/index.mjs +2 -0
- package/dist/menu/index.mjs.map +1 -1
- package/dist/menu/menu-checkbox-item.d.mts +26 -2
- package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
- package/dist/menu/menu-checkbox-item.mjs +2 -0
- package/dist/menu/menu-checkbox-item.mjs.map +1 -1
- package/dist/menu/menu-context-trigger.d.mts +24 -2
- package/dist/menu/menu-context-trigger.d.mts.map +1 -1
- package/dist/menu/menu-context-trigger.mjs +2 -0
- package/dist/menu/menu-context-trigger.mjs.map +1 -1
- package/dist/menu/menu-group.d.mts +36 -1
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +9 -1
- package/dist/menu/menu-group.mjs.map +1 -1
- package/dist/menu/menu-item.d.mts +23 -1
- package/dist/menu/menu-item.d.mts.map +1 -1
- package/dist/menu/menu-item.mjs +2 -0
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-popup.d.mts +33 -8
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +2 -0
- package/dist/menu/menu-popup.mjs.map +1 -1
- package/dist/menu/menu-radio-group.d.mts +20 -1
- package/dist/menu/menu-radio-group.d.mts.map +1 -1
- package/dist/menu/menu-radio-group.mjs +2 -0
- package/dist/menu/menu-radio-group.mjs.map +1 -1
- package/dist/menu/menu-radio-item.d.mts +16 -0
- package/dist/menu/menu-radio-item.d.mts.map +1 -1
- package/dist/menu/menu-radio-item.mjs +2 -0
- package/dist/menu/menu-radio-item.mjs.map +1 -1
- package/dist/menu/menu-root.d.mts +22 -3
- package/dist/menu/menu-root.d.mts.map +1 -1
- package/dist/menu/menu-root.mjs +2 -0
- package/dist/menu/menu-root.mjs.map +1 -1
- package/dist/menu/menu-submenu-trigger.d.mts +13 -0
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +2 -0
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +15 -0
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +2 -0
- package/dist/menu/menu-trigger.mjs.map +1 -1
- package/dist/meter/index.d.mts +2 -0
- package/dist/meter/index.d.mts.map +1 -1
- package/dist/meter/index.mjs +2 -0
- package/dist/meter/index.mjs.map +1 -1
- package/dist/meter/meter-indicator.d.mts +11 -0
- package/dist/meter/meter-indicator.d.mts.map +1 -1
- package/dist/meter/meter-indicator.mjs +2 -0
- package/dist/meter/meter-indicator.mjs.map +1 -1
- package/dist/meter/meter-label.d.mts +11 -0
- package/dist/meter/meter-label.d.mts.map +1 -1
- package/dist/meter/meter-label.mjs +2 -0
- package/dist/meter/meter-label.mjs.map +1 -1
- package/dist/meter/meter-region.d.mts +5 -0
- package/dist/meter/meter-region.d.mts.map +1 -1
- package/dist/meter/meter-region.mjs.map +1 -1
- package/dist/meter/meter-root.d.mts +52 -10
- package/dist/meter/meter-root.d.mts.map +1 -1
- package/dist/meter/meter-root.mjs +2 -0
- package/dist/meter/meter-root.mjs.map +1 -1
- package/dist/meter/meter-track.d.mts +11 -0
- package/dist/meter/meter-track.d.mts.map +1 -1
- package/dist/meter/meter-track.mjs +2 -0
- package/dist/meter/meter-track.mjs.map +1 -1
- package/dist/meter/meter-value.d.mts +15 -1
- package/dist/meter/meter-value.d.mts.map +1 -1
- package/dist/meter/meter-value.mjs +2 -0
- package/dist/meter/meter-value.mjs.map +1 -1
- package/dist/number-field/index.d.mts +2 -0
- package/dist/number-field/index.d.mts.map +1 -1
- package/dist/number-field/index.mjs +2 -0
- package/dist/number-field/index.mjs.map +1 -1
- package/dist/number-field/number-field-decrement.d.mts +2 -0
- package/dist/number-field/number-field-decrement.d.mts.map +1 -1
- package/dist/number-field/number-field-decrement.mjs +2 -0
- package/dist/number-field/number-field-decrement.mjs.map +1 -1
- package/dist/number-field/number-field-increment.d.mts +2 -0
- package/dist/number-field/number-field-increment.d.mts.map +1 -1
- package/dist/number-field/number-field-increment.mjs +2 -0
- package/dist/number-field/number-field-increment.mjs.map +1 -1
- package/dist/number-field/number-field-input.d.mts +9 -0
- package/dist/number-field/number-field-input.d.mts.map +1 -1
- package/dist/number-field/number-field-input.mjs +2 -0
- package/dist/number-field/number-field-input.mjs.map +1 -1
- package/dist/number-field/number-field-label.d.mts +10 -0
- package/dist/number-field/number-field-label.d.mts.map +1 -1
- package/dist/number-field/number-field-label.mjs +2 -0
- package/dist/number-field/number-field-label.mjs.map +1 -1
- package/dist/number-field/number-field-root.d.mts +62 -14
- package/dist/number-field/number-field-root.d.mts.map +1 -1
- package/dist/number-field/number-field-root.mjs +2 -0
- package/dist/number-field/number-field-root.mjs.map +1 -1
- package/dist/number-field/use-step-button.d.mts +20 -0
- package/dist/number-field/use-step-button.d.mts.map +1 -1
- package/dist/number-field/use-step-button.mjs.map +1 -1
- package/dist/popover/index.d.mts +2 -0
- package/dist/popover/index.d.mts.map +1 -1
- package/dist/popover/index.mjs +2 -0
- package/dist/popover/index.mjs.map +1 -1
- package/dist/popover/popover-close.d.mts +18 -0
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +2 -0
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-description.d.mts +12 -0
- package/dist/popover/popover-description.d.mts.map +1 -1
- package/dist/popover/popover-description.mjs +2 -0
- package/dist/popover/popover-description.mjs.map +1 -1
- package/dist/popover/popover-popup.d.mts +30 -4
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +2 -0
- package/dist/popover/popover-popup.mjs.map +1 -1
- package/dist/popover/popover-root.d.mts +9 -0
- package/dist/popover/popover-root.d.mts.map +1 -1
- package/dist/popover/popover-root.mjs +2 -0
- package/dist/popover/popover-root.mjs.map +1 -1
- package/dist/popover/popover-title.d.mts +11 -0
- package/dist/popover/popover-title.d.mts.map +1 -1
- package/dist/popover/popover-title.mjs +2 -0
- package/dist/popover/popover-title.mjs.map +1 -1
- package/dist/popover/popover-trigger.d.mts +15 -0
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +2 -0
- package/dist/popover/popover-trigger.mjs.map +1 -1
- package/dist/progress/index.d.mts +2 -0
- package/dist/progress/index.d.mts.map +1 -1
- package/dist/progress/index.mjs +2 -0
- package/dist/progress/index.mjs.map +1 -1
- package/dist/progress/progress-indicator.d.mts +11 -0
- package/dist/progress/progress-indicator.d.mts.map +1 -1
- package/dist/progress/progress-indicator.mjs +2 -0
- package/dist/progress/progress-indicator.mjs.map +1 -1
- package/dist/progress/progress-label.d.mts +11 -0
- package/dist/progress/progress-label.d.mts.map +1 -1
- package/dist/progress/progress-label.mjs +2 -0
- package/dist/progress/progress-label.mjs.map +1 -1
- package/dist/progress/progress-root.d.mts +36 -8
- package/dist/progress/progress-root.d.mts.map +1 -1
- package/dist/progress/progress-root.mjs +2 -0
- package/dist/progress/progress-root.mjs.map +1 -1
- package/dist/progress/progress-track.d.mts +11 -0
- package/dist/progress/progress-track.d.mts.map +1 -1
- package/dist/progress/progress-track.mjs +2 -0
- package/dist/progress/progress-track.mjs.map +1 -1
- package/dist/progress/progress-value.d.mts +15 -1
- package/dist/progress/progress-value.d.mts.map +1 -1
- package/dist/progress/progress-value.mjs +2 -0
- package/dist/progress/progress-value.mjs.map +1 -1
- package/dist/radio-group/index.d.mts +2 -0
- package/dist/radio-group/index.d.mts.map +1 -1
- package/dist/radio-group/index.mjs +2 -0
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/radio-group/radio-group-item.d.mts +18 -1
- package/dist/radio-group/radio-group-item.d.mts.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +2 -0
- package/dist/radio-group/radio-group-item.mjs.map +1 -1
- package/dist/radio-group/radio-group-label.d.mts +10 -0
- package/dist/radio-group/radio-group-label.d.mts.map +1 -1
- package/dist/radio-group/radio-group-label.mjs +2 -0
- package/dist/radio-group/radio-group-label.mjs.map +1 -1
- package/dist/radio-group/radio-group-root.d.mts +29 -5
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +2 -0
- package/dist/radio-group/radio-group-root.mjs.map +1 -1
- package/dist/select/index.d.mts +2 -0
- package/dist/select/index.d.mts.map +1 -1
- package/dist/select/index.mjs +2 -0
- package/dist/select/index.mjs.map +1 -1
- package/dist/select/select-group-label.d.mts +10 -0
- package/dist/select/select-group-label.d.mts.map +1 -1
- package/dist/select/select-group-label.mjs +2 -0
- package/dist/select/select-group-label.mjs.map +1 -1
- package/dist/select/select-group.d.mts +15 -1
- package/dist/select/select-group.d.mts.map +1 -1
- package/dist/select/select-group.mjs +2 -0
- package/dist/select/select-group.mjs.map +1 -1
- package/dist/select/select-option.d.mts +19 -1
- package/dist/select/select-option.d.mts.map +1 -1
- package/dist/select/select-option.mjs +2 -0
- package/dist/select/select-option.mjs.map +1 -1
- package/dist/select/select-root.d.mts +24 -1
- package/dist/select/select-root.d.mts.map +1 -1
- package/dist/select/select-root.mjs +2 -0
- package/dist/select/select-root.mjs.map +1 -1
- package/dist/select/select-separator.d.mts +9 -0
- package/dist/select/select-separator.d.mts.map +1 -1
- package/dist/select/select-separator.mjs +2 -0
- package/dist/select/select-separator.mjs.map +1 -1
- package/dist/select/select-trigger.d.mts +9 -0
- package/dist/select/select-trigger.d.mts.map +1 -1
- package/dist/select/select-trigger.mjs +2 -0
- package/dist/select/select-trigger.mjs.map +1 -1
- package/dist/select/select-value.d.mts +9 -0
- package/dist/select/select-value.d.mts.map +1 -1
- package/dist/select/select-value.mjs +2 -0
- package/dist/select/select-value.mjs.map +1 -1
- package/dist/slider/index.d.mts +2 -0
- package/dist/slider/index.d.mts.map +1 -1
- package/dist/slider/index.mjs +2 -0
- package/dist/slider/index.mjs.map +1 -1
- package/dist/slider/slider-indicator.d.mts +12 -0
- package/dist/slider/slider-indicator.d.mts.map +1 -1
- package/dist/slider/slider-indicator.mjs +2 -0
- package/dist/slider/slider-indicator.mjs.map +1 -1
- package/dist/slider/slider-label.d.mts +11 -1
- package/dist/slider/slider-label.d.mts.map +1 -1
- package/dist/slider/slider-label.mjs +2 -0
- package/dist/slider/slider-label.mjs.map +1 -1
- package/dist/slider/slider-root.d.mts +53 -9
- package/dist/slider/slider-root.d.mts.map +1 -1
- package/dist/slider/slider-root.mjs +2 -0
- package/dist/slider/slider-root.mjs.map +1 -1
- package/dist/slider/slider-thumb.d.mts +32 -3
- package/dist/slider/slider-thumb.d.mts.map +1 -1
- package/dist/slider/slider-thumb.mjs +2 -0
- package/dist/slider/slider-thumb.mjs.map +1 -1
- package/dist/slider/slider-track.d.mts +17 -0
- package/dist/slider/slider-track.d.mts.map +1 -1
- package/dist/slider/slider-track.mjs +2 -0
- package/dist/slider/slider-track.mjs.map +1 -1
- package/dist/slider/slider-value.d.mts +11 -0
- package/dist/slider/slider-value.d.mts.map +1 -1
- package/dist/slider/slider-value.mjs +2 -0
- package/dist/slider/slider-value.mjs.map +1 -1
- package/dist/switch/switch.d.mts +23 -3
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +2 -0
- package/dist/switch/switch.mjs.map +1 -1
- package/dist/tabs/index.d.mts +2 -0
- package/dist/tabs/index.d.mts.map +1 -1
- package/dist/tabs/index.mjs +2 -0
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/tabs/tabs-context.d.mts +5 -0
- package/dist/tabs/tabs-context.d.mts.map +1 -1
- package/dist/tabs/tabs-context.mjs.map +1 -1
- package/dist/tabs/tabs-indicator.d.mts +17 -0
- package/dist/tabs/tabs-indicator.d.mts.map +1 -1
- package/dist/tabs/tabs-indicator.mjs +2 -0
- package/dist/tabs/tabs-indicator.mjs.map +1 -1
- package/dist/tabs/tabs-list.d.mts +19 -1
- package/dist/tabs/tabs-list.d.mts.map +1 -1
- package/dist/tabs/tabs-list.mjs +2 -0
- package/dist/tabs/tabs-list.mjs.map +1 -1
- package/dist/tabs/tabs-panel.d.mts +19 -0
- package/dist/tabs/tabs-panel.d.mts.map +1 -1
- package/dist/tabs/tabs-panel.mjs +2 -0
- package/dist/tabs/tabs-panel.mjs.map +1 -1
- package/dist/tabs/tabs-root.d.mts +39 -5
- package/dist/tabs/tabs-root.d.mts.map +1 -1
- package/dist/tabs/tabs-root.mjs +2 -0
- package/dist/tabs/tabs-root.mjs.map +1 -1
- package/dist/tabs/tabs-tab.d.mts +22 -1
- package/dist/tabs/tabs-tab.d.mts.map +1 -1
- package/dist/tabs/tabs-tab.mjs +2 -0
- package/dist/tabs/tabs-tab.mjs.map +1 -1
- package/dist/toast/index.d.mts +2 -0
- package/dist/toast/index.d.mts.map +1 -1
- package/dist/toast/index.mjs +2 -0
- package/dist/toast/index.mjs.map +1 -1
- package/dist/toast/toast-action.d.mts +28 -3
- package/dist/toast/toast-action.d.mts.map +1 -1
- package/dist/toast/toast-action.mjs +2 -0
- package/dist/toast/toast-action.mjs.map +1 -1
- package/dist/toast/toast-close.d.mts +16 -0
- package/dist/toast/toast-close.d.mts.map +1 -1
- package/dist/toast/toast-close.mjs +2 -0
- package/dist/toast/toast-close.mjs.map +1 -1
- package/dist/toast/toast-description.d.mts +16 -1
- package/dist/toast/toast-description.d.mts.map +1 -1
- package/dist/toast/toast-description.mjs +2 -0
- package/dist/toast/toast-description.mjs.map +1 -1
- package/dist/toast/toast-root.d.mts +20 -0
- package/dist/toast/toast-root.d.mts.map +1 -1
- package/dist/toast/toast-root.mjs +2 -0
- package/dist/toast/toast-root.mjs.map +1 -1
- package/dist/toast/toast-title.d.mts +15 -1
- package/dist/toast/toast-title.d.mts.map +1 -1
- package/dist/toast/toast-title.mjs +2 -0
- package/dist/toast/toast-title.mjs.map +1 -1
- package/dist/toast/toast-viewport.d.mts +34 -5
- package/dist/toast/toast-viewport.d.mts.map +1 -1
- package/dist/toast/toast-viewport.mjs +2 -0
- package/dist/toast/toast-viewport.mjs.map +1 -1
- package/dist/toast/toast.d.mts +46 -6
- package/dist/toast/toast.d.mts.map +1 -1
- package/dist/toast/toast.mjs +4 -0
- package/dist/toast/toast.mjs.map +1 -1
- package/dist/toggle/toggle.d.mts +20 -2
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +2 -0
- package/dist/toggle/toggle.mjs.map +1 -1
- package/dist/toggle-group/index.d.mts +2 -0
- package/dist/toggle-group/index.d.mts.map +1 -1
- package/dist/toggle-group/index.mjs +2 -0
- package/dist/toggle-group/index.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-context.d.mts +1 -0
- package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-item.d.mts +16 -0
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-item.mjs +2 -0
- package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-root.d.mts +73 -12
- package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-root.mjs +2 -0
- package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
- package/dist/toolbar/index.d.mts +2 -0
- package/dist/toolbar/index.d.mts.map +1 -1
- package/dist/toolbar/index.mjs +2 -0
- package/dist/toolbar/index.mjs.map +1 -1
- package/dist/toolbar/toolbar-root.d.mts +30 -3
- package/dist/toolbar/toolbar-root.d.mts.map +1 -1
- package/dist/toolbar/toolbar-root.mjs +2 -0
- package/dist/toolbar/toolbar-root.mjs.map +1 -1
- package/dist/toolbar/toolbar-separator.d.mts +13 -0
- package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
- package/dist/toolbar/toolbar-separator.mjs +2 -0
- package/dist/toolbar/toolbar-separator.mjs.map +1 -1
- package/dist/tooltip/index.d.mts +2 -0
- package/dist/tooltip/index.d.mts.map +1 -1
- package/dist/tooltip/index.mjs +2 -0
- package/dist/tooltip/index.mjs.map +1 -1
- package/dist/tooltip/tooltip-arrow.d.mts +16 -0
- package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
- package/dist/tooltip/tooltip-arrow.mjs +2 -0
- package/dist/tooltip/tooltip-arrow.mjs.map +1 -1
- package/dist/tooltip/tooltip-context.d.mts +4 -0
- package/dist/tooltip/tooltip-context.d.mts.map +1 -1
- package/dist/tooltip/tooltip-context.mjs.map +1 -1
- package/dist/tooltip/tooltip-popup.d.mts +24 -3
- package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
- package/dist/tooltip/tooltip-popup.mjs +2 -0
- package/dist/tooltip/tooltip-popup.mjs.map +1 -1
- package/dist/tooltip/tooltip-root.d.mts +24 -2
- package/dist/tooltip/tooltip-root.d.mts.map +1 -1
- package/dist/tooltip/tooltip-root.mjs +2 -0
- package/dist/tooltip/tooltip-root.mjs.map +1 -1
- package/dist/tooltip/tooltip-trigger.d.mts +18 -1
- package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +2 -0
- package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
- package/package.json +9 -1
- package/skills/funstack-ui-knowledge/SKILL.md +75 -0
|
@@ -17,13 +17,20 @@ export interface DialogOpenChangeDetails extends ActionDetails {
|
|
|
17
17
|
*/
|
|
18
18
|
readonly returnValue: string | undefined;
|
|
19
19
|
}
|
|
20
|
+
/** State of `Dialog.Root`, passed to the function forms of `children`. */
|
|
20
21
|
export interface DialogRootState {
|
|
21
22
|
/** Optimistic open state (`false` in JS-free mode). Content rendered from it must not suspend. */
|
|
22
23
|
readonly open: boolean;
|
|
23
24
|
/** An `openChangeAction` dispatched through this Dialog is in flight (library mode only). */
|
|
24
25
|
readonly pending: boolean;
|
|
26
|
+
/** The `modal` prop. */
|
|
25
27
|
readonly modal: boolean;
|
|
26
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Props of `Dialog.Root`.
|
|
31
|
+
*
|
|
32
|
+
* @see https://ui.funstack.work/components/dialog
|
|
33
|
+
*/
|
|
27
34
|
export interface DialogRootProps {
|
|
28
35
|
/**
|
|
29
36
|
* Controlled open state. `undefined` means uncontrolled (and, with `defaultOpen` and
|
|
@@ -52,8 +59,13 @@ export interface DialogRootProps {
|
|
|
52
59
|
* `startTransition` (React limitation).
|
|
53
60
|
*/
|
|
54
61
|
openChangeAction?: ChangeAction<boolean, DialogOpenChangeDetails>;
|
|
55
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* `showModal()` (top layer, backdrop, inert page, Escape) or `show()`.
|
|
64
|
+
*
|
|
65
|
+
* @defaultValue `true`
|
|
66
|
+
*/
|
|
56
67
|
modal?: boolean;
|
|
68
|
+
/** The parts. The function form receives the optimistic state and must not suspend. */
|
|
57
69
|
children?: StateValue<ReactNode, DialogRootState>;
|
|
58
70
|
}
|
|
59
71
|
/**
|
|
@@ -67,6 +79,8 @@ export interface DialogRootProps {
|
|
|
67
79
|
* close a part asks for (Close, Form, a foreign close command: `openChangeAction(false)` is
|
|
68
80
|
* awaited, `close(returnValue)` runs when it has committed). Dismissals (Escape, a click
|
|
69
81
|
* outside) are the browser's and `openChangeAction(false)` is a notification.
|
|
82
|
+
*
|
|
83
|
+
* @see https://ui.funstack.work/components/dialog
|
|
70
84
|
*/
|
|
71
85
|
export declare function DialogRoot({ open, defaultOpen, openChangeAction, modal, children }: DialogRootProps): import("react").JSX.Element;
|
|
72
86
|
export declare namespace DialogRoot {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-root.d.mts","names":[],"sources":["../../src/dialog/dialog-root.tsx"],"mappings":";;;;iBAWiB,gCAAgC;;;;;;;;WAQtC,QAAQ;;;;;WAKR;;
|
|
1
|
+
{"version":3,"file":"dialog-root.d.mts","names":[],"sources":["../../src/dialog/dialog-root.tsx"],"mappings":";;;;iBAWiB,gCAAgC;;;;;;;;WAQtC,QAAQ;;;;;WAKR;;;iBAIM;;WAEN;;WAEA;;WAEA;;;;;;;iBAQM;;;;;EAKf;;;;;EAKA;;;;;;;;;;;;;;;;;EAiBA,mBAAmB,sBAAsB;;;;;;EAMzC;;EAEA,WAAW,WAAW,WAAW;;;;;;;;;;;;;;;;wBAyBnB,aACd,MACA,aACA,kBACA,OACA,YACC,kCAAe,IAAA;yBANF"}
|
|
@@ -22,6 +22,8 @@ const isDialogOpen = (dialog) => dialog.open;
|
|
|
22
22
|
* close a part asks for (Close, Form, a foreign close command: `openChangeAction(false)` is
|
|
23
23
|
* awaited, `close(returnValue)` runs when it has committed). Dismissals (Escape, a click
|
|
24
24
|
* outside) are the browser's and `openChangeAction(false)` is a notification.
|
|
25
|
+
*
|
|
26
|
+
* @see https://ui.funstack.work/components/dialog
|
|
25
27
|
*/
|
|
26
28
|
function DialogRoot({ open, defaultOpen, openChangeAction, modal = true, children }) {
|
|
27
29
|
const root = useOverlayRoot({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-root.mjs","names":[],"sources":["../../src/dialog/dialog-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useInsertionEffect, useMemo, useRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport type { ActionDetails, ChangeAction, ChangeReason, StateValue } from \"../internal/types.js\";\nimport { useOverlayRoot } from \"../internal/use-overlay-root.js\";\nimport { resolveStateValue } from \"../internal/use-render.js\";\nimport { DialogContext } from \"./dialog-context.js\";\nimport type { DialogContextValue } from \"./dialog-context.js\";\n\n/** Details passed as the second argument of `openChangeAction`. */\nexport interface DialogOpenChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user acted on a part: Trigger (open), Close or Form submit (close).\n * `\"dismiss\"`: the user closed the dialog without a part: Escape, Android back, an assistive-\n * technology dismiss gesture, or a click outside (`lightDismiss` / `closedby=\"any\"`).\n * `\"platform\"`: the dialog was found open on mount (opened before hydration); `event` is\n * `undefined`.\n */\n readonly reason: ChangeReason;\n /**\n * On close: `dialog.returnValue`: the `value` of the Close button or the form submitter that\n * closed it, `\"\"` for a dismiss. On open: `undefined`.\n */\n readonly returnValue: string | undefined;\n}\n\nexport interface DialogRootState {\n /** Optimistic open state (`false` in JS-free mode). Content rendered from it must not suspend. */\n readonly open: boolean;\n /** An `openChangeAction` dispatched through this Dialog is in flight (library mode only). */\n readonly pending: boolean;\n readonly modal: boolean;\n}\n\nexport interface DialogRootProps {\n /**\n * Controlled open state. `undefined` means uncontrolled (and, with `defaultOpen` and\n * `openChangeAction` also absent, JS-free mode).\n */\n open?: boolean;\n /**\n * Initial open state in uncontrolled library mode. The dialog opens after hydration, never in\n * the server HTML.\n */\n defaultOpen?: boolean;\n /**\n * Awaited for `true` (the dialog opens when it resolves and the content has rendered) and for\n * a `false` the user asked a part for (`Dialog.Close`, a `Dialog.Form` submit or settled\n * action, a foreign close command: the dialog closes with `details.returnValue` when it\n * resolves, with a view transition if the Popup's `transition` is set; a controlled parent\n * that keeps `open` vetoes it). A notification for a dismissal (Escape, Android back, a click\n * outside: the dialog is already closed, `returnValue` is `\"\"`; the action runs inside the\n * Root's transition, and a controlled parent that keeps `open` gets it re-opened, which is\n * not a veto). A dismissal while a part's close is in flight is not notified on its own: if that\n * close is vetoed, the dismissal is notified (`\"dismiss\"`) when the veto settles, and the dialog\n * stays closed. May be a Server Function. Rejections reach the nearest Error Boundary above\n * Root.\n *\n * A `setState` placed after your own `await` is not a Transition update; wrap it in\n * `startTransition` (React limitation).\n */\n openChangeAction?: ChangeAction<boolean, DialogOpenChangeDetails>;\n
|
|
1
|
+
{"version":3,"file":"dialog-root.mjs","names":[],"sources":["../../src/dialog/dialog-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useInsertionEffect, useMemo, useRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport type { ActionDetails, ChangeAction, ChangeReason, StateValue } from \"../internal/types.js\";\nimport { useOverlayRoot } from \"../internal/use-overlay-root.js\";\nimport { resolveStateValue } from \"../internal/use-render.js\";\nimport { DialogContext } from \"./dialog-context.js\";\nimport type { DialogContextValue } from \"./dialog-context.js\";\n\n/** Details passed as the second argument of `openChangeAction`. */\nexport interface DialogOpenChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user acted on a part: Trigger (open), Close or Form submit (close).\n * `\"dismiss\"`: the user closed the dialog without a part: Escape, Android back, an assistive-\n * technology dismiss gesture, or a click outside (`lightDismiss` / `closedby=\"any\"`).\n * `\"platform\"`: the dialog was found open on mount (opened before hydration); `event` is\n * `undefined`.\n */\n readonly reason: ChangeReason;\n /**\n * On close: `dialog.returnValue`: the `value` of the Close button or the form submitter that\n * closed it, `\"\"` for a dismiss. On open: `undefined`.\n */\n readonly returnValue: string | undefined;\n}\n\n/** State of `Dialog.Root`, passed to the function forms of `children`. */\nexport interface DialogRootState {\n /** Optimistic open state (`false` in JS-free mode). Content rendered from it must not suspend. */\n readonly open: boolean;\n /** An `openChangeAction` dispatched through this Dialog is in flight (library mode only). */\n readonly pending: boolean;\n /** The `modal` prop. */\n readonly modal: boolean;\n}\n\n/**\n * Props of `Dialog.Root`.\n *\n * @see https://ui.funstack.work/components/dialog\n */\nexport interface DialogRootProps {\n /**\n * Controlled open state. `undefined` means uncontrolled (and, with `defaultOpen` and\n * `openChangeAction` also absent, JS-free mode).\n */\n open?: boolean;\n /**\n * Initial open state in uncontrolled library mode. The dialog opens after hydration, never in\n * the server HTML.\n */\n defaultOpen?: boolean;\n /**\n * Awaited for `true` (the dialog opens when it resolves and the content has rendered) and for\n * a `false` the user asked a part for (`Dialog.Close`, a `Dialog.Form` submit or settled\n * action, a foreign close command: the dialog closes with `details.returnValue` when it\n * resolves, with a view transition if the Popup's `transition` is set; a controlled parent\n * that keeps `open` vetoes it). A notification for a dismissal (Escape, Android back, a click\n * outside: the dialog is already closed, `returnValue` is `\"\"`; the action runs inside the\n * Root's transition, and a controlled parent that keeps `open` gets it re-opened, which is\n * not a veto). A dismissal while a part's close is in flight is not notified on its own: if that\n * close is vetoed, the dismissal is notified (`\"dismiss\"`) when the veto settles, and the dialog\n * stays closed. May be a Server Function. Rejections reach the nearest Error Boundary above\n * Root.\n *\n * A `setState` placed after your own `await` is not a Transition update; wrap it in\n * `startTransition` (React limitation).\n */\n openChangeAction?: ChangeAction<boolean, DialogOpenChangeDetails>;\n /**\n * `showModal()` (top layer, backdrop, inert page, Escape) or `show()`.\n *\n * @defaultValue `true`\n */\n modal?: boolean;\n /** The parts. The function form receives the optimistic state and must not suspend. */\n children?: StateValue<ReactNode, DialogRootState>;\n}\n\nconst dialogDetails = (\n event: Event | undefined,\n reason: ChangeReason,\n returnValue?: string,\n): DialogOpenChangeDetails => createActionDetails(event, { reason, returnValue });\n\nconst isDialogOpen = (dialog: HTMLDialogElement): boolean => dialog.open;\n\n/**\n * Owns the ids, the mode, the open state and the context. Renders no DOM, so it has no `ref`,\n * `className` or `style`; `pending` is exposed through `children(state)` and the Trigger.\n *\n * Without `open`, `defaultOpen` and `openChangeAction` the Dialog runs in **JS-free mode**: the\n * Trigger is a native `command=\"show-modal\"` invoker and the browser owns everything. With any of\n * them it runs in **library mode**: opening is a transition (the Trigger shows `data-pending`,\n * content renders from committed state, `showModal()` runs when it has committed), and so is a\n * close a part asks for (Close, Form, a foreign close command: `openChangeAction(false)` is\n * awaited, `close(returnValue)` runs when it has committed). Dismissals (Escape, a click\n * outside) are the browser's and `openChangeAction(false)` is a notification.\n *\n * @see https://ui.funstack.work/components/dialog\n */\nexport function DialogRoot({\n open,\n defaultOpen,\n openChangeAction,\n modal = true,\n children,\n}: DialogRootProps) {\n // The popover machinery (design/components/popover.md 14.1) with the `<dialog>`'s `open` and\n // `returnValue` in the details: an open's `returnValue` is an own `undefined`.\n const root = useOverlayRoot<DialogOpenChangeDetails, HTMLDialogElement, [returnValue: string]>({\n component: \"dialog\",\n part: \"Dialog.Root\",\n open,\n defaultOpen,\n openChangeAction,\n details: dialogDetails,\n isShown: isDialogOpen,\n });\n const { mode, intended, latestInFlight, optimistic, requestClose: closeRoot } = root;\n\n // The `returnValue` of a pending part-initiated close (design 2.3), handed to the apply\n // effect's `close()`. Stale once `true` is intended again (a vetoed close snapped back, or a\n // re-open), so the commit that shows it clears it.\n const closeReturnValue = useRef<string | undefined>(undefined);\n useInsertionEffect(() => {\n if (latestInFlight()?.next ?? optimistic) closeReturnValue.current = undefined;\n });\n const takeCloseReturnValue = useCallback((): string => {\n const value = closeReturnValue.current;\n closeReturnValue.current = undefined;\n return value ?? \"\";\n }, []);\n\n // A library-owned close (design 2.3): `openChangeAction(false)` is awaited and the Popup's\n // apply effect calls `close(returnValue)` in the commit that ends it. A dismissal's\n // `notifyClosed` records no `returnValue`.\n const requestClose = useCallback(\n (event: Event | undefined, reason: ChangeReason, returnValue: string): void => {\n if (mode !== \"library\" || !intended()) return;\n closeReturnValue.current = returnValue;\n closeRoot(event, reason, returnValue);\n },\n [mode, intended, closeRoot],\n );\n\n // Memoised: `root` changes only with the open state and pending, so the value changes only\n // with those and `modal`, and the parts do not re-render for an unrelated render of the Root.\n const context = useMemo<DialogContextValue>(\n () => ({ ...root, modal, requestClose, takeCloseReturnValue }),\n [root, modal, requestClose, takeCloseReturnValue],\n );\n\n const state: DialogRootState = { open: optimistic, pending: root.pending, modal };\n\n return <DialogContext value={context}>{resolveStateValue(children, state)}</DialogContext>;\n}\n\nDialogRoot.displayName = \"DialogRoot\";\n"],"mappings":";;;;;;;;AAgFA,MAAM,iBACJ,OACA,QACA,gBAC4B,oBAAoB,OAAO;CAAE;CAAQ;AAAY,CAAC;AAEhF,MAAM,gBAAgB,WAAuC,OAAO;;;;;;;;;;;;;;;AAgBpE,SAAgB,WAAW,EACzB,MACA,aACA,kBACA,QAAQ,MACR,YACkB;CAGlB,MAAM,OAAO,eAAkF;EAC7F,WAAW;EACX,MAAM;EACN;EACA;EACA;EACA,SAAS;EACT,SAAS;CACX,CAAC;CACD,MAAM,EAAE,MAAM,UAAU,gBAAgB,YAAY,cAAc,cAAc;CAKhF,MAAM,mBAAmB,OAA2B,KAAA,CAAS;CAC7D,yBAAyB;EACvB,IAAI,eAAe,CAAC,EAAE,QAAQ,YAAY,iBAAiB,UAAU,KAAA;CACvE,CAAC;CACD,MAAM,uBAAuB,kBAA0B;EACrD,MAAM,QAAQ,iBAAiB;EAC/B,iBAAiB,UAAU,KAAA;EAC3B,OAAO,SAAS;CAClB,GAAG,CAAC,CAAC;CAKL,MAAM,eAAe,aAClB,OAA0B,QAAsB,gBAA8B;EAC7E,IAAI,SAAS,aAAa,CAAC,SAAS,GAAG;EACvC,iBAAiB,UAAU;EAC3B,UAAU,OAAO,QAAQ,WAAW;CACtC,GACA;EAAC;EAAM;EAAU;CAAS,CAC5B;CAIA,MAAM,UAAU,eACP;EAAE,GAAG;EAAM;EAAO;EAAc;CAAqB,IAC5D;EAAC;EAAM;EAAO;EAAc;CAAoB,CAClD;CAEA,MAAM,QAAyB;EAAE,MAAM;EAAY,SAAS,KAAK;EAAS;CAAM;CAEhF,OAAO,oBAAC,eAAD;EAAe,OAAO;EAAU,UAAA,kBAAkB,UAAU,KAAK;CAAiB,CAAA;AAC3F;AAEA,WAAW,cAAc"}
|
|
@@ -2,10 +2,19 @@ import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
|
2
2
|
import { DialogPopupState } from "./dialog-popup.mjs";
|
|
3
3
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
4
|
//#region src/dialog/dialog-title.d.ts
|
|
5
|
+
/** State of `Dialog.Title`: the Popup's state. */
|
|
5
6
|
export type DialogTitleState = DialogPopupState;
|
|
7
|
+
/**
|
|
8
|
+
* Props of `Dialog.Title`.
|
|
9
|
+
*
|
|
10
|
+
* @see https://ui.funstack.work/components/dialog
|
|
11
|
+
*/
|
|
6
12
|
export interface DialogTitleProps extends Omit<ComponentPropsWithRef<"h2">, "id" | "className" | "style" | "children"> {
|
|
13
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
7
14
|
className?: StateValue<string | undefined, DialogTitleState>;
|
|
15
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
8
16
|
style?: StateValue<CSSProperties | undefined, DialogTitleState>;
|
|
17
|
+
/** Content, or a function of the part's state. */
|
|
9
18
|
children?: StateValue<ReactNode, DialogTitleState>;
|
|
10
19
|
/** `render={<h3 />}` changes the heading level. */
|
|
11
20
|
render?: RenderProp<ComponentPropsWithRef<"h2">, DialogTitleState>;
|
|
@@ -14,6 +23,8 @@ export interface DialogTitleProps extends Omit<ComponentPropsWithRef<"h2">, "id"
|
|
|
14
23
|
* The dialog's name: an `<h2>` whose id the Popup references with `aria-labelledby`.
|
|
15
24
|
*
|
|
16
25
|
* Owned key (conventions 1.2): `id`.
|
|
26
|
+
*
|
|
27
|
+
* @see https://ui.funstack.work/components/dialog
|
|
17
28
|
*/
|
|
18
29
|
export declare function DialogTitle({ className, style, children, render, ...rest }: DialogTitleProps): ReactNode;
|
|
19
30
|
export declare namespace DialogTitle {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-title.d.mts","names":[],"sources":["../../src/dialog/dialog-title.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialog-title.d.mts","names":[],"sources":["../../src/dialog/dialog-title.tsx"],"mappings":";;;;;YAQY,mBAAmB;;;;;;iBAOd,yBAAyB,KACxC;;EAIA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,6BAA6B;;;;;;;;;wBAUnC,cAAc,WAAW,OAAO,UAAU,WAAW,QAAQ,mBAAgB;yBAA7E"}
|
|
@@ -6,6 +6,8 @@ import { useDialogContext } from "./dialog-context.mjs";
|
|
|
6
6
|
* The dialog's name: an `<h2>` whose id the Popup references with `aria-labelledby`.
|
|
7
7
|
*
|
|
8
8
|
* Owned key (conventions 1.2): `id`.
|
|
9
|
+
*
|
|
10
|
+
* @see https://ui.funstack.work/components/dialog
|
|
9
11
|
*/
|
|
10
12
|
function DialogTitle({ className, style, children, render, ...rest }) {
|
|
11
13
|
const ctx = useDialogContext("Dialog.Title");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-title.mjs","names":[],"sources":["../../src/dialog/dialog-title.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useDialogContext } from \"./dialog-context.js\";\nimport type { DialogPopupState } from \"./dialog-popup.js\";\n\nexport type DialogTitleState = DialogPopupState;\n\nexport interface DialogTitleProps extends Omit<\n ComponentPropsWithRef<\"h2\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, DialogTitleState>;\n style?: StateValue<CSSProperties | undefined, DialogTitleState>;\n children?: StateValue<ReactNode, DialogTitleState>;\n /** `render={<h3 />}` changes the heading level. */\n render?: RenderProp<ComponentPropsWithRef<\"h2\">, DialogTitleState>;\n}\n\n/**\n * The dialog's name: an `<h2>` whose id the Popup references with `aria-labelledby`.\n *\n * Owned key (conventions 1.2): `id`.\n */\nexport function DialogTitle({ className, style, children, render, ...rest }: DialogTitleProps) {\n const ctx = useDialogContext(\"Dialog.Title\");\n const state: DialogTitleState = { open: ctx.committed, modal: ctx.modal };\n return useRender<ComponentPropsWithRef<\"h2\">, DialogTitleState>({\n defaultElement: \"h2\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: { id: ctx.ids.title },\n });\n}\n\nDialogTitle.displayName = \"DialogTitle\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialog-title.mjs","names":[],"sources":["../../src/dialog/dialog-title.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useDialogContext } from \"./dialog-context.js\";\nimport type { DialogPopupState } from \"./dialog-popup.js\";\n\n/** State of `Dialog.Title`: the Popup's state. */\nexport type DialogTitleState = DialogPopupState;\n\n/**\n * Props of `Dialog.Title`.\n *\n * @see https://ui.funstack.work/components/dialog\n */\nexport interface DialogTitleProps extends Omit<\n ComponentPropsWithRef<\"h2\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, DialogTitleState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, DialogTitleState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, DialogTitleState>;\n /** `render={<h3 />}` changes the heading level. */\n render?: RenderProp<ComponentPropsWithRef<\"h2\">, DialogTitleState>;\n}\n\n/**\n * The dialog's name: an `<h2>` whose id the Popup references with `aria-labelledby`.\n *\n * Owned key (conventions 1.2): `id`.\n *\n * @see https://ui.funstack.work/components/dialog\n */\nexport function DialogTitle({ className, style, children, render, ...rest }: DialogTitleProps) {\n const ctx = useDialogContext(\"Dialog.Title\");\n const state: DialogTitleState = { open: ctx.committed, modal: ctx.modal };\n return useRender<ComponentPropsWithRef<\"h2\">, DialogTitleState>({\n defaultElement: \"h2\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: { id: ctx.ids.title },\n });\n}\n\nDialogTitle.displayName = \"DialogTitle\";\n"],"mappings":";;;;;;;;;;;AAoCA,SAAgB,YAAY,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,QAA0B;CAC7F,MAAM,MAAM,iBAAiB,cAAc;CAC3C,MAAM,QAA0B;EAAE,MAAM,IAAI;EAAW,OAAO,IAAI;CAAM;CACxE,OAAO,UAAyD;EAC9D,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,cAAc,EAAE,IAAI,IAAI,IAAI,MAAM;CACpC,CAAC;AACH;AAEA,YAAY,cAAc"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
2
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
3
3
|
//#region src/dialog/dialog-trigger.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* State of `Dialog.Trigger`, passed to the function forms of `className`, `style`, `children` and
|
|
6
|
+
* `render`.
|
|
7
|
+
*/
|
|
4
8
|
export interface DialogTriggerState {
|
|
5
9
|
/** Optimistic open state (library mode); `false` in JS-free mode. */
|
|
6
10
|
readonly open: boolean;
|
|
@@ -10,16 +14,26 @@ export interface DialogTriggerState {
|
|
|
10
14
|
* flight, or a re-open requested while a close notification is still settling.
|
|
11
15
|
*/
|
|
12
16
|
readonly pending: boolean;
|
|
17
|
+
/** The `disabled` prop. */
|
|
13
18
|
readonly disabled: boolean;
|
|
14
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Props of `Dialog.Trigger`.
|
|
22
|
+
*
|
|
23
|
+
* @see https://ui.funstack.work/components/dialog
|
|
24
|
+
*/
|
|
15
25
|
export interface DialogTriggerProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "className" | "style" | "children"> {
|
|
16
26
|
/**
|
|
17
27
|
* Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); with a link or
|
|
18
28
|
* component `render` where the Trigger handles the click (library mode, or a non-modal
|
|
19
29
|
* dialog), `aria-disabled="true"` instead: the element stays focusable.
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue `false`
|
|
20
32
|
*/
|
|
21
33
|
disabled?: boolean;
|
|
34
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
22
35
|
className?: StateValue<string | undefined, DialogTriggerState>;
|
|
36
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
23
37
|
style?: StateValue<CSSProperties | undefined, DialogTriggerState>;
|
|
24
38
|
/** Rendered from optimistic state; must not suspend. */
|
|
25
39
|
children?: StateValue<ReactNode, DialogTriggerState>;
|
|
@@ -37,6 +51,8 @@ export interface DialogTriggerProps extends Omit<ComponentPropsWithRef<"button">
|
|
|
37
51
|
* link or component `render` with the click handler installed), `commandfor`, `command`,
|
|
38
52
|
* `onClick`, `onPointerDown` (non-modal JS-free mode), `data-open`, `data-pending`,
|
|
39
53
|
* `data-disabled`.
|
|
54
|
+
*
|
|
55
|
+
* @see https://ui.funstack.work/components/dialog
|
|
40
56
|
*/
|
|
41
57
|
export declare function DialogTrigger({ disabled, className, style, children, render, ...rest }: DialogTriggerProps): ReactNode;
|
|
42
58
|
export declare namespace DialogTrigger {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-trigger.d.mts","names":[],"sources":["../../src/dialog/dialog-trigger.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialog-trigger.d.mts","names":[],"sources":["../../src/dialog/dialog-trigger.tsx"],"mappings":";;;;;;;iBAeiB;;WAEN;;;;;;WAMA;;WAEA;;;;;;;iBAQM,2BAA2B,KAC1C;;;;;;;;EAUA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;;;wBAmBvC,gBACd,UACA,WACA,OACA,UACA,WACG,QACF,qBAAkB;yBAPL"}
|
|
@@ -19,6 +19,8 @@ const isDev = process.env.NODE_ENV !== "production";
|
|
|
19
19
|
* link or component `render` with the click handler installed), `commandfor`, `command`,
|
|
20
20
|
* `onClick`, `onPointerDown` (non-modal JS-free mode), `data-open`, `data-pending`,
|
|
21
21
|
* `data-disabled`.
|
|
22
|
+
*
|
|
23
|
+
* @see https://ui.funstack.work/components/dialog
|
|
22
24
|
*/
|
|
23
25
|
function DialogTrigger({ disabled = false, className, style, children, render, ...rest }) {
|
|
24
26
|
const ctx = useDialogContext("Dialog.Trigger");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-trigger.mjs","names":[],"sources":["../../src/dialog/dialog-trigger.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { registerTrigger } from \"../internal/trigger-ref.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { disabledButton, rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { useDialogContext } from \"./dialog-context.js\";\n\nexport interface DialogTriggerState {\n /** Optimistic open state (library mode); `false` in JS-free mode. */\n readonly open: boolean;\n /**\n * The Root's transition is pending: an open in flight, a close a part asked for in flight\n * (`openChangeAction(false)` awaited while the dialog is still open), a close notification in\n * flight, or a re-open requested while a close notification is still settling.\n */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface DialogTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); with a link or\n * component `render` where the Trigger handles the click (library mode, or a non-modal\n * dialog), `aria-disabled=\"true\"` instead: the element stays focusable.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, DialogTriggerState>;\n style?: StateValue<CSSProperties | undefined, DialogTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, DialogTriggerState>;\n /** Should render a `<button>`; another element works only in library mode (click handler). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, DialogTriggerState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * The opener: `<button type=\"button\" commandfor command=\"show-modal\">`. In JS-free mode the\n * browser runs the command. In library mode the click is cancelled (so the command does not run)\n * and dispatched through the Root's transition; the button shows optimistic `data-open` and\n * `data-pending` until the dialog has opened. Non-modal dialogs have no command and always use a\n * click handler (`show()`).\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled` (a\n * link or component `render` with the click handler installed), `commandfor`, `command`,\n * `onClick`, `onPointerDown` (non-modal JS-free mode), `data-open`, `data-pending`,\n * `data-disabled`.\n */\nexport function DialogTrigger({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: DialogTriggerProps) {\n const ctx = useDialogContext(\"Dialog.Trigger\");\n const isLibrary = ctx.mode === \"library\";\n const { modal, ids, triggerRef, popupRef } = ctx;\n\n const state: DialogTriggerState = {\n open: ctx.optimistic,\n // Every Root dispatch is an open, a part-initiated close or a dismissal notification, and\n // all of them belong to the Trigger (design 4.2). Not `optimistic !== committed`: a re-open\n // while a close notification is still settling has both `true` (the close never committed)\n // and is pending all the same.\n pending: ctx.pending,\n disabled,\n };\n\n const checkElement = useElementCheck(\n isDev &&\n ((element) =>\n !isLibrary && modal && element.tagName !== \"BUTTON\"\n ? `Dialog.Trigger: rendered a <${element.tagName.toLowerCase()}> in JS-free mode. Only a ` +\n '<button> runs `command=\"show-modal\"`; this trigger will not open the dialog. Render ' +\n \"a <button>, or put the Dialog in library mode (`defaultOpen={false}`).\"\n : null),\n );\n const libraryRef = useCallback(\n (element: HTMLElement) => {\n checkElement?.(element);\n return registerTrigger(triggerRef, element, \"Dialog.Trigger\");\n },\n [checkElement, triggerRef],\n );\n\n // A Trigger without a Popup opens nothing (design 14, dev warnings).\n useEffect(() => {\n if (!isDev) return;\n if (document.getElementById(ids.popup) === null) {\n console.error(\n \"Dialog.Trigger: no Dialog.Popup is rendered for this Dialog.Root; the trigger opens nothing.\",\n );\n }\n }, [ids.popup]);\n\n // Library mode (both modal and non-modal) and non-modal JS-free mode need a click handler;\n // modal JS-free mode is the browser's command.\n const installClick = isLibrary || !modal;\n // The modal JS-free command needs native `disabled` to stop it.\n const disabledProps = disabledButton(render, disabled, { handlesClick: installClick });\n // Only on a button (or a component, assumed to render one): another element is no invoker.\n const invoker = modal && disabledProps.invoker && rendersButton(render);\n // Non-modal JS-free mode: whether the dialog was open when the press began. A press on the\n // Trigger of an open `lightDismiss` dialog is a dismissal (the JS listeners or native\n // `closedby=\"any\"` close it before the click), so that click must not `show()` it again.\n // Pointer clicks only (`detail > 0`): a keyboard click has no press, and a press that never\n // became a click must not swallow a later one.\n const pressedOpen = useRef(false);\n const installPress = !isLibrary && !modal;\n const onPointerDown = () => {\n pressedOpen.current = popupRef.current?.open ?? false;\n };\n const onClick = (event: MouseEvent<HTMLElement>) => {\n if (isLibrary) {\n // Cancelling the click cancels the command (it runs as the button's activation\n // behaviour, only if the click was not cancelled).\n event.preventDefault();\n if (disabled) return;\n ctx.requestOpen(event.nativeEvent, \"activate\");\n return;\n }\n if (disabled) {\n // A disabled link must not navigate either.\n event.preventDefault();\n return;\n }\n const wasOpen = event.detail > 0 && pressedOpen.current;\n pressedOpen.current = false;\n const dialog = popupRef.current;\n if (dialog !== null && !dialog.open && !wasOpen && dialog.isConnected) dialog.show();\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n // `type` only applies to a <button>; on any other element the key is not owned.\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Trigger (in JS-free mode the\n // browser would run its command).\n ...disabledProps.props,\n commandfor: invoker ? ids.popup : undefined,\n command: invoker ? \"show-modal\" : undefined,\n // Only owned when installed, so a render element keeps its own `onClick` in modal JS-free\n // mode (Accordion's rule).\n ...(installClick && { onClick }),\n ...(installPress && { onPointerDown }),\n \"data-open\": dataAttr(state.open),\n \"data-pending\": dataAttr(state.pending),\n // Every mode: the styling hook agrees with the rendered `disabled` / `aria-disabled`\n // (conventions 1.2).\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, DialogTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: libraryRef,\n });\n}\n\nDialogTrigger.displayName = \"DialogTrigger\";\n"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"dialog-trigger.mjs","names":[],"sources":["../../src/dialog/dialog-trigger.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { registerTrigger } from \"../internal/trigger-ref.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { disabledButton, rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { useDialogContext } from \"./dialog-context.js\";\n\n/**\n * State of `Dialog.Trigger`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface DialogTriggerState {\n /** Optimistic open state (library mode); `false` in JS-free mode. */\n readonly open: boolean;\n /**\n * The Root's transition is pending: an open in flight, a close a part asked for in flight\n * (`openChangeAction(false)` awaited while the dialog is still open), a close notification in\n * flight, or a re-open requested while a close notification is still settling.\n */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/**\n * Props of `Dialog.Trigger`.\n *\n * @see https://ui.funstack.work/components/dialog\n */\nexport interface DialogTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); with a link or\n * component `render` where the Trigger handles the click (library mode, or a non-modal\n * dialog), `aria-disabled=\"true\"` instead: the element stays focusable.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, DialogTriggerState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, DialogTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, DialogTriggerState>;\n /** Should render a `<button>`; another element works only in library mode (click handler). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, DialogTriggerState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * The opener: `<button type=\"button\" commandfor command=\"show-modal\">`. In JS-free mode the\n * browser runs the command. In library mode the click is cancelled (so the command does not run)\n * and dispatched through the Root's transition; the button shows optimistic `data-open` and\n * `data-pending` until the dialog has opened. Non-modal dialogs have no command and always use a\n * click handler (`show()`).\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled` (a\n * link or component `render` with the click handler installed), `commandfor`, `command`,\n * `onClick`, `onPointerDown` (non-modal JS-free mode), `data-open`, `data-pending`,\n * `data-disabled`.\n *\n * @see https://ui.funstack.work/components/dialog\n */\nexport function DialogTrigger({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: DialogTriggerProps) {\n const ctx = useDialogContext(\"Dialog.Trigger\");\n const isLibrary = ctx.mode === \"library\";\n const { modal, ids, triggerRef, popupRef } = ctx;\n\n const state: DialogTriggerState = {\n open: ctx.optimistic,\n // Every Root dispatch is an open, a part-initiated close or a dismissal notification, and\n // all of them belong to the Trigger (design 4.2). Not `optimistic !== committed`: a re-open\n // while a close notification is still settling has both `true` (the close never committed)\n // and is pending all the same.\n pending: ctx.pending,\n disabled,\n };\n\n const checkElement = useElementCheck(\n isDev &&\n ((element) =>\n !isLibrary && modal && element.tagName !== \"BUTTON\"\n ? `Dialog.Trigger: rendered a <${element.tagName.toLowerCase()}> in JS-free mode. Only a ` +\n '<button> runs `command=\"show-modal\"`; this trigger will not open the dialog. Render ' +\n \"a <button>, or put the Dialog in library mode (`defaultOpen={false}`).\"\n : null),\n );\n const libraryRef = useCallback(\n (element: HTMLElement) => {\n checkElement?.(element);\n return registerTrigger(triggerRef, element, \"Dialog.Trigger\");\n },\n [checkElement, triggerRef],\n );\n\n // A Trigger without a Popup opens nothing (design 14, dev warnings).\n useEffect(() => {\n if (!isDev) return;\n if (document.getElementById(ids.popup) === null) {\n console.error(\n \"Dialog.Trigger: no Dialog.Popup is rendered for this Dialog.Root; the trigger opens nothing.\",\n );\n }\n }, [ids.popup]);\n\n // Library mode (both modal and non-modal) and non-modal JS-free mode need a click handler;\n // modal JS-free mode is the browser's command.\n const installClick = isLibrary || !modal;\n // The modal JS-free command needs native `disabled` to stop it.\n const disabledProps = disabledButton(render, disabled, { handlesClick: installClick });\n // Only on a button (or a component, assumed to render one): another element is no invoker.\n const invoker = modal && disabledProps.invoker && rendersButton(render);\n // Non-modal JS-free mode: whether the dialog was open when the press began. A press on the\n // Trigger of an open `lightDismiss` dialog is a dismissal (the JS listeners or native\n // `closedby=\"any\"` close it before the click), so that click must not `show()` it again.\n // Pointer clicks only (`detail > 0`): a keyboard click has no press, and a press that never\n // became a click must not swallow a later one.\n const pressedOpen = useRef(false);\n const installPress = !isLibrary && !modal;\n const onPointerDown = () => {\n pressedOpen.current = popupRef.current?.open ?? false;\n };\n const onClick = (event: MouseEvent<HTMLElement>) => {\n if (isLibrary) {\n // Cancelling the click cancels the command (it runs as the button's activation\n // behaviour, only if the click was not cancelled).\n event.preventDefault();\n if (disabled) return;\n ctx.requestOpen(event.nativeEvent, \"activate\");\n return;\n }\n if (disabled) {\n // A disabled link must not navigate either.\n event.preventDefault();\n return;\n }\n const wasOpen = event.detail > 0 && pressedOpen.current;\n pressedOpen.current = false;\n const dialog = popupRef.current;\n if (dialog !== null && !dialog.open && !wasOpen && dialog.isConnected) dialog.show();\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n // `type` only applies to a <button>; on any other element the key is not owned.\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Trigger (in JS-free mode the\n // browser would run its command).\n ...disabledProps.props,\n commandfor: invoker ? ids.popup : undefined,\n command: invoker ? \"show-modal\" : undefined,\n // Only owned when installed, so a render element keeps its own `onClick` in modal JS-free\n // mode (Accordion's rule).\n ...(installClick && { onClick }),\n ...(installPress && { onPointerDown }),\n \"data-open\": dataAttr(state.open),\n \"data-pending\": dataAttr(state.pending),\n // Every mode: the styling hook agrees with the rendered `disabled` / `aria-disabled`\n // (conventions 1.2).\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, DialogTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: libraryRef,\n });\n}\n\nDialogTrigger.displayName = \"DialogTrigger\";\n"],"mappings":";;;;;;;;;AAuDA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;;AAgBvC,SAAgB,cAAc,EAC5B,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACkB;CACrB,MAAM,MAAM,iBAAiB,gBAAgB;CAC7C,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,OAAO,KAAK,YAAY,aAAa;CAE7C,MAAM,QAA4B;EAChC,MAAM,IAAI;EAKV,SAAS,IAAI;EACb;CACF;CAEA,MAAM,eAAe,gBACnB,WACI,YACA,CAAC,aAAa,SAAS,QAAQ,YAAY,WACvC,+BAA+B,QAAQ,QAAQ,YAAY,EAAE,4LAG7D,KACV;CACA,MAAM,aAAa,aAChB,YAAyB;EACxB,eAAe,OAAO;EACtB,OAAO,gBAAgB,YAAY,SAAS,gBAAgB;CAC9D,GACA,CAAC,cAAc,UAAU,CAC3B;CAGA,gBAAgB;EACd,IAAI,CAAC,OAAO;EACZ,IAAI,SAAS,eAAe,IAAI,KAAK,MAAM,MACzC,QAAQ,MACN,8FACF;CAEJ,GAAG,CAAC,IAAI,KAAK,CAAC;CAId,MAAM,eAAe,aAAa,CAAC;CAEnC,MAAM,gBAAgB,eAAe,QAAQ,UAAU,EAAE,cAAc,aAAa,CAAC;CAErF,MAAM,UAAU,SAAS,cAAc,WAAW,cAAc,MAAM;CAMtE,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,eAAe,CAAC,aAAa,CAAC;CACpC,MAAM,sBAAsB;EAC1B,YAAY,UAAU,SAAS,SAAS,QAAQ;CAClD;CACA,MAAM,WAAW,UAAmC;EAClD,IAAI,WAAW;GAGb,MAAM,eAAe;GACrB,IAAI,UAAU;GACd,IAAI,YAAY,MAAM,aAAa,UAAU;GAC7C;EACF;EACA,IAAI,UAAU;GAEZ,MAAM,eAAe;GACrB;EACF;EACA,MAAM,UAAU,MAAM,SAAS,KAAK,YAAY;EAChD,YAAY,UAAU;EACtB,MAAM,SAAS,SAAS;EACxB,IAAI,WAAW,QAAQ,CAAC,OAAO,QAAQ,CAAC,WAAW,OAAO,aAAa,OAAO,KAAK;CACrF;CAEA,MAAM,eAAiE;EAErE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EAGvD,GAAG,cAAc;EACjB,YAAY,UAAU,IAAI,QAAQ,KAAA;EAClC,SAAS,UAAU,eAAe,KAAA;EAGlC,GAAI,gBAAgB,EAAE,QAAQ;EAC9B,GAAI,gBAAgB,EAAE,cAAc;EACpC,aAAa,SAAS,MAAM,IAAI;EAChC,gBAAgB,SAAS,MAAM,OAAO;EAGtC,iBAAiB,SAAS,QAAQ;CACpC;CAEA,OAAO,UAA+D;EACpE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;AACH;AAEA,cAAc,cAAc"}
|
package/dist/dialog/index.d.mts
CHANGED
|
@@ -15,6 +15,8 @@ import { DialogTrigger, DialogTriggerProps, DialogTriggerState } from "./dialog-
|
|
|
15
15
|
* part asks for (Close, Form, a foreign close command: `openChangeAction(false)` awaited, then
|
|
16
16
|
* `close(returnValue)`); dismissals (Escape, a click outside) are the browser's, notified
|
|
17
17
|
* through `openChangeAction(false)`.
|
|
18
|
+
*
|
|
19
|
+
* @see https://ui.funstack.work/components/dialog
|
|
18
20
|
*/
|
|
19
21
|
export declare const Dialog: {
|
|
20
22
|
readonly Root: typeof DialogRoot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/dialog/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/dialog/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;qBAsBa;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,cAAK;WACL,aAAI;WACJ,cAAK;WACL,oBAAW"}
|
package/dist/dialog/index.mjs
CHANGED
|
@@ -14,6 +14,8 @@ import { DialogTrigger } from "./dialog-trigger.mjs";
|
|
|
14
14
|
* part asks for (Close, Form, a foreign close command: `openChangeAction(false)` awaited, then
|
|
15
15
|
* `close(returnValue)`); dismissals (Escape, a click outside) are the browser's, notified
|
|
16
16
|
* through `openChangeAction(false)`.
|
|
17
|
+
*
|
|
18
|
+
* @see https://ui.funstack.work/components/dialog
|
|
17
19
|
*/
|
|
18
20
|
const Dialog = {
|
|
19
21
|
Root: DialogRoot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/dialog/index.ts"],"sourcesContent":["// Ships the platform attribute typings (`command`, `commandfor`) with this subpath\n// (conventions 7.4). Type-only: the built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { DialogClose } from \"./dialog-close.js\";\nimport { DialogDescription } from \"./dialog-description.js\";\nimport { DialogForm } from \"./dialog-form.js\";\nimport { DialogPopup } from \"./dialog-popup.js\";\nimport { DialogRoot } from \"./dialog-root.js\";\nimport { DialogTitle } from \"./dialog-title.js\";\nimport { DialogTrigger } from \"./dialog-trigger.js\";\n\n/**\n * Dialog built on `<dialog>` and Invoker Commands: `Root` (no DOM) > `Trigger`\n * (`button[command=show-modal]`) + `Popup` (`dialog`) > `Title`, `Description`, `Form`, `Close`.\n * JS-free when the Root has none of `open` / `defaultOpen` / `openChangeAction`; otherwise\n * opening is a transition (pending Trigger, content from committed state), and so is a close a\n * part asks for (Close, Form, a foreign close command: `openChangeAction(false)` awaited, then\n * `close(returnValue)`); dismissals (Escape, a click outside) are the browser's, notified\n * through `openChangeAction(false)`.\n */\nexport const Dialog = {\n Root: DialogRoot,\n Trigger: DialogTrigger,\n Popup: DialogPopup,\n Close: DialogClose,\n Form: DialogForm,\n Title: DialogTitle,\n Description: DialogDescription,\n} as const;\n\nexport type { DialogRootProps, DialogRootState, DialogOpenChangeDetails } from \"./dialog-root.js\";\nexport type { DialogTriggerProps, DialogTriggerState } from \"./dialog-trigger.js\";\nexport type { DialogPopupProps, DialogPopupState } from \"./dialog-popup.js\";\nexport type { DialogCloseProps, DialogCloseState, DialogCloseDetails } from \"./dialog-close.js\";\nexport type { DialogFormProps, DialogFormState } from \"./dialog-form.js\";\nexport type { DialogTitleProps, DialogTitleState } from \"./dialog-title.js\";\nexport type { DialogDescriptionProps, DialogDescriptionState } from \"./dialog-description.js\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/dialog/index.ts"],"sourcesContent":["// Ships the platform attribute typings (`command`, `commandfor`) with this subpath\n// (conventions 7.4). Type-only: the built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { DialogClose } from \"./dialog-close.js\";\nimport { DialogDescription } from \"./dialog-description.js\";\nimport { DialogForm } from \"./dialog-form.js\";\nimport { DialogPopup } from \"./dialog-popup.js\";\nimport { DialogRoot } from \"./dialog-root.js\";\nimport { DialogTitle } from \"./dialog-title.js\";\nimport { DialogTrigger } from \"./dialog-trigger.js\";\n\n/**\n * Dialog built on `<dialog>` and Invoker Commands: `Root` (no DOM) > `Trigger`\n * (`button[command=show-modal]`) + `Popup` (`dialog`) > `Title`, `Description`, `Form`, `Close`.\n * JS-free when the Root has none of `open` / `defaultOpen` / `openChangeAction`; otherwise\n * opening is a transition (pending Trigger, content from committed state), and so is a close a\n * part asks for (Close, Form, a foreign close command: `openChangeAction(false)` awaited, then\n * `close(returnValue)`); dismissals (Escape, a click outside) are the browser's, notified\n * through `openChangeAction(false)`.\n *\n * @see https://ui.funstack.work/components/dialog\n */\nexport const Dialog = {\n Root: DialogRoot,\n Trigger: DialogTrigger,\n Popup: DialogPopup,\n Close: DialogClose,\n Form: DialogForm,\n Title: DialogTitle,\n Description: DialogDescription,\n} as const;\n\nexport type { DialogRootProps, DialogRootState, DialogOpenChangeDetails } from \"./dialog-root.js\";\nexport type { DialogTriggerProps, DialogTriggerState } from \"./dialog-trigger.js\";\nexport type { DialogPopupProps, DialogPopupState } from \"./dialog-popup.js\";\nexport type { DialogCloseProps, DialogCloseState, DialogCloseDetails } from \"./dialog-close.js\";\nexport type { DialogFormProps, DialogFormState } from \"./dialog-form.js\";\nexport type { DialogTitleProps, DialogTitleState } from \"./dialog-title.js\";\nexport type { DialogDescriptionProps, DialogDescriptionState } from \"./dialog-description.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,MAAa,SAAS;CACpB,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,OAAO;CACP,aAAa;AACf"}
|