@funstack/ui 0.1.0-alpha.2 → 0.1.0-alpha.20
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-context.mjs.map +1 -1
- package/dist/accordion/accordion-item.d.mts +22 -4
- package/dist/accordion/accordion-item.d.mts.map +1 -1
- package/dist/accordion/accordion-item.mjs +32 -10
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.d.mts +19 -4
- package/dist/accordion/accordion-panel.d.mts.map +1 -1
- package/dist/accordion/accordion-panel.mjs +8 -6
- package/dist/accordion/accordion-panel.mjs.map +1 -1
- package/dist/accordion/accordion-root.d.mts +39 -5
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +75 -67
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.d.mts +12 -4
- package/dist/accordion/accordion-trigger.d.mts.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +14 -28
- 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/alert-dialog/alert-dialog-action.d.mts +73 -0
- package/dist/alert-dialog/alert-dialog-action.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-action.mjs +23 -0
- package/dist/alert-dialog/alert-dialog-action.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-cancel.d.mts +31 -0
- package/dist/alert-dialog/alert-dialog-cancel.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-cancel.mjs +50 -0
- package/dist/alert-dialog/alert-dialog-cancel.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-context.mjs +24 -0
- package/dist/alert-dialog/alert-dialog-context.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-description.d.mts +25 -0
- package/dist/alert-dialog/alert-dialog-description.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-description.mjs +20 -0
- package/dist/alert-dialog/alert-dialog-description.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-form.d.mts +27 -0
- package/dist/alert-dialog/alert-dialog-form.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-form.mjs +22 -0
- package/dist/alert-dialog/alert-dialog-form.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-popup.d.mts +42 -0
- package/dist/alert-dialog/alert-dialog-popup.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-popup.mjs +53 -0
- package/dist/alert-dialog/alert-dialog-popup.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-root.d.mts +31 -0
- package/dist/alert-dialog/alert-dialog-root.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-root.mjs +22 -0
- package/dist/alert-dialog/alert-dialog-root.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-title.d.mts +23 -0
- package/dist/alert-dialog/alert-dialog-title.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-title.mjs +18 -0
- package/dist/alert-dialog/alert-dialog-title.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-trigger.d.mts +23 -0
- package/dist/alert-dialog/alert-dialog-trigger.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-trigger.mjs +18 -0
- package/dist/alert-dialog/alert-dialog-trigger.mjs.map +1 -0
- package/dist/alert-dialog/index.d.mts +33 -0
- package/dist/alert-dialog/index.d.mts.map +1 -0
- package/dist/alert-dialog/index.mjs +33 -0
- package/dist/alert-dialog/index.mjs.map +1 -0
- 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 +118 -0
- package/dist/button/button.d.mts.map +1 -0
- package/dist/button/button.mjs +98 -0
- package/dist/button/button.mjs.map +1 -0
- package/dist/button/index.d.mts +3 -0
- package/dist/button/index.mjs +1 -0
- package/dist/checkbox/checkbox.d.mts +32 -9
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +25 -50
- package/dist/checkbox/checkbox.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts +20 -5
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +25 -27
- 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 +3 -6
- package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.d.mts +22 -5
- package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +17 -13
- package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +37 -7
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +102 -102
- 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/collapsible/collapsible-context.mjs +8 -0
- package/dist/collapsible/collapsible-context.mjs.map +1 -0
- package/dist/collapsible/collapsible-panel.d.mts +53 -0
- package/dist/collapsible/collapsible-panel.d.mts.map +1 -0
- package/dist/collapsible/collapsible-panel.mjs +41 -0
- package/dist/collapsible/collapsible-panel.mjs.map +1 -0
- package/dist/collapsible/collapsible-root.d.mts +108 -0
- package/dist/collapsible/collapsible-root.d.mts.map +1 -0
- package/dist/collapsible/collapsible-root.mjs +147 -0
- package/dist/collapsible/collapsible-root.mjs.map +1 -0
- package/dist/collapsible/collapsible-trigger.d.mts +45 -0
- package/dist/collapsible/collapsible-trigger.d.mts.map +1 -0
- package/dist/collapsible/collapsible-trigger.mjs +62 -0
- package/dist/collapsible/collapsible-trigger.mjs.map +1 -0
- package/dist/collapsible/index.d.mts +21 -0
- package/dist/collapsible/index.d.mts.map +1 -0
- package/dist/collapsible/index.mjs +21 -0
- package/dist/collapsible/index.mjs.map +1 -0
- package/dist/combobox/chip-text.mjs +24 -0
- package/dist/combobox/chip-text.mjs.map +1 -0
- package/dist/combobox/combobox-chips.d.mts +159 -0
- package/dist/combobox/combobox-chips.d.mts.map +1 -0
- package/dist/combobox/combobox-chips.mjs +198 -0
- package/dist/combobox/combobox-chips.mjs.map +1 -0
- package/dist/combobox/combobox-clear.d.mts +29 -5
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +17 -8
- package/dist/combobox/combobox-clear.mjs.map +1 -1
- package/dist/combobox/combobox-context.mjs +4 -5
- package/dist/combobox/combobox-context.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 +14 -3
- package/dist/combobox/combobox-group.mjs.map +1 -1
- package/dist/combobox/combobox-input.d.mts +27 -5
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +53 -13
- package/dist/combobox/combobox-input.mjs.map +1 -1
- package/dist/combobox/combobox-keyboard.mjs +127 -0
- package/dist/combobox/combobox-keyboard.mjs.map +1 -0
- package/dist/combobox/combobox-label.d.mts +18 -1
- package/dist/combobox/combobox-label.d.mts.map +1 -1
- package/dist/combobox/combobox-label.mjs +4 -1
- package/dist/combobox/combobox-label.mjs.map +1 -1
- package/dist/combobox/combobox-list.d.mts +15 -1
- package/dist/combobox/combobox-list.d.mts.map +1 -1
- package/dist/combobox/combobox-list.mjs +13 -13
- package/dist/combobox/combobox-list.mjs.map +1 -1
- package/dist/combobox/combobox-option.d.mts +30 -5
- package/dist/combobox/combobox-option.d.mts.map +1 -1
- package/dist/combobox/combobox-option.mjs +9 -5
- package/dist/combobox/combobox-option.mjs.map +1 -1
- package/dist/combobox/combobox-popup.d.mts +24 -3
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +24 -29
- package/dist/combobox/combobox-popup.mjs.map +1 -1
- package/dist/combobox/combobox-root.d.mts +183 -43
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +476 -270
- package/dist/combobox/combobox-root.mjs.map +1 -1
- package/dist/combobox/combobox-trigger.d.mts +36 -8
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +50 -41
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/combobox/index.d.mts +13 -5
- package/dist/combobox/index.d.mts.map +1 -1
- package/dist/combobox/index.mjs +13 -5
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/combobox/use-combobox-form.mjs +53 -0
- package/dist/combobox/use-combobox-form.mjs.map +1 -0
- package/dist/combobox/use-combobox-text.mjs +43 -0
- package/dist/combobox/use-combobox-text.mjs.map +1 -0
- package/dist/csp/csp-provider.d.mts +33 -0
- package/dist/csp/csp-provider.d.mts.map +1 -0
- package/dist/csp/csp-provider.mjs +26 -0
- package/dist/csp/csp-provider.mjs.map +1 -0
- package/dist/csp/index.d.mts +3 -0
- package/dist/csp/index.mjs +3 -0
- package/dist/csp/style-hashes.d.mts +21 -0
- package/dist/csp/style-hashes.d.mts.map +1 -0
- package/dist/csp/style-hashes.mjs +23 -0
- package/dist/csp/style-hashes.mjs.map +1 -0
- package/dist/dialog/dialog-close.d.mts +56 -12
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +52 -55
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-context.d.mts +2 -0
- package/dist/dialog/dialog-context.mjs +14 -2
- package/dist/dialog/dialog-context.mjs.map +1 -1
- package/dist/dialog/dialog-description.d.mts +14 -1
- package/dist/dialog/dialog-description.d.mts.map +1 -1
- package/dist/dialog/dialog-description.mjs +10 -4
- package/dist/dialog/dialog-description.mjs.map +1 -1
- package/dist/dialog/dialog-dismiss.mjs +108 -0
- package/dist/dialog/dialog-dismiss.mjs.map +1 -0
- package/dist/dialog/dialog-form.d.mts +43 -11
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +64 -37
- package/dist/dialog/dialog-form.mjs.map +1 -1
- package/dist/dialog/dialog-popup.d.mts +47 -14
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +167 -242
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts +54 -19
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +74 -92
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-title.d.mts +13 -1
- package/dist/dialog/dialog-title.d.mts.map +1 -1
- package/dist/dialog/dialog-title.mjs +10 -4
- package/dist/dialog/dialog-title.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +30 -6
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +50 -28
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/dialog/index.d.mts +7 -3
- package/dist/dialog/index.d.mts.map +1 -1
- package/dist/dialog/index.mjs +7 -3
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/docs/components/accordion.md +428 -0
- package/dist/docs/components/alert-dialog.md +546 -0
- package/dist/docs/components/button.md +511 -0
- package/dist/docs/components/checkbox-group.md +483 -0
- package/dist/docs/components/checkbox.md +373 -0
- package/dist/docs/components/collapsible.md +408 -0
- package/dist/docs/components/combobox.md +960 -0
- package/dist/docs/components/context-menu.md +524 -0
- package/dist/docs/components/dialog.md +694 -0
- package/dist/docs/components/field.md +765 -0
- package/dist/docs/components/hover-card.md +494 -0
- package/dist/docs/components/menu.md +670 -0
- package/dist/docs/components/meter.md +313 -0
- package/dist/docs/components/multi-select.md +622 -0
- package/dist/docs/components/number-field.md +528 -0
- package/dist/docs/components/popover.md +656 -0
- package/dist/docs/components/progress.md +450 -0
- package/dist/docs/components/radio-group.md +457 -0
- package/dist/docs/components/select.md +670 -0
- package/dist/docs/components/separator.md +182 -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 +602 -0
- package/dist/docs/components/toggle-group.md +341 -0
- package/dist/docs/components/toggle.md +245 -0
- package/dist/docs/components/toolbar.md +390 -0
- package/dist/docs/components/tooltip.md +494 -0
- package/dist/docs/concepts/action-props.md +281 -0
- package/dist/docs/concepts/ai-agents.md +56 -0
- package/dist/docs/concepts/browser-owned-state.md +133 -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 +263 -0
- package/dist/docs/concepts/render.md +23 -0
- package/dist/docs/concepts/server-components.md +132 -0
- package/dist/docs/concepts/suspense.md +129 -0
- package/dist/docs/concepts/transitions.md +112 -0
- package/dist/docs/getting-started.md +102 -0
- package/dist/docs/index.md +187 -0
- package/dist/docs/roadmap.md +144 -0
- package/dist/docs/why.md +104 -0
- package/dist/field/field-control.d.mts +65 -0
- package/dist/field/field-control.d.mts.map +1 -0
- package/dist/field/field-control.mjs +92 -0
- package/dist/field/field-control.mjs.map +1 -0
- package/dist/field/field-description.d.mts +35 -0
- package/dist/field/field-description.d.mts.map +1 -0
- package/dist/field/field-description.mjs +35 -0
- package/dist/field/field-description.mjs.map +1 -0
- package/dist/field/field-error.d.mts +42 -0
- package/dist/field/field-error.d.mts.map +1 -0
- package/dist/field/field-error.mjs +43 -0
- package/dist/field/field-error.mjs.map +1 -0
- package/dist/field/field-label.d.mts +39 -0
- package/dist/field/field-label.d.mts.map +1 -0
- package/dist/field/field-label.mjs +50 -0
- package/dist/field/field-label.mjs.map +1 -0
- package/dist/field/field-root.d.mts +72 -0
- package/dist/field/field-root.d.mts.map +1 -0
- package/dist/field/field-root.mjs +309 -0
- package/dist/field/field-root.mjs.map +1 -0
- package/dist/field/index.d.mts +27 -0
- package/dist/field/index.d.mts.map +1 -0
- package/dist/field/index.mjs +26 -0
- package/dist/field/index.mjs.map +1 -0
- package/dist/field/use-server-error-visibility.mjs +44 -0
- package/dist/field/use-server-error-visibility.mjs.map +1 -0
- package/dist/form/form-root.d.mts +74 -0
- package/dist/form/form-root.d.mts.map +1 -0
- package/dist/form/form-root.mjs +158 -0
- package/dist/form/form-root.mjs.map +1 -0
- package/dist/form/form-submit.d.mts +56 -0
- package/dist/form/form-submit.d.mts.map +1 -0
- package/dist/form/form-submit.mjs +53 -0
- package/dist/form/form-submit.mjs.map +1 -0
- package/dist/form/index.d.mts +18 -0
- package/dist/form/index.d.mts.map +1 -0
- package/dist/form/index.mjs +18 -0
- package/dist/form/index.mjs.map +1 -0
- package/dist/hover-card/hover-card-context.mjs +13 -0
- package/dist/hover-card/hover-card-context.mjs.map +1 -0
- package/dist/hover-card/hover-card-popup.d.mts +102 -0
- package/dist/hover-card/hover-card-popup.d.mts.map +1 -0
- package/dist/hover-card/hover-card-popup.mjs +80 -0
- package/dist/hover-card/hover-card-popup.mjs.map +1 -0
- package/dist/hover-card/hover-card-root.d.mts +94 -0
- package/dist/hover-card/hover-card-root.d.mts.map +1 -0
- package/dist/hover-card/hover-card-root.mjs +74 -0
- package/dist/hover-card/hover-card-root.mjs.map +1 -0
- package/dist/hover-card/hover-card-trigger.d.mts +65 -0
- package/dist/hover-card/hover-card-trigger.d.mts.map +1 -0
- package/dist/hover-card/hover-card-trigger.mjs +109 -0
- package/dist/hover-card/hover-card-trigger.mjs.map +1 -0
- package/dist/hover-card/index.d.mts +24 -0
- package/dist/hover-card/index.d.mts.map +1 -0
- package/dist/hover-card/index.mjs +24 -0
- package/dist/hover-card/index.mjs.map +1 -0
- package/dist/hover-card/use-hover-card-interest.mjs +242 -0
- package/dist/hover-card/use-hover-card-interest.mjs.map +1 -0
- package/dist/index.d.mts +100 -13
- package/dist/index.mjs +19 -1
- package/dist/internal/{action-details.mjs → action/action-details.mjs} +1 -1
- package/dist/internal/action/action-details.mjs.map +1 -0
- package/dist/internal/action/call-urgent-handler.mjs +32 -0
- package/dist/internal/action/call-urgent-handler.mjs.map +1 -0
- package/dist/internal/action/report-dropped.mjs +27 -0
- package/dist/internal/action/report-dropped.mjs.map +1 -0
- package/dist/internal/action/use-action-trigger.mjs +67 -0
- package/dist/internal/action/use-action-trigger.mjs.map +1 -0
- package/dist/internal/action/use-connected.mjs +24 -0
- package/dist/internal/action/use-connected.mjs.map +1 -0
- package/dist/internal/action/use-controllable-action.mjs +153 -0
- package/dist/internal/action/use-controllable-action.mjs.map +1 -0
- package/dist/internal/action/use-multiple-selection.mjs +83 -0
- package/dist/internal/action/use-multiple-selection.mjs.map +1 -0
- package/dist/internal/action/use-pure-trigger.mjs +34 -0
- package/dist/internal/action/use-pure-trigger.mjs.map +1 -0
- package/dist/internal/action/use-step-commit.mjs +147 -0
- package/dist/internal/action/use-step-commit.mjs.map +1 -0
- package/dist/internal/announce.mjs +20 -0
- package/dist/internal/announce.mjs.map +1 -0
- package/dist/internal/arrow-keys.mjs +21 -0
- package/dist/internal/arrow-keys.mjs.map +1 -0
- package/dist/internal/csp-context.mjs +8 -0
- package/dist/internal/csp-context.mjs.map +1 -0
- package/dist/internal/decimal.mjs +33 -0
- package/dist/internal/decimal.mjs.map +1 -0
- package/dist/internal/details-summary.mjs +56 -0
- package/dist/internal/details-summary.mjs.map +1 -0
- package/dist/internal/dev-warn.mjs +17 -0
- package/dist/internal/dev-warn.mjs.map +1 -0
- package/dist/internal/dom-order.mjs +17 -0
- package/dist/internal/dom-order.mjs.map +1 -0
- package/dist/internal/form/field-context.d.mts +19 -0
- package/dist/internal/form/field-context.d.mts.map +1 -0
- package/dist/internal/form/field-context.mjs +24 -0
- package/dist/internal/form/field-context.mjs.map +1 -0
- package/dist/internal/form/focus-first-invalid.mjs +67 -0
- package/dist/internal/form/focus-first-invalid.mjs.map +1 -0
- package/dist/internal/form/form-status-watcher.mjs +31 -0
- package/dist/internal/form/form-status-watcher.mjs.map +1 -0
- package/dist/internal/form/group-member.mjs +37 -0
- package/dist/internal/form/group-member.mjs.map +1 -0
- package/dist/internal/form/hidden-values.mjs +29 -0
- package/dist/internal/form/hidden-values.mjs.map +1 -0
- package/dist/internal/{sync-presence.mjs → form/sync-presence.mjs} +6 -2
- package/dist/internal/form/sync-presence.mjs.map +1 -0
- package/dist/internal/form/use-checkable-input.mjs +79 -0
- package/dist/internal/form/use-checkable-input.mjs.map +1 -0
- package/dist/internal/form/use-field-control.mjs +125 -0
- package/dist/internal/form/use-field-control.mjs.map +1 -0
- package/dist/internal/form/use-fieldset-group.mjs +46 -0
- package/dist/internal/form/use-fieldset-group.mjs.map +1 -0
- package/dist/internal/form/use-form-owner-event.mjs +44 -0
- package/dist/internal/form/use-form-owner-event.mjs.map +1 -0
- package/dist/internal/form/use-form-reset.mjs +39 -0
- package/dist/internal/form/use-form-reset.mjs.map +1 -0
- package/dist/internal/{use-native-checked.mjs → form/use-native-checked.mjs} +8 -9
- package/dist/internal/form/use-native-checked.mjs.map +1 -0
- package/dist/internal/{use-native-group-reconciliation.mjs → form/use-native-group-reconciliation.mjs} +15 -12
- package/dist/internal/form/use-native-group-reconciliation.mjs.map +1 -0
- package/dist/internal/{use-native-select-value.mjs → form/use-native-select-value.mjs} +8 -6
- package/dist/internal/form/use-native-select-value.mjs.map +1 -0
- package/dist/internal/form/validity.d.mts +35 -0
- package/dist/internal/form/validity.d.mts.map +1 -0
- package/dist/internal/form/validity.mjs +98 -0
- package/dist/internal/form/validity.mjs.map +1 -0
- package/dist/internal/overlay/anchor-position.d.mts +15 -0
- package/dist/internal/overlay/anchor-position.d.mts.map +1 -0
- package/dist/internal/overlay/anchor-position.mjs +132 -0
- package/dist/internal/overlay/anchor-position.mjs.map +1 -0
- package/dist/internal/overlay/content-focus-probe.mjs +42 -0
- package/dist/internal/overlay/content-focus-probe.mjs.map +1 -0
- package/dist/internal/overlay/css-transition-cut.mjs +66 -0
- package/dist/internal/overlay/css-transition-cut.mjs.map +1 -0
- package/dist/internal/overlay/focus-visible.mjs +26 -0
- package/dist/internal/overlay/focus-visible.mjs.map +1 -0
- package/dist/internal/overlay/invokers.mjs +63 -0
- package/dist/internal/overlay/invokers.mjs.map +1 -0
- package/dist/internal/overlay/modal-registry.mjs +39 -0
- package/dist/internal/overlay/modal-registry.mjs.map +1 -0
- package/dist/internal/overlay/overlay-popup.mjs +103 -0
- package/dist/internal/overlay/overlay-popup.mjs.map +1 -0
- package/dist/internal/overlay/overlay-show.mjs +73 -0
- package/dist/internal/overlay/overlay-show.mjs.map +1 -0
- package/dist/internal/overlay/popover-open.mjs +18 -0
- package/dist/internal/overlay/popover-open.mjs.map +1 -0
- package/dist/internal/overlay/trigger-ref.mjs +26 -0
- package/dist/internal/overlay/trigger-ref.mjs.map +1 -0
- package/dist/internal/overlay/use-apply-open-state.mjs +44 -0
- package/dist/internal/overlay/use-apply-open-state.mjs.map +1 -0
- package/dist/internal/{use-exit-animation.mjs → overlay/use-exit-animation.mjs} +28 -8
- package/dist/internal/overlay/use-exit-animation.mjs.map +1 -0
- package/dist/internal/overlay/use-interest-dismiss.mjs +85 -0
- package/dist/internal/overlay/use-interest-dismiss.mjs.map +1 -0
- package/dist/internal/overlay/use-modal-registration.mjs +47 -0
- package/dist/internal/overlay/use-modal-registration.mjs.map +1 -0
- package/dist/internal/overlay/use-overlay-close.mjs +72 -0
- package/dist/internal/overlay/use-overlay-close.mjs.map +1 -0
- package/dist/internal/overlay/use-overlay-root.d.mts +2 -0
- package/dist/internal/overlay/use-overlay-root.mjs +193 -0
- package/dist/internal/overlay/use-overlay-root.mjs.map +1 -0
- package/dist/internal/overlay/use-popover-popup.mjs +287 -0
- package/dist/internal/overlay/use-popover-popup.mjs.map +1 -0
- package/dist/internal/overlay/use-popover-trigger.d.mts +16 -0
- package/dist/internal/overlay/use-popover-trigger.d.mts.map +1 -0
- package/dist/internal/overlay/use-popover-trigger.mjs +142 -0
- package/dist/internal/overlay/use-popover-trigger.mjs.map +1 -0
- package/dist/internal/overlay/use-resolved-placement.mjs +162 -0
- package/dist/internal/overlay/use-resolved-placement.mjs.map +1 -0
- package/dist/internal/platform-attributes.d.mts +2 -1
- package/dist/internal/platform-attributes.d.mts.map +1 -1
- package/dist/internal/pointer-capture.mjs +20 -0
- package/dist/internal/pointer-capture.mjs.map +1 -0
- package/dist/internal/range-value.mjs +51 -0
- package/dist/internal/range-value.mjs.map +1 -0
- package/dist/internal/render-element.d.mts +2 -0
- package/dist/internal/render-element.mjs +123 -0
- package/dist/internal/render-element.mjs.map +1 -0
- package/dist/internal/shipped-styles.mjs +14 -0
- package/dist/internal/shipped-styles.mjs.map +1 -0
- package/dist/internal/toolbar-context.mjs +17 -0
- package/dist/internal/toolbar-context.mjs.map +1 -0
- package/dist/internal/transition-boundary.mjs +5 -9
- package/dist/internal/transition-boundary.mjs.map +1 -1
- package/dist/internal/typeahead.mjs +52 -0
- package/dist/internal/typeahead.mjs.map +1 -0
- package/dist/internal/types.d.mts +42 -9
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-active-option.mjs +51 -0
- package/dist/internal/use-active-option.mjs.map +1 -0
- package/dist/internal/use-deferred-leave.mjs +113 -0
- package/dist/internal/use-deferred-leave.mjs.map +1 -0
- package/dist/internal/use-dev-warning.mjs +8 -4
- package/dist/internal/use-dev-warning.mjs.map +1 -1
- package/dist/internal/use-element-check.mjs +39 -0
- package/dist/internal/use-element-check.mjs.map +1 -0
- package/dist/internal/use-item-order.mjs +42 -0
- package/dist/internal/use-item-order.mjs.map +1 -0
- package/dist/internal/use-latest.mjs +28 -0
- package/dist/internal/use-latest.mjs.map +1 -0
- package/dist/internal/use-merged-refs.mjs +19 -0
- package/dist/internal/use-merged-refs.mjs.map +1 -0
- package/dist/internal/use-mount-fixed.mjs +22 -0
- package/dist/internal/use-mount-fixed.mjs.map +1 -0
- package/dist/internal/use-name-warning.mjs +140 -0
- package/dist/internal/use-name-warning.mjs.map +1 -0
- package/dist/internal/use-native-focusgroup.mjs +19 -0
- package/dist/internal/use-native-focusgroup.mjs.map +1 -0
- package/dist/internal/use-option-registry.mjs +70 -0
- package/dist/internal/use-option-registry.mjs.map +1 -0
- package/dist/internal/use-register-count.mjs +27 -0
- package/dist/internal/use-register-count.mjs.map +1 -0
- package/dist/internal/use-render.d.mts +2 -0
- package/dist/internal/use-render.mjs +12 -35
- package/dist/internal/use-render.mjs.map +1 -1
- package/dist/internal/use-roving-focus.mjs +288 -0
- package/dist/internal/use-roving-focus.mjs.map +1 -0
- package/dist/internal/use-value-set.mjs +20 -0
- package/dist/internal/use-value-set.mjs.map +1 -0
- package/dist/internal/value-set.mjs +41 -0
- package/dist/internal/value-set.mjs.map +1 -0
- package/dist/menu/index.d.mts +8 -2
- package/dist/menu/index.d.mts.map +1 -1
- package/dist/menu/index.mjs +7 -1
- package/dist/menu/index.mjs.map +1 -1
- package/dist/menu/menu-checkbox-item.d.mts +27 -3
- package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
- package/dist/menu/menu-checkbox-item.mjs +6 -3
- package/dist/menu/menu-checkbox-item.mjs.map +1 -1
- package/dist/menu/menu-context-trigger.d.mts +63 -0
- package/dist/menu/menu-context-trigger.d.mts.map +1 -0
- package/dist/menu/menu-context-trigger.mjs +231 -0
- package/dist/menu/menu-context-trigger.mjs.map +1 -0
- package/dist/menu/menu-context.d.mts +1 -1
- package/dist/menu/menu-context.mjs +44 -1
- package/dist/menu/menu-context.mjs.map +1 -1
- package/dist/menu/menu-dom.mjs +35 -4
- package/dist/menu/menu-dom.mjs.map +1 -1
- package/dist/menu/menu-gestures.mjs +166 -0
- package/dist/menu/menu-gestures.mjs.map +1 -0
- 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 +15 -5
- package/dist/menu/menu-group.mjs.map +1 -1
- package/dist/menu/menu-hover.mjs +0 -1
- package/dist/menu/menu-hover.mjs.map +1 -1
- package/dist/menu/menu-item.d.mts +42 -5
- package/dist/menu/menu-item.d.mts.map +1 -1
- package/dist/menu/menu-item.mjs +18 -9
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-outside.mjs +101 -0
- package/dist/menu/menu-outside.mjs.map +1 -0
- package/dist/menu/menu-point.mjs +85 -0
- package/dist/menu/menu-point.mjs.map +1 -0
- package/dist/menu/menu-popup.d.mts +68 -11
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +106 -116
- 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 +14 -7
- package/dist/menu/menu-radio-group.mjs.map +1 -1
- package/dist/menu/menu-radio-item.d.mts +18 -0
- package/dist/menu/menu-radio-item.d.mts.map +1 -1
- package/dist/menu/menu-radio-item.mjs +5 -1
- package/dist/menu/menu-radio-item.mjs.map +1 -1
- package/dist/menu/menu-root.d.mts +61 -12
- package/dist/menu/menu-root.d.mts.map +1 -1
- package/dist/menu/menu-root.mjs +72 -17
- package/dist/menu/menu-root.mjs.map +1 -1
- package/dist/menu/menu-submenu-trigger.d.mts +24 -9
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +48 -26
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +37 -16
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +39 -23
- package/dist/menu/menu-trigger.mjs.map +1 -1
- package/dist/menu/use-menu-item.mjs +14 -16
- package/dist/menu/use-menu-item.mjs.map +1 -1
- package/dist/menu/use-menu-keyboard.mjs +68 -0
- package/dist/menu/use-menu-keyboard.mjs.map +1 -0
- package/dist/meter/index.d.mts +26 -0
- package/dist/meter/index.d.mts.map +1 -0
- package/dist/meter/index.mjs +25 -0
- package/dist/meter/index.mjs.map +1 -0
- package/dist/meter/meter-context.mjs +13 -0
- package/dist/meter/meter-context.mjs.map +1 -0
- package/dist/meter/meter-indicator.d.mts +30 -0
- package/dist/meter/meter-indicator.d.mts.map +1 -0
- package/dist/meter/meter-indicator.mjs +27 -0
- package/dist/meter/meter-indicator.mjs.map +1 -0
- package/dist/meter/meter-label.d.mts +30 -0
- package/dist/meter/meter-label.d.mts.map +1 -0
- package/dist/meter/meter-label.mjs +30 -0
- package/dist/meter/meter-label.mjs.map +1 -0
- package/dist/meter/meter-region.d.mts +9 -0
- package/dist/meter/meter-region.d.mts.map +1 -0
- package/dist/meter/meter-region.mjs +39 -0
- package/dist/meter/meter-region.mjs.map +1 -0
- package/dist/meter/meter-root.d.mts +113 -0
- package/dist/meter/meter-root.d.mts.map +1 -0
- package/dist/meter/meter-root.mjs +85 -0
- package/dist/meter/meter-root.mjs.map +1 -0
- package/dist/meter/meter-track.d.mts +30 -0
- package/dist/meter/meter-track.d.mts.map +1 -0
- package/dist/meter/meter-track.mjs +27 -0
- package/dist/meter/meter-track.mjs.map +1 -0
- package/dist/meter/meter-value.d.mts +34 -0
- package/dist/meter/meter-value.d.mts.map +1 -0
- package/dist/meter/meter-value.mjs +31 -0
- package/dist/meter/meter-value.mjs.map +1 -0
- package/dist/multi-select/index.d.mts +37 -0
- package/dist/multi-select/index.d.mts.map +1 -0
- package/dist/multi-select/index.mjs +37 -0
- package/dist/multi-select/index.mjs.map +1 -0
- package/dist/multi-select/multi-select-context.mjs +19 -0
- package/dist/multi-select/multi-select-context.mjs.map +1 -0
- package/dist/multi-select/multi-select-group.d.mts +120 -0
- package/dist/multi-select/multi-select-group.d.mts.map +1 -0
- package/dist/multi-select/multi-select-group.mjs +111 -0
- package/dist/multi-select/multi-select-group.mjs.map +1 -0
- package/dist/multi-select/multi-select-keyboard.mjs +145 -0
- package/dist/multi-select/multi-select-keyboard.mjs.map +1 -0
- package/dist/multi-select/multi-select-label.d.mts +42 -0
- package/dist/multi-select/multi-select-label.d.mts.map +1 -0
- package/dist/multi-select/multi-select-label.mjs +41 -0
- package/dist/multi-select/multi-select-label.mjs.map +1 -0
- package/dist/multi-select/multi-select-list.d.mts +47 -0
- package/dist/multi-select/multi-select-list.d.mts.map +1 -0
- package/dist/multi-select/multi-select-list.mjs +65 -0
- package/dist/multi-select/multi-select-list.mjs.map +1 -0
- package/dist/multi-select/multi-select-option.d.mts +68 -0
- package/dist/multi-select/multi-select-option.d.mts.map +1 -0
- package/dist/multi-select/multi-select-option.mjs +93 -0
- package/dist/multi-select/multi-select-option.mjs.map +1 -0
- package/dist/multi-select/multi-select-popup.d.mts +58 -0
- package/dist/multi-select/multi-select-popup.d.mts.map +1 -0
- package/dist/multi-select/multi-select-popup.mjs +71 -0
- package/dist/multi-select/multi-select-popup.mjs.map +1 -0
- package/dist/multi-select/multi-select-root.d.mts +125 -0
- package/dist/multi-select/multi-select-root.d.mts.map +1 -0
- package/dist/multi-select/multi-select-root.mjs +257 -0
- package/dist/multi-select/multi-select-root.mjs.map +1 -0
- package/dist/multi-select/multi-select-trigger.d.mts +66 -0
- package/dist/multi-select/multi-select-trigger.d.mts.map +1 -0
- package/dist/multi-select/multi-select-trigger.mjs +169 -0
- package/dist/multi-select/multi-select-trigger.mjs.map +1 -0
- package/dist/multi-select/multi-select-value.d.mts +57 -0
- package/dist/multi-select/multi-select-value.d.mts.map +1 -0
- package/dist/multi-select/multi-select-value.mjs +41 -0
- package/dist/multi-select/multi-select-value.mjs.map +1 -0
- package/dist/number-field/index.d.mts +29 -0
- package/dist/number-field/index.d.mts.map +1 -0
- package/dist/number-field/index.mjs +28 -0
- package/dist/number-field/index.mjs.map +1 -0
- package/dist/number-field/number-field-arithmetic.mjs +97 -0
- package/dist/number-field/number-field-arithmetic.mjs.map +1 -0
- package/dist/number-field/number-field-context.d.mts +7 -0
- package/dist/number-field/number-field-context.d.mts.map +1 -0
- package/dist/number-field/number-field-context.mjs +13 -0
- package/dist/number-field/number-field-context.mjs.map +1 -0
- package/dist/number-field/number-field-decrement.d.mts +19 -0
- package/dist/number-field/number-field-decrement.d.mts.map +1 -0
- package/dist/number-field/number-field-decrement.mjs +22 -0
- package/dist/number-field/number-field-decrement.mjs.map +1 -0
- package/dist/number-field/number-field-format.mjs +279 -0
- package/dist/number-field/number-field-format.mjs.map +1 -0
- package/dist/number-field/number-field-increment.d.mts +19 -0
- package/dist/number-field/number-field-increment.d.mts.map +1 -0
- package/dist/number-field/number-field-increment.mjs +22 -0
- package/dist/number-field/number-field-increment.mjs.map +1 -0
- package/dist/number-field/number-field-input.d.mts +38 -0
- package/dist/number-field/number-field-input.d.mts.map +1 -0
- package/dist/number-field/number-field-input.mjs +161 -0
- package/dist/number-field/number-field-input.mjs.map +1 -0
- package/dist/number-field/number-field-label.d.mts +33 -0
- package/dist/number-field/number-field-label.d.mts.map +1 -0
- package/dist/number-field/number-field-label.mjs +43 -0
- package/dist/number-field/number-field-label.mjs.map +1 -0
- package/dist/number-field/number-field-root.d.mts +157 -0
- package/dist/number-field/number-field-root.d.mts.map +1 -0
- package/dist/number-field/number-field-root.mjs +445 -0
- package/dist/number-field/number-field-root.mjs.map +1 -0
- package/dist/number-field/use-number-field-dev-warnings.mjs +28 -0
- package/dist/number-field/use-number-field-dev-warnings.mjs.map +1 -0
- package/dist/number-field/use-step-button.d.mts +44 -0
- package/dist/number-field/use-step-button.d.mts.map +1 -0
- package/dist/number-field/use-step-button.mjs +175 -0
- package/dist/number-field/use-step-button.mjs.map +1 -0
- package/dist/popover/index.d.mts +6 -4
- package/dist/popover/index.d.mts.map +1 -1
- package/dist/popover/index.mjs +6 -4
- package/dist/popover/index.mjs.map +1 -1
- package/dist/popover/popover-close.d.mts +48 -8
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +41 -67
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-context.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 +64 -18
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +31 -36
- package/dist/popover/popover-popup.mjs.map +1 -1
- package/dist/popover/popover-root.d.mts +40 -18
- package/dist/popover/popover-root.d.mts.map +1 -1
- package/dist/popover/popover-root.mjs +15 -10
- 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 +38 -18
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +14 -9
- package/dist/popover/popover-trigger.mjs.map +1 -1
- package/dist/progress/index.d.mts +26 -0
- package/dist/progress/index.d.mts.map +1 -0
- package/dist/progress/index.mjs +26 -0
- package/dist/progress/index.mjs.map +1 -0
- package/dist/progress/progress-context.mjs +13 -0
- package/dist/progress/progress-context.mjs.map +1 -0
- package/dist/progress/progress-indicator.d.mts +30 -0
- package/dist/progress/progress-indicator.d.mts.map +1 -0
- package/dist/progress/progress-indicator.mjs +31 -0
- package/dist/progress/progress-indicator.mjs.map +1 -0
- package/dist/progress/progress-label.d.mts +30 -0
- package/dist/progress/progress-label.d.mts.map +1 -0
- package/dist/progress/progress-label.mjs +32 -0
- package/dist/progress/progress-label.mjs.map +1 -0
- package/dist/progress/progress-root.d.mts +96 -0
- package/dist/progress/progress-root.d.mts.map +1 -0
- package/dist/progress/progress-root.mjs +82 -0
- package/dist/progress/progress-root.mjs.map +1 -0
- package/dist/progress/progress-track.d.mts +30 -0
- package/dist/progress/progress-track.d.mts.map +1 -0
- package/dist/progress/progress-track.mjs +31 -0
- package/dist/progress/progress-track.mjs.map +1 -0
- package/dist/progress/progress-value.d.mts +34 -0
- package/dist/progress/progress-value.d.mts.map +1 -0
- package/dist/progress/progress-value.mjs +35 -0
- package/dist/progress/progress-value.mjs.map +1 -0
- 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-context.mjs.map +1 -1
- package/dist/radio-group/radio-group-item.d.mts +21 -5
- package/dist/radio-group/radio-group-item.d.mts.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +22 -25
- 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 +3 -6
- package/dist/radio-group/radio-group-label.mjs.map +1 -1
- package/dist/radio-group/radio-group-root.d.mts +34 -8
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +48 -39
- 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-dom.mjs +9 -18
- package/dist/select/select-dom.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 +5 -1
- 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 +8 -4
- 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 +4 -2
- package/dist/select/select-option.mjs.map +1 -1
- package/dist/select/select-root.d.mts +28 -3
- package/dist/select/select-root.d.mts.map +1 -1
- package/dist/select/select-root.mjs +39 -12
- 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 +5 -1
- 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 +5 -6
- package/dist/select/select-value.mjs.map +1 -1
- package/dist/separator/index.d.mts +3 -0
- package/dist/separator/index.mjs +1 -0
- package/dist/separator/separator.d.mts +58 -0
- package/dist/separator/separator.d.mts.map +1 -0
- package/dist/separator/separator.mjs +41 -0
- package/dist/separator/separator.mjs.map +1 -0
- package/dist/slider/index.d.mts +34 -0
- package/dist/slider/index.d.mts.map +1 -0
- package/dist/slider/index.mjs +29 -0
- package/dist/slider/index.mjs.map +1 -0
- package/dist/slider/slider-arithmetic.mjs +165 -0
- package/dist/slider/slider-arithmetic.mjs.map +1 -0
- package/dist/slider/slider-context.mjs +13 -0
- package/dist/slider/slider-context.mjs.map +1 -0
- package/dist/slider/slider-indicator.d.mts +34 -0
- package/dist/slider/slider-indicator.d.mts.map +1 -0
- package/dist/slider/slider-indicator.mjs +38 -0
- package/dist/slider/slider-indicator.mjs.map +1 -0
- package/dist/slider/slider-label.d.mts +33 -0
- package/dist/slider/slider-label.d.mts.map +1 -0
- package/dist/slider/slider-label.mjs +40 -0
- package/dist/slider/slider-label.mjs.map +1 -0
- package/dist/slider/slider-root.d.mts +155 -0
- package/dist/slider/slider-root.d.mts.map +1 -0
- package/dist/slider/slider-root.mjs +434 -0
- package/dist/slider/slider-root.mjs.map +1 -0
- package/dist/slider/slider-thumb.d.mts +87 -0
- package/dist/slider/slider-thumb.d.mts.map +1 -0
- package/dist/slider/slider-thumb.mjs +150 -0
- package/dist/slider/slider-thumb.mjs.map +1 -0
- package/dist/slider/slider-track.d.mts +46 -0
- package/dist/slider/slider-track.d.mts.map +1 -0
- package/dist/slider/slider-track.mjs +57 -0
- package/dist/slider/slider-track.mjs.map +1 -0
- package/dist/slider/slider-value.d.mts +45 -0
- package/dist/slider/slider-value.d.mts.map +1 -0
- package/dist/slider/slider-value.mjs +41 -0
- package/dist/slider/slider-value.mjs.map +1 -0
- package/dist/slider/use-slider-dev-warnings.mjs +29 -0
- package/dist/slider/use-slider-dev-warnings.mjs.map +1 -0
- package/dist/slider/use-thumb-registry.mjs +51 -0
- package/dist/slider/use-thumb-registry.mjs.map +1 -0
- package/dist/switch/switch.d.mts +30 -9
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +24 -46
- 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 +7 -3
- 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 +4 -1
- 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 +12 -23
- package/dist/tabs/tabs-list.mjs.map +1 -1
- package/dist/tabs/tabs-panel.d.mts +22 -4
- package/dist/tabs/tabs-panel.d.mts.map +1 -1
- package/dist/tabs/tabs-panel.mjs +4 -2
- package/dist/tabs/tabs-panel.mjs.map +1 -1
- package/dist/tabs/tabs-root.d.mts +43 -8
- package/dist/tabs/tabs-root.d.mts.map +1 -1
- package/dist/tabs/tabs-root.mjs +23 -10
- package/dist/tabs/tabs-root.mjs.map +1 -1
- package/dist/tabs/tabs-tab.d.mts +25 -5
- package/dist/tabs/tabs-tab.d.mts.map +1 -1
- package/dist/tabs/tabs-tab.mjs +5 -2
- package/dist/tabs/tabs-tab.mjs.map +1 -1
- package/dist/{internal → tabs}/use-until-found.mjs +1 -1
- package/dist/tabs/use-until-found.mjs.map +1 -0
- package/dist/toast/index.d.mts +27 -0
- package/dist/toast/index.d.mts.map +1 -0
- package/dist/toast/index.mjs +28 -0
- package/dist/toast/index.mjs.map +1 -0
- package/dist/toast/toast-action.d.mts +86 -0
- package/dist/toast/toast-action.d.mts.map +1 -0
- package/dist/toast/toast-action.mjs +81 -0
- package/dist/toast/toast-action.mjs.map +1 -0
- package/dist/toast/toast-close.d.mts +52 -0
- package/dist/toast/toast-close.d.mts.map +1 -0
- package/dist/toast/toast-close.mjs +53 -0
- package/dist/toast/toast-close.mjs.map +1 -0
- package/dist/toast/toast-context.mjs +19 -0
- package/dist/toast/toast-context.mjs.map +1 -0
- package/dist/toast/toast-description.d.mts +39 -0
- package/dist/toast/toast-description.d.mts.map +1 -0
- package/dist/toast/toast-description.mjs +37 -0
- package/dist/toast/toast-description.mjs.map +1 -0
- package/dist/toast/toast-hotkey.mjs +27 -0
- package/dist/toast/toast-hotkey.mjs.map +1 -0
- package/dist/toast/toast-queue.mjs +137 -0
- package/dist/toast/toast-queue.mjs.map +1 -0
- package/dist/toast/toast-root.d.mts +63 -0
- package/dist/toast/toast-root.d.mts.map +1 -0
- package/dist/toast/toast-root.mjs +209 -0
- package/dist/toast/toast-root.mjs.map +1 -0
- package/dist/toast/toast-timers.mjs +65 -0
- package/dist/toast/toast-timers.mjs.map +1 -0
- package/dist/toast/toast-title.d.mts +38 -0
- package/dist/toast/toast-title.d.mts.map +1 -0
- package/dist/toast/toast-title.mjs +35 -0
- package/dist/toast/toast-title.mjs.map +1 -0
- package/dist/toast/toast-viewport.d.mts +81 -0
- package/dist/toast/toast-viewport.d.mts.map +1 -0
- package/dist/toast/toast-viewport.mjs +345 -0
- package/dist/toast/toast-viewport.mjs.map +1 -0
- package/dist/toast/toast.d.mts +162 -0
- package/dist/toast/toast.d.mts.map +1 -0
- package/dist/toast/toast.mjs +161 -0
- package/dist/toast/toast.mjs.map +1 -0
- package/dist/toast/use-modal-portal-host.mjs +52 -0
- package/dist/toast/use-modal-portal-host.mjs.map +1 -0
- package/dist/toast/use-toast-announcements.mjs +46 -0
- package/dist/toast/use-toast-announcements.mjs.map +1 -0
- package/dist/toast/use-toast-focus.mjs +75 -0
- package/dist/toast/use-toast-focus.mjs.map +1 -0
- package/dist/toast/use-toast-pauses.mjs +58 -0
- package/dist/toast/use-toast-pauses.mjs.map +1 -0
- package/dist/toggle/toggle.d.mts +26 -6
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +12 -6
- package/dist/toggle/toggle.mjs.map +1 -1
- package/dist/toggle-group/index.d.mts +18 -0
- package/dist/toggle-group/index.d.mts.map +1 -0
- package/dist/toggle-group/index.mjs +17 -0
- package/dist/toggle-group/index.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-context.d.mts +6 -0
- package/dist/toggle-group/toggle-group-context.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-context.mjs +13 -0
- package/dist/toggle-group/toggle-group-context.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-item.d.mts +71 -0
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-item.mjs +69 -0
- package/dist/toggle-group/toggle-group-item.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-root.d.mts +156 -0
- package/dist/toggle-group/toggle-group-root.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-root.mjs +177 -0
- package/dist/toggle-group/toggle-group-root.mjs.map +1 -0
- package/dist/toolbar/index.d.mts +19 -0
- package/dist/toolbar/index.d.mts.map +1 -0
- package/dist/toolbar/index.mjs +19 -0
- package/dist/toolbar/index.mjs.map +1 -0
- package/dist/toolbar/toolbar-root.d.mts +65 -0
- package/dist/toolbar/toolbar-root.d.mts.map +1 -0
- package/dist/toolbar/toolbar-root.mjs +67 -0
- package/dist/toolbar/toolbar-root.mjs.map +1 -0
- package/dist/toolbar/toolbar-separator.d.mts +38 -0
- package/dist/toolbar/toolbar-separator.d.mts.map +1 -0
- package/dist/toolbar/toolbar-separator.mjs +33 -0
- package/dist/toolbar/toolbar-separator.mjs.map +1 -0
- package/dist/tooltip/index.d.mts +10 -5
- package/dist/tooltip/index.d.mts.map +1 -1
- package/dist/tooltip/index.mjs +8 -3
- package/dist/tooltip/index.mjs.map +1 -1
- package/dist/tooltip/tooltip-arrow.d.mts +46 -0
- package/dist/tooltip/tooltip-arrow.d.mts.map +1 -0
- package/dist/tooltip/tooltip-arrow.mjs +47 -0
- package/dist/tooltip/tooltip-arrow.mjs.map +1 -0
- package/dist/tooltip/tooltip-context.d.mts +11 -0
- package/dist/tooltip/tooltip-context.d.mts.map +1 -1
- package/dist/tooltip/tooltip-context.mjs +2 -1
- package/dist/tooltip/tooltip-context.mjs.map +1 -1
- package/dist/tooltip/tooltip-popup.d.mts +49 -7
- package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
- package/dist/tooltip/tooltip-popup.mjs +37 -15
- 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 +29 -6
- package/dist/tooltip/tooltip-root.mjs.map +1 -1
- package/dist/tooltip/tooltip-trigger.d.mts +28 -3
- package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +26 -6
- package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
- package/dist/tooltip/tooltip-warm.mjs +29 -0
- package/dist/tooltip/tooltip-warm.mjs.map +1 -0
- package/dist/tooltip/use-tooltip-interaction.mjs +128 -77
- package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
- package/package.json +27 -2
- package/skills/funstack-ui-knowledge/SKILL.md +80 -0
- package/dist/accordion/accordion-context.d.mts +0 -5
- package/dist/accordion/accordion-context.d.mts.map +0 -1
- package/dist/internal/action-details.mjs.map +0 -1
- package/dist/internal/anchor-position.d.mts +0 -7
- package/dist/internal/anchor-position.d.mts.map +0 -1
- package/dist/internal/anchor-position.mjs +0 -16
- package/dist/internal/anchor-position.mjs.map +0 -1
- package/dist/internal/sync-presence.mjs.map +0 -1
- package/dist/internal/use-action-trigger.mjs +0 -58
- package/dist/internal/use-action-trigger.mjs.map +0 -1
- package/dist/internal/use-controllable-action.mjs +0 -119
- package/dist/internal/use-controllable-action.mjs.map +0 -1
- package/dist/internal/use-exit-animation.mjs.map +0 -1
- package/dist/internal/use-form-reset.mjs +0 -54
- package/dist/internal/use-form-reset.mjs.map +0 -1
- package/dist/internal/use-native-checked.mjs.map +0 -1
- package/dist/internal/use-native-group-reconciliation.mjs.map +0 -1
- package/dist/internal/use-native-select-value.mjs.map +0 -1
- package/dist/internal/use-popover-popup.mjs +0 -274
- package/dist/internal/use-popover-popup.mjs.map +0 -1
- package/dist/internal/use-popover-root.d.mts +0 -2
- package/dist/internal/use-popover-root.mjs +0 -112
- package/dist/internal/use-popover-root.mjs.map +0 -1
- package/dist/internal/use-popover-trigger.mjs +0 -86
- package/dist/internal/use-popover-trigger.mjs.map +0 -1
- package/dist/internal/use-until-found.mjs.map +0 -1
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
# Dialog
|
|
2
|
+
|
|
3
|
+
Built on `<dialog>`, `showModal()` and Invoker Commands. The platform supplies the top layer, the backdrop, the inert page, Escape, initial focus and focus return. The library adds the asynchronous half: opening a dialog whose content loads is a transition, so the trigger shows `data-pending` and the dialog opens once its content is ready, and closing it with one of its parts waits for your action and can animate with a view transition.
|
|
4
|
+
|
|
5
|
+
```tsx title="DialogConfirm.tsx"
|
|
6
|
+
// No "use client": this file is a Server Component. The Dialog.Root has no `open`, `defaultOpen`
|
|
7
|
+
// or `openChangeAction`, so it runs in JS-free mode: the Trigger is a native
|
|
8
|
+
// `command="show-modal"` invoker, Cancel is a `command="request-close"` button and Delete submits
|
|
9
|
+
// a `<form method="dialog">`. The browser opens, focuses, closes on Escape and returns focus,
|
|
10
|
+
// before hydration and with JavaScript off.
|
|
11
|
+
import { Dialog } from "@funstack/ui/dialog";
|
|
12
|
+
|
|
13
|
+
export function DialogConfirm() {
|
|
14
|
+
return (
|
|
15
|
+
<Dialog.Root>
|
|
16
|
+
<Dialog.Trigger className="demo-button">Delete draft…</Dialog.Trigger>
|
|
17
|
+
<Dialog.Popup className="demo-dialog" role="alertdialog">
|
|
18
|
+
<Dialog.Title>Delete this draft?</Dialog.Title>
|
|
19
|
+
<Dialog.Description>This cannot be undone.</Dialog.Description>
|
|
20
|
+
<Dialog.Form className="demo-dialog-actions">
|
|
21
|
+
<Dialog.Close className="demo-button" value="cancel">
|
|
22
|
+
Cancel
|
|
23
|
+
</Dialog.Close>
|
|
24
|
+
<button type="submit" className="demo-button demo-danger" value="delete">
|
|
25
|
+
Delete
|
|
26
|
+
</button>
|
|
27
|
+
</Dialog.Form>
|
|
28
|
+
</Dialog.Popup>
|
|
29
|
+
</Dialog.Root>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```css title="dialog.css"
|
|
35
|
+
/* Dialog: the Popup is the <dialog> itself. Open state is `:open` / `:modal` on it (exact in
|
|
36
|
+
both modes); the Trigger carries `data-open` / `data-pending` in library mode only. */
|
|
37
|
+
|
|
38
|
+
/* CSS-only scroll lock, keyed on :modal: covers dialogs opened before hydration and nested ones. */
|
|
39
|
+
html:has(.demo-dialog:modal) {
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.demo-dialog {
|
|
44
|
+
inline-size: min(28rem, calc(100vw - 32px));
|
|
45
|
+
padding: 20px 24px;
|
|
46
|
+
border: 1px solid var(--color-border);
|
|
47
|
+
border-radius: 10px;
|
|
48
|
+
background: var(--color-bg);
|
|
49
|
+
color: var(--color-text);
|
|
50
|
+
box-shadow: 0 12px 40px rgb(0 0 0 / 0.3);
|
|
51
|
+
overscroll-behavior: contain;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.demo-dialog::backdrop {
|
|
55
|
+
background: rgb(0 0 0 / 0.45);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.demo-dialog h2 {
|
|
59
|
+
margin: 0 0 8px;
|
|
60
|
+
padding: 0;
|
|
61
|
+
border: 0;
|
|
62
|
+
font-size: 1.2rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.demo-dialog p {
|
|
66
|
+
margin: 0 0 12px;
|
|
67
|
+
color: var(--color-text-secondary);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Enter and exit with CSS, both modes. Enter works everywhere; the exit animates in Chromium
|
|
71
|
+
(with `overlay`) and Safari and is instant in Firefox. */
|
|
72
|
+
.demo-dialog,
|
|
73
|
+
.demo-dialog::backdrop {
|
|
74
|
+
opacity: 0;
|
|
75
|
+
transition:
|
|
76
|
+
opacity 150ms,
|
|
77
|
+
translate 150ms,
|
|
78
|
+
display 150ms allow-discrete,
|
|
79
|
+
overlay 150ms allow-discrete;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.demo-dialog {
|
|
83
|
+
translate: 0 8px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.demo-dialog:open,
|
|
87
|
+
.demo-dialog:open::backdrop {
|
|
88
|
+
opacity: 1;
|
|
89
|
+
translate: 0 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@starting-style {
|
|
93
|
+
.demo-dialog:open,
|
|
94
|
+
.demo-dialog:open::backdrop {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
}
|
|
97
|
+
.demo-dialog:open {
|
|
98
|
+
translate: 0 8px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* With `transition`, a view transition animates the library-driven opens and closes (a Close
|
|
103
|
+
part, a Form, a controlled close), Firefox included; dismissals (Escape, a click on the
|
|
104
|
+
backdrop) are the browser's and keep the CSS exit above.
|
|
105
|
+
The library keeps the two apart; no extra rule is needed. */
|
|
106
|
+
|
|
107
|
+
::view-transition-new(.demo-dialog-pop) {
|
|
108
|
+
animation: 180ms ease-out both demo-dialog-pop-in;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
::view-transition-old(.demo-dialog-pop) {
|
|
112
|
+
animation: 140ms ease-in both demo-dialog-pop-out;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@keyframes demo-dialog-pop-in {
|
|
116
|
+
from {
|
|
117
|
+
opacity: 0;
|
|
118
|
+
scale: 0.96;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@keyframes demo-dialog-pop-out {
|
|
123
|
+
to {
|
|
124
|
+
opacity: 0;
|
|
125
|
+
scale: 0.96;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@media (prefers-reduced-motion: reduce) {
|
|
130
|
+
.demo-dialog,
|
|
131
|
+
.demo-dialog::backdrop {
|
|
132
|
+
transition: none;
|
|
133
|
+
}
|
|
134
|
+
::view-transition-group(*),
|
|
135
|
+
::view-transition-old(*),
|
|
136
|
+
::view-transition-new(*) {
|
|
137
|
+
animation: none !important;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.demo-dialog-actions {
|
|
142
|
+
display: flex;
|
|
143
|
+
justify-content: flex-end;
|
|
144
|
+
gap: 8px;
|
|
145
|
+
margin-top: 16px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.demo-dialog-form label {
|
|
149
|
+
display: grid;
|
|
150
|
+
gap: 4px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.demo-dialog-form input {
|
|
154
|
+
padding: 0.35em 0.6em;
|
|
155
|
+
border: 1px solid var(--color-border);
|
|
156
|
+
border-radius: 6px;
|
|
157
|
+
background: var(--color-bg);
|
|
158
|
+
color: var(--color-text);
|
|
159
|
+
font: inherit;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.demo-dialog-details {
|
|
163
|
+
display: grid;
|
|
164
|
+
grid-template-columns: auto 1fr;
|
|
165
|
+
gap: 4px 16px;
|
|
166
|
+
margin: 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.demo-dialog-details dd {
|
|
170
|
+
margin: 0;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* The Trigger in library mode: optimistic open and pending. */
|
|
174
|
+
.demo-button[data-open] {
|
|
175
|
+
border-color: var(--color-primary);
|
|
176
|
+
color: var(--color-primary);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.demo-button[data-pending] {
|
|
180
|
+
cursor: progress;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
ul.demo-list {
|
|
184
|
+
margin: 0 0 12px;
|
|
185
|
+
padding: 0;
|
|
186
|
+
list-style: none;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
ul.demo-list .demo-row {
|
|
190
|
+
justify-content: space-between;
|
|
191
|
+
max-inline-size: 20rem;
|
|
192
|
+
padding-block: 4px;
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
For confirmations, [AlertDialog](alert-dialog.md) is this pattern with the defaults built in: `role="alertdialog"`, no light dismiss, focus on Cancel, and a confirm button that runs an async action.
|
|
197
|
+
|
|
198
|
+
This confirmation is a Server Component in JS-free mode. Every button is a native invoker or a `method="dialog"` submit, so it works before hydration and with JavaScript disabled.
|
|
199
|
+
|
|
200
|
+
## Anatomy
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import { Dialog } from "@funstack/ui/dialog";
|
|
204
|
+
|
|
205
|
+
<Dialog.Root> {/* no DOM: ids, mode, state */}
|
|
206
|
+
<Dialog.Trigger>Edit profile</Dialog.Trigger> {/* button[commandfor][command=show-modal] */}
|
|
207
|
+
<Dialog.Popup> {/* dialog */}
|
|
208
|
+
<Dialog.Title>Edit profile</Dialog.Title> {/* h2, wired to aria-labelledby */}
|
|
209
|
+
<Dialog.Description>…</Dialog.Description> {/* p, wired to aria-describedby */}
|
|
210
|
+
<Dialog.Form action={saveProfile}> {/* form: closes after the action settles */}
|
|
211
|
+
<input name="name" />
|
|
212
|
+
<Dialog.Close>Cancel</Dialog.Close> {/* button[commandfor][command=request-close] */}
|
|
213
|
+
<button type="submit">Save</button>
|
|
214
|
+
</Dialog.Form>
|
|
215
|
+
</Dialog.Popup>
|
|
216
|
+
</Dialog.Root>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
- **Root renders no DOM.** Trigger and Popup need not be siblings: `commandfor` links them by id. A Popup without a Trigger is fine (controlled `open`); a Trigger without a Popup is a development warning. A `<button commandfor command>` of your own that targets the dialog is a [foreign invoker](../concepts/browser-owned-state.md#foreign-invoker); in library mode it goes through the library too.
|
|
220
|
+
- **Popup is the `<dialog>` itself**, so it carries `::backdrop`. There is no Portal, Backdrop or Positioner part: the top layer makes them unnecessary. Nothing inside the dialog portals out of it.
|
|
221
|
+
- `render`: Popup must render a `<dialog>`, Form a `<form>`. Trigger and Close must render a `<button>` for the command path; another element works only through a click handler (Trigger in library mode, Close with `action`). Wrong elements are development warnings.
|
|
222
|
+
|
|
223
|
+
## How it works
|
|
224
|
+
|
|
225
|
+
### Two modes
|
|
226
|
+
|
|
227
|
+
| | JS-free mode | Library mode |
|
|
228
|
+
| - | - | - |
|
|
229
|
+
| Selected when | Root has none of `open`, `defaultOpen`, `openChangeAction`, `onOpenChange` | Root has any of them |
|
|
230
|
+
| Open | the browser runs `command="show-modal"` | the click is intercepted and dispatched in the Root's transition; `showModal()` runs in the commit that mounts the content |
|
|
231
|
+
| Close by a part (Close, Form, a foreign close command, controlled `open={false}`) | the browser | the click, submit or command is cancelled and dispatched in the Root's transition; `close(returnValue)` runs in the commit that ends it |
|
|
232
|
+
| Dismissal (Escape, Android back, a click outside) | the browser | the browser, at once; a fact: `onOpenChange(false)` is called synchronously, nothing is pending, no view transition |
|
|
233
|
+
| Popup content | always mounted (in the server HTML) | rendered from committed `open`; unmounted while closed unless `keepMounted` |
|
|
234
|
+
| Trigger `data-open`, `data-pending` | not emitted; style `:open` on the dialog | emitted (optimistic) |
|
|
235
|
+
| Before hydration | everything works | the native open happens; the content arrives on hydration (see below) |
|
|
236
|
+
| `transition` on Popup | no effect (development warning) | animates opens, content swaps and every library-driven close |
|
|
237
|
+
|
|
238
|
+
In library mode, opening and [a part's close](../concepts/browser-owned-state.md#parts-close) are the library's; a [dismissal](../concepts/browser-owned-state.md#dismissal) (Escape, Android back, a click outside) is the browser's: a fact, reported to `onOpenChange` ([Requests and facts](../concepts/browser-owned-state.md#requests-and-facts)). The mode is decided on the first render; switching later is not supported (development warning).
|
|
239
|
+
|
|
240
|
+
## Props
|
|
241
|
+
|
|
242
|
+
### `Dialog.Root`
|
|
243
|
+
|
|
244
|
+
| Prop | Type | Default | Description |
|
|
245
|
+
| - | - | - | - |
|
|
246
|
+
| `open` | `boolean` | – | Controlled open state. undefined means uncontrolled. Selects library mode. Pass `onOpenChange` too: the browser closes the dialog without asking (development warns). |
|
|
247
|
+
| `defaultOpen` | `boolean` | – | Initial open state in uncontrolled library mode. A dialog that starts open is shown after hydration, never by the server HTML; its content and the Trigger's open state are already in that HTML. `defaultOpen={false}` is the usual way to select library mode without an action. |
|
|
248
|
+
| `openChangeAction` | `ChangeAction<boolean, DialogOpenChangeDetails>` | – | Requests only. Awaited for `true`: the dialog opens when it resolves and the content has rendered. Awaited for a `false` the user asked a part for (a `Dialog.Close`, a `Dialog.Form` submit or settled action, a foreign close command): the dialog closes with `details.returnValue` when it resolves, with a view transition if the Popup has `transition`; a controlled parent that keeps `open` vetoes it. Never called for a dismissal (`onOpenChange`). Runs in the Root's transition; may be a Server Function; rejections reach the nearest Error Boundary above the Root. `details`: `reason` (`"activate"` or `"platform"`) and `returnValue` (the closing button's or submitter's `value`, `undefined` on open). Selects library mode. |
|
|
249
|
+
| `onOpenChange` | `UrgentChangeHandler<boolean, DialogOpenChangeDetails>` | – | Facts only: the dialog was closed without the library closing it (Escape, Android back, an assistive-technology dismiss, a click outside with `lightDismiss`, a script `close()` / `requestClose()`). Always `false`, with `reason: "dismiss"` and `returnValue` as the browser left it (`""` for Escape). Called synchronously in the browser's `close` event, outside any transition, and not awaited: nothing is pending and no view transition runs. A dismissal while a part's close is still running is reported at once and supersedes that close. In controlled mode set state directly here (`onOpenChange={setOpen}`), never in `startTransition` or after an `await`; a parent that keeps `open` gets the dialog shown again at once. May return a promise (a Server Function); a rejection or a throw goes to `reportError`. Selects library mode. |
|
|
250
|
+
| `modal` | `boolean` | `true` | `showModal()` (top layer, backdrop, inert page, Escape) or `show()`. A non-modal dialog has no command to open it, so its Trigger always uses a click handler: in JS-free mode too, it needs JavaScript to open. |
|
|
251
|
+
| `children` | `ReactNode \| ((state: DialogRootState) => ReactNode)` | – | The parts. The function form receives the optimistic state and must not suspend. |
|
|
252
|
+
|
|
253
|
+
- **State**: `DialogRootState` is `{ open, pending, modal }`; `open` is optimistic, and `open` and `pending` are `false` in JS-free mode.
|
|
254
|
+
- **Owned**: nothing rendered: the Root has no element (no `ref`, `className` or `style`).
|
|
255
|
+
|
|
256
|
+
### `Dialog.Trigger`
|
|
257
|
+
|
|
258
|
+
One per Root: focus returns to the Trigger that mounted last, and a non-modal dialog treats a press on any other one as outside. A second `Dialog.Trigger` in the same Root is not supported (development warns); use a Root per trigger.
|
|
259
|
+
|
|
260
|
+
| Prop | Type | Default | Description |
|
|
261
|
+
| - | - | - | - |
|
|
262
|
+
| `disabled` | `boolean` | `false` | Native `disabled`: a disabled button is not an invoker and never opens. With a link or component `render` where the Trigger handles the click (library mode, or a non-modal dialog), `aria-disabled="true"` instead (the element stays focusable). A host link is `aria-disabled` in every mode (it cannot be natively disabled), and its click is cancelled. |
|
|
263
|
+
| `className` | `string \| ((state: DialogTriggerState) => string \| undefined)` | – | A class name, or a function of the part's state. |
|
|
264
|
+
| `style` | `CSSProperties \| ((state: DialogTriggerState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
|
|
265
|
+
| `children` | `ReactNode \| ((state: DialogTriggerState) => ReactNode)` | – | Rendered from optimistic state; must not suspend. |
|
|
266
|
+
| `render` | `ReactElement \| ((props, state: DialogTriggerState) => ReactNode)` | – | Replace the default \<button> (element form) or take over rendering (function form). |
|
|
267
|
+
|
|
268
|
+
- **State**: `DialogTriggerState` is `{ open, pending, disabled }`; `pending` is true while the Root is pending: an open in flight, or a part's close waiting for `openChangeAction(false)`. A dismissal never pends, but a request still running when a dismissal superseded it keeps `pending` until that request settles.
|
|
269
|
+
- **Owned**: `type` (on a `<button>` only), `disabled`, `aria-disabled` (a host link, or a component `render` with the click handler installed), `commandfor`, `command` (not on a link or other non-button host element), `onClick` (when it installs one), `onPointerDown` (non-modal JS-free mode), `data-open`, `data-pending`, `data-disabled`.
|
|
270
|
+
|
|
271
|
+
### `Dialog.Popup`
|
|
272
|
+
|
|
273
|
+
| Prop | Type | Default | Description |
|
|
274
|
+
| - | - | - | - |
|
|
275
|
+
| `keepMounted` | `boolean` | `false` | Library mode. `false`: children are not rendered while closed, so content that suspends holds the open until it is ready. `true`: children stay in `<Activity mode="hidden">` (state kept, effects stopped, pre-rendered at low priority; not in the server HTML). Either way, unmounting waits for the dialog's CSS exit animation, or happens inside the close's view transition when `transition` is set. Ignored in JS-free mode (always mounted). An action of a part inside that rejects while it is hidden goes to `reportError`, not to an Error Boundary (see [Action props](../concepts/action-props.md)). |
|
|
276
|
+
| `initialFocus` | `RefObject<HTMLElement \| null> \| string` | – | The element to focus on open: a ref, or a selector resolved inside the dialog. The library writes `autofocus` on it right before `showModal()` and lets the platform focus it; it never calls `.focus()`. Default: the platform's choice (the first focusable element). In JS-free mode the attribute is written after mount; prefer it to `autoFocus`, which React writes only into server-rendered HTML (not when the Popup renders on the client, for example after a client navigation to a Server Component page). |
|
|
277
|
+
| `lightDismiss` | `boolean` | `false` | Close on a click outside the dialog (the `::backdrop` for a modal). JS `pointerdown` and `click` listeners: both the press and the click must land outside, so a drag that starts inside (selecting text) never closes. With `experimental_closedBy`, native `closedby="any"`, which behaves the same. A click on the Trigger of an open non-modal dialog counts as outside, as native `closedby="any"` treats it: the dialog ends closed and the click does not re-open it, in JS-free and library mode. |
|
|
278
|
+
| `experimental_closedBy` | `boolean` | `false` | Renders `closedby` (`"any"` with `lightDismiss`, else `"closerequest"`) and skips the JS dismiss listeners where the browser implements it (Chromium, Firefox). Elsewhere the JS stays. See [Experimental features](../concepts/experimental.md). |
|
|
279
|
+
| `transition` | `ViewTransitionClass` | – | Library mode only. Forwarded to the `<ViewTransition>` around the dialog; without it no boundary is rendered. Animates the opening commit, content swaps while open, and every library-driven close (a Close part, a Form submit or settled action, a foreign close command, a controlled `open={false}`) in all engines. Dismissals (Escape, a click outside) are the browser's and animate with CSS only. Keep it static; any value makes a Root inserted by a transition run the page cross-fade. |
|
|
280
|
+
| `className` | `string \| ((state: DialogPopupState) => string \| undefined)` | – | A class name, or a function of the part's state. |
|
|
281
|
+
| `style` | `CSSProperties \| ((state: DialogPopupState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
|
|
282
|
+
| `children` | `ReactNode \| ((state: DialogPopupState) => ReactNode)` | – | Content, or a function of the part's state. |
|
|
283
|
+
| `render` | `ReactElement \| ((props, state: DialogPopupState) => ReactNode)` | – | Replace the default \<dialog> (element form) or take over rendering (function form). |
|
|
284
|
+
|
|
285
|
+
- **State**: `DialogPopupState` is `{ open, modal }`; `open` is committed (`false` in JS-free mode; `:open` is the DOM truth).
|
|
286
|
+
- **Owned**: `id`, `open` (never rendered: opening goes through `showModal()` only), `closedby`, `data-modal`, `suppressHydrationWarning`; `aria-labelledby` and `aria-describedby` are merged with yours. `onToggle` and `onBeforeToggle` are not accepted: use a `ref` for the platform events.
|
|
287
|
+
|
|
288
|
+
Other props, such as `role` or `onCancel`, pass through. For a confirmation, use [AlertDialog](alert-dialog.md): `role="alertdialog"`, no light dismiss and focus on Cancel are its defaults.
|
|
289
|
+
|
|
290
|
+
### `Dialog.Close`
|
|
291
|
+
|
|
292
|
+
| Prop | Type | Default | Description |
|
|
293
|
+
| - | - | - | - |
|
|
294
|
+
| `action` | `Action<[details: DialogCloseDetails]>` | – | Runs in this button's own transition (`data-pending` on it), then closes the dialog with `value` as `returnValue`: in library mode through the Root (`openChangeAction(false)` awaited, view transition if set; the button stays pending until the dialog closes), in JS-free mode with `close(value)`. A rejection reaches the nearest Error Boundary above the button and leaves the dialog open. If the dialog was closed and opened again while the action ran, the close is dropped: it belonged to the previous opening. A second click while it is pending is ignored, and the button is `aria-disabled="true"` meanwhile, unless `whilePending` is `"run"`. With `action` the button renders no `commandfor` / `command`, so a click before hydration does nothing (rather than closing the dialog without running the action). Without `action` the button is a native `command="request-close"` invoker in JS-free mode and goes straight through the Root in library mode. `details.returnValue` is the `value`. |
|
|
295
|
+
| `whilePending` | `"run" \| "ignore"` | `"ignore"` | What a click, Enter or Space does while this part's `action` is pending. `"ignore"`: nothing (the click is cancelled, `aria-disabled="true"` meanwhile). `"run"`: the action runs again (`data-pending` until every run has settled, no `aria-disabled`); the dialog closes once the last run has settled, and only if the latest run resolved: a rejection leaves it open in both modes. No effect without `action`. See [A second click while pending](../concepts/pending-and-optimistic.md#second-click). |
|
|
296
|
+
| `value` | `string` | – | Becomes `dialog.returnValue`, and `details.returnValue` of `openChangeAction(false)`. |
|
|
297
|
+
| `disabled` | `boolean` | `false` | Native `disabled`; owned, so a `render` element cannot re-enable it. With a link or component `render` where the Close handles the click (library mode, or with `action`), `aria-disabled="true"` instead (the element stays focusable). A host link is `aria-disabled` in every mode (it cannot be natively disabled), and its click is cancelled. |
|
|
298
|
+
| `className` | `string \| ((state: DialogCloseState) => string \| undefined)` | – | A class name, or a function of the part's state. |
|
|
299
|
+
| `style` | `CSSProperties \| ((state: DialogCloseState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
|
|
300
|
+
| `children` | `ReactNode \| ((state: DialogCloseState) => ReactNode)` | – | Content, or a function of the part's state. |
|
|
301
|
+
| `render` | `ReactElement \| ((props, state: DialogCloseState) => ReactNode)` | – | Replace the default \<button> (element form) or take over rendering (function form). |
|
|
302
|
+
|
|
303
|
+
- **State**: `DialogCloseState` is `{ pending, disabled }`.
|
|
304
|
+
- **Owned**: `type` (on a `<button>` only), `disabled`, `aria-disabled`, `commandfor`, `command` (not with `action`, and not on a link or other non-button host element), `value`, `onClick` (library mode, or with `action`), `data-pending`, `data-disabled`; a `render` element cannot re-enable a disabled Close.
|
|
305
|
+
|
|
306
|
+
By default (`whilePending="ignore"`) a second click, Enter or Space while the action is pending is ignored (and cancelled), and the button is `aria-disabled="true"` for as long as it shows `data-pending`, which spans the action and the close; it is never natively disabled, so it keeps focus. To close at once and finish the work in the background, do not return the promise: `action={() => { void save(); }}`.
|
|
307
|
+
|
|
308
|
+
### `Dialog.Form`
|
|
309
|
+
|
|
310
|
+
| Prop | Type | Default | Description |
|
|
311
|
+
| - | - | - | - |
|
|
312
|
+
| `action` | `string \| ((formData: FormData) => unknown)` | – | Without `action` the form renders `method="dialog"`: a submit closes the dialog with the submitter's `value`, natively in JS-free mode and through the Root in library mode (`openChangeAction(false)` awaited, view transition if set). A `preventDefault()` in your `onSubmit` keeps it open in both modes. A function (may be a Server Function) is React's form action, passed through unwrapped; the dialog closes, in the same way, once the action's transition has settled, including any Suspense wait it causes (see `closeOnSettle`). A rejection leaves the dialog open. A string is a plain navigating form. |
|
|
313
|
+
| `closeOnSettle` | `boolean` | `true` | With a function `action`: close the dialog once the action settles without throwing and, when the form is rendered as a `Form.Root` (`render={<Form.Root errors={state.errors} />}`), with no field error: a settle whose `errors` has a non-empty entry (hidden stale ones included, the `autoReset` rule) keeps the dialog open and the Form focuses the first errored field. Without a `Form.Root` the library never sees a result, so any settle that does not throw counts, including a `useActionState` result that reports errors: render the form as a `Form.Root` to route them, throw to keep the dialog open, or set `false` and close it yourself (a `Dialog.Close`, a submit button in a separate `method="dialog"` form, or a controlled `open`; a `formMethod="dialog"` submitter inside this form runs the action again instead). The dialog is never closed when it was closed while the action ran, even if the user re-opened it meanwhile. |
|
|
314
|
+
| `method` | `string` | – | Only with a string `action` (for example `"post"`). Otherwise owned: `"dialog"` without `action`, React's own with a function. |
|
|
315
|
+
| `className` | `string \| ((state: DialogFormState) => string \| undefined)` | – | A class name, or a function of the part's state. |
|
|
316
|
+
| `style` | `CSSProperties \| ((state: DialogFormState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
|
|
317
|
+
| `children` | `ReactNode \| ((state: DialogFormState) => ReactNode)` | – | Content, or a function of the part's state. |
|
|
318
|
+
| `render` | `ReactElement \| ((props, state: DialogFormState) => ReactNode)` | – | Replace the default \<form> (element form) or take over rendering (function form). |
|
|
319
|
+
|
|
320
|
+
- **State**: `DialogFormState` is `{ pending }`, this form's `useFormStatus().pending`; it is not emitted as `data-pending` and not folded into any other part's state.
|
|
321
|
+
- **Owned**: `action`, and `method` unless `action` is a string.
|
|
322
|
+
|
|
323
|
+
With field errors from `useActionState`, render it as a `Form.Root`: `<Dialog.Form action={dispatch} render={<Form.Root errors={state.errors} />}>`. The Form then runs the action, routes the errors to its fields and resets the form only on success (React's own path resets it after every successful action), and the dialog closes only on a result with no field error: errors keep it open with the first errored field focused. The composition needs a function `action` (without one the form would navigate; a development warning says so). The reset runs before the close, so pass `autoReset={false}` on the `Form.Root` element if your exit animation is visible. See [Field and Form: in a Dialog](field.md#dialog-form).
|
|
324
|
+
|
|
325
|
+
### `Dialog.Title`, `Dialog.Description`
|
|
326
|
+
|
|
327
|
+
| Prop | Type | Default | Description |
|
|
328
|
+
| - | - | - | - |
|
|
329
|
+
| `className` | `string \| ((state: DialogTitleState) => string \| undefined)` | – | A class name, or a function of the part's state. |
|
|
330
|
+
| `style` | `CSSProperties \| ((state: DialogTitleState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
|
|
331
|
+
| `children` | `ReactNode \| ((state: DialogTitleState) => ReactNode)` | – | Content, or a function of the part's state. |
|
|
332
|
+
| `render` | `ReactElement \| ((props, state: DialogTitleState) => ReactNode)` | – | Replace the default \<h2> (Title) or \<p> (Description). `render={<h3 />}` changes the heading level. |
|
|
333
|
+
|
|
334
|
+
- **State**: the Popup's (`DialogTitleState` and `DialogDescriptionState` are `DialogPopupState`).
|
|
335
|
+
- **Owned**: `id`.
|
|
336
|
+
|
|
337
|
+
## Data attributes
|
|
338
|
+
|
|
339
|
+
| Hook | On | Meaning |
|
|
340
|
+
| - | - | - |
|
|
341
|
+
| `:open` | Popup | The dialog is open (DOM truth, both modes). |
|
|
342
|
+
| `:modal` | Popup | Opened with `showModal()`. |
|
|
343
|
+
| `::backdrop` | Popup | The modal backdrop. |
|
|
344
|
+
| `data-modal` | Popup | The `modal` prop (also before the dialog opens). |
|
|
345
|
+
| `data-open` | Trigger | Optimistic open state (library mode only). |
|
|
346
|
+
| `data-pending` | Trigger | An open or a part's close is in flight (library mode only). A dismissal never pends, but a request still running when a dismissal superseded it keeps it until that request settles. |
|
|
347
|
+
| `data-pending` | Close | Its `action` is in flight. |
|
|
348
|
+
| `aria-disabled` | Close | `"true"` while `data-pending` with `whilePending="ignore"` (the default): a second click is ignored meanwhile. |
|
|
349
|
+
| `data-disabled` | Trigger, Close | The `disabled` prop (both modes). |
|
|
350
|
+
|
|
351
|
+
The `<dialog>` emits no `data-open`: `:open` and `:modal` are exact. Enter and exit animate in CSS, in both modes:
|
|
352
|
+
|
|
353
|
+
```css
|
|
354
|
+
.dialog, .dialog::backdrop {
|
|
355
|
+
opacity: 0;
|
|
356
|
+
transition: opacity 150ms, display 150ms allow-discrete, overlay 150ms allow-discrete;
|
|
357
|
+
}
|
|
358
|
+
.dialog:open, .dialog:open::backdrop { opacity: 1; }
|
|
359
|
+
@starting-style { .dialog:open, .dialog:open::backdrop { opacity: 0; } }
|
|
360
|
+
|
|
361
|
+
/* Scroll lock, CSS only: keyed on :modal, so it covers pre-hydration opens and nested dialogs. */
|
|
362
|
+
html { scrollbar-gutter: stable; }
|
|
363
|
+
html:has(dialog:modal) { overflow: hidden; }
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
The CSS exit animates in Chromium and Safari; Firefox closes a dialog instantly. The library keeps the content mounted until the exit animation ends, so a fading dialog is never empty, and a controlled close keeps it through the fade as well.
|
|
367
|
+
|
|
368
|
+
## Keyboard and ARIA
|
|
369
|
+
|
|
370
|
+
| Key | Behaviour | Who |
|
|
371
|
+
| - | - | - |
|
|
372
|
+
| Enter / Space on the Trigger | Opens | the browser (JS-free) or the Trigger |
|
|
373
|
+
| Tab / Shift+Tab in a modal | Cycles through the dialog and the browser UI; the page is inert | the browser |
|
|
374
|
+
| Escape (modal) | Closes and returns focus; `onOpenChange(false, { reason: "dismiss" })` | the browser |
|
|
375
|
+
| Escape (non-modal) | Closes with `requestClose()` | the Popup (or `closedby` with the flag) |
|
|
376
|
+
| Escape in a nested dialog | Closes the innermost one only | the browser |
|
|
377
|
+
| Enter in a form field | Submits the Form: closes (through the Root in library mode), or runs the action and then closes | the browser / Form |
|
|
378
|
+
|
|
379
|
+
- The Popup's role is the native `dialog`; `aria-modal` is exposed by the browser after `showModal()`, never set by hand. `role="alertdialog"` passes through; for a confirmation that needs an answer, [AlertDialog](alert-dialog.md) renders it for you, with no light dismiss and focus on Cancel. `aria-labelledby` and `aria-describedby` point at Title and Description. A Popup with neither a Title nor an `aria-label` is a development warning.
|
|
380
|
+
- There is no focus trap: `showModal()` makes the rest of the page inert. Focus return is the platform's; the library only steps in when the opener has been removed (focus goes to the Trigger if it is still there, else to the body), and when a library-driven close of a non-modal dialog unmounted the focused button before the dialog closed (focus goes to the Trigger).
|
|
381
|
+
- For long or destructive dialogs, focus a static element so the title is heard first: `initialFocus` pointing at a `<Dialog.Title tabIndex={-1}>`.
|
|
382
|
+
- The Trigger is a plain button: no `aria-expanded`, no `aria-haspopup`. Give an icon-only Close an `aria-label`.
|
|
383
|
+
|
|
384
|
+
> **Escape cannot be turned off**
|
|
385
|
+
>
|
|
386
|
+
> Browsers honour `cancel.preventDefault()` only once per user activation, so a `closeOnEscape={false}` prop could not keep its promise. Build "unsaved changes" confirmation inside the dialog: a "Discard…" button that is the Trigger of a nested confirm Dialog, whose own `Dialog.Close action` does the work and then closes the outer dialog. Never write an action that awaits the user's answer in another dialog: React holds every transition started while an async action is pending, so the confirm would never open.
|
|
387
|
+
|
|
388
|
+
## Transition types
|
|
389
|
+
|
|
390
|
+
Concept: [Transitions & ViewTransition](../concepts/transitions.md#transition-types)
|
|
391
|
+
|
|
392
|
+
Library mode: `fsui-dialog` plus `fsui-dialog-open` or `fsui-dialog-close`; a controlled close carries none. JS-free mode starts no transitions.
|
|
393
|
+
|
|
394
|
+
### ViewTransition: an exit in every engine
|
|
395
|
+
|
|
396
|
+
With `transition`, the Popup renders `<ViewTransition>` around the `<dialog>`. A library-driven open calls `showModal()` in the layout effect of its commit and a library-driven close calls `close(returnValue)` in the layout effect of its commit, so the view transition captures the dialog's box as `::view-transition-new` on open and `::view-transition-old` (with its content) on close. That is the only way a dialog's exit can animate in Firefox. The order example below uses it.
|
|
397
|
+
|
|
398
|
+
```tsx
|
|
399
|
+
<Dialog.Popup transition={{ "fsui-dialog-open": "pop", "fsui-dialog-close": "pop", default: "none" }}>
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
```css
|
|
403
|
+
::view-transition-new(.pop) { animation: 180ms ease-out both pop-in; }
|
|
404
|
+
::view-transition-old(.pop) { animation: 140ms ease-in both pop-out; }
|
|
405
|
+
@media (prefers-reduced-motion: reduce) {
|
|
406
|
+
::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
- Library-driven closes: a `Dialog.Close`, a `Dialog.Form` submit or settled action, a foreign `request-close` / `close` command, a controlled `open={false}`. Transition types: `fsui-dialog` plus `fsui-dialog-open` or `fsui-dialog-close`; a controlled close carries none.
|
|
411
|
+
- Dismissals (Escape, a click outside) animate with the CSS exit only: keep it next to `transition`. The library turns the dialog's CSS transitions off for the moment of its own show and hide while a view transition runs, so you need no extra rule ([A popup with a CSS exit and a view transition](../concepts/transitions.md#css-exit)).
|
|
412
|
+
- The `::backdrop` is not captured on its own: it is part of the page snapshot and leaves with the root cross-fade. A backdrop that should animate with the dialog is an element rendered as the Popup's first child (`position: fixed; inset: 0`; clicks on it are not light dismiss).
|
|
413
|
+
- A plain open with `transition="none"` starts no document view transition (the content mounts under the already-mounted `<dialog>`). A Root inserted by a transition with `transition` on its Popup, or a nested Popup with `transition` that mounts with the outer content, runs the page cross-fade ([issue #35](https://github.com/uhyo/funstack-ui/issues/35)).
|
|
414
|
+
|
|
415
|
+
## Optimistic and pending
|
|
416
|
+
|
|
417
|
+
Concept: [Pending & optimistic state](../concepts/pending-and-optimistic.md)
|
|
418
|
+
|
|
419
|
+
Library mode: the Trigger shows the optimistic open state (`data-open`) and `data-pending` while an open or a part's close is in flight; a dismissal is a fact and pends nothing. The Popup's content renders from the committed `open`. A Close with an `action` is a [pure trigger](../concepts/pending-and-optimistic.md#pure-trigger) (`data-pending`; `aria-disabled` while it ignores a second click, the default).
|
|
420
|
+
|
|
421
|
+
### Walkthrough (library mode)
|
|
422
|
+
|
|
423
|
+
```tsx title="DialogOrders.tsx"
|
|
424
|
+
"use client";
|
|
425
|
+
import { use, useState } from "react";
|
|
426
|
+
import { Dialog } from "@funstack/ui/dialog";
|
|
427
|
+
import type { DialogOpenChangeDetails } from "@funstack/ui/dialog";
|
|
428
|
+
import { sleep } from "./fake-api.js";
|
|
429
|
+
|
|
430
|
+
interface Order {
|
|
431
|
+
readonly items: string;
|
|
432
|
+
readonly total: string;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// Cache the promises so `use()` sees the same one on every render.
|
|
436
|
+
const cache = new Map<string, Promise<Order>>();
|
|
437
|
+
function loadOrder(id: string): Promise<Order> {
|
|
438
|
+
let promise = cache.get(id);
|
|
439
|
+
if (promise === undefined) {
|
|
440
|
+
promise = sleep(1200).then(() => ({
|
|
441
|
+
items: id === "1042" ? "Keyboard, USB-C cable" : "Notebook",
|
|
442
|
+
total: id === "1042" ? "$129.00" : "$18.50",
|
|
443
|
+
}));
|
|
444
|
+
cache.set(id, promise);
|
|
445
|
+
}
|
|
446
|
+
return promise;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function OrderDetails({ id }: { id: string }) {
|
|
450
|
+
const order = use(loadOrder(id));
|
|
451
|
+
return (
|
|
452
|
+
<dl className="demo-dialog-details">
|
|
453
|
+
<dt>Items</dt>
|
|
454
|
+
<dd>{order.items}</dd>
|
|
455
|
+
<dt>Total</dt>
|
|
456
|
+
<dd>{order.total}</dd>
|
|
457
|
+
</dl>
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// Library mode: `defaultOpen={false}` (or any action prop) hands the open to the library. The
|
|
462
|
+
// Popup's children render from committed state, so <OrderDetails> mounts inside the opening
|
|
463
|
+
// transition and suspends: the dialog stays closed and the Trigger carries data-pending until the
|
|
464
|
+
// data is ready, then the dialog opens once, complete. The Close button's close is library-owned
|
|
465
|
+
// too: openChangeAction(false) runs first, then the dialog closes in a view transition
|
|
466
|
+
// (`transition`), so the exit animates in every engine, Firefox included. Escape and a click on
|
|
467
|
+
// the backdrop are dismissals: the browser closes the dialog (with the CSS exit), a fact reported
|
|
468
|
+
// to `onOpenChange` synchronously. The readout shows what the Root received.
|
|
469
|
+
export function DialogOrders() {
|
|
470
|
+
const [last, setLast] = useState("(none yet)");
|
|
471
|
+
const record = (open: boolean, { reason, returnValue }: DialogOpenChangeDetails) => {
|
|
472
|
+
// The synchronous part of an action: this setState is a transition update.
|
|
473
|
+
setLast(`openChangeAction(${open}, "${reason}") returnValue=${JSON.stringify(returnValue)}`);
|
|
474
|
+
};
|
|
475
|
+
const recordFact = (open: boolean, { reason, returnValue }: DialogOpenChangeDetails) => {
|
|
476
|
+
// A fact handler: this setState is urgent.
|
|
477
|
+
setLast(`onOpenChange(${open}, "${reason}") returnValue=${JSON.stringify(returnValue)}`);
|
|
478
|
+
};
|
|
479
|
+
return (
|
|
480
|
+
<>
|
|
481
|
+
<ul className="demo-list">
|
|
482
|
+
{["1042", "1043"].map((id) => (
|
|
483
|
+
<li key={id} className="demo-row">
|
|
484
|
+
Order #{id}
|
|
485
|
+
<Dialog.Root defaultOpen={false} openChangeAction={record} onOpenChange={recordFact}>
|
|
486
|
+
<Dialog.Trigger className="demo-button">
|
|
487
|
+
{({ pending }) => (
|
|
488
|
+
<>
|
|
489
|
+
Details
|
|
490
|
+
{pending && <span className="demo-spinner" aria-hidden />}
|
|
491
|
+
</>
|
|
492
|
+
)}
|
|
493
|
+
</Dialog.Trigger>
|
|
494
|
+
<Dialog.Popup
|
|
495
|
+
className="demo-dialog"
|
|
496
|
+
lightDismiss
|
|
497
|
+
initialFocus="[data-autofocus]"
|
|
498
|
+
transition={{
|
|
499
|
+
"fsui-dialog-open": "demo-dialog-pop",
|
|
500
|
+
"fsui-dialog-close": "demo-dialog-pop",
|
|
501
|
+
default: "none",
|
|
502
|
+
}}
|
|
503
|
+
>
|
|
504
|
+
<Dialog.Title>Order #{id}</Dialog.Title>
|
|
505
|
+
<OrderDetails id={id} />
|
|
506
|
+
<div className="demo-dialog-actions">
|
|
507
|
+
<Dialog.Close className="demo-button" value="done" data-autofocus="">
|
|
508
|
+
Close
|
|
509
|
+
</Dialog.Close>
|
|
510
|
+
</div>
|
|
511
|
+
</Dialog.Popup>
|
|
512
|
+
</Dialog.Root>
|
|
513
|
+
</li>
|
|
514
|
+
))}
|
|
515
|
+
</ul>
|
|
516
|
+
<div className="demo-row">
|
|
517
|
+
<button type="button" className="demo-button" onClick={() => cache.clear()}>
|
|
518
|
+
Clear the cache
|
|
519
|
+
</button>
|
|
520
|
+
</div>
|
|
521
|
+
<output className="demo-readout">
|
|
522
|
+
last call: <code>{last}</code>
|
|
523
|
+
</output>
|
|
524
|
+
</>
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
`dialog.css`: the same file as above.
|
|
530
|
+
|
|
531
|
+
1. Click Details: the click is cancelled (so the native command does not run), the Trigger gets `data-open` and `data-pending`, and `openChangeAction(true, { reason: "activate", returnValue: undefined })` runs.
|
|
532
|
+
2. The commit that sets committed `open` renders the Popup's children; `OrderDetails` suspends, so React holds the commit. The dialog stays closed; the Trigger keeps spinning.
|
|
533
|
+
3. The data arrives: the content commits and `showModal()` runs in the same commit's layout effect, so the platform focuses fully rendered content (here the Close button, through `initialFocus`).
|
|
534
|
+
4. Close it with the Close button: the click is cancelled, the Trigger shows `data-pending` while `openChangeAction(false, { reason: "activate", returnValue: "done" })` runs, then the dialog closes in a view transition (the `transition` prop), in Firefox too. Escape or a click on the backdrop (`lightDismiss`) are dismissals: the browser closes the dialog at once and the Root calls `onOpenChange(false, { reason: "dismiss" })` in the same event, with nothing pending. The second open is instant (the data is cached).
|
|
535
|
+
5. If the opening action rejects, the error reaches the Error Boundary above the Root and the dialog never opens.
|
|
536
|
+
|
|
537
|
+
To open now and show a skeleton instead, put a `<Suspense>` boundary inside the Popup: a newly mounted boundary shows its fallback immediately.
|
|
538
|
+
|
|
539
|
+
> **A part's close is yours to refuse; a dismissal's is not**
|
|
540
|
+
>
|
|
541
|
+
> A close a part asks for waits for `openChangeAction(false)`: a controlled parent that keeps `open` gets a plain snap-back, and the dialog never blinks (for example "the save failed, keep editing", checked through `details.returnValue`). A dismissal is already done when `onOpenChange` runs: a parent that does not adopt `false` gets the dialog re-opened at once, and the user sees it close and come back (a modal dialog takes focus back; a non-modal one leaves focus where the dismissal put it). Adopt a dismissal's `false` directly in `onOpenChange` (not in `startTransition`, not after an `await`). If the user dismisses the dialog while a part's close is still running, `onOpenChange` hears it at once and that close is superseded: a later veto of it changes nothing. Neither is a way to ask the user first: an action must never await input, so build confirmation inside the dialog (see the callout above).
|
|
542
|
+
|
|
543
|
+
## Suspense
|
|
544
|
+
|
|
545
|
+
Concept: [Suspense](../concepts/suspense.md)
|
|
546
|
+
|
|
547
|
+
Content that suspends holds the open: the dialog stays closed with the Trigger pending, then opens once, complete. A `<Suspense>` inside the Popup opens at once with a skeleton instead.
|
|
548
|
+
|
|
549
|
+
## Browser-owned state
|
|
550
|
+
|
|
551
|
+
Concept: [Browser-owned state](../concepts/browser-owned-state.md)
|
|
552
|
+
|
|
553
|
+
JS-free mode: the browser owns everything through Invoker Commands. Library mode: opening and a close asked for by a part are requests (`openChangeAction`); a dismissal (Escape, Android back, a click outside) is the browser's, a fact: the dialog closes at once, `onOpenChange(false)` is called with `reason: "dismiss"`, and a controlled parent that keeps `open` gets it re-opened at once. Dismissals animate with CSS only.
|
|
554
|
+
|
|
555
|
+
## Before hydration
|
|
556
|
+
|
|
557
|
+
Concept: [Server Components](../concepts/server-components.md#before-hydration)
|
|
558
|
+
|
|
559
|
+
JS-free mode: everything for a modal dialog: open (`command="show-modal"`), Escape, Close buttons without `action` (`command="request-close"`; one with `action` does nothing until hydration), `<form method="dialog">`, focus and focus return, `autoFocus` in server-rendered markup, CSS animation; a `Dialog.Form` with a Server Function action submits with React's progressive enhancement. Hydration adds `initialFocus`, `lightDismiss` and closing after a form action. A non-modal dialog needs JavaScript to open. Library mode: the Trigger opens the dialog natively, but its content is not in the HTML; on hydration it is reconciled with one `openChangeAction(true)` call (`reason: "platform"`) and the content mounts.
|
|
560
|
+
|
|
561
|
+
### The [platform paths](../concepts/browser-owned-state.md#platform-path)
|
|
562
|
+
|
|
563
|
+
- **Before hydration, JS-free mode:** everything works, including `autoFocus` in server-rendered markup and `Dialog.Form` with a Server Function action (React's progressive enhancement). After hydration, and for content React renders on the client, use `initialFocus`: React does not write `autofocus` on client-rendered elements.
|
|
564
|
+
- **Before hydration, library mode:** the Trigger already carries the command, so a click opens the dialog natively, but the content is not in the HTML yet. On hydration the Popup finds the dialog open and dispatches `openChangeAction(true, { reason: "platform" })` with no event; the content mounts into the open dialog. If the action rejects or a controlled parent refuses, the dialog closes again. A dialog whose pre-hydration experience matters belongs in JS-free mode.
|
|
565
|
+
- **Foreign invokers:** in library mode, any `<button commandfor command="show-modal">` (or `"request-close"` / `"close"`) pointing at the dialog goes through the library too, as the Trigger and Close parts do; a close command's `value` becomes the `returnValue`.
|
|
566
|
+
|
|
567
|
+
## Forms
|
|
568
|
+
|
|
569
|
+
```tsx title="DialogProfile.tsx"
|
|
570
|
+
"use client";
|
|
571
|
+
import { startTransition, useState } from "react";
|
|
572
|
+
import { useFormStatus } from "react-dom";
|
|
573
|
+
import { Dialog } from "@funstack/ui/dialog";
|
|
574
|
+
import { DemoErrorBoundary } from "./DemoErrorBoundary.js";
|
|
575
|
+
import { sleep } from "./fake-api.js";
|
|
576
|
+
|
|
577
|
+
function SaveButton() {
|
|
578
|
+
// React's form channel. The Form part only observes it; nothing in the library reports it as
|
|
579
|
+
// its own pending state.
|
|
580
|
+
const { pending } = useFormStatus();
|
|
581
|
+
return (
|
|
582
|
+
<button type="submit" className="demo-button demo-primary" value="save">
|
|
583
|
+
{pending && <span className="demo-spinner" aria-hidden />}
|
|
584
|
+
Save
|
|
585
|
+
</button>
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// Dialog.Form with a function `action` renders <form action> (React's form action, passed
|
|
590
|
+
// through unwrapped, so a Server Function keeps progressive enhancement) and closes the dialog
|
|
591
|
+
// once the action's transition has settled, with the submitter's value as returnValue. A name
|
|
592
|
+
// containing "fail" makes the save reject: the Error Boundary inside the dialog shows the error
|
|
593
|
+
// and the dialog stays open.
|
|
594
|
+
export function DialogProfile() {
|
|
595
|
+
const [name, setName] = useState("Ada Lovelace");
|
|
596
|
+
return (
|
|
597
|
+
<>
|
|
598
|
+
<Dialog.Root defaultOpen={false}>
|
|
599
|
+
<Dialog.Trigger className="demo-button">Edit profile</Dialog.Trigger>
|
|
600
|
+
<Dialog.Popup className="demo-dialog" initialFocus="[name=name]">
|
|
601
|
+
<Dialog.Title>Edit profile</Dialog.Title>
|
|
602
|
+
<Dialog.Description>
|
|
603
|
+
Type a name containing "fail" to see a rejected save.
|
|
604
|
+
</Dialog.Description>
|
|
605
|
+
<DemoErrorBoundary>
|
|
606
|
+
<Dialog.Form
|
|
607
|
+
className="demo-dialog-form"
|
|
608
|
+
action={async (formData) => {
|
|
609
|
+
const next = String(formData.get("name") ?? "");
|
|
610
|
+
await sleep(900);
|
|
611
|
+
if (next.toLowerCase().includes("fail")) {
|
|
612
|
+
throw new Error(`The server rejected the name "${next}".`);
|
|
613
|
+
}
|
|
614
|
+
// After an await: wrap the update yourself (React limitation).
|
|
615
|
+
startTransition(() => setName(next));
|
|
616
|
+
}}
|
|
617
|
+
>
|
|
618
|
+
<label>
|
|
619
|
+
Name <input name="name" defaultValue={name} />
|
|
620
|
+
</label>
|
|
621
|
+
<div className="demo-dialog-actions">
|
|
622
|
+
<Dialog.Close className="demo-button" value="cancel">
|
|
623
|
+
Cancel
|
|
624
|
+
</Dialog.Close>
|
|
625
|
+
<SaveButton />
|
|
626
|
+
</div>
|
|
627
|
+
</Dialog.Form>
|
|
628
|
+
</DemoErrorBoundary>
|
|
629
|
+
</Dialog.Popup>
|
|
630
|
+
</Dialog.Root>
|
|
631
|
+
<output className="demo-readout">
|
|
632
|
+
saved name: <strong>{name}</strong>
|
|
633
|
+
</output>
|
|
634
|
+
</>
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
`dialog.css`: the same file as above.
|
|
640
|
+
|
|
641
|
+
1. Submit: React runs the form action; `useFormStatus().pending` is true in the Save button. The dialog stays open.
|
|
642
|
+
2. The action resolves and the name updates in a transition. When the form's pending state ends, the Form asks the Root to close the dialog with the submitter's `value` (`"save"`): `openChangeAction(false)` runs with `reason: "activate"`, then the dialog closes.
|
|
643
|
+
3. A name containing "fail" rejects: the Error Boundary inside the Popup shows the error and the dialog stays open. A boundary above the Root would unmount the dialog instead.
|
|
644
|
+
|
|
645
|
+
For a single "run this, then close" button without a form, such as Delete, use `Dialog.Close action`: it shows `data-pending` on the button and closes when the action resolves.
|
|
646
|
+
|
|
647
|
+
In library mode a `method="dialog"` submit is a library-owned close too, with the submitter's `value`, after your own `onSubmit` ran. To leave such a form to the browser, call `event.stopPropagation()` in its `onSubmit`: the dialog then closes natively and `onOpenChange` hears it as a `reason: "dismiss"` fact.
|
|
648
|
+
|
|
649
|
+
### Server Functions
|
|
650
|
+
|
|
651
|
+
The dialog's action and the [form channel](../concepts/action-props.md#form-channel) are independent, and both usable from a Server Component:
|
|
652
|
+
|
|
653
|
+
```tsx
|
|
654
|
+
// Persist "seen" when the user closes an announcement: a Close button is a request,
|
|
655
|
+
// Escape a fact, so pass the Server Function to both. It receives (open, details): with a
|
|
656
|
+
// Trigger inside, the action is also called with true when the dialog opens.
|
|
657
|
+
<Dialog.Root
|
|
658
|
+
defaultOpen={!user.seenAnnouncement}
|
|
659
|
+
openChangeAction={markAnnouncementSeen}
|
|
660
|
+
onOpenChange={markAnnouncementSeen}
|
|
661
|
+
>
|
|
662
|
+
...
|
|
663
|
+
</Dialog.Root>
|
|
664
|
+
|
|
665
|
+
// A form inside the dialog: progressive enhancement before hydration, close after success.
|
|
666
|
+
<Dialog.Form action={saveProfile}>...</Dialog.Form>
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
`openChangeAction` is a per-dialog action with the Trigger's pending state; `onOpenChange` is called and not awaited, nothing pends for it, and its rejection goes to `reportError`; `Dialog.Form action` is React's form action with React's `useFormStatus`. The Form only observes the form channel to close the dialog afterwards; it never wraps your function and never reports form pending as the dialog's.
|
|
670
|
+
|
|
671
|
+
## Recipes
|
|
672
|
+
|
|
673
|
+
### Controlled, opened without a Trigger
|
|
674
|
+
|
|
675
|
+
```tsx
|
|
676
|
+
const [open, setOpen] = useState(false);
|
|
677
|
+
|
|
678
|
+
<Dialog.Root open={open} openChangeAction={setOpen} onOpenChange={setOpen}>
|
|
679
|
+
<Dialog.Popup>...</Dialog.Popup>
|
|
680
|
+
</Dialog.Root>
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
### Branch on how it closed
|
|
684
|
+
|
|
685
|
+
```tsx
|
|
686
|
+
<Dialog.Root
|
|
687
|
+
defaultOpen={false}
|
|
688
|
+
openChangeAction={(open, { reason, returnValue }) => {
|
|
689
|
+
if (!open && reason === "activate" && returnValue === "delete") deleteDraft();
|
|
690
|
+
}}
|
|
691
|
+
>
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
A `<ViewTransition>` that mounts inside a transition runs the page cross-fade ([the transition prop](../concepts/transitions.md#transition-prop), issue [#35](https://github.com/uhyo/funstack-ui/issues/35)). In a library-mode dialog that happens when the content mounts parts that render one, such as a nested Dialog or a control with `transition` set.
|