@funstack/ui 0.1.0-alpha.2 → 0.1.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -1
- package/dist/accordion/accordion-context.mjs.map +1 -1
- package/dist/accordion/accordion-item.d.mts +22 -4
- package/dist/accordion/accordion-item.d.mts.map +1 -1
- package/dist/accordion/accordion-item.mjs +32 -10
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.d.mts +19 -4
- package/dist/accordion/accordion-panel.d.mts.map +1 -1
- package/dist/accordion/accordion-panel.mjs +8 -6
- package/dist/accordion/accordion-panel.mjs.map +1 -1
- package/dist/accordion/accordion-root.d.mts +39 -5
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +75 -67
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.d.mts +12 -4
- package/dist/accordion/accordion-trigger.d.mts.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +14 -28
- package/dist/accordion/accordion-trigger.mjs.map +1 -1
- package/dist/accordion/index.d.mts +2 -0
- package/dist/accordion/index.d.mts.map +1 -1
- package/dist/accordion/index.mjs +2 -0
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/alert-dialog/alert-dialog-action.d.mts +73 -0
- package/dist/alert-dialog/alert-dialog-action.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-action.mjs +23 -0
- package/dist/alert-dialog/alert-dialog-action.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-cancel.d.mts +31 -0
- package/dist/alert-dialog/alert-dialog-cancel.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-cancel.mjs +50 -0
- package/dist/alert-dialog/alert-dialog-cancel.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-context.mjs +24 -0
- package/dist/alert-dialog/alert-dialog-context.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-description.d.mts +25 -0
- package/dist/alert-dialog/alert-dialog-description.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-description.mjs +20 -0
- package/dist/alert-dialog/alert-dialog-description.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-form.d.mts +27 -0
- package/dist/alert-dialog/alert-dialog-form.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-form.mjs +22 -0
- package/dist/alert-dialog/alert-dialog-form.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-popup.d.mts +42 -0
- package/dist/alert-dialog/alert-dialog-popup.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-popup.mjs +53 -0
- package/dist/alert-dialog/alert-dialog-popup.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-root.d.mts +31 -0
- package/dist/alert-dialog/alert-dialog-root.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-root.mjs +22 -0
- package/dist/alert-dialog/alert-dialog-root.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-title.d.mts +23 -0
- package/dist/alert-dialog/alert-dialog-title.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-title.mjs +18 -0
- package/dist/alert-dialog/alert-dialog-title.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-trigger.d.mts +23 -0
- package/dist/alert-dialog/alert-dialog-trigger.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-trigger.mjs +18 -0
- package/dist/alert-dialog/alert-dialog-trigger.mjs.map +1 -0
- package/dist/alert-dialog/index.d.mts +33 -0
- package/dist/alert-dialog/index.d.mts.map +1 -0
- package/dist/alert-dialog/index.mjs +33 -0
- package/dist/alert-dialog/index.mjs.map +1 -0
- package/dist/bin/skill-installer.d.mts +1 -0
- package/dist/bin/skill-installer.mjs +12 -0
- package/dist/bin/skill-installer.mjs.map +1 -0
- package/dist/button/button.d.mts +118 -0
- package/dist/button/button.d.mts.map +1 -0
- package/dist/button/button.mjs +98 -0
- package/dist/button/button.mjs.map +1 -0
- package/dist/button/index.d.mts +3 -0
- package/dist/button/index.mjs +1 -0
- package/dist/checkbox/checkbox.d.mts +32 -9
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +25 -50
- package/dist/checkbox/checkbox.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts +20 -5
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +25 -27
- package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.d.mts +10 -0
- package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.mjs +3 -6
- package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.d.mts +22 -5
- package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +17 -13
- package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +37 -7
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +102 -102
- package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
- package/dist/checkbox-group/index.d.mts +2 -0
- package/dist/checkbox-group/index.d.mts.map +1 -1
- package/dist/checkbox-group/index.mjs +2 -0
- package/dist/checkbox-group/index.mjs.map +1 -1
- package/dist/collapsible/collapsible-context.mjs +8 -0
- package/dist/collapsible/collapsible-context.mjs.map +1 -0
- package/dist/collapsible/collapsible-panel.d.mts +53 -0
- package/dist/collapsible/collapsible-panel.d.mts.map +1 -0
- package/dist/collapsible/collapsible-panel.mjs +41 -0
- package/dist/collapsible/collapsible-panel.mjs.map +1 -0
- package/dist/collapsible/collapsible-root.d.mts +108 -0
- package/dist/collapsible/collapsible-root.d.mts.map +1 -0
- package/dist/collapsible/collapsible-root.mjs +147 -0
- package/dist/collapsible/collapsible-root.mjs.map +1 -0
- package/dist/collapsible/collapsible-trigger.d.mts +45 -0
- package/dist/collapsible/collapsible-trigger.d.mts.map +1 -0
- package/dist/collapsible/collapsible-trigger.mjs +62 -0
- package/dist/collapsible/collapsible-trigger.mjs.map +1 -0
- package/dist/collapsible/index.d.mts +21 -0
- package/dist/collapsible/index.d.mts.map +1 -0
- package/dist/collapsible/index.mjs +21 -0
- package/dist/collapsible/index.mjs.map +1 -0
- package/dist/combobox/chip-text.mjs +24 -0
- package/dist/combobox/chip-text.mjs.map +1 -0
- package/dist/combobox/combobox-chips.d.mts +159 -0
- package/dist/combobox/combobox-chips.d.mts.map +1 -0
- package/dist/combobox/combobox-chips.mjs +198 -0
- package/dist/combobox/combobox-chips.mjs.map +1 -0
- package/dist/combobox/combobox-clear.d.mts +29 -5
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +17 -8
- package/dist/combobox/combobox-clear.mjs.map +1 -1
- package/dist/combobox/combobox-context.mjs +4 -5
- package/dist/combobox/combobox-context.mjs.map +1 -1
- package/dist/combobox/combobox-group.d.mts +49 -1
- package/dist/combobox/combobox-group.d.mts.map +1 -1
- package/dist/combobox/combobox-group.mjs +14 -3
- package/dist/combobox/combobox-group.mjs.map +1 -1
- package/dist/combobox/combobox-input.d.mts +27 -5
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +53 -13
- package/dist/combobox/combobox-input.mjs.map +1 -1
- package/dist/combobox/combobox-keyboard.mjs +127 -0
- package/dist/combobox/combobox-keyboard.mjs.map +1 -0
- package/dist/combobox/combobox-label.d.mts +18 -1
- package/dist/combobox/combobox-label.d.mts.map +1 -1
- package/dist/combobox/combobox-label.mjs +4 -1
- package/dist/combobox/combobox-label.mjs.map +1 -1
- package/dist/combobox/combobox-list.d.mts +15 -1
- package/dist/combobox/combobox-list.d.mts.map +1 -1
- package/dist/combobox/combobox-list.mjs +13 -13
- package/dist/combobox/combobox-list.mjs.map +1 -1
- package/dist/combobox/combobox-option.d.mts +30 -5
- package/dist/combobox/combobox-option.d.mts.map +1 -1
- package/dist/combobox/combobox-option.mjs +9 -5
- package/dist/combobox/combobox-option.mjs.map +1 -1
- package/dist/combobox/combobox-popup.d.mts +24 -3
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +24 -29
- package/dist/combobox/combobox-popup.mjs.map +1 -1
- package/dist/combobox/combobox-root.d.mts +183 -43
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +476 -270
- package/dist/combobox/combobox-root.mjs.map +1 -1
- package/dist/combobox/combobox-trigger.d.mts +36 -8
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +50 -41
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/combobox/index.d.mts +13 -5
- package/dist/combobox/index.d.mts.map +1 -1
- package/dist/combobox/index.mjs +13 -5
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/combobox/use-combobox-form.mjs +53 -0
- package/dist/combobox/use-combobox-form.mjs.map +1 -0
- package/dist/combobox/use-combobox-text.mjs +43 -0
- package/dist/combobox/use-combobox-text.mjs.map +1 -0
- package/dist/csp/csp-provider.d.mts +33 -0
- package/dist/csp/csp-provider.d.mts.map +1 -0
- package/dist/csp/csp-provider.mjs +26 -0
- package/dist/csp/csp-provider.mjs.map +1 -0
- package/dist/csp/index.d.mts +3 -0
- package/dist/csp/index.mjs +3 -0
- package/dist/csp/style-hashes.d.mts +21 -0
- package/dist/csp/style-hashes.d.mts.map +1 -0
- package/dist/csp/style-hashes.mjs +23 -0
- package/dist/csp/style-hashes.mjs.map +1 -0
- package/dist/dialog/dialog-close.d.mts +56 -12
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +52 -55
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-context.d.mts +2 -0
- package/dist/dialog/dialog-context.mjs +14 -2
- package/dist/dialog/dialog-context.mjs.map +1 -1
- package/dist/dialog/dialog-description.d.mts +14 -1
- package/dist/dialog/dialog-description.d.mts.map +1 -1
- package/dist/dialog/dialog-description.mjs +10 -4
- package/dist/dialog/dialog-description.mjs.map +1 -1
- package/dist/dialog/dialog-dismiss.mjs +108 -0
- package/dist/dialog/dialog-dismiss.mjs.map +1 -0
- package/dist/dialog/dialog-form.d.mts +43 -11
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +64 -37
- package/dist/dialog/dialog-form.mjs.map +1 -1
- package/dist/dialog/dialog-popup.d.mts +47 -14
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +167 -242
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts +54 -19
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +74 -92
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-title.d.mts +13 -1
- package/dist/dialog/dialog-title.d.mts.map +1 -1
- package/dist/dialog/dialog-title.mjs +10 -4
- package/dist/dialog/dialog-title.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +30 -6
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +50 -28
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/dialog/index.d.mts +7 -3
- package/dist/dialog/index.d.mts.map +1 -1
- package/dist/dialog/index.mjs +7 -3
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/docs/components/accordion.md +428 -0
- package/dist/docs/components/alert-dialog.md +546 -0
- package/dist/docs/components/button.md +511 -0
- package/dist/docs/components/checkbox-group.md +483 -0
- package/dist/docs/components/checkbox.md +373 -0
- package/dist/docs/components/collapsible.md +408 -0
- package/dist/docs/components/combobox.md +960 -0
- package/dist/docs/components/context-menu.md +524 -0
- package/dist/docs/components/dialog.md +694 -0
- package/dist/docs/components/field.md +765 -0
- package/dist/docs/components/hover-card.md +494 -0
- package/dist/docs/components/menu.md +670 -0
- package/dist/docs/components/meter.md +313 -0
- package/dist/docs/components/multi-select.md +622 -0
- package/dist/docs/components/number-field.md +528 -0
- package/dist/docs/components/popover.md +656 -0
- package/dist/docs/components/progress.md +450 -0
- package/dist/docs/components/radio-group.md +457 -0
- package/dist/docs/components/select.md +670 -0
- package/dist/docs/components/separator.md +182 -0
- package/dist/docs/components/slider.md +558 -0
- package/dist/docs/components/switch.md +311 -0
- package/dist/docs/components/tabs.md +473 -0
- package/dist/docs/components/toast.md +602 -0
- package/dist/docs/components/toggle-group.md +341 -0
- package/dist/docs/components/toggle.md +245 -0
- package/dist/docs/components/toolbar.md +390 -0
- package/dist/docs/components/tooltip.md +494 -0
- package/dist/docs/concepts/action-props.md +281 -0
- package/dist/docs/concepts/ai-agents.md +56 -0
- package/dist/docs/concepts/browser-owned-state.md +133 -0
- package/dist/docs/concepts/content-security-policy.md +69 -0
- package/dist/docs/concepts/experimental.md +36 -0
- package/dist/docs/concepts/pending-and-optimistic.md +263 -0
- package/dist/docs/concepts/render.md +23 -0
- package/dist/docs/concepts/server-components.md +132 -0
- package/dist/docs/concepts/suspense.md +129 -0
- package/dist/docs/concepts/transitions.md +112 -0
- package/dist/docs/getting-started.md +102 -0
- package/dist/docs/index.md +187 -0
- package/dist/docs/roadmap.md +144 -0
- package/dist/docs/why.md +104 -0
- package/dist/field/field-control.d.mts +65 -0
- package/dist/field/field-control.d.mts.map +1 -0
- package/dist/field/field-control.mjs +92 -0
- package/dist/field/field-control.mjs.map +1 -0
- package/dist/field/field-description.d.mts +35 -0
- package/dist/field/field-description.d.mts.map +1 -0
- package/dist/field/field-description.mjs +35 -0
- package/dist/field/field-description.mjs.map +1 -0
- package/dist/field/field-error.d.mts +42 -0
- package/dist/field/field-error.d.mts.map +1 -0
- package/dist/field/field-error.mjs +43 -0
- package/dist/field/field-error.mjs.map +1 -0
- package/dist/field/field-label.d.mts +39 -0
- package/dist/field/field-label.d.mts.map +1 -0
- package/dist/field/field-label.mjs +50 -0
- package/dist/field/field-label.mjs.map +1 -0
- package/dist/field/field-root.d.mts +72 -0
- package/dist/field/field-root.d.mts.map +1 -0
- package/dist/field/field-root.mjs +309 -0
- package/dist/field/field-root.mjs.map +1 -0
- package/dist/field/index.d.mts +27 -0
- package/dist/field/index.d.mts.map +1 -0
- package/dist/field/index.mjs +26 -0
- package/dist/field/index.mjs.map +1 -0
- package/dist/field/use-server-error-visibility.mjs +44 -0
- package/dist/field/use-server-error-visibility.mjs.map +1 -0
- package/dist/form/form-root.d.mts +74 -0
- package/dist/form/form-root.d.mts.map +1 -0
- package/dist/form/form-root.mjs +158 -0
- package/dist/form/form-root.mjs.map +1 -0
- package/dist/form/form-submit.d.mts +56 -0
- package/dist/form/form-submit.d.mts.map +1 -0
- package/dist/form/form-submit.mjs +53 -0
- package/dist/form/form-submit.mjs.map +1 -0
- package/dist/form/index.d.mts +18 -0
- package/dist/form/index.d.mts.map +1 -0
- package/dist/form/index.mjs +18 -0
- package/dist/form/index.mjs.map +1 -0
- package/dist/hover-card/hover-card-context.mjs +13 -0
- package/dist/hover-card/hover-card-context.mjs.map +1 -0
- package/dist/hover-card/hover-card-popup.d.mts +102 -0
- package/dist/hover-card/hover-card-popup.d.mts.map +1 -0
- package/dist/hover-card/hover-card-popup.mjs +80 -0
- package/dist/hover-card/hover-card-popup.mjs.map +1 -0
- package/dist/hover-card/hover-card-root.d.mts +94 -0
- package/dist/hover-card/hover-card-root.d.mts.map +1 -0
- package/dist/hover-card/hover-card-root.mjs +74 -0
- package/dist/hover-card/hover-card-root.mjs.map +1 -0
- package/dist/hover-card/hover-card-trigger.d.mts +65 -0
- package/dist/hover-card/hover-card-trigger.d.mts.map +1 -0
- package/dist/hover-card/hover-card-trigger.mjs +109 -0
- package/dist/hover-card/hover-card-trigger.mjs.map +1 -0
- package/dist/hover-card/index.d.mts +24 -0
- package/dist/hover-card/index.d.mts.map +1 -0
- package/dist/hover-card/index.mjs +24 -0
- package/dist/hover-card/index.mjs.map +1 -0
- package/dist/hover-card/use-hover-card-interest.mjs +242 -0
- package/dist/hover-card/use-hover-card-interest.mjs.map +1 -0
- package/dist/index.d.mts +100 -13
- package/dist/index.mjs +19 -1
- package/dist/internal/{action-details.mjs → action/action-details.mjs} +1 -1
- package/dist/internal/action/action-details.mjs.map +1 -0
- package/dist/internal/action/call-urgent-handler.mjs +32 -0
- package/dist/internal/action/call-urgent-handler.mjs.map +1 -0
- package/dist/internal/action/report-dropped.mjs +27 -0
- package/dist/internal/action/report-dropped.mjs.map +1 -0
- package/dist/internal/action/use-action-trigger.mjs +67 -0
- package/dist/internal/action/use-action-trigger.mjs.map +1 -0
- package/dist/internal/action/use-connected.mjs +24 -0
- package/dist/internal/action/use-connected.mjs.map +1 -0
- package/dist/internal/action/use-controllable-action.mjs +153 -0
- package/dist/internal/action/use-controllable-action.mjs.map +1 -0
- package/dist/internal/action/use-multiple-selection.mjs +83 -0
- package/dist/internal/action/use-multiple-selection.mjs.map +1 -0
- package/dist/internal/action/use-pure-trigger.mjs +34 -0
- package/dist/internal/action/use-pure-trigger.mjs.map +1 -0
- package/dist/internal/action/use-step-commit.mjs +147 -0
- package/dist/internal/action/use-step-commit.mjs.map +1 -0
- package/dist/internal/announce.mjs +20 -0
- package/dist/internal/announce.mjs.map +1 -0
- package/dist/internal/arrow-keys.mjs +21 -0
- package/dist/internal/arrow-keys.mjs.map +1 -0
- package/dist/internal/csp-context.mjs +8 -0
- package/dist/internal/csp-context.mjs.map +1 -0
- package/dist/internal/decimal.mjs +33 -0
- package/dist/internal/decimal.mjs.map +1 -0
- package/dist/internal/details-summary.mjs +56 -0
- package/dist/internal/details-summary.mjs.map +1 -0
- package/dist/internal/dev-warn.mjs +17 -0
- package/dist/internal/dev-warn.mjs.map +1 -0
- package/dist/internal/dom-order.mjs +17 -0
- package/dist/internal/dom-order.mjs.map +1 -0
- package/dist/internal/form/field-context.d.mts +19 -0
- package/dist/internal/form/field-context.d.mts.map +1 -0
- package/dist/internal/form/field-context.mjs +24 -0
- package/dist/internal/form/field-context.mjs.map +1 -0
- package/dist/internal/form/focus-first-invalid.mjs +67 -0
- package/dist/internal/form/focus-first-invalid.mjs.map +1 -0
- package/dist/internal/form/form-status-watcher.mjs +31 -0
- package/dist/internal/form/form-status-watcher.mjs.map +1 -0
- package/dist/internal/form/group-member.mjs +37 -0
- package/dist/internal/form/group-member.mjs.map +1 -0
- package/dist/internal/form/hidden-values.mjs +29 -0
- package/dist/internal/form/hidden-values.mjs.map +1 -0
- package/dist/internal/{sync-presence.mjs → form/sync-presence.mjs} +6 -2
- package/dist/internal/form/sync-presence.mjs.map +1 -0
- package/dist/internal/form/use-checkable-input.mjs +79 -0
- package/dist/internal/form/use-checkable-input.mjs.map +1 -0
- package/dist/internal/form/use-field-control.mjs +125 -0
- package/dist/internal/form/use-field-control.mjs.map +1 -0
- package/dist/internal/form/use-fieldset-group.mjs +46 -0
- package/dist/internal/form/use-fieldset-group.mjs.map +1 -0
- package/dist/internal/form/use-form-owner-event.mjs +44 -0
- package/dist/internal/form/use-form-owner-event.mjs.map +1 -0
- package/dist/internal/form/use-form-reset.mjs +39 -0
- package/dist/internal/form/use-form-reset.mjs.map +1 -0
- package/dist/internal/{use-native-checked.mjs → form/use-native-checked.mjs} +8 -9
- package/dist/internal/form/use-native-checked.mjs.map +1 -0
- package/dist/internal/{use-native-group-reconciliation.mjs → form/use-native-group-reconciliation.mjs} +15 -12
- package/dist/internal/form/use-native-group-reconciliation.mjs.map +1 -0
- package/dist/internal/{use-native-select-value.mjs → form/use-native-select-value.mjs} +8 -6
- package/dist/internal/form/use-native-select-value.mjs.map +1 -0
- package/dist/internal/form/validity.d.mts +35 -0
- package/dist/internal/form/validity.d.mts.map +1 -0
- package/dist/internal/form/validity.mjs +98 -0
- package/dist/internal/form/validity.mjs.map +1 -0
- package/dist/internal/overlay/anchor-position.d.mts +15 -0
- package/dist/internal/overlay/anchor-position.d.mts.map +1 -0
- package/dist/internal/overlay/anchor-position.mjs +132 -0
- package/dist/internal/overlay/anchor-position.mjs.map +1 -0
- package/dist/internal/overlay/content-focus-probe.mjs +42 -0
- package/dist/internal/overlay/content-focus-probe.mjs.map +1 -0
- package/dist/internal/overlay/css-transition-cut.mjs +66 -0
- package/dist/internal/overlay/css-transition-cut.mjs.map +1 -0
- package/dist/internal/overlay/focus-visible.mjs +26 -0
- package/dist/internal/overlay/focus-visible.mjs.map +1 -0
- package/dist/internal/overlay/invokers.mjs +63 -0
- package/dist/internal/overlay/invokers.mjs.map +1 -0
- package/dist/internal/overlay/modal-registry.mjs +39 -0
- package/dist/internal/overlay/modal-registry.mjs.map +1 -0
- package/dist/internal/overlay/overlay-popup.mjs +103 -0
- package/dist/internal/overlay/overlay-popup.mjs.map +1 -0
- package/dist/internal/overlay/overlay-show.mjs +73 -0
- package/dist/internal/overlay/overlay-show.mjs.map +1 -0
- package/dist/internal/overlay/popover-open.mjs +18 -0
- package/dist/internal/overlay/popover-open.mjs.map +1 -0
- package/dist/internal/overlay/trigger-ref.mjs +26 -0
- package/dist/internal/overlay/trigger-ref.mjs.map +1 -0
- package/dist/internal/overlay/use-apply-open-state.mjs +44 -0
- package/dist/internal/overlay/use-apply-open-state.mjs.map +1 -0
- package/dist/internal/{use-exit-animation.mjs → overlay/use-exit-animation.mjs} +28 -8
- package/dist/internal/overlay/use-exit-animation.mjs.map +1 -0
- package/dist/internal/overlay/use-interest-dismiss.mjs +85 -0
- package/dist/internal/overlay/use-interest-dismiss.mjs.map +1 -0
- package/dist/internal/overlay/use-modal-registration.mjs +47 -0
- package/dist/internal/overlay/use-modal-registration.mjs.map +1 -0
- package/dist/internal/overlay/use-overlay-close.mjs +72 -0
- package/dist/internal/overlay/use-overlay-close.mjs.map +1 -0
- package/dist/internal/overlay/use-overlay-root.d.mts +2 -0
- package/dist/internal/overlay/use-overlay-root.mjs +193 -0
- package/dist/internal/overlay/use-overlay-root.mjs.map +1 -0
- package/dist/internal/overlay/use-popover-popup.mjs +287 -0
- package/dist/internal/overlay/use-popover-popup.mjs.map +1 -0
- package/dist/internal/overlay/use-popover-trigger.d.mts +16 -0
- package/dist/internal/overlay/use-popover-trigger.d.mts.map +1 -0
- package/dist/internal/overlay/use-popover-trigger.mjs +142 -0
- package/dist/internal/overlay/use-popover-trigger.mjs.map +1 -0
- package/dist/internal/overlay/use-resolved-placement.mjs +162 -0
- package/dist/internal/overlay/use-resolved-placement.mjs.map +1 -0
- package/dist/internal/platform-attributes.d.mts +2 -1
- package/dist/internal/platform-attributes.d.mts.map +1 -1
- package/dist/internal/pointer-capture.mjs +20 -0
- package/dist/internal/pointer-capture.mjs.map +1 -0
- package/dist/internal/range-value.mjs +51 -0
- package/dist/internal/range-value.mjs.map +1 -0
- package/dist/internal/render-element.d.mts +2 -0
- package/dist/internal/render-element.mjs +123 -0
- package/dist/internal/render-element.mjs.map +1 -0
- package/dist/internal/shipped-styles.mjs +14 -0
- package/dist/internal/shipped-styles.mjs.map +1 -0
- package/dist/internal/toolbar-context.mjs +17 -0
- package/dist/internal/toolbar-context.mjs.map +1 -0
- package/dist/internal/transition-boundary.mjs +5 -9
- package/dist/internal/transition-boundary.mjs.map +1 -1
- package/dist/internal/typeahead.mjs +52 -0
- package/dist/internal/typeahead.mjs.map +1 -0
- package/dist/internal/types.d.mts +42 -9
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-active-option.mjs +51 -0
- package/dist/internal/use-active-option.mjs.map +1 -0
- package/dist/internal/use-deferred-leave.mjs +113 -0
- package/dist/internal/use-deferred-leave.mjs.map +1 -0
- package/dist/internal/use-dev-warning.mjs +8 -4
- package/dist/internal/use-dev-warning.mjs.map +1 -1
- package/dist/internal/use-element-check.mjs +39 -0
- package/dist/internal/use-element-check.mjs.map +1 -0
- package/dist/internal/use-item-order.mjs +42 -0
- package/dist/internal/use-item-order.mjs.map +1 -0
- package/dist/internal/use-latest.mjs +28 -0
- package/dist/internal/use-latest.mjs.map +1 -0
- package/dist/internal/use-merged-refs.mjs +19 -0
- package/dist/internal/use-merged-refs.mjs.map +1 -0
- package/dist/internal/use-mount-fixed.mjs +22 -0
- package/dist/internal/use-mount-fixed.mjs.map +1 -0
- package/dist/internal/use-name-warning.mjs +140 -0
- package/dist/internal/use-name-warning.mjs.map +1 -0
- package/dist/internal/use-native-focusgroup.mjs +19 -0
- package/dist/internal/use-native-focusgroup.mjs.map +1 -0
- package/dist/internal/use-option-registry.mjs +70 -0
- package/dist/internal/use-option-registry.mjs.map +1 -0
- package/dist/internal/use-register-count.mjs +27 -0
- package/dist/internal/use-register-count.mjs.map +1 -0
- package/dist/internal/use-render.d.mts +2 -0
- package/dist/internal/use-render.mjs +12 -35
- package/dist/internal/use-render.mjs.map +1 -1
- package/dist/internal/use-roving-focus.mjs +288 -0
- package/dist/internal/use-roving-focus.mjs.map +1 -0
- package/dist/internal/use-value-set.mjs +20 -0
- package/dist/internal/use-value-set.mjs.map +1 -0
- package/dist/internal/value-set.mjs +41 -0
- package/dist/internal/value-set.mjs.map +1 -0
- package/dist/menu/index.d.mts +8 -2
- package/dist/menu/index.d.mts.map +1 -1
- package/dist/menu/index.mjs +7 -1
- package/dist/menu/index.mjs.map +1 -1
- package/dist/menu/menu-checkbox-item.d.mts +27 -3
- package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
- package/dist/menu/menu-checkbox-item.mjs +6 -3
- package/dist/menu/menu-checkbox-item.mjs.map +1 -1
- package/dist/menu/menu-context-trigger.d.mts +63 -0
- package/dist/menu/menu-context-trigger.d.mts.map +1 -0
- package/dist/menu/menu-context-trigger.mjs +231 -0
- package/dist/menu/menu-context-trigger.mjs.map +1 -0
- package/dist/menu/menu-context.d.mts +1 -1
- package/dist/menu/menu-context.mjs +44 -1
- package/dist/menu/menu-context.mjs.map +1 -1
- package/dist/menu/menu-dom.mjs +35 -4
- package/dist/menu/menu-dom.mjs.map +1 -1
- package/dist/menu/menu-gestures.mjs +166 -0
- package/dist/menu/menu-gestures.mjs.map +1 -0
- package/dist/menu/menu-group.d.mts +36 -1
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +15 -5
- package/dist/menu/menu-group.mjs.map +1 -1
- package/dist/menu/menu-hover.mjs +0 -1
- package/dist/menu/menu-hover.mjs.map +1 -1
- package/dist/menu/menu-item.d.mts +42 -5
- package/dist/menu/menu-item.d.mts.map +1 -1
- package/dist/menu/menu-item.mjs +18 -9
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-outside.mjs +101 -0
- package/dist/menu/menu-outside.mjs.map +1 -0
- package/dist/menu/menu-point.mjs +85 -0
- package/dist/menu/menu-point.mjs.map +1 -0
- package/dist/menu/menu-popup.d.mts +68 -11
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +106 -116
- package/dist/menu/menu-popup.mjs.map +1 -1
- package/dist/menu/menu-radio-group.d.mts +20 -1
- package/dist/menu/menu-radio-group.d.mts.map +1 -1
- package/dist/menu/menu-radio-group.mjs +14 -7
- package/dist/menu/menu-radio-group.mjs.map +1 -1
- package/dist/menu/menu-radio-item.d.mts +18 -0
- package/dist/menu/menu-radio-item.d.mts.map +1 -1
- package/dist/menu/menu-radio-item.mjs +5 -1
- package/dist/menu/menu-radio-item.mjs.map +1 -1
- package/dist/menu/menu-root.d.mts +61 -12
- package/dist/menu/menu-root.d.mts.map +1 -1
- package/dist/menu/menu-root.mjs +72 -17
- package/dist/menu/menu-root.mjs.map +1 -1
- package/dist/menu/menu-submenu-trigger.d.mts +24 -9
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +48 -26
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +37 -16
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +39 -23
- package/dist/menu/menu-trigger.mjs.map +1 -1
- package/dist/menu/use-menu-item.mjs +14 -16
- package/dist/menu/use-menu-item.mjs.map +1 -1
- package/dist/menu/use-menu-keyboard.mjs +68 -0
- package/dist/menu/use-menu-keyboard.mjs.map +1 -0
- package/dist/meter/index.d.mts +26 -0
- package/dist/meter/index.d.mts.map +1 -0
- package/dist/meter/index.mjs +25 -0
- package/dist/meter/index.mjs.map +1 -0
- package/dist/meter/meter-context.mjs +13 -0
- package/dist/meter/meter-context.mjs.map +1 -0
- package/dist/meter/meter-indicator.d.mts +30 -0
- package/dist/meter/meter-indicator.d.mts.map +1 -0
- package/dist/meter/meter-indicator.mjs +27 -0
- package/dist/meter/meter-indicator.mjs.map +1 -0
- package/dist/meter/meter-label.d.mts +30 -0
- package/dist/meter/meter-label.d.mts.map +1 -0
- package/dist/meter/meter-label.mjs +30 -0
- package/dist/meter/meter-label.mjs.map +1 -0
- package/dist/meter/meter-region.d.mts +9 -0
- package/dist/meter/meter-region.d.mts.map +1 -0
- package/dist/meter/meter-region.mjs +39 -0
- package/dist/meter/meter-region.mjs.map +1 -0
- package/dist/meter/meter-root.d.mts +113 -0
- package/dist/meter/meter-root.d.mts.map +1 -0
- package/dist/meter/meter-root.mjs +85 -0
- package/dist/meter/meter-root.mjs.map +1 -0
- package/dist/meter/meter-track.d.mts +30 -0
- package/dist/meter/meter-track.d.mts.map +1 -0
- package/dist/meter/meter-track.mjs +27 -0
- package/dist/meter/meter-track.mjs.map +1 -0
- package/dist/meter/meter-value.d.mts +34 -0
- package/dist/meter/meter-value.d.mts.map +1 -0
- package/dist/meter/meter-value.mjs +31 -0
- package/dist/meter/meter-value.mjs.map +1 -0
- package/dist/multi-select/index.d.mts +37 -0
- package/dist/multi-select/index.d.mts.map +1 -0
- package/dist/multi-select/index.mjs +37 -0
- package/dist/multi-select/index.mjs.map +1 -0
- package/dist/multi-select/multi-select-context.mjs +19 -0
- package/dist/multi-select/multi-select-context.mjs.map +1 -0
- package/dist/multi-select/multi-select-group.d.mts +120 -0
- package/dist/multi-select/multi-select-group.d.mts.map +1 -0
- package/dist/multi-select/multi-select-group.mjs +111 -0
- package/dist/multi-select/multi-select-group.mjs.map +1 -0
- package/dist/multi-select/multi-select-keyboard.mjs +145 -0
- package/dist/multi-select/multi-select-keyboard.mjs.map +1 -0
- package/dist/multi-select/multi-select-label.d.mts +42 -0
- package/dist/multi-select/multi-select-label.d.mts.map +1 -0
- package/dist/multi-select/multi-select-label.mjs +41 -0
- package/dist/multi-select/multi-select-label.mjs.map +1 -0
- package/dist/multi-select/multi-select-list.d.mts +47 -0
- package/dist/multi-select/multi-select-list.d.mts.map +1 -0
- package/dist/multi-select/multi-select-list.mjs +65 -0
- package/dist/multi-select/multi-select-list.mjs.map +1 -0
- package/dist/multi-select/multi-select-option.d.mts +68 -0
- package/dist/multi-select/multi-select-option.d.mts.map +1 -0
- package/dist/multi-select/multi-select-option.mjs +93 -0
- package/dist/multi-select/multi-select-option.mjs.map +1 -0
- package/dist/multi-select/multi-select-popup.d.mts +58 -0
- package/dist/multi-select/multi-select-popup.d.mts.map +1 -0
- package/dist/multi-select/multi-select-popup.mjs +71 -0
- package/dist/multi-select/multi-select-popup.mjs.map +1 -0
- package/dist/multi-select/multi-select-root.d.mts +125 -0
- package/dist/multi-select/multi-select-root.d.mts.map +1 -0
- package/dist/multi-select/multi-select-root.mjs +257 -0
- package/dist/multi-select/multi-select-root.mjs.map +1 -0
- package/dist/multi-select/multi-select-trigger.d.mts +66 -0
- package/dist/multi-select/multi-select-trigger.d.mts.map +1 -0
- package/dist/multi-select/multi-select-trigger.mjs +169 -0
- package/dist/multi-select/multi-select-trigger.mjs.map +1 -0
- package/dist/multi-select/multi-select-value.d.mts +57 -0
- package/dist/multi-select/multi-select-value.d.mts.map +1 -0
- package/dist/multi-select/multi-select-value.mjs +41 -0
- package/dist/multi-select/multi-select-value.mjs.map +1 -0
- package/dist/number-field/index.d.mts +29 -0
- package/dist/number-field/index.d.mts.map +1 -0
- package/dist/number-field/index.mjs +28 -0
- package/dist/number-field/index.mjs.map +1 -0
- package/dist/number-field/number-field-arithmetic.mjs +97 -0
- package/dist/number-field/number-field-arithmetic.mjs.map +1 -0
- package/dist/number-field/number-field-context.d.mts +7 -0
- package/dist/number-field/number-field-context.d.mts.map +1 -0
- package/dist/number-field/number-field-context.mjs +13 -0
- package/dist/number-field/number-field-context.mjs.map +1 -0
- package/dist/number-field/number-field-decrement.d.mts +19 -0
- package/dist/number-field/number-field-decrement.d.mts.map +1 -0
- package/dist/number-field/number-field-decrement.mjs +22 -0
- package/dist/number-field/number-field-decrement.mjs.map +1 -0
- package/dist/number-field/number-field-format.mjs +279 -0
- package/dist/number-field/number-field-format.mjs.map +1 -0
- package/dist/number-field/number-field-increment.d.mts +19 -0
- package/dist/number-field/number-field-increment.d.mts.map +1 -0
- package/dist/number-field/number-field-increment.mjs +22 -0
- package/dist/number-field/number-field-increment.mjs.map +1 -0
- package/dist/number-field/number-field-input.d.mts +38 -0
- package/dist/number-field/number-field-input.d.mts.map +1 -0
- package/dist/number-field/number-field-input.mjs +161 -0
- package/dist/number-field/number-field-input.mjs.map +1 -0
- package/dist/number-field/number-field-label.d.mts +33 -0
- package/dist/number-field/number-field-label.d.mts.map +1 -0
- package/dist/number-field/number-field-label.mjs +43 -0
- package/dist/number-field/number-field-label.mjs.map +1 -0
- package/dist/number-field/number-field-root.d.mts +157 -0
- package/dist/number-field/number-field-root.d.mts.map +1 -0
- package/dist/number-field/number-field-root.mjs +445 -0
- package/dist/number-field/number-field-root.mjs.map +1 -0
- package/dist/number-field/use-number-field-dev-warnings.mjs +28 -0
- package/dist/number-field/use-number-field-dev-warnings.mjs.map +1 -0
- package/dist/number-field/use-step-button.d.mts +44 -0
- package/dist/number-field/use-step-button.d.mts.map +1 -0
- package/dist/number-field/use-step-button.mjs +175 -0
- package/dist/number-field/use-step-button.mjs.map +1 -0
- package/dist/popover/index.d.mts +6 -4
- package/dist/popover/index.d.mts.map +1 -1
- package/dist/popover/index.mjs +6 -4
- package/dist/popover/index.mjs.map +1 -1
- package/dist/popover/popover-close.d.mts +48 -8
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +41 -67
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-context.mjs.map +1 -1
- package/dist/popover/popover-description.d.mts +12 -0
- package/dist/popover/popover-description.d.mts.map +1 -1
- package/dist/popover/popover-description.mjs +2 -0
- package/dist/popover/popover-description.mjs.map +1 -1
- package/dist/popover/popover-popup.d.mts +64 -18
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +31 -36
- package/dist/popover/popover-popup.mjs.map +1 -1
- package/dist/popover/popover-root.d.mts +40 -18
- package/dist/popover/popover-root.d.mts.map +1 -1
- package/dist/popover/popover-root.mjs +15 -10
- package/dist/popover/popover-root.mjs.map +1 -1
- package/dist/popover/popover-title.d.mts +11 -0
- package/dist/popover/popover-title.d.mts.map +1 -1
- package/dist/popover/popover-title.mjs +2 -0
- package/dist/popover/popover-title.mjs.map +1 -1
- package/dist/popover/popover-trigger.d.mts +38 -18
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +14 -9
- package/dist/popover/popover-trigger.mjs.map +1 -1
- package/dist/progress/index.d.mts +26 -0
- package/dist/progress/index.d.mts.map +1 -0
- package/dist/progress/index.mjs +26 -0
- package/dist/progress/index.mjs.map +1 -0
- package/dist/progress/progress-context.mjs +13 -0
- package/dist/progress/progress-context.mjs.map +1 -0
- package/dist/progress/progress-indicator.d.mts +30 -0
- package/dist/progress/progress-indicator.d.mts.map +1 -0
- package/dist/progress/progress-indicator.mjs +31 -0
- package/dist/progress/progress-indicator.mjs.map +1 -0
- package/dist/progress/progress-label.d.mts +30 -0
- package/dist/progress/progress-label.d.mts.map +1 -0
- package/dist/progress/progress-label.mjs +32 -0
- package/dist/progress/progress-label.mjs.map +1 -0
- package/dist/progress/progress-root.d.mts +96 -0
- package/dist/progress/progress-root.d.mts.map +1 -0
- package/dist/progress/progress-root.mjs +82 -0
- package/dist/progress/progress-root.mjs.map +1 -0
- package/dist/progress/progress-track.d.mts +30 -0
- package/dist/progress/progress-track.d.mts.map +1 -0
- package/dist/progress/progress-track.mjs +31 -0
- package/dist/progress/progress-track.mjs.map +1 -0
- package/dist/progress/progress-value.d.mts +34 -0
- package/dist/progress/progress-value.d.mts.map +1 -0
- package/dist/progress/progress-value.mjs +35 -0
- package/dist/progress/progress-value.mjs.map +1 -0
- package/dist/radio-group/index.d.mts +2 -0
- package/dist/radio-group/index.d.mts.map +1 -1
- package/dist/radio-group/index.mjs +2 -0
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/radio-group/radio-group-context.mjs.map +1 -1
- package/dist/radio-group/radio-group-item.d.mts +21 -5
- package/dist/radio-group/radio-group-item.d.mts.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +22 -25
- package/dist/radio-group/radio-group-item.mjs.map +1 -1
- package/dist/radio-group/radio-group-label.d.mts +10 -0
- package/dist/radio-group/radio-group-label.d.mts.map +1 -1
- package/dist/radio-group/radio-group-label.mjs +3 -6
- package/dist/radio-group/radio-group-label.mjs.map +1 -1
- package/dist/radio-group/radio-group-root.d.mts +34 -8
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +48 -39
- package/dist/radio-group/radio-group-root.mjs.map +1 -1
- package/dist/select/index.d.mts +2 -0
- package/dist/select/index.d.mts.map +1 -1
- package/dist/select/index.mjs +2 -0
- package/dist/select/index.mjs.map +1 -1
- package/dist/select/select-dom.mjs +9 -18
- package/dist/select/select-dom.mjs.map +1 -1
- package/dist/select/select-group-label.d.mts +10 -0
- package/dist/select/select-group-label.d.mts.map +1 -1
- package/dist/select/select-group-label.mjs +5 -1
- package/dist/select/select-group-label.mjs.map +1 -1
- package/dist/select/select-group.d.mts +15 -1
- package/dist/select/select-group.d.mts.map +1 -1
- package/dist/select/select-group.mjs +8 -4
- package/dist/select/select-group.mjs.map +1 -1
- package/dist/select/select-option.d.mts +19 -1
- package/dist/select/select-option.d.mts.map +1 -1
- package/dist/select/select-option.mjs +4 -2
- package/dist/select/select-option.mjs.map +1 -1
- package/dist/select/select-root.d.mts +28 -3
- package/dist/select/select-root.d.mts.map +1 -1
- package/dist/select/select-root.mjs +39 -12
- package/dist/select/select-root.mjs.map +1 -1
- package/dist/select/select-separator.d.mts +9 -0
- package/dist/select/select-separator.d.mts.map +1 -1
- package/dist/select/select-separator.mjs +2 -0
- package/dist/select/select-separator.mjs.map +1 -1
- package/dist/select/select-trigger.d.mts +9 -0
- package/dist/select/select-trigger.d.mts.map +1 -1
- package/dist/select/select-trigger.mjs +5 -1
- package/dist/select/select-trigger.mjs.map +1 -1
- package/dist/select/select-value.d.mts +9 -0
- package/dist/select/select-value.d.mts.map +1 -1
- package/dist/select/select-value.mjs +5 -6
- package/dist/select/select-value.mjs.map +1 -1
- package/dist/separator/index.d.mts +3 -0
- package/dist/separator/index.mjs +1 -0
- package/dist/separator/separator.d.mts +58 -0
- package/dist/separator/separator.d.mts.map +1 -0
- package/dist/separator/separator.mjs +41 -0
- package/dist/separator/separator.mjs.map +1 -0
- package/dist/slider/index.d.mts +34 -0
- package/dist/slider/index.d.mts.map +1 -0
- package/dist/slider/index.mjs +29 -0
- package/dist/slider/index.mjs.map +1 -0
- package/dist/slider/slider-arithmetic.mjs +165 -0
- package/dist/slider/slider-arithmetic.mjs.map +1 -0
- package/dist/slider/slider-context.mjs +13 -0
- package/dist/slider/slider-context.mjs.map +1 -0
- package/dist/slider/slider-indicator.d.mts +34 -0
- package/dist/slider/slider-indicator.d.mts.map +1 -0
- package/dist/slider/slider-indicator.mjs +38 -0
- package/dist/slider/slider-indicator.mjs.map +1 -0
- package/dist/slider/slider-label.d.mts +33 -0
- package/dist/slider/slider-label.d.mts.map +1 -0
- package/dist/slider/slider-label.mjs +40 -0
- package/dist/slider/slider-label.mjs.map +1 -0
- package/dist/slider/slider-root.d.mts +155 -0
- package/dist/slider/slider-root.d.mts.map +1 -0
- package/dist/slider/slider-root.mjs +434 -0
- package/dist/slider/slider-root.mjs.map +1 -0
- package/dist/slider/slider-thumb.d.mts +87 -0
- package/dist/slider/slider-thumb.d.mts.map +1 -0
- package/dist/slider/slider-thumb.mjs +150 -0
- package/dist/slider/slider-thumb.mjs.map +1 -0
- package/dist/slider/slider-track.d.mts +46 -0
- package/dist/slider/slider-track.d.mts.map +1 -0
- package/dist/slider/slider-track.mjs +57 -0
- package/dist/slider/slider-track.mjs.map +1 -0
- package/dist/slider/slider-value.d.mts +45 -0
- package/dist/slider/slider-value.d.mts.map +1 -0
- package/dist/slider/slider-value.mjs +41 -0
- package/dist/slider/slider-value.mjs.map +1 -0
- package/dist/slider/use-slider-dev-warnings.mjs +29 -0
- package/dist/slider/use-slider-dev-warnings.mjs.map +1 -0
- package/dist/slider/use-thumb-registry.mjs +51 -0
- package/dist/slider/use-thumb-registry.mjs.map +1 -0
- package/dist/switch/switch.d.mts +30 -9
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +24 -46
- package/dist/switch/switch.mjs.map +1 -1
- package/dist/tabs/index.d.mts +2 -0
- package/dist/tabs/index.d.mts.map +1 -1
- package/dist/tabs/index.mjs +2 -0
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/tabs/tabs-context.d.mts +7 -3
- package/dist/tabs/tabs-context.d.mts.map +1 -1
- package/dist/tabs/tabs-context.mjs.map +1 -1
- package/dist/tabs/tabs-indicator.d.mts +17 -0
- package/dist/tabs/tabs-indicator.d.mts.map +1 -1
- package/dist/tabs/tabs-indicator.mjs +4 -1
- package/dist/tabs/tabs-indicator.mjs.map +1 -1
- package/dist/tabs/tabs-list.d.mts +19 -1
- package/dist/tabs/tabs-list.d.mts.map +1 -1
- package/dist/tabs/tabs-list.mjs +12 -23
- package/dist/tabs/tabs-list.mjs.map +1 -1
- package/dist/tabs/tabs-panel.d.mts +22 -4
- package/dist/tabs/tabs-panel.d.mts.map +1 -1
- package/dist/tabs/tabs-panel.mjs +4 -2
- package/dist/tabs/tabs-panel.mjs.map +1 -1
- package/dist/tabs/tabs-root.d.mts +43 -8
- package/dist/tabs/tabs-root.d.mts.map +1 -1
- package/dist/tabs/tabs-root.mjs +23 -10
- package/dist/tabs/tabs-root.mjs.map +1 -1
- package/dist/tabs/tabs-tab.d.mts +25 -5
- package/dist/tabs/tabs-tab.d.mts.map +1 -1
- package/dist/tabs/tabs-tab.mjs +5 -2
- package/dist/tabs/tabs-tab.mjs.map +1 -1
- package/dist/{internal → tabs}/use-until-found.mjs +1 -1
- package/dist/tabs/use-until-found.mjs.map +1 -0
- package/dist/toast/index.d.mts +27 -0
- package/dist/toast/index.d.mts.map +1 -0
- package/dist/toast/index.mjs +28 -0
- package/dist/toast/index.mjs.map +1 -0
- package/dist/toast/toast-action.d.mts +86 -0
- package/dist/toast/toast-action.d.mts.map +1 -0
- package/dist/toast/toast-action.mjs +81 -0
- package/dist/toast/toast-action.mjs.map +1 -0
- package/dist/toast/toast-close.d.mts +52 -0
- package/dist/toast/toast-close.d.mts.map +1 -0
- package/dist/toast/toast-close.mjs +53 -0
- package/dist/toast/toast-close.mjs.map +1 -0
- package/dist/toast/toast-context.mjs +19 -0
- package/dist/toast/toast-context.mjs.map +1 -0
- package/dist/toast/toast-description.d.mts +39 -0
- package/dist/toast/toast-description.d.mts.map +1 -0
- package/dist/toast/toast-description.mjs +37 -0
- package/dist/toast/toast-description.mjs.map +1 -0
- package/dist/toast/toast-hotkey.mjs +27 -0
- package/dist/toast/toast-hotkey.mjs.map +1 -0
- package/dist/toast/toast-queue.mjs +137 -0
- package/dist/toast/toast-queue.mjs.map +1 -0
- package/dist/toast/toast-root.d.mts +63 -0
- package/dist/toast/toast-root.d.mts.map +1 -0
- package/dist/toast/toast-root.mjs +209 -0
- package/dist/toast/toast-root.mjs.map +1 -0
- package/dist/toast/toast-timers.mjs +65 -0
- package/dist/toast/toast-timers.mjs.map +1 -0
- package/dist/toast/toast-title.d.mts +38 -0
- package/dist/toast/toast-title.d.mts.map +1 -0
- package/dist/toast/toast-title.mjs +35 -0
- package/dist/toast/toast-title.mjs.map +1 -0
- package/dist/toast/toast-viewport.d.mts +81 -0
- package/dist/toast/toast-viewport.d.mts.map +1 -0
- package/dist/toast/toast-viewport.mjs +345 -0
- package/dist/toast/toast-viewport.mjs.map +1 -0
- package/dist/toast/toast.d.mts +162 -0
- package/dist/toast/toast.d.mts.map +1 -0
- package/dist/toast/toast.mjs +161 -0
- package/dist/toast/toast.mjs.map +1 -0
- package/dist/toast/use-modal-portal-host.mjs +52 -0
- package/dist/toast/use-modal-portal-host.mjs.map +1 -0
- package/dist/toast/use-toast-announcements.mjs +46 -0
- package/dist/toast/use-toast-announcements.mjs.map +1 -0
- package/dist/toast/use-toast-focus.mjs +75 -0
- package/dist/toast/use-toast-focus.mjs.map +1 -0
- package/dist/toast/use-toast-pauses.mjs +58 -0
- package/dist/toast/use-toast-pauses.mjs.map +1 -0
- package/dist/toggle/toggle.d.mts +26 -6
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +12 -6
- package/dist/toggle/toggle.mjs.map +1 -1
- package/dist/toggle-group/index.d.mts +18 -0
- package/dist/toggle-group/index.d.mts.map +1 -0
- package/dist/toggle-group/index.mjs +17 -0
- package/dist/toggle-group/index.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-context.d.mts +6 -0
- package/dist/toggle-group/toggle-group-context.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-context.mjs +13 -0
- package/dist/toggle-group/toggle-group-context.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-item.d.mts +71 -0
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-item.mjs +69 -0
- package/dist/toggle-group/toggle-group-item.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-root.d.mts +156 -0
- package/dist/toggle-group/toggle-group-root.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-root.mjs +177 -0
- package/dist/toggle-group/toggle-group-root.mjs.map +1 -0
- package/dist/toolbar/index.d.mts +19 -0
- package/dist/toolbar/index.d.mts.map +1 -0
- package/dist/toolbar/index.mjs +19 -0
- package/dist/toolbar/index.mjs.map +1 -0
- package/dist/toolbar/toolbar-root.d.mts +65 -0
- package/dist/toolbar/toolbar-root.d.mts.map +1 -0
- package/dist/toolbar/toolbar-root.mjs +67 -0
- package/dist/toolbar/toolbar-root.mjs.map +1 -0
- package/dist/toolbar/toolbar-separator.d.mts +38 -0
- package/dist/toolbar/toolbar-separator.d.mts.map +1 -0
- package/dist/toolbar/toolbar-separator.mjs +33 -0
- package/dist/toolbar/toolbar-separator.mjs.map +1 -0
- package/dist/tooltip/index.d.mts +10 -5
- package/dist/tooltip/index.d.mts.map +1 -1
- package/dist/tooltip/index.mjs +8 -3
- package/dist/tooltip/index.mjs.map +1 -1
- package/dist/tooltip/tooltip-arrow.d.mts +46 -0
- package/dist/tooltip/tooltip-arrow.d.mts.map +1 -0
- package/dist/tooltip/tooltip-arrow.mjs +47 -0
- package/dist/tooltip/tooltip-arrow.mjs.map +1 -0
- package/dist/tooltip/tooltip-context.d.mts +11 -0
- package/dist/tooltip/tooltip-context.d.mts.map +1 -1
- package/dist/tooltip/tooltip-context.mjs +2 -1
- package/dist/tooltip/tooltip-context.mjs.map +1 -1
- package/dist/tooltip/tooltip-popup.d.mts +49 -7
- package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
- package/dist/tooltip/tooltip-popup.mjs +37 -15
- package/dist/tooltip/tooltip-popup.mjs.map +1 -1
- package/dist/tooltip/tooltip-root.d.mts +24 -2
- package/dist/tooltip/tooltip-root.d.mts.map +1 -1
- package/dist/tooltip/tooltip-root.mjs +29 -6
- package/dist/tooltip/tooltip-root.mjs.map +1 -1
- package/dist/tooltip/tooltip-trigger.d.mts +28 -3
- package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +26 -6
- package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
- package/dist/tooltip/tooltip-warm.mjs +29 -0
- package/dist/tooltip/tooltip-warm.mjs.map +1 -0
- package/dist/tooltip/use-tooltip-interaction.mjs +128 -77
- package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
- package/package.json +27 -2
- package/skills/funstack-ui-knowledge/SKILL.md +80 -0
- package/dist/accordion/accordion-context.d.mts +0 -5
- package/dist/accordion/accordion-context.d.mts.map +0 -1
- package/dist/internal/action-details.mjs.map +0 -1
- package/dist/internal/anchor-position.d.mts +0 -7
- package/dist/internal/anchor-position.d.mts.map +0 -1
- package/dist/internal/anchor-position.mjs +0 -16
- package/dist/internal/anchor-position.mjs.map +0 -1
- package/dist/internal/sync-presence.mjs.map +0 -1
- package/dist/internal/use-action-trigger.mjs +0 -58
- package/dist/internal/use-action-trigger.mjs.map +0 -1
- package/dist/internal/use-controllable-action.mjs +0 -119
- package/dist/internal/use-controllable-action.mjs.map +0 -1
- package/dist/internal/use-exit-animation.mjs.map +0 -1
- package/dist/internal/use-form-reset.mjs +0 -54
- package/dist/internal/use-form-reset.mjs.map +0 -1
- package/dist/internal/use-native-checked.mjs.map +0 -1
- package/dist/internal/use-native-group-reconciliation.mjs.map +0 -1
- package/dist/internal/use-native-select-value.mjs.map +0 -1
- package/dist/internal/use-popover-popup.mjs +0 -274
- package/dist/internal/use-popover-popup.mjs.map +0 -1
- package/dist/internal/use-popover-root.d.mts +0 -2
- package/dist/internal/use-popover-root.mjs +0 -112
- package/dist/internal/use-popover-root.mjs.map +0 -1
- package/dist/internal/use-popover-trigger.mjs +0 -86
- package/dist/internal/use-popover-trigger.mjs.map +0 -1
- package/dist/internal/use-until-found.mjs.map +0 -1
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
# NumberField
|
|
2
|
+
|
|
3
|
+
A number field: the user types in their locale's notation, steps with the keys or two buttons, and the form posts a machine number. The platform's `<input type="number">` cannot be the visible control (it cannot format, it localises by the browser's language rather than the page's, and it is a text field to VoiceOver anyway), so `NumberField.Input` renders **two inputs**: a visible `type="text"` input the user edits, and right after it a visually hidden native `type="number"` input that carries `name`, `min` / `max` / `step` / `required`, the posted value, the form reset and the browser's own constraint messages. The library adds the asynchronous half: the typed text is urgent, a **step** is a transition, and each **gesture** is one commit with `data-pending` and a rollback if the save fails.
|
|
4
|
+
|
|
5
|
+
```tsx title="NumberFieldQuantity.tsx"
|
|
6
|
+
"use client";
|
|
7
|
+
import { startTransition, useState } from "react";
|
|
8
|
+
import { NumberField } from "@funstack/ui/number-field";
|
|
9
|
+
import { fakeSave } from "./fake-api.js";
|
|
10
|
+
|
|
11
|
+
// A cart line. Type a number (committed on blur or Enter), use the arrow keys, or press and hold
|
|
12
|
+
// a button: the save runs once per gesture in valueCommitAction (800 ms, data-pending on the Root,
|
|
13
|
+
// the Input and the pressed button). The parent adopts the quantity when the save succeeds; with
|
|
14
|
+
// failures on it keeps the old one, so the text returns to it.
|
|
15
|
+
export function NumberFieldQuantity() {
|
|
16
|
+
const [fail, setFail] = useState(false);
|
|
17
|
+
const [quantity, setQuantity] = useState<number | null>(1);
|
|
18
|
+
return (
|
|
19
|
+
<div className="demo-stack">
|
|
20
|
+
<label className="demo-field">
|
|
21
|
+
<input type="checkbox" checked={fail} onChange={(e) => setFail(e.target.checked)} />
|
|
22
|
+
Make the save fail
|
|
23
|
+
</label>
|
|
24
|
+
<NumberField.Root
|
|
25
|
+
className="demo-number-field"
|
|
26
|
+
locale="en-US"
|
|
27
|
+
value={quantity}
|
|
28
|
+
min={1}
|
|
29
|
+
max={99}
|
|
30
|
+
valueCommitAction={async (next) => {
|
|
31
|
+
try {
|
|
32
|
+
await fakeSave(`quantity ${next}`, { fail });
|
|
33
|
+
startTransition(() => setQuantity(next));
|
|
34
|
+
} catch {
|
|
35
|
+
// The parent keeps its quantity: the field shows it again.
|
|
36
|
+
}
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
{({ pending }) => (
|
|
40
|
+
<>
|
|
41
|
+
<NumberField.Label className="demo-number-label">Quantity</NumberField.Label>
|
|
42
|
+
<div className="demo-number-group">
|
|
43
|
+
<NumberField.Decrement className="demo-number-step">−</NumberField.Decrement>
|
|
44
|
+
<NumberField.Input className="demo-number-input" />
|
|
45
|
+
<NumberField.Increment className="demo-number-step">+</NumberField.Increment>
|
|
46
|
+
</div>
|
|
47
|
+
<span className="demo-number-status">
|
|
48
|
+
{pending ? "Saving…" : `In the cart: ${String(quantity)}`}
|
|
49
|
+
</span>
|
|
50
|
+
</>
|
|
51
|
+
)}
|
|
52
|
+
</NumberField.Root>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```css title="number-field.css"
|
|
59
|
+
/* NumberField: the Root is the group (a grid of the two buttons around the input). The visible
|
|
60
|
+
input is a plain text field; the hidden number input after it is positioned by the library. */
|
|
61
|
+
.demo-number-field {
|
|
62
|
+
display: grid;
|
|
63
|
+
gap: 0.35rem;
|
|
64
|
+
justify-items: start;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.demo-number-label {
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
color: var(--color-text);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.demo-number-group {
|
|
73
|
+
display: inline-grid;
|
|
74
|
+
grid-template-columns: auto 1fr auto;
|
|
75
|
+
align-items: stretch;
|
|
76
|
+
border: 1px solid var(--color-border);
|
|
77
|
+
border-radius: 8px;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
background: var(--color-bg);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.demo-number-group:has(.demo-number-input:focus-visible) {
|
|
83
|
+
outline: 2px solid var(--color-primary);
|
|
84
|
+
outline-offset: 1px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.demo-number-input {
|
|
88
|
+
inline-size: 9ch;
|
|
89
|
+
min-inline-size: 6ch;
|
|
90
|
+
border: 0;
|
|
91
|
+
padding: 0.4rem 0.6rem;
|
|
92
|
+
background: transparent;
|
|
93
|
+
color: var(--color-text);
|
|
94
|
+
font: inherit;
|
|
95
|
+
font-variant-numeric: tabular-nums;
|
|
96
|
+
text-align: end;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.demo-number-input:focus {
|
|
100
|
+
outline: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.demo-number-input:user-invalid {
|
|
104
|
+
color: #dc2626;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.demo-number-input[data-pending] {
|
|
108
|
+
color: var(--color-text-secondary);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.demo-number-step {
|
|
112
|
+
inline-size: 2.25rem;
|
|
113
|
+
border: 0;
|
|
114
|
+
background: var(--color-bg-secondary, transparent);
|
|
115
|
+
color: var(--color-text);
|
|
116
|
+
font: inherit;
|
|
117
|
+
font-size: 1.1rem;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.demo-number-step:active {
|
|
122
|
+
background: var(--color-border);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.demo-number-step:disabled {
|
|
126
|
+
opacity: 0.4;
|
|
127
|
+
cursor: default;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.demo-number-step[data-pending] {
|
|
131
|
+
cursor: progress;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.demo-number-field[data-invalid] .demo-number-group,
|
|
135
|
+
.demo-number-group:has(:user-invalid) {
|
|
136
|
+
border-color: #dc2626;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.demo-number-status {
|
|
140
|
+
color: var(--color-text-secondary);
|
|
141
|
+
font-size: 0.875rem;
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Anatomy
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
import { NumberField } from "@funstack/ui/number-field";
|
|
149
|
+
|
|
150
|
+
<NumberField.Root name="quantity" defaultValue={1} min={1} max={99} locale="en-US"
|
|
151
|
+
valueCommitAction={saveQuantity}> {/* div role=group, named by the Label */}
|
|
152
|
+
<NumberField.Label>Quantity</NumberField.Label> {/* label for= the visible input */}
|
|
153
|
+
<NumberField.Decrement>−</NumberField.Decrement> {/* button tabindex=-1 aria-label="Decrease" */}
|
|
154
|
+
<NumberField.Input /> {/* input type=text + hidden input type=number */}
|
|
155
|
+
<NumberField.Increment>+</NumberField.Increment> {/* button tabindex=-1 aria-label="Increase" */}
|
|
156
|
+
</NumberField.Root>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## How it works
|
|
160
|
+
|
|
161
|
+
### Two actions: steps and commits
|
|
162
|
+
|
|
163
|
+
A **step** is one value change; a **commit** here is the gesture's save through `valueCommitAction`, not React's [render commit](../concepts/transitions.md#commit).
|
|
164
|
+
|
|
165
|
+
| | valueChangeAction | valueCommitAction |
|
|
166
|
+
| - | - | - |
|
|
167
|
+
| Called | On every step: the parsed text at its commit, each key press, each tick of a held button, each wheel event, a form reset, text found at hydration, and the revert after a failed save (`reason: "dismiss"`, uncontrolled). | Once per gesture: a typed text's blur or Enter, a held button's release, each key press, each wheel event, a form reset, text found at hydration. |
|
|
168
|
+
| Lane | A transition of its own: a controlled parent's `setValue(next)` in the synchronous prefix renders interruptibly. | The Root's commit transition, with `useOptimistic`. |
|
|
169
|
+
| Pending | `data-pending` while a step is in flight. Without a `valueChangeAction` a step starts no transition. | `data-pending` on the Root, the Input and the pressed button until the save settles. |
|
|
170
|
+
| Uncontrolled state | Not written. | Written when it resolves; reverts to the value before the gesture if it rejects. |
|
|
171
|
+
| Meant for | Adopting the value in a controlled parent, a live total, cheap synchronous work. | Saving: a Server Function, a fetch, `requestSubmit()`. |
|
|
172
|
+
|
|
173
|
+
> **The save goes in valueCommitAction**
|
|
174
|
+
>
|
|
175
|
+
> A held button steps every 60 ms, and an awaited action holds every transition in the app ([Action props](../concepts/action-props.md#await-only)). Keep `valueChangeAction` cheap and put the network call in `valueCommitAction`, which runs once per gesture. A typed value and a key press fire both, with the same value; only a held button separates them.
|
|
176
|
+
|
|
177
|
+
- **Typed text is committed on blur and on Enter, never per keystroke.** `-`, `1,` and `12` on the way to `123` are not the number the user means. The draft is internal, urgent state: typing never waits for a transition. A step (a key, a button) parses an open draft first.
|
|
178
|
+
- Text that does not parse (`abc`, `1,5` in English) reverts to the committed value's text with no dispatch. An empty field commits `null`.
|
|
179
|
+
- The input shows the value the gesture reached while a button is held, a step waits for its commit, or anything is in flight, so it never snaps back between ticks. A controlled value that changes from outside shows at once, unless the user has a draft open: the draft wins until it is committed.
|
|
180
|
+
- A rejected save reaches the nearest Error Boundary above the Root. For a visible rollback, catch inside the action and adopt the value only on success, as the example does: the text and the hidden input return to the parent's value.
|
|
181
|
+
|
|
182
|
+
### Locales and formats
|
|
183
|
+
|
|
184
|
+
```tsx title="NumberFieldFormats.tsx"
|
|
185
|
+
"use client";
|
|
186
|
+
import { useState } from "react";
|
|
187
|
+
import { NumberField } from "@funstack/ui/number-field";
|
|
188
|
+
|
|
189
|
+
const locales = ["en-US", "de-DE", "fr-FR", "ar-EG"] as const;
|
|
190
|
+
type Locale = (typeof locales)[number];
|
|
191
|
+
|
|
192
|
+
// The buttons' built-in names are English; pass your own next to the locale.
|
|
193
|
+
const labels: Record<Locale, { increase: string; decrease: string }> = {
|
|
194
|
+
"en-US": { increase: "Increase", decrease: "Decrease" },
|
|
195
|
+
"de-DE": { increase: "Erhöhen", decrease: "Verringern" },
|
|
196
|
+
"fr-FR": { increase: "Augmenter", decrease: "Diminuer" },
|
|
197
|
+
"ar-EG": { increase: "زيادة", decrease: "إنقاص" },
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// A price in euros and a percentage, formatted and parsed in the chosen locale. The text is the
|
|
201
|
+
// locale's (`12,50 €`, `€12.50`, `١٢٫٥٠ €`); the value and the posted form value are plain numbers.
|
|
202
|
+
// Try `1,5` in English (not a number: it reverts) and in German (1.5).
|
|
203
|
+
export function NumberFieldFormats() {
|
|
204
|
+
const [locale, setLocale] = useState<Locale>("de-DE");
|
|
205
|
+
const [price, setPrice] = useState<number | null>(12.5);
|
|
206
|
+
const { increase, decrease } = labels[locale];
|
|
207
|
+
return (
|
|
208
|
+
<div className="demo-stack">
|
|
209
|
+
<label className="demo-field">
|
|
210
|
+
Locale
|
|
211
|
+
<select value={locale} onChange={(e) => setLocale(e.target.value as Locale)}>
|
|
212
|
+
{locales.map((l) => (
|
|
213
|
+
<option key={l}>{l}</option>
|
|
214
|
+
))}
|
|
215
|
+
</select>
|
|
216
|
+
</label>
|
|
217
|
+
<NumberField.Root
|
|
218
|
+
className="demo-number-field"
|
|
219
|
+
locale={locale}
|
|
220
|
+
format={{ style: "currency", currency: "EUR" }}
|
|
221
|
+
value={price}
|
|
222
|
+
min={0}
|
|
223
|
+
step={0.5}
|
|
224
|
+
valueChangeAction={(next) => {
|
|
225
|
+
setPrice(next);
|
|
226
|
+
}}
|
|
227
|
+
>
|
|
228
|
+
<NumberField.Label className="demo-number-label">Price</NumberField.Label>
|
|
229
|
+
<div className="demo-number-group">
|
|
230
|
+
<NumberField.Decrement className="demo-number-step" aria-label={decrease}>
|
|
231
|
+
−
|
|
232
|
+
</NumberField.Decrement>
|
|
233
|
+
<NumberField.Input className="demo-number-input" />
|
|
234
|
+
<NumberField.Increment className="demo-number-step" aria-label={increase}>
|
|
235
|
+
+
|
|
236
|
+
</NumberField.Increment>
|
|
237
|
+
</div>
|
|
238
|
+
</NumberField.Root>
|
|
239
|
+
<output className="demo-readout">value: {String(price)}</output>
|
|
240
|
+
<NumberField.Root
|
|
241
|
+
className="demo-number-field"
|
|
242
|
+
locale={locale}
|
|
243
|
+
format={{ style: "percent" }}
|
|
244
|
+
defaultValue={0.25}
|
|
245
|
+
min={0}
|
|
246
|
+
max={1}
|
|
247
|
+
stepOnWheel
|
|
248
|
+
>
|
|
249
|
+
<NumberField.Label className="demo-number-label">Discount (wheel on)</NumberField.Label>
|
|
250
|
+
<div className="demo-number-group">
|
|
251
|
+
<NumberField.Decrement className="demo-number-step" aria-label={decrease}>
|
|
252
|
+
−
|
|
253
|
+
</NumberField.Decrement>
|
|
254
|
+
<NumberField.Input className="demo-number-input" />
|
|
255
|
+
<NumberField.Increment className="demo-number-step" aria-label={increase}>
|
|
256
|
+
+
|
|
257
|
+
</NumberField.Increment>
|
|
258
|
+
</div>
|
|
259
|
+
</NumberField.Root>
|
|
260
|
+
</div>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
`number-field.css`: the same file as above.
|
|
266
|
+
|
|
267
|
+
- `format` is `Intl.NumberFormatOptions`: `style` `"decimal"` (default), `"percent"` (the value is a fraction, `0.25` shows `25%`; default `step` `0.01`), `"currency"` and `"unit"`, plus fraction digits, grouping, sign display and numbering system.
|
|
268
|
+
- **Pass `locale`**. The default is the runtime's locale (on the server and in the browser alike); a development warning fires when the page's `lang` disagrees and no `locale` was given.
|
|
269
|
+
- The parser accepts what the formatter produces: the locale's decimal and group separators and digits (Arabic-Indic, Devanagari, full-width), the currency or unit in any spelling (`€`, `EUR`, `euros`), a leading or trailing minus, U+2212 and accounting parentheses. **Grouping is strict**: a group separator must sit before the decimal separator and be followed by a whole group, so `1,5` in English is not 15 and `1.5` in German is not 15; the text reverts instead of silently becoming ten times larger.
|
|
270
|
+
- The committed value is **rounded to what the text shows** (the format's maximum fraction digits): `1.999` in a euro field commits `2` and shows `2,00 €`, so what the user sees is what the form posts. Stepped values are rounded the same way (a `step` finer than the format cannot post a digit the text hides). Set `maximumFractionDigits` higher for more precision. `notation: "compact"` cannot be parsed back and logs a development warning.
|
|
271
|
+
|
|
272
|
+
### Constraints: not clamped, reported
|
|
273
|
+
|
|
274
|
+
Like a native number input, a **typed** value is neither clamped to `min` / `max` nor snapped to `step`: it stays as typed, the hidden input reports `rangeUnderflow`, `rangeOverflow` or `stepMismatch`, the browser's localised message is mirrored onto the visible input, and the form does not submit until it is fixed. **Stepping** does clamp and snap, with the HTML `stepUp()` rules: an off-grid value snaps in the direction of the step, the step base is `min` (else `0`; give `min` when the grid matters), and a button is `disabled` when its next step would change nothing (judged from the draft while one is open; an unreachable `max` stays unreachable: `0`–`5` by `2` stops at `4`). To clamp typed values, do it in a controlled parent's `valueChangeAction`.
|
|
275
|
+
|
|
276
|
+
## Props
|
|
277
|
+
|
|
278
|
+
### `NumberField.Root`
|
|
279
|
+
|
|
280
|
+
| Prop | Type | Default | Description |
|
|
281
|
+
| - | - | - | - |
|
|
282
|
+
| `value` | `number \| null` | – | Controlled value; `null` is empty, `undefined` uncontrolled. `NaN` / `Infinity` are treated as empty (development warning). |
|
|
283
|
+
| `defaultValue` | `number \| null` | `null` | Initial value in uncontrolled mode; also the form-reset target (the latest value). |
|
|
284
|
+
| `valueChangeAction` | `ChangeAction<number \| null, NumberFieldValueChangeDetails>` | – | Runs in the Root's step transition on every step. Awaited; `data-pending` meanwhile. Adopt the value here in a controlled parent. Not the place for a save. |
|
|
285
|
+
| `valueCommitAction` | `ChangeAction<number \| null, NumberFieldValueChangeDetails>` | – | Runs in the Root's commit transition once per gesture. Awaited; the field keeps the gesture's value with `data-pending` until it settles. Uncontrolled, the value is committed when it resolves and reverts when it rejects. May be a Server Function. |
|
|
286
|
+
| `min, max` | `number` | – | Native constraints on the hidden input, and the bounds of stepping. Home / End go to them when set. |
|
|
287
|
+
| `step` | `number` | `1 (0.01 for style "percent")` | Native `step` and the stepping grid from `min` (else 0). |
|
|
288
|
+
| `largeStep` | `number` | `10 × step` | PageUp / PageDown and Shift+Arrow. |
|
|
289
|
+
| `format` | `Intl.NumberFormatOptions` | – | How the text is formatted and parsed: `decimal`, `percent`, `currency`, `unit`, fraction digits, grouping, sign display, numbering system. |
|
|
290
|
+
| `locale` | `string \| readonly string[]` | `runtime locale` | BCP 47 tag(s) for formatting and parsing. Pass the page's `lang` (development warning when it disagrees and this is absent). |
|
|
291
|
+
| `stepOnWheel` | `boolean` | `false` | Step with the mouse wheel while the input is focused (a native non-passive listener; the page does not scroll then). |
|
|
292
|
+
| `name, form` | `string` | – | On the hidden number input, which posts `String(value)` (`""` when empty). `name` defaults to the Field's. |
|
|
293
|
+
| `disabled` | `boolean` | `false` | Disables both inputs (not submitted) and the buttons. An ancestor `<fieldset disabled>` does the same (the buttons ignore the pointer too), but `data-disabled` and `state.disabled` stay this prop's. |
|
|
294
|
+
| `readOnly` | `boolean` | `false` | Native `readonly` on both inputs; no stepping, buttons disabled. |
|
|
295
|
+
| `required` | `boolean` | `false` | On the hidden input: an empty field is `valueMissing`. Or the Field's. |
|
|
296
|
+
| `announce` | `(value: number \| null, state: NumberFieldState) => string \| null` | `state.text` | What is announced after a key press, a wheel event, a click activation and a hold's release (not per tick, not for typed text). `null` announces nothing. |
|
|
297
|
+
| `className` | `string \| ((state: NumberFieldState) => string \| undefined)` | – | A class name, or a function of the part's state. |
|
|
298
|
+
| `style` | `CSSProperties \| ((state: NumberFieldState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
|
|
299
|
+
| `children` | `ReactNode \| ((state: NumberFieldState) => ReactNode)` | – | The parts. The function form receives the state. |
|
|
300
|
+
| `render` | `ReactElement \| ((props, state: NumberFieldState) => ReactNode)` | – | Replace the default \<div> (element form) or take over rendering (function form). |
|
|
301
|
+
|
|
302
|
+
- **State**: `NumberFieldState` (every part but the buttons) is `{ value, text, pending, disabled, readOnly, required }`; `value` is the shown value (the gesture's while one is open or in flight) and `text` the shown text (the draft while editing).
|
|
303
|
+
- **Owned**: `role` (`"group"`), `aria-labelledby` (your tokens, then the Label's id while one is mounted, then a Field label's), `data-pending`, `data-disabled`, `data-invalid` (inside a Field).
|
|
304
|
+
|
|
305
|
+
Details are `{ reason, source, event }`: `reason` is `"activate"`, `"platform"` (a form reset, text found at hydration) or `"dismiss"` (the revert after a failed save, steps only); `source` is one of `"input"`, `"increment"`, `"decrement"`, `"keyboard"`, `"wheel"`, or `null` on platform paths and the revert; `event` is the DOM event, and `undefined` for the repeats of a held button, a hold that ended at its bound, hydration and the revert. There is no `transition` prop on any part; the dispatches carry the types `fsui-number-field` plus `fsui-number-field-change` (step) or `fsui-number-field-commit` (gesture) for your own boundaries.
|
|
306
|
+
|
|
307
|
+
### `NumberField.Input`
|
|
308
|
+
|
|
309
|
+
| Prop | Type | Default | Description |
|
|
310
|
+
| - | - | - | - |
|
|
311
|
+
| `hiddenInputRef` | `Ref<HTMLInputElement>` | – | The hidden native `<input type="number">` rendered after the visible input (`ref` is the visible one). |
|
|
312
|
+
| `inputMode, autoComplete, autoCorrect, spellCheck` | `string, string, string, boolean` | `"numeric" or "decimal", "off", "off", false` | `inputMode` is `"decimal"` when fractions are allowed, else `"numeric"`. Defaults your own prop replaces. |
|
|
313
|
+
| `className` | `string \| ((state: NumberFieldState) => string \| undefined)` | – | A class name, or a function of the part's state. |
|
|
314
|
+
| `style` | `CSSProperties \| ((state: NumberFieldState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
|
|
315
|
+
| `render` | `ReactElement \| ((props, state: NumberFieldState) => ReactNode)` | – | Replace the default \<input> (element form) or take over rendering (function form). |
|
|
316
|
+
|
|
317
|
+
- **State**: `NumberFieldState`.
|
|
318
|
+
- **Owned**: on the visible input: `id`, `type` (`text`, or `search` / `tel` from a `render` element; a `number` element logs a warning), `value`, `disabled`, `readOnly`, `onChange`, `onKeyDown`, `onBlur`, `aria-invalid` and `aria-describedby` (inside a Field), `data-pending`, `data-disabled`, `data-invalid`. `name`, `min`, `max`, `step`, `required` and `pattern` are not props: constraints live on the hidden input.
|
|
319
|
+
|
|
320
|
+
`placeholder`, `aria-*`, `onFocus`, `onPaste`, `onCompositionStart` / `onCompositionEnd` and the rest pass through. A constraint on the visible input would make it invalid for a reason nobody reports.
|
|
321
|
+
|
|
322
|
+
### `NumberField.Increment`, `NumberField.Decrement`
|
|
323
|
+
|
|
324
|
+
| Prop | Type | Default | Description |
|
|
325
|
+
| - | - | - | - |
|
|
326
|
+
| `disabled` | `boolean` | `false` | Also disabled by the Root's `disabled` / `readOnly`, and when the next step would change nothing. Native `disabled` on a `<button>`; with a link or component `render`, `aria-disabled="true"` instead, in all three cases. |
|
|
327
|
+
| `aria-label` | `string` | `"Increase" / "Decrease"` | The built-in English names. Your `aria-label` (or `aria-labelledby`) replaces them; pass the same text as `aria-label` to let a text label name the button. |
|
|
328
|
+
| `className` | `string \| ((state: NumberFieldButtonState) => string \| undefined)` | – | A class name, or a function of the part's state. |
|
|
329
|
+
| `style` | `CSSProperties \| ((state: NumberFieldButtonState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
|
|
330
|
+
| `children` | `ReactNode \| ((state: NumberFieldButtonState) => ReactNode)` | – | Content, or a function of the part's state. |
|
|
331
|
+
| `render` | `ReactElement \| ((props, state: NumberFieldButtonState) => ReactNode)` | – | Replace the default \<button> (element form) or take over rendering (function form). |
|
|
332
|
+
|
|
333
|
+
- **State**: `NumberFieldButtonState` is `{ pending, disabled }`; `pending` is true while the latest step or commit came from this button and is in flight.
|
|
334
|
+
- **Owned**: `type` (`"button"`, on a `<button>` only), `tabIndex` (`-1`), `aria-controls`, `disabled`, `aria-disabled` (link or component `render`), `onPointerDown`, `onClick`, `onContextMenu`, `data-pending`, `data-disabled`.
|
|
335
|
+
|
|
336
|
+
### `NumberField.Label`
|
|
337
|
+
|
|
338
|
+
| Prop | Type | Default | Description |
|
|
339
|
+
| - | - | - | - |
|
|
340
|
+
| `className` | `string \| ((state: NumberFieldState) => string \| undefined)` | – | A class name, or a function of the part's state. |
|
|
341
|
+
| `style` | `CSSProperties \| ((state: NumberFieldState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
|
|
342
|
+
| `children` | `ReactNode \| ((state: NumberFieldState) => ReactNode)` | – | Content, or a function of the part's state. |
|
|
343
|
+
| `render` | `ReactElement \| ((props, state: NumberFieldState) => ReactNode)` | – | Replace the default \<label> (element form) or take over rendering (function form). |
|
|
344
|
+
|
|
345
|
+
- **State**: `NumberFieldState`.
|
|
346
|
+
- **Owned**: `id`, `htmlFor`, `data-pending`, `data-disabled`.
|
|
347
|
+
|
|
348
|
+
Must stay a `<label>`: it names the visible input through `for` and, through its id, the Root group.
|
|
349
|
+
|
|
350
|
+
## Data attributes
|
|
351
|
+
|
|
352
|
+
| Hook | On | Meaning |
|
|
353
|
+
| - | - | - |
|
|
354
|
+
| `data-pending` | Root, Label, Input | A step (with a `valueChangeAction`) or commit is in flight. |
|
|
355
|
+
| `data-pending` | Increment / Decrement | The latest step or commit came from this button and is in flight. |
|
|
356
|
+
| `data-disabled` | every part | Disabled (the buttons also at their bound and when read-only). |
|
|
357
|
+
| `data-invalid` | Root, Input | Inside a Field that shows an error. |
|
|
358
|
+
| `:user-invalid`, `:read-only`, `:disabled`, `:placeholder-shown` | the visible input | The platform's own states. |
|
|
359
|
+
| `:active` | a held button | No `data-holding`: the platform has it. |
|
|
360
|
+
|
|
361
|
+
```css
|
|
362
|
+
.number-field { display: inline-grid; grid-template-columns: auto 1fr auto; }
|
|
363
|
+
.number-field .input { min-width: 6ch; text-align: end; font-variant-numeric: tabular-nums; }
|
|
364
|
+
.number-field .step { inline-size: 2.25rem; }
|
|
365
|
+
.number-field .step:disabled { opacity: .4; }
|
|
366
|
+
.number-field .input[data-pending] { background-image: var(--spinner); background-repeat: no-repeat; }
|
|
367
|
+
.number-field .step[data-pending] { cursor: progress; }
|
|
368
|
+
.number-field .input:user-invalid { border-color: var(--danger); }
|
|
369
|
+
.number-field[data-invalid] .step { border-color: var(--danger); }
|
|
370
|
+
.number-field:has(.input:focus-visible) { outline: 2px solid var(--accent); }
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
The buttons' order is your markup's: an RTL page places `Decrement` first in source if it wants it at the inline start.
|
|
374
|
+
|
|
375
|
+
## Keyboard and ARIA
|
|
376
|
+
|
|
377
|
+
| Input | Effect |
|
|
378
|
+
| - | - |
|
|
379
|
+
| ArrowUp / ArrowDown | ± step from the parsed draft or the shown value (empty counts as 0), snapped and clamped. |
|
|
380
|
+
| Shift+Arrow, PageUp / PageDown | ± largeStep. |
|
|
381
|
+
| Home / End | `min` / the largest step at or below `max`, only when that bound is set; otherwise the caret moves. Shift+Home / Shift+End always select text. |
|
|
382
|
+
| Enter | Commits the draft. Not prevented: inside a form with a submit button the implicit submission follows and posts the committed value. |
|
|
383
|
+
| Everything else | Text editing. Tab leaves the field and the blur commits. |
|
|
384
|
+
| A button press | One step at once, then a repeat after 400 ms and every 60 ms while held; one commit at the release. |
|
|
385
|
+
| The wheel (`stepOnWheel`) | One step per wheel event while the input is focused; unfocused, the page scrolls. |
|
|
386
|
+
|
|
387
|
+
- Each key press, wheel event and click activation is its own gesture: a step and a commit. With a slow `valueCommitAction` a wheel flick is several commits; the latest wins.
|
|
388
|
+
- A press on a button is `preventDefault()`ed: focus stays where it was (the library never moves it), a touch opens no keyboard, and no text is selected. The buttons are not Tab stops (`tabindex="-1"`, as the APG asks); a click with no pointer (assistive technology) steps once.
|
|
389
|
+
- The iPhone's numeric keypads have no minus key; pass `inputMode="text"` when negatives must be typed there.
|
|
390
|
+
|
|
391
|
+
### Accessibility
|
|
392
|
+
|
|
393
|
+
- **No `role="spinbutton"`.** On a text input VoiceOver announces the wrong value for a spinbutton and its gestures rewrite the text, so the visible input is a plain textbox (as in React Aria and Base UI). The formatted text is its value, the group tells the user what the buttons change, and each step is **announced**.
|
|
394
|
+
- **Announcements** go through `ariaNotify()` on the input (every supported browser has it; no live region is rendered). The default is the formatted text (`"2"`, `"1,50 €"`, `"50%"`); override with `announce`.
|
|
395
|
+
- **No `aria-roledescription`**: it would replace "edit text", the cue that the field takes typing. Pass one through `NumberField.Input` if you want it.
|
|
396
|
+
- The hidden number input is `aria-hidden` and unfocusable; its `invalid` event is always cancelled, so the browser reports on (and focuses) the visible input, which mirrors its `validationMessage`.
|
|
397
|
+
|
|
398
|
+
## Transition types
|
|
399
|
+
|
|
400
|
+
Concept: [Transitions & ViewTransition](../concepts/transitions.md#transition-types)
|
|
401
|
+
|
|
402
|
+
A step: `fsui-number-field` plus `fsui-number-field-change`. A gesture's save (`valueCommitAction`): `fsui-number-field` plus `fsui-number-field-commit`. No part takes a `transition` prop; use the types in your own boundaries.
|
|
403
|
+
|
|
404
|
+
## Optimistic and pending
|
|
405
|
+
|
|
406
|
+
Concept: [Pending & optimistic state](../concepts/pending-and-optimistic.md)
|
|
407
|
+
|
|
408
|
+
Typed text is an internal urgent draft, committed on blur and Enter. The input shows the value the gesture reached while a button is held, a step waits for its commit, or anything is in flight. `data-pending` is on the Root, Label and Input while a step (with a `valueChangeAction`) or commit is in flight, and on the Increment or Decrement button it came from.
|
|
409
|
+
|
|
410
|
+
## Suspense
|
|
411
|
+
|
|
412
|
+
Concept: [Suspense](../concepts/suspense.md)
|
|
413
|
+
|
|
414
|
+
Nothing specific: the NumberField renders no content region.
|
|
415
|
+
|
|
416
|
+
## Browser-owned state
|
|
417
|
+
|
|
418
|
+
Concept: [Browser-owned state](../concepts/browser-owned-state.md)
|
|
419
|
+
|
|
420
|
+
The hidden input's form reset is the browser's; the library then dispatches one step and one commit with `reason: "platform"`.
|
|
421
|
+
|
|
422
|
+
## Before hydration
|
|
423
|
+
|
|
424
|
+
Concept: [Server Components](../concepts/server-components.md#before-hydration)
|
|
425
|
+
|
|
426
|
+
The text can be typed; at hydration a parsable change is adopted with one `"platform"` step and commit. A form submitted before hydration posts the default value; the buttons do nothing yet. For a number field that needs no JavaScript, see [Plain HTML](#plain-html).
|
|
427
|
+
|
|
428
|
+
### Plain HTML
|
|
429
|
+
|
|
430
|
+
A native number input is the JS-free number field. A Server Component can render it with no library code, and it works before hydration and without it:
|
|
431
|
+
|
|
432
|
+
```tsx
|
|
433
|
+
// A Server Component: no import from @funstack/ui.
|
|
434
|
+
<label>
|
|
435
|
+
Quantity
|
|
436
|
+
<input type="number" name="quantity" min={1} max={99} step={1} defaultValue={cart.quantity} />
|
|
437
|
+
</label>
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
The browser steps it with ArrowUp / ArrowDown, validates `min`, `max` and `step` (`:user-invalid`) and posts the number. Compared with `NumberField`, it gives up what the component is for: no `format` (currency, percent, units, grouping), no parsing of the user's locale, no Increment / Decrement parts with press-and-hold, and no announcement of each step. It also has no `valueChangeAction` / `valueCommitAction` (no single save per gesture with rollback, no `data-pending`), no data attributes, and no [Field](#inside-a-field) integration.
|
|
441
|
+
|
|
442
|
+
## Forms
|
|
443
|
+
|
|
444
|
+
- The hidden input posts `String(value)` (`quantity=12`, `price=12.5`), `""` when empty, nothing when disabled; the text is never posted.
|
|
445
|
+
- **Form reset** is the platform's for the hidden input (its `defaultValue` is the reset target: the latest `defaultValue` uncontrolled, the mount-time value controlled); the library then dispatches one step and one commit with `reason: "platform"` and clears an open draft.
|
|
446
|
+
- **Before hydration** the text can be typed; at hydration a parsable change is adopted with one `"platform"` step and commit (or kept as the draft while the input is still focused). A form submitted before hydration posts the default value; the buttons do nothing yet. For a number field that needs no JavaScript at all, see [Plain HTML](#plain-html).
|
|
447
|
+
- A step writes the hidden input by script, so a `<form onChange>` listener hears typed edits only.
|
|
448
|
+
|
|
449
|
+
## Recipes
|
|
450
|
+
|
|
451
|
+
### Inside a Field
|
|
452
|
+
|
|
453
|
+
```tsx title="NumberFieldField.tsx"
|
|
454
|
+
"use client";
|
|
455
|
+
import { startTransition, useState } from "react";
|
|
456
|
+
import { Field } from "@funstack/ui/field";
|
|
457
|
+
import { Form } from "@funstack/ui/form";
|
|
458
|
+
import { NumberField } from "@funstack/ui/number-field";
|
|
459
|
+
import { fakeSave } from "./fake-api.js";
|
|
460
|
+
|
|
461
|
+
// A NumberField as a Field's control. `min`, `max` and `step` are native constraints on the hidden
|
|
462
|
+
// number input: a typed 7 is kept as typed and reported (`validity.stepMismatch`), not snapped.
|
|
463
|
+
// The browser's message is mirrored onto the visible input, so `:user-invalid`, the blocked
|
|
464
|
+
// submission and the focus move all land there. A + press snaps to the grid and clears it.
|
|
465
|
+
export function NumberFieldField() {
|
|
466
|
+
const [saved, setSaved] = useState<string | null>(null);
|
|
467
|
+
return (
|
|
468
|
+
<Form.Root
|
|
469
|
+
className="demo-form"
|
|
470
|
+
autoReset={false}
|
|
471
|
+
action={async (formData) => {
|
|
472
|
+
await fakeSave("the order");
|
|
473
|
+
startTransition(() => setSaved(String(formData.get("quantity"))));
|
|
474
|
+
}}
|
|
475
|
+
>
|
|
476
|
+
<Field.Root name="quantity" className="demo-fieldset">
|
|
477
|
+
<Field.Label className="demo-label">Quantity</Field.Label>
|
|
478
|
+
<NumberField.Root
|
|
479
|
+
className="demo-number-field"
|
|
480
|
+
locale="en-US"
|
|
481
|
+
min={6}
|
|
482
|
+
max={120}
|
|
483
|
+
step={6}
|
|
484
|
+
defaultValue={6}
|
|
485
|
+
>
|
|
486
|
+
<div className="demo-number-group">
|
|
487
|
+
<NumberField.Decrement className="demo-number-step">−</NumberField.Decrement>
|
|
488
|
+
<NumberField.Input className="demo-number-input" />
|
|
489
|
+
<NumberField.Increment className="demo-number-step">+</NumberField.Increment>
|
|
490
|
+
</div>
|
|
491
|
+
</NumberField.Root>
|
|
492
|
+
<Field.Description className="demo-description">
|
|
493
|
+
Sold in packs of six, up to 120.
|
|
494
|
+
</Field.Description>
|
|
495
|
+
<Field.Error className="demo-field-error">
|
|
496
|
+
{({ validity, messages }) =>
|
|
497
|
+
validity.stepMismatch ? "Enter a multiple of six." : messages.join(" ")
|
|
498
|
+
}
|
|
499
|
+
</Field.Error>
|
|
500
|
+
</Field.Root>
|
|
501
|
+
<div className="demo-row">
|
|
502
|
+
<Form.Submit className="demo-button demo-primary demo-submit">
|
|
503
|
+
{({ pending }) => (
|
|
504
|
+
<>
|
|
505
|
+
{pending && <span className="demo-spinner" aria-hidden />}
|
|
506
|
+
Order
|
|
507
|
+
</>
|
|
508
|
+
)}
|
|
509
|
+
</Form.Submit>
|
|
510
|
+
</div>
|
|
511
|
+
{saved !== null && <output className="demo-readout">Ordered {saved}.</output>}
|
|
512
|
+
</Form.Root>
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
`number-field.css`: the same file as above.
|
|
518
|
+
|
|
519
|
+
- The visible input is the Field's control: it takes the Field's id (so `Field.Label`'s `for` names it), its description and error, and the focus of a blocked submission. The Root's group is named by `Field.Label` too.
|
|
520
|
+
- The validity is the **hidden input's**: `Field.Error`'s function `children` sees `validity.stepMismatch`, `rangeUnderflow`, `rangeOverflow` and `valueMissing`, and the Field writes `validate`'s message and server errors there, mirrored onto the visible input.
|
|
521
|
+
- `name` and `required` go to the hidden input, `disabled` to both inputs and the buttons. `validate` receives `String(number)` (the committed value, not the draft), so `Number(value)` is safe.
|
|
522
|
+
- A step or a typed commit counts as an edit (it re-runs `validate` and dismisses a server error); a rollback or a form reset re-runs `validate` only.
|
|
523
|
+
- The [two channels](../concepts/action-props.md#form-channel) stay separate: the field's own save is its `data-pending`, the form's submission is the Field's.
|
|
524
|
+
|
|
525
|
+
```tsx
|
|
526
|
+
// A Server Function as the save, straight from a Server Component:
|
|
527
|
+
<NumberField.Root defaultValue={line.quantity} min={1} locale="en-US" valueCommitAction={saveQuantity}>…</NumberField.Root>
|
|
528
|
+
```
|