@funstack/ui 0.1.0-alpha.2 → 0.1.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -1
- package/dist/accordion/accordion-context.mjs.map +1 -1
- package/dist/accordion/accordion-item.d.mts +22 -4
- package/dist/accordion/accordion-item.d.mts.map +1 -1
- package/dist/accordion/accordion-item.mjs +32 -10
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.d.mts +19 -4
- package/dist/accordion/accordion-panel.d.mts.map +1 -1
- package/dist/accordion/accordion-panel.mjs +8 -6
- package/dist/accordion/accordion-panel.mjs.map +1 -1
- package/dist/accordion/accordion-root.d.mts +39 -5
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +75 -67
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.d.mts +12 -4
- package/dist/accordion/accordion-trigger.d.mts.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +14 -28
- package/dist/accordion/accordion-trigger.mjs.map +1 -1
- package/dist/accordion/index.d.mts +2 -0
- package/dist/accordion/index.d.mts.map +1 -1
- package/dist/accordion/index.mjs +2 -0
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/alert-dialog/alert-dialog-action.d.mts +73 -0
- package/dist/alert-dialog/alert-dialog-action.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-action.mjs +23 -0
- package/dist/alert-dialog/alert-dialog-action.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-cancel.d.mts +31 -0
- package/dist/alert-dialog/alert-dialog-cancel.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-cancel.mjs +50 -0
- package/dist/alert-dialog/alert-dialog-cancel.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-context.mjs +24 -0
- package/dist/alert-dialog/alert-dialog-context.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-description.d.mts +25 -0
- package/dist/alert-dialog/alert-dialog-description.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-description.mjs +20 -0
- package/dist/alert-dialog/alert-dialog-description.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-form.d.mts +27 -0
- package/dist/alert-dialog/alert-dialog-form.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-form.mjs +22 -0
- package/dist/alert-dialog/alert-dialog-form.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-popup.d.mts +42 -0
- package/dist/alert-dialog/alert-dialog-popup.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-popup.mjs +53 -0
- package/dist/alert-dialog/alert-dialog-popup.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-root.d.mts +31 -0
- package/dist/alert-dialog/alert-dialog-root.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-root.mjs +22 -0
- package/dist/alert-dialog/alert-dialog-root.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-title.d.mts +23 -0
- package/dist/alert-dialog/alert-dialog-title.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-title.mjs +18 -0
- package/dist/alert-dialog/alert-dialog-title.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-trigger.d.mts +23 -0
- package/dist/alert-dialog/alert-dialog-trigger.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-trigger.mjs +18 -0
- package/dist/alert-dialog/alert-dialog-trigger.mjs.map +1 -0
- package/dist/alert-dialog/index.d.mts +33 -0
- package/dist/alert-dialog/index.d.mts.map +1 -0
- package/dist/alert-dialog/index.mjs +33 -0
- package/dist/alert-dialog/index.mjs.map +1 -0
- package/dist/bin/skill-installer.d.mts +1 -0
- package/dist/bin/skill-installer.mjs +12 -0
- package/dist/bin/skill-installer.mjs.map +1 -0
- package/dist/button/button.d.mts +118 -0
- package/dist/button/button.d.mts.map +1 -0
- package/dist/button/button.mjs +98 -0
- package/dist/button/button.mjs.map +1 -0
- package/dist/button/index.d.mts +3 -0
- package/dist/button/index.mjs +1 -0
- package/dist/checkbox/checkbox.d.mts +32 -9
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +25 -50
- package/dist/checkbox/checkbox.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts +20 -5
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +25 -27
- package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.d.mts +10 -0
- package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.mjs +3 -6
- package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.d.mts +22 -5
- package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +17 -13
- package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +37 -7
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +102 -102
- package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
- package/dist/checkbox-group/index.d.mts +2 -0
- package/dist/checkbox-group/index.d.mts.map +1 -1
- package/dist/checkbox-group/index.mjs +2 -0
- package/dist/checkbox-group/index.mjs.map +1 -1
- package/dist/collapsible/collapsible-context.mjs +8 -0
- package/dist/collapsible/collapsible-context.mjs.map +1 -0
- package/dist/collapsible/collapsible-panel.d.mts +53 -0
- package/dist/collapsible/collapsible-panel.d.mts.map +1 -0
- package/dist/collapsible/collapsible-panel.mjs +41 -0
- package/dist/collapsible/collapsible-panel.mjs.map +1 -0
- package/dist/collapsible/collapsible-root.d.mts +108 -0
- package/dist/collapsible/collapsible-root.d.mts.map +1 -0
- package/dist/collapsible/collapsible-root.mjs +147 -0
- package/dist/collapsible/collapsible-root.mjs.map +1 -0
- package/dist/collapsible/collapsible-trigger.d.mts +45 -0
- package/dist/collapsible/collapsible-trigger.d.mts.map +1 -0
- package/dist/collapsible/collapsible-trigger.mjs +62 -0
- package/dist/collapsible/collapsible-trigger.mjs.map +1 -0
- package/dist/collapsible/index.d.mts +21 -0
- package/dist/collapsible/index.d.mts.map +1 -0
- package/dist/collapsible/index.mjs +21 -0
- package/dist/collapsible/index.mjs.map +1 -0
- package/dist/combobox/chip-text.mjs +24 -0
- package/dist/combobox/chip-text.mjs.map +1 -0
- package/dist/combobox/combobox-chips.d.mts +159 -0
- package/dist/combobox/combobox-chips.d.mts.map +1 -0
- package/dist/combobox/combobox-chips.mjs +198 -0
- package/dist/combobox/combobox-chips.mjs.map +1 -0
- package/dist/combobox/combobox-clear.d.mts +29 -5
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +17 -8
- package/dist/combobox/combobox-clear.mjs.map +1 -1
- package/dist/combobox/combobox-context.mjs +4 -5
- package/dist/combobox/combobox-context.mjs.map +1 -1
- package/dist/combobox/combobox-group.d.mts +49 -1
- package/dist/combobox/combobox-group.d.mts.map +1 -1
- package/dist/combobox/combobox-group.mjs +14 -3
- package/dist/combobox/combobox-group.mjs.map +1 -1
- package/dist/combobox/combobox-input.d.mts +27 -5
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +53 -13
- package/dist/combobox/combobox-input.mjs.map +1 -1
- package/dist/combobox/combobox-keyboard.mjs +127 -0
- package/dist/combobox/combobox-keyboard.mjs.map +1 -0
- package/dist/combobox/combobox-label.d.mts +18 -1
- package/dist/combobox/combobox-label.d.mts.map +1 -1
- package/dist/combobox/combobox-label.mjs +4 -1
- package/dist/combobox/combobox-label.mjs.map +1 -1
- package/dist/combobox/combobox-list.d.mts +15 -1
- package/dist/combobox/combobox-list.d.mts.map +1 -1
- package/dist/combobox/combobox-list.mjs +13 -13
- package/dist/combobox/combobox-list.mjs.map +1 -1
- package/dist/combobox/combobox-option.d.mts +30 -5
- package/dist/combobox/combobox-option.d.mts.map +1 -1
- package/dist/combobox/combobox-option.mjs +9 -5
- package/dist/combobox/combobox-option.mjs.map +1 -1
- package/dist/combobox/combobox-popup.d.mts +24 -3
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +24 -29
- package/dist/combobox/combobox-popup.mjs.map +1 -1
- package/dist/combobox/combobox-root.d.mts +183 -43
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +476 -270
- package/dist/combobox/combobox-root.mjs.map +1 -1
- package/dist/combobox/combobox-trigger.d.mts +36 -8
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +50 -41
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/combobox/index.d.mts +13 -5
- package/dist/combobox/index.d.mts.map +1 -1
- package/dist/combobox/index.mjs +13 -5
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/combobox/use-combobox-form.mjs +53 -0
- package/dist/combobox/use-combobox-form.mjs.map +1 -0
- package/dist/combobox/use-combobox-text.mjs +43 -0
- package/dist/combobox/use-combobox-text.mjs.map +1 -0
- package/dist/csp/csp-provider.d.mts +33 -0
- package/dist/csp/csp-provider.d.mts.map +1 -0
- package/dist/csp/csp-provider.mjs +26 -0
- package/dist/csp/csp-provider.mjs.map +1 -0
- package/dist/csp/index.d.mts +3 -0
- package/dist/csp/index.mjs +3 -0
- package/dist/csp/style-hashes.d.mts +21 -0
- package/dist/csp/style-hashes.d.mts.map +1 -0
- package/dist/csp/style-hashes.mjs +23 -0
- package/dist/csp/style-hashes.mjs.map +1 -0
- package/dist/dialog/dialog-close.d.mts +56 -12
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +52 -55
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-context.d.mts +2 -0
- package/dist/dialog/dialog-context.mjs +14 -2
- package/dist/dialog/dialog-context.mjs.map +1 -1
- package/dist/dialog/dialog-description.d.mts +14 -1
- package/dist/dialog/dialog-description.d.mts.map +1 -1
- package/dist/dialog/dialog-description.mjs +10 -4
- package/dist/dialog/dialog-description.mjs.map +1 -1
- package/dist/dialog/dialog-dismiss.mjs +108 -0
- package/dist/dialog/dialog-dismiss.mjs.map +1 -0
- package/dist/dialog/dialog-form.d.mts +43 -11
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +64 -37
- package/dist/dialog/dialog-form.mjs.map +1 -1
- package/dist/dialog/dialog-popup.d.mts +47 -14
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +167 -242
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts +54 -19
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +74 -92
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-title.d.mts +13 -1
- package/dist/dialog/dialog-title.d.mts.map +1 -1
- package/dist/dialog/dialog-title.mjs +10 -4
- package/dist/dialog/dialog-title.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +30 -6
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +50 -28
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/dialog/index.d.mts +7 -3
- package/dist/dialog/index.d.mts.map +1 -1
- package/dist/dialog/index.mjs +7 -3
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/docs/components/accordion.md +428 -0
- package/dist/docs/components/alert-dialog.md +546 -0
- package/dist/docs/components/button.md +511 -0
- package/dist/docs/components/checkbox-group.md +483 -0
- package/dist/docs/components/checkbox.md +373 -0
- package/dist/docs/components/collapsible.md +408 -0
- package/dist/docs/components/combobox.md +960 -0
- package/dist/docs/components/context-menu.md +524 -0
- package/dist/docs/components/dialog.md +694 -0
- package/dist/docs/components/field.md +765 -0
- package/dist/docs/components/hover-card.md +494 -0
- package/dist/docs/components/menu.md +670 -0
- package/dist/docs/components/meter.md +313 -0
- package/dist/docs/components/multi-select.md +622 -0
- package/dist/docs/components/number-field.md +528 -0
- package/dist/docs/components/popover.md +656 -0
- package/dist/docs/components/progress.md +450 -0
- package/dist/docs/components/radio-group.md +457 -0
- package/dist/docs/components/select.md +670 -0
- package/dist/docs/components/separator.md +182 -0
- package/dist/docs/components/slider.md +558 -0
- package/dist/docs/components/switch.md +311 -0
- package/dist/docs/components/tabs.md +473 -0
- package/dist/docs/components/toast.md +602 -0
- package/dist/docs/components/toggle-group.md +341 -0
- package/dist/docs/components/toggle.md +245 -0
- package/dist/docs/components/toolbar.md +390 -0
- package/dist/docs/components/tooltip.md +494 -0
- package/dist/docs/concepts/action-props.md +281 -0
- package/dist/docs/concepts/ai-agents.md +56 -0
- package/dist/docs/concepts/browser-owned-state.md +133 -0
- package/dist/docs/concepts/content-security-policy.md +69 -0
- package/dist/docs/concepts/experimental.md +36 -0
- package/dist/docs/concepts/pending-and-optimistic.md +263 -0
- package/dist/docs/concepts/render.md +23 -0
- package/dist/docs/concepts/server-components.md +132 -0
- package/dist/docs/concepts/suspense.md +129 -0
- package/dist/docs/concepts/transitions.md +112 -0
- package/dist/docs/getting-started.md +102 -0
- package/dist/docs/index.md +187 -0
- package/dist/docs/roadmap.md +144 -0
- package/dist/docs/why.md +104 -0
- package/dist/field/field-control.d.mts +65 -0
- package/dist/field/field-control.d.mts.map +1 -0
- package/dist/field/field-control.mjs +92 -0
- package/dist/field/field-control.mjs.map +1 -0
- package/dist/field/field-description.d.mts +35 -0
- package/dist/field/field-description.d.mts.map +1 -0
- package/dist/field/field-description.mjs +35 -0
- package/dist/field/field-description.mjs.map +1 -0
- package/dist/field/field-error.d.mts +42 -0
- package/dist/field/field-error.d.mts.map +1 -0
- package/dist/field/field-error.mjs +43 -0
- package/dist/field/field-error.mjs.map +1 -0
- package/dist/field/field-label.d.mts +39 -0
- package/dist/field/field-label.d.mts.map +1 -0
- package/dist/field/field-label.mjs +50 -0
- package/dist/field/field-label.mjs.map +1 -0
- package/dist/field/field-root.d.mts +72 -0
- package/dist/field/field-root.d.mts.map +1 -0
- package/dist/field/field-root.mjs +309 -0
- package/dist/field/field-root.mjs.map +1 -0
- package/dist/field/index.d.mts +27 -0
- package/dist/field/index.d.mts.map +1 -0
- package/dist/field/index.mjs +26 -0
- package/dist/field/index.mjs.map +1 -0
- package/dist/field/use-server-error-visibility.mjs +44 -0
- package/dist/field/use-server-error-visibility.mjs.map +1 -0
- package/dist/form/form-root.d.mts +74 -0
- package/dist/form/form-root.d.mts.map +1 -0
- package/dist/form/form-root.mjs +158 -0
- package/dist/form/form-root.mjs.map +1 -0
- package/dist/form/form-submit.d.mts +56 -0
- package/dist/form/form-submit.d.mts.map +1 -0
- package/dist/form/form-submit.mjs +53 -0
- package/dist/form/form-submit.mjs.map +1 -0
- package/dist/form/index.d.mts +18 -0
- package/dist/form/index.d.mts.map +1 -0
- package/dist/form/index.mjs +18 -0
- package/dist/form/index.mjs.map +1 -0
- package/dist/hover-card/hover-card-context.mjs +13 -0
- package/dist/hover-card/hover-card-context.mjs.map +1 -0
- package/dist/hover-card/hover-card-popup.d.mts +102 -0
- package/dist/hover-card/hover-card-popup.d.mts.map +1 -0
- package/dist/hover-card/hover-card-popup.mjs +80 -0
- package/dist/hover-card/hover-card-popup.mjs.map +1 -0
- package/dist/hover-card/hover-card-root.d.mts +94 -0
- package/dist/hover-card/hover-card-root.d.mts.map +1 -0
- package/dist/hover-card/hover-card-root.mjs +74 -0
- package/dist/hover-card/hover-card-root.mjs.map +1 -0
- package/dist/hover-card/hover-card-trigger.d.mts +65 -0
- package/dist/hover-card/hover-card-trigger.d.mts.map +1 -0
- package/dist/hover-card/hover-card-trigger.mjs +109 -0
- package/dist/hover-card/hover-card-trigger.mjs.map +1 -0
- package/dist/hover-card/index.d.mts +24 -0
- package/dist/hover-card/index.d.mts.map +1 -0
- package/dist/hover-card/index.mjs +24 -0
- package/dist/hover-card/index.mjs.map +1 -0
- package/dist/hover-card/use-hover-card-interest.mjs +242 -0
- package/dist/hover-card/use-hover-card-interest.mjs.map +1 -0
- package/dist/index.d.mts +100 -13
- package/dist/index.mjs +19 -1
- package/dist/internal/{action-details.mjs → action/action-details.mjs} +1 -1
- package/dist/internal/action/action-details.mjs.map +1 -0
- package/dist/internal/action/call-urgent-handler.mjs +32 -0
- package/dist/internal/action/call-urgent-handler.mjs.map +1 -0
- package/dist/internal/action/report-dropped.mjs +27 -0
- package/dist/internal/action/report-dropped.mjs.map +1 -0
- package/dist/internal/action/use-action-trigger.mjs +67 -0
- package/dist/internal/action/use-action-trigger.mjs.map +1 -0
- package/dist/internal/action/use-connected.mjs +24 -0
- package/dist/internal/action/use-connected.mjs.map +1 -0
- package/dist/internal/action/use-controllable-action.mjs +153 -0
- package/dist/internal/action/use-controllable-action.mjs.map +1 -0
- package/dist/internal/action/use-multiple-selection.mjs +83 -0
- package/dist/internal/action/use-multiple-selection.mjs.map +1 -0
- package/dist/internal/action/use-pure-trigger.mjs +34 -0
- package/dist/internal/action/use-pure-trigger.mjs.map +1 -0
- package/dist/internal/action/use-step-commit.mjs +147 -0
- package/dist/internal/action/use-step-commit.mjs.map +1 -0
- package/dist/internal/announce.mjs +20 -0
- package/dist/internal/announce.mjs.map +1 -0
- package/dist/internal/arrow-keys.mjs +21 -0
- package/dist/internal/arrow-keys.mjs.map +1 -0
- package/dist/internal/csp-context.mjs +8 -0
- package/dist/internal/csp-context.mjs.map +1 -0
- package/dist/internal/decimal.mjs +33 -0
- package/dist/internal/decimal.mjs.map +1 -0
- package/dist/internal/details-summary.mjs +56 -0
- package/dist/internal/details-summary.mjs.map +1 -0
- package/dist/internal/dev-warn.mjs +17 -0
- package/dist/internal/dev-warn.mjs.map +1 -0
- package/dist/internal/dom-order.mjs +17 -0
- package/dist/internal/dom-order.mjs.map +1 -0
- package/dist/internal/form/field-context.d.mts +19 -0
- package/dist/internal/form/field-context.d.mts.map +1 -0
- package/dist/internal/form/field-context.mjs +24 -0
- package/dist/internal/form/field-context.mjs.map +1 -0
- package/dist/internal/form/focus-first-invalid.mjs +67 -0
- package/dist/internal/form/focus-first-invalid.mjs.map +1 -0
- package/dist/internal/form/form-status-watcher.mjs +31 -0
- package/dist/internal/form/form-status-watcher.mjs.map +1 -0
- package/dist/internal/form/group-member.mjs +37 -0
- package/dist/internal/form/group-member.mjs.map +1 -0
- package/dist/internal/form/hidden-values.mjs +29 -0
- package/dist/internal/form/hidden-values.mjs.map +1 -0
- package/dist/internal/{sync-presence.mjs → form/sync-presence.mjs} +6 -2
- package/dist/internal/form/sync-presence.mjs.map +1 -0
- package/dist/internal/form/use-checkable-input.mjs +79 -0
- package/dist/internal/form/use-checkable-input.mjs.map +1 -0
- package/dist/internal/form/use-field-control.mjs +125 -0
- package/dist/internal/form/use-field-control.mjs.map +1 -0
- package/dist/internal/form/use-fieldset-group.mjs +46 -0
- package/dist/internal/form/use-fieldset-group.mjs.map +1 -0
- package/dist/internal/form/use-form-owner-event.mjs +44 -0
- package/dist/internal/form/use-form-owner-event.mjs.map +1 -0
- package/dist/internal/form/use-form-reset.mjs +39 -0
- package/dist/internal/form/use-form-reset.mjs.map +1 -0
- package/dist/internal/{use-native-checked.mjs → form/use-native-checked.mjs} +8 -9
- package/dist/internal/form/use-native-checked.mjs.map +1 -0
- package/dist/internal/{use-native-group-reconciliation.mjs → form/use-native-group-reconciliation.mjs} +15 -12
- package/dist/internal/form/use-native-group-reconciliation.mjs.map +1 -0
- package/dist/internal/{use-native-select-value.mjs → form/use-native-select-value.mjs} +8 -6
- package/dist/internal/form/use-native-select-value.mjs.map +1 -0
- package/dist/internal/form/validity.d.mts +35 -0
- package/dist/internal/form/validity.d.mts.map +1 -0
- package/dist/internal/form/validity.mjs +98 -0
- package/dist/internal/form/validity.mjs.map +1 -0
- package/dist/internal/overlay/anchor-position.d.mts +15 -0
- package/dist/internal/overlay/anchor-position.d.mts.map +1 -0
- package/dist/internal/overlay/anchor-position.mjs +132 -0
- package/dist/internal/overlay/anchor-position.mjs.map +1 -0
- package/dist/internal/overlay/content-focus-probe.mjs +42 -0
- package/dist/internal/overlay/content-focus-probe.mjs.map +1 -0
- package/dist/internal/overlay/css-transition-cut.mjs +66 -0
- package/dist/internal/overlay/css-transition-cut.mjs.map +1 -0
- package/dist/internal/overlay/focus-visible.mjs +26 -0
- package/dist/internal/overlay/focus-visible.mjs.map +1 -0
- package/dist/internal/overlay/invokers.mjs +63 -0
- package/dist/internal/overlay/invokers.mjs.map +1 -0
- package/dist/internal/overlay/modal-registry.mjs +39 -0
- package/dist/internal/overlay/modal-registry.mjs.map +1 -0
- package/dist/internal/overlay/overlay-popup.mjs +103 -0
- package/dist/internal/overlay/overlay-popup.mjs.map +1 -0
- package/dist/internal/overlay/overlay-show.mjs +73 -0
- package/dist/internal/overlay/overlay-show.mjs.map +1 -0
- package/dist/internal/overlay/popover-open.mjs +18 -0
- package/dist/internal/overlay/popover-open.mjs.map +1 -0
- package/dist/internal/overlay/trigger-ref.mjs +26 -0
- package/dist/internal/overlay/trigger-ref.mjs.map +1 -0
- package/dist/internal/overlay/use-apply-open-state.mjs +44 -0
- package/dist/internal/overlay/use-apply-open-state.mjs.map +1 -0
- package/dist/internal/{use-exit-animation.mjs → overlay/use-exit-animation.mjs} +28 -8
- package/dist/internal/overlay/use-exit-animation.mjs.map +1 -0
- package/dist/internal/overlay/use-interest-dismiss.mjs +85 -0
- package/dist/internal/overlay/use-interest-dismiss.mjs.map +1 -0
- package/dist/internal/overlay/use-modal-registration.mjs +47 -0
- package/dist/internal/overlay/use-modal-registration.mjs.map +1 -0
- package/dist/internal/overlay/use-overlay-close.mjs +72 -0
- package/dist/internal/overlay/use-overlay-close.mjs.map +1 -0
- package/dist/internal/overlay/use-overlay-root.d.mts +2 -0
- package/dist/internal/overlay/use-overlay-root.mjs +193 -0
- package/dist/internal/overlay/use-overlay-root.mjs.map +1 -0
- package/dist/internal/overlay/use-popover-popup.mjs +287 -0
- package/dist/internal/overlay/use-popover-popup.mjs.map +1 -0
- package/dist/internal/overlay/use-popover-trigger.d.mts +16 -0
- package/dist/internal/overlay/use-popover-trigger.d.mts.map +1 -0
- package/dist/internal/overlay/use-popover-trigger.mjs +142 -0
- package/dist/internal/overlay/use-popover-trigger.mjs.map +1 -0
- package/dist/internal/overlay/use-resolved-placement.mjs +162 -0
- package/dist/internal/overlay/use-resolved-placement.mjs.map +1 -0
- package/dist/internal/platform-attributes.d.mts +2 -1
- package/dist/internal/platform-attributes.d.mts.map +1 -1
- package/dist/internal/pointer-capture.mjs +20 -0
- package/dist/internal/pointer-capture.mjs.map +1 -0
- package/dist/internal/range-value.mjs +51 -0
- package/dist/internal/range-value.mjs.map +1 -0
- package/dist/internal/render-element.d.mts +2 -0
- package/dist/internal/render-element.mjs +123 -0
- package/dist/internal/render-element.mjs.map +1 -0
- package/dist/internal/shipped-styles.mjs +14 -0
- package/dist/internal/shipped-styles.mjs.map +1 -0
- package/dist/internal/toolbar-context.mjs +17 -0
- package/dist/internal/toolbar-context.mjs.map +1 -0
- package/dist/internal/transition-boundary.mjs +5 -9
- package/dist/internal/transition-boundary.mjs.map +1 -1
- package/dist/internal/typeahead.mjs +52 -0
- package/dist/internal/typeahead.mjs.map +1 -0
- package/dist/internal/types.d.mts +42 -9
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-active-option.mjs +51 -0
- package/dist/internal/use-active-option.mjs.map +1 -0
- package/dist/internal/use-deferred-leave.mjs +113 -0
- package/dist/internal/use-deferred-leave.mjs.map +1 -0
- package/dist/internal/use-dev-warning.mjs +8 -4
- package/dist/internal/use-dev-warning.mjs.map +1 -1
- package/dist/internal/use-element-check.mjs +39 -0
- package/dist/internal/use-element-check.mjs.map +1 -0
- package/dist/internal/use-item-order.mjs +42 -0
- package/dist/internal/use-item-order.mjs.map +1 -0
- package/dist/internal/use-latest.mjs +28 -0
- package/dist/internal/use-latest.mjs.map +1 -0
- package/dist/internal/use-merged-refs.mjs +19 -0
- package/dist/internal/use-merged-refs.mjs.map +1 -0
- package/dist/internal/use-mount-fixed.mjs +22 -0
- package/dist/internal/use-mount-fixed.mjs.map +1 -0
- package/dist/internal/use-name-warning.mjs +140 -0
- package/dist/internal/use-name-warning.mjs.map +1 -0
- package/dist/internal/use-native-focusgroup.mjs +19 -0
- package/dist/internal/use-native-focusgroup.mjs.map +1 -0
- package/dist/internal/use-option-registry.mjs +70 -0
- package/dist/internal/use-option-registry.mjs.map +1 -0
- package/dist/internal/use-register-count.mjs +27 -0
- package/dist/internal/use-register-count.mjs.map +1 -0
- package/dist/internal/use-render.d.mts +2 -0
- package/dist/internal/use-render.mjs +12 -35
- package/dist/internal/use-render.mjs.map +1 -1
- package/dist/internal/use-roving-focus.mjs +288 -0
- package/dist/internal/use-roving-focus.mjs.map +1 -0
- package/dist/internal/use-value-set.mjs +20 -0
- package/dist/internal/use-value-set.mjs.map +1 -0
- package/dist/internal/value-set.mjs +41 -0
- package/dist/internal/value-set.mjs.map +1 -0
- package/dist/menu/index.d.mts +8 -2
- package/dist/menu/index.d.mts.map +1 -1
- package/dist/menu/index.mjs +7 -1
- package/dist/menu/index.mjs.map +1 -1
- package/dist/menu/menu-checkbox-item.d.mts +27 -3
- package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
- package/dist/menu/menu-checkbox-item.mjs +6 -3
- package/dist/menu/menu-checkbox-item.mjs.map +1 -1
- package/dist/menu/menu-context-trigger.d.mts +63 -0
- package/dist/menu/menu-context-trigger.d.mts.map +1 -0
- package/dist/menu/menu-context-trigger.mjs +231 -0
- package/dist/menu/menu-context-trigger.mjs.map +1 -0
- package/dist/menu/menu-context.d.mts +1 -1
- package/dist/menu/menu-context.mjs +44 -1
- package/dist/menu/menu-context.mjs.map +1 -1
- package/dist/menu/menu-dom.mjs +35 -4
- package/dist/menu/menu-dom.mjs.map +1 -1
- package/dist/menu/menu-gestures.mjs +166 -0
- package/dist/menu/menu-gestures.mjs.map +1 -0
- package/dist/menu/menu-group.d.mts +36 -1
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +15 -5
- package/dist/menu/menu-group.mjs.map +1 -1
- package/dist/menu/menu-hover.mjs +0 -1
- package/dist/menu/menu-hover.mjs.map +1 -1
- package/dist/menu/menu-item.d.mts +42 -5
- package/dist/menu/menu-item.d.mts.map +1 -1
- package/dist/menu/menu-item.mjs +18 -9
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-outside.mjs +101 -0
- package/dist/menu/menu-outside.mjs.map +1 -0
- package/dist/menu/menu-point.mjs +85 -0
- package/dist/menu/menu-point.mjs.map +1 -0
- package/dist/menu/menu-popup.d.mts +68 -11
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +106 -116
- package/dist/menu/menu-popup.mjs.map +1 -1
- package/dist/menu/menu-radio-group.d.mts +20 -1
- package/dist/menu/menu-radio-group.d.mts.map +1 -1
- package/dist/menu/menu-radio-group.mjs +14 -7
- package/dist/menu/menu-radio-group.mjs.map +1 -1
- package/dist/menu/menu-radio-item.d.mts +18 -0
- package/dist/menu/menu-radio-item.d.mts.map +1 -1
- package/dist/menu/menu-radio-item.mjs +5 -1
- package/dist/menu/menu-radio-item.mjs.map +1 -1
- package/dist/menu/menu-root.d.mts +61 -12
- package/dist/menu/menu-root.d.mts.map +1 -1
- package/dist/menu/menu-root.mjs +72 -17
- package/dist/menu/menu-root.mjs.map +1 -1
- package/dist/menu/menu-submenu-trigger.d.mts +24 -9
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +48 -26
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +37 -16
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +39 -23
- package/dist/menu/menu-trigger.mjs.map +1 -1
- package/dist/menu/use-menu-item.mjs +14 -16
- package/dist/menu/use-menu-item.mjs.map +1 -1
- package/dist/menu/use-menu-keyboard.mjs +68 -0
- package/dist/menu/use-menu-keyboard.mjs.map +1 -0
- package/dist/meter/index.d.mts +26 -0
- package/dist/meter/index.d.mts.map +1 -0
- package/dist/meter/index.mjs +25 -0
- package/dist/meter/index.mjs.map +1 -0
- package/dist/meter/meter-context.mjs +13 -0
- package/dist/meter/meter-context.mjs.map +1 -0
- package/dist/meter/meter-indicator.d.mts +30 -0
- package/dist/meter/meter-indicator.d.mts.map +1 -0
- package/dist/meter/meter-indicator.mjs +27 -0
- package/dist/meter/meter-indicator.mjs.map +1 -0
- package/dist/meter/meter-label.d.mts +30 -0
- package/dist/meter/meter-label.d.mts.map +1 -0
- package/dist/meter/meter-label.mjs +30 -0
- package/dist/meter/meter-label.mjs.map +1 -0
- package/dist/meter/meter-region.d.mts +9 -0
- package/dist/meter/meter-region.d.mts.map +1 -0
- package/dist/meter/meter-region.mjs +39 -0
- package/dist/meter/meter-region.mjs.map +1 -0
- package/dist/meter/meter-root.d.mts +113 -0
- package/dist/meter/meter-root.d.mts.map +1 -0
- package/dist/meter/meter-root.mjs +85 -0
- package/dist/meter/meter-root.mjs.map +1 -0
- package/dist/meter/meter-track.d.mts +30 -0
- package/dist/meter/meter-track.d.mts.map +1 -0
- package/dist/meter/meter-track.mjs +27 -0
- package/dist/meter/meter-track.mjs.map +1 -0
- package/dist/meter/meter-value.d.mts +34 -0
- package/dist/meter/meter-value.d.mts.map +1 -0
- package/dist/meter/meter-value.mjs +31 -0
- package/dist/meter/meter-value.mjs.map +1 -0
- package/dist/multi-select/index.d.mts +37 -0
- package/dist/multi-select/index.d.mts.map +1 -0
- package/dist/multi-select/index.mjs +37 -0
- package/dist/multi-select/index.mjs.map +1 -0
- package/dist/multi-select/multi-select-context.mjs +19 -0
- package/dist/multi-select/multi-select-context.mjs.map +1 -0
- package/dist/multi-select/multi-select-group.d.mts +120 -0
- package/dist/multi-select/multi-select-group.d.mts.map +1 -0
- package/dist/multi-select/multi-select-group.mjs +111 -0
- package/dist/multi-select/multi-select-group.mjs.map +1 -0
- package/dist/multi-select/multi-select-keyboard.mjs +145 -0
- package/dist/multi-select/multi-select-keyboard.mjs.map +1 -0
- package/dist/multi-select/multi-select-label.d.mts +42 -0
- package/dist/multi-select/multi-select-label.d.mts.map +1 -0
- package/dist/multi-select/multi-select-label.mjs +41 -0
- package/dist/multi-select/multi-select-label.mjs.map +1 -0
- package/dist/multi-select/multi-select-list.d.mts +47 -0
- package/dist/multi-select/multi-select-list.d.mts.map +1 -0
- package/dist/multi-select/multi-select-list.mjs +65 -0
- package/dist/multi-select/multi-select-list.mjs.map +1 -0
- package/dist/multi-select/multi-select-option.d.mts +68 -0
- package/dist/multi-select/multi-select-option.d.mts.map +1 -0
- package/dist/multi-select/multi-select-option.mjs +93 -0
- package/dist/multi-select/multi-select-option.mjs.map +1 -0
- package/dist/multi-select/multi-select-popup.d.mts +58 -0
- package/dist/multi-select/multi-select-popup.d.mts.map +1 -0
- package/dist/multi-select/multi-select-popup.mjs +71 -0
- package/dist/multi-select/multi-select-popup.mjs.map +1 -0
- package/dist/multi-select/multi-select-root.d.mts +125 -0
- package/dist/multi-select/multi-select-root.d.mts.map +1 -0
- package/dist/multi-select/multi-select-root.mjs +257 -0
- package/dist/multi-select/multi-select-root.mjs.map +1 -0
- package/dist/multi-select/multi-select-trigger.d.mts +66 -0
- package/dist/multi-select/multi-select-trigger.d.mts.map +1 -0
- package/dist/multi-select/multi-select-trigger.mjs +169 -0
- package/dist/multi-select/multi-select-trigger.mjs.map +1 -0
- package/dist/multi-select/multi-select-value.d.mts +57 -0
- package/dist/multi-select/multi-select-value.d.mts.map +1 -0
- package/dist/multi-select/multi-select-value.mjs +41 -0
- package/dist/multi-select/multi-select-value.mjs.map +1 -0
- package/dist/number-field/index.d.mts +29 -0
- package/dist/number-field/index.d.mts.map +1 -0
- package/dist/number-field/index.mjs +28 -0
- package/dist/number-field/index.mjs.map +1 -0
- package/dist/number-field/number-field-arithmetic.mjs +97 -0
- package/dist/number-field/number-field-arithmetic.mjs.map +1 -0
- package/dist/number-field/number-field-context.d.mts +7 -0
- package/dist/number-field/number-field-context.d.mts.map +1 -0
- package/dist/number-field/number-field-context.mjs +13 -0
- package/dist/number-field/number-field-context.mjs.map +1 -0
- package/dist/number-field/number-field-decrement.d.mts +19 -0
- package/dist/number-field/number-field-decrement.d.mts.map +1 -0
- package/dist/number-field/number-field-decrement.mjs +22 -0
- package/dist/number-field/number-field-decrement.mjs.map +1 -0
- package/dist/number-field/number-field-format.mjs +279 -0
- package/dist/number-field/number-field-format.mjs.map +1 -0
- package/dist/number-field/number-field-increment.d.mts +19 -0
- package/dist/number-field/number-field-increment.d.mts.map +1 -0
- package/dist/number-field/number-field-increment.mjs +22 -0
- package/dist/number-field/number-field-increment.mjs.map +1 -0
- package/dist/number-field/number-field-input.d.mts +38 -0
- package/dist/number-field/number-field-input.d.mts.map +1 -0
- package/dist/number-field/number-field-input.mjs +161 -0
- package/dist/number-field/number-field-input.mjs.map +1 -0
- package/dist/number-field/number-field-label.d.mts +33 -0
- package/dist/number-field/number-field-label.d.mts.map +1 -0
- package/dist/number-field/number-field-label.mjs +43 -0
- package/dist/number-field/number-field-label.mjs.map +1 -0
- package/dist/number-field/number-field-root.d.mts +157 -0
- package/dist/number-field/number-field-root.d.mts.map +1 -0
- package/dist/number-field/number-field-root.mjs +445 -0
- package/dist/number-field/number-field-root.mjs.map +1 -0
- package/dist/number-field/use-number-field-dev-warnings.mjs +28 -0
- package/dist/number-field/use-number-field-dev-warnings.mjs.map +1 -0
- package/dist/number-field/use-step-button.d.mts +44 -0
- package/dist/number-field/use-step-button.d.mts.map +1 -0
- package/dist/number-field/use-step-button.mjs +175 -0
- package/dist/number-field/use-step-button.mjs.map +1 -0
- package/dist/popover/index.d.mts +6 -4
- package/dist/popover/index.d.mts.map +1 -1
- package/dist/popover/index.mjs +6 -4
- package/dist/popover/index.mjs.map +1 -1
- package/dist/popover/popover-close.d.mts +48 -8
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +41 -67
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-context.mjs.map +1 -1
- package/dist/popover/popover-description.d.mts +12 -0
- package/dist/popover/popover-description.d.mts.map +1 -1
- package/dist/popover/popover-description.mjs +2 -0
- package/dist/popover/popover-description.mjs.map +1 -1
- package/dist/popover/popover-popup.d.mts +64 -18
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +31 -36
- package/dist/popover/popover-popup.mjs.map +1 -1
- package/dist/popover/popover-root.d.mts +40 -18
- package/dist/popover/popover-root.d.mts.map +1 -1
- package/dist/popover/popover-root.mjs +15 -10
- package/dist/popover/popover-root.mjs.map +1 -1
- package/dist/popover/popover-title.d.mts +11 -0
- package/dist/popover/popover-title.d.mts.map +1 -1
- package/dist/popover/popover-title.mjs +2 -0
- package/dist/popover/popover-title.mjs.map +1 -1
- package/dist/popover/popover-trigger.d.mts +38 -18
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +14 -9
- package/dist/popover/popover-trigger.mjs.map +1 -1
- package/dist/progress/index.d.mts +26 -0
- package/dist/progress/index.d.mts.map +1 -0
- package/dist/progress/index.mjs +26 -0
- package/dist/progress/index.mjs.map +1 -0
- package/dist/progress/progress-context.mjs +13 -0
- package/dist/progress/progress-context.mjs.map +1 -0
- package/dist/progress/progress-indicator.d.mts +30 -0
- package/dist/progress/progress-indicator.d.mts.map +1 -0
- package/dist/progress/progress-indicator.mjs +31 -0
- package/dist/progress/progress-indicator.mjs.map +1 -0
- package/dist/progress/progress-label.d.mts +30 -0
- package/dist/progress/progress-label.d.mts.map +1 -0
- package/dist/progress/progress-label.mjs +32 -0
- package/dist/progress/progress-label.mjs.map +1 -0
- package/dist/progress/progress-root.d.mts +96 -0
- package/dist/progress/progress-root.d.mts.map +1 -0
- package/dist/progress/progress-root.mjs +82 -0
- package/dist/progress/progress-root.mjs.map +1 -0
- package/dist/progress/progress-track.d.mts +30 -0
- package/dist/progress/progress-track.d.mts.map +1 -0
- package/dist/progress/progress-track.mjs +31 -0
- package/dist/progress/progress-track.mjs.map +1 -0
- package/dist/progress/progress-value.d.mts +34 -0
- package/dist/progress/progress-value.d.mts.map +1 -0
- package/dist/progress/progress-value.mjs +35 -0
- package/dist/progress/progress-value.mjs.map +1 -0
- package/dist/radio-group/index.d.mts +2 -0
- package/dist/radio-group/index.d.mts.map +1 -1
- package/dist/radio-group/index.mjs +2 -0
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/radio-group/radio-group-context.mjs.map +1 -1
- package/dist/radio-group/radio-group-item.d.mts +21 -5
- package/dist/radio-group/radio-group-item.d.mts.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +22 -25
- package/dist/radio-group/radio-group-item.mjs.map +1 -1
- package/dist/radio-group/radio-group-label.d.mts +10 -0
- package/dist/radio-group/radio-group-label.d.mts.map +1 -1
- package/dist/radio-group/radio-group-label.mjs +3 -6
- package/dist/radio-group/radio-group-label.mjs.map +1 -1
- package/dist/radio-group/radio-group-root.d.mts +34 -8
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +48 -39
- package/dist/radio-group/radio-group-root.mjs.map +1 -1
- package/dist/select/index.d.mts +2 -0
- package/dist/select/index.d.mts.map +1 -1
- package/dist/select/index.mjs +2 -0
- package/dist/select/index.mjs.map +1 -1
- package/dist/select/select-dom.mjs +9 -18
- package/dist/select/select-dom.mjs.map +1 -1
- package/dist/select/select-group-label.d.mts +10 -0
- package/dist/select/select-group-label.d.mts.map +1 -1
- package/dist/select/select-group-label.mjs +5 -1
- package/dist/select/select-group-label.mjs.map +1 -1
- package/dist/select/select-group.d.mts +15 -1
- package/dist/select/select-group.d.mts.map +1 -1
- package/dist/select/select-group.mjs +8 -4
- package/dist/select/select-group.mjs.map +1 -1
- package/dist/select/select-option.d.mts +19 -1
- package/dist/select/select-option.d.mts.map +1 -1
- package/dist/select/select-option.mjs +4 -2
- package/dist/select/select-option.mjs.map +1 -1
- package/dist/select/select-root.d.mts +28 -3
- package/dist/select/select-root.d.mts.map +1 -1
- package/dist/select/select-root.mjs +39 -12
- package/dist/select/select-root.mjs.map +1 -1
- package/dist/select/select-separator.d.mts +9 -0
- package/dist/select/select-separator.d.mts.map +1 -1
- package/dist/select/select-separator.mjs +2 -0
- package/dist/select/select-separator.mjs.map +1 -1
- package/dist/select/select-trigger.d.mts +9 -0
- package/dist/select/select-trigger.d.mts.map +1 -1
- package/dist/select/select-trigger.mjs +5 -1
- package/dist/select/select-trigger.mjs.map +1 -1
- package/dist/select/select-value.d.mts +9 -0
- package/dist/select/select-value.d.mts.map +1 -1
- package/dist/select/select-value.mjs +5 -6
- package/dist/select/select-value.mjs.map +1 -1
- package/dist/separator/index.d.mts +3 -0
- package/dist/separator/index.mjs +1 -0
- package/dist/separator/separator.d.mts +58 -0
- package/dist/separator/separator.d.mts.map +1 -0
- package/dist/separator/separator.mjs +41 -0
- package/dist/separator/separator.mjs.map +1 -0
- package/dist/slider/index.d.mts +34 -0
- package/dist/slider/index.d.mts.map +1 -0
- package/dist/slider/index.mjs +29 -0
- package/dist/slider/index.mjs.map +1 -0
- package/dist/slider/slider-arithmetic.mjs +165 -0
- package/dist/slider/slider-arithmetic.mjs.map +1 -0
- package/dist/slider/slider-context.mjs +13 -0
- package/dist/slider/slider-context.mjs.map +1 -0
- package/dist/slider/slider-indicator.d.mts +34 -0
- package/dist/slider/slider-indicator.d.mts.map +1 -0
- package/dist/slider/slider-indicator.mjs +38 -0
- package/dist/slider/slider-indicator.mjs.map +1 -0
- package/dist/slider/slider-label.d.mts +33 -0
- package/dist/slider/slider-label.d.mts.map +1 -0
- package/dist/slider/slider-label.mjs +40 -0
- package/dist/slider/slider-label.mjs.map +1 -0
- package/dist/slider/slider-root.d.mts +155 -0
- package/dist/slider/slider-root.d.mts.map +1 -0
- package/dist/slider/slider-root.mjs +434 -0
- package/dist/slider/slider-root.mjs.map +1 -0
- package/dist/slider/slider-thumb.d.mts +87 -0
- package/dist/slider/slider-thumb.d.mts.map +1 -0
- package/dist/slider/slider-thumb.mjs +150 -0
- package/dist/slider/slider-thumb.mjs.map +1 -0
- package/dist/slider/slider-track.d.mts +46 -0
- package/dist/slider/slider-track.d.mts.map +1 -0
- package/dist/slider/slider-track.mjs +57 -0
- package/dist/slider/slider-track.mjs.map +1 -0
- package/dist/slider/slider-value.d.mts +45 -0
- package/dist/slider/slider-value.d.mts.map +1 -0
- package/dist/slider/slider-value.mjs +41 -0
- package/dist/slider/slider-value.mjs.map +1 -0
- package/dist/slider/use-slider-dev-warnings.mjs +29 -0
- package/dist/slider/use-slider-dev-warnings.mjs.map +1 -0
- package/dist/slider/use-thumb-registry.mjs +51 -0
- package/dist/slider/use-thumb-registry.mjs.map +1 -0
- package/dist/switch/switch.d.mts +30 -9
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +24 -46
- package/dist/switch/switch.mjs.map +1 -1
- package/dist/tabs/index.d.mts +2 -0
- package/dist/tabs/index.d.mts.map +1 -1
- package/dist/tabs/index.mjs +2 -0
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/tabs/tabs-context.d.mts +7 -3
- package/dist/tabs/tabs-context.d.mts.map +1 -1
- package/dist/tabs/tabs-context.mjs.map +1 -1
- package/dist/tabs/tabs-indicator.d.mts +17 -0
- package/dist/tabs/tabs-indicator.d.mts.map +1 -1
- package/dist/tabs/tabs-indicator.mjs +4 -1
- package/dist/tabs/tabs-indicator.mjs.map +1 -1
- package/dist/tabs/tabs-list.d.mts +19 -1
- package/dist/tabs/tabs-list.d.mts.map +1 -1
- package/dist/tabs/tabs-list.mjs +12 -23
- package/dist/tabs/tabs-list.mjs.map +1 -1
- package/dist/tabs/tabs-panel.d.mts +22 -4
- package/dist/tabs/tabs-panel.d.mts.map +1 -1
- package/dist/tabs/tabs-panel.mjs +4 -2
- package/dist/tabs/tabs-panel.mjs.map +1 -1
- package/dist/tabs/tabs-root.d.mts +43 -8
- package/dist/tabs/tabs-root.d.mts.map +1 -1
- package/dist/tabs/tabs-root.mjs +23 -10
- package/dist/tabs/tabs-root.mjs.map +1 -1
- package/dist/tabs/tabs-tab.d.mts +25 -5
- package/dist/tabs/tabs-tab.d.mts.map +1 -1
- package/dist/tabs/tabs-tab.mjs +5 -2
- package/dist/tabs/tabs-tab.mjs.map +1 -1
- package/dist/{internal → tabs}/use-until-found.mjs +1 -1
- package/dist/tabs/use-until-found.mjs.map +1 -0
- package/dist/toast/index.d.mts +27 -0
- package/dist/toast/index.d.mts.map +1 -0
- package/dist/toast/index.mjs +28 -0
- package/dist/toast/index.mjs.map +1 -0
- package/dist/toast/toast-action.d.mts +86 -0
- package/dist/toast/toast-action.d.mts.map +1 -0
- package/dist/toast/toast-action.mjs +81 -0
- package/dist/toast/toast-action.mjs.map +1 -0
- package/dist/toast/toast-close.d.mts +52 -0
- package/dist/toast/toast-close.d.mts.map +1 -0
- package/dist/toast/toast-close.mjs +53 -0
- package/dist/toast/toast-close.mjs.map +1 -0
- package/dist/toast/toast-context.mjs +19 -0
- package/dist/toast/toast-context.mjs.map +1 -0
- package/dist/toast/toast-description.d.mts +39 -0
- package/dist/toast/toast-description.d.mts.map +1 -0
- package/dist/toast/toast-description.mjs +37 -0
- package/dist/toast/toast-description.mjs.map +1 -0
- package/dist/toast/toast-hotkey.mjs +27 -0
- package/dist/toast/toast-hotkey.mjs.map +1 -0
- package/dist/toast/toast-queue.mjs +137 -0
- package/dist/toast/toast-queue.mjs.map +1 -0
- package/dist/toast/toast-root.d.mts +63 -0
- package/dist/toast/toast-root.d.mts.map +1 -0
- package/dist/toast/toast-root.mjs +209 -0
- package/dist/toast/toast-root.mjs.map +1 -0
- package/dist/toast/toast-timers.mjs +65 -0
- package/dist/toast/toast-timers.mjs.map +1 -0
- package/dist/toast/toast-title.d.mts +38 -0
- package/dist/toast/toast-title.d.mts.map +1 -0
- package/dist/toast/toast-title.mjs +35 -0
- package/dist/toast/toast-title.mjs.map +1 -0
- package/dist/toast/toast-viewport.d.mts +81 -0
- package/dist/toast/toast-viewport.d.mts.map +1 -0
- package/dist/toast/toast-viewport.mjs +345 -0
- package/dist/toast/toast-viewport.mjs.map +1 -0
- package/dist/toast/toast.d.mts +162 -0
- package/dist/toast/toast.d.mts.map +1 -0
- package/dist/toast/toast.mjs +161 -0
- package/dist/toast/toast.mjs.map +1 -0
- package/dist/toast/use-modal-portal-host.mjs +52 -0
- package/dist/toast/use-modal-portal-host.mjs.map +1 -0
- package/dist/toast/use-toast-announcements.mjs +46 -0
- package/dist/toast/use-toast-announcements.mjs.map +1 -0
- package/dist/toast/use-toast-focus.mjs +75 -0
- package/dist/toast/use-toast-focus.mjs.map +1 -0
- package/dist/toast/use-toast-pauses.mjs +58 -0
- package/dist/toast/use-toast-pauses.mjs.map +1 -0
- package/dist/toggle/toggle.d.mts +26 -6
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +12 -6
- package/dist/toggle/toggle.mjs.map +1 -1
- package/dist/toggle-group/index.d.mts +18 -0
- package/dist/toggle-group/index.d.mts.map +1 -0
- package/dist/toggle-group/index.mjs +17 -0
- package/dist/toggle-group/index.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-context.d.mts +6 -0
- package/dist/toggle-group/toggle-group-context.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-context.mjs +13 -0
- package/dist/toggle-group/toggle-group-context.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-item.d.mts +71 -0
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-item.mjs +69 -0
- package/dist/toggle-group/toggle-group-item.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-root.d.mts +156 -0
- package/dist/toggle-group/toggle-group-root.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-root.mjs +177 -0
- package/dist/toggle-group/toggle-group-root.mjs.map +1 -0
- package/dist/toolbar/index.d.mts +19 -0
- package/dist/toolbar/index.d.mts.map +1 -0
- package/dist/toolbar/index.mjs +19 -0
- package/dist/toolbar/index.mjs.map +1 -0
- package/dist/toolbar/toolbar-root.d.mts +65 -0
- package/dist/toolbar/toolbar-root.d.mts.map +1 -0
- package/dist/toolbar/toolbar-root.mjs +67 -0
- package/dist/toolbar/toolbar-root.mjs.map +1 -0
- package/dist/toolbar/toolbar-separator.d.mts +38 -0
- package/dist/toolbar/toolbar-separator.d.mts.map +1 -0
- package/dist/toolbar/toolbar-separator.mjs +33 -0
- package/dist/toolbar/toolbar-separator.mjs.map +1 -0
- package/dist/tooltip/index.d.mts +10 -5
- package/dist/tooltip/index.d.mts.map +1 -1
- package/dist/tooltip/index.mjs +8 -3
- package/dist/tooltip/index.mjs.map +1 -1
- package/dist/tooltip/tooltip-arrow.d.mts +46 -0
- package/dist/tooltip/tooltip-arrow.d.mts.map +1 -0
- package/dist/tooltip/tooltip-arrow.mjs +47 -0
- package/dist/tooltip/tooltip-arrow.mjs.map +1 -0
- package/dist/tooltip/tooltip-context.d.mts +11 -0
- package/dist/tooltip/tooltip-context.d.mts.map +1 -1
- package/dist/tooltip/tooltip-context.mjs +2 -1
- package/dist/tooltip/tooltip-context.mjs.map +1 -1
- package/dist/tooltip/tooltip-popup.d.mts +49 -7
- package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
- package/dist/tooltip/tooltip-popup.mjs +37 -15
- package/dist/tooltip/tooltip-popup.mjs.map +1 -1
- package/dist/tooltip/tooltip-root.d.mts +24 -2
- package/dist/tooltip/tooltip-root.d.mts.map +1 -1
- package/dist/tooltip/tooltip-root.mjs +29 -6
- package/dist/tooltip/tooltip-root.mjs.map +1 -1
- package/dist/tooltip/tooltip-trigger.d.mts +28 -3
- package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +26 -6
- package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
- package/dist/tooltip/tooltip-warm.mjs +29 -0
- package/dist/tooltip/tooltip-warm.mjs.map +1 -0
- package/dist/tooltip/use-tooltip-interaction.mjs +128 -77
- package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
- package/package.json +27 -2
- package/skills/funstack-ui-knowledge/SKILL.md +80 -0
- package/dist/accordion/accordion-context.d.mts +0 -5
- package/dist/accordion/accordion-context.d.mts.map +0 -1
- package/dist/internal/action-details.mjs.map +0 -1
- package/dist/internal/anchor-position.d.mts +0 -7
- package/dist/internal/anchor-position.d.mts.map +0 -1
- package/dist/internal/anchor-position.mjs +0 -16
- package/dist/internal/anchor-position.mjs.map +0 -1
- package/dist/internal/sync-presence.mjs.map +0 -1
- package/dist/internal/use-action-trigger.mjs +0 -58
- package/dist/internal/use-action-trigger.mjs.map +0 -1
- package/dist/internal/use-controllable-action.mjs +0 -119
- package/dist/internal/use-controllable-action.mjs.map +0 -1
- package/dist/internal/use-exit-animation.mjs.map +0 -1
- package/dist/internal/use-form-reset.mjs +0 -54
- package/dist/internal/use-form-reset.mjs.map +0 -1
- package/dist/internal/use-native-checked.mjs.map +0 -1
- package/dist/internal/use-native-group-reconciliation.mjs.map +0 -1
- package/dist/internal/use-native-select-value.mjs.map +0 -1
- package/dist/internal/use-popover-popup.mjs +0 -274
- package/dist/internal/use-popover-popup.mjs.map +0 -1
- package/dist/internal/use-popover-root.d.mts +0 -2
- package/dist/internal/use-popover-root.mjs +0 -112
- package/dist/internal/use-popover-root.mjs.map +0 -1
- package/dist/internal/use-popover-trigger.mjs +0 -86
- package/dist/internal/use-popover-trigger.mjs.map +0 -1
- package/dist/internal/use-until-found.mjs.map +0 -1
package/dist/docs/why.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Why FUNSTACK UI
|
|
2
|
+
|
|
3
|
+
React 18 brought transitions and Suspense for data fetching. React 19 added actions and `useOptimistic`, and React 19.3 made `<ViewTransition>` stable. FUNSTACK UI is a headless component library that uses them for you, so the async work around every button, tab and dialog is already done.
|
|
4
|
+
|
|
5
|
+
## <a id="async-react"></a>Built for Async React
|
|
6
|
+
|
|
7
|
+
Async React is the React team's name for using these features together (the [Async React talks at React Conf 2025](https://react.dev/blog/2025/10/16/react-conf-2025-recap)). The idea is good async UX built in: while data loads or a request runs, the screen stays responsive, shows what is pending, and switches to the result when it is ready, without each app wiring that by hand.
|
|
8
|
+
|
|
9
|
+
FUNSTACK UI bets on this idea and is **Async React-native**: the components start the transitions, show optimistic and pending state and wait for Suspense themselves. You get good async UI by using them, without wiring it yourself.
|
|
10
|
+
|
|
11
|
+
## What you stop writing
|
|
12
|
+
|
|
13
|
+
- **[No pending flags](concepts/pending-and-optimistic.md)**
|
|
14
|
+
|
|
15
|
+
Every component with an action sets `data-pending` while the action runs, until its result is on screen. Style it in CSS.
|
|
16
|
+
|
|
17
|
+
- **[No onChange + useTransition + useOptimistic](concepts/action-props.md)**
|
|
18
|
+
|
|
19
|
+
Pass an async function as an action prop. The component runs it in a transition, shows the new value at once, and rolls it back if the action fails. Errors go to your Error Boundary.
|
|
20
|
+
|
|
21
|
+
- **[No races between fast clicks](concepts/action-props.md#overlapping-actions)**
|
|
22
|
+
|
|
23
|
+
The display always shows the latest click. Uncontrolled state commits only the latest one, so a slow response to an older click never overwrites a newer choice.
|
|
24
|
+
|
|
25
|
+
- **[No fallback flashes](concepts/suspense.md)**
|
|
26
|
+
|
|
27
|
+
When the next tab, accordion item or dialog loads data, the current screen stays as it is and the trigger shows pending until the new content is ready.
|
|
28
|
+
|
|
29
|
+
- **[No JavaScript copies of the browser](concepts/browser-owned-state.md)**
|
|
30
|
+
|
|
31
|
+
Popups use the Popover API, `<dialog>` and CSS Anchor Positioning; form controls are native inputs. The browser handles the top layer and Escape, and popovers close on a click outside natively.
|
|
32
|
+
|
|
33
|
+
- **[No animation glue](concepts/transitions.md)**
|
|
34
|
+
|
|
35
|
+
Pass `transition` to a part and it renders React's `<ViewTransition>`. Each change is tagged with a transition type, such as `fsui-tabs-next`, so you can animate by direction.
|
|
36
|
+
|
|
37
|
+
## Before and after
|
|
38
|
+
|
|
39
|
+
A favourite button that saves to a server. By hand:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
const [pressed, setPressed] = useState(initial);
|
|
43
|
+
const [optimistic, setOptimistic] = useOptimistic(pressed);
|
|
44
|
+
const [isPending, startTransition] = useTransition();
|
|
45
|
+
|
|
46
|
+
<button
|
|
47
|
+
aria-pressed={optimistic}
|
|
48
|
+
data-pending={isPending ? "" : undefined}
|
|
49
|
+
onClick={() => {
|
|
50
|
+
const next = !optimistic;
|
|
51
|
+
startTransition(async () => {
|
|
52
|
+
setOptimistic(next);
|
|
53
|
+
await saveFavorite(next);
|
|
54
|
+
startTransition(() => setPressed(next));
|
|
55
|
+
});
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
Favorite
|
|
59
|
+
</button>
|
|
60
|
+
// ...and a slow save from an earlier click can still overwrite a later one.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
With FUNSTACK UI:
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
<Toggle defaultPressed={initial} pressedChangeAction={(next) => saveFavorite(next)}>
|
|
67
|
+
Favorite
|
|
68
|
+
</Toggle>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Same optimistic flip and `data-pending`, plus latest-click-wins and transition types for animation. Try it on the [home page](index.md).
|
|
72
|
+
|
|
73
|
+
## Compared with other headless libraries
|
|
74
|
+
|
|
75
|
+
Most established headless React libraries were designed before React's async features, and support a wide range of browsers. They are mature and a safe choice. FUNSTACK UI takes a different approach:
|
|
76
|
+
|
|
77
|
+
| | Typical headless library | FUNSTACK UI |
|
|
78
|
+
| - | - | - |
|
|
79
|
+
| **Callbacks** | Event handlers (`onValueChange`, `onOpenChange`). Transitions, optimistic state and pending flags are yours to add. | [Action props](concepts/action-props.md): run in a transition, may be async. Optimistic and pending state built in. |
|
|
80
|
+
| **Popups** | JavaScript for positioning, layering and dismissal, so older browsers work too. | The [platform](concepts/browser-owned-state.md): Popover API, `<dialog>`, CSS Anchor Positioning. Some components work before hydration. |
|
|
81
|
+
| **Animation** | CSS, with exit-animation states built in. No `<ViewTransition>` integration. | CSS, plus `<ViewTransition>` through the parts' `transition` prop ([Transitions](concepts/transitions.md)). |
|
|
82
|
+
| **Browsers** | Wide support, including older versions. | Latest stable Chrome, Edge, Safari and Firefox. No fallbacks. |
|
|
83
|
+
|
|
84
|
+
## Who it is for
|
|
85
|
+
|
|
86
|
+
### Choose it if
|
|
87
|
+
|
|
88
|
+
- Your app uses React 19.3 or later, with actions, Suspense or [Server Components](concepts/server-components.md).
|
|
89
|
+
- Your controls save to a server and should feel instant.
|
|
90
|
+
- You only need to support current browsers.
|
|
91
|
+
- You want to write your own CSS: no styles, no theme, no provider.
|
|
92
|
+
|
|
93
|
+
### Look elsewhere (for now) if
|
|
94
|
+
|
|
95
|
+
- You need older browsers or older Safari versions.
|
|
96
|
+
- You need a stable API today.
|
|
97
|
+
- You want styled components out of the box.
|
|
98
|
+
- You need a component that is not here yet (see the [roadmap](roadmap.md)).
|
|
99
|
+
|
|
100
|
+
## Next
|
|
101
|
+
|
|
102
|
+
- [Getting started](getting-started.md): install, import, style.
|
|
103
|
+
- [Action props](concepts/action-props.md): the idea everything else builds on.
|
|
104
|
+
- [Using with AI agents](concepts/ai-agents.md): give your coding agent the full docs.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { FieldState } from "../internal/form/field-context.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef } from "react";
|
|
4
|
+
//#region src/field/field-control.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props of `Field.Control`.
|
|
7
|
+
*
|
|
8
|
+
* @see https://ui.funstack.work/components/field
|
|
9
|
+
*/
|
|
10
|
+
export interface FieldControlProps extends Omit<ComponentPropsWithRef<"input">, "id" | "aria-invalid" | "className" | "style" | "children"> {
|
|
11
|
+
/**
|
|
12
|
+
* Native `id`, used outside a `Field.Root` only. Inside one the Field owns the id (so that
|
|
13
|
+
* `Field.Label` can point at it) and this prop is ignored with a development warning.
|
|
14
|
+
*/
|
|
15
|
+
id?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Native `name`.
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue the Field's `name`
|
|
20
|
+
*/
|
|
21
|
+
name?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Native `disabled`. Owned. Also `true` when the Field is disabled: an explicit `false` does not
|
|
24
|
+
* override the Field.
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue `false`
|
|
27
|
+
*/
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Native `required`. Owned. Also `true` when the Field is required: an explicit `false` does not
|
|
31
|
+
* override the Field.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue `false`
|
|
34
|
+
*/
|
|
35
|
+
required?: boolean;
|
|
36
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
37
|
+
className?: StateValue<string | undefined, FieldState>;
|
|
38
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
39
|
+
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
40
|
+
/** Must render an `<input>`, `<textarea>` or `<select>`: `render={<textarea rows={3} />}`. */
|
|
41
|
+
render?: RenderProp<ComponentPropsWithRef<"input">, FieldState>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The field's native control: an `<input>` (or a `<textarea>` / `<select>` through `render`)
|
|
45
|
+
* wired to the Field: `id` for the Label, `aria-describedby` (the consumer's tokens, the
|
|
46
|
+
* description, the error while shown), an explicit `aria-invalid`, and `name` / `disabled` /
|
|
47
|
+
* `required` from the Field unless given. Everything else passes through, including `onChange`
|
|
48
|
+
* / `value` for a controlled input; the Field's listeners are native and run independently.
|
|
49
|
+
*
|
|
50
|
+
* Owned keys inside a Field (conventions 1.2): `id`, `name`, `disabled`, `required`,
|
|
51
|
+
* `aria-invalid`, `aria-describedby` (token-merged), `data-invalid`, `data-disabled`,
|
|
52
|
+
* `data-required`, `data-pending`.
|
|
53
|
+
*
|
|
54
|
+
* Outside a `Field.Root` it is the plain native control: every prop passes through (`id`
|
|
55
|
+
* included), the library adds no attribute, and the function props receive a state that is
|
|
56
|
+
* never invalid or pending, with `disabled` / `required` from the own props.
|
|
57
|
+
*
|
|
58
|
+
* @see https://ui.funstack.work/components/field
|
|
59
|
+
*/
|
|
60
|
+
export declare function FieldControl({ id: consumerId, name, disabled, required, className, style, render, ...props }: FieldControlProps): import("react").ReactNode;
|
|
61
|
+
export declare namespace FieldControl {
|
|
62
|
+
var displayName: string;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//# sourceMappingURL=field-control.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-control.d.mts","names":[],"sources":["../../src/field/field-control.tsx"],"mappings":";;;;;;;;;iBAmBiB,0BAA0B,KACzC;;;;;EAOA;;;;;;EAMA;;;;;;;EAOA;;;;;;;EAOA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,SAAS,WAAW,gCAAgC;;;;;;;;;;;;;;;;;;;wBA8CtC,eACd,IAAI,YACJ,MACA,UACA,UACA,WACA,OACA,WACG,SACF,oCAAiB;yBATJ"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { useElementCheck } from "../internal/use-element-check.mjs";
|
|
4
|
+
import { useMergedRefs } from "../internal/use-merged-refs.mjs";
|
|
5
|
+
import { FieldContext, fieldDataAttributes } from "../internal/form/field-context.mjs";
|
|
6
|
+
import { useFieldControl } from "../internal/form/use-field-control.mjs";
|
|
7
|
+
import { VALID } from "../internal/form/validity.mjs";
|
|
8
|
+
import { use } from "react";
|
|
9
|
+
//#region src/field/field-control.tsx
|
|
10
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
11
|
+
const CONTROL_TAGS = /* @__PURE__ */ new Set([
|
|
12
|
+
"INPUT",
|
|
13
|
+
"TEXTAREA",
|
|
14
|
+
"SELECT"
|
|
15
|
+
]);
|
|
16
|
+
/**
|
|
17
|
+
* The states the function props receive outside a `Field.Root` (design/components/field-form.md
|
|
18
|
+
* 4.3): never invalid or pending (no validation without a Field), with `disabled` / `required`
|
|
19
|
+
* from the control's own props, as inside a Field and as a standalone Checkbox reports them.
|
|
20
|
+
* One frozen object per combination, indexed `disabled * 2 + required`.
|
|
21
|
+
*/
|
|
22
|
+
const NO_MESSAGES = Object.freeze([]);
|
|
23
|
+
const STANDALONE_STATES = [false, true].flatMap((disabled) => [false, true].map((required) => Object.freeze({
|
|
24
|
+
invalid: false,
|
|
25
|
+
messages: NO_MESSAGES,
|
|
26
|
+
validity: VALID,
|
|
27
|
+
disabled,
|
|
28
|
+
required,
|
|
29
|
+
pending: false
|
|
30
|
+
})));
|
|
31
|
+
function standaloneState(disabled, required) {
|
|
32
|
+
return STANDALONE_STATES[(disabled === true ? 2 : 0) + (required === true ? 1 : 0)];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The field's native control: an `<input>` (or a `<textarea>` / `<select>` through `render`)
|
|
36
|
+
* wired to the Field: `id` for the Label, `aria-describedby` (the consumer's tokens, the
|
|
37
|
+
* description, the error while shown), an explicit `aria-invalid`, and `name` / `disabled` /
|
|
38
|
+
* `required` from the Field unless given. Everything else passes through, including `onChange`
|
|
39
|
+
* / `value` for a controlled input; the Field's listeners are native and run independently.
|
|
40
|
+
*
|
|
41
|
+
* Owned keys inside a Field (conventions 1.2): `id`, `name`, `disabled`, `required`,
|
|
42
|
+
* `aria-invalid`, `aria-describedby` (token-merged), `data-invalid`, `data-disabled`,
|
|
43
|
+
* `data-required`, `data-pending`.
|
|
44
|
+
*
|
|
45
|
+
* Outside a `Field.Root` it is the plain native control: every prop passes through (`id`
|
|
46
|
+
* included), the library adds no attribute, and the function props receive a state that is
|
|
47
|
+
* never invalid or pending, with `disabled` / `required` from the own props.
|
|
48
|
+
*
|
|
49
|
+
* @see https://ui.funstack.work/components/field
|
|
50
|
+
*/
|
|
51
|
+
function FieldControl({ id: consumerId, name, disabled, required, className, style, render, ...props }) {
|
|
52
|
+
const ctx = use(FieldContext);
|
|
53
|
+
const field = useFieldControl({
|
|
54
|
+
labelable: true,
|
|
55
|
+
name,
|
|
56
|
+
disabled,
|
|
57
|
+
required,
|
|
58
|
+
id: consumerId,
|
|
59
|
+
component: "Field.Control"
|
|
60
|
+
});
|
|
61
|
+
const checkElement = useElementCheck(isDev && ((el) => !CONTROL_TAGS.has(el.tagName) ? `Field.Control: expected to render an <input>, <textarea> or <select> but got <${el.tagName.toLowerCase()}>. Validation, labelling and form participation need a native form control.` : null));
|
|
62
|
+
const ref = useMergedRefs(checkElement, field.ref);
|
|
63
|
+
return useRender({
|
|
64
|
+
defaultElement: "input",
|
|
65
|
+
render,
|
|
66
|
+
state: ctx === null ? standaloneState(disabled, required) : ctx.state,
|
|
67
|
+
className,
|
|
68
|
+
style,
|
|
69
|
+
children: void 0,
|
|
70
|
+
props: ctx === null ? {
|
|
71
|
+
...props,
|
|
72
|
+
id: consumerId,
|
|
73
|
+
name,
|
|
74
|
+
disabled,
|
|
75
|
+
required
|
|
76
|
+
} : props,
|
|
77
|
+
libraryProps: ctx === null ? void 0 : {
|
|
78
|
+
id: field.id,
|
|
79
|
+
name: field.name,
|
|
80
|
+
disabled: field.disabled,
|
|
81
|
+
required: field.required,
|
|
82
|
+
...field.attributes,
|
|
83
|
+
...fieldDataAttributes(ctx.state)
|
|
84
|
+
},
|
|
85
|
+
ref
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
FieldControl.displayName = "FieldControl";
|
|
89
|
+
//#endregion
|
|
90
|
+
export { FieldControl };
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=field-control.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-control.mjs","names":[],"sources":["../../src/field/field-control.tsx"],"sourcesContent":["\"use client\";\nimport { use } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { FieldContext, fieldDataAttributes } from \"../internal/form/field-context.js\";\nimport type { FieldState } from \"../internal/form/field-context.js\";\nimport { VALID } from \"../internal/form/validity.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { useFieldControl } from \"../internal/form/use-field-control.js\";\nimport { useMergedRefs } from \"../internal/use-merged-refs.js\";\nimport { useRender } from \"../internal/use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Props of `Field.Control`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport interface FieldControlProps extends Omit<\n ComponentPropsWithRef<\"input\">,\n \"id\" | \"aria-invalid\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Native `id`, used outside a `Field.Root` only. Inside one the Field owns the id (so that\n * `Field.Label` can point at it) and this prop is ignored with a development warning.\n */\n id?: string;\n /**\n * Native `name`.\n *\n * @defaultValue the Field's `name`\n */\n name?: string;\n /**\n * Native `disabled`. Owned. Also `true` when the Field is disabled: an explicit `false` does not\n * override the Field.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /**\n * Native `required`. Owned. Also `true` when the Field is required: an explicit `false` does not\n * override the Field.\n *\n * @defaultValue `false`\n */\n required?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, FieldState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /** Must render an `<input>`, `<textarea>` or `<select>`: `render={<textarea rows={3} />}`. */\n render?: RenderProp<ComponentPropsWithRef<\"input\">, FieldState>;\n}\n\nconst CONTROL_TAGS = new Set([\"INPUT\", \"TEXTAREA\", \"SELECT\"]);\n\n/**\n * The states the function props receive outside a `Field.Root` (design/components/field-form.md\n * 4.3): never invalid or pending (no validation without a Field), with `disabled` / `required`\n * from the control's own props, as inside a Field and as a standalone Checkbox reports them.\n * One frozen object per combination, indexed `disabled * 2 + required`.\n */\nconst NO_MESSAGES: readonly string[] = Object.freeze([]);\nconst STANDALONE_STATES: readonly FieldState[] = [false, true].flatMap((disabled) =>\n [false, true].map((required) =>\n Object.freeze({\n invalid: false,\n messages: NO_MESSAGES,\n validity: VALID,\n disabled,\n required,\n pending: false,\n }),\n ),\n);\n\nfunction standaloneState(disabled: boolean | undefined, required: boolean | undefined) {\n return STANDALONE_STATES[(disabled === true ? 2 : 0) + (required === true ? 1 : 0)]!;\n}\n\n/**\n * The field's native control: an `<input>` (or a `<textarea>` / `<select>` through `render`)\n * wired to the Field: `id` for the Label, `aria-describedby` (the consumer's tokens, the\n * description, the error while shown), an explicit `aria-invalid`, and `name` / `disabled` /\n * `required` from the Field unless given. Everything else passes through, including `onChange`\n * / `value` for a controlled input; the Field's listeners are native and run independently.\n *\n * Owned keys inside a Field (conventions 1.2): `id`, `name`, `disabled`, `required`,\n * `aria-invalid`, `aria-describedby` (token-merged), `data-invalid`, `data-disabled`,\n * `data-required`, `data-pending`.\n *\n * Outside a `Field.Root` it is the plain native control: every prop passes through (`id`\n * included), the library adds no attribute, and the function props receive a state that is\n * never invalid or pending, with `disabled` / `required` from the own props.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport function FieldControl({\n id: consumerId,\n name,\n disabled,\n required,\n className,\n style,\n render,\n ...props\n}: FieldControlProps) {\n const ctx = use(FieldContext);\n const field = useFieldControl({\n labelable: true,\n name,\n disabled,\n required,\n id: consumerId,\n component: \"Field.Control\",\n });\n const checkElement = useElementCheck(\n isDev &&\n ((el) =>\n !CONTROL_TAGS.has(el.tagName)\n ? \"Field.Control: expected to render an <input>, <textarea> or <select> but got \" +\n `<${el.tagName.toLowerCase()}>. Validation, labelling and form participation need a ` +\n \"native form control.\"\n : null),\n );\n const ref = useMergedRefs<HTMLElement>(checkElement, field.ref);\n\n return useRender<ComponentPropsWithRef<\"input\">, FieldState>({\n defaultElement: \"input\",\n render,\n state: ctx === null ? standaloneState(disabled, required) : ctx.state,\n className,\n style,\n children: undefined,\n // Outside a Field the own props are ordinary pass-through: a `render` element's own `id` /\n // `disabled` / `required` win over them, as for any pass-through prop (conventions 1.2).\n props: ctx === null ? { ...props, id: consumerId, name, disabled, required } : props,\n libraryProps:\n ctx === null\n ? undefined\n : {\n id: field.id,\n name: field.name,\n disabled: field.disabled,\n required: field.required,\n ...field.attributes,\n ...fieldDataAttributes(ctx.state),\n },\n ref,\n });\n}\n\nFieldControl.displayName = \"FieldControl\";\n"],"mappings":";;;;;;;;;AAYA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AA4CvC,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAS;CAAY;AAAQ,CAAC;;;;;;;AAQ5D,MAAM,cAAiC,OAAO,OAAO,CAAC,CAAC;AACvD,MAAM,oBAA2C,CAAC,OAAO,IAAI,CAAC,CAAC,SAAS,aACtE,CAAC,OAAO,IAAI,CAAC,CAAC,KAAK,aACjB,OAAO,OAAO;CACZ,SAAS;CACT,UAAU;CACV,UAAU;CACV;CACA;CACA,SAAS;AACX,CAAC,CACH,CACF;AAEA,SAAS,gBAAgB,UAA+B,UAA+B;CACrF,OAAO,mBAAmB,aAAa,OAAO,IAAI,MAAM,aAAa,OAAO,IAAI;AAClF;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,aAAa,EAC3B,IAAI,YACJ,MACA,UACA,UACA,WACA,OACA,QACA,GAAG,SACiB;CACpB,MAAM,MAAM,IAAI,YAAY;CAC5B,MAAM,QAAQ,gBAAgB;EAC5B,WAAW;EACX;EACA;EACA;EACA,IAAI;EACJ,WAAW;CACb,CAAC;CACD,MAAM,eAAe,gBACnB,WACI,OACA,CAAC,aAAa,IAAI,GAAG,OAAO,IACxB,iFACI,GAAG,QAAQ,YAAY,EAAE,+EAE7B,KACV;CACA,MAAM,MAAM,cAA2B,cAAc,MAAM,GAAG;CAE9D,OAAO,UAAsD;EAC3D,gBAAgB;EAChB;EACA,OAAO,QAAQ,OAAO,gBAAgB,UAAU,QAAQ,IAAI,IAAI;EAChE;EACA;EACA,UAAU,KAAA;EAGV,OAAO,QAAQ,OAAO;GAAE,GAAG;GAAO,IAAI;GAAY;GAAM;GAAU;EAAS,IAAI;EAC/E,cACE,QAAQ,OACJ,KAAA,IACA;GACE,IAAI,MAAM;GACV,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,GAAG,MAAM;GACT,GAAG,oBAAoB,IAAI,KAAK;EAClC;EACN;CACF,CAAC;AACH;AAEA,aAAa,cAAc"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { FieldState } from "../internal/form/field-context.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/field/field-description.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props of `Field.Description`.
|
|
7
|
+
*
|
|
8
|
+
* @see https://ui.funstack.work/components/field
|
|
9
|
+
*/
|
|
10
|
+
export interface FieldDescriptionProps extends Omit<ComponentPropsWithRef<"p">, "id" | "className" | "style" | "children"> {
|
|
11
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
12
|
+
className?: StateValue<string | undefined, FieldState>;
|
|
13
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
14
|
+
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
15
|
+
/** Content, or a function of the part's state. */
|
|
16
|
+
children?: StateValue<ReactNode, FieldState>;
|
|
17
|
+
/** Replace the default `<p>` (element form) or take over rendering (function form). */
|
|
18
|
+
render?: RenderProp<ComponentPropsWithRef<"p">, FieldState>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Help text for the field: a `<p>` whose id the control always lists in `aria-describedby`
|
|
22
|
+
* (a dangling reference when no Description is rendered is skipped by assistive technology, so
|
|
23
|
+
* nothing registers and the server HTML is exact).
|
|
24
|
+
*
|
|
25
|
+
* Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,
|
|
26
|
+
* `data-pending`.
|
|
27
|
+
*
|
|
28
|
+
* @see https://ui.funstack.work/components/field
|
|
29
|
+
*/
|
|
30
|
+
export declare function FieldDescription({ className, style, children, render, ...rest }: FieldDescriptionProps): ReactNode;
|
|
31
|
+
export declare namespace FieldDescription {
|
|
32
|
+
var displayName: string;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//# sourceMappingURL=field-description.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-description.d.mts","names":[],"sources":["../../src/field/field-description.tsx"],"mappings":";;;;;;;;;iBAYiB,8BAA8B,KAC7C;;EAIA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,4BAA4B;;;;;;;;;;;;wBAalC,mBACd,WACA,OACA,UACA,WACG,QACF,wBAAqB;yBANR"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { fieldDataAttributes, useFieldContext } from "../internal/form/field-context.mjs";
|
|
4
|
+
//#region src/field/field-description.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Help text for the field: a `<p>` whose id the control always lists in `aria-describedby`
|
|
7
|
+
* (a dangling reference when no Description is rendered is skipped by assistive technology, so
|
|
8
|
+
* nothing registers and the server HTML is exact).
|
|
9
|
+
*
|
|
10
|
+
* Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,
|
|
11
|
+
* `data-pending`.
|
|
12
|
+
*
|
|
13
|
+
* @see https://ui.funstack.work/components/field
|
|
14
|
+
*/
|
|
15
|
+
function FieldDescription({ className, style, children, render, ...rest }) {
|
|
16
|
+
const ctx = useFieldContext("Field.Description");
|
|
17
|
+
return useRender({
|
|
18
|
+
defaultElement: "p",
|
|
19
|
+
render,
|
|
20
|
+
state: ctx.state,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
children,
|
|
24
|
+
props: rest,
|
|
25
|
+
libraryProps: {
|
|
26
|
+
id: ctx.ids.description,
|
|
27
|
+
...fieldDataAttributes(ctx.state)
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
FieldDescription.displayName = "FieldDescription";
|
|
32
|
+
//#endregion
|
|
33
|
+
export { FieldDescription };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=field-description.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-description.mjs","names":[],"sources":["../../src/field/field-description.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { fieldDataAttributes, useFieldContext } from \"../internal/form/field-context.js\";\nimport type { FieldState } from \"../internal/form/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\n\n/**\n * Props of `Field.Description`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport interface FieldDescriptionProps extends Omit<\n ComponentPropsWithRef<\"p\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, FieldState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, FieldState>;\n /** Replace the default `<p>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"p\">, FieldState>;\n}\n\n/**\n * Help text for the field: a `<p>` whose id the control always lists in `aria-describedby`\n * (a dangling reference when no Description is rendered is skipped by assistive technology, so\n * nothing registers and the server HTML is exact).\n *\n * Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport function FieldDescription({\n className,\n style,\n children,\n render,\n ...rest\n}: FieldDescriptionProps) {\n const ctx = useFieldContext(\"Field.Description\");\n return useRender<ComponentPropsWithRef<\"p\">, FieldState>({\n defaultElement: \"p\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: { id: ctx.ids.description, ...fieldDataAttributes(ctx.state) },\n });\n}\n\nFieldDescription.displayName = \"FieldDescription\";\n"],"mappings":";;;;;;;;;;;;;;AAoCA,SAAgB,iBAAiB,EAC/B,WACA,OACA,UACA,QACA,GAAG,QACqB;CACxB,MAAM,MAAM,gBAAgB,mBAAmB;CAC/C,OAAO,UAAkD;EACvD,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GAAE,IAAI,IAAI,IAAI;GAAa,GAAG,oBAAoB,IAAI,KAAK;EAAE;CAC7E,CAAC;AACH;AAEA,iBAAiB,cAAc"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { FieldState } from "../internal/form/field-context.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/field/field-error.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props of `Field.Error`.
|
|
7
|
+
*
|
|
8
|
+
* @see https://ui.funstack.work/components/field
|
|
9
|
+
*/
|
|
10
|
+
export interface FieldErrorProps extends Omit<ComponentPropsWithRef<"div">, "id" | "className" | "style" | "children"> {
|
|
11
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
12
|
+
className?: StateValue<string | undefined, FieldState>;
|
|
13
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
14
|
+
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
15
|
+
/**
|
|
16
|
+
* Rendered only while `state.invalid`. A function gets the state:
|
|
17
|
+
* `({ validity, messages }) => validity.valueMissing ? "Enter your email" : messages.join(" ")`.
|
|
18
|
+
* Must not suspend (urgent render, design 2.4).
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue `state.messages` joined by a space
|
|
21
|
+
*/
|
|
22
|
+
children?: StateValue<ReactNode, FieldState>;
|
|
23
|
+
/** Replace the default `<div>` (element form) or take over rendering (function form). */
|
|
24
|
+
render?: RenderProp<ComponentPropsWithRef<"div">, FieldState>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The field's error message: a `div` rendered only while an error is shown, whose id the control
|
|
28
|
+
* then lists in `aria-describedby`. No role and no live region: the library focuses the first
|
|
29
|
+
* invalid control after a submission attempt, and focus reads the description (design 4.2).
|
|
30
|
+
* Its presence lets the Field cancel the platform's validation bubble.
|
|
31
|
+
*
|
|
32
|
+
* Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,
|
|
33
|
+
* `data-pending`.
|
|
34
|
+
*
|
|
35
|
+
* @see https://ui.funstack.work/components/field
|
|
36
|
+
*/
|
|
37
|
+
export declare function FieldError({ className, style, children, render, ...rest }: FieldErrorProps): ReactNode;
|
|
38
|
+
export declare namespace FieldError {
|
|
39
|
+
var displayName: string;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//# sourceMappingURL=field-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-error.d.mts","names":[],"sources":["../../src/field/field-error.tsx"],"mappings":";;;;;;;;;iBAaiB,wBAAwB,KACvC;;EAIA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;;;;;;;EAQ9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;;;wBAkBpC,aACd,WACA,OACA,UACA,WACG,QACF,kBAAe;yBANF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { fieldDataAttributes, useFieldContext } from "../internal/form/field-context.mjs";
|
|
4
|
+
import { useLayoutEffect } from "react";
|
|
5
|
+
//#region src/field/field-error.tsx
|
|
6
|
+
function defaultChildren(state) {
|
|
7
|
+
return state.messages.join(" ");
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The field's error message: a `div` rendered only while an error is shown, whose id the control
|
|
11
|
+
* then lists in `aria-describedby`. No role and no live region: the library focuses the first
|
|
12
|
+
* invalid control after a submission attempt, and focus reads the description (design 4.2).
|
|
13
|
+
* Its presence lets the Field cancel the platform's validation bubble.
|
|
14
|
+
*
|
|
15
|
+
* Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,
|
|
16
|
+
* `data-pending`.
|
|
17
|
+
*
|
|
18
|
+
* @see https://ui.funstack.work/components/field
|
|
19
|
+
*/
|
|
20
|
+
function FieldError({ className, style, children = defaultChildren, render, ...rest }) {
|
|
21
|
+
const ctx = useFieldContext("Field.Error");
|
|
22
|
+
const { registerError } = ctx;
|
|
23
|
+
useLayoutEffect(registerError, [registerError]);
|
|
24
|
+
const element = useRender({
|
|
25
|
+
defaultElement: "div",
|
|
26
|
+
render,
|
|
27
|
+
state: ctx.state,
|
|
28
|
+
className,
|
|
29
|
+
style,
|
|
30
|
+
children,
|
|
31
|
+
props: rest,
|
|
32
|
+
libraryProps: {
|
|
33
|
+
id: ctx.ids.error,
|
|
34
|
+
...fieldDataAttributes(ctx.state)
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return ctx.state.invalid ? element : null;
|
|
38
|
+
}
|
|
39
|
+
FieldError.displayName = "FieldError";
|
|
40
|
+
//#endregion
|
|
41
|
+
export { FieldError };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=field-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-error.mjs","names":[],"sources":["../../src/field/field-error.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { fieldDataAttributes, useFieldContext } from \"../internal/form/field-context.js\";\nimport type { FieldState } from \"../internal/form/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\n\n/**\n * Props of `Field.Error`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport interface FieldErrorProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, FieldState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /**\n * Rendered only while `state.invalid`. A function gets the state:\n * `({ validity, messages }) => validity.valueMissing ? \"Enter your email\" : messages.join(\" \")`.\n * Must not suspend (urgent render, design 2.4).\n *\n * @defaultValue `state.messages` joined by a space\n */\n children?: StateValue<ReactNode, FieldState>;\n /** Replace the default `<div>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"div\">, FieldState>;\n}\n\nfunction defaultChildren(state: FieldState): ReactNode {\n return state.messages.join(\" \");\n}\n\n/**\n * The field's error message: a `div` rendered only while an error is shown, whose id the control\n * then lists in `aria-describedby`. No role and no live region: the library focuses the first\n * invalid control after a submission attempt, and focus reads the description (design 4.2).\n * Its presence lets the Field cancel the platform's validation bubble.\n *\n * Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport function FieldError({\n className,\n style,\n children = defaultChildren,\n render,\n ...rest\n}: FieldErrorProps) {\n const ctx = useFieldContext(\"Field.Error\");\n const { registerError } = ctx;\n useLayoutEffect(registerError, [registerError]);\n const element = useRender<ComponentPropsWithRef<\"div\">, FieldState>({\n defaultElement: \"div\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: { id: ctx.ids.error, ...fieldDataAttributes(ctx.state) },\n });\n return ctx.state.invalid ? element : null;\n}\n\nFieldError.displayName = \"FieldError\";\n"],"mappings":";;;;;AAiCA,SAAS,gBAAgB,OAA8B;CACrD,OAAO,MAAM,SAAS,KAAK,GAAG;AAChC;;;;;;;;;;;;AAaA,SAAgB,WAAW,EACzB,WACA,OACA,WAAW,iBACX,QACA,GAAG,QACe;CAClB,MAAM,MAAM,gBAAgB,aAAa;CACzC,MAAM,EAAE,kBAAkB;CAC1B,gBAAgB,eAAe,CAAC,aAAa,CAAC;CAC9C,MAAM,UAAU,UAAoD;EAClE,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GAAE,IAAI,IAAI,IAAI;GAAO,GAAG,oBAAoB,IAAI,KAAK;EAAE;CACvE,CAAC;CACD,OAAO,IAAI,MAAM,UAAU,UAAU;AACvC;AAEA,WAAW,cAAc"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { FieldState } from "../internal/form/field-context.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/field/field-label.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props of `Field.Label`.
|
|
7
|
+
*
|
|
8
|
+
* @see https://ui.funstack.work/components/field
|
|
9
|
+
*/
|
|
10
|
+
export interface FieldLabelProps extends Omit<ComponentPropsWithRef<"label">, "htmlFor" | "id" | "className" | "style" | "children"> {
|
|
11
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
12
|
+
className?: StateValue<string | undefined, FieldState>;
|
|
13
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
14
|
+
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
15
|
+
/** Content, or a function of the part's state. */
|
|
16
|
+
children?: StateValue<ReactNode, FieldState>;
|
|
17
|
+
/** Must render a `<label>`. */
|
|
18
|
+
render?: RenderProp<ComponentPropsWithRef<"label">, FieldState>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The field's visible name: `<label for>` pointing at the control. For a group control (a
|
|
22
|
+
* RadioGroup or CheckboxGroup `<fieldset>`) it renders no `for` once the group registered, and
|
|
23
|
+
* the group names itself with `aria-labelledby` → this id (design 4.2).
|
|
24
|
+
*
|
|
25
|
+
* A `<label for>` on a `<button>` forwards a click to it. For a button control (MultiSelect's
|
|
26
|
+
* Trigger, multi-select.md B.10) the click is cancelled and the button is focused instead, as a
|
|
27
|
+
* label focuses a `<select>` without opening it.
|
|
28
|
+
*
|
|
29
|
+
* Owned keys (conventions 1.2): `id`, `htmlFor`, `onClick` (composed), `data-invalid`,
|
|
30
|
+
* `data-disabled`, `data-required`, `data-pending`.
|
|
31
|
+
*
|
|
32
|
+
* @see https://ui.funstack.work/components/field
|
|
33
|
+
*/
|
|
34
|
+
export declare function FieldLabel({ className, style, children, render, ...rest }: FieldLabelProps): ReactNode;
|
|
35
|
+
export declare namespace FieldLabel {
|
|
36
|
+
var displayName: string;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//# sourceMappingURL=field-label.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-label.d.mts","names":[],"sources":["../../src/field/field-label.tsx"],"mappings":";;;;;;;;;iBAeiB,wBAAwB,KACvC;;EAIA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,gCAAgC;;;;;;;;;;;;;;;;wBAiBtC,aAAa,WAAW,OAAO,UAAU,WAAW,QAAQ,kBAAe;yBAA3E"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { useElementCheck } from "../internal/use-element-check.mjs";
|
|
4
|
+
import { fieldDataAttributes, useFieldContext } from "../internal/form/field-context.mjs";
|
|
5
|
+
//#region src/field/field-label.tsx
|
|
6
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
7
|
+
/**
|
|
8
|
+
* The field's visible name: `<label for>` pointing at the control. For a group control (a
|
|
9
|
+
* RadioGroup or CheckboxGroup `<fieldset>`) it renders no `for` once the group registered, and
|
|
10
|
+
* the group names itself with `aria-labelledby` → this id (design 4.2).
|
|
11
|
+
*
|
|
12
|
+
* A `<label for>` on a `<button>` forwards a click to it. For a button control (MultiSelect's
|
|
13
|
+
* Trigger, multi-select.md B.10) the click is cancelled and the button is focused instead, as a
|
|
14
|
+
* label focuses a `<select>` without opening it.
|
|
15
|
+
*
|
|
16
|
+
* Owned keys (conventions 1.2): `id`, `htmlFor`, `onClick` (composed), `data-invalid`,
|
|
17
|
+
* `data-disabled`, `data-required`, `data-pending`.
|
|
18
|
+
*
|
|
19
|
+
* @see https://ui.funstack.work/components/field
|
|
20
|
+
*/
|
|
21
|
+
function FieldLabel({ className, style, children, render, ...rest }) {
|
|
22
|
+
const ctx = useFieldContext("Field.Label");
|
|
23
|
+
const ref = useElementCheck(isDev && ((el) => el.tagName !== "LABEL" ? `Field.Label: expected to render a <label> element but got <${el.tagName.toLowerCase()}>. Label activation and the control's accessible name need a real <label>.` : null));
|
|
24
|
+
return useRender({
|
|
25
|
+
defaultElement: "label",
|
|
26
|
+
render,
|
|
27
|
+
state: ctx.state,
|
|
28
|
+
className,
|
|
29
|
+
style,
|
|
30
|
+
children,
|
|
31
|
+
props: rest,
|
|
32
|
+
libraryProps: {
|
|
33
|
+
id: ctx.ids.label,
|
|
34
|
+
htmlFor: ctx.labelable ? ctx.ids.control : void 0,
|
|
35
|
+
onClick: (event) => {
|
|
36
|
+
const control = ctx.controlElement();
|
|
37
|
+
if (!(control instanceof HTMLButtonElement) || event.defaultPrevented) return;
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
if (!control.disabled) control.focus();
|
|
40
|
+
},
|
|
41
|
+
...fieldDataAttributes(ctx.state)
|
|
42
|
+
},
|
|
43
|
+
ref
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
FieldLabel.displayName = "FieldLabel";
|
|
47
|
+
//#endregion
|
|
48
|
+
export { FieldLabel };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=field-label.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-label.mjs","names":[],"sources":["../../src/field/field-label.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { fieldDataAttributes, useFieldContext } from \"../internal/form/field-context.js\";\nimport type { FieldState } from \"../internal/form/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { useRender } from \"../internal/use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Props of `Field.Label`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport interface FieldLabelProps extends Omit<\n ComponentPropsWithRef<\"label\">,\n \"htmlFor\" | \"id\" | \"className\" | \"style\" | \"children\"\n> {\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, FieldState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, FieldState>;\n /** Must render a `<label>`. */\n render?: RenderProp<ComponentPropsWithRef<\"label\">, FieldState>;\n}\n\n/**\n * The field's visible name: `<label for>` pointing at the control. For a group control (a\n * RadioGroup or CheckboxGroup `<fieldset>`) it renders no `for` once the group registered, and\n * the group names itself with `aria-labelledby` → this id (design 4.2).\n *\n * A `<label for>` on a `<button>` forwards a click to it. For a button control (MultiSelect's\n * Trigger, multi-select.md B.10) the click is cancelled and the button is focused instead, as a\n * label focuses a `<select>` without opening it.\n *\n * Owned keys (conventions 1.2): `id`, `htmlFor`, `onClick` (composed), `data-invalid`,\n * `data-disabled`, `data-required`, `data-pending`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport function FieldLabel({ className, style, children, render, ...rest }: FieldLabelProps) {\n const ctx = useFieldContext(\"Field.Label\");\n const ref = useElementCheck(\n isDev &&\n ((el) =>\n el.tagName !== \"LABEL\"\n ? `Field.Label: expected to render a <label> element but got <${el.tagName.toLowerCase()}>. ` +\n \"Label activation and the control's accessible name need a real <label>.\"\n : null),\n );\n return useRender<ComponentPropsWithRef<\"label\">, FieldState>({\n defaultElement: \"label\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n id: ctx.ids.label,\n htmlFor: ctx.labelable ? ctx.ids.control : undefined,\n onClick: (event: MouseEvent<HTMLLabelElement>) => {\n const control = ctx.controlElement();\n if (!(control instanceof HTMLButtonElement) || event.defaultPrevented) return;\n event.preventDefault();\n if (!control.disabled) control.focus();\n },\n ...fieldDataAttributes(ctx.state),\n },\n ref,\n });\n}\n\nFieldLabel.displayName = \"FieldLabel\";\n"],"mappings":";;;;;AAQA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;;AAmCvC,SAAgB,WAAW,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,QAAyB;CAC3F,MAAM,MAAM,gBAAgB,aAAa;CACzC,MAAM,MAAM,gBACV,WACI,OACA,GAAG,YAAY,UACX,8DAA8D,GAAG,QAAQ,YAAY,EAAE,8EAEvF,KACV;CACA,OAAO,UAAsD;EAC3D,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,IAAI,IAAI,IAAI;GACZ,SAAS,IAAI,YAAY,IAAI,IAAI,UAAU,KAAA;GAC3C,UAAU,UAAwC;IAChD,MAAM,UAAU,IAAI,eAAe;IACnC,IAAI,EAAE,mBAAmB,sBAAsB,MAAM,kBAAkB;IACvE,MAAM,eAAe;IACrB,IAAI,CAAC,QAAQ,UAAU,QAAQ,MAAM;GACvC;GACA,GAAG,oBAAoB,IAAI,KAAK;EAClC;EACA;CACF,CAAC;AACH;AAEA,WAAW,cAAc"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { FieldErrorValue, FieldValidity } from "../internal/form/validity.mjs";
|
|
3
|
+
import { FieldState } from "../internal/form/field-context.mjs";
|
|
4
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
5
|
+
//#region src/field/field-root.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* A custom constraint: receives the field's submitted value (`formData.get(name)` as a string,
|
|
8
|
+
* `""` when absent) and the whole form's `FormData`. Return a message (or several) for an error,
|
|
9
|
+
* `null` / `undefined` / `""` for none.
|
|
10
|
+
*/
|
|
11
|
+
export type FieldValidate = (value: string, formData: FormData) => FieldErrorValue;
|
|
12
|
+
/**
|
|
13
|
+
* Props of `Field.Root`.
|
|
14
|
+
*
|
|
15
|
+
* @see https://ui.funstack.work/components/field
|
|
16
|
+
*/
|
|
17
|
+
export interface FieldRootProps extends Omit<ComponentPropsWithRef<"div">, "className" | "style" | "children"> {
|
|
18
|
+
/** Form field name: the control's default `name`, the key in `Form.Root errors`, and the entry `validate` reads. */
|
|
19
|
+
name?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Disables the control (native `disabled`) and marks every part `data-disabled`.
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue `false`
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Makes the control `required` (native) and marks every part `data-required`.
|
|
28
|
+
*
|
|
29
|
+
* @defaultValue `false`
|
|
30
|
+
*/
|
|
31
|
+
required?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* A custom constraint, written into the control with `setCustomValidity`. Sync. Receives the
|
|
34
|
+
* field's submitted value (`formData.get(name)` as a string, `""` when absent) and the whole
|
|
35
|
+
* form's `FormData`, so a cross-field rule can read the other field. Runs at mount, on every
|
|
36
|
+
* `input` / `change` in the form (and a FUNSTACK control's value change), on blur, after a
|
|
37
|
+
* reset, on a submission attempt, and in every commit in which this prop changed identity, so
|
|
38
|
+
* a rule that reads outside state (a list that loads, a sibling value in React state) updates
|
|
39
|
+
* on render. An inline function therefore re-runs on every render of the Field; wrap it in
|
|
40
|
+
* `useCallback` to re-run only when its inputs change. Return a string
|
|
41
|
+
* or strings for an error, `null` / `undefined` / `""` for none. Shown when the platform's
|
|
42
|
+
* `:user-invalid` heuristic says so, like a native constraint. Not serialisable: a Field with
|
|
43
|
+
* `validate` is rendered from a client component.
|
|
44
|
+
*/
|
|
45
|
+
validate?: FieldValidate;
|
|
46
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
47
|
+
className?: StateValue<string | undefined, FieldState>;
|
|
48
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
49
|
+
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
50
|
+
/** Content, or a function of the part's state. */
|
|
51
|
+
children?: StateValue<ReactNode, FieldState>;
|
|
52
|
+
/** Replace the default `<div>` (element form) or take over rendering (function form). */
|
|
53
|
+
render?: RenderProp<ComponentPropsWithRef<"div">, FieldState>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The field: a `div` that owns the ids, the urgent validity mirror, the custom-validity slot
|
|
57
|
+
* (`validate` and the server error), the control registration and the native listeners
|
|
58
|
+
* (design/components/field-form.md 2, 14). `data-pending` is the enclosing form's submission
|
|
59
|
+
* (`useFormStatus`), the one part that folds the form channel into its own state, because a
|
|
60
|
+
* Field has no action of its own.
|
|
61
|
+
*
|
|
62
|
+
* Owned keys (conventions 1.2): `data-invalid`, `data-disabled`, `data-required`, `data-pending`.
|
|
63
|
+
*
|
|
64
|
+
* @see https://ui.funstack.work/components/field
|
|
65
|
+
*/
|
|
66
|
+
export declare function FieldRoot({ name, disabled, required, validate, className, style, children, render, ...rest }: FieldRootProps): import("react").JSX.Element;
|
|
67
|
+
export declare namespace FieldRoot {
|
|
68
|
+
var displayName: string;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export type { FieldState, FieldValidity };
|
|
72
|
+
//# sourceMappingURL=field-root.d.mts.map
|