@funstack/ui 0.1.0-alpha.15 → 0.1.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -1
- package/dist/accordion/accordion-item.d.mts +19 -0
- package/dist/accordion/accordion-item.d.mts.map +1 -1
- package/dist/accordion/accordion-item.mjs +2 -0
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.d.mts +16 -0
- package/dist/accordion/accordion-panel.d.mts.map +1 -1
- package/dist/accordion/accordion-panel.mjs +2 -0
- package/dist/accordion/accordion-panel.mjs.map +1 -1
- package/dist/accordion/accordion-root.d.mts +36 -2
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +2 -0
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.d.mts +9 -0
- package/dist/accordion/accordion-trigger.d.mts.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +2 -0
- package/dist/accordion/accordion-trigger.mjs.map +1 -1
- package/dist/accordion/index.d.mts +2 -0
- package/dist/accordion/index.d.mts.map +1 -1
- package/dist/accordion/index.mjs +2 -0
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/bin/skill-installer.d.mts +1 -0
- package/dist/bin/skill-installer.mjs +12 -0
- package/dist/bin/skill-installer.mjs.map +1 -0
- package/dist/button/button.d.mts +25 -7
- package/dist/button/button.d.mts.map +1 -1
- package/dist/button/button.mjs +2 -0
- package/dist/button/button.mjs.map +1 -1
- package/dist/checkbox/checkbox.d.mts +25 -3
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +2 -0
- package/dist/checkbox/checkbox.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts +15 -0
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.d.mts +10 -0
- package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.d.mts +19 -1
- package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +31 -4
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
- package/dist/checkbox-group/index.d.mts +2 -0
- package/dist/checkbox-group/index.d.mts.map +1 -1
- package/dist/checkbox-group/index.mjs +2 -0
- package/dist/checkbox-group/index.mjs.map +1 -1
- package/dist/combobox/combobox-clear.d.mts +18 -0
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +2 -0
- package/dist/combobox/combobox-clear.mjs.map +1 -1
- package/dist/combobox/combobox-group.d.mts +49 -1
- package/dist/combobox/combobox-group.d.mts.map +1 -1
- package/dist/combobox/combobox-group.mjs +11 -1
- package/dist/combobox/combobox-group.mjs.map +1 -1
- package/dist/combobox/combobox-input.d.mts +11 -0
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +2 -0
- package/dist/combobox/combobox-input.mjs.map +1 -1
- package/dist/combobox/combobox-label.d.mts +16 -0
- package/dist/combobox/combobox-label.d.mts.map +1 -1
- package/dist/combobox/combobox-label.mjs +2 -0
- package/dist/combobox/combobox-label.mjs.map +1 -1
- package/dist/combobox/combobox-list.d.mts +14 -0
- package/dist/combobox/combobox-list.d.mts.map +1 -1
- package/dist/combobox/combobox-list.mjs +2 -0
- package/dist/combobox/combobox-list.mjs.map +1 -1
- package/dist/combobox/combobox-option.d.mts +25 -3
- package/dist/combobox/combobox-option.d.mts.map +1 -1
- package/dist/combobox/combobox-option.mjs +2 -0
- package/dist/combobox/combobox-option.mjs.map +1 -1
- package/dist/combobox/combobox-popup.d.mts +16 -0
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +2 -0
- package/dist/combobox/combobox-popup.mjs.map +1 -1
- package/dist/combobox/combobox-root.d.mts +49 -12
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +2 -0
- package/dist/combobox/combobox-root.mjs.map +1 -1
- package/dist/combobox/combobox-trigger.d.mts +16 -0
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +2 -0
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/combobox/index.d.mts +2 -0
- package/dist/combobox/index.d.mts.map +1 -1
- package/dist/combobox/index.mjs +2 -0
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/csp/csp-provider.d.mts +8 -0
- package/dist/csp/csp-provider.d.mts.map +1 -1
- package/dist/csp/csp-provider.mjs +2 -0
- package/dist/csp/csp-provider.mjs.map +1 -1
- package/dist/csp/style-hashes.d.mts +2 -0
- package/dist/csp/style-hashes.d.mts.map +1 -1
- package/dist/csp/style-hashes.mjs +2 -0
- package/dist/csp/style-hashes.mjs.map +1 -1
- package/dist/dialog/dialog-close.d.mts +18 -0
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +2 -0
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-description.d.mts +12 -0
- package/dist/dialog/dialog-description.d.mts.map +1 -1
- package/dist/dialog/dialog-description.mjs +2 -0
- package/dist/dialog/dialog-description.mjs.map +1 -1
- package/dist/dialog/dialog-form.d.mts +18 -1
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +2 -0
- package/dist/dialog/dialog-form.mjs.map +1 -1
- package/dist/dialog/dialog-popup.d.mts +25 -4
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +2 -0
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts +15 -1
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +2 -0
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-title.d.mts +11 -0
- package/dist/dialog/dialog-title.d.mts.map +1 -1
- package/dist/dialog/dialog-title.mjs +2 -0
- package/dist/dialog/dialog-title.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +16 -0
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +2 -0
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/dialog/index.d.mts +2 -0
- package/dist/dialog/index.d.mts.map +1 -1
- package/dist/dialog/index.mjs +2 -0
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/docs/components/accordion.md +426 -0
- package/dist/docs/components/button.md +464 -0
- package/dist/docs/components/checkbox-group.md +474 -0
- package/dist/docs/components/checkbox.md +373 -0
- package/dist/docs/components/combobox.md +635 -0
- package/dist/docs/components/context-menu.md +524 -0
- package/dist/docs/components/dialog.md +686 -0
- package/dist/docs/components/field.md +587 -0
- package/dist/docs/components/menu.md +589 -0
- package/dist/docs/components/meter.md +313 -0
- package/dist/docs/components/number-field.md +528 -0
- package/dist/docs/components/popover.md +591 -0
- package/dist/docs/components/progress.md +450 -0
- package/dist/docs/components/radio-group.md +457 -0
- package/dist/docs/components/select.md +662 -0
- package/dist/docs/components/slider.md +558 -0
- package/dist/docs/components/switch.md +311 -0
- package/dist/docs/components/tabs.md +473 -0
- package/dist/docs/components/toast.md +576 -0
- package/dist/docs/components/toggle-group.md +341 -0
- package/dist/docs/components/toggle.md +245 -0
- package/dist/docs/components/toolbar.md +389 -0
- package/dist/docs/components/tooltip.md +494 -0
- package/dist/docs/concepts/action-props.md +251 -0
- package/dist/docs/concepts/ai-agents.md +56 -0
- package/dist/docs/concepts/browser-owned-state.md +118 -0
- package/dist/docs/concepts/content-security-policy.md +69 -0
- package/dist/docs/concepts/experimental.md +36 -0
- package/dist/docs/concepts/pending-and-optimistic.md +250 -0
- package/dist/docs/concepts/server-components.md +118 -0
- package/dist/docs/concepts/suspense.md +124 -0
- package/dist/docs/concepts/transitions.md +118 -0
- package/dist/docs/getting-started.md +115 -0
- package/dist/docs/index.md +181 -0
- package/dist/docs/roadmap.md +74 -0
- package/dist/docs/why.md +100 -0
- package/dist/field/field-control.d.mts +26 -3
- package/dist/field/field-control.d.mts.map +1 -1
- package/dist/field/field-control.mjs +2 -0
- package/dist/field/field-control.mjs.map +1 -1
- package/dist/field/field-description.d.mts +11 -0
- package/dist/field/field-description.d.mts.map +1 -1
- package/dist/field/field-description.mjs +2 -0
- package/dist/field/field-description.mjs.map +1 -1
- package/dist/field/field-error.d.mts +14 -2
- package/dist/field/field-error.d.mts.map +1 -1
- package/dist/field/field-error.mjs +2 -0
- package/dist/field/field-error.mjs.map +1 -1
- package/dist/field/field-label.d.mts +10 -0
- package/dist/field/field-label.d.mts.map +1 -1
- package/dist/field/field-label.mjs +2 -0
- package/dist/field/field-label.mjs.map +1 -1
- package/dist/field/field-root.d.mts +21 -2
- package/dist/field/field-root.d.mts.map +1 -1
- package/dist/field/field-root.mjs +2 -0
- package/dist/field/field-root.mjs.map +1 -1
- package/dist/field/index.d.mts +9 -0
- package/dist/field/index.d.mts.map +1 -1
- package/dist/field/index.mjs +9 -0
- package/dist/field/index.mjs.map +1 -1
- package/dist/form/form-root.d.mts +17 -1
- package/dist/form/form-root.d.mts.map +1 -1
- package/dist/form/form-root.mjs +2 -0
- package/dist/form/form-root.mjs.map +1 -1
- package/dist/form/form-submit.d.mts +18 -0
- package/dist/form/form-submit.d.mts.map +1 -1
- package/dist/form/form-submit.mjs +2 -0
- package/dist/form/form-submit.mjs.map +1 -1
- package/dist/form/index.d.mts +7 -0
- package/dist/form/index.d.mts.map +1 -1
- package/dist/form/index.mjs +7 -0
- package/dist/form/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/internal/types.d.mts +3 -0
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-popover-trigger.d.mts +1 -0
- package/dist/internal/use-popover-trigger.d.mts.map +1 -1
- package/dist/internal/use-popover-trigger.mjs.map +1 -1
- package/dist/internal/validity.d.mts +11 -0
- package/dist/internal/validity.d.mts.map +1 -1
- package/dist/internal/validity.mjs.map +1 -1
- package/dist/menu/index.d.mts +2 -0
- package/dist/menu/index.d.mts.map +1 -1
- package/dist/menu/index.mjs +2 -0
- package/dist/menu/index.mjs.map +1 -1
- package/dist/menu/menu-checkbox-item.d.mts +26 -2
- package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
- package/dist/menu/menu-checkbox-item.mjs +2 -0
- package/dist/menu/menu-checkbox-item.mjs.map +1 -1
- package/dist/menu/menu-context-trigger.d.mts +24 -2
- package/dist/menu/menu-context-trigger.d.mts.map +1 -1
- package/dist/menu/menu-context-trigger.mjs +2 -0
- package/dist/menu/menu-context-trigger.mjs.map +1 -1
- package/dist/menu/menu-group.d.mts +36 -1
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +9 -1
- package/dist/menu/menu-group.mjs.map +1 -1
- package/dist/menu/menu-item.d.mts +23 -1
- package/dist/menu/menu-item.d.mts.map +1 -1
- package/dist/menu/menu-item.mjs +2 -0
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-popup.d.mts +33 -8
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +2 -0
- package/dist/menu/menu-popup.mjs.map +1 -1
- package/dist/menu/menu-radio-group.d.mts +20 -1
- package/dist/menu/menu-radio-group.d.mts.map +1 -1
- package/dist/menu/menu-radio-group.mjs +2 -0
- package/dist/menu/menu-radio-group.mjs.map +1 -1
- package/dist/menu/menu-radio-item.d.mts +16 -0
- package/dist/menu/menu-radio-item.d.mts.map +1 -1
- package/dist/menu/menu-radio-item.mjs +2 -0
- package/dist/menu/menu-radio-item.mjs.map +1 -1
- package/dist/menu/menu-root.d.mts +22 -3
- package/dist/menu/menu-root.d.mts.map +1 -1
- package/dist/menu/menu-root.mjs +2 -0
- package/dist/menu/menu-root.mjs.map +1 -1
- package/dist/menu/menu-submenu-trigger.d.mts +13 -0
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +2 -0
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +15 -0
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +2 -0
- package/dist/menu/menu-trigger.mjs.map +1 -1
- package/dist/meter/index.d.mts +2 -0
- package/dist/meter/index.d.mts.map +1 -1
- package/dist/meter/index.mjs +2 -0
- package/dist/meter/index.mjs.map +1 -1
- package/dist/meter/meter-indicator.d.mts +11 -0
- package/dist/meter/meter-indicator.d.mts.map +1 -1
- package/dist/meter/meter-indicator.mjs +2 -0
- package/dist/meter/meter-indicator.mjs.map +1 -1
- package/dist/meter/meter-label.d.mts +11 -0
- package/dist/meter/meter-label.d.mts.map +1 -1
- package/dist/meter/meter-label.mjs +2 -0
- package/dist/meter/meter-label.mjs.map +1 -1
- package/dist/meter/meter-region.d.mts +5 -0
- package/dist/meter/meter-region.d.mts.map +1 -1
- package/dist/meter/meter-region.mjs.map +1 -1
- package/dist/meter/meter-root.d.mts +52 -10
- package/dist/meter/meter-root.d.mts.map +1 -1
- package/dist/meter/meter-root.mjs +2 -0
- package/dist/meter/meter-root.mjs.map +1 -1
- package/dist/meter/meter-track.d.mts +11 -0
- package/dist/meter/meter-track.d.mts.map +1 -1
- package/dist/meter/meter-track.mjs +2 -0
- package/dist/meter/meter-track.mjs.map +1 -1
- package/dist/meter/meter-value.d.mts +15 -1
- package/dist/meter/meter-value.d.mts.map +1 -1
- package/dist/meter/meter-value.mjs +2 -0
- package/dist/meter/meter-value.mjs.map +1 -1
- package/dist/number-field/index.d.mts +2 -0
- package/dist/number-field/index.d.mts.map +1 -1
- package/dist/number-field/index.mjs +2 -0
- package/dist/number-field/index.mjs.map +1 -1
- package/dist/number-field/number-field-decrement.d.mts +2 -0
- package/dist/number-field/number-field-decrement.d.mts.map +1 -1
- package/dist/number-field/number-field-decrement.mjs +2 -0
- package/dist/number-field/number-field-decrement.mjs.map +1 -1
- package/dist/number-field/number-field-increment.d.mts +2 -0
- package/dist/number-field/number-field-increment.d.mts.map +1 -1
- package/dist/number-field/number-field-increment.mjs +2 -0
- package/dist/number-field/number-field-increment.mjs.map +1 -1
- package/dist/number-field/number-field-input.d.mts +9 -0
- package/dist/number-field/number-field-input.d.mts.map +1 -1
- package/dist/number-field/number-field-input.mjs +2 -0
- package/dist/number-field/number-field-input.mjs.map +1 -1
- package/dist/number-field/number-field-label.d.mts +10 -0
- package/dist/number-field/number-field-label.d.mts.map +1 -1
- package/dist/number-field/number-field-label.mjs +2 -0
- package/dist/number-field/number-field-label.mjs.map +1 -1
- package/dist/number-field/number-field-root.d.mts +62 -14
- package/dist/number-field/number-field-root.d.mts.map +1 -1
- package/dist/number-field/number-field-root.mjs +2 -0
- package/dist/number-field/number-field-root.mjs.map +1 -1
- package/dist/number-field/use-step-button.d.mts +20 -0
- package/dist/number-field/use-step-button.d.mts.map +1 -1
- package/dist/number-field/use-step-button.mjs.map +1 -1
- package/dist/popover/index.d.mts +2 -0
- package/dist/popover/index.d.mts.map +1 -1
- package/dist/popover/index.mjs +2 -0
- package/dist/popover/index.mjs.map +1 -1
- package/dist/popover/popover-close.d.mts +18 -0
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +2 -0
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-description.d.mts +12 -0
- package/dist/popover/popover-description.d.mts.map +1 -1
- package/dist/popover/popover-description.mjs +2 -0
- package/dist/popover/popover-description.mjs.map +1 -1
- package/dist/popover/popover-popup.d.mts +30 -4
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +2 -0
- package/dist/popover/popover-popup.mjs.map +1 -1
- package/dist/popover/popover-root.d.mts +9 -0
- package/dist/popover/popover-root.d.mts.map +1 -1
- package/dist/popover/popover-root.mjs +2 -0
- package/dist/popover/popover-root.mjs.map +1 -1
- package/dist/popover/popover-title.d.mts +11 -0
- package/dist/popover/popover-title.d.mts.map +1 -1
- package/dist/popover/popover-title.mjs +2 -0
- package/dist/popover/popover-title.mjs.map +1 -1
- package/dist/popover/popover-trigger.d.mts +15 -0
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +2 -0
- package/dist/popover/popover-trigger.mjs.map +1 -1
- package/dist/progress/index.d.mts +2 -0
- package/dist/progress/index.d.mts.map +1 -1
- package/dist/progress/index.mjs +2 -0
- package/dist/progress/index.mjs.map +1 -1
- package/dist/progress/progress-indicator.d.mts +11 -0
- package/dist/progress/progress-indicator.d.mts.map +1 -1
- package/dist/progress/progress-indicator.mjs +2 -0
- package/dist/progress/progress-indicator.mjs.map +1 -1
- package/dist/progress/progress-label.d.mts +11 -0
- package/dist/progress/progress-label.d.mts.map +1 -1
- package/dist/progress/progress-label.mjs +2 -0
- package/dist/progress/progress-label.mjs.map +1 -1
- package/dist/progress/progress-root.d.mts +36 -8
- package/dist/progress/progress-root.d.mts.map +1 -1
- package/dist/progress/progress-root.mjs +2 -0
- package/dist/progress/progress-root.mjs.map +1 -1
- package/dist/progress/progress-track.d.mts +11 -0
- package/dist/progress/progress-track.d.mts.map +1 -1
- package/dist/progress/progress-track.mjs +2 -0
- package/dist/progress/progress-track.mjs.map +1 -1
- package/dist/progress/progress-value.d.mts +15 -1
- package/dist/progress/progress-value.d.mts.map +1 -1
- package/dist/progress/progress-value.mjs +2 -0
- package/dist/progress/progress-value.mjs.map +1 -1
- package/dist/radio-group/index.d.mts +2 -0
- package/dist/radio-group/index.d.mts.map +1 -1
- package/dist/radio-group/index.mjs +2 -0
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/radio-group/radio-group-item.d.mts +18 -1
- package/dist/radio-group/radio-group-item.d.mts.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +2 -0
- package/dist/radio-group/radio-group-item.mjs.map +1 -1
- package/dist/radio-group/radio-group-label.d.mts +10 -0
- package/dist/radio-group/radio-group-label.d.mts.map +1 -1
- package/dist/radio-group/radio-group-label.mjs +2 -0
- package/dist/radio-group/radio-group-label.mjs.map +1 -1
- package/dist/radio-group/radio-group-root.d.mts +29 -5
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +2 -0
- package/dist/radio-group/radio-group-root.mjs.map +1 -1
- package/dist/select/index.d.mts +2 -0
- package/dist/select/index.d.mts.map +1 -1
- package/dist/select/index.mjs +2 -0
- package/dist/select/index.mjs.map +1 -1
- package/dist/select/select-group-label.d.mts +10 -0
- package/dist/select/select-group-label.d.mts.map +1 -1
- package/dist/select/select-group-label.mjs +2 -0
- package/dist/select/select-group-label.mjs.map +1 -1
- package/dist/select/select-group.d.mts +15 -1
- package/dist/select/select-group.d.mts.map +1 -1
- package/dist/select/select-group.mjs +2 -0
- package/dist/select/select-group.mjs.map +1 -1
- package/dist/select/select-option.d.mts +19 -1
- package/dist/select/select-option.d.mts.map +1 -1
- package/dist/select/select-option.mjs +2 -0
- package/dist/select/select-option.mjs.map +1 -1
- package/dist/select/select-root.d.mts +24 -1
- package/dist/select/select-root.d.mts.map +1 -1
- package/dist/select/select-root.mjs +2 -0
- package/dist/select/select-root.mjs.map +1 -1
- package/dist/select/select-separator.d.mts +9 -0
- package/dist/select/select-separator.d.mts.map +1 -1
- package/dist/select/select-separator.mjs +2 -0
- package/dist/select/select-separator.mjs.map +1 -1
- package/dist/select/select-trigger.d.mts +9 -0
- package/dist/select/select-trigger.d.mts.map +1 -1
- package/dist/select/select-trigger.mjs +2 -0
- package/dist/select/select-trigger.mjs.map +1 -1
- package/dist/select/select-value.d.mts +9 -0
- package/dist/select/select-value.d.mts.map +1 -1
- package/dist/select/select-value.mjs +2 -0
- package/dist/select/select-value.mjs.map +1 -1
- package/dist/slider/index.d.mts +2 -0
- package/dist/slider/index.d.mts.map +1 -1
- package/dist/slider/index.mjs +2 -0
- package/dist/slider/index.mjs.map +1 -1
- package/dist/slider/slider-indicator.d.mts +12 -0
- package/dist/slider/slider-indicator.d.mts.map +1 -1
- package/dist/slider/slider-indicator.mjs +2 -0
- package/dist/slider/slider-indicator.mjs.map +1 -1
- package/dist/slider/slider-label.d.mts +11 -1
- package/dist/slider/slider-label.d.mts.map +1 -1
- package/dist/slider/slider-label.mjs +2 -0
- package/dist/slider/slider-label.mjs.map +1 -1
- package/dist/slider/slider-root.d.mts +53 -9
- package/dist/slider/slider-root.d.mts.map +1 -1
- package/dist/slider/slider-root.mjs +2 -0
- package/dist/slider/slider-root.mjs.map +1 -1
- package/dist/slider/slider-thumb.d.mts +32 -3
- package/dist/slider/slider-thumb.d.mts.map +1 -1
- package/dist/slider/slider-thumb.mjs +2 -0
- package/dist/slider/slider-thumb.mjs.map +1 -1
- package/dist/slider/slider-track.d.mts +17 -0
- package/dist/slider/slider-track.d.mts.map +1 -1
- package/dist/slider/slider-track.mjs +2 -0
- package/dist/slider/slider-track.mjs.map +1 -1
- package/dist/slider/slider-value.d.mts +11 -0
- package/dist/slider/slider-value.d.mts.map +1 -1
- package/dist/slider/slider-value.mjs +2 -0
- package/dist/slider/slider-value.mjs.map +1 -1
- package/dist/switch/switch.d.mts +23 -3
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +2 -0
- package/dist/switch/switch.mjs.map +1 -1
- package/dist/tabs/index.d.mts +2 -0
- package/dist/tabs/index.d.mts.map +1 -1
- package/dist/tabs/index.mjs +2 -0
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/tabs/tabs-context.d.mts +5 -0
- package/dist/tabs/tabs-context.d.mts.map +1 -1
- package/dist/tabs/tabs-context.mjs.map +1 -1
- package/dist/tabs/tabs-indicator.d.mts +17 -0
- package/dist/tabs/tabs-indicator.d.mts.map +1 -1
- package/dist/tabs/tabs-indicator.mjs +2 -0
- package/dist/tabs/tabs-indicator.mjs.map +1 -1
- package/dist/tabs/tabs-list.d.mts +19 -1
- package/dist/tabs/tabs-list.d.mts.map +1 -1
- package/dist/tabs/tabs-list.mjs +2 -0
- package/dist/tabs/tabs-list.mjs.map +1 -1
- package/dist/tabs/tabs-panel.d.mts +19 -0
- package/dist/tabs/tabs-panel.d.mts.map +1 -1
- package/dist/tabs/tabs-panel.mjs +2 -0
- package/dist/tabs/tabs-panel.mjs.map +1 -1
- package/dist/tabs/tabs-root.d.mts +39 -5
- package/dist/tabs/tabs-root.d.mts.map +1 -1
- package/dist/tabs/tabs-root.mjs +2 -0
- package/dist/tabs/tabs-root.mjs.map +1 -1
- package/dist/tabs/tabs-tab.d.mts +22 -1
- package/dist/tabs/tabs-tab.d.mts.map +1 -1
- package/dist/tabs/tabs-tab.mjs +2 -0
- package/dist/tabs/tabs-tab.mjs.map +1 -1
- package/dist/toast/index.d.mts +2 -0
- package/dist/toast/index.d.mts.map +1 -1
- package/dist/toast/index.mjs +2 -0
- package/dist/toast/index.mjs.map +1 -1
- package/dist/toast/toast-action.d.mts +28 -3
- package/dist/toast/toast-action.d.mts.map +1 -1
- package/dist/toast/toast-action.mjs +2 -0
- package/dist/toast/toast-action.mjs.map +1 -1
- package/dist/toast/toast-close.d.mts +16 -0
- package/dist/toast/toast-close.d.mts.map +1 -1
- package/dist/toast/toast-close.mjs +2 -0
- package/dist/toast/toast-close.mjs.map +1 -1
- package/dist/toast/toast-description.d.mts +16 -1
- package/dist/toast/toast-description.d.mts.map +1 -1
- package/dist/toast/toast-description.mjs +2 -0
- package/dist/toast/toast-description.mjs.map +1 -1
- package/dist/toast/toast-root.d.mts +20 -0
- package/dist/toast/toast-root.d.mts.map +1 -1
- package/dist/toast/toast-root.mjs +2 -0
- package/dist/toast/toast-root.mjs.map +1 -1
- package/dist/toast/toast-title.d.mts +15 -1
- package/dist/toast/toast-title.d.mts.map +1 -1
- package/dist/toast/toast-title.mjs +2 -0
- package/dist/toast/toast-title.mjs.map +1 -1
- package/dist/toast/toast-viewport.d.mts +34 -5
- package/dist/toast/toast-viewport.d.mts.map +1 -1
- package/dist/toast/toast-viewport.mjs +2 -0
- package/dist/toast/toast-viewport.mjs.map +1 -1
- package/dist/toast/toast.d.mts +46 -6
- package/dist/toast/toast.d.mts.map +1 -1
- package/dist/toast/toast.mjs +4 -0
- package/dist/toast/toast.mjs.map +1 -1
- package/dist/toggle/toggle.d.mts +20 -2
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +2 -0
- package/dist/toggle/toggle.mjs.map +1 -1
- package/dist/toggle-group/index.d.mts +2 -0
- package/dist/toggle-group/index.d.mts.map +1 -1
- package/dist/toggle-group/index.mjs +2 -0
- package/dist/toggle-group/index.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-context.d.mts +1 -0
- package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-item.d.mts +16 -0
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-item.mjs +2 -0
- package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-root.d.mts +73 -12
- package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-root.mjs +2 -0
- package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
- package/dist/toolbar/index.d.mts +2 -0
- package/dist/toolbar/index.d.mts.map +1 -1
- package/dist/toolbar/index.mjs +2 -0
- package/dist/toolbar/index.mjs.map +1 -1
- package/dist/toolbar/toolbar-root.d.mts +30 -3
- package/dist/toolbar/toolbar-root.d.mts.map +1 -1
- package/dist/toolbar/toolbar-root.mjs +2 -0
- package/dist/toolbar/toolbar-root.mjs.map +1 -1
- package/dist/toolbar/toolbar-separator.d.mts +13 -0
- package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
- package/dist/toolbar/toolbar-separator.mjs +2 -0
- package/dist/toolbar/toolbar-separator.mjs.map +1 -1
- package/dist/tooltip/index.d.mts +2 -0
- package/dist/tooltip/index.d.mts.map +1 -1
- package/dist/tooltip/index.mjs +2 -0
- package/dist/tooltip/index.mjs.map +1 -1
- package/dist/tooltip/tooltip-arrow.d.mts +16 -0
- package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
- package/dist/tooltip/tooltip-arrow.mjs +2 -0
- package/dist/tooltip/tooltip-arrow.mjs.map +1 -1
- package/dist/tooltip/tooltip-context.d.mts +4 -0
- package/dist/tooltip/tooltip-context.d.mts.map +1 -1
- package/dist/tooltip/tooltip-context.mjs.map +1 -1
- package/dist/tooltip/tooltip-popup.d.mts +24 -3
- package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
- package/dist/tooltip/tooltip-popup.mjs +2 -0
- package/dist/tooltip/tooltip-popup.mjs.map +1 -1
- package/dist/tooltip/tooltip-root.d.mts +24 -2
- package/dist/tooltip/tooltip-root.d.mts.map +1 -1
- package/dist/tooltip/tooltip-root.mjs +2 -0
- package/dist/tooltip/tooltip-root.mjs.map +1 -1
- package/dist/tooltip/tooltip-trigger.d.mts +18 -1
- package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +2 -0
- package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
- package/package.json +9 -1
- package/skills/funstack-ui-knowledge/SKILL.md +75 -0
|
@@ -33,6 +33,7 @@ export interface ComboboxOpenChangeDetails extends ActionDetails {
|
|
|
33
33
|
*/
|
|
34
34
|
readonly reason: ChangeReason;
|
|
35
35
|
}
|
|
36
|
+
/** State of `Combobox.Root`, passed to the function forms of `announce` and `children`. */
|
|
36
37
|
export interface ComboboxRootState {
|
|
37
38
|
/** Optimistic selection. Content rendered from it must not suspend. */
|
|
38
39
|
readonly value: string | null;
|
|
@@ -48,12 +49,22 @@ export interface ComboboxRootState {
|
|
|
48
49
|
readonly open: boolean;
|
|
49
50
|
/** A `valueChangeAction` or `openChangeAction` dispatched through this Combobox is in flight. */
|
|
50
51
|
readonly pending: boolean;
|
|
52
|
+
/** The `disabled` prop, or the enclosing Field's. */
|
|
51
53
|
readonly disabled: boolean;
|
|
52
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Props of `Combobox.Root`.
|
|
57
|
+
*
|
|
58
|
+
* @see https://ui.funstack.work/components/combobox
|
|
59
|
+
*/
|
|
53
60
|
export interface ComboboxRootProps {
|
|
54
61
|
/** Controlled selection. `null`: nothing selected. `undefined`: uncontrolled. */
|
|
55
62
|
value?: string | null;
|
|
56
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Initial selection in uncontrolled mode.
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue `null`
|
|
67
|
+
*/
|
|
57
68
|
defaultValue?: string | null;
|
|
58
69
|
/**
|
|
59
70
|
* Runs inside the Root's transition when the user accepts an option, commits free text
|
|
@@ -66,8 +77,10 @@ export interface ComboboxRootProps {
|
|
|
66
77
|
/** Controlled input text. `undefined`: uncontrolled. */
|
|
67
78
|
inputValue?: string;
|
|
68
79
|
/**
|
|
69
|
-
* Initial input text.
|
|
80
|
+
* Initial input text. Pass the selected value's label when `defaultValue` is
|
|
70
81
|
* set: the library never derives the text from the value.
|
|
82
|
+
*
|
|
83
|
+
* @defaultValue `""`
|
|
71
84
|
*/
|
|
72
85
|
defaultInputValue?: string;
|
|
73
86
|
/**
|
|
@@ -81,7 +94,11 @@ export interface ComboboxRootProps {
|
|
|
81
94
|
onInputValueChange?: UrgentChangeHandler<string, ComboboxInputValueChangeDetails>;
|
|
82
95
|
/** Controlled open state. `undefined`: uncontrolled. */
|
|
83
96
|
open?: boolean;
|
|
84
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Initial open state when uncontrolled. Opens after hydration.
|
|
99
|
+
*
|
|
100
|
+
* @defaultValue `false`
|
|
101
|
+
*/
|
|
85
102
|
defaultOpen?: boolean;
|
|
86
103
|
/**
|
|
87
104
|
* Awaited for opens and for the close after an accepted option (or the Trigger); a
|
|
@@ -91,32 +108,50 @@ export interface ComboboxRootProps {
|
|
|
91
108
|
/**
|
|
92
109
|
* Free text is a value: Enter with no active option, or focus leaving with text that is not
|
|
93
110
|
* the selected option's label, dispatches the text with `details.custom: true` (empty text
|
|
94
|
-
* dispatches `null`).
|
|
95
|
-
*
|
|
111
|
+
* dispatches `null`). When `false`, unmatched text reverts to the selection's label when focus
|
|
112
|
+
* leaves.
|
|
113
|
+
*
|
|
114
|
+
* @defaultValue `false`
|
|
96
115
|
*/
|
|
97
116
|
allowCustomValue?: boolean;
|
|
98
117
|
/**
|
|
99
118
|
* Make the first enabled option active when the results for an open or an edit settle (APG
|
|
100
|
-
* "automatic selection"). Stale results are never highlighted.
|
|
119
|
+
* "automatic selection"). Stale results are never highlighted.
|
|
120
|
+
*
|
|
121
|
+
* @defaultValue `false`
|
|
101
122
|
*/
|
|
102
123
|
autoHighlight?: boolean;
|
|
103
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* Open the listbox on a pointer click in the input (not on focus).
|
|
126
|
+
*
|
|
127
|
+
* @defaultValue `false`
|
|
128
|
+
*/
|
|
104
129
|
openOnClick?: boolean;
|
|
105
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Wrap from the last option to the first and back with the arrow keys.
|
|
132
|
+
*
|
|
133
|
+
* @defaultValue `false`
|
|
134
|
+
*/
|
|
106
135
|
loop?: boolean;
|
|
107
136
|
/**
|
|
108
137
|
* The message `ariaNotify()` announces on the List when the results settle, from the number
|
|
109
|
-
* of mounted options.
|
|
110
|
-
*
|
|
111
|
-
*
|
|
138
|
+
* of mounted options. Override for localisation or a richer message; return `null` to announce
|
|
139
|
+
* nothing. Ignored where `ariaNotify` is missing.
|
|
140
|
+
*
|
|
141
|
+
* @defaultValue English: `"No results"`, `"1 result"`, `"N results"`
|
|
112
142
|
*/
|
|
113
143
|
announce?: (count: number, state: ComboboxRootState) => string | null;
|
|
114
144
|
/** Form participation through a hidden input with this name (value `""` for `null`). */
|
|
115
145
|
name?: string;
|
|
116
146
|
/** The `form` attribute of the hidden input. */
|
|
117
147
|
form?: string;
|
|
118
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Disables the Input, Trigger and Clear; nothing dispatches for user interaction.
|
|
150
|
+
*
|
|
151
|
+
* @defaultValue `false`
|
|
152
|
+
*/
|
|
119
153
|
disabled?: boolean;
|
|
154
|
+
/** The parts, or a function of the Root's state. */
|
|
120
155
|
children?: StateValue<ReactNode, ComboboxRootState>;
|
|
121
156
|
}
|
|
122
157
|
/**
|
|
@@ -127,6 +162,8 @@ export interface ComboboxRootProps {
|
|
|
127
162
|
* urgent virtual focus (`aria-activedescendant`); the listbox is a `popover="auto"` opened by the
|
|
128
163
|
* library with the input as `source`. Renders no DOM, except one `<input type="hidden">` when
|
|
129
164
|
* `name` is given.
|
|
165
|
+
*
|
|
166
|
+
* @see https://ui.funstack.work/components/combobox
|
|
130
167
|
*/
|
|
131
168
|
export declare function ComboboxRoot(props: ComboboxRootProps): import("react").JSX.Element;
|
|
132
169
|
export declare namespace ComboboxRoot {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-root.d.mts","names":[],"sources":["../../src/combobox/combobox-root.tsx"],"mappings":";;;;iBAyCiB,mCAAmC;;;;;;;WAOzC,QAAQ;;WAER;;;iBAIM,wCAAwC;;;;;;;WAO9C,QAAQ;;;iBAIF,kCAAkC;;;;;;;WAOxC,QAAQ;;
|
|
1
|
+
{"version":3,"file":"combobox-root.d.mts","names":[],"sources":["../../src/combobox/combobox-root.tsx"],"mappings":";;;;iBAyCiB,mCAAmC;;;;;;;WAOzC,QAAQ;;WAER;;;iBAIM,wCAAwC;;;;;;;WAO9C,QAAQ;;;iBAIF,kCAAkC;;;;;;;WAOxC,QAAQ;;;iBAIF;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;;iBAQM;;EAEf;;;;;;EAMA;;;;;;;;EAQA,oBAAoB,4BAA4B;;EAGhD;;;;;;;EAOA;;;;;;;;;EASA,qBAAqB,4BAA4B;;EAGjD;;;;;;EAMA;;;;;EAKA,mBAAmB,sBAAsB;;;;;;;;;EAUzC;;;;;;;EAOA;;;;;;EAMA;;;;;;EAMA;;;;;;;;EAQA,YAAY,eAAe,OAAO;;EAGlC;;EAEA;;;;;;EAMA;;EAEA,WAAW,WAAW,WAAW;;;;;;;;;;;;;wBAoDnB,aAAa,OAAO,oCAAiB,IAAA;yBAArC"}
|
|
@@ -38,6 +38,8 @@ function isThenable(value) {
|
|
|
38
38
|
* urgent virtual focus (`aria-activedescendant`); the listbox is a `popover="auto"` opened by the
|
|
39
39
|
* library with the input as `source`. Renders no DOM, except one `<input type="hidden">` when
|
|
40
40
|
* `name` is given.
|
|
41
|
+
*
|
|
42
|
+
* @see https://ui.funstack.work/components/combobox
|
|
41
43
|
*/
|
|
42
44
|
function ComboboxRoot(props) {
|
|
43
45
|
const { value, defaultValue, valueChangeAction, inputValue: inputValueProp, defaultInputValue, open, defaultOpen, openChangeAction, allowCustomValue = false, autoHighlight = false, openOnClick = false, loop = false, form, children } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-root.mjs","names":[],"sources":["../../src/combobox/combobox-root.tsx"],"sourcesContent":["\"use client\";\nimport {\n use,\n useCallback,\n useDeferredValue,\n useEffect,\n useId,\n useInsertionEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ReactNode } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { announce, canAnnounce } from \"../internal/announce.js\";\nimport { FieldContext } from \"../internal/field-context.js\";\nimport { isPopoverOpen } from \"../internal/popover-open.js\";\nimport { capturePointer } from \"../internal/pointer-capture.js\";\nimport { useFieldValueChange } from \"../internal/use-field-control.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n StateValue,\n UrgentChangeHandler,\n} from \"../internal/types.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { popoverDetails, useOverlayRoot } from \"../internal/use-overlay-root.js\";\nimport { resolveStateValue } from \"../internal/use-render.js\";\nimport { ComboboxContext } from \"./combobox-context.js\";\nimport { useComboboxForm } from \"./use-combobox-form.js\";\nimport { useDeferredLeave } from \"./use-deferred-leave.js\";\nimport { useOptionRegistry } from \"./use-option-registry.js\";\nimport type { ComboboxContextValue } from \"./combobox-context.js\";\n\n/** Details passed as the second argument of `Combobox.Root`'s `valueChangeAction`. */\nexport interface ComboboxValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user accepted an option (Enter, click; `details.event` is the `keydown` or\n * `click`), committed free text with `allowCustomValue` (Enter: the `keydown`; focus leaving:\n * the `focusout`), or pressed Clear (`click`).\n * `\"platform\"`: a form reset (`details.event` is the `reset` event).\n */\n readonly reason: ChangeReason;\n /** `true` when `next` is free text committed under `allowCustomValue`, not an option's value. */\n readonly custom: boolean;\n}\n\n/** Details passed as the second argument of `Combobox.Root`'s `onInputValueChange`. */\nexport interface ComboboxInputValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: typing (the `input` event), an accepted option's label, Clear.\n * `\"dismiss\"`: a revert: focus left with unmatched text, or the selection rolled back.\n * `\"platform\"`: form reset (the `reset` event), or text found in the input at mount\n * (`undefined`).\n */\n readonly reason: ChangeReason;\n}\n\n/** Details passed as the second argument of `Combobox.Root`'s `openChangeAction`. */\nexport interface ComboboxOpenChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: typing, ArrowDown / ArrowUp / Alt+ArrowDown, the Trigger, a click on the input\n * with `openOnClick`, an accepted option (the close after it), a foreign `showPopover()`.\n * `\"dismiss\"`: Escape, light dismiss, focus leaving the combobox, another top-layer element.\n * `\"platform\"`: the popup was found open on mount (only script can cause it).\n */\n readonly reason: ChangeReason;\n}\n\nexport interface ComboboxRootState {\n /** Optimistic selection. Content rendered from it must not suspend. */\n readonly value: string | null;\n /** The text in the input (urgent). */\n readonly inputValue: string;\n /** The deferred text the mounted results are for. */\n readonly query: string;\n /** `inputValue !== query`: the results shown are for an older text. */\n readonly stale: boolean;\n /** The value of the option `aria-activedescendant` points at, or `null`. */\n readonly activeValue: string | null;\n /** Optimistic open state. */\n readonly open: boolean;\n /** A `valueChangeAction` or `openChangeAction` dispatched through this Combobox is in flight. */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface ComboboxRootProps {\n /** Controlled selection. `null`: nothing selected. `undefined`: uncontrolled. */\n value?: string | null;\n /** Initial selection in uncontrolled mode. Default `null`. */\n defaultValue?: string | null;\n /**\n * Runs inside the Root's transition when the user accepts an option, commits free text\n * (`allowCustomValue`), presses Clear, or the form resets. Awaited; the listbox closes in the\n * commit that ends it; a rejection rolls the input text and `data-selected` back and leaves\n * the listbox open. May be a Server Function. A `setState` after your own `await` needs\n * `startTransition`.\n */\n valueChangeAction?: ChangeAction<string | null, ComboboxValueChangeDetails>;\n\n /** Controlled input text. `undefined`: uncontrolled. */\n inputValue?: string;\n /**\n * Initial input text. Default `\"\"`. Pass the selected value's label when `defaultValue` is\n * set: the library never derives the text from the value.\n */\n defaultInputValue?: string;\n /**\n * The urgent lane, a handler and not an action: called synchronously, outside any Transition,\n * on every change of the text (typing, and the library's own writes: an accepted option's\n * label, a revert, Clear, a form reset, text typed before hydration). Not awaited; nothing is\n * pending for it. A controlled parent updates its state in the body (an urgent update, which is\n * what a controlled text input needs). A returned promise is ignored (development warns once: a\n * fetch belongs in a transition).\n */\n onInputValueChange?: UrgentChangeHandler<string, ComboboxInputValueChangeDetails>;\n\n /** Controlled open state. `undefined`: uncontrolled. */\n open?: boolean;\n /** Initial open state when uncontrolled. Opens after hydration. */\n defaultOpen?: boolean;\n /**\n * Awaited for opens and for the close after an accepted option (or the Trigger); a\n * notification for dismissals (Escape, a click outside, focus leaving).\n */\n openChangeAction?: ChangeAction<boolean, ComboboxOpenChangeDetails>;\n\n /**\n * Free text is a value: Enter with no active option, or focus leaving with text that is not\n * the selected option's label, dispatches the text with `details.custom: true` (empty text\n * dispatches `null`). Default `false`: unmatched text reverts to the selection's label when\n * focus leaves.\n */\n allowCustomValue?: boolean;\n /**\n * Make the first enabled option active when the results for an open or an edit settle (APG\n * \"automatic selection\"). Stale results are never highlighted. Default `false`.\n */\n autoHighlight?: boolean;\n /** Open the listbox on a pointer click in the input (not on focus). Default `false`. */\n openOnClick?: boolean;\n /** Wrap from the last option to the first and back with the arrow keys. Default `false`. */\n loop?: boolean;\n /**\n * The message `ariaNotify()` announces on the List when the results settle, from the number\n * of mounted options. Default (English): `\"No results\"`, `\"1 result\"`, `\"N results\"`. Override\n * for localisation or a richer message; return `null` to announce nothing. Ignored where\n * `ariaNotify` is missing.\n */\n announce?: (count: number, state: ComboboxRootState) => string | null;\n\n /** Form participation through a hidden input with this name (value `\"\"` for `null`). */\n name?: string;\n /** The `form` attribute of the hidden input. */\n form?: string;\n /** Disables the Input, Trigger and Clear; nothing dispatches for user interaction. */\n disabled?: boolean;\n children?: StateValue<ReactNode, ComboboxRootState>;\n}\n\n/** The default announcement (design 6.4; conventions 11: English, always overridable). */\nfunction defaultComboboxAnnouncement(count: number): string {\n if (count === 0) return \"No results\";\n if (count === 1) return \"1 result\";\n return `${count} results`;\n}\n\nconst VALUE_TRANSITION_TYPES = transitionTypes(\"combobox\", \"select\");\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nfunction isThenable(value: unknown): boolean {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { then?: unknown }).then === \"function\"\n );\n}\n\n/** What a value dispatch carries for the Root's own follow-up (by `details` identity). */\ninterface DispatchMeta {\n readonly id: number;\n /** The open this dispatch belongs to (Popover 3.4): a newer open drops the close. */\n readonly generation: number;\n /** Close the listbox once the action settled (an accepted option, Enter on free text). */\n readonly close: boolean;\n /** The text the library wrote with the dispatch: typing since then keeps the listbox open. */\n readonly text: string | undefined;\n}\n\n/** The text the library wrote for a user dispatch, reverted if the value does not land. */\ninterface TextRecord {\n readonly id: number;\n readonly value: string | null;\n readonly text: string;\n settled: boolean;\n}\n\n/**\n * Owns the two states of a combobox (design/components/combobox.md 2): the selection (`value`,\n * a transition with `useOptimistic`, like every other value) and the text (`inputValue`, the\n * library's **urgent** lane: the `onInputValueChange` handler is called synchronously, outside\n * any transition). The results render from `useDeferredValue(inputValue)`; the active option is\n * urgent virtual focus (`aria-activedescendant`); the listbox is a `popover=\"auto\"` opened by the\n * library with the input as `source`. Renders no DOM, except one `<input type=\"hidden\">` when\n * `name` is given.\n */\nexport function ComboboxRoot(props: ComboboxRootProps) {\n const {\n value,\n defaultValue,\n valueChangeAction,\n inputValue: inputValueProp,\n defaultInputValue,\n open,\n defaultOpen,\n openChangeAction,\n allowCustomValue = false,\n autoHighlight = false,\n openOnClick = false,\n loop = false,\n form,\n children,\n } = props;\n\n // Inside a Field.Root (design/components/field-form.md 7.2): the Input is the Field's control\n // (its id is the Field's, so `Field.Label` points at it), the hidden input's `name` and\n // `disabled` default from the Field, and the List is named by `Field.Label` when no\n // `Combobox.Label` is mounted.\n const field = use(FieldContext);\n const name = props.name ?? field?.name;\n const disabled = (props.disabled ?? false) || (field?.disabled ?? false);\n const fieldControlId = field?.ids.control;\n\n const id = useId();\n const ids = useMemo(\n () => ({\n input: fieldControlId ?? `${id}-input`,\n label: `${id}-label`,\n list: `${id}-list`,\n optionPrefix: `${id}-option-`,\n }),\n [id, fieldControlId],\n );\n\n const popover = useOverlayRoot<ComboboxOpenChangeDetails>({\n component: \"combobox\",\n part: \"Combobox.Root\",\n mode: \"library\",\n open,\n defaultOpen,\n openChangeAction,\n details: popoverDetails,\n });\n\n // --- Refs the handlers read after an `await` or from a timer ------------------------------\n\n const propsRef = useLatest(props);\n const popoverRef = useLatest(popover);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const listRef = useRef<HTMLElement | null>(null);\n const hiddenRef = useRef<HTMLInputElement | null>(null);\n\n // --- Text: the urgent lane (design 4) ------------------------------------------------------\n\n const [internalText, setInternalText] = useState(() => defaultInputValue ?? inputValueProp ?? \"\");\n const text = inputValueProp ?? internalText;\n const query = useDeferredValue(text);\n const stale = text !== query;\n const textRef = useRef(text);\n useInsertionEffect(() => {\n textRef.current = text;\n });\n\n const warnedThenable = useRef(false);\n /** Writes the text (urgent) and calls `onInputValueChange` synchronously (design 2.2). */\n const writeText = useCallback(\n (next: string, reason: ChangeReason, event: Event | undefined): void => {\n const latest = propsRef.current;\n if (latest.inputValue === undefined) setInternalText(next);\n textRef.current = next;\n const handler = latest.onInputValueChange;\n if (handler === undefined) return;\n const result: unknown = handler(next, createActionDetails(event, { reason }));\n if (isDev && !warnedThenable.current && isThenable(result)) {\n warnedThenable.current = true;\n console.error(\n \"Combobox.Root: `onInputValueChange` returned a promise. It is the urgent lane: it is \" +\n \"not awaited. Fetch in a transition instead (`valueChangeAction`, or \" +\n \"`useDeferredValue` of `inputValue`).\",\n );\n }\n },\n [propsRef],\n );\n\n // --- Labels (design 2.3) -------------------------------------------------------------------\n\n const [labels] = useState(() => {\n const map = new Map<string, string>();\n const initialValue = value !== undefined ? value : (defaultValue ?? null);\n if (initialValue !== null) map.set(initialValue, defaultInputValue ?? inputValueProp ?? \"\");\n return map;\n });\n const labelFor = useCallback(\n (v: string | null): string => (v === null ? \"\" : (labels.get(v) ?? \"\")),\n [labels],\n );\n\n // --- Selection: a transition (design 3.1, 5.2) --------------------------------------------\n\n const dispatchSeq = useRef(0);\n const [dispatchMeta] = useState(() => new WeakMap<object, DispatchMeta>());\n const textRecord = useRef<TextRecord | null>(null);\n\n const runValueAction = async (\n next: string | null,\n details: ComboboxValueChangeDetails,\n ): Promise<void> => {\n const meta = dispatchMeta.get(details);\n try {\n await valueChangeAction?.(next, details);\n } catch (error) {\n // Walkthrough 4: the text rolls back with the optimistic value. A synchronous throw lands\n // here inside the Root's `startTransition` callback; yield once so the write (and the\n // consumer's `onInputValueChange`) is urgent, as every text write (conventions 2.6).\n await undefined;\n const record = textRecord.current;\n if (meta !== undefined && record !== null && record.id === meta.id) {\n textRecord.current = null;\n if (textRef.current === record.text) {\n writeText(labelFor(committedRef.current), \"dismiss\", undefined);\n }\n }\n throw error;\n }\n const record = textRecord.current;\n if (meta !== undefined && record !== null && record.id === meta.id) record.settled = true;\n // Menu decision 3: close in the commit that ends the action, unless a newer dispatch took\n // over, the user dismissed and re-opened meanwhile, or the user is typing a new search.\n const current = popoverRef.current;\n if (\n meta !== undefined &&\n meta.close &&\n meta.id === dispatchSeq.current &&\n current.openGeneration() === meta.generation &&\n (meta.text === undefined || textRef.current === meta.text)\n ) {\n current.requestClose(details.event, \"activate\");\n }\n };\n\n const selection = useControllableAction<string | null, ComboboxValueChangeDetails>({\n controlled: value,\n defaultValue,\n initialValue: null,\n action: runValueAction,\n transitionTypes: () => VALUE_TRANSITION_TYPES,\n warn: { component: \"Combobox.Root\", prop: \"value\" },\n });\n // Read by `runValueAction` above, which only runs after a commit.\n const committedRef = useLatest(selection.committed);\n\n /** The next change of the optimistic selection comes from the user (a dispatch). */\n const userEdit = useRef(false);\n const dispatchValue = (\n next: string | null,\n event: Event | undefined,\n fields: { reason: ChangeReason; custom: boolean },\n options: { close: boolean; text: string | undefined },\n ): void => {\n const details = createActionDetails(event, fields);\n const dispatchId = ++dispatchSeq.current;\n dispatchMeta.set(details, {\n id: dispatchId,\n generation: popover.openGeneration(),\n close: options.close,\n text: options.text,\n });\n textRecord.current =\n options.text === undefined\n ? null\n : { id: dispatchId, value: next, text: options.text, settled: false };\n if (next !== selection.optimistic) userEdit.current = true;\n selection.dispatch(next, details);\n };\n\n // Inside a Field: React writes the hidden input with no `input` / `change` event, so the Field\n // is told after the commit (its `validate` reads the hidden input; a user's pick dismisses a\n // shown server error like typing would).\n useFieldValueChange(selection.optimistic, () => {\n const edit = userEdit.current;\n userEdit.current = false;\n return edit;\n });\n\n // --- Option registry and the active option (design 2, 6.5) --------------------------------\n\n const {\n registry,\n optionCount,\n statusCount,\n statusCountRef,\n labelCount,\n registerOption,\n registerStatus,\n registerLabel,\n orderedOptions,\n } = useOptionRegistry(labels);\n\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 // The edge to activate once the open has options (ArrowDown / ArrowUp while closed).\n const pendingEdge = useRef<\"first\" | \"last\" | null>(null);\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 const autoArmed = useRef(true);\n\n // A Status inside the List is a Suspense fallback: the results are loading (design 6.3).\n const loading = statusCount > 0;\n const empty = optionCount === 0 && !stale && !loading;\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()) pendingEdge.current = null;\n autoArmed.current = true;\n if (current !== null) setActive(null);\n return;\n }\n const enabled = orderedOptions().filter((option) => !option.disabled);\n let next = current;\n if (pendingEdge.current !== null && enabled.length > 0) {\n next = (pendingEdge.current === \"first\" ? enabled[0] : enabled.at(-1))!.value;\n pendingEdge.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 autoArmed.current = false;\n } else if (autoHighlight && autoArmed.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 autoArmed.current = false;\n }\n if (next !== current) setActive(next);\n });\n\n // The selection did not land (a controlled parent refused it, or the caught-inside variant of\n // a controlled parent): the text goes back to the committed value's label (design 2.2).\n // Labels for values set from outside are learnt from the text the consumer passed with them.\n const prevCommitted = useRef(selection.committed);\n useLayoutEffect(() => {\n const record = textRecord.current;\n if (\n record !== null &&\n record.settled &&\n !selection.pending &&\n selection.latestInFlight() === null\n ) {\n textRecord.current = null;\n if (selection.committed !== record.value && textRef.current === record.text) {\n writeText(labelFor(selection.committed), \"dismiss\", undefined);\n }\n }\n if (prevCommitted.current !== selection.committed) {\n prevCommitted.current = selection.committed;\n const committed = selection.committed;\n if (committed !== null && textRecord.current === null && !labels.has(committed)) {\n labels.set(committed, textRef.current);\n }\n }\n });\n\n // --- Announcements (design 6.4) -----------------------------------------------------------\n\n const state: ComboboxRootState = {\n value: selection.optimistic,\n inputValue: text,\n query,\n stale,\n activeValue,\n open: popover.optimistic,\n pending: selection.pending || popover.pending,\n disabled,\n };\n\n const lastAnnounced = useRef<string | null>(null);\n useEffect(() => {\n if (!popover.committed) {\n lastAnnounced.current = null;\n return;\n }\n if (stale || statusCountRef.current > 0) return;\n // The registry, not `optionCount`: a commit's passive effects can run before the re-render\n // that the Options' registration scheduled.\n const count = registry.size;\n const key = `${count}\\u0000${query}`;\n if (lastAnnounced.current === key) return;\n lastAnnounced.current = key;\n const list = listRef.current;\n if (list === null || !canAnnounce(list)) return;\n const compose = propsRef.current.announce ?? defaultComboboxAnnouncement;\n const message = compose(count, state);\n if (message !== null) announce(list, message);\n });\n\n // --- Form: hidden input, reset, mount reconciliation (design 11.1, walkthroughs 10 and 11) ---\n\n useComboboxForm({\n value,\n defaultValue,\n inputValue: inputValueProp,\n defaultInputValue,\n inputRef,\n hiddenRef,\n textRef,\n writeText,\n optimistic: selection.optimistic,\n resetValue: (next, event) =>\n dispatchValue(\n next,\n event,\n { reason: \"platform\", custom: false },\n { close: false, text: undefined },\n ),\n });\n\n const [missingText] = useState(\n () =>\n (value ?? defaultValue ?? null) !== null &&\n inputValueProp === undefined &&\n defaultInputValue === undefined,\n );\n useDevWarning(\n missingText,\n isDev &&\n \"Combobox.Root: `value` / `defaultValue` is set but neither `inputValue` nor \" +\n \"`defaultInputValue` is: the input will show no text for the selection. The library never \" +\n \"derives the text from the value; pass the selected option's label as well.\",\n );\n\n // --- Interaction (design 5, 8) -------------------------------------------------------------\n\n const accept = (optionValue: string, event: Event): void => {\n if (disabled) return;\n const entry = registry.get(optionValue);\n if (entry === undefined || entry.disabled) return;\n const label = entry.label ?? (entry.element.textContent ?? \"\").trim();\n labels.set(optionValue, label);\n pendingEdge.current = null;\n if (activeRef.current !== optionValue) setActive(optionValue);\n writeText(label, \"activate\", event);\n // Re-accepting the selected option dispatches nothing and closes (conventions 2.3 item 8).\n if (optionValue === selection.optimistic) {\n popover.requestClose(event, \"activate\");\n return;\n }\n dispatchValue(\n optionValue,\n event,\n { reason: \"activate\", custom: false },\n { close: true, text: label },\n );\n };\n\n /** Free text as the value (design 5.3). Returns whether it dispatched. */\n const commitText = (event: Event, close: boolean): boolean => {\n const current = selection.optimistic;\n const typed = textRef.current;\n if (typed === labelFor(current)) return false;\n const next = typed === \"\" ? null : typed;\n if (next === current) return false;\n if (next !== null) labels.set(next, typed);\n dispatchValue(\n next,\n event,\n { reason: \"activate\", custom: next !== null },\n { close, text: typed },\n );\n return true;\n };\n\n const clear = (event: Event): void => {\n if (disabled) return;\n if (textRef.current !== \"\") writeText(\"\", \"activate\", event);\n if (selection.optimistic !== null) {\n dispatchValue(null, event, { reason: \"activate\", custom: false }, { close: false, text: \"\" });\n }\n inputRef.current?.focus();\n };\n\n const typed = (next: string, event: Event): void => {\n if (disabled) return;\n writeText(next, \"activate\", event);\n pendingEdge.current = null;\n // APG: editing moves visual focus back to the input; `autoHighlight` picks the first option\n // again once the results for the new text settle.\n if (activeRef.current !== null) setActive(null);\n autoArmed.current = true;\n popover.requestOpen(event, \"activate\");\n };\n\n const move = (direction: 1 | -1): void => {\n const enabled = orderedOptions().filter((option) => !option.disabled);\n if (enabled.length === 0) return;\n const last = enabled.length - 1;\n const index = enabled.findIndex((option) => option.value === activeRef.current);\n let next: number;\n if (direction === 1) next = index < 0 ? 0 : index >= last ? (loop ? 0 : last) : index + 1;\n else next = index < 0 ? last : index <= 0 ? (loop ? last : 0) : index - 1;\n const target = enabled[next]!;\n setActive(target.value);\n if (typeof target.element.scrollIntoView === \"function\") {\n target.element.scrollIntoView({ block: \"nearest\" });\n }\n };\n\n const activeEnabled = (): string | null => {\n const current = activeRef.current;\n if (current === null) return null;\n const entry = registry.get(current);\n return entry !== undefined && !entry.disabled ? current : null;\n };\n\n const keyDown = (event: KeyboardEvent): boolean => {\n if (disabled || event.ctrlKey || event.metaKey) return false;\n // IME: the key belongs to the composition (Enter commits it, arrows pick a candidate).\n if (event.isComposing || event.keyCode === 229) return false;\n // What the user sees, not what is intended: right after Escape the platform has hidden the\n // popup but its `toggle` (and the library's notification) is still queued, and an open that\n // is still committing shows nothing yet. Enter must submit and arrows must open in both.\n const isOpen = isPopoverOpen(popover.popupRef.current);\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n if (event.altKey) {\n if (!isOpen) popover.requestOpen(event, \"activate\");\n } else if (!isOpen) {\n pendingEdge.current = \"first\";\n popover.requestOpen(event, \"activate\");\n } else {\n move(1);\n }\n return true;\n case \"ArrowUp\":\n event.preventDefault();\n if (event.altKey) {\n if (isOpen) {\n const active = activeEnabled();\n if (active !== null) accept(active, event);\n else popover.requestClose(event, \"activate\");\n }\n } else if (!isOpen) {\n pendingEdge.current = \"last\";\n popover.requestOpen(event, \"activate\");\n } else {\n move(-1);\n }\n return true;\n case \"Enter\": {\n if (isOpen) {\n // An open listbox means the user is choosing: never submit from here.\n event.preventDefault();\n const active = activeEnabled();\n if (active !== null) accept(active, event);\n else if (allowCustomValue && !commitText(event, true)) {\n popover.requestClose(event, \"activate\");\n }\n return true;\n }\n // Closed: not prevented, so a form still submits. The key's default action (implicit\n // submission) must see the optimistic hidden value: Firefox submits before React's\n // scheduled flush of the optimistic render, so it is flushed here (design 5.3).\n if (allowCustomValue) flushSync(() => commitText(event, false));\n return false;\n }\n case \"Home\":\n case \"End\":\n case \"ArrowLeft\":\n case \"ArrowRight\":\n // APG: the caret keys move visual focus to the input (not prevented: the caret moves).\n if (activeRef.current !== null) setActive(null);\n return false;\n default:\n return false;\n }\n };\n\n /** Focus has left the input and the popup (design 5.4). */\n const leave = (event: Event): void => {\n // `disabled`: nothing dispatches (disabling a focused input blurs it).\n if (disabled) return;\n const popup = popover.popupRef.current;\n if (popup !== null && isPopoverOpen(popup)) {\n popover.recordCloseIntent({ reason: \"dismiss\", event });\n popup.hidePopover();\n }\n pendingEdge.current = null;\n if (allowCustomValue) {\n commitText(event, false);\n return;\n }\n const label = labelFor(selection.optimistic);\n if (textRef.current !== label) writeText(label, \"dismiss\", event);\n };\n const { focusIn, focusOut } = useDeferredLeave({\n inputRef,\n popupRef: popover.popupRef,\n leave,\n });\n\n const inputClick = (event: MouseEvent): void => {\n if (disabled || !openOnClick) return;\n popover.requestOpen(event, \"activate\");\n };\n\n // A press on the field while the listbox is shown: `source` is no light-dismiss exemption, so\n // the release goes to the Popup, whose topmost clicked popover is the listbox itself (design\n // 5.4). Judged on `:popover-open`, not the intent: a press during a pending close must\n // not dismiss either. Primary button only (a right click keeps the field's own context menu).\n // The engine releases the capture after `pointerup`; the press tracking above still sees\n // the release on the document.\n const inputPointerDown = (event: PointerEvent): void => {\n if (disabled || event.button !== 0) return;\n const popup = popover.popupRef.current;\n if (popup !== null && isPopoverOpen(popup)) capturePointer(popup, event.pointerId);\n };\n\n const context: ComboboxContextValue = {\n popover,\n ids,\n value: selection.optimistic,\n valuePending: selection.pending,\n pending: state.pending,\n inputValue: text,\n query,\n stale,\n activeValue,\n empty,\n loading,\n hasLabel: labelCount > 0,\n fieldLabelId: field?.ids.label,\n disabled,\n inputRef,\n listRef,\n registerOption,\n registerStatus,\n registerLabel,\n setActive,\n accept,\n clear,\n typed,\n keyDown,\n focusIn,\n focusOut,\n inputClick,\n inputPointerDown,\n };\n\n return (\n <ComboboxContext value={context}>\n {name !== undefined && (\n <input\n ref={hiddenRef}\n type=\"hidden\"\n name={name}\n form={form}\n value={selection.optimistic ?? \"\"}\n />\n )}\n {resolveStateValue(children, state)}\n </ComboboxContext>\n );\n}\n\nComboboxRoot.displayName = \"ComboboxRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwKA,SAAS,4BAA4B,OAAuB;CAC1D,IAAI,UAAU,GAAG,OAAO;CACxB,IAAI,UAAU,GAAG,OAAO;CACxB,OAAO,GAAG,MAAM;AAClB;AAEA,MAAM,yBAAyB,gBAAgB,YAAY,QAAQ;AAEnE,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,SAAS,WAAW,OAAyB;CAC3C,OACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA6B,SAAS;AAElD;;;;;;;;;;AA8BA,SAAgB,aAAa,OAA0B;CACrD,MAAM,EACJ,OACA,cACA,mBACA,YAAY,gBACZ,mBACA,MACA,aACA,kBACA,mBAAmB,OACnB,gBAAgB,OAChB,cAAc,OACd,OAAO,OACP,MACA,aACE;CAMJ,MAAM,QAAQ,IAAI,YAAY;CAC9B,MAAM,OAAO,MAAM,QAAQ,OAAO;CAClC,MAAM,YAAY,MAAM,YAAY,WAAW,OAAO,YAAY;CAClE,MAAM,iBAAiB,OAAO,IAAI;CAElC,MAAM,KAAK,MAAM;CACjB,MAAM,MAAM,eACH;EACL,OAAO,kBAAkB,GAAG,GAAG;EAC/B,OAAO,GAAG,GAAG;EACb,MAAM,GAAG,GAAG;EACZ,cAAc,GAAG,GAAG;CACtB,IACA,C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,UAAU;EAC3C,IAAI,QAAQ,YAAY,OAAO,UAAU,OAAO,WAAW,KAAK;CAClE;CACA,MAAM,EAAE,SAAS,aAAa,iBAAiB;EAC7C;EACA,UAAU,QAAQ;EAClB;CACF,CAAC;CAED,MAAM,cAAc,UAA4B;EAC9C,IAAI,YAAY,CAAC,aAAa;EAC9B,QAAQ,YAAY,OAAO,UAAU;CACvC;CAQA,MAAM,oBAAoB,UAA8B;EACtD,IAAI,YAAY,MAAM,WAAW,GAAG;EACpC,MAAM,QAAQ,QAAQ,SAAS;EAC/B,IAAI,UAAU,QAAQ,cAAc,KAAK,GAAG,eAAe,OAAO,MAAM,SAAS;CACnF;CAEA,MAAM,UAAgC;EACpC;EACA;EACA,OAAO,UAAU;EACjB,cAAc,UAAU;EACxB,SAAS,MAAM;EACf,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA,UAAU,aAAa;EACvB,cAAc,OAAO,IAAI;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAEA,OACE,qBAAC,iBAAD;EAAiB,OAAO;EAAxB,UAAA,CACG,SAAS,KAAA,KACR,oBAAC,SAAD;GACE,KAAK;GACL,MAAK;GACC;GACA;GACN,OAAO,UAAU,cAAc;EAChC,CAAA,GAEF,kBAAkB,UAAU,KAAK,CACnB;;AAErB;AAEA,aAAa,cAAc"}
|
|
1
|
+
{"version":3,"file":"combobox-root.mjs","names":[],"sources":["../../src/combobox/combobox-root.tsx"],"sourcesContent":["\"use client\";\nimport {\n use,\n useCallback,\n useDeferredValue,\n useEffect,\n useId,\n useInsertionEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ReactNode } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { announce, canAnnounce } from \"../internal/announce.js\";\nimport { FieldContext } from \"../internal/field-context.js\";\nimport { isPopoverOpen } from \"../internal/popover-open.js\";\nimport { capturePointer } from \"../internal/pointer-capture.js\";\nimport { useFieldValueChange } from \"../internal/use-field-control.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n StateValue,\n UrgentChangeHandler,\n} from \"../internal/types.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { popoverDetails, useOverlayRoot } from \"../internal/use-overlay-root.js\";\nimport { resolveStateValue } from \"../internal/use-render.js\";\nimport { ComboboxContext } from \"./combobox-context.js\";\nimport { useComboboxForm } from \"./use-combobox-form.js\";\nimport { useDeferredLeave } from \"./use-deferred-leave.js\";\nimport { useOptionRegistry } from \"./use-option-registry.js\";\nimport type { ComboboxContextValue } from \"./combobox-context.js\";\n\n/** Details passed as the second argument of `Combobox.Root`'s `valueChangeAction`. */\nexport interface ComboboxValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user accepted an option (Enter, click; `details.event` is the `keydown` or\n * `click`), committed free text with `allowCustomValue` (Enter: the `keydown`; focus leaving:\n * the `focusout`), or pressed Clear (`click`).\n * `\"platform\"`: a form reset (`details.event` is the `reset` event).\n */\n readonly reason: ChangeReason;\n /** `true` when `next` is free text committed under `allowCustomValue`, not an option's value. */\n readonly custom: boolean;\n}\n\n/** Details passed as the second argument of `Combobox.Root`'s `onInputValueChange`. */\nexport interface ComboboxInputValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: typing (the `input` event), an accepted option's label, Clear.\n * `\"dismiss\"`: a revert: focus left with unmatched text, or the selection rolled back.\n * `\"platform\"`: form reset (the `reset` event), or text found in the input at mount\n * (`undefined`).\n */\n readonly reason: ChangeReason;\n}\n\n/** Details passed as the second argument of `Combobox.Root`'s `openChangeAction`. */\nexport interface ComboboxOpenChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: typing, ArrowDown / ArrowUp / Alt+ArrowDown, the Trigger, a click on the input\n * with `openOnClick`, an accepted option (the close after it), a foreign `showPopover()`.\n * `\"dismiss\"`: Escape, light dismiss, focus leaving the combobox, another top-layer element.\n * `\"platform\"`: the popup was found open on mount (only script can cause it).\n */\n readonly reason: ChangeReason;\n}\n\n/** State of `Combobox.Root`, passed to the function forms of `announce` and `children`. */\nexport interface ComboboxRootState {\n /** Optimistic selection. Content rendered from it must not suspend. */\n readonly value: string | null;\n /** The text in the input (urgent). */\n readonly inputValue: string;\n /** The deferred text the mounted results are for. */\n readonly query: string;\n /** `inputValue !== query`: the results shown are for an older text. */\n readonly stale: boolean;\n /** The value of the option `aria-activedescendant` points at, or `null`. */\n readonly activeValue: string | null;\n /** Optimistic open state. */\n readonly open: boolean;\n /** A `valueChangeAction` or `openChangeAction` dispatched through this Combobox is in flight. */\n readonly pending: boolean;\n /** The `disabled` prop, or the enclosing Field's. */\n readonly disabled: boolean;\n}\n\n/**\n * Props of `Combobox.Root`.\n *\n * @see https://ui.funstack.work/components/combobox\n */\nexport interface ComboboxRootProps {\n /** Controlled selection. `null`: nothing selected. `undefined`: uncontrolled. */\n value?: string | null;\n /**\n * Initial selection in uncontrolled mode.\n *\n * @defaultValue `null`\n */\n defaultValue?: string | null;\n /**\n * Runs inside the Root's transition when the user accepts an option, commits free text\n * (`allowCustomValue`), presses Clear, or the form resets. Awaited; the listbox closes in the\n * commit that ends it; a rejection rolls the input text and `data-selected` back and leaves\n * the listbox open. May be a Server Function. A `setState` after your own `await` needs\n * `startTransition`.\n */\n valueChangeAction?: ChangeAction<string | null, ComboboxValueChangeDetails>;\n\n /** Controlled input text. `undefined`: uncontrolled. */\n inputValue?: string;\n /**\n * Initial input text. Pass the selected value's label when `defaultValue` is\n * set: the library never derives the text from the value.\n *\n * @defaultValue `\"\"`\n */\n defaultInputValue?: string;\n /**\n * The urgent lane, a handler and not an action: called synchronously, outside any Transition,\n * on every change of the text (typing, and the library's own writes: an accepted option's\n * label, a revert, Clear, a form reset, text typed before hydration). Not awaited; nothing is\n * pending for it. A controlled parent updates its state in the body (an urgent update, which is\n * what a controlled text input needs). A returned promise is ignored (development warns once: a\n * fetch belongs in a transition).\n */\n onInputValueChange?: UrgentChangeHandler<string, ComboboxInputValueChangeDetails>;\n\n /** Controlled open state. `undefined`: uncontrolled. */\n open?: boolean;\n /**\n * Initial open state when uncontrolled. Opens after hydration.\n *\n * @defaultValue `false`\n */\n defaultOpen?: boolean;\n /**\n * Awaited for opens and for the close after an accepted option (or the Trigger); a\n * notification for dismissals (Escape, a click outside, focus leaving).\n */\n openChangeAction?: ChangeAction<boolean, ComboboxOpenChangeDetails>;\n\n /**\n * Free text is a value: Enter with no active option, or focus leaving with text that is not\n * the selected option's label, dispatches the text with `details.custom: true` (empty text\n * dispatches `null`). When `false`, unmatched text reverts to the selection's label when focus\n * leaves.\n *\n * @defaultValue `false`\n */\n allowCustomValue?: boolean;\n /**\n * Make the first enabled option active when the results for an open or an edit settle (APG\n * \"automatic selection\"). Stale results are never highlighted.\n *\n * @defaultValue `false`\n */\n autoHighlight?: boolean;\n /**\n * Open the listbox on a pointer click in the input (not on focus).\n *\n * @defaultValue `false`\n */\n openOnClick?: boolean;\n /**\n * Wrap from the last option to the first and back with the arrow keys.\n *\n * @defaultValue `false`\n */\n loop?: boolean;\n /**\n * The message `ariaNotify()` announces on the List when the results settle, from the number\n * of mounted options. Override for localisation or a richer message; return `null` to announce\n * nothing. Ignored where `ariaNotify` is missing.\n *\n * @defaultValue English: `\"No results\"`, `\"1 result\"`, `\"N results\"`\n */\n announce?: (count: number, state: ComboboxRootState) => string | null;\n\n /** Form participation through a hidden input with this name (value `\"\"` for `null`). */\n name?: string;\n /** The `form` attribute of the hidden input. */\n form?: string;\n /**\n * Disables the Input, Trigger and Clear; nothing dispatches for user interaction.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /** The parts, or a function of the Root's state. */\n children?: StateValue<ReactNode, ComboboxRootState>;\n}\n\n/** The default announcement (design 6.4; conventions 11: English, always overridable). */\nfunction defaultComboboxAnnouncement(count: number): string {\n if (count === 0) return \"No results\";\n if (count === 1) return \"1 result\";\n return `${count} results`;\n}\n\nconst VALUE_TRANSITION_TYPES = transitionTypes(\"combobox\", \"select\");\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nfunction isThenable(value: unknown): boolean {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { then?: unknown }).then === \"function\"\n );\n}\n\n/** What a value dispatch carries for the Root's own follow-up (by `details` identity). */\ninterface DispatchMeta {\n readonly id: number;\n /** The open this dispatch belongs to (Popover 3.4): a newer open drops the close. */\n readonly generation: number;\n /** Close the listbox once the action settled (an accepted option, Enter on free text). */\n readonly close: boolean;\n /** The text the library wrote with the dispatch: typing since then keeps the listbox open. */\n readonly text: string | undefined;\n}\n\n/** The text the library wrote for a user dispatch, reverted if the value does not land. */\ninterface TextRecord {\n readonly id: number;\n readonly value: string | null;\n readonly text: string;\n settled: boolean;\n}\n\n/**\n * Owns the two states of a combobox (design/components/combobox.md 2): the selection (`value`,\n * a transition with `useOptimistic`, like every other value) and the text (`inputValue`, the\n * library's **urgent** lane: the `onInputValueChange` handler is called synchronously, outside\n * any transition). The results render from `useDeferredValue(inputValue)`; the active option is\n * urgent virtual focus (`aria-activedescendant`); the listbox is a `popover=\"auto\"` opened by the\n * library with the input as `source`. Renders no DOM, except one `<input type=\"hidden\">` when\n * `name` is given.\n *\n * @see https://ui.funstack.work/components/combobox\n */\nexport function ComboboxRoot(props: ComboboxRootProps) {\n const {\n value,\n defaultValue,\n valueChangeAction,\n inputValue: inputValueProp,\n defaultInputValue,\n open,\n defaultOpen,\n openChangeAction,\n allowCustomValue = false,\n autoHighlight = false,\n openOnClick = false,\n loop = false,\n form,\n children,\n } = props;\n\n // Inside a Field.Root (design/components/field-form.md 7.2): the Input is the Field's control\n // (its id is the Field's, so `Field.Label` points at it), the hidden input's `name` and\n // `disabled` default from the Field, and the List is named by `Field.Label` when no\n // `Combobox.Label` is mounted.\n const field = use(FieldContext);\n const name = props.name ?? field?.name;\n const disabled = (props.disabled ?? false) || (field?.disabled ?? false);\n const fieldControlId = field?.ids.control;\n\n const id = useId();\n const ids = useMemo(\n () => ({\n input: fieldControlId ?? `${id}-input`,\n label: `${id}-label`,\n list: `${id}-list`,\n optionPrefix: `${id}-option-`,\n }),\n [id, fieldControlId],\n );\n\n const popover = useOverlayRoot<ComboboxOpenChangeDetails>({\n component: \"combobox\",\n part: \"Combobox.Root\",\n mode: \"library\",\n open,\n defaultOpen,\n openChangeAction,\n details: popoverDetails,\n });\n\n // --- Refs the handlers read after an `await` or from a timer ------------------------------\n\n const propsRef = useLatest(props);\n const popoverRef = useLatest(popover);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const listRef = useRef<HTMLElement | null>(null);\n const hiddenRef = useRef<HTMLInputElement | null>(null);\n\n // --- Text: the urgent lane (design 4) ------------------------------------------------------\n\n const [internalText, setInternalText] = useState(() => defaultInputValue ?? inputValueProp ?? \"\");\n const text = inputValueProp ?? internalText;\n const query = useDeferredValue(text);\n const stale = text !== query;\n const textRef = useRef(text);\n useInsertionEffect(() => {\n textRef.current = text;\n });\n\n const warnedThenable = useRef(false);\n /** Writes the text (urgent) and calls `onInputValueChange` synchronously (design 2.2). */\n const writeText = useCallback(\n (next: string, reason: ChangeReason, event: Event | undefined): void => {\n const latest = propsRef.current;\n if (latest.inputValue === undefined) setInternalText(next);\n textRef.current = next;\n const handler = latest.onInputValueChange;\n if (handler === undefined) return;\n const result: unknown = handler(next, createActionDetails(event, { reason }));\n if (isDev && !warnedThenable.current && isThenable(result)) {\n warnedThenable.current = true;\n console.error(\n \"Combobox.Root: `onInputValueChange` returned a promise. It is the urgent lane: it is \" +\n \"not awaited. Fetch in a transition instead (`valueChangeAction`, or \" +\n \"`useDeferredValue` of `inputValue`).\",\n );\n }\n },\n [propsRef],\n );\n\n // --- Labels (design 2.3) -------------------------------------------------------------------\n\n const [labels] = useState(() => {\n const map = new Map<string, string>();\n const initialValue = value !== undefined ? value : (defaultValue ?? null);\n if (initialValue !== null) map.set(initialValue, defaultInputValue ?? inputValueProp ?? \"\");\n return map;\n });\n const labelFor = useCallback(\n (v: string | null): string => (v === null ? \"\" : (labels.get(v) ?? \"\")),\n [labels],\n );\n\n // --- Selection: a transition (design 3.1, 5.2) --------------------------------------------\n\n const dispatchSeq = useRef(0);\n const [dispatchMeta] = useState(() => new WeakMap<object, DispatchMeta>());\n const textRecord = useRef<TextRecord | null>(null);\n\n const runValueAction = async (\n next: string | null,\n details: ComboboxValueChangeDetails,\n ): Promise<void> => {\n const meta = dispatchMeta.get(details);\n try {\n await valueChangeAction?.(next, details);\n } catch (error) {\n // Walkthrough 4: the text rolls back with the optimistic value. A synchronous throw lands\n // here inside the Root's `startTransition` callback; yield once so the write (and the\n // consumer's `onInputValueChange`) is urgent, as every text write (conventions 2.6).\n await undefined;\n const record = textRecord.current;\n if (meta !== undefined && record !== null && record.id === meta.id) {\n textRecord.current = null;\n if (textRef.current === record.text) {\n writeText(labelFor(committedRef.current), \"dismiss\", undefined);\n }\n }\n throw error;\n }\n const record = textRecord.current;\n if (meta !== undefined && record !== null && record.id === meta.id) record.settled = true;\n // Menu decision 3: close in the commit that ends the action, unless a newer dispatch took\n // over, the user dismissed and re-opened meanwhile, or the user is typing a new search.\n const current = popoverRef.current;\n if (\n meta !== undefined &&\n meta.close &&\n meta.id === dispatchSeq.current &&\n current.openGeneration() === meta.generation &&\n (meta.text === undefined || textRef.current === meta.text)\n ) {\n current.requestClose(details.event, \"activate\");\n }\n };\n\n const selection = useControllableAction<string | null, ComboboxValueChangeDetails>({\n controlled: value,\n defaultValue,\n initialValue: null,\n action: runValueAction,\n transitionTypes: () => VALUE_TRANSITION_TYPES,\n warn: { component: \"Combobox.Root\", prop: \"value\" },\n });\n // Read by `runValueAction` above, which only runs after a commit.\n const committedRef = useLatest(selection.committed);\n\n /** The next change of the optimistic selection comes from the user (a dispatch). */\n const userEdit = useRef(false);\n const dispatchValue = (\n next: string | null,\n event: Event | undefined,\n fields: { reason: ChangeReason; custom: boolean },\n options: { close: boolean; text: string | undefined },\n ): void => {\n const details = createActionDetails(event, fields);\n const dispatchId = ++dispatchSeq.current;\n dispatchMeta.set(details, {\n id: dispatchId,\n generation: popover.openGeneration(),\n close: options.close,\n text: options.text,\n });\n textRecord.current =\n options.text === undefined\n ? null\n : { id: dispatchId, value: next, text: options.text, settled: false };\n if (next !== selection.optimistic) userEdit.current = true;\n selection.dispatch(next, details);\n };\n\n // Inside a Field: React writes the hidden input with no `input` / `change` event, so the Field\n // is told after the commit (its `validate` reads the hidden input; a user's pick dismisses a\n // shown server error like typing would).\n useFieldValueChange(selection.optimistic, () => {\n const edit = userEdit.current;\n userEdit.current = false;\n return edit;\n });\n\n // --- Option registry and the active option (design 2, 6.5) --------------------------------\n\n const {\n registry,\n optionCount,\n statusCount,\n statusCountRef,\n labelCount,\n registerOption,\n registerStatus,\n registerLabel,\n orderedOptions,\n } = useOptionRegistry(labels);\n\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 // The edge to activate once the open has options (ArrowDown / ArrowUp while closed).\n const pendingEdge = useRef<\"first\" | \"last\" | null>(null);\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 const autoArmed = useRef(true);\n\n // A Status inside the List is a Suspense fallback: the results are loading (design 6.3).\n const loading = statusCount > 0;\n const empty = optionCount === 0 && !stale && !loading;\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()) pendingEdge.current = null;\n autoArmed.current = true;\n if (current !== null) setActive(null);\n return;\n }\n const enabled = orderedOptions().filter((option) => !option.disabled);\n let next = current;\n if (pendingEdge.current !== null && enabled.length > 0) {\n next = (pendingEdge.current === \"first\" ? enabled[0] : enabled.at(-1))!.value;\n pendingEdge.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 autoArmed.current = false;\n } else if (autoHighlight && autoArmed.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 autoArmed.current = false;\n }\n if (next !== current) setActive(next);\n });\n\n // The selection did not land (a controlled parent refused it, or the caught-inside variant of\n // a controlled parent): the text goes back to the committed value's label (design 2.2).\n // Labels for values set from outside are learnt from the text the consumer passed with them.\n const prevCommitted = useRef(selection.committed);\n useLayoutEffect(() => {\n const record = textRecord.current;\n if (\n record !== null &&\n record.settled &&\n !selection.pending &&\n selection.latestInFlight() === null\n ) {\n textRecord.current = null;\n if (selection.committed !== record.value && textRef.current === record.text) {\n writeText(labelFor(selection.committed), \"dismiss\", undefined);\n }\n }\n if (prevCommitted.current !== selection.committed) {\n prevCommitted.current = selection.committed;\n const committed = selection.committed;\n if (committed !== null && textRecord.current === null && !labels.has(committed)) {\n labels.set(committed, textRef.current);\n }\n }\n });\n\n // --- Announcements (design 6.4) -----------------------------------------------------------\n\n const state: ComboboxRootState = {\n value: selection.optimistic,\n inputValue: text,\n query,\n stale,\n activeValue,\n open: popover.optimistic,\n pending: selection.pending || popover.pending,\n disabled,\n };\n\n const lastAnnounced = useRef<string | null>(null);\n useEffect(() => {\n if (!popover.committed) {\n lastAnnounced.current = null;\n return;\n }\n if (stale || statusCountRef.current > 0) return;\n // The registry, not `optionCount`: a commit's passive effects can run before the re-render\n // that the Options' registration scheduled.\n const count = registry.size;\n const key = `${count}\\u0000${query}`;\n if (lastAnnounced.current === key) return;\n lastAnnounced.current = key;\n const list = listRef.current;\n if (list === null || !canAnnounce(list)) return;\n const compose = propsRef.current.announce ?? defaultComboboxAnnouncement;\n const message = compose(count, state);\n if (message !== null) announce(list, message);\n });\n\n // --- Form: hidden input, reset, mount reconciliation (design 11.1, walkthroughs 10 and 11) ---\n\n useComboboxForm({\n value,\n defaultValue,\n inputValue: inputValueProp,\n defaultInputValue,\n inputRef,\n hiddenRef,\n textRef,\n writeText,\n optimistic: selection.optimistic,\n resetValue: (next, event) =>\n dispatchValue(\n next,\n event,\n { reason: \"platform\", custom: false },\n { close: false, text: undefined },\n ),\n });\n\n const [missingText] = useState(\n () =>\n (value ?? defaultValue ?? null) !== null &&\n inputValueProp === undefined &&\n defaultInputValue === undefined,\n );\n useDevWarning(\n missingText,\n isDev &&\n \"Combobox.Root: `value` / `defaultValue` is set but neither `inputValue` nor \" +\n \"`defaultInputValue` is: the input will show no text for the selection. The library never \" +\n \"derives the text from the value; pass the selected option's label as well.\",\n );\n\n // --- Interaction (design 5, 8) -------------------------------------------------------------\n\n const accept = (optionValue: string, event: Event): void => {\n if (disabled) return;\n const entry = registry.get(optionValue);\n if (entry === undefined || entry.disabled) return;\n const label = entry.label ?? (entry.element.textContent ?? \"\").trim();\n labels.set(optionValue, label);\n pendingEdge.current = null;\n if (activeRef.current !== optionValue) setActive(optionValue);\n writeText(label, \"activate\", event);\n // Re-accepting the selected option dispatches nothing and closes (conventions 2.3 item 8).\n if (optionValue === selection.optimistic) {\n popover.requestClose(event, \"activate\");\n return;\n }\n dispatchValue(\n optionValue,\n event,\n { reason: \"activate\", custom: false },\n { close: true, text: label },\n );\n };\n\n /** Free text as the value (design 5.3). Returns whether it dispatched. */\n const commitText = (event: Event, close: boolean): boolean => {\n const current = selection.optimistic;\n const typed = textRef.current;\n if (typed === labelFor(current)) return false;\n const next = typed === \"\" ? null : typed;\n if (next === current) return false;\n if (next !== null) labels.set(next, typed);\n dispatchValue(\n next,\n event,\n { reason: \"activate\", custom: next !== null },\n { close, text: typed },\n );\n return true;\n };\n\n const clear = (event: Event): void => {\n if (disabled) return;\n if (textRef.current !== \"\") writeText(\"\", \"activate\", event);\n if (selection.optimistic !== null) {\n dispatchValue(null, event, { reason: \"activate\", custom: false }, { close: false, text: \"\" });\n }\n inputRef.current?.focus();\n };\n\n const typed = (next: string, event: Event): void => {\n if (disabled) return;\n writeText(next, \"activate\", event);\n pendingEdge.current = null;\n // APG: editing moves visual focus back to the input; `autoHighlight` picks the first option\n // again once the results for the new text settle.\n if (activeRef.current !== null) setActive(null);\n autoArmed.current = true;\n popover.requestOpen(event, \"activate\");\n };\n\n const move = (direction: 1 | -1): void => {\n const enabled = orderedOptions().filter((option) => !option.disabled);\n if (enabled.length === 0) return;\n const last = enabled.length - 1;\n const index = enabled.findIndex((option) => option.value === activeRef.current);\n let next: number;\n if (direction === 1) next = index < 0 ? 0 : index >= last ? (loop ? 0 : last) : index + 1;\n else next = index < 0 ? last : index <= 0 ? (loop ? last : 0) : index - 1;\n const target = enabled[next]!;\n setActive(target.value);\n if (typeof target.element.scrollIntoView === \"function\") {\n target.element.scrollIntoView({ block: \"nearest\" });\n }\n };\n\n const activeEnabled = (): string | null => {\n const current = activeRef.current;\n if (current === null) return null;\n const entry = registry.get(current);\n return entry !== undefined && !entry.disabled ? current : null;\n };\n\n const keyDown = (event: KeyboardEvent): boolean => {\n if (disabled || event.ctrlKey || event.metaKey) return false;\n // IME: the key belongs to the composition (Enter commits it, arrows pick a candidate).\n if (event.isComposing || event.keyCode === 229) return false;\n // What the user sees, not what is intended: right after Escape the platform has hidden the\n // popup but its `toggle` (and the library's notification) is still queued, and an open that\n // is still committing shows nothing yet. Enter must submit and arrows must open in both.\n const isOpen = isPopoverOpen(popover.popupRef.current);\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n if (event.altKey) {\n if (!isOpen) popover.requestOpen(event, \"activate\");\n } else if (!isOpen) {\n pendingEdge.current = \"first\";\n popover.requestOpen(event, \"activate\");\n } else {\n move(1);\n }\n return true;\n case \"ArrowUp\":\n event.preventDefault();\n if (event.altKey) {\n if (isOpen) {\n const active = activeEnabled();\n if (active !== null) accept(active, event);\n else popover.requestClose(event, \"activate\");\n }\n } else if (!isOpen) {\n pendingEdge.current = \"last\";\n popover.requestOpen(event, \"activate\");\n } else {\n move(-1);\n }\n return true;\n case \"Enter\": {\n if (isOpen) {\n // An open listbox means the user is choosing: never submit from here.\n event.preventDefault();\n const active = activeEnabled();\n if (active !== null) accept(active, event);\n else if (allowCustomValue && !commitText(event, true)) {\n popover.requestClose(event, \"activate\");\n }\n return true;\n }\n // Closed: not prevented, so a form still submits. The key's default action (implicit\n // submission) must see the optimistic hidden value: Firefox submits before React's\n // scheduled flush of the optimistic render, so it is flushed here (design 5.3).\n if (allowCustomValue) flushSync(() => commitText(event, false));\n return false;\n }\n case \"Home\":\n case \"End\":\n case \"ArrowLeft\":\n case \"ArrowRight\":\n // APG: the caret keys move visual focus to the input (not prevented: the caret moves).\n if (activeRef.current !== null) setActive(null);\n return false;\n default:\n return false;\n }\n };\n\n /** Focus has left the input and the popup (design 5.4). */\n const leave = (event: Event): void => {\n // `disabled`: nothing dispatches (disabling a focused input blurs it).\n if (disabled) return;\n const popup = popover.popupRef.current;\n if (popup !== null && isPopoverOpen(popup)) {\n popover.recordCloseIntent({ reason: \"dismiss\", event });\n popup.hidePopover();\n }\n pendingEdge.current = null;\n if (allowCustomValue) {\n commitText(event, false);\n return;\n }\n const label = labelFor(selection.optimistic);\n if (textRef.current !== label) writeText(label, \"dismiss\", event);\n };\n const { focusIn, focusOut } = useDeferredLeave({\n inputRef,\n popupRef: popover.popupRef,\n leave,\n });\n\n const inputClick = (event: MouseEvent): void => {\n if (disabled || !openOnClick) return;\n popover.requestOpen(event, \"activate\");\n };\n\n // A press on the field while the listbox is shown: `source` is no light-dismiss exemption, so\n // the release goes to the Popup, whose topmost clicked popover is the listbox itself (design\n // 5.4). Judged on `:popover-open`, not the intent: a press during a pending close must\n // not dismiss either. Primary button only (a right click keeps the field's own context menu).\n // The engine releases the capture after `pointerup`; the press tracking above still sees\n // the release on the document.\n const inputPointerDown = (event: PointerEvent): void => {\n if (disabled || event.button !== 0) return;\n const popup = popover.popupRef.current;\n if (popup !== null && isPopoverOpen(popup)) capturePointer(popup, event.pointerId);\n };\n\n const context: ComboboxContextValue = {\n popover,\n ids,\n value: selection.optimistic,\n valuePending: selection.pending,\n pending: state.pending,\n inputValue: text,\n query,\n stale,\n activeValue,\n empty,\n loading,\n hasLabel: labelCount > 0,\n fieldLabelId: field?.ids.label,\n disabled,\n inputRef,\n listRef,\n registerOption,\n registerStatus,\n registerLabel,\n setActive,\n accept,\n clear,\n typed,\n keyDown,\n focusIn,\n focusOut,\n inputClick,\n inputPointerDown,\n };\n\n return (\n <ComboboxContext value={context}>\n {name !== undefined && (\n <input\n ref={hiddenRef}\n type=\"hidden\"\n name={name}\n form={form}\n value={selection.optimistic ?? \"\"}\n />\n )}\n {resolveStateValue(children, state)}\n </ComboboxContext>\n );\n}\n\nComboboxRoot.displayName = \"ComboboxRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2MA,SAAS,4BAA4B,OAAuB;CAC1D,IAAI,UAAU,GAAG,OAAO;CACxB,IAAI,UAAU,GAAG,OAAO;CACxB,OAAO,GAAG,MAAM;AAClB;AAEA,MAAM,yBAAyB,gBAAgB,YAAY,QAAQ;AAEnE,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,SAAS,WAAW,OAAyB;CAC3C,OACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA6B,SAAS;AAElD;;;;;;;;;;;;AAgCA,SAAgB,aAAa,OAA0B;CACrD,MAAM,EACJ,OACA,cACA,mBACA,YAAY,gBACZ,mBACA,MACA,aACA,kBACA,mBAAmB,OACnB,gBAAgB,OAChB,cAAc,OACd,OAAO,OACP,MACA,aACE;CAMJ,MAAM,QAAQ,IAAI,YAAY;CAC9B,MAAM,OAAO,MAAM,QAAQ,OAAO;CAClC,MAAM,YAAY,MAAM,YAAY,WAAW,OAAO,YAAY;CAClE,M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K,GAAG;GAC1C,QAAQ,kBAAkB;IAAE,QAAQ;IAAW;GAAM,CAAC;GACtD,MAAM,YAAY;EACpB;EACA,YAAY,UAAU;EACtB,IAAI,kBAAkB;GACpB,WAAW,OAAO,KAAK;GACvB;EACF;EACA,MAAM,QAAQ,SAAS,UAAU,UAAU;EAC3C,IAAI,QAAQ,YAAY,OAAO,UAAU,OAAO,WAAW,KAAK;CAClE;CACA,MAAM,EAAE,SAAS,aAAa,iBAAiB;EAC7C;EACA,UAAU,QAAQ;EAClB;CACF,CAAC;CAED,MAAM,cAAc,UAA4B;EAC9C,IAAI,YAAY,CAAC,aAAa;EAC9B,QAAQ,YAAY,OAAO,UAAU;CACvC;CAQA,MAAM,oBAAoB,UAA8B;EACtD,IAAI,YAAY,MAAM,WAAW,GAAG;EACpC,MAAM,QAAQ,QAAQ,SAAS;EAC/B,IAAI,UAAU,QAAQ,cAAc,KAAK,GAAG,eAAe,OAAO,MAAM,SAAS;CACnF;CAEA,MAAM,UAAgC;EACpC;EACA;EACA,OAAO,UAAU;EACjB,cAAc,UAAU;EACxB,SAAS,MAAM;EACf,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA,UAAU,aAAa;EACvB,cAAc,OAAO,IAAI;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAEA,OACE,qBAAC,iBAAD;EAAiB,OAAO;EAAxB,UAAA,CACG,SAAS,KAAA,KACR,oBAAC,SAAD;GACE,KAAK;GACL,MAAK;GACC;GACA;GACN,OAAO,UAAU,cAAc;EAChC,CAAA,GAEF,kBAAkB,UAAU,KAAK,CACnB;;AAErB;AAEA,aAAa,cAAc"}
|
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
2
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
3
3
|
//#region src/combobox/combobox-trigger.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* State of `Combobox.Trigger`, passed to the function forms of `className`, `style`, `children` and
|
|
6
|
+
* `render`.
|
|
7
|
+
*/
|
|
4
8
|
export interface ComboboxTriggerState {
|
|
5
9
|
/** Optimistic open state. */
|
|
6
10
|
readonly open: boolean;
|
|
7
11
|
/** The open (or close) transition is in flight. */
|
|
8
12
|
readonly pending: boolean;
|
|
13
|
+
/** Disabled by its own prop or by the Root. */
|
|
9
14
|
readonly disabled: boolean;
|
|
10
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Props of `Combobox.Trigger`.
|
|
18
|
+
*
|
|
19
|
+
* @see https://ui.funstack.work/components/combobox
|
|
20
|
+
*/
|
|
11
21
|
export interface ComboboxTriggerProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "onPointerDown" | "onMouseDown" | "tabIndex" | "aria-expanded" | "aria-controls" | "commandfor" | "command" | "popoverTarget" | "popoverTargetAction" | "disabled" | "className" | "style" | "children"> {
|
|
12
22
|
/**
|
|
13
23
|
* Disables this button; the Root's `disabled` does too. Native `disabled` on a `<button>`; with
|
|
14
24
|
* a link or component `render`, `aria-disabled="true"` instead.
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue `false`
|
|
15
27
|
*/
|
|
16
28
|
disabled?: boolean;
|
|
29
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
17
30
|
className?: StateValue<string | undefined, ComboboxTriggerState>;
|
|
31
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
18
32
|
style?: StateValue<CSSProperties | undefined, ComboboxTriggerState>;
|
|
19
33
|
/** Rendered from optimistic state; must not suspend. */
|
|
20
34
|
children?: StateValue<ReactNode, ComboboxTriggerState>;
|
|
@@ -39,6 +53,8 @@ export interface ComboboxTriggerProps extends Omit<ComponentPropsWithRef<"button
|
|
|
39
53
|
* invoker), `onClick`, `onPointerDown`, `onMouseDown`, `data-open`, `data-pending`,
|
|
40
54
|
* `data-disabled`; `popoverTarget`, `popoverTargetAction`, `commandfor` and `command` (never
|
|
41
55
|
* written as props; omitted from the props type).
|
|
56
|
+
*
|
|
57
|
+
* @see https://ui.funstack.work/components/combobox
|
|
42
58
|
*/
|
|
43
59
|
export declare function ComboboxTrigger({ disabled: ownDisabled, className, style, children, render, ...rest }: ComboboxTriggerProps): ReactNode;
|
|
44
60
|
export declare namespace ComboboxTrigger {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-trigger.d.mts","names":[],"sources":["../../src/combobox/combobox-trigger.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"combobox-trigger.d.mts","names":[],"sources":["../../src/combobox/combobox-trigger.tsx"],"mappings":";;;;;;;iBAwBiB;;WAEN;;WAEA;;WAEA;;;;;;;iBAQM,6BAA6B,KAC5C;;;;;;;EAsBA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;wBAwBvC,kBACd,UAAU,aACV,WACA,OACA,UACA,WACG,QACF,uBAAoB;yBAPP"}
|
|
@@ -27,6 +27,8 @@ const isDev = process.env.NODE_ENV !== "production";
|
|
|
27
27
|
* invoker), `onClick`, `onPointerDown`, `onMouseDown`, `data-open`, `data-pending`,
|
|
28
28
|
* `data-disabled`; `popoverTarget`, `popoverTargetAction`, `commandfor` and `command` (never
|
|
29
29
|
* written as props; omitted from the props type).
|
|
30
|
+
*
|
|
31
|
+
* @see https://ui.funstack.work/components/combobox
|
|
30
32
|
*/
|
|
31
33
|
function ComboboxTrigger({ disabled: ownDisabled = false, className, style, children, render, ...rest }) {
|
|
32
34
|
const part = "Combobox.Trigger";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-trigger.mjs","names":[],"sources":["../../src/combobox/combobox-trigger.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n MouseEvent,\n PointerEvent,\n ReactNode,\n} from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { nonInvokerMessage, RESERVED_INVOKER_KEYS } from \"../internal/use-popover-trigger.js\";\nimport { BUTTON_NAME, useNameWarning } from \"../internal/use-name-warning.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { disabledButton, rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { useComboboxContext } from \"./combobox-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface ComboboxTriggerState {\n /** Optimistic open state. */\n readonly open: boolean;\n /** The open (or close) transition is in flight. */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface ComboboxTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n | \"onClick\"\n | \"onPointerDown\"\n | \"onMouseDown\"\n | \"tabIndex\"\n | \"aria-expanded\"\n | \"aria-controls\"\n | \"commandfor\"\n | \"command\"\n | \"popoverTarget\"\n | \"popoverTargetAction\"\n | \"disabled\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Disables this button; the Root's `disabled` does too. Native `disabled` on a `<button>`; with\n * a link or component `render`, `aria-disabled=\"true\"` instead.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, ComboboxTriggerState>;\n style?: StateValue<CSSProperties | undefined, ComboboxTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, ComboboxTriggerState>;\n /** Should render a `<button>`. */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ComboboxTriggerState>;\n}\n\n/**\n * The optional button that toggles the listbox: `<button type=\"button\" tabindex=\"-1\"\n * aria-controls>` (the APG keeps it out of the Tab sequence; the input is the one stop). A press\n * does not take focus from the input, and a click focuses the input. After hydration a `<button>`\n * also names the Popup as its invoker (`popovertarget`, written through the ref, never\n * server-rendered), so a press while the listbox is open is not a light dismiss and the click's\n * close is the only one (design 3.3), and the browser exposes the listbox's state on it: an\n * invoker renders no `aria-expanded`. A Trigger that is disabled and still focusable\n * (`aria-disabled` on a component `render`) is no invoker, like any other overlay Trigger: a press\n * on it while the listbox is shown is a light dismiss. A non-invoker renders `aria-expanded` from\n * the shown listbox. Every click is cancelled, so the toggle never runs: the listbox stays\n * anchored to the input (design 1).\n *\n * Owned keys: `type` (on a `<button>`), `tabIndex`, `disabled`, `aria-disabled` (link or\n * component `render`), `aria-expanded`, `aria-controls` (token-merged), `popovertarget` (while an\n * invoker), `onClick`, `onPointerDown`, `onMouseDown`, `data-open`, `data-pending`,\n * `data-disabled`; `popoverTarget`, `popoverTargetAction`, `commandfor` and `command` (never\n * written as props; omitted from the props type).\n */\nexport function ComboboxTrigger({\n disabled: ownDisabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: ComboboxTriggerProps) {\n const part = \"Combobox.Trigger\";\n const ctx = useComboboxContext(part);\n const { popover } = ctx;\n const disabled = ownDisabled || ctx.disabled;\n // Development check (design 9): an icon-only Trigger needs a name from the consumer.\n const checkName = useNameWarning(\n isDev && \"Combobox.Trigger: the button has no accessible name. Give it an `aria-label`.\",\n BUTTON_NAME,\n );\n const checkElement = useElementCheck(\n isDev &&\n ((element) =>\n element.tagName === \"BUTTON\"\n ? null\n : nonInvokerMessage(part, element.tagName.toLowerCase(), \"listbox\", \"listbox\")),\n );\n const popupId = popover.ids.popup;\n // Not an invoker while disabled and focusable (`aria-disabled`), as the other overlay Triggers.\n const { props: disabledProps, invoker } = disabledButton(render, disabled);\n // After hydration a `<button>` becomes the popup's invoker (design 3.3): the platform's\n // light dismiss exempts a press on an invoker of the open popover. Written here, not rendered,\n // so the server HTML has no `popovertarget` and a click before hydration opens nothing. A flip\n // of `invoker` re-runs the ref, which adds or removes the attribute.\n const ref = useCallback(\n (element: HTMLElement) => {\n checkName?.(element);\n checkElement?.(element);\n if (element.tagName !== \"BUTTON\" || !invoker) return () => {};\n element.setAttribute(\"popovertarget\", popupId);\n return () => {\n element.removeAttribute(\"popovertarget\");\n };\n },\n [checkName, checkElement, popupId, invoker],\n );\n\n const state: ComboboxTriggerState = {\n open: popover.optimistic,\n pending: popover.pending,\n disabled,\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n tabIndex: -1,\n ...disabledProps,\n // An invoker `<button>`: the browser exposes the listbox's state on it after hydration.\n // Otherwise: shown (the listbox is in the top layer); `data-open` is the optimistic one.\n \"aria-expanded\": invoker && rendersButton(render) ? undefined : popover.shown,\n \"aria-controls\": ctx.ids.list,\n // Owned: the ref writes `popovertarget` after hydration; a render element sets none of these.\n popoverTarget: undefined,\n ...RESERVED_INVOKER_KEYS,\n onPointerDown: (event: PointerEvent<HTMLButtonElement>) => {\n event.preventDefault();\n },\n onMouseDown: (event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n },\n onClick: (event: MouseEvent<HTMLButtonElement>) => {\n // Cancelled first, whatever follows: the popover toggle must never run (the library opens the\n // listbox anchored to the input), and a disabled link must not navigate either.\n event.preventDefault();\n if (disabled) return;\n const native = event.nativeEvent;\n if (popover.intended()) popover.requestClose(native, \"activate\");\n else popover.requestOpen(native, \"activate\");\n ctx.inputRef.current?.focus();\n },\n \"data-open\": dataAttr(popover.optimistic),\n \"data-pending\": dataAttr(popover.pending),\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, ComboboxTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref,\n });\n}\n\nComboboxTrigger.displayName = \"ComboboxTrigger\";\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,QAAQ,QAAQ,IAAI,aAAa
|
|
1
|
+
{"version":3,"file":"combobox-trigger.mjs","names":[],"sources":["../../src/combobox/combobox-trigger.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n MouseEvent,\n PointerEvent,\n ReactNode,\n} from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { nonInvokerMessage, RESERVED_INVOKER_KEYS } from \"../internal/use-popover-trigger.js\";\nimport { BUTTON_NAME, useNameWarning } from \"../internal/use-name-warning.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { disabledButton, rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { useComboboxContext } from \"./combobox-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * State of `Combobox.Trigger`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface ComboboxTriggerState {\n /** Optimistic open state. */\n readonly open: boolean;\n /** The open (or close) transition is in flight. */\n readonly pending: boolean;\n /** Disabled by its own prop or by the Root. */\n readonly disabled: boolean;\n}\n\n/**\n * Props of `Combobox.Trigger`.\n *\n * @see https://ui.funstack.work/components/combobox\n */\nexport interface ComboboxTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n | \"onClick\"\n | \"onPointerDown\"\n | \"onMouseDown\"\n | \"tabIndex\"\n | \"aria-expanded\"\n | \"aria-controls\"\n | \"commandfor\"\n | \"command\"\n | \"popoverTarget\"\n | \"popoverTargetAction\"\n | \"disabled\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Disables this button; the Root's `disabled` does too. Native `disabled` on a `<button>`; with\n * a link or component `render`, `aria-disabled=\"true\"` instead.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, ComboboxTriggerState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, ComboboxTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, ComboboxTriggerState>;\n /** Should render a `<button>`. */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ComboboxTriggerState>;\n}\n\n/**\n * The optional button that toggles the listbox: `<button type=\"button\" tabindex=\"-1\"\n * aria-controls>` (the APG keeps it out of the Tab sequence; the input is the one stop). A press\n * does not take focus from the input, and a click focuses the input. After hydration a `<button>`\n * also names the Popup as its invoker (`popovertarget`, written through the ref, never\n * server-rendered), so a press while the listbox is open is not a light dismiss and the click's\n * close is the only one (design 3.3), and the browser exposes the listbox's state on it: an\n * invoker renders no `aria-expanded`. A Trigger that is disabled and still focusable\n * (`aria-disabled` on a component `render`) is no invoker, like any other overlay Trigger: a press\n * on it while the listbox is shown is a light dismiss. A non-invoker renders `aria-expanded` from\n * the shown listbox. Every click is cancelled, so the toggle never runs: the listbox stays\n * anchored to the input (design 1).\n *\n * Owned keys: `type` (on a `<button>`), `tabIndex`, `disabled`, `aria-disabled` (link or\n * component `render`), `aria-expanded`, `aria-controls` (token-merged), `popovertarget` (while an\n * invoker), `onClick`, `onPointerDown`, `onMouseDown`, `data-open`, `data-pending`,\n * `data-disabled`; `popoverTarget`, `popoverTargetAction`, `commandfor` and `command` (never\n * written as props; omitted from the props type).\n *\n * @see https://ui.funstack.work/components/combobox\n */\nexport function ComboboxTrigger({\n disabled: ownDisabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: ComboboxTriggerProps) {\n const part = \"Combobox.Trigger\";\n const ctx = useComboboxContext(part);\n const { popover } = ctx;\n const disabled = ownDisabled || ctx.disabled;\n // Development check (design 9): an icon-only Trigger needs a name from the consumer.\n const checkName = useNameWarning(\n isDev && \"Combobox.Trigger: the button has no accessible name. Give it an `aria-label`.\",\n BUTTON_NAME,\n );\n const checkElement = useElementCheck(\n isDev &&\n ((element) =>\n element.tagName === \"BUTTON\"\n ? null\n : nonInvokerMessage(part, element.tagName.toLowerCase(), \"listbox\", \"listbox\")),\n );\n const popupId = popover.ids.popup;\n // Not an invoker while disabled and focusable (`aria-disabled`), as the other overlay Triggers.\n const { props: disabledProps, invoker } = disabledButton(render, disabled);\n // After hydration a `<button>` becomes the popup's invoker (design 3.3): the platform's\n // light dismiss exempts a press on an invoker of the open popover. Written here, not rendered,\n // so the server HTML has no `popovertarget` and a click before hydration opens nothing. A flip\n // of `invoker` re-runs the ref, which adds or removes the attribute.\n const ref = useCallback(\n (element: HTMLElement) => {\n checkName?.(element);\n checkElement?.(element);\n if (element.tagName !== \"BUTTON\" || !invoker) return () => {};\n element.setAttribute(\"popovertarget\", popupId);\n return () => {\n element.removeAttribute(\"popovertarget\");\n };\n },\n [checkName, checkElement, popupId, invoker],\n );\n\n const state: ComboboxTriggerState = {\n open: popover.optimistic,\n pending: popover.pending,\n disabled,\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n tabIndex: -1,\n ...disabledProps,\n // An invoker `<button>`: the browser exposes the listbox's state on it after hydration.\n // Otherwise: shown (the listbox is in the top layer); `data-open` is the optimistic one.\n \"aria-expanded\": invoker && rendersButton(render) ? undefined : popover.shown,\n \"aria-controls\": ctx.ids.list,\n // Owned: the ref writes `popovertarget` after hydration; a render element sets none of these.\n popoverTarget: undefined,\n ...RESERVED_INVOKER_KEYS,\n onPointerDown: (event: PointerEvent<HTMLButtonElement>) => {\n event.preventDefault();\n },\n onMouseDown: (event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n },\n onClick: (event: MouseEvent<HTMLButtonElement>) => {\n // Cancelled first, whatever follows: the popover toggle must never run (the library opens the\n // listbox anchored to the input), and a disabled link must not navigate either.\n event.preventDefault();\n if (disabled) return;\n const native = event.nativeEvent;\n if (popover.intended()) popover.requestClose(native, \"activate\");\n else popover.requestOpen(native, \"activate\");\n ctx.inputRef.current?.focus();\n },\n \"data-open\": dataAttr(popover.optimistic),\n \"data-pending\": dataAttr(popover.pending),\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, ComboboxTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref,\n });\n}\n\nComboboxTrigger.displayName = \"ComboboxTrigger\";\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;;;;;;;;;AA2EvC,SAAgB,gBAAgB,EAC9B,UAAU,cAAc,OACxB,WACA,OACA,UACA,QACA,GAAG,QACoB;CACvB,MAAM,OAAO;CACb,MAAM,MAAM,mBAAmB,IAAI;CACnC,MAAM,EAAE,YAAY;CACpB,MAAM,WAAW,eAAe,IAAI;CAEpC,MAAM,YAAY,eAChB,SAAS,iFACT,WACF;CACA,MAAM,eAAe,gBACnB,WACI,YACA,QAAQ,YAAY,WAChB,OACA,kBAAkB,MAAM,QAAQ,QAAQ,YAAY,GAAG,WAAW,SAAS,EACrF;CACA,MAAM,UAAU,QAAQ,IAAI;CAE5B,MAAM,EAAE,OAAO,eAAe,YAAY,eAAe,QAAQ,QAAQ;CAKzE,MAAM,MAAM,aACT,YAAyB;EACxB,YAAY,OAAO;EACnB,eAAe,OAAO;EACtB,IAAI,QAAQ,YAAY,YAAY,CAAC,SAAS,aAAa,CAAC;EAC5D,QAAQ,aAAa,iBAAiB,OAAO;EAC7C,aAAa;GACX,QAAQ,gBAAgB,eAAe;EACzC;CACF,GACA;EAAC;EAAW;EAAc;EAAS;CAAO,CAC5C;CAEA,MAAM,QAA8B;EAClC,MAAM,QAAQ;EACd,SAAS,QAAQ;EACjB;CACF;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EACvD,UAAU;EACV,GAAG;EAGH,iBAAiB,WAAW,cAAc,MAAM,IAAI,KAAA,IAAY,QAAQ;EACxE,iBAAiB,IAAI,IAAI;EAEzB,eAAe,KAAA;EACf,GAAG;EACH,gBAAgB,UAA2C;GACzD,MAAM,eAAe;EACvB;EACA,cAAc,UAAyC;GACrD,MAAM,eAAe;EACvB;EACA,UAAU,UAAyC;GAGjD,MAAM,eAAe;GACrB,IAAI,UAAU;GACd,MAAM,SAAS,MAAM;GACrB,IAAI,QAAQ,SAAS,GAAG,QAAQ,aAAa,QAAQ,UAAU;QAC1D,QAAQ,YAAY,QAAQ,UAAU;GAC3C,IAAI,SAAS,SAAS,MAAM;EAC9B;EACA,aAAa,SAAS,QAAQ,UAAU;EACxC,gBAAgB,SAAS,QAAQ,OAAO;EACxC,iBAAiB,SAAS,QAAQ;CACpC;CAEA,OAAO,UAAiE;EACtE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;CACF,CAAC;AACH;AAEA,gBAAgB,cAAc"}
|
|
@@ -16,6 +16,8 @@ import { ComboboxTrigger, ComboboxTriggerProps, ComboboxTriggerState } from "./c
|
|
|
16
16
|
* `GroupLabel`; `Empty` and `Status` in the Popup. Typing is urgent (the `onInputValueChange`
|
|
17
17
|
* handler, the library's urgent lane); the results render from the deferred `query`; accepting an
|
|
18
18
|
* option is a transition with `data-pending` on it, and the listbox closes when it settles.
|
|
19
|
+
*
|
|
20
|
+
* @see https://ui.funstack.work/components/combobox
|
|
19
21
|
*/
|
|
20
22
|
export declare const Combobox: {
|
|
21
23
|
readonly Root: typeof ComboboxRoot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/combobox/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/combobox/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;qBA4Ba;WACX,aAAI;WACJ,cAAK;WACL,cAAK;WACL,gBAAO;WACP,cAAK;WACL,cAAK;WACL,aAAI;WACJ,eAAM;WACN,cAAK;WACL,mBAAU;WACV,cAAK;WACL,eAAM"}
|
package/dist/combobox/index.mjs
CHANGED
|
@@ -15,6 +15,8 @@ import { ComboboxTrigger } from "./combobox-trigger.mjs";
|
|
|
15
15
|
* `GroupLabel`; `Empty` and `Status` in the Popup. Typing is urgent (the `onInputValueChange`
|
|
16
16
|
* handler, the library's urgent lane); the results render from the deferred `query`; accepting an
|
|
17
17
|
* option is a transition with `data-pending` on it, and the listbox closes when it settles.
|
|
18
|
+
*
|
|
19
|
+
* @see https://ui.funstack.work/components/combobox
|
|
18
20
|
*/
|
|
19
21
|
const Combobox = {
|
|
20
22
|
Root: ComboboxRoot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/combobox/index.ts"],"sourcesContent":["// Ships the platform attribute typings with this subpath (conventions 7.4). Type-only: the built\n// JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { ComboboxClear } from \"./combobox-clear.js\";\nimport {\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxGroupLabel,\n ComboboxStatus,\n} from \"./combobox-group.js\";\nimport { ComboboxInput } from \"./combobox-input.js\";\nimport { ComboboxLabel } from \"./combobox-label.js\";\nimport { ComboboxList } from \"./combobox-list.js\";\nimport { ComboboxOption } from \"./combobox-option.js\";\nimport { ComboboxPopup } from \"./combobox-popup.js\";\nimport { ComboboxRoot } from \"./combobox-root.js\";\nimport { ComboboxTrigger } from \"./combobox-trigger.js\";\n\n/**\n * Editable combobox with list autocomplete (WAI-ARIA APG) on `popover=\"auto\"`: `Root` (no DOM,\n * or one hidden input with `name`) > `Label`, `Input` (`input[role=combobox]`), `Trigger`,\n * `Clear`, `Popup` (`div[popover=auto]`) > `List` (`div[role=listbox]`) > `Option`, `Group` >\n * `GroupLabel`; `Empty` and `Status` in the Popup. Typing is urgent (the `onInputValueChange`\n * handler, the library's urgent lane); the results render from the deferred `query`; accepting an\n * option is a transition with `data-pending` on it, and the listbox closes when it settles.\n */\nexport const Combobox = {\n Root: ComboboxRoot,\n Label: ComboboxLabel,\n Input: ComboboxInput,\n Trigger: ComboboxTrigger,\n Clear: ComboboxClear,\n Popup: ComboboxPopup,\n List: ComboboxList,\n Option: ComboboxOption,\n Group: ComboboxGroup,\n GroupLabel: ComboboxGroupLabel,\n Empty: ComboboxEmpty,\n Status: ComboboxStatus,\n} as const;\n\nexport type {\n ComboboxRootProps,\n ComboboxRootState,\n ComboboxValueChangeDetails,\n ComboboxInputValueChangeDetails,\n ComboboxOpenChangeDetails,\n} from \"./combobox-root.js\";\nexport type { ComboboxLabelProps, ComboboxLabelState } from \"./combobox-label.js\";\nexport type { ComboboxInputProps, ComboboxInputState } from \"./combobox-input.js\";\nexport type { ComboboxTriggerProps, ComboboxTriggerState } from \"./combobox-trigger.js\";\nexport type { ComboboxClearProps, ComboboxClearState } from \"./combobox-clear.js\";\nexport type { ComboboxPopupProps, ComboboxPopupState } from \"./combobox-popup.js\";\nexport type { ComboboxListProps, ComboboxListState } from \"./combobox-list.js\";\nexport type { ComboboxOptionProps, ComboboxOptionState } from \"./combobox-option.js\";\nexport type {\n ComboboxGroupProps,\n ComboboxGroupState,\n ComboboxGroupLabelProps,\n ComboboxGroupLabelState,\n ComboboxEmptyProps,\n ComboboxEmptyState,\n ComboboxStatusProps,\n ComboboxStatusState,\n} from \"./combobox-group.js\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/combobox/index.ts"],"sourcesContent":["// Ships the platform attribute typings with this subpath (conventions 7.4). Type-only: the built\n// JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { ComboboxClear } from \"./combobox-clear.js\";\nimport {\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxGroupLabel,\n ComboboxStatus,\n} from \"./combobox-group.js\";\nimport { ComboboxInput } from \"./combobox-input.js\";\nimport { ComboboxLabel } from \"./combobox-label.js\";\nimport { ComboboxList } from \"./combobox-list.js\";\nimport { ComboboxOption } from \"./combobox-option.js\";\nimport { ComboboxPopup } from \"./combobox-popup.js\";\nimport { ComboboxRoot } from \"./combobox-root.js\";\nimport { ComboboxTrigger } from \"./combobox-trigger.js\";\n\n/**\n * Editable combobox with list autocomplete (WAI-ARIA APG) on `popover=\"auto\"`: `Root` (no DOM,\n * or one hidden input with `name`) > `Label`, `Input` (`input[role=combobox]`), `Trigger`,\n * `Clear`, `Popup` (`div[popover=auto]`) > `List` (`div[role=listbox]`) > `Option`, `Group` >\n * `GroupLabel`; `Empty` and `Status` in the Popup. Typing is urgent (the `onInputValueChange`\n * handler, the library's urgent lane); the results render from the deferred `query`; accepting an\n * option is a transition with `data-pending` on it, and the listbox closes when it settles.\n *\n * @see https://ui.funstack.work/components/combobox\n */\nexport const Combobox = {\n Root: ComboboxRoot,\n Label: ComboboxLabel,\n Input: ComboboxInput,\n Trigger: ComboboxTrigger,\n Clear: ComboboxClear,\n Popup: ComboboxPopup,\n List: ComboboxList,\n Option: ComboboxOption,\n Group: ComboboxGroup,\n GroupLabel: ComboboxGroupLabel,\n Empty: ComboboxEmpty,\n Status: ComboboxStatus,\n} as const;\n\nexport type {\n ComboboxRootProps,\n ComboboxRootState,\n ComboboxValueChangeDetails,\n ComboboxInputValueChangeDetails,\n ComboboxOpenChangeDetails,\n} from \"./combobox-root.js\";\nexport type { ComboboxLabelProps, ComboboxLabelState } from \"./combobox-label.js\";\nexport type { ComboboxInputProps, ComboboxInputState } from \"./combobox-input.js\";\nexport type { ComboboxTriggerProps, ComboboxTriggerState } from \"./combobox-trigger.js\";\nexport type { ComboboxClearProps, ComboboxClearState } from \"./combobox-clear.js\";\nexport type { ComboboxPopupProps, ComboboxPopupState } from \"./combobox-popup.js\";\nexport type { ComboboxListProps, ComboboxListState } from \"./combobox-list.js\";\nexport type { ComboboxOptionProps, ComboboxOptionState } from \"./combobox-option.js\";\nexport type {\n ComboboxGroupProps,\n ComboboxGroupState,\n ComboboxGroupLabelProps,\n ComboboxGroupLabelState,\n ComboboxEmptyProps,\n ComboboxEmptyState,\n ComboboxStatusProps,\n ComboboxStatusState,\n} from \"./combobox-group.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,WAAW;CACtB,MAAM;CACN,OAAO;CACP,OAAO;CACP,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,OAAO;CACP,QAAQ;AACV"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
//#region src/csp/csp-provider.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Props of `CSPProvider`.
|
|
5
|
+
*
|
|
6
|
+
* @see https://ui.funstack.work/concepts/content-security-policy
|
|
7
|
+
*/
|
|
3
8
|
export interface CSPProviderProps {
|
|
4
9
|
/**
|
|
5
10
|
* The per-response nonce of a nonce-based `style-src` policy. Pass the same value as React's
|
|
@@ -8,6 +13,7 @@ export interface CSPProviderProps {
|
|
|
8
13
|
* the `nonce` when the option is absent or in its string form.
|
|
9
14
|
*/
|
|
10
15
|
nonce?: string;
|
|
16
|
+
/** The tree whose library parts receive the nonce. */
|
|
11
17
|
children?: ReactNode;
|
|
12
18
|
}
|
|
13
19
|
/**
|
|
@@ -16,6 +22,8 @@ export interface CSPProviderProps {
|
|
|
16
22
|
* `experimental_interestFor`), which forward it as the element's `nonce` (design/conventions.md
|
|
17
23
|
* 12). The library's only provider; its prop is serialisable, so a Server Component layout that
|
|
18
24
|
* knows the nonce renders it once. Hash-based policies need no provider: use `STYLE_SHA256`.
|
|
25
|
+
*
|
|
26
|
+
* @see https://ui.funstack.work/concepts/content-security-policy
|
|
19
27
|
*/
|
|
20
28
|
export declare function CSPProvider({ nonce, children }: CSPProviderProps): import("react").JSX.Element;
|
|
21
29
|
export declare namespace CSPProvider {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csp-provider.d.mts","names":[],"sources":["../../src/csp/csp-provider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"csp-provider.d.mts","names":[],"sources":["../../src/csp/csp-provider.tsx"],"mappings":";;;;;;;iBAWiB;;;;;;;EAOf;;EAEA,WAAW;;;;;;;;;;;wBAYG,cAAc,OAAO,YAAY,mCAAgB,IAAA;yBAAjD"}
|
|
@@ -9,6 +9,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
9
9
|
* `experimental_interestFor`), which forward it as the element's `nonce` (design/conventions.md
|
|
10
10
|
* 12). The library's only provider; its prop is serialisable, so a Server Component layout that
|
|
11
11
|
* knows the nonce renders it once. Hash-based policies need no provider: use `STYLE_SHA256`.
|
|
12
|
+
*
|
|
13
|
+
* @see https://ui.funstack.work/concepts/content-security-policy
|
|
12
14
|
*/
|
|
13
15
|
function CSPProvider({ nonce, children }) {
|
|
14
16
|
const value = useMemo(() => ({ nonce }), [nonce]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csp-provider.mjs","names":[],"sources":["../../src/csp/csp-provider.tsx"],"sourcesContent":["\"use client\";\nimport { useMemo } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { CSPContext } from \"../internal/csp-context.js\";\nimport type { CSPContextValue } from \"../internal/csp-context.js\";\n\nexport interface CSPProviderProps {\n /**\n * The per-response nonce of a nonce-based `style-src` policy. Pass the same value as React's\n * `nonce: { style }` render option: during server rendering React drops a hoisted\n * `<style precedence>` whose `nonce` differs from it (a missing provider included), and strips\n * the `nonce` when the option is absent or in its string form.\n */\n nonce?: string;\n children?: ReactNode;\n}\n\n/**\n * Hands a Content Security Policy nonce to every library part that renders a hoisted `<style>`\n * (`Menu.Popup`'s point placement rules, `Tooltip.Trigger`'s skip-delay rule with\n * `experimental_interestFor`), which forward it as the element's `nonce` (design/conventions.md\n * 12). The library's only provider; its prop is serialisable, so a Server Component layout that\n * knows the nonce renders it once. Hash-based policies need no provider: use `STYLE_SHA256`.\n */\nexport function CSPProvider({ nonce, children }: CSPProviderProps) {\n const value = useMemo<CSPContextValue>(() => ({ nonce }), [nonce]);\n return <CSPContext value={value}>{children}</CSPContext>;\n}\n\nCSPProvider.displayName = \"CSPProvider\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"csp-provider.mjs","names":[],"sources":["../../src/csp/csp-provider.tsx"],"sourcesContent":["\"use client\";\nimport { useMemo } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { CSPContext } from \"../internal/csp-context.js\";\nimport type { CSPContextValue } from \"../internal/csp-context.js\";\n\n/**\n * Props of `CSPProvider`.\n *\n * @see https://ui.funstack.work/concepts/content-security-policy\n */\nexport interface CSPProviderProps {\n /**\n * The per-response nonce of a nonce-based `style-src` policy. Pass the same value as React's\n * `nonce: { style }` render option: during server rendering React drops a hoisted\n * `<style precedence>` whose `nonce` differs from it (a missing provider included), and strips\n * the `nonce` when the option is absent or in its string form.\n */\n nonce?: string;\n /** The tree whose library parts receive the nonce. */\n children?: ReactNode;\n}\n\n/**\n * Hands a Content Security Policy nonce to every library part that renders a hoisted `<style>`\n * (`Menu.Popup`'s point placement rules, `Tooltip.Trigger`'s skip-delay rule with\n * `experimental_interestFor`), which forward it as the element's `nonce` (design/conventions.md\n * 12). The library's only provider; its prop is serialisable, so a Server Component layout that\n * knows the nonce renders it once. Hash-based policies need no provider: use `STYLE_SHA256`.\n *\n * @see https://ui.funstack.work/concepts/content-security-policy\n */\nexport function CSPProvider({ nonce, children }: CSPProviderProps) {\n const value = useMemo<CSPContextValue>(() => ({ nonce }), [nonce]);\n return <CSPContext value={value}>{children}</CSPContext>;\n}\n\nCSPProvider.displayName = \"CSPProvider\";\n"],"mappings":";;;;;;;;;;;;;;AAgCA,SAAgB,YAAY,EAAE,OAAO,YAA8B;CACjE,MAAM,QAAQ,eAAgC,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC;CACjE,OAAO,oBAAC,YAAD;EAAmB;EAAQ;CAAqB,CAAA;AACzD;AAEA,YAAY,cAAc"}
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* A blocked stylesheet degrades: the point menu opens at the point but never flips, and on the
|
|
12
12
|
* native tooltip path each tooltip waits its own `delay` (no skip-delay).
|
|
13
|
+
*
|
|
14
|
+
* @see https://ui.funstack.work/concepts/content-security-policy
|
|
13
15
|
*/
|
|
14
16
|
export declare const STYLE_SHA256: {
|
|
15
17
|
readonly "@funstack/ui/menu-point": "Wm5aBRstuZ3S9kDs0IbldhidU/prqpIW69jEAS0N9mc=";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-hashes.d.mts","names":[],"sources":["../../src/csp/style-hashes.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"style-hashes.d.mts","names":[],"sources":["../../src/csp/style-hashes.ts"],"mappings":";;;;;;;;;;;;;;;qBAkBa;WACX;WACA"}
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* A blocked stylesheet degrades: the point menu opens at the point but never flips, and on the
|
|
12
12
|
* native tooltip path each tooltip waits its own `delay` (no skip-delay).
|
|
13
|
+
*
|
|
14
|
+
* @see https://ui.funstack.work/concepts/content-security-policy
|
|
13
15
|
*/
|
|
14
16
|
const STYLE_SHA256 = {
|
|
15
17
|
"@funstack/ui/menu-point": "Wm5aBRstuZ3S9kDs0IbldhidU/prqpIW69jEAS0N9mc=",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-hashes.mjs","names":[],"sources":["../../src/csp/style-hashes.ts"],"sourcesContent":["// The SHA-256 of every stylesheet the library ships (design/conventions.md 12), for hash-based\n// Content Security Policies. Committed constants: `csp.test.ts` recomputes them from the CSS\n// strings, so they cannot drift. No \"use client\" directive: data only (conventions 7.1).\n\n/**\n * The base64 SHA-256 of each shipped stylesheet, keyed by its `<style href>`. Allow them with\n * `style-src 'sha256-<value>'`:\n *\n * - `\"@funstack/ui/menu-point\"`: `Menu.Popup`'s `@position-try` rules for a menu opened at a\n * point (`Menu.ContextTrigger`), inserted on the client by the first such open.\n * - `\"@funstack/ui/tooltip-warm\"`: `Tooltip.Trigger`'s skip-delay rule, rendered only with\n * `experimental_interestFor` (during server rendering too).\n *\n * A blocked stylesheet degrades: the point menu opens at the point but never flips, and on the\n * native tooltip path each tooltip waits its own `delay` (no skip-delay).\n */\nexport const STYLE_SHA256 = {\n \"@funstack/ui/menu-point\": \"Wm5aBRstuZ3S9kDs0IbldhidU/prqpIW69jEAS0N9mc=\",\n \"@funstack/ui/tooltip-warm\": \"nFBZGhNvo46ITrlBb48hELUAyWzpeIdJCziCectFQa4=\",\n} as const;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"style-hashes.mjs","names":[],"sources":["../../src/csp/style-hashes.ts"],"sourcesContent":["// The SHA-256 of every stylesheet the library ships (design/conventions.md 12), for hash-based\n// Content Security Policies. Committed constants: `csp.test.ts` recomputes them from the CSS\n// strings, so they cannot drift. No \"use client\" directive: data only (conventions 7.1).\n\n/**\n * The base64 SHA-256 of each shipped stylesheet, keyed by its `<style href>`. Allow them with\n * `style-src 'sha256-<value>'`:\n *\n * - `\"@funstack/ui/menu-point\"`: `Menu.Popup`'s `@position-try` rules for a menu opened at a\n * point (`Menu.ContextTrigger`), inserted on the client by the first such open.\n * - `\"@funstack/ui/tooltip-warm\"`: `Tooltip.Trigger`'s skip-delay rule, rendered only with\n * `experimental_interestFor` (during server rendering too).\n *\n * A blocked stylesheet degrades: the point menu opens at the point but never flips, and on the\n * native tooltip path each tooltip waits its own `delay` (no skip-delay).\n *\n * @see https://ui.funstack.work/concepts/content-security-policy\n */\nexport const STYLE_SHA256 = {\n \"@funstack/ui/menu-point\": \"Wm5aBRstuZ3S9kDs0IbldhidU/prqpIW69jEAS0N9mc=\",\n \"@funstack/ui/tooltip-warm\": \"nFBZGhNvo46ITrlBb48hELUAyWzpeIdJCziCectFQa4=\",\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,eAAe;CAC1B,2BAA2B;CAC3B,6BAA6B;AAC/B"}
|