@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,123 @@
|
|
|
1
|
+
import { mergeProps, mergeRefs } from "./merge-props.mjs";
|
|
2
|
+
import { cloneElement, createElement, isValidElement } from "react";
|
|
3
|
+
//#region src/internal/render-element.ts
|
|
4
|
+
function resolveStateValue(value, state) {
|
|
5
|
+
return typeof value === "function" ? value(state) : value;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Whether a part whose default element is a `<button>` should add `type="button"` (conventions
|
|
9
|
+
* 1.2): no `render`, the function form (it receives button props and decides itself what to
|
|
10
|
+
* spread), a host `<button>` element, or a **component** element (assumed to render a
|
|
11
|
+
* `<button>`; if it renders a link, `type` is a harmless ignored attribute, while a missing
|
|
12
|
+
* `type` on a `<button>` in a form is a silent submit). Only a host element of another tag (an
|
|
13
|
+
* `<a>`) does not get it.
|
|
14
|
+
*/
|
|
15
|
+
function rendersButton(render) {
|
|
16
|
+
if (render === void 0 || typeof render === "function") return true;
|
|
17
|
+
if (!isValidElement(render)) return false;
|
|
18
|
+
return typeof render.type !== "string" || render.type === "button";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Whether the rendered element is certainly a host `<button>`: no `render`, the function form, or
|
|
22
|
+
* a host `"button"` element. The strict predicate for native `disabled`, which means nothing on a
|
|
23
|
+
* link and would expose it as enabled to assistive technology; anything else (a link, a
|
|
24
|
+
* component) takes the `aria-disabled` branch (design/components/button.md).
|
|
25
|
+
*/
|
|
26
|
+
function isHostButton(render) {
|
|
27
|
+
if (render === void 0 || typeof render === "function") return true;
|
|
28
|
+
return isValidElement(render) && render.type === "button";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Whether the rendered element certainly cannot be natively disabled: a host element of a tag
|
|
32
|
+
* other than `<button>` / `<input>` (an `<a>`, a `<div>`). No `render`, the function form and a
|
|
33
|
+
* component element may render a button.
|
|
34
|
+
*/
|
|
35
|
+
function certainlyNotDisableable(render) {
|
|
36
|
+
if (rendersButton(render)) return false;
|
|
37
|
+
return !(isValidElement(render) && render.type === "input");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The disabled rule of a button-like part that accepts an arbitrary `render` (conventions 1.2,
|
|
41
|
+
* design/components/button.md 17). Native `disabled` on a host `<button>` (the function form
|
|
42
|
+
* included), and wherever the element may be a button and the click's effect is the browser's
|
|
43
|
+
* own (`handlesClick: false`: a submitter, a reset button, a JS-free invoker; only native
|
|
44
|
+
* `disabled` stops those before hydration). `aria-disabled`, which the part's click handler
|
|
45
|
+
* honours by cancelling the click, otherwise: on an element that certainly cannot be natively
|
|
46
|
+
* disabled (a host `<a>`, `<div>`), on a component or other non-button render whose own handler
|
|
47
|
+
* is the action (`handlesClick: true`, the default), and with `alwaysFocusable` (an opt-in
|
|
48
|
+
* focusable disabled control: a menu item, a Toolbar or `focusableWhenDisabled` Button). A part
|
|
49
|
+
* that installs no click handler of its own (`Form.Submit`, a JS-free command part on a host
|
|
50
|
+
* link) installs `cancelClick` while `invoker` is `false`, so the click is cancelled there too.
|
|
51
|
+
*
|
|
52
|
+
* When `disabled` and the part's pending `aria-disabled` meet, the native `disabled` wins:
|
|
53
|
+
* `pendingAriaDisabled` below.
|
|
54
|
+
*/
|
|
55
|
+
function disabledButton(render, disabled, options = {}) {
|
|
56
|
+
const { handlesClick = true, alwaysFocusable = false } = options;
|
|
57
|
+
const focusable = alwaysFocusable || (handlesClick ? !isHostButton(render) : certainlyNotDisableable(render));
|
|
58
|
+
return {
|
|
59
|
+
props: {
|
|
60
|
+
disabled: focusable ? void 0 : disabled,
|
|
61
|
+
...focusable && { "aria-disabled": disabled ? true : void 0 }
|
|
62
|
+
},
|
|
63
|
+
invoker: !(focusable && disabled)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The click handler of a disabled part in the `aria-disabled` branch that has no click handler
|
|
68
|
+
* of its own (`Form.Submit`, a JS-free command Trigger / Close on a host link): cancels the
|
|
69
|
+
* click, so a disabled link does not navigate after hydration (conventions 1.2). Installed only
|
|
70
|
+
* while disabled: an enabled render element keeps its own `onClick` as the only one.
|
|
71
|
+
*/
|
|
72
|
+
function cancelClick(event) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The owned `aria-disabled` of a pure trigger that also renders it while pending (conventions
|
|
77
|
+
* 3.6): the focusable-disabled branch's `true`; nothing while natively disabled (native
|
|
78
|
+
* `disabled` wins, a second unavailable state on the same element says nothing new); otherwise
|
|
79
|
+
* `true` while pending exactly when the part ignores activations (`ignoringPending`).
|
|
80
|
+
*/
|
|
81
|
+
function pendingAriaDisabled(disabledProps, ignoringPending) {
|
|
82
|
+
if (disabledProps.disabled === true) return void 0;
|
|
83
|
+
if (disabledProps["aria-disabled"] === true) return true;
|
|
84
|
+
return ignoringPending ? true : void 0;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The ref of a part with no library ref, merged from the consumer's `ref` and a `render`
|
|
88
|
+
* element's ref without memoisation (the directive-free half of `use-render.tsx`,
|
|
89
|
+
* progress.md 8.1). A fresh callback ref per render is correct because every merged callback
|
|
90
|
+
* returns a cleanup; a single ref is passed through untouched.
|
|
91
|
+
*/
|
|
92
|
+
function mergeRenderRef(consumerRef, render) {
|
|
93
|
+
const elementRef = isValidElement(render) ? render.props.ref : void 0;
|
|
94
|
+
if (consumerRef != null && elementRef != null) return mergeRefs(consumerRef, elementRef);
|
|
95
|
+
return consumerRef ?? elementRef;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Resolves `render` and the function-form `className` / `style` / `children` of a part against
|
|
99
|
+
* its state and produces the element (conventions 1.2, 1.3, 1.4). Pure: the caller merges the
|
|
100
|
+
* refs (`useRender` memoises the merge; a directive-free part merges unmemoised).
|
|
101
|
+
*/
|
|
102
|
+
function renderElement(options) {
|
|
103
|
+
const { defaultElement, render, state, className, style, children, props, libraryProps, ref } = options;
|
|
104
|
+
const partProps = {
|
|
105
|
+
...props,
|
|
106
|
+
ref,
|
|
107
|
+
className: resolveStateValue(className, state),
|
|
108
|
+
style: resolveStateValue(style, state),
|
|
109
|
+
children: resolveStateValue(children, state)
|
|
110
|
+
};
|
|
111
|
+
const controlled = libraryProps ?? {};
|
|
112
|
+
if (isValidElement(render)) {
|
|
113
|
+
const { ref: _ignored, ...elementProps } = render.props;
|
|
114
|
+
return cloneElement(render, mergeProps(partProps, elementProps, controlled));
|
|
115
|
+
}
|
|
116
|
+
const resolved = mergeProps(partProps, {}, controlled);
|
|
117
|
+
if (typeof render === "function") return render(resolved, state);
|
|
118
|
+
return createElement(defaultElement, resolved);
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { cancelClick, disabledButton, isHostButton, mergeRenderRef, pendingAriaDisabled, renderElement, rendersButton, resolveStateValue };
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=render-element.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-element.mjs","names":[],"sources":["../../src/internal/render-element.ts"],"sourcesContent":["// No \"use client\": the pure half of `useRender`, usable from a directive-free part (a Root that\n// may run as a Server Component, design/components/progress.md 8.1 and implementation note 14.1).\nimport { cloneElement, createElement, isValidElement } from \"react\";\nimport type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { mergeProps, mergeRefs } from \"./merge-props.js\";\nimport type { RenderProp, StateValue } from \"./types.js\";\n\nexport interface ElementLikeProps {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n children?: ReactNode;\n ref?: Ref<unknown> | undefined;\n}\n\n/** `data-*` attributes are valid JSX but absent from the element prop types. */\nexport type DataAttributes = { [key: `data-${string}`]: string | undefined };\n\nexport interface RenderElementOptions<Props extends ElementLikeProps, State> {\n /** Intrinsic element rendered when `render` is not given. */\n defaultElement: string;\n render: RenderProp<Props, State> | undefined;\n state: State;\n className: StateValue<string | undefined, State> | undefined;\n style: StateValue<CSSProperties | undefined, State> | undefined;\n children: StateValue<ReactNode, State> | undefined;\n /**\n * The part's pass-through props for the element. A `render` element's own props win over\n * these. Their `ref` is replaced by `ref` below.\n */\n props: Omit<Props, \"className\" | \"style\" | \"children\"> & DataAttributes;\n /**\n * Library-controlled attributes the part computes (`role`, `aria-*` state, id wiring, `data-*`\n * state, the library's own event handlers). These win over a `render` element's props\n * (conventions 1.2).\n */\n libraryProps?: Partial<Omit<Props, \"className\" | \"style\" | \"children\">> & DataAttributes;\n /**\n * The element's ref, already merged from the library's ref, the consumer's `ref` and the\n * `render` element's ref. The `render` element's own ref is not attached separately.\n */\n ref: Ref<unknown> | undefined;\n}\n\nexport function resolveStateValue<T, State>(value: StateValue<T, State>, state: State): T {\n return typeof value === \"function\" ? (value as (state: State) => T)(state) : value;\n}\n\n/**\n * Whether a part whose default element is a `<button>` should add `type=\"button\"` (conventions\n * 1.2): no `render`, the function form (it receives button props and decides itself what to\n * spread), a host `<button>` element, or a **component** element (assumed to render a\n * `<button>`; if it renders a link, `type` is a harmless ignored attribute, while a missing\n * `type` on a `<button>` in a form is a silent submit). Only a host element of another tag (an\n * `<a>`) does not get it.\n */\nexport function rendersButton<Props, State>(render: RenderProp<Props, State> | undefined): boolean {\n if (render === undefined || typeof render === \"function\") return true;\n if (!isValidElement(render)) return false;\n return typeof render.type !== \"string\" || render.type === \"button\";\n}\n\n/**\n * Whether the rendered element is certainly a host `<button>`: no `render`, the function form, or\n * a host `\"button\"` element. The strict predicate for native `disabled`, which means nothing on a\n * link and would expose it as enabled to assistive technology; anything else (a link, a\n * component) takes the `aria-disabled` branch (design/components/button.md).\n */\nexport function isHostButton<Props, State>(render: RenderProp<Props, State> | undefined): boolean {\n if (render === undefined || typeof render === \"function\") return true;\n return isValidElement(render) && render.type === \"button\";\n}\n\nexport interface DisabledButton {\n /**\n * Owned keys, spread where `disabled` goes: `disabled` (owned as absent in the focusable\n * branch, where the element may not be a host `<button>` and the part's click handler refuses,\n * so a render element's own is removed), and in that branch only `aria-disabled` (a host\n * button keeps a consumer's own).\n */\n readonly props: {\n readonly disabled: boolean | undefined;\n readonly \"aria-disabled\"?: true | undefined;\n };\n /**\n * Whether an invoker part may render `popovertarget` or `commandfor` / `command`: not when disabled in the\n * focusable branch, where nothing native stops the command (a component render spreading onto\n * a real `<button>` would be a live invoker before hydration).\n */\n readonly invoker: boolean;\n}\n\n/**\n * Whether the rendered element certainly cannot be natively disabled: a host element of a tag\n * other than `<button>` / `<input>` (an `<a>`, a `<div>`). No `render`, the function form and a\n * component element may render a button.\n */\nfunction certainlyNotDisableable<Props, State>(\n render: RenderProp<Props, State> | undefined,\n): boolean {\n if (rendersButton(render)) return false;\n return !(isValidElement(render) && render.type === \"input\");\n}\n\n/**\n * The disabled rule of a button-like part that accepts an arbitrary `render` (conventions 1.2,\n * design/components/button.md 17). Native `disabled` on a host `<button>` (the function form\n * included), and wherever the element may be a button and the click's effect is the browser's\n * own (`handlesClick: false`: a submitter, a reset button, a JS-free invoker; only native\n * `disabled` stops those before hydration). `aria-disabled`, which the part's click handler\n * honours by cancelling the click, otherwise: on an element that certainly cannot be natively\n * disabled (a host `<a>`, `<div>`), on a component or other non-button render whose own handler\n * is the action (`handlesClick: true`, the default), and with `alwaysFocusable` (an opt-in\n * focusable disabled control: a menu item, a Toolbar or `focusableWhenDisabled` Button). A part\n * that installs no click handler of its own (`Form.Submit`, a JS-free command part on a host\n * link) installs `cancelClick` while `invoker` is `false`, so the click is cancelled there too.\n *\n * When `disabled` and the part's pending `aria-disabled` meet, the native `disabled` wins:\n * `pendingAriaDisabled` below.\n */\nexport function disabledButton<Props, State>(\n render: RenderProp<Props, State> | undefined,\n disabled: boolean,\n options: { readonly handlesClick?: boolean; readonly alwaysFocusable?: boolean } = {},\n): DisabledButton {\n const { handlesClick = true, alwaysFocusable = false } = options;\n const focusable =\n alwaysFocusable || (handlesClick ? !isHostButton(render) : certainlyNotDisableable(render));\n return {\n props: {\n disabled: focusable ? undefined : disabled,\n ...(focusable && { \"aria-disabled\": disabled ? true : undefined }),\n },\n invoker: !(focusable && disabled),\n };\n}\n\n/**\n * The click handler of a disabled part in the `aria-disabled` branch that has no click handler\n * of its own (`Form.Submit`, a JS-free command Trigger / Close on a host link): cancels the\n * click, so a disabled link does not navigate after hydration (conventions 1.2). Installed only\n * while disabled: an enabled render element keeps its own `onClick` as the only one.\n */\nexport function cancelClick(event: { preventDefault(): void }): void {\n event.preventDefault();\n}\n\n/**\n * The owned `aria-disabled` of a pure trigger that also renders it while pending (conventions\n * 3.6): the focusable-disabled branch's `true`; nothing while natively disabled (native\n * `disabled` wins, a second unavailable state on the same element says nothing new); otherwise\n * `true` while pending exactly when the part ignores activations (`ignoringPending`).\n */\nexport function pendingAriaDisabled(\n disabledProps: DisabledButton[\"props\"],\n ignoringPending: boolean,\n): true | undefined {\n if (disabledProps.disabled === true) return undefined;\n if (disabledProps[\"aria-disabled\"] === true) return true;\n return ignoringPending ? true : undefined;\n}\n\n/**\n * The ref of a part with no library ref, merged from the consumer's `ref` and a `render`\n * element's ref without memoisation (the directive-free half of `use-render.tsx`,\n * progress.md 8.1). A fresh callback ref per render is correct because every merged callback\n * returns a cleanup; a single ref is passed through untouched.\n */\nexport function mergeRenderRef(\n consumerRef: Ref<unknown> | undefined,\n render: unknown,\n): Ref<unknown> | undefined {\n const elementRef = isValidElement<ElementLikeProps>(render) ? render.props.ref : undefined;\n if (consumerRef != null && elementRef != null) return mergeRefs(consumerRef, elementRef);\n return consumerRef ?? elementRef;\n}\n\n/**\n * Resolves `render` and the function-form `className` / `style` / `children` of a part against\n * its state and produces the element (conventions 1.2, 1.3, 1.4). Pure: the caller merges the\n * refs (`useRender` memoises the merge; a directive-free part merges unmemoised).\n */\nexport function renderElement<Props extends ElementLikeProps, State>(\n options: RenderElementOptions<Props, State>,\n): ReactNode {\n const { defaultElement, render, state, className, style, children, props, libraryProps, ref } =\n options;\n\n const partProps = {\n ...props,\n ref,\n className: resolveStateValue(className, state),\n style: resolveStateValue(style, state),\n children: resolveStateValue(children, state),\n } as Record<string, unknown>;\n const controlled = (libraryProps ?? {}) as Record<string, unknown>;\n\n if (isValidElement<ElementLikeProps>(render)) {\n // The element's ref is already part of `ref`.\n const { ref: _ignored, ...elementProps } = render.props as Record<string, unknown>;\n return cloneElement(render, mergeProps(partProps, elementProps, controlled) as Partial<Props>);\n }\n const resolved = mergeProps(partProps, {}, controlled) as unknown as Props;\n if (typeof render === \"function\") {\n return render(resolved, state);\n }\n return createElement(defaultElement, resolved);\n}\n"],"mappings":";;;AA2CA,SAAgB,kBAA4B,OAA6B,OAAiB;CACxF,OAAO,OAAO,UAAU,aAAc,MAA8B,KAAK,IAAI;AAC/E;;;;;;;;;AAUA,SAAgB,cAA4B,QAAuD;CACjG,IAAI,WAAW,KAAA,KAAa,OAAO,WAAW,YAAY,OAAO;CACjE,IAAI,CAAC,eAAe,MAAM,GAAG,OAAO;CACpC,OAAO,OAAO,OAAO,SAAS,YAAY,OAAO,SAAS;AAC5D;;;;;;;AAQA,SAAgB,aAA2B,QAAuD;CAChG,IAAI,WAAW,KAAA,KAAa,OAAO,WAAW,YAAY,OAAO;CACjE,OAAO,eAAe,MAAM,KAAK,OAAO,SAAS;AACnD;;;;;;AA0BA,SAAS,wBACP,QACS;CACT,IAAI,cAAc,MAAM,GAAG,OAAO;CAClC,OAAO,EAAE,eAAe,MAAM,KAAK,OAAO,SAAS;AACrD;;;;;;;;;;;;;;;;;AAkBA,SAAgB,eACd,QACA,UACA,UAAmF,CAAC,GACpE;CAChB,MAAM,EAAE,eAAe,MAAM,kBAAkB,UAAU;CACzD,MAAM,YACJ,oBAAoB,eAAe,CAAC,aAAa,MAAM,IAAI,wBAAwB,MAAM;CAC3F,OAAO;EACL,OAAO;GACL,UAAU,YAAY,KAAA,IAAY;GAClC,GAAI,aAAa,EAAE,iBAAiB,WAAW,OAAO,KAAA,EAAU;EAClE;EACA,SAAS,EAAE,aAAa;CAC1B;AACF;;;;;;;AAQA,SAAgB,YAAY,OAAyC;CACnE,MAAM,eAAe;AACvB;;;;;;;AAQA,SAAgB,oBACd,eACA,iBACkB;CAClB,IAAI,cAAc,aAAa,MAAM,OAAO,KAAA;CAC5C,IAAI,cAAc,qBAAqB,MAAM,OAAO;CACpD,OAAO,kBAAkB,OAAO,KAAA;AAClC;;;;;;;AAQA,SAAgB,eACd,aACA,QAC0B;CAC1B,MAAM,aAAa,eAAiC,MAAM,IAAI,OAAO,MAAM,MAAM,KAAA;CACjF,IAAI,eAAe,QAAQ,cAAc,MAAM,OAAO,UAAU,aAAa,UAAU;CACvF,OAAO,eAAe;AACxB;;;;;;AAOA,SAAgB,cACd,SACW;CACX,MAAM,EAAE,gBAAgB,QAAQ,OAAO,WAAW,OAAO,UAAU,OAAO,cAAc,QACtF;CAEF,MAAM,YAAY;EAChB,GAAG;EACH;EACA,WAAW,kBAAkB,WAAW,KAAK;EAC7C,OAAO,kBAAkB,OAAO,KAAK;EACrC,UAAU,kBAAkB,UAAU,KAAK;CAC7C;CACA,MAAM,aAAc,gBAAgB,CAAC;CAErC,IAAI,eAAiC,MAAM,GAAG;EAE5C,MAAM,EAAE,KAAK,UAAU,GAAG,iBAAiB,OAAO;EAClD,OAAO,aAAa,QAAQ,WAAW,WAAW,cAAc,UAAU,CAAmB;CAC/F;CACA,MAAM,WAAW,WAAW,WAAW,CAAC,GAAG,UAAU;CACrD,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO,UAAU,KAAK;CAE/B,OAAO,cAAc,gBAAgB,QAAQ;AAC/C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/internal/shipped-styles.ts
|
|
2
|
+
/**
|
|
3
|
+
* The React stylesheet precedence bucket of the library's functional CSS. Fizz writes every
|
|
4
|
+
* same-precedence `<style>` of one server flush as a single element with the texts concatenated,
|
|
5
|
+
* which would match none of the per-href hashes in `STYLE_SHA256`: at most one shipped stylesheet
|
|
6
|
+
* in this bucket may render during server rendering (today the tooltip skip-delay rule; the menu
|
|
7
|
+
* point rules are client-only). A second one needs a precedence of its own (guard row in
|
|
8
|
+
* `csp/csp.test.tsx`).
|
|
9
|
+
*/
|
|
10
|
+
const FSUI_PRECEDENCE = "fsui";
|
|
11
|
+
//#endregion
|
|
12
|
+
export { FSUI_PRECEDENCE };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=shipped-styles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shipped-styles.mjs","names":[],"sources":["../../src/internal/shipped-styles.ts"],"sourcesContent":["// Shared by the library's shipped functional stylesheets (conventions 12). No \"use client\"\n// directive: constants only (conventions 7.1).\n\n/**\n * The React stylesheet precedence bucket of the library's functional CSS. Fizz writes every\n * same-precedence `<style>` of one server flush as a single element with the texts concatenated,\n * which would match none of the per-href hashes in `STYLE_SHA256`: at most one shipped stylesheet\n * in this bucket may render during server rendering (today the tooltip skip-delay rule; the menu\n * point rules are client-only). A second one needs a precedence of its own (guard row in\n * `csp/csp.test.tsx`).\n */\nexport const FSUI_PRECEDENCE = \"fsui\";\n"],"mappings":";;;;;;;;;AAWA,MAAa,kBAAkB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, use } from "react";
|
|
3
|
+
//#region src/internal/toolbar-context.ts
|
|
4
|
+
/**
|
|
5
|
+
* Provided by `Toolbar.Root`; read across folders by `ToggleGroup.Root` (joins the Toolbar's
|
|
6
|
+
* sequence instead of running its own engine), `Toolbar.Separator` (perpendicular orientation)
|
|
7
|
+
* and `Menu.Trigger` (opening arrows in a vertical Toolbar). Conventions 7.1.
|
|
8
|
+
*/
|
|
9
|
+
const ToolbarContext = createContext(null);
|
|
10
|
+
/** The enclosing Toolbar, or `null` outside one. Works during SSR (context, not DOM). */
|
|
11
|
+
function useToolbarContext() {
|
|
12
|
+
return use(ToolbarContext);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { ToolbarContext, useToolbarContext };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=toolbar-context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-context.mjs","names":[],"sources":["../../src/internal/toolbar-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { Orientation } from \"./types.js\";\n\n/** What a part inside a `Toolbar.Root` learns about it (design/components/toggle-group.md 7.3, 7.4). */\nexport interface ToolbarContextValue {\n /** The Toolbar's arrow-key axis. */\n readonly orientation: Orientation;\n}\n\n/**\n * Provided by `Toolbar.Root`; read across folders by `ToggleGroup.Root` (joins the Toolbar's\n * sequence instead of running its own engine), `Toolbar.Separator` (perpendicular orientation)\n * and `Menu.Trigger` (opening arrows in a vertical Toolbar). Conventions 7.1.\n */\nexport const ToolbarContext = createContext<ToolbarContextValue | null>(null);\n\n/** The enclosing Toolbar, or `null` outside one. Works during SSR (context, not DOM). */\nexport function useToolbarContext(): ToolbarContextValue | null {\n return use(ToolbarContext);\n}\n"],"mappings":";;;;;;;;AAeA,MAAa,iBAAiB,cAA0C,IAAI;;AAG5E,SAAgB,oBAAgD;CAC9D,OAAO,IAAI,cAAc;AAC3B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useDevWarning } from "./use-dev-warning.mjs";
|
|
3
|
+
import { ViewTransition, useState } from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region src/internal/transition-boundary.tsx
|
|
5
6
|
const isDev = process.env.NODE_ENV !== "production";
|
|
@@ -8,7 +9,7 @@ const isDev = process.env.NODE_ENV !== "production";
|
|
|
8
9
|
* passed `transition`** (conventions 5.1). With `transition === undefined` the node is returned
|
|
9
10
|
* unwrapped and the part renders no boundary at all.
|
|
10
11
|
*
|
|
11
|
-
* Reason (docs/research/view-transition-mount-cost.md
|
|
12
|
+
* Reason (docs/research/view-transition-mount-cost.md): react-dom 19.3 starts a
|
|
12
13
|
* document view transition whenever a `<ViewTransition>` mounts or is revealed by `<Activity>` in
|
|
13
14
|
* a transition-lane commit, whatever its class resolves to (`"none"` included). The browser's
|
|
14
15
|
* 250 ms root cross-fade then runs and every later transition commit waits for it. Exits and
|
|
@@ -37,13 +38,8 @@ function transitionBoundary(transition, node) {
|
|
|
37
38
|
*/
|
|
38
39
|
function useTransitionBoundary(part, transition, node) {
|
|
39
40
|
const hasBoundary = transition !== void 0;
|
|
40
|
-
const initial =
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (!isDev || warned.current || hasBoundary === initial.current) return;
|
|
44
|
-
warned.current = true;
|
|
45
|
-
console.error(`${part}: \`transition\` changed between undefined and a value after mount. The part renders a <ViewTransition> only when \`transition\` is given, so this remounts its subtree (DOM and state are lost). Keep \`transition\` static; use \`transition="none"\` to switch animation off without removing the boundary.`);
|
|
46
|
-
}, [hasBoundary, part]);
|
|
41
|
+
const [initial] = useState(hasBoundary);
|
|
42
|
+
useDevWarning(hasBoundary !== initial, isDev && `${part}: \`transition\` changed between undefined and a value after mount. The part renders a <ViewTransition> only when \`transition\` is given, so this remounts its subtree (DOM and state are lost). Keep \`transition\` static; use \`transition="none"\` to switch animation off without removing the boundary.`);
|
|
47
43
|
return transitionBoundary(transition, node);
|
|
48
44
|
}
|
|
49
45
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-boundary.mjs","names":[],"sources":["../../src/internal/transition-boundary.tsx"],"sourcesContent":["\"use client\";\nimport {
|
|
1
|
+
{"version":3,"file":"transition-boundary.mjs","names":[],"sources":["../../src/internal/transition-boundary.tsx"],"sourcesContent":["\"use client\";\nimport { useState, ViewTransition } from \"react\";\nimport type { ReactNode, ViewTransitionClass } from \"react\";\n\nimport { useDevWarning } from \"./use-dev-warning.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Wraps a part's output in `<ViewTransition default={transition}>` **only when the consumer\n * passed `transition`** (conventions 5.1). With `transition === undefined` the node is returned\n * unwrapped and the part renders no boundary at all.\n *\n * Reason (docs/research/view-transition-mount-cost.md): react-dom 19.3 starts a\n * document view transition whenever a `<ViewTransition>` mounts or is revealed by `<Activity>` in\n * a transition-lane commit, whatever its class resolves to (`\"none\"` included). The browser's\n * 250 ms root cross-fade then runs and every later transition commit waits for it. Exits and\n * updates of a `\"none\"` boundary are free, so an explicit `transition=\"none\"` keeps the boundary\n * and lets a consumer switch between `\"none\"` and a class without remounting.\n *\n * The boundary stays the outermost node of the part's output, so a part that is the top of an\n * inserted subtree gets enter / exit. A plain function (not a component), so it adds no fiber\n * between the boundary and the element.\n */\nexport function transitionBoundary(\n transition: ViewTransitionClass | undefined,\n node: ReactNode,\n): ReactNode {\n if (transition === undefined) return node;\n return <ViewTransition default={transition}>{node}</ViewTransition>;\n}\n\n/**\n * {@link transitionBoundary} plus the development warning for a non-static `transition`\n * (conventions 5.1): changing it between `undefined` and a value changes the element type at the\n * part's root, so React remounts the part's subtree (DOM and state lost). Warns once per\n * instance, from an effect. `part` is the public name used in the message (`\"Tabs.Panel\"`).\n *\n * Pass the *effective* value: a part that ignores `transition` in some mode (Accordion, Dialog\n * JS-free mode) passes `undefined` there.\n */\nexport function useTransitionBoundary(\n part: string,\n transition: ViewTransitionClass | undefined,\n node: ReactNode,\n): ReactNode {\n const hasBoundary = transition !== undefined;\n const [initial] = useState(hasBoundary);\n useDevWarning(\n hasBoundary !== initial,\n isDev &&\n `${part}: \\`transition\\` changed between undefined and a value after mount. The part ` +\n \"renders a <ViewTransition> only when `transition` is given, so this remounts its \" +\n 'subtree (DOM and state are lost). Keep `transition` static; use `transition=\"none\"` ' +\n \"to switch animation off without removing the boundary.\",\n );\n return transitionBoundary(transition, node);\n}\n"],"mappings":";;;;;AAMA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;;;;AAkBvC,SAAgB,mBACd,YACA,MACW;CACX,IAAI,eAAe,KAAA,GAAW,OAAO;CACrC,OAAO,oBAAC,gBAAD;EAAgB,SAAS;EAAa,UAAA;CAAqB,CAAA;AACpE;;;;;;;;;;AAWA,SAAgB,sBACd,MACA,YACA,MACW;CACX,MAAM,cAAc,eAAe,KAAA;CACnC,MAAM,CAAC,WAAW,SAAS,WAAW;CACtC,cACE,gBAAgB,SAChB,SACE,GAAG,KAAK,+SAIZ;CACA,OAAO,mBAAmB,YAAY,IAAI;AAC5C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
function createTypeaheadBuffer() {
|
|
2
|
+
return {
|
|
3
|
+
text: "",
|
|
4
|
+
at: 0
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
/** A buffer is live: a Space then belongs to it rather than to the item. */
|
|
8
|
+
function isTypingAhead(buffer, now = Date.now()) {
|
|
9
|
+
return buffer.text !== "" && now - buffer.at <= 500;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Adds `key` to the buffer (a stale buffer starts over). Returns `false` when the key is not
|
|
13
|
+
* taken: a Space with an empty buffer, which belongs to the item instead.
|
|
14
|
+
*/
|
|
15
|
+
function pushTypeahead(buffer, key, now = Date.now()) {
|
|
16
|
+
if (buffer.text === "" || now - buffer.at > 500) buffer.text = "";
|
|
17
|
+
if (key === " " && buffer.text === "") return false;
|
|
18
|
+
buffer.text += key.toLowerCase();
|
|
19
|
+
buffer.at = now;
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The item the buffer selects among `texts` (each item's typeahead text, already trimmed and
|
|
24
|
+
* lowercased, in list order), with `current` the index of the current item (`-1`: none); `-1`
|
|
25
|
+
* when nothing matches.
|
|
26
|
+
*
|
|
27
|
+
* A repeated single character cycles through the items starting with it, from the one after
|
|
28
|
+
* the current item; a longer buffer keeps the current item while it still matches.
|
|
29
|
+
*/
|
|
30
|
+
function findTypeahead(buffer, texts, current) {
|
|
31
|
+
if (texts.length === 0 || buffer.text === "") return -1;
|
|
32
|
+
const repeated = [...buffer.text].every((c) => c === buffer.text[0]);
|
|
33
|
+
const search = repeated ? buffer.text[0] : buffer.text;
|
|
34
|
+
const start = repeated || current < 0 ? current + 1 : current;
|
|
35
|
+
for (let i = 0; i < texts.length; i++) {
|
|
36
|
+
const index = (start + i) % texts.length;
|
|
37
|
+
if (texts[index].startsWith(search)) return index;
|
|
38
|
+
}
|
|
39
|
+
return -1;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* `pushTypeahead` then `findTypeahead`: `null` when the key is not taken, else the index of the
|
|
43
|
+
* match or `-1`.
|
|
44
|
+
*/
|
|
45
|
+
function typeaheadMatch(buffer, key, texts, current, now = Date.now()) {
|
|
46
|
+
if (!pushTypeahead(buffer, key, now)) return null;
|
|
47
|
+
return findTypeahead(buffer, texts, current);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { createTypeaheadBuffer, findTypeahead, isTypingAhead, pushTypeahead, typeaheadMatch };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=typeahead.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeahead.mjs","names":[],"sources":["../../src/internal/typeahead.ts"],"sourcesContent":["// Typeahead of the item lists (design/components/menu.md 5.1; multi-select.md B.8): a buffer of\n// the characters typed within 500 ms, matched case-insensitively as a prefix. No \"use client\"\n// directive: pure functions over a mutable buffer (conventions 7.1).\n\n/** Buffer lifetime after the last keystroke (menu.md 5.1). */\nexport const TYPEAHEAD_RESET_MS = 500;\n\n/** The typed prefix and the time of its last character. Kept in a ref by the part. */\nexport interface TypeaheadBuffer {\n text: string;\n at: number;\n}\n\nexport function createTypeaheadBuffer(): TypeaheadBuffer {\n return { text: \"\", at: 0 };\n}\n\n/** A buffer is live: a Space then belongs to it rather than to the item. */\nexport function isTypingAhead(buffer: TypeaheadBuffer, now = Date.now()): boolean {\n return buffer.text !== \"\" && now - buffer.at <= TYPEAHEAD_RESET_MS;\n}\n\n/**\n * Adds `key` to the buffer (a stale buffer starts over). Returns `false` when the key is not\n * taken: a Space with an empty buffer, which belongs to the item instead.\n */\nexport function pushTypeahead(buffer: TypeaheadBuffer, key: string, now = Date.now()): boolean {\n if (buffer.text === \"\" || now - buffer.at > TYPEAHEAD_RESET_MS) buffer.text = \"\";\n if (key === \" \" && buffer.text === \"\") return false;\n buffer.text += key.toLowerCase();\n buffer.at = now;\n return true;\n}\n\n/**\n * The item the buffer selects among `texts` (each item's typeahead text, already trimmed and\n * lowercased, in list order), with `current` the index of the current item (`-1`: none); `-1`\n * when nothing matches.\n *\n * A repeated single character cycles through the items starting with it, from the one after\n * the current item; a longer buffer keeps the current item while it still matches.\n */\nexport function findTypeahead(\n buffer: TypeaheadBuffer,\n texts: readonly string[],\n current: number,\n): number {\n if (texts.length === 0 || buffer.text === \"\") return -1;\n const repeated = [...buffer.text].every((c) => c === buffer.text[0]);\n const search = repeated ? buffer.text[0]! : buffer.text;\n const start = repeated || current < 0 ? current + 1 : current;\n for (let i = 0; i < texts.length; i++) {\n const index = (start + i) % texts.length;\n if (texts[index]!.startsWith(search)) return index;\n }\n return -1;\n}\n\n/**\n * `pushTypeahead` then `findTypeahead`: `null` when the key is not taken, else the index of the\n * match or `-1`.\n */\nexport function typeaheadMatch(\n buffer: TypeaheadBuffer,\n key: string,\n texts: readonly string[],\n current: number,\n now = Date.now(),\n): number | null {\n if (!pushTypeahead(buffer, key, now)) return null;\n return findTypeahead(buffer, texts, current);\n}\n"],"mappings":"AAaA,SAAgB,wBAAyC;CACvD,OAAO;EAAE,MAAM;EAAI,IAAI;CAAE;AAC3B;;AAGA,SAAgB,cAAc,QAAyB,MAAM,KAAK,IAAI,GAAY;CAChF,OAAO,OAAO,SAAS,MAAM,MAAM,OAAO,MAAA;AAC5C;;;;;AAMA,SAAgB,cAAc,QAAyB,KAAa,MAAM,KAAK,IAAI,GAAY;CAC7F,IAAI,OAAO,SAAS,MAAM,MAAM,OAAO,KAAA,KAAyB,OAAO,OAAO;CAC9E,IAAI,QAAQ,OAAO,OAAO,SAAS,IAAI,OAAO;CAC9C,OAAO,QAAQ,IAAI,YAAY;CAC/B,OAAO,KAAK;CACZ,OAAO;AACT;;;;;;;;;AAUA,SAAgB,cACd,QACA,OACA,SACQ;CACR,IAAI,MAAM,WAAW,KAAK,OAAO,SAAS,IAAI,OAAO;CACrD,MAAM,WAAW,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC,OAAO,MAAM,MAAM,OAAO,KAAK,EAAE;CACnE,MAAM,SAAS,WAAW,OAAO,KAAK,KAAM,OAAO;CACnD,MAAM,QAAQ,YAAY,UAAU,IAAI,UAAU,IAAI;CACtD,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,SAAS,QAAQ,KAAK,MAAM;EAClC,IAAI,MAAM,MAAM,CAAE,WAAW,MAAM,GAAG,OAAO;CAC/C;CACA,OAAO;AACT;;;;;AAMA,SAAgB,eACd,QACA,KACA,OACA,SACA,MAAM,KAAK,IAAI,GACA;CACf,IAAI,CAAC,cAAc,QAAQ,KAAK,GAAG,GAAG,OAAO;CAC7C,OAAO,cAAc,QAAQ,OAAO,OAAO;AAC7C"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from "react";
|
|
2
2
|
//#region src/internal/types.d.ts
|
|
3
|
+
/** The arrow-key axis of a composite widget (Toolbar, Tabs, ToggleGroup, Slider). */
|
|
4
|
+
export type Orientation = "horizontal" | "vertical";
|
|
3
5
|
/**
|
|
4
6
|
* A callback the library runs inside a Transition. May be sync or async: the library awaits
|
|
5
7
|
* whatever it returns (a thenable is awaited, anything else is ignored). The return type is
|
|
@@ -7,6 +9,9 @@ import { ReactElement, ReactNode } from "react";
|
|
|
7
9
|
* returns data, as Server Functions usually do (conventions 2.2).
|
|
8
10
|
*/
|
|
9
11
|
export type Action<Args extends readonly unknown[] = []> = (...args: Args) => unknown;
|
|
12
|
+
/**
|
|
13
|
+
* The base of every `details` object an action receives (the second argument of a change action).
|
|
14
|
+
*/
|
|
10
15
|
export interface ActionDetails {
|
|
11
16
|
/** The DOM event that caused the action, or `undefined` for programmatic changes. */
|
|
12
17
|
readonly event: Event | undefined;
|
|
@@ -14,13 +19,23 @@ export interface ActionDetails {
|
|
|
14
19
|
/** An action called with the next value of a controllable state. */
|
|
15
20
|
export type ChangeAction<T, Details extends ActionDetails = ActionDetails> = Action<[next: T, details: Details]>;
|
|
16
21
|
/**
|
|
17
|
-
* A change
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
+
* A change **handler**: the library reports a fact about a state, a change it could not hold
|
|
23
|
+
* (conventions 2.1, the handler rule; #96, #148). Called synchronously in the event that reports
|
|
24
|
+
* it, outside any Transition, and not awaited: nothing is pending or optimistic for it, so
|
|
25
|
+
* `(next) => setOpen(next)` is an urgent update. Used by Combobox's `onInputValueChange` (the
|
|
26
|
+
* text of a controlled input) and the overlay Roots' `onOpenChange` (a dismissal). Not an action.
|
|
27
|
+
*
|
|
28
|
+
* It may return a promise (an `async` function, a Server Function): a rejection, like a
|
|
29
|
+
* synchronous throw, is passed to `reportError`. Nothing reaches an Error Boundary and nothing
|
|
30
|
+
* warns.
|
|
31
|
+
*/
|
|
32
|
+
export type UrgentChangeHandler<T, Details extends ActionDetails = ActionDetails> = (next: T, details: Details) => void;
|
|
33
|
+
/**
|
|
34
|
+
* A handler for a fact that carries no state (a toast's `onClose`). Same rule as
|
|
35
|
+
* `UrgentChangeHandler`: synchronous, outside any Transition, not awaited; a returned promise's
|
|
36
|
+
* rejection or a synchronous throw goes to `reportError`.
|
|
22
37
|
*/
|
|
23
|
-
export type
|
|
38
|
+
export type UrgentHandler<Details extends ActionDetails = ActionDetails> = (details: Details) => void;
|
|
24
39
|
/**
|
|
25
40
|
* Why a change action was dispatched (conventions 2.2). One library-wide vocabulary: every
|
|
26
41
|
* `<Component><State>ChangeDetails` that exposes `reason` declares it with this type.
|
|
@@ -28,12 +43,30 @@ export type UrgentChangeAction<T, Details extends ActionDetails = ActionDetails>
|
|
|
28
43
|
* - `"activate"`: the user acted on a trigger part (click, Enter/Space, label click, focus in an
|
|
29
44
|
* automatic-activation mode). `details.event` is the native event.
|
|
30
45
|
* - `"dismiss"`: the user closed the component without acting on one of its parts: Escape,
|
|
31
|
-
* Android back, an assistive-technology dismiss gesture, or a click outside (light dismiss)
|
|
32
|
-
*
|
|
46
|
+
* Android back, an assistive-technology dismiss gesture, or a click outside (light dismiss);
|
|
47
|
+
* also a close nobody caused through the component (script, another top-layer element, focus
|
|
48
|
+
* leaving). `details.event` is the platform's `close` or `toggle` event. On an overlay Root most
|
|
49
|
+
* such closes are facts, reported to `onOpenChange`, not to `openChangeAction` (#148).
|
|
33
50
|
* - `"platform"`: the browser changed the state itself: find-in-page, a form reset (`event` is
|
|
34
51
|
* the `reset` event), or interaction before hydration found at mount (`event` is `undefined`).
|
|
52
|
+
* - `"timeout"`: the library's own timer closed the component; no user gesture and no platform
|
|
53
|
+
* event (`event` is `undefined`). Toast's auto-dismiss is the only user.
|
|
54
|
+
*/
|
|
55
|
+
export type ChangeReason = "activate" | "dismiss" | "platform" | "timeout";
|
|
56
|
+
/**
|
|
57
|
+
* What a pure trigger (`Button`, `Dialog.Close`, `Popover.Close`, `Menu.Item`, `Toast.Action`)
|
|
58
|
+
* does with an activation that arrives while its own action is pending (conventions 2.5.1):
|
|
59
|
+
*
|
|
60
|
+
* - `"run"`: the activation runs the action again, in the same transition; the part shows
|
|
61
|
+
* `data-pending` until every run has settled and is never `aria-disabled` because of pending.
|
|
62
|
+
* - `"ignore"`: the activation starts nothing and its default action (a link's navigation, a
|
|
63
|
+
* form submission, a command) is cancelled; the part renders `aria-disabled="true"` while
|
|
64
|
+
* pending.
|
|
65
|
+
*
|
|
66
|
+
* The default depends on the part: `"run"` where the action is the user's alone (`Button`),
|
|
67
|
+
* `"ignore"` where the library closes something after it (a Close part, a closing menu item).
|
|
35
68
|
*/
|
|
36
|
-
export type
|
|
69
|
+
export type WhilePending = "run" | "ignore";
|
|
37
70
|
/** A prop value that is either a plain value or a function of the part's state. */
|
|
38
71
|
export type StateValue<T, State> = T | ((state: State) => T);
|
|
39
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/internal/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/internal/types.ts"],"mappings":";;;YAGY;;;;;;;YAQA,OAAO,4CAA4C,MAAM;;;;iBAKpD;;WAEN,OAAO;;;YAIN,aAAa,GAAG,gBAAgB,gBAAgB,iBAAiB,QAC1E,MAAM,GAAG,SAAS;;;;;;;;;;;;YAcT,oBAAoB,GAAG,gBAAgB,gBAAgB,kBACjE,MAAM,GACN,SAAS;;;;;;YAQC,cAAc,gBAAgB,gBAAgB,kBACxD,SAAS;;;;;;;;;;;;;;;;;YAmBC;;;;;;;;;;;;;;YAeA;;YAGA,WAAW,GAAG,SAAS,MAAM,OAAO,UAAU;;;;;;YAO9C,WAAW,OAAO,SAC1B,aAAa,QAAQ,YACnB,OAAO,OAAO,OAAO,UAAU"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
//#region src/internal/use-active-option.ts
|
|
4
|
+
/**
|
|
5
|
+
* The active option of a listbox with virtual focus, Combobox or MultiSelect
|
|
6
|
+
* (design/components/combobox.md 2 and 6.5; multi-select.md B.8): urgent virtual focus,
|
|
7
|
+
* revalidated against the mounted options in a layout effect after every commit.
|
|
8
|
+
*/
|
|
9
|
+
function useActiveOption({ popover, orderedOptions, autoHighlight, stale, loading }) {
|
|
10
|
+
const [activeValue, setActiveValue] = useState(null);
|
|
11
|
+
const activeRef = useRef(null);
|
|
12
|
+
const setActive = useCallback((next) => {
|
|
13
|
+
activeRef.current = next;
|
|
14
|
+
setActiveValue(next);
|
|
15
|
+
}, []);
|
|
16
|
+
const pendingEdgeRef = useRef(null);
|
|
17
|
+
const autoArmedRef = useRef(true);
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
const current = activeRef.current;
|
|
20
|
+
if (!popover.committed) {
|
|
21
|
+
if (!popover.intended()) pendingEdgeRef.current = null;
|
|
22
|
+
autoArmedRef.current = true;
|
|
23
|
+
if (current !== null) setActive(null);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const enabled = orderedOptions().filter((option) => !option.disabled);
|
|
27
|
+
let next = current;
|
|
28
|
+
const edge = pendingEdgeRef.current;
|
|
29
|
+
if (edge !== null && enabled.length > 0 && loading?.() !== true) {
|
|
30
|
+
next = typeof edge === "function" ? edge(enabled) : (edge === "first" ? enabled[0] : enabled.at(-1)).value;
|
|
31
|
+
pendingEdgeRef.current = null;
|
|
32
|
+
} else if (next !== null && !enabled.some((option) => option.value === next)) next = null;
|
|
33
|
+
if (next !== null) autoArmedRef.current = false;
|
|
34
|
+
else if (autoHighlight && autoArmedRef.current && !stale && enabled.length > 0) {
|
|
35
|
+
next = enabled[0].value;
|
|
36
|
+
autoArmedRef.current = false;
|
|
37
|
+
}
|
|
38
|
+
if (next !== current) setActive(next);
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
activeValue,
|
|
42
|
+
activeRef,
|
|
43
|
+
setActive,
|
|
44
|
+
pendingEdgeRef,
|
|
45
|
+
autoArmedRef
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { useActiveOption };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=use-active-option.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-active-option.mjs","names":[],"sources":["../../src/internal/use-active-option.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useLayoutEffect, useRef, useState } from \"react\";\nimport type { RefObject } from \"react\";\nimport type { OptionRegistry, OrderedOption } from \"./use-option-registry.js\";\n\n/**\n * Where the active option goes once an open has options: the first or last enabled one\n * (ArrowDown / ArrowUp while closed), or what a resolver picks from the enabled options in\n * document order (MultiSelect: the first selected one, a typeahead match; `null`: none).\n */\nexport type PendingEdge = \"first\" | \"last\" | ((enabled: readonly OrderedOption[]) => string | null);\n\nexport interface ActiveOptionOptions {\n /** The Root's popover (`PopoverRootValue`): its committed open state and the intent. */\n readonly popover: { readonly committed: boolean; readonly intended: () => boolean };\n readonly orderedOptions: OptionRegistry[\"orderedOptions\"];\n /** The Root's `autoHighlight`. */\n readonly autoHighlight: boolean;\n /** The results shown are for an older text: never auto-highlighted. */\n readonly stale: boolean;\n /**\n * Whether the List is loading (a `Status` is mounted inside it): the pending edge waits until\n * it settles (MultiSelect, multi-select.md B.8). Read in the layout effect, so it must see a\n * Status that registered in the same commit (a ref count, not render state). Default: never\n * loading, the edge is taken as soon as an enabled option is mounted (Combobox).\n */\n readonly loading?: () => boolean;\n}\n\nexport interface ActiveOption {\n /** The value of the option `aria-activedescendant` points at, or `null` (urgent state). */\n readonly activeValue: string | null;\n /** The same, for handlers: written together with the state. */\n readonly activeRef: RefObject<string | null>;\n readonly setActive: (next: string | null) => void;\n /** The edge to activate once the open has options (ArrowDown / ArrowUp while closed). */\n readonly pendingEdgeRef: RefObject<PendingEdge | null>;\n /**\n * `autoHighlight` (APG automatic selection) highlights once per open and once per edit, when\n * the results for it settle. Home / End / Left / Right clear the active option without\n * re-arming it, so the caret keys really return visual focus to the input.\n */\n readonly autoArmedRef: RefObject<boolean>;\n}\n\n/**\n * The active option of a listbox with virtual focus, Combobox or MultiSelect\n * (design/components/combobox.md 2 and 6.5; multi-select.md B.8): urgent virtual focus,\n * revalidated against the mounted options in a layout effect after every commit.\n */\nexport function useActiveOption({\n popover,\n orderedOptions,\n autoHighlight,\n stale,\n loading,\n}: ActiveOptionOptions): ActiveOption {\n const [activeValue, setActiveValue] = useState<string | null>(null);\n const activeRef = useRef<string | null>(null);\n const setActive = useCallback((next: string | null) => {\n activeRef.current = next;\n setActiveValue(next);\n }, []);\n const pendingEdgeRef = useRef<PendingEdge | null>(null);\n const autoArmedRef = useRef(true);\n\n // Revalidation (design 6.5): urgent, in a layout effect after every commit; never dispatches.\n useLayoutEffect(() => {\n const current = activeRef.current;\n if (!popover.committed) {\n // Keep the edge of an open that is on its way (the optimistic commit comes first).\n if (!popover.intended()) pendingEdgeRef.current = null;\n autoArmedRef.current = true;\n if (current !== null) setActive(null);\n return;\n }\n const enabled = orderedOptions().filter((option) => !option.disabled);\n let next = current;\n const edge = pendingEdgeRef.current;\n if (edge !== null && enabled.length > 0 && loading?.() !== true) {\n next =\n typeof edge === \"function\"\n ? edge(enabled)\n : (edge === \"first\" ? enabled[0] : enabled.at(-1))!.value;\n pendingEdgeRef.current = null;\n } else if (next !== null && !enabled.some((option) => option.value === next)) {\n next = null;\n }\n if (next !== null) {\n // Something is active (keys, hover): nothing to highlight for these results.\n autoArmedRef.current = false;\n } else if (autoHighlight && autoArmedRef.current && !stale && enabled.length > 0) {\n // Only settled results: a stale list's first option is never auto-highlighted, so a fast\n // Enter commits the typed text or does nothing (design 6.5).\n next = enabled[0]!.value;\n autoArmedRef.current = false;\n }\n if (next !== current) setActive(next);\n });\n\n return { activeValue, activeRef, setActive, pendingEdgeRef, autoArmedRef };\n}\n"],"mappings":";;;;;;;;AAkDA,SAAgB,gBAAgB,EAC9B,SACA,gBACA,eACA,OACA,WACoC;CACpC,MAAM,CAAC,aAAa,kBAAkB,SAAwB,IAAI;CAClE,MAAM,YAAY,OAAsB,IAAI;CAC5C,MAAM,YAAY,aAAa,SAAwB;EACrD,UAAU,UAAU;EACpB,eAAe,IAAI;CACrB,GAAG,CAAC,CAAC;CACL,MAAM,iBAAiB,OAA2B,IAAI;CACtD,MAAM,eAAe,OAAO,IAAI;CAGhC,sBAAsB;EACpB,MAAM,UAAU,UAAU;EAC1B,IAAI,CAAC,QAAQ,WAAW;GAEtB,IAAI,CAAC,QAAQ,SAAS,GAAG,eAAe,UAAU;GAClD,aAAa,UAAU;GACvB,IAAI,YAAY,MAAM,UAAU,IAAI;GACpC;EACF;EACA,MAAM,UAAU,eAAe,CAAC,CAAC,QAAQ,WAAW,CAAC,OAAO,QAAQ;EACpE,IAAI,OAAO;EACX,MAAM,OAAO,eAAe;EAC5B,IAAI,SAAS,QAAQ,QAAQ,SAAS,KAAK,UAAU,MAAM,MAAM;GAC/D,OACE,OAAO,SAAS,aACZ,KAAK,OAAO,KACX,SAAS,UAAU,QAAQ,KAAK,QAAQ,GAAG,EAAE,EAAA,CAAI;GACxD,eAAe,UAAU;EAC3B,OAAO,IAAI,SAAS,QAAQ,CAAC,QAAQ,MAAM,WAAW,OAAO,UAAU,IAAI,GACzE,OAAO;EAET,IAAI,SAAS,MAEX,aAAa,UAAU;OAClB,IAAI,iBAAiB,aAAa,WAAW,CAAC,SAAS,QAAQ,SAAS,GAAG;GAGhF,OAAO,QAAQ,EAAE,CAAE;GACnB,aAAa,UAAU;EACzB;EACA,IAAI,SAAS,SAAS,UAAU,IAAI;CACtC,CAAC;CAED,OAAO;EAAE;EAAa;EAAW;EAAW;EAAgB;CAAa;AAC3E"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLatest } from "./use-latest.mjs";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
//#region src/internal/use-deferred-leave.ts
|
|
5
|
+
/**
|
|
6
|
+
* The focus-leave decision of a listbox component's focus surface (design/components/combobox.md
|
|
7
|
+
* 5.4; the Combobox Input, the MultiSelect Trigger, multi-select.md B.4). A press blurs the
|
|
8
|
+
* input at `mousedown`, but its outcome is known only at the `click`, which runs in the
|
|
9
|
+
* `pointerup` task: a `<label for>` (Combobox.Label, Field.Label) refocuses the input there.
|
|
10
|
+
* While the input is focused (and until a leave deferred to a release has been decided), the
|
|
11
|
+
* presses on its document are tracked; a leave check made while one is down waits for the last
|
|
12
|
+
* release. A window blur forgets the presses (a release it swallowed would otherwise hold the
|
|
13
|
+
* check back), and so does focus arriving in the input.
|
|
14
|
+
*
|
|
15
|
+
* Returns the `focus` and `blur` handlers of the Input and of `Chips`: `focusIn` starts the
|
|
16
|
+
* tracking, `focusOut` calls `leave` at once when focus moved to an element outside the input,
|
|
17
|
+
* the popup and the chips, and
|
|
18
|
+
* decides one task after the press is released (or one task later) when it moved nowhere.
|
|
19
|
+
*/
|
|
20
|
+
function useDeferredLeave({ surfaceRef: inputRef, popupRef, chipsRef, leave }) {
|
|
21
|
+
const leaveRef = useLatest(leave);
|
|
22
|
+
const inside = (node) => {
|
|
23
|
+
if (node === null) return false;
|
|
24
|
+
if (node === inputRef.current) return true;
|
|
25
|
+
const popup = popupRef.current;
|
|
26
|
+
if (popup !== null && popup.contains(node)) return true;
|
|
27
|
+
const chips = chipsRef?.current ?? null;
|
|
28
|
+
return chips !== null && chips.contains(node);
|
|
29
|
+
};
|
|
30
|
+
const presses = useRef(/* @__PURE__ */ new Set());
|
|
31
|
+
const afterPress = useRef(null);
|
|
32
|
+
const unwatchPresses = useRef(null);
|
|
33
|
+
const unwatch = () => {
|
|
34
|
+
unwatchPresses.current?.();
|
|
35
|
+
unwatchPresses.current = null;
|
|
36
|
+
presses.current.clear();
|
|
37
|
+
afterPress.current = null;
|
|
38
|
+
};
|
|
39
|
+
const watchPresses = (element) => {
|
|
40
|
+
presses.current.clear();
|
|
41
|
+
if (unwatchPresses.current !== null) return;
|
|
42
|
+
const doc = element.ownerDocument;
|
|
43
|
+
const win = doc.defaultView;
|
|
44
|
+
const released = () => {
|
|
45
|
+
const check = afterPress.current;
|
|
46
|
+
if (check === null || presses.current.size > 0) return;
|
|
47
|
+
unwatch();
|
|
48
|
+
setTimeout(check, 0);
|
|
49
|
+
};
|
|
50
|
+
const down = (event) => {
|
|
51
|
+
presses.current.add(event.pointerId);
|
|
52
|
+
};
|
|
53
|
+
const up = (event) => {
|
|
54
|
+
presses.current.delete(event.pointerId);
|
|
55
|
+
released();
|
|
56
|
+
};
|
|
57
|
+
const blur = () => {
|
|
58
|
+
presses.current.clear();
|
|
59
|
+
released();
|
|
60
|
+
};
|
|
61
|
+
doc.addEventListener("pointerdown", down, true);
|
|
62
|
+
doc.addEventListener("pointerup", up, true);
|
|
63
|
+
doc.addEventListener("pointercancel", up, true);
|
|
64
|
+
win?.addEventListener("blur", blur);
|
|
65
|
+
unwatchPresses.current = () => {
|
|
66
|
+
doc.removeEventListener("pointerdown", down, true);
|
|
67
|
+
doc.removeEventListener("pointerup", up, true);
|
|
68
|
+
doc.removeEventListener("pointercancel", up, true);
|
|
69
|
+
win?.removeEventListener("blur", blur);
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
const input = inputRef.current;
|
|
74
|
+
if (input !== null && input.ownerDocument.activeElement === input) watchPresses(input);
|
|
75
|
+
return unwatch;
|
|
76
|
+
}, [inputRef]);
|
|
77
|
+
const focusIn = (event) => {
|
|
78
|
+
watchPresses(event.currentTarget);
|
|
79
|
+
};
|
|
80
|
+
const focusOut = (event) => {
|
|
81
|
+
const input = inputRef.current;
|
|
82
|
+
const next = event.relatedTarget;
|
|
83
|
+
if (next instanceof Node) {
|
|
84
|
+
if (inside(next)) return;
|
|
85
|
+
unwatch();
|
|
86
|
+
leave(event);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (input === null) {
|
|
90
|
+
unwatch();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const doc = input.ownerDocument;
|
|
94
|
+
const check = () => {
|
|
95
|
+
if (!doc.hasFocus()) return;
|
|
96
|
+
if (inside(doc.activeElement)) return;
|
|
97
|
+
if (input.isConnected) leaveRef.current(event);
|
|
98
|
+
};
|
|
99
|
+
if (presses.current.size > 0) afterPress.current = check;
|
|
100
|
+
else {
|
|
101
|
+
unwatch();
|
|
102
|
+
setTimeout(check, 0);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
focusIn,
|
|
107
|
+
focusOut
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { useDeferredLeave };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=use-deferred-leave.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-deferred-leave.mjs","names":[],"sources":["../../src/internal/use-deferred-leave.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport type { RefObject } from \"react\";\nimport { useLatest } from \"./use-latest.js\";\n\nexport interface DeferredLeaveOptions {\n /** The element that holds focus: the Combobox Input, the MultiSelect Trigger. */\n readonly surfaceRef: RefObject<HTMLElement | null>;\n readonly popupRef: RefObject<HTMLElement | null>;\n /**\n * `Combobox.Chips` (`multiple`, combobox.md 15.6): a third region inside the combobox. Focus\n * moving between the input and a chip is not focus leaving.\n */\n readonly chipsRef?: RefObject<HTMLElement | null>;\n /** Focus has left the surface, the popup and the chips (combobox.md 5.4, 15.6). */\n readonly leave: (event: Event) => void;\n}\n\nexport interface DeferredLeave {\n readonly focusIn: (event: FocusEvent) => void;\n readonly focusOut: (event: FocusEvent) => void;\n}\n\n/**\n * The focus-leave decision of a listbox component's focus surface (design/components/combobox.md\n * 5.4; the Combobox Input, the MultiSelect Trigger, multi-select.md B.4). A press blurs the\n * input at `mousedown`, but its outcome is known only at the `click`, which runs in the\n * `pointerup` task: a `<label for>` (Combobox.Label, Field.Label) refocuses the input there.\n * While the input is focused (and until a leave deferred to a release has been decided), the\n * presses on its document are tracked; a leave check made while one is down waits for the last\n * release. A window blur forgets the presses (a release it swallowed would otherwise hold the\n * check back), and so does focus arriving in the input.\n *\n * Returns the `focus` and `blur` handlers of the Input and of `Chips`: `focusIn` starts the\n * tracking, `focusOut` calls `leave` at once when focus moved to an element outside the input,\n * the popup and the chips, and\n * decides one task after the press is released (or one task later) when it moved nowhere.\n */\nexport function useDeferredLeave({\n surfaceRef: inputRef,\n popupRef,\n chipsRef,\n leave,\n}: DeferredLeaveOptions): DeferredLeave {\n const leaveRef = useLatest(leave);\n const inside = (node: Node | null): boolean => {\n if (node === null) return false;\n if (node === inputRef.current) return true;\n const popup = popupRef.current;\n if (popup !== null && popup.contains(node)) return true;\n const chips = chipsRef?.current ?? null;\n return chips !== null && chips.contains(node);\n };\n\n const presses = useRef(new Set<number>());\n const afterPress = useRef<(() => void) | null>(null);\n const unwatchPresses = useRef<(() => void) | null>(null);\n const unwatch = (): void => {\n unwatchPresses.current?.();\n unwatchPresses.current = null;\n presses.current.clear();\n afterPress.current = null;\n };\n const watchPresses = (element: HTMLElement): void => {\n presses.current.clear();\n if (unwatchPresses.current !== null) return;\n const doc = element.ownerDocument;\n const win = doc.defaultView;\n const released = (): void => {\n const check = afterPress.current;\n if (check === null || presses.current.size > 0) return;\n unwatch();\n setTimeout(check, 0);\n };\n const down = (event: PointerEvent): void => {\n presses.current.add(event.pointerId);\n };\n const up = (event: PointerEvent): void => {\n presses.current.delete(event.pointerId);\n released();\n };\n const blur = (): void => {\n presses.current.clear();\n released();\n };\n doc.addEventListener(\"pointerdown\", down, true);\n doc.addEventListener(\"pointerup\", up, true);\n doc.addEventListener(\"pointercancel\", up, true);\n win?.addEventListener(\"blur\", blur);\n unwatchPresses.current = () => {\n doc.removeEventListener(\"pointerdown\", down, true);\n doc.removeEventListener(\"pointerup\", up, true);\n doc.removeEventListener(\"pointercancel\", up, true);\n win?.removeEventListener(\"blur\", blur);\n };\n };\n useEffect(() => {\n // Focused before the Root mounted (autofocus, typing before hydration): no `focus` follows.\n const input = inputRef.current;\n if (input !== null && input.ownerDocument.activeElement === input) watchPresses(input);\n return unwatch;\n // `inputRef` is the Root's own ref object: the effect runs once, at mount.\n }, [inputRef]);\n\n const focusIn = (event: FocusEvent): void => {\n watchPresses(event.currentTarget as HTMLElement);\n };\n\n const focusOut = (event: FocusEvent): void => {\n const input = inputRef.current;\n const next = event.relatedTarget;\n if (next instanceof Node) {\n if (inside(next)) return;\n unwatch();\n leave(event);\n return;\n }\n // No related target: the window lost focus (nothing to do), or a press landed on something\n // that takes no focus (a label, the page itself: focus moved to <body>). Decide one task\n // after the press is released (its click has run then), or one task later without a press.\n if (input === null) {\n unwatch();\n return;\n }\n const doc = input.ownerDocument;\n const check = () => {\n if (!doc.hasFocus()) return;\n if (inside(doc.activeElement)) return;\n if (input.isConnected) leaveRef.current(event);\n };\n if (presses.current.size > 0) {\n afterPress.current = check;\n } else {\n unwatch();\n setTimeout(check, 0);\n }\n };\n\n return { focusIn, focusOut };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,iBAAiB,EAC/B,YAAY,UACZ,UACA,UACA,SACsC;CACtC,MAAM,WAAW,UAAU,KAAK;CAChC,MAAM,UAAU,SAA+B;EAC7C,IAAI,SAAS,MAAM,OAAO;EAC1B,IAAI,SAAS,SAAS,SAAS,OAAO;EACtC,MAAM,QAAQ,SAAS;EACvB,IAAI,UAAU,QAAQ,MAAM,SAAS,IAAI,GAAG,OAAO;EACnD,MAAM,QAAQ,UAAU,WAAW;EACnC,OAAO,UAAU,QAAQ,MAAM,SAAS,IAAI;CAC9C;CAEA,MAAM,UAAU,uBAAO,IAAI,IAAY,CAAC;CACxC,MAAM,aAAa,OAA4B,IAAI;CACnD,MAAM,iBAAiB,OAA4B,IAAI;CACvD,MAAM,gBAAsB;EAC1B,eAAe,UAAU;EACzB,eAAe,UAAU;EACzB,QAAQ,QAAQ,MAAM;EACtB,WAAW,UAAU;CACvB;CACA,MAAM,gBAAgB,YAA+B;EACnD,QAAQ,QAAQ,MAAM;EACtB,IAAI,eAAe,YAAY,MAAM;EACrC,MAAM,MAAM,QAAQ;EACpB,MAAM,MAAM,IAAI;EAChB,MAAM,iBAAuB;GAC3B,MAAM,QAAQ,WAAW;GACzB,IAAI,UAAU,QAAQ,QAAQ,QAAQ,OAAO,GAAG;GAChD,QAAQ;GACR,WAAW,OAAO,CAAC;EACrB;EACA,MAAM,QAAQ,UAA8B;GAC1C,QAAQ,QAAQ,IAAI,MAAM,SAAS;EACrC;EACA,MAAM,MAAM,UAA8B;GACxC,QAAQ,QAAQ,OAAO,MAAM,SAAS;GACtC,SAAS;EACX;EACA,MAAM,aAAmB;GACvB,QAAQ,QAAQ,MAAM;GACtB,SAAS;EACX;EACA,IAAI,iBAAiB,eAAe,MAAM,IAAI;EAC9C,IAAI,iBAAiB,aAAa,IAAI,IAAI;EAC1C,IAAI,iBAAiB,iBAAiB,IAAI,IAAI;EAC9C,KAAK,iBAAiB,QAAQ,IAAI;EAClC,eAAe,gBAAgB;GAC7B,IAAI,oBAAoB,eAAe,MAAM,IAAI;GACjD,IAAI,oBAAoB,aAAa,IAAI,IAAI;GAC7C,IAAI,oBAAoB,iBAAiB,IAAI,IAAI;GACjD,KAAK,oBAAoB,QAAQ,IAAI;EACvC;CACF;CACA,gBAAgB;EAEd,MAAM,QAAQ,SAAS;EACvB,IAAI,UAAU,QAAQ,MAAM,cAAc,kBAAkB,OAAO,aAAa,KAAK;EACrF,OAAO;CAET,GAAG,CAAC,QAAQ,CAAC;CAEb,MAAM,WAAW,UAA4B;EAC3C,aAAa,MAAM,aAA4B;CACjD;CAEA,MAAM,YAAY,UAA4B;EAC5C,MAAM,QAAQ,SAAS;EACvB,MAAM,OAAO,MAAM;EACnB,IAAI,gBAAgB,MAAM;GACxB,IAAI,OAAO,IAAI,GAAG;GAClB,QAAQ;GACR,MAAM,KAAK;GACX;EACF;EAIA,IAAI,UAAU,MAAM;GAClB,QAAQ;GACR;EACF;EACA,MAAM,MAAM,MAAM;EAClB,MAAM,cAAc;GAClB,IAAI,CAAC,IAAI,SAAS,GAAG;GACrB,IAAI,OAAO,IAAI,aAAa,GAAG;GAC/B,IAAI,MAAM,aAAa,SAAS,QAAQ,KAAK;EAC/C;EACA,IAAI,QAAQ,QAAQ,OAAO,GACzB,WAAW,UAAU;OAChB;GACL,QAAQ;GACR,WAAW,OAAO,CAAC;EACrB;CACF;CAEA,OAAO;EAAE;EAAS;CAAS;AAC7B"}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
|
-
//#region src/internal/use-dev-warning.ts
|
|
4
|
-
const isDev = process.env.NODE_ENV !== "production";
|
|
5
3
|
/**
|
|
6
4
|
* Logs `message` through `console.error` once per component instance, the first time
|
|
7
5
|
* `condition` is true. Runs in an effect (never during render) so the warning cannot fire for a
|
|
8
6
|
* render that is discarded.
|
|
7
|
+
*
|
|
8
|
+
* Pass the message as `isDev && "..."` with the calling module's own `isDev` constant: the text
|
|
9
|
+
* then folds away in a production build (`src/__tests__/production-bundle.test.ts` checks it).
|
|
10
|
+
* In production the hook is a no-op.
|
|
9
11
|
*/
|
|
10
|
-
|
|
12
|
+
const useDevWarning = process.env.NODE_ENV !== "production" ? useDevWarningDev : noop;
|
|
13
|
+
function useDevWarningDev(condition, message) {
|
|
11
14
|
const warned = useRef(false);
|
|
12
15
|
useEffect(() => {
|
|
13
|
-
if (!
|
|
16
|
+
if (!condition || message === false || warned.current) return;
|
|
14
17
|
warned.current = true;
|
|
15
18
|
console.error(message);
|
|
16
19
|
}, [condition, message]);
|
|
17
20
|
}
|
|
21
|
+
function noop() {}
|
|
18
22
|
//#endregion
|
|
19
23
|
export { useDevWarning };
|
|
20
24
|
|