@funstack/ui 0.1.0-alpha.22 → 0.1.0-alpha.24
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/dist/accordion/accordion-context.mjs +1 -2
- package/dist/accordion/accordion-item.d.mts +1 -3
- package/dist/accordion/accordion-item.d.mts.map +1 -1
- package/dist/accordion/accordion-item.mjs +14 -8
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.d.mts +1 -3
- package/dist/accordion/accordion-panel.d.mts.map +1 -1
- package/dist/accordion/accordion-panel.mjs +3 -4
- package/dist/accordion/accordion-root.d.mts +1 -3
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +12 -15
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.d.mts +1 -3
- package/dist/accordion/accordion-trigger.d.mts.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +4 -5
- package/dist/accordion/index.d.mts +0 -2
- package/dist/accordion/index.d.mts.map +1 -1
- package/dist/accordion/index.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-action.d.mts +5 -5
- package/dist/alert-dialog/alert-dialog-action.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-action.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-action.mjs.map +1 -1
- package/dist/alert-dialog/alert-dialog-cancel.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-cancel.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-cancel.mjs +4 -5
- package/dist/alert-dialog/alert-dialog-context.mjs +2 -3
- package/dist/alert-dialog/alert-dialog-description.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-description.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-description.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-form.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-form.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-form.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-popup.d.mts +1 -3
- package/dist/alert-dialog/alert-dialog-popup.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-popup.mjs +3 -4
- package/dist/alert-dialog/alert-dialog-root.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-root.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-root.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-title.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-title.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-title.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-trigger.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-trigger.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-trigger.mjs +1 -2
- package/dist/alert-dialog/index.d.mts +0 -2
- package/dist/alert-dialog/index.d.mts.map +1 -1
- package/dist/alert-dialog/index.mjs +1 -2
- package/dist/avatar/avatar-context.mjs +1 -2
- package/dist/avatar/avatar-fallback.d.mts +1 -3
- package/dist/avatar/avatar-fallback.d.mts.map +1 -1
- package/dist/avatar/avatar-fallback.mjs +1 -2
- package/dist/avatar/avatar-image.d.mts +1 -3
- package/dist/avatar/avatar-image.d.mts.map +1 -1
- package/dist/avatar/avatar-image.mjs +2 -3
- package/dist/avatar/avatar-root.d.mts +1 -3
- package/dist/avatar/avatar-root.d.mts.map +1 -1
- package/dist/avatar/avatar-root.mjs +2 -3
- package/dist/avatar/index.d.mts +1 -3
- package/dist/avatar/index.d.mts.map +1 -1
- package/dist/avatar/index.mjs +1 -2
- package/dist/bin/skill-installer.mjs +1 -2
- package/dist/button/button.d.mts +1 -3
- package/dist/button/button.d.mts.map +1 -1
- package/dist/button/button.mjs +4 -5
- package/dist/checkbox/checkbox.d.mts +1 -3
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +2 -3
- package/dist/checkbox-group/checkbox-group-context.mjs +1 -2
- package/dist/checkbox-group/checkbox-group-item.d.mts +1 -3
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +5 -6
- package/dist/checkbox-group/checkbox-group-label.d.mts +1 -3
- package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.mjs +1 -2
- package/dist/checkbox-group/checkbox-group-parent.d.mts +1 -3
- package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +7 -8
- package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +1 -3
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +7 -8
- package/dist/checkbox-group/index.d.mts +1 -3
- package/dist/checkbox-group/index.d.mts.map +1 -1
- package/dist/checkbox-group/index.mjs +1 -2
- package/dist/collapsible/collapsible-context.mjs +1 -2
- package/dist/collapsible/collapsible-panel.d.mts +1 -3
- package/dist/collapsible/collapsible-panel.d.mts.map +1 -1
- package/dist/collapsible/collapsible-panel.mjs +3 -4
- package/dist/collapsible/collapsible-root.d.mts +1 -3
- package/dist/collapsible/collapsible-root.d.mts.map +1 -1
- package/dist/collapsible/collapsible-root.mjs +18 -18
- package/dist/collapsible/collapsible-root.mjs.map +1 -1
- package/dist/collapsible/collapsible-trigger.d.mts +1 -3
- package/dist/collapsible/collapsible-trigger.d.mts.map +1 -1
- package/dist/collapsible/collapsible-trigger.mjs +4 -5
- package/dist/collapsible/index.d.mts +0 -2
- package/dist/collapsible/index.d.mts.map +1 -1
- package/dist/collapsible/index.mjs +1 -2
- package/dist/combobox/chip-text.mjs +1 -2
- package/dist/combobox/combobox-chips.d.mts +1 -3
- package/dist/combobox/combobox-chips.d.mts.map +1 -1
- package/dist/combobox/combobox-chips.mjs +3 -4
- package/dist/combobox/combobox-clear.d.mts +1 -3
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +2 -3
- package/dist/combobox/combobox-context.mjs +1 -2
- package/dist/combobox/combobox-group.d.mts +1 -3
- package/dist/combobox/combobox-group.d.mts.map +1 -1
- package/dist/combobox/combobox-group.mjs +2 -3
- package/dist/combobox/combobox-input.d.mts +1 -3
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +5 -6
- package/dist/combobox/combobox-keyboard.mjs +4 -4
- package/dist/combobox/combobox-keyboard.mjs.map +1 -1
- package/dist/combobox/combobox-label.d.mts +1 -3
- package/dist/combobox/combobox-label.d.mts.map +1 -1
- package/dist/combobox/combobox-label.mjs +2 -3
- package/dist/combobox/combobox-list.d.mts +1 -3
- package/dist/combobox/combobox-list.d.mts.map +1 -1
- package/dist/combobox/combobox-list.mjs +3 -4
- package/dist/combobox/combobox-option.d.mts +1 -3
- package/dist/combobox/combobox-option.d.mts.map +1 -1
- package/dist/combobox/combobox-option.mjs +2 -3
- package/dist/combobox/combobox-popup.d.mts +1 -3
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +4 -5
- package/dist/combobox/combobox-root.d.mts +1 -3
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +14 -15
- package/dist/combobox/combobox-trigger.d.mts +1 -3
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +5 -6
- package/dist/combobox/index.d.mts +1 -3
- package/dist/combobox/index.d.mts.map +1 -1
- package/dist/combobox/index.mjs +1 -2
- package/dist/combobox/use-combobox-form.mjs +3 -5
- package/dist/combobox/use-combobox-form.mjs.map +1 -1
- package/dist/combobox/use-combobox-text.mjs +3 -4
- package/dist/csp/csp-provider.d.mts +0 -2
- package/dist/csp/csp-provider.d.mts.map +1 -1
- package/dist/csp/csp-provider.mjs +2 -3
- package/dist/csp/style-hashes.d.mts +0 -2
- package/dist/csp/style-hashes.d.mts.map +1 -1
- package/dist/csp/style-hashes.mjs +1 -2
- package/dist/dialog/dialog-close.d.mts +10 -6
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +5 -5
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-context.mjs +1 -2
- package/dist/dialog/dialog-description.d.mts +1 -3
- package/dist/dialog/dialog-description.d.mts.map +1 -1
- package/dist/dialog/dialog-description.mjs +1 -2
- package/dist/dialog/dialog-dismiss.mjs +52 -21
- package/dist/dialog/dialog-dismiss.mjs.map +1 -1
- package/dist/dialog/dialog-form.d.mts +1 -3
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +6 -7
- package/dist/dialog/dialog-popup.d.mts +2 -4
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +10 -11
- package/dist/dialog/dialog-root.d.mts +1 -3
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +3 -4
- package/dist/dialog/dialog-title.d.mts +1 -3
- package/dist/dialog/dialog-title.d.mts.map +1 -1
- package/dist/dialog/dialog-title.mjs +1 -2
- package/dist/dialog/dialog-trigger.d.mts +1 -3
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +4 -5
- package/dist/dialog/index.d.mts +1 -3
- package/dist/dialog/index.d.mts.map +1 -1
- package/dist/dialog/index.mjs +1 -2
- package/dist/docs/components/accordion.md +1 -1
- package/dist/docs/components/alert-dialog.md +15 -7
- package/dist/docs/components/collapsible.md +1 -1
- package/dist/docs/components/dialog.md +14 -6
- package/dist/docs/components/drawer.md +3 -3
- package/dist/docs/components/field.md +2 -2
- package/dist/docs/components/menu.md +3 -3
- package/dist/docs/components/popover.md +6 -6
- package/dist/docs/concepts/pending-and-optimistic.md +1 -0
- package/dist/docs/roadmap.md +4 -0
- package/dist/drawer/drawer-close.d.mts +0 -2
- package/dist/drawer/drawer-close.d.mts.map +1 -1
- package/dist/drawer/drawer-close.mjs +1 -2
- package/dist/drawer/drawer-description.d.mts +0 -2
- package/dist/drawer/drawer-description.d.mts.map +1 -1
- package/dist/drawer/drawer-description.mjs +1 -2
- package/dist/drawer/drawer-form.d.mts +0 -2
- package/dist/drawer/drawer-form.d.mts.map +1 -1
- package/dist/drawer/drawer-form.mjs +1 -2
- package/dist/drawer/drawer-popup.d.mts +2 -4
- package/dist/drawer/drawer-popup.d.mts.map +1 -1
- package/dist/drawer/drawer-popup.mjs +3 -4
- package/dist/drawer/drawer-root.d.mts +0 -2
- package/dist/drawer/drawer-root.d.mts.map +1 -1
- package/dist/drawer/drawer-root.mjs +1 -2
- package/dist/drawer/drawer-swipe.d.mts +0 -2
- package/dist/drawer/drawer-swipe.d.mts.map +1 -1
- package/dist/drawer/drawer-swipe.mjs +1 -2
- package/dist/drawer/drawer-swipe.mjs.map +1 -1
- package/dist/drawer/drawer-title.d.mts +0 -2
- package/dist/drawer/drawer-title.d.mts.map +1 -1
- package/dist/drawer/drawer-title.mjs +1 -2
- package/dist/drawer/drawer-trigger.d.mts +0 -2
- package/dist/drawer/drawer-trigger.d.mts.map +1 -1
- package/dist/drawer/drawer-trigger.mjs +1 -2
- package/dist/drawer/index.d.mts +0 -2
- package/dist/drawer/index.d.mts.map +1 -1
- package/dist/drawer/index.mjs +1 -2
- package/dist/field/field-control.d.mts +2 -4
- package/dist/field/field-control.d.mts.map +1 -1
- package/dist/field/field-control.mjs +6 -7
- package/dist/field/field-description.d.mts +2 -4
- package/dist/field/field-description.d.mts.map +1 -1
- package/dist/field/field-description.mjs +2 -3
- package/dist/field/field-error.d.mts +2 -4
- package/dist/field/field-error.d.mts.map +1 -1
- package/dist/field/field-error.mjs +3 -4
- package/dist/field/field-label.d.mts +2 -4
- package/dist/field/field-label.d.mts.map +1 -1
- package/dist/field/field-label.mjs +3 -4
- package/dist/field/field-root.d.mts +2 -4
- package/dist/field/field-root.d.mts.map +1 -1
- package/dist/field/field-root.mjs +81 -31
- package/dist/field/field-root.mjs.map +1 -1
- package/dist/field/index.d.mts +0 -2
- package/dist/field/index.d.mts.map +1 -1
- package/dist/field/index.mjs +1 -2
- package/dist/field/use-server-error-visibility.mjs +22 -8
- package/dist/field/use-server-error-visibility.mjs.map +1 -1
- package/dist/form/form-root.d.mts +1 -3
- package/dist/form/form-root.d.mts.map +1 -1
- package/dist/form/form-root.mjs +8 -9
- package/dist/form/form-submit.d.mts +1 -3
- package/dist/form/form-submit.d.mts.map +1 -1
- package/dist/form/form-submit.mjs +3 -4
- package/dist/form/index.d.mts +0 -2
- package/dist/form/index.d.mts.map +1 -1
- package/dist/form/index.mjs +1 -2
- package/dist/hover-card/hover-card-context.mjs +1 -2
- package/dist/hover-card/hover-card-popup.d.mts +2 -4
- package/dist/hover-card/hover-card-popup.d.mts.map +1 -1
- package/dist/hover-card/hover-card-popup.mjs +6 -7
- package/dist/hover-card/hover-card-root.d.mts +1 -3
- package/dist/hover-card/hover-card-root.d.mts.map +1 -1
- package/dist/hover-card/hover-card-root.mjs +3 -4
- package/dist/hover-card/hover-card-trigger.d.mts +1 -3
- package/dist/hover-card/hover-card-trigger.d.mts.map +1 -1
- package/dist/hover-card/hover-card-trigger.mjs +5 -6
- package/dist/hover-card/index.d.mts +0 -2
- package/dist/hover-card/index.d.mts.map +1 -1
- package/dist/hover-card/index.mjs +1 -2
- package/dist/hover-card/use-hover-card-interest.mjs +7 -22
- package/dist/hover-card/use-hover-card-interest.mjs.map +1 -1
- package/dist/index.d.mts +41 -35
- package/dist/internal/action/action-details.mjs +1 -2
- package/dist/internal/action/call-urgent-handler.mjs +1 -2
- package/dist/internal/action/report-dropped.mjs +1 -2
- package/dist/internal/action/use-action-trigger.mjs +2 -3
- package/dist/internal/action/use-connected.mjs +1 -2
- package/dist/internal/action/use-controllable-action.mjs +4 -5
- package/dist/internal/action/use-multiple-selection.mjs +4 -5
- package/dist/internal/action/use-pure-trigger.mjs +1 -2
- package/dist/internal/action/use-pure-trigger.mjs.map +1 -1
- package/dist/internal/action/use-step-commit.mjs +3 -4
- package/dist/internal/after-dispatch.mjs +23 -0
- package/dist/internal/after-dispatch.mjs.map +1 -0
- package/dist/internal/announce.mjs +1 -2
- package/dist/internal/arrow-keys.mjs +1 -2
- package/dist/internal/csp-context.mjs +1 -2
- package/dist/internal/data-attr.mjs +1 -2
- package/dist/internal/decimal.mjs +1 -2
- package/dist/internal/details-summary.mjs +51 -3
- package/dist/internal/details-summary.mjs.map +1 -1
- package/dist/internal/dev-warn.mjs +1 -2
- package/dist/internal/dom-order.mjs +1 -2
- package/dist/internal/escape-key.mjs +20 -0
- package/dist/internal/escape-key.mjs.map +1 -0
- package/dist/internal/form/field-context.d.mts +0 -2
- package/dist/internal/form/field-context.d.mts.map +1 -1
- package/dist/internal/form/field-context.mjs +2 -3
- package/dist/internal/form/focus-first-invalid.mjs +2 -3
- package/dist/internal/form/form-status-watcher.mjs +1 -2
- package/dist/internal/form/group-member.mjs +1 -2
- package/dist/internal/form/hidden-values.mjs +1 -2
- package/dist/internal/form/sync-presence.mjs +1 -2
- package/dist/internal/form/use-checkable-input.mjs +2 -3
- package/dist/internal/form/use-field-control.mjs +3 -4
- package/dist/internal/form/use-fieldset-group.mjs +3 -4
- package/dist/internal/form/use-form-owner-event.mjs +1 -2
- package/dist/internal/form/use-form-reset.mjs +10 -8
- package/dist/internal/form/use-form-reset.mjs.map +1 -1
- package/dist/internal/form/use-native-checked.mjs +2 -3
- package/dist/internal/form/use-native-group-reconciliation.mjs +3 -4
- package/dist/internal/form/use-native-select-value.mjs +2 -3
- package/dist/internal/form/validity.d.mts +0 -2
- package/dist/internal/form/validity.d.mts.map +1 -1
- package/dist/internal/form/validity.mjs +1 -2
- package/dist/internal/menubar-context.mjs +1 -2
- package/dist/internal/merge-props.mjs +1 -2
- package/dist/internal/overlay/anchor-position.d.mts +0 -2
- package/dist/internal/overlay/anchor-position.d.mts.map +1 -1
- package/dist/internal/overlay/anchor-position.mjs +1 -2
- package/dist/internal/overlay/content-focus-probe.mjs +1 -2
- package/dist/internal/overlay/css-transition-cut.mjs +1 -2
- package/dist/internal/overlay/css-transition-cut.mjs.map +1 -1
- package/dist/internal/overlay/focus-visible.mjs +1 -2
- package/dist/internal/overlay/invokers.mjs +1 -2
- package/dist/internal/overlay/modal-registry.mjs +1 -2
- package/dist/internal/overlay/open-layer.mjs +31 -0
- package/dist/internal/overlay/open-layer.mjs.map +1 -0
- package/dist/internal/overlay/overlay-popup.mjs +2 -3
- package/dist/internal/overlay/overlay-show.mjs +1 -2
- package/dist/internal/overlay/popover-open.mjs +1 -2
- package/dist/internal/overlay/trigger-ref.mjs +1 -2
- package/dist/internal/overlay/use-apply-open-state.mjs +1 -2
- package/dist/internal/overlay/use-exit-animation.mjs +1 -2
- package/dist/internal/overlay/use-exit-animation.mjs.map +1 -1
- package/dist/internal/overlay/use-interest-dismiss.mjs +3 -4
- package/dist/internal/overlay/use-modal-registration.mjs +2 -3
- package/dist/internal/overlay/use-overlay-close.mjs +11 -9
- package/dist/internal/overlay/use-overlay-close.mjs.map +1 -1
- package/dist/internal/overlay/use-overlay-root.d.mts +2 -2
- package/dist/internal/overlay/use-overlay-root.mjs +6 -7
- package/dist/internal/overlay/use-popover-popup.mjs +6 -7
- package/dist/internal/overlay/use-popover-trigger.d.mts +2 -4
- package/dist/internal/overlay/use-popover-trigger.d.mts.map +1 -1
- package/dist/internal/overlay/use-popover-trigger.mjs +4 -5
- package/dist/internal/overlay/use-resolved-placement.mjs +4 -5
- package/dist/internal/platform-attributes.d.mts +0 -2
- package/dist/internal/platform-attributes.d.mts.map +1 -1
- package/dist/internal/pointer-capture.mjs +1 -2
- package/dist/internal/range-value.mjs +1 -2
- package/dist/internal/render-element.d.mts +2 -2
- package/dist/internal/render-element.mjs +2 -3
- package/dist/internal/shipped-styles.mjs +1 -2
- package/dist/internal/swipe-arithmetic.mjs +0 -1
- package/dist/internal/swipe.mjs +2 -3
- package/dist/internal/toolbar-context.mjs +1 -2
- package/dist/internal/transition-boundary.mjs +2 -3
- package/dist/internal/transition-types.mjs +1 -2
- package/dist/internal/typeahead.mjs +0 -1
- package/dist/internal/types.d.mts +0 -2
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-active-option.mjs +1 -2
- package/dist/internal/use-deferred-leave.mjs +2 -3
- package/dist/internal/use-delayed-pair.mjs +1 -2
- package/dist/internal/use-dev-warning.mjs +0 -1
- package/dist/internal/use-element-check.mjs +1 -2
- package/dist/internal/use-hydrated-mount.mjs +1 -2
- package/dist/internal/use-item-order.mjs +2 -3
- package/dist/internal/use-latest.mjs +1 -2
- package/dist/internal/use-merged-refs.mjs +2 -3
- package/dist/internal/use-mount-fixed.mjs +2 -3
- package/dist/internal/use-name-warning.mjs +1 -2
- package/dist/internal/use-native-focusgroup.mjs +1 -2
- package/dist/internal/use-option-registry.mjs +3 -4
- package/dist/internal/use-register-count.mjs +1 -2
- package/dist/internal/use-render.d.mts +2 -2
- package/dist/internal/use-render.mjs +2 -3
- package/dist/internal/use-roving-focus.mjs +2 -3
- package/dist/internal/use-value-set.mjs +2 -3
- package/dist/internal/value-set.mjs +1 -2
- package/dist/menu/index.d.mts +2 -4
- package/dist/menu/index.d.mts.map +1 -1
- package/dist/menu/index.mjs +2 -3
- package/dist/menu/menu-checkbox-item.d.mts +1 -3
- package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
- package/dist/menu/menu-checkbox-item.mjs +3 -4
- package/dist/menu/menu-context-trigger.d.mts +1 -3
- package/dist/menu/menu-context-trigger.d.mts.map +1 -1
- package/dist/menu/menu-context-trigger.mjs +4 -5
- package/dist/menu/menu-context.mjs +1 -2
- package/dist/menu/menu-dom.mjs +1 -2
- package/dist/menu/menu-gestures.mjs +1 -2
- package/dist/menu/menu-group.d.mts +1 -3
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +2 -3
- package/dist/menu/menu-hover.mjs +1 -2
- package/dist/menu/menu-item.d.mts +3 -4
- package/dist/menu/menu-item.d.mts.map +1 -1
- package/dist/menu/menu-item.mjs +6 -3
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-outside.mjs +1 -2
- package/dist/menu/menu-point.mjs +1 -2
- package/dist/menu/menu-popup.d.mts +2 -4
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +13 -14
- package/dist/menu/menu-radio-group.d.mts +1 -3
- package/dist/menu/menu-radio-group.d.mts.map +1 -1
- package/dist/menu/menu-radio-group.mjs +3 -4
- package/dist/menu/menu-radio-item.d.mts +1 -3
- package/dist/menu/menu-radio-item.d.mts.map +1 -1
- package/dist/menu/menu-radio-item.mjs +2 -3
- package/dist/menu/menu-root.d.mts +1 -3
- package/dist/menu/menu-root.d.mts.map +1 -1
- package/dist/menu/menu-root.mjs +4 -5
- package/dist/menu/menu-submenu-trigger.d.mts +1 -3
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +5 -6
- package/dist/menu/menu-trigger.d.mts +1 -3
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +5 -6
- package/dist/menu/use-menu-item.mjs +2 -3
- package/dist/menu/use-menu-keyboard.mjs +2 -3
- package/dist/menubar/menubar.d.mts +1 -3
- package/dist/menubar/menubar.d.mts.map +1 -1
- package/dist/menubar/menubar.mjs +9 -9
- package/dist/menubar/menubar.mjs.map +1 -1
- package/dist/meter/index.d.mts +1 -3
- package/dist/meter/index.d.mts.map +1 -1
- package/dist/meter/index.mjs +1 -2
- package/dist/meter/meter-context.mjs +1 -2
- package/dist/meter/meter-indicator.d.mts +1 -3
- package/dist/meter/meter-indicator.d.mts.map +1 -1
- package/dist/meter/meter-indicator.mjs +1 -2
- package/dist/meter/meter-label.d.mts +1 -3
- package/dist/meter/meter-label.d.mts.map +1 -1
- package/dist/meter/meter-label.mjs +1 -2
- package/dist/meter/meter-region.d.mts +0 -2
- package/dist/meter/meter-region.d.mts.map +1 -1
- package/dist/meter/meter-region.mjs +1 -2
- package/dist/meter/meter-root.d.mts +1 -3
- package/dist/meter/meter-root.d.mts.map +1 -1
- package/dist/meter/meter-root.mjs +4 -5
- package/dist/meter/meter-track.d.mts +1 -3
- package/dist/meter/meter-track.d.mts.map +1 -1
- package/dist/meter/meter-track.mjs +1 -2
- package/dist/meter/meter-value.d.mts +1 -3
- package/dist/meter/meter-value.d.mts.map +1 -1
- package/dist/meter/meter-value.mjs +1 -2
- package/dist/multi-select/index.d.mts +1 -3
- package/dist/multi-select/index.d.mts.map +1 -1
- package/dist/multi-select/index.mjs +1 -2
- package/dist/multi-select/multi-select-context.mjs +1 -2
- package/dist/multi-select/multi-select-group.d.mts +1 -3
- package/dist/multi-select/multi-select-group.d.mts.map +1 -1
- package/dist/multi-select/multi-select-group.mjs +2 -3
- package/dist/multi-select/multi-select-keyboard.mjs +3 -3
- package/dist/multi-select/multi-select-keyboard.mjs.map +1 -1
- package/dist/multi-select/multi-select-label.d.mts +1 -3
- package/dist/multi-select/multi-select-label.d.mts.map +1 -1
- package/dist/multi-select/multi-select-label.mjs +2 -3
- package/dist/multi-select/multi-select-list.d.mts +1 -3
- package/dist/multi-select/multi-select-list.d.mts.map +1 -1
- package/dist/multi-select/multi-select-list.mjs +3 -4
- package/dist/multi-select/multi-select-option.d.mts +1 -3
- package/dist/multi-select/multi-select-option.d.mts.map +1 -1
- package/dist/multi-select/multi-select-option.mjs +3 -4
- package/dist/multi-select/multi-select-popup.d.mts +1 -3
- package/dist/multi-select/multi-select-popup.d.mts.map +1 -1
- package/dist/multi-select/multi-select-popup.mjs +5 -6
- package/dist/multi-select/multi-select-root.d.mts +1 -3
- package/dist/multi-select/multi-select-root.d.mts.map +1 -1
- package/dist/multi-select/multi-select-root.mjs +12 -13
- package/dist/multi-select/multi-select-trigger.d.mts +1 -3
- package/dist/multi-select/multi-select-trigger.d.mts.map +1 -1
- package/dist/multi-select/multi-select-trigger.mjs +8 -9
- package/dist/multi-select/multi-select-value.d.mts +1 -3
- package/dist/multi-select/multi-select-value.d.mts.map +1 -1
- package/dist/multi-select/multi-select-value.mjs +1 -2
- package/dist/navigation-menu/index.d.mts +0 -2
- package/dist/navigation-menu/index.d.mts.map +1 -1
- package/dist/navigation-menu/index.mjs +1 -2
- package/dist/navigation-menu/navigation-menu-context.mjs +1 -2
- package/dist/navigation-menu/navigation-menu-item.d.mts +1 -3
- package/dist/navigation-menu/navigation-menu-item.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-item.mjs +3 -4
- package/dist/navigation-menu/navigation-menu-link.d.mts +1 -3
- package/dist/navigation-menu/navigation-menu-link.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-link.mjs +4 -5
- package/dist/navigation-menu/navigation-menu-list.d.mts +1 -3
- package/dist/navigation-menu/navigation-menu-list.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-list.mjs +1 -2
- package/dist/navigation-menu/navigation-menu-popup.d.mts +2 -4
- package/dist/navigation-menu/navigation-menu-popup.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-popup.mjs +8 -9
- package/dist/navigation-menu/navigation-menu-root.d.mts +1 -3
- package/dist/navigation-menu/navigation-menu-root.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-root.mjs +1 -2
- package/dist/navigation-menu/navigation-menu-trigger.d.mts +0 -2
- package/dist/navigation-menu/navigation-menu-trigger.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-trigger.mjs +2 -3
- package/dist/number-field/index.d.mts +2 -4
- package/dist/number-field/index.d.mts.map +1 -1
- package/dist/number-field/index.mjs +1 -2
- package/dist/number-field/number-field-arithmetic.mjs +1 -2
- package/dist/number-field/number-field-context.d.mts +1 -3
- package/dist/number-field/number-field-context.d.mts.map +1 -1
- package/dist/number-field/number-field-context.mjs +1 -2
- package/dist/number-field/number-field-decrement.d.mts +0 -2
- package/dist/number-field/number-field-decrement.d.mts.map +1 -1
- package/dist/number-field/number-field-decrement.mjs +1 -2
- package/dist/number-field/number-field-format.mjs +1 -2
- package/dist/number-field/number-field-increment.d.mts +0 -2
- package/dist/number-field/number-field-increment.d.mts.map +1 -1
- package/dist/number-field/number-field-increment.mjs +1 -2
- package/dist/number-field/number-field-input.d.mts +1 -3
- package/dist/number-field/number-field-input.d.mts.map +1 -1
- package/dist/number-field/number-field-input.mjs +4 -5
- package/dist/number-field/number-field-label.d.mts +1 -3
- package/dist/number-field/number-field-label.d.mts.map +1 -1
- package/dist/number-field/number-field-label.mjs +3 -4
- package/dist/number-field/number-field-root.d.mts +1 -3
- package/dist/number-field/number-field-root.d.mts.map +1 -1
- package/dist/number-field/number-field-root.mjs +9 -9
- package/dist/number-field/number-field-root.mjs.map +1 -1
- package/dist/number-field/use-number-field-dev-warnings.mjs +2 -3
- package/dist/number-field/use-step-button.d.mts +1 -3
- package/dist/number-field/use-step-button.d.mts.map +1 -1
- package/dist/number-field/use-step-button.mjs +2 -3
- package/dist/otp-field/index.d.mts +2 -4
- package/dist/otp-field/index.d.mts.map +1 -1
- package/dist/otp-field/index.mjs +1 -2
- package/dist/otp-field/otp-field-context.mjs +1 -2
- package/dist/otp-field/otp-field-filter.d.mts +0 -2
- package/dist/otp-field/otp-field-filter.d.mts.map +1 -1
- package/dist/otp-field/otp-field-filter.mjs +1 -2
- package/dist/otp-field/otp-field-input.d.mts +1 -3
- package/dist/otp-field/otp-field-input.d.mts.map +1 -1
- package/dist/otp-field/otp-field-input.mjs +6 -7
- package/dist/otp-field/otp-field-root.d.mts +1 -3
- package/dist/otp-field/otp-field-root.d.mts.map +1 -1
- package/dist/otp-field/otp-field-root.mjs +10 -11
- package/dist/otp-field/otp-field-slot.d.mts +1 -3
- package/dist/otp-field/otp-field-slot.d.mts.map +1 -1
- package/dist/otp-field/otp-field-slot.mjs +2 -3
- package/dist/popover/index.d.mts +2 -4
- package/dist/popover/index.d.mts.map +1 -1
- package/dist/popover/index.mjs +1 -2
- package/dist/popover/popover-close.d.mts +10 -6
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +3 -3
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-context.mjs +1 -2
- package/dist/popover/popover-description.d.mts +1 -3
- package/dist/popover/popover-description.d.mts.map +1 -1
- package/dist/popover/popover-description.mjs +1 -2
- package/dist/popover/popover-popup.d.mts +2 -4
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +4 -5
- package/dist/popover/popover-root.d.mts +1 -3
- package/dist/popover/popover-root.d.mts.map +1 -1
- package/dist/popover/popover-root.mjs +2 -3
- package/dist/popover/popover-title.d.mts +1 -3
- package/dist/popover/popover-title.d.mts.map +1 -1
- package/dist/popover/popover-title.mjs +1 -2
- package/dist/popover/popover-trigger.d.mts +1 -3
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +2 -3
- package/dist/progress/index.d.mts +1 -3
- package/dist/progress/index.d.mts.map +1 -1
- package/dist/progress/index.mjs +1 -2
- package/dist/progress/progress-context.mjs +1 -2
- package/dist/progress/progress-indicator.d.mts +1 -3
- package/dist/progress/progress-indicator.d.mts.map +1 -1
- package/dist/progress/progress-indicator.mjs +1 -2
- package/dist/progress/progress-label.d.mts +1 -3
- package/dist/progress/progress-label.d.mts.map +1 -1
- package/dist/progress/progress-label.mjs +1 -2
- package/dist/progress/progress-root.d.mts +1 -3
- package/dist/progress/progress-root.d.mts.map +1 -1
- package/dist/progress/progress-root.mjs +4 -5
- package/dist/progress/progress-track.d.mts +1 -3
- package/dist/progress/progress-track.d.mts.map +1 -1
- package/dist/progress/progress-track.mjs +1 -2
- package/dist/progress/progress-value.d.mts +1 -3
- package/dist/progress/progress-value.d.mts.map +1 -1
- package/dist/progress/progress-value.mjs +1 -2
- package/dist/radio-group/index.d.mts +1 -3
- package/dist/radio-group/index.d.mts.map +1 -1
- package/dist/radio-group/index.mjs +1 -2
- package/dist/radio-group/radio-group-context.mjs +1 -2
- package/dist/radio-group/radio-group-item.d.mts +1 -3
- package/dist/radio-group/radio-group-item.d.mts.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +3 -4
- package/dist/radio-group/radio-group-label.d.mts +1 -3
- package/dist/radio-group/radio-group-label.d.mts.map +1 -1
- package/dist/radio-group/radio-group-label.mjs +1 -2
- package/dist/radio-group/radio-group-root.d.mts +1 -3
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +4 -5
- package/dist/select/index.d.mts +1 -3
- package/dist/select/index.d.mts.map +1 -1
- package/dist/select/index.mjs +1 -2
- package/dist/select/select-context.mjs +1 -2
- package/dist/select/select-dom.mjs +2 -3
- package/dist/select/select-group-label.d.mts +1 -3
- package/dist/select/select-group-label.d.mts.map +1 -1
- package/dist/select/select-group-label.mjs +1 -2
- package/dist/select/select-group.d.mts +1 -3
- package/dist/select/select-group.d.mts.map +1 -1
- package/dist/select/select-group.mjs +2 -3
- package/dist/select/select-option.d.mts +1 -3
- package/dist/select/select-option.d.mts.map +1 -1
- package/dist/select/select-option.mjs +3 -4
- package/dist/select/select-root.d.mts +1 -3
- package/dist/select/select-root.d.mts.map +1 -1
- package/dist/select/select-root.mjs +6 -7
- package/dist/select/select-separator.d.mts +1 -3
- package/dist/select/select-separator.d.mts.map +1 -1
- package/dist/select/select-separator.mjs +1 -2
- package/dist/select/select-trigger.d.mts +1 -3
- package/dist/select/select-trigger.d.mts.map +1 -1
- package/dist/select/select-trigger.mjs +1 -2
- package/dist/select/select-value.d.mts +1 -3
- package/dist/select/select-value.d.mts.map +1 -1
- package/dist/select/select-value.mjs +3 -4
- package/dist/select/select-value.mjs.map +1 -1
- package/dist/separator/separator.d.mts +1 -3
- package/dist/separator/separator.d.mts.map +1 -1
- package/dist/separator/separator.mjs +1 -2
- package/dist/slider/index.d.mts +2 -4
- package/dist/slider/index.d.mts.map +1 -1
- package/dist/slider/index.mjs +1 -2
- package/dist/slider/slider-arithmetic.mjs +1 -2
- package/dist/slider/slider-context.mjs +1 -2
- package/dist/slider/slider-indicator.d.mts +1 -3
- package/dist/slider/slider-indicator.d.mts.map +1 -1
- package/dist/slider/slider-indicator.mjs +1 -2
- package/dist/slider/slider-label.d.mts +1 -3
- package/dist/slider/slider-label.d.mts.map +1 -1
- package/dist/slider/slider-label.mjs +3 -4
- package/dist/slider/slider-root.d.mts +1 -3
- package/dist/slider/slider-root.d.mts.map +1 -1
- package/dist/slider/slider-root.mjs +8 -9
- package/dist/slider/slider-thumb.d.mts +1 -3
- package/dist/slider/slider-thumb.d.mts.map +1 -1
- package/dist/slider/slider-thumb.mjs +5 -6
- package/dist/slider/slider-track.d.mts +1 -3
- package/dist/slider/slider-track.d.mts.map +1 -1
- package/dist/slider/slider-track.mjs +2 -3
- package/dist/slider/slider-value.d.mts +1 -3
- package/dist/slider/slider-value.d.mts.map +1 -1
- package/dist/slider/slider-value.mjs +1 -2
- package/dist/slider/use-slider-dev-warnings.mjs +2 -3
- package/dist/slider/use-thumb-registry.mjs +1 -2
- package/dist/switch/switch.d.mts +1 -3
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +2 -3
- package/dist/tabs/index.d.mts +0 -2
- package/dist/tabs/index.d.mts.map +1 -1
- package/dist/tabs/index.mjs +1 -2
- package/dist/tabs/tabs-context.d.mts +0 -2
- package/dist/tabs/tabs-context.d.mts.map +1 -1
- package/dist/tabs/tabs-context.mjs +1 -2
- package/dist/tabs/tabs-ids.mjs +1 -2
- package/dist/tabs/tabs-indicator.d.mts +1 -3
- package/dist/tabs/tabs-indicator.d.mts.map +1 -1
- package/dist/tabs/tabs-indicator.mjs +1 -2
- package/dist/tabs/tabs-list.d.mts +1 -3
- package/dist/tabs/tabs-list.d.mts.map +1 -1
- package/dist/tabs/tabs-list.mjs +4 -5
- package/dist/tabs/tabs-panel.d.mts +1 -3
- package/dist/tabs/tabs-panel.d.mts.map +1 -1
- package/dist/tabs/tabs-panel.mjs +4 -5
- package/dist/tabs/tabs-root.d.mts +1 -3
- package/dist/tabs/tabs-root.d.mts.map +1 -1
- package/dist/tabs/tabs-root.mjs +5 -6
- package/dist/tabs/tabs-tab.d.mts +1 -3
- package/dist/tabs/tabs-tab.d.mts.map +1 -1
- package/dist/tabs/tabs-tab.mjs +3 -4
- package/dist/tabs/use-until-found.mjs +1 -2
- package/dist/toast/index.d.mts +2 -4
- package/dist/toast/index.d.mts.map +1 -1
- package/dist/toast/index.mjs +2 -3
- package/dist/toast/toast-action.d.mts +1 -3
- package/dist/toast/toast-action.d.mts.map +1 -1
- package/dist/toast/toast-action.mjs +2 -3
- package/dist/toast/toast-close.d.mts +1 -3
- package/dist/toast/toast-close.d.mts.map +1 -1
- package/dist/toast/toast-close.mjs +2 -3
- package/dist/toast/toast-context.mjs +1 -2
- package/dist/toast/toast-description.d.mts +1 -3
- package/dist/toast/toast-description.d.mts.map +1 -1
- package/dist/toast/toast-description.mjs +2 -3
- package/dist/toast/toast-hotkey.mjs +1 -2
- package/dist/toast/toast-queue.mjs +1 -2
- package/dist/toast/toast-root.d.mts +1 -3
- package/dist/toast/toast-root.d.mts.map +1 -1
- package/dist/toast/toast-root.mjs +8 -6
- package/dist/toast/toast-root.mjs.map +1 -1
- package/dist/toast/toast-timers.mjs +1 -2
- package/dist/toast/toast-title.d.mts +1 -3
- package/dist/toast/toast-title.d.mts.map +1 -1
- package/dist/toast/toast-title.mjs +2 -3
- package/dist/toast/toast-viewport.d.mts +1 -3
- package/dist/toast/toast-viewport.d.mts.map +1 -1
- package/dist/toast/toast-viewport.mjs +9 -10
- package/dist/toast/toast.d.mts +1 -3
- package/dist/toast/toast.d.mts.map +1 -1
- package/dist/toast/toast.mjs +1 -2
- package/dist/toast/use-modal-portal-host.mjs +2 -3
- package/dist/toast/use-toast-announcements.mjs +2 -3
- package/dist/toast/use-toast-announcements.mjs.map +1 -1
- package/dist/toast/use-toast-focus.mjs +2 -3
- package/dist/toast/use-toast-pauses.mjs +2 -3
- package/dist/toggle/toggle.d.mts +1 -3
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +3 -4
- package/dist/toggle-group/index.d.mts +0 -2
- package/dist/toggle-group/index.d.mts.map +1 -1
- package/dist/toggle-group/index.mjs +1 -2
- package/dist/toggle-group/toggle-group-context.d.mts +0 -2
- package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-context.mjs +1 -2
- package/dist/toggle-group/toggle-group-item.d.mts +1 -3
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-item.mjs +2 -3
- package/dist/toggle-group/toggle-group-root.d.mts +1 -3
- package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-root.mjs +8 -9
- package/dist/toolbar/index.d.mts +0 -2
- package/dist/toolbar/index.d.mts.map +1 -1
- package/dist/toolbar/index.mjs +1 -2
- package/dist/toolbar/toolbar-root.d.mts +1 -3
- package/dist/toolbar/toolbar-root.d.mts.map +1 -1
- package/dist/toolbar/toolbar-root.mjs +3 -4
- package/dist/toolbar/toolbar-separator.d.mts +1 -3
- package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
- package/dist/toolbar/toolbar-separator.mjs +1 -2
- package/dist/tooltip/index.d.mts +0 -2
- package/dist/tooltip/index.d.mts.map +1 -1
- package/dist/tooltip/index.mjs +1 -2
- package/dist/tooltip/tooltip-arrow.d.mts +1 -3
- package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
- package/dist/tooltip/tooltip-arrow.mjs +2 -3
- package/dist/tooltip/tooltip-context.d.mts +0 -2
- package/dist/tooltip/tooltip-context.d.mts.map +1 -1
- package/dist/tooltip/tooltip-context.mjs +1 -2
- package/dist/tooltip/tooltip-popup.d.mts +1 -3
- package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
- package/dist/tooltip/tooltip-popup.mjs +4 -5
- package/dist/tooltip/tooltip-root.d.mts +1 -3
- package/dist/tooltip/tooltip-root.d.mts.map +1 -1
- package/dist/tooltip/tooltip-root.mjs +2 -3
- package/dist/tooltip/tooltip-trigger.d.mts +1 -3
- package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +6 -7
- package/dist/tooltip/tooltip-warm.mjs +1 -2
- package/dist/tooltip/use-tooltip-interaction.mjs +5 -5
- package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
- package/package.json +8 -8
- package/skills/funstack-ui-knowledge/SKILL.md +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-field-root.mjs","names":[],"sources":["../../src/number-field/number-field-root.tsx"],"sourcesContent":["\"use client\";\nimport { use, useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode, RefObject } from \"react\";\nimport { announce as speak } from \"../internal/announce.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { FieldContext } from \"../internal/form/field-context.js\";\nimport { mergeTokenLists } from \"../internal/merge-props.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n RenderProp,\n StateValue,\n} from \"../internal/types.js\";\nimport { resolveFieldDefaults, useFieldValueChange } from \"../internal/form/use-field-control.js\";\nimport type { FormAssociatedElement } from \"../internal/form/use-form-owner-event.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useResetTarget } from \"../internal/form/use-form-reset.js\";\nimport { useRegisterCount } from \"../internal/use-register-count.js\";\nimport { useNativeGroupReconciliation } from \"../internal/form/use-native-group-reconciliation.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { useStepCommit } from \"../internal/action/use-step-commit.js\";\nimport { keyStep, stepValue } from \"./number-field-arithmetic.js\";\nimport type { StepBounds } from \"./number-field-arithmetic.js\";\nimport { NumberFieldContext } from \"./number-field-context.js\";\nimport type {\n NumberFieldContextValue,\n NumberFieldSource,\n StepDirection,\n} from \"./number-field-context.js\";\nimport { createNumberFormatter, formatKey } from \"./number-field-format.js\";\nimport type { NumberFormatter } from \"./number-field-format.js\";\nimport { useNumberFieldDevWarnings } from \"./use-number-field-dev-warnings.js\";\n\n/** Details passed as the second argument of both NumberField actions. */\nexport interface NumberFieldValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user typed, pressed a key, a button or turned the wheel (`details.event` is\n * the `focusout` / Enter `keydown` of a typed value, the `keydown` of a key, the `pointerdown` /\n * `pointerup` of a button (`undefined` for the repeats of a held button and for a hold that\n * ended at its bound), the `wheel` event). `\"platform\"`: a form reset (the `reset`\n * event) or text typed before hydration (`undefined`). `\"dismiss\"`: the commit action rejected\n * and the field reverted to the committed value (uncontrolled; `valueChangeAction` only).\n */\n readonly reason: ChangeReason;\n /** What produced the value: typed text, a button, a key, the wheel; `null` for \"platform\" and \"dismiss\". */\n readonly source: NumberFieldSource;\n}\n\n/** The state every NumberField part's function props receive (one object, Field's precedent). */\nexport interface NumberFieldState {\n /** The shown value: the gesture's value while one is open or in flight, else the optimistic value; `null` when empty. */\n readonly value: number | null;\n /** The shown text: the draft while the user is editing, else `value` formatted. */\n readonly text: string;\n /** A step or commit dispatched through this NumberField is in flight. */\n readonly pending: boolean;\n /** The `disabled` prop, or the enclosing Field's. */\n readonly disabled: boolean;\n /** The `readOnly` prop. */\n readonly readOnly: boolean;\n /** The `required` prop, or the enclosing Field's. */\n readonly required: boolean;\n}\n\n/**\n * Props of `NumberField.Root`.\n *\n * @see https://ui.funstack.work/components/number-field\n */\nexport interface NumberFieldRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"defaultValue\" | \"role\" | \"className\" | \"style\" | \"children\"\n> {\n /** Controlled value; `null` is empty, `undefined` uncontrolled. */\n value?: number | null;\n /**\n * Initial value in uncontrolled mode, and its form-reset target (latest).\n *\n * @defaultValue `null` (empty)\n */\n defaultValue?: number | null;\n /**\n * Runs inside the Root's step transition on every step: the parse of typed text at commit,\n * each key press, each tick of a hold, each wheel event, each platform change, and the revert\n * after a rejected commit (`reason: \"dismiss\"`, uncontrolled). Keep it cheap: adopt the value\n * (`setValue(next)` in the sync prefix is a transition update), start a deferred render.\n */\n valueChangeAction?: ChangeAction<number | null, NumberFieldValueChangeDetails>;\n /**\n * Runs inside the Root's commit transition once per gesture: a typed text's blur or Enter, a\n * hold's release, each key press, each wheel event, a form reset, text typed before hydration.\n * Where the save goes; uncontrolled state is committed when it resolves and reverts when it\n * rejects. May be a Server Function.\n */\n valueCommitAction?: ChangeAction<number | null, NumberFieldValueChangeDetails>;\n /** Native `min` on the hidden input (a constraint) and the lower bound of stepping. */\n min?: number;\n /** Native `max` on the hidden input (a constraint) and the upper bound of stepping. */\n max?: number;\n /**\n * Native `step` and the stepping grid from `min` (else `0`).\n *\n * @defaultValue `1`, or `0.01` when `format.style` is `\"percent\"`\n */\n step?: number;\n /**\n * The step of PageUp / PageDown and Shift+Arrow.\n *\n * @defaultValue `10 × step`\n */\n largeStep?: number;\n /**\n * `Intl.NumberFormatOptions` for the text: `style` `\"decimal\"` (default), `\"percent\"`,\n * `\"currency\"` (with `currency`), `\"unit\"` (with `unit`); fraction digits, grouping, sign\n * display. `notation: \"compact\"` is a dev warning (unparsable).\n */\n format?: Intl.NumberFormatOptions;\n /**\n * BCP 47 tag(s). Pass the page's `lang`; a dev warning fires when\n * `document.documentElement.lang` disagrees and this prop is absent.\n *\n * @defaultValue the runtime's locale (`Intl.NumberFormat().resolvedOptions().locale`)\n */\n locale?: string | readonly string[];\n /**\n * Step with the mouse wheel while the input is focused.\n *\n * @defaultValue `false`\n */\n stepOnWheel?: boolean;\n /**\n * Native `name` on the hidden input.\n *\n * @defaultValue the Field's `name` inside a `Field.Root`\n */\n name?: string;\n /** Native `form` on the hidden input. */\n form?: string;\n /**\n * Disables both inputs and the buttons; inherited by every part.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /**\n * Native `readonly` on both inputs; no stepping (buttons disabled, keys and wheel inert).\n *\n * @defaultValue `false`\n */\n readOnly?: boolean;\n /**\n * Native `required` on the hidden input (empty is `valueMissing`); or the Field's.\n *\n * @defaultValue `false`\n */\n required?: boolean;\n /**\n * What is announced (`ariaNotify()`) after a key press, a wheel event, a click activation and a\n * hold's release. Return `null` to announce nothing.\n *\n * @defaultValue `(_, state) => state.text`\n */\n announce?: (value: number | null, state: NumberFieldState) => string | null;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, NumberFieldState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, NumberFieldState>;\n /** The parts. The function form receives the state. */\n children?: StateValue<ReactNode, NumberFieldState>;\n /** Replace the default `<div>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"div\">, NumberFieldState>;\n}\n\nconst STEP_TYPES = transitionTypes(\"number-field\", \"change\");\nconst COMMIT_TYPES = transitionTypes(\"number-field\", \"commit\");\n\n/** A finite number, or `null` (`NaN` / `Infinity` are treated as empty). */\nfunction sanitize(value: number | null | undefined): number | null | undefined {\n if (value === undefined || value === null) return value;\n return Number.isFinite(value) ? value : null;\n}\n\n/** The `details` fields of both actions. */\nfunction numberFieldDetails(reason: ChangeReason, source: NumberFieldSource) {\n return { reason, source };\n}\n\nfunction identity(value: number | null): number | null {\n return value;\n}\n\n/** The hidden input's value for `value`. */\nfunction hiddenText(value: number | null): string {\n return value === null ? \"\" : String(value);\n}\n\n/**\n * Mount reconciliation's read of the visible input (design 4.5): the value the hydrated text\n * means. The client's own formatting of `current` is `current`. Focused text is still being typed\n * (even a partial `12,` or `-`): handed to `adoptDraft`, never overwritten under the caret; the\n * blur commits or reverts it by the ordinary rule. Otherwise the parsed text, or, for another\n * locale's formatting of the same value or text that is no number, `current` with the client's\n * text written back (react-dom kept the hydrated DOM value).\n */\nfunction readVisible(\n visible: HTMLInputElement | null,\n current: number | null,\n formatter: NumberFormatter,\n adoptDraft: (text: string) => void,\n): number | null {\n if (visible === null) return current;\n const domText = visible.value;\n if (domText === formatter.format(current)) return current;\n if (visible.ownerDocument.activeElement === visible) {\n adoptDraft(domText);\n return current;\n }\n const parsed = formatter.parse(domText);\n if (parsed === undefined || Object.is(parsed, current)) {\n visible.value = formatter.format(current);\n return current;\n }\n return parsed;\n}\n\n/**\n * Owns the number field's state (design/components/number-field.md 2): the committed value\n * through `useControllableAction` with `valueCommitAction` (once per gesture), each step through\n * its own transition (`valueChangeAction`), the urgent draft text, the urgent value of the open\n * gesture (`live`), the press-and-hold, the formatter and parser, the announcements, mount\n * reconciliation and form reset (through the hidden input the Input renders).\n *\n * Owned keys (conventions 1.2): `role=\"group\"`, `aria-labelledby` (token-merged: the consumer's,\n * then `NumberField.Label`'s id while one is mounted, then a Field's label id), `data-pending`,\n * `data-disabled`, `data-invalid` (inside a Field).\n *\n * @see https://ui.funstack.work/components/number-field\n */\nexport function NumberFieldRoot(props: NumberFieldRootProps) {\n const {\n value: valueProp,\n defaultValue: defaultValueProp,\n valueChangeAction,\n valueCommitAction,\n min,\n max,\n step: stepProp,\n largeStep: largeStepProp,\n format,\n locale,\n stepOnWheel = false,\n name: nameProp,\n form,\n disabled: disabledProp = false,\n readOnly = false,\n required: requiredProp = false,\n announce,\n className,\n style,\n children,\n render,\n ...rest\n } = props;\n\n const value = sanitize(valueProp);\n const defaultValue = sanitize(defaultValueProp);\n\n // --- Format, bounds -----------------------------------------------------------------------\n\n const key = formatKey(format);\n const localeKey = locale === undefined ? \"\" : JSON.stringify(locale);\n // Memoised on the content of `format` and `locale`, not their identity (an inline object).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const formatter = useMemo(() => createNumberFormatter(locale, format), [localeKey, key]);\n const defaultStep = formatter.percent ? 0.01 : 1;\n const stepValid = stepProp === undefined || (Number.isFinite(stepProp) && stepProp > 0);\n const stepSize = stepProp !== undefined && stepValid ? stepProp : defaultStep;\n const largeStepValid =\n largeStepProp === undefined || (Number.isFinite(largeStepProp) && largeStepProp > 0);\n const largeStep = largeStepProp !== undefined && largeStepValid ? largeStepProp : 10 * stepSize;\n const bounds = useMemo<StepBounds>(\n () => ({\n min: Number.isFinite(min) ? min : undefined,\n max: Number.isFinite(max) ? max : undefined,\n step: stepSize,\n }),\n [min, max, stepSize],\n );\n\n // --- Field ----------------------------------------------------------------------------------\n\n // NumberField.Input registers the control (design 7.1); the Root only resolves the defaults.\n const fieldContext = use(FieldContext);\n const { disabled, required, name } = resolveFieldDefaults(fieldContext, {\n name: nameProp,\n disabled: disabledProp,\n required: requiredProp,\n });\n const fieldInvalid = fieldContext === null ? undefined : fieldContext.state.invalid;\n\n const id = useId();\n const inputId = fieldContext?.ids.control ?? `${id}-input`;\n const labelId = `${id}-label`;\n\n // --- State (design 2) -----------------------------------------------------------------------\n\n const [draft, setDraft] = useState<string | null>(null);\n const draftRef = useRef<string | null>(null);\n const [hold, setHold] = useState<StepDirection | null>(null);\n /** The value the next tick of a hold steps from. */\n const holdBase = useRef<number | null>(null);\n const holdRef = useRef<StepDirection | null>(null);\n const visibleRef = useRef<HTMLInputElement | null>(null);\n const hiddenRef = useRef<HTMLInputElement | null>(null);\n\n const clearDraft = useCallback(() => {\n if (draftRef.current === null) return;\n draftRef.current = null;\n setDraft(null);\n }, []);\n\n /**\n * Writes `next` into the hidden input, then mirrors its validity onto the visible input, which\n * is invalid exactly when the hidden one is (6.2).\n */\n const syncHidden = useCallback((next: number | null) => {\n const hidden = hiddenRef.current;\n if (hidden !== null) {\n const text = hiddenText(next);\n if (hidden.value !== text) hidden.value = text;\n }\n const visible = visibleRef.current;\n if (hidden === null || visible === null) return;\n const message = hidden.validationMessage;\n if (visible.validationMessage !== message) visible.setCustomValidity(message);\n }, []);\n\n // The step and commit core (design 2.4), shared with Slider.\n const {\n shown,\n shownRef,\n optimistic,\n pending,\n pendingSource,\n step,\n commit,\n openGesture,\n captureGesture,\n takeEdit,\n } = useStepCommit<\n number | null,\n number | null,\n NumberFieldSource,\n ReturnType<typeof numberFieldDetails>\n >({\n controlled: value,\n defaultValue,\n initialValue: null,\n stepAction: valueChangeAction,\n commitAction: valueCommitAction,\n stepTypes: STEP_TYPES,\n commitTypes: COMMIT_TYPES,\n warn: { component: \"NumberField.Root\", prop: \"value\" },\n toShown: identity,\n fromShown: identity,\n equals: Object.is,\n details: numberFieldDetails,\n captured: hold !== null,\n // What the text can show is what the form posts (5.4): a step finer than the format's\n // digits is rounded like a typed value.\n normalize: (next) => (next === null ? next : formatter.round(next)),\n // A step clears the draft and writes the hidden input synchronously (section 6).\n onStep: (next) => {\n clearDraft();\n syncHidden(next);\n },\n // `announceValue` is declared below; this runs in an event, long after the render.\n onCommit: (next, source, reason) => {\n if (reason === \"activate\" && source !== \"input\" && source !== null) announceValue(next);\n },\n });\n\n const text = draft ?? formatter.format(shown);\n // The value a button press steps from (4.3 step 3): the parsed draft while one is open.\n const parsedDraft = draft === null ? undefined : formatter.parse(draft);\n const stepBase = parsedDraft === undefined ? shown : parsedDraft;\n\n const state = useMemo<NumberFieldState>(\n () => ({ value: shown, text, pending, disabled, readOnly, required }),\n [shown, text, pending, disabled, readOnly, required],\n );\n\n // A step, a key and a typed commit fire no `input` / `change` on the element the Field hears\n // for the value (the hidden input is written by script): tell it at the commit (design 7.2).\n useFieldValueChange(optimistic, takeEdit);\n\n const latest = useLatest({\n formatter,\n bounds,\n largeStep,\n disabled,\n readOnly,\n announce,\n state,\n });\n\n // --- Announcements (design 8.3) ---------------------------------------------------------------\n\n const announceValue = useCallback(\n (next: number | null) => {\n const visible = visibleRef.current;\n if (visible === null) return;\n const { announce: compose, formatter: f, state: s } = latest.current;\n const nextState: NumberFieldState = { ...s, value: next, text: f.format(next) };\n const message = compose === undefined ? nextState.text : compose(next, nextState);\n if (message !== null) speak(visible, message);\n },\n [latest],\n );\n\n /** The value a key or a button steps from: the parsed draft if one is open, else the shown value. */\n const resolveBase = useCallback((): number | null => {\n const open = draftRef.current;\n if (open !== null) {\n const parsed = latest.current.formatter.parse(open);\n clearDraft();\n if (parsed !== undefined) return parsed;\n }\n return shownRef.current;\n }, [clearDraft, latest, shownRef]);\n\n /** A one-step gesture: a key press, a wheel event, a click activation. */\n const oneStep = useCallback(\n (compute: (base: number | null) => number | null, source: NumberFieldSource, event: Event) => {\n const base = resolveBase();\n openGesture();\n step(compute(base), source, \"activate\", event);\n commit(source, \"activate\", event);\n },\n [commit, openGesture, resolveBase, step],\n );\n\n // --- Typing (design 4.1) ----------------------------------------------------------------------\n\n const typed = useCallback((next: string) => {\n draftRef.current = next;\n setDraft(next);\n }, []);\n\n const commitDraft = useCallback(\n (event: Event) => {\n const open = draftRef.current;\n if (open === null) return;\n const { formatter: f, disabled: off, readOnly: ro } = latest.current;\n if (off || ro) {\n clearDraft();\n return;\n }\n const parsed = f.parse(open);\n // Unparsable: revert to the committed value's text, no dispatch, no error.\n if (parsed === undefined || Object.is(parsed, shownRef.current)) {\n clearDraft();\n return;\n }\n openGesture();\n step(parsed, \"input\", \"activate\", event);\n commit(\"input\", \"activate\", event);\n },\n [clearDraft, commit, latest, openGesture, shownRef, step],\n );\n\n // --- Keyboard and wheel (design 4.2, 4.4) ----------------------------------------------------\n\n const keyDown = useCallback(\n (event: KeyboardEvent) => {\n const { disabled: off, readOnly: ro, bounds: b, largeStep: large } = latest.current;\n // WebKit fires `compositionend` before the confirming keydown, which then has\n // `isComposing === false` and `keyCode === 229` (Combobox's guard).\n if (off || ro || event.isComposing || event.keyCode === 229) return;\n if (event.key === \"Enter\") {\n commitDraft(event);\n return;\n }\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const compute = keyStep(event.key, event.shiftKey, b, large);\n if (compute === null) return;\n event.preventDefault();\n oneStep(compute, \"keyboard\", event);\n },\n [commitDraft, latest, oneStep],\n );\n\n const wheel = useCallback(\n (event: WheelEvent) => {\n const { disabled: off, readOnly: ro, bounds: b } = latest.current;\n const visible = visibleRef.current;\n if (off || ro || visible === null || event.deltaY === 0) return;\n // Only while the input is focused; unfocused, the page scrolls.\n if (visible.ownerDocument.activeElement !== visible) return;\n event.preventDefault();\n const n = event.deltaY < 0 ? 1 : -1;\n oneStep((v) => stepValue(v, n, b), \"wheel\", event);\n },\n [latest, oneStep],\n );\n\n // --- Buttons (design 4.3) ---------------------------------------------------------------------\n\n const endHold = useCallback(\n (direction: StepDirection, event: Event | undefined) => {\n if (holdRef.current !== direction) return;\n holdRef.current = null;\n setHold(null);\n commit(direction, \"activate\", event);\n },\n [commit],\n );\n\n const tickHold = useCallback(\n (direction: StepDirection, event: Event | undefined): boolean => {\n if (holdRef.current !== direction) return false;\n const { bounds: b } = latest.current;\n const n = direction === \"increment\" ? 1 : -1;\n const next = stepValue(holdBase.current, n, b);\n holdBase.current = next;\n step(next, direction, \"activate\", event);\n // At the bound: end the hold now, before the button re-renders disabled (a disabled\n // element may not deliver the release).\n if (stepValue(next, n, b) === next) {\n endHold(direction, event);\n return false;\n }\n return true;\n },\n [endHold, latest, step],\n );\n\n const beginHold = useCallback(\n (direction: StepDirection, event: Event): boolean => {\n const { disabled: off, readOnly: ro } = latest.current;\n if (off || ro || holdRef.current !== null) return false;\n const base = resolveBase();\n // A capture alone holds `live` on screen: start it from what is shown.\n captureGesture();\n holdBase.current = base;\n holdRef.current = direction;\n setHold(direction);\n return tickHold(direction, event);\n },\n [captureGesture, latest, resolveBase, tickHold],\n );\n\n const activate = useCallback(\n (direction: StepDirection, event: Event) => {\n const { disabled: off, readOnly: ro, bounds: b } = latest.current;\n if (off || ro || holdRef.current !== null) return;\n const n = direction === \"increment\" ? 1 : -1;\n oneStep((v) => stepValue(v, n, b), direction, event);\n },\n [latest, oneStep],\n );\n\n // --- Labels ---------------------------------------------------------------------------------\n\n const { count: labelCount, register: registerLabel } = useRegisterCount();\n\n // --- Residual browser paths: mount reconciliation and form reset (design 4.5, 6.4) ----------\n\n const resetTarget = useResetTarget(value, defaultValue) ?? null;\n const resetTargetText = hiddenText(resetTarget);\n\n const { onItemMounted } = useNativeGroupReconciliation<number | null>({\n element: hiddenRef as RefObject<FormAssociatedElement | null>,\n readCurrent: () =>\n readVisible(visibleRef.current, shownRef.current, formatter, (text) => {\n draftRef.current = text;\n setDraft(text);\n }),\n readDefault: () => {\n // A reset clears an open draft whatever the target.\n clearDraft();\n return resetTarget;\n },\n base: () => shownRef.current,\n onPlatformChange: (next, event) => {\n openGesture();\n step(next, null, \"platform\", event);\n commit(null, \"platform\", event);\n },\n onResetEvent: () => {\n // react-dom rewrites a controlled text input's `defaultValue` after every update; the\n // visible text's reset target is written right before the reset algorithm reads it.\n const visible = visibleRef.current;\n if (visible !== null) visible.defaultValue = formatter.format(resetTarget);\n },\n });\n\n // --- Development warnings -------------------------------------------------------------------\n\n useNumberFieldDevWarnings({\n value: valueProp,\n defaultValue: defaultValueProp,\n min,\n max,\n bounds,\n stepValid,\n largeStepValid,\n formatter,\n locale,\n });\n\n // An unmount mid-hold leaves nothing behind (the buttons detach their own listeners).\n useEffect(\n () => () => {\n holdRef.current = null;\n },\n [],\n );\n\n // --- Render ---------------------------------------------------------------------------------\n\n const context = useMemo<NumberFieldContextValue>(\n () => ({\n state,\n bounds,\n stepBase,\n pendingSource: pending ? pendingSource : null,\n inputId,\n labelId,\n name,\n form,\n allowsFractions: formatter.allowsFractions || !Number.isInteger(stepSize),\n stepOnWheel,\n resetTargetText,\n fieldInvalid,\n visibleRef,\n hiddenRef,\n typed,\n commitDraft,\n keyDown,\n wheel,\n beginHold,\n tickHold,\n endHold,\n activate,\n syncHidden,\n registerLabel,\n onItemMounted,\n }),\n [\n state,\n bounds,\n stepBase,\n pending,\n pendingSource,\n inputId,\n labelId,\n name,\n form,\n formatter,\n stepSize,\n stepOnWheel,\n resetTargetText,\n fieldInvalid,\n typed,\n commitDraft,\n keyDown,\n wheel,\n beginHold,\n tickHold,\n endHold,\n activate,\n syncHidden,\n registerLabel,\n onItemMounted,\n ],\n );\n\n const labelledBy = mergeTokenLists(labelCount > 0 ? labelId : undefined, fieldContext?.ids.label);\n const libraryProps: Partial<ComponentPropsWithRef<\"div\">> & DataAttributes = {\n role: \"group\",\n ...(labelledBy !== \"\" ? { \"aria-labelledby\": labelledBy } : {}),\n ...(fieldContext !== null ? { \"data-invalid\": dataAttr(fieldInvalid === true) } : {}),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, NumberFieldState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n });\n\n return <NumberFieldContext value={context}>{element}</NumberFieldContext>;\n}\n\nNumberFieldRoot.displayName = \"NumberFieldRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgLA,MAAM,aAAa,gBAAgB,gBAAgB,QAAQ;AAC3D,MAAM,eAAe,gBAAgB,gBAAgB,QAAQ;;AAG7D,SAAS,SAAS,OAA6D;CAC7E,IAAI,UAAU,KAAA,KAAa,UAAU,MAAM,OAAO;CAClD,OAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;;AAGA,SAAS,mBAAmB,QAAsB,QAA2B;CAC3E,OAAO;EAAE;EAAQ;CAAO;AAC1B;AAEA,SAAS,SAAS,OAAqC;CACrD,OAAO;AACT;;AAGA,SAAS,WAAW,OAA8B;CAChD,OAAO,UAAU,OAAO,KAAK,OAAO,KAAK;AAC3C;;;;;;;;;AAUA,SAAS,YACP,SACA,SACA,WACA,YACe;CACf,IAAI,YAAY,MAAM,OAAO;CAC7B,MAAM,UAAU,QAAQ;CACxB,IAAI,YAAY,UAAU,OAAO,OAAO,GAAG,OAAO;CAClD,IAAI,QAAQ,cAAc,kBAAkB,SAAS;EACnD,WAAW,OAAO;EAClB,OAAO;CACT;CACA,MAAM,SAAS,UAAU,MAAM,OAAO;CACtC,IAAI,WAAW,KAAA,KAAa,OAAO,GAAG,QAAQ,OAAO,GAAG;EACtD,QAAQ,QAAQ,UAAU,OAAO,OAAO;EACxC,O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AAS,iBAAiB,IAAI,EAAE,IAAI,CAAC;EACnF,gBAAgB,SAAS,OAAO;EAChC,iBAAiB,SAAS,QAAQ;CACpC;CAEA,MAAM,UAAU,UAA0D;EACxE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;CACF,CAAC;CAED,OAAO,oBAAC,oBAAD;EAAoB,OAAO;EAAU,UAAA;CAA4B,CAAA;AAC1E;AAEA,gBAAgB,cAAc"}
|
|
1
|
+
{"version":3,"file":"number-field-root.mjs","names":["announce","speak"],"sources":["../../src/number-field/number-field-root.tsx"],"sourcesContent":["\"use client\";\nimport { use, useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode, RefObject } from \"react\";\nimport { announce as speak } from \"../internal/announce.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { isComposingKey } from \"../internal/escape-key.js\";\nimport { FieldContext } from \"../internal/form/field-context.js\";\nimport { mergeTokenLists } from \"../internal/merge-props.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n RenderProp,\n StateValue,\n} from \"../internal/types.js\";\nimport { resolveFieldDefaults, useFieldValueChange } from \"../internal/form/use-field-control.js\";\nimport type { FormAssociatedElement } from \"../internal/form/use-form-owner-event.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useResetTarget } from \"../internal/form/use-form-reset.js\";\nimport { useRegisterCount } from \"../internal/use-register-count.js\";\nimport { useNativeGroupReconciliation } from \"../internal/form/use-native-group-reconciliation.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { useStepCommit } from \"../internal/action/use-step-commit.js\";\nimport { keyStep, stepValue } from \"./number-field-arithmetic.js\";\nimport type { StepBounds } from \"./number-field-arithmetic.js\";\nimport { NumberFieldContext } from \"./number-field-context.js\";\nimport type {\n NumberFieldContextValue,\n NumberFieldSource,\n StepDirection,\n} from \"./number-field-context.js\";\nimport { createNumberFormatter, formatKey } from \"./number-field-format.js\";\nimport type { NumberFormatter } from \"./number-field-format.js\";\nimport { useNumberFieldDevWarnings } from \"./use-number-field-dev-warnings.js\";\n\n/** Details passed as the second argument of both NumberField actions. */\nexport interface NumberFieldValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user typed, pressed a key, a button or turned the wheel (`details.event` is\n * the `focusout` / Enter `keydown` of a typed value, the `keydown` of a key, the `pointerdown` /\n * `pointerup` of a button (`undefined` for the repeats of a held button and for a hold that\n * ended at its bound), the `wheel` event). `\"platform\"`: a form reset (the `reset`\n * event) or text typed before hydration (`undefined`). `\"dismiss\"`: the commit action rejected\n * and the field reverted to the committed value (uncontrolled; `valueChangeAction` only).\n */\n readonly reason: ChangeReason;\n /** What produced the value: typed text, a button, a key, the wheel; `null` for \"platform\" and \"dismiss\". */\n readonly source: NumberFieldSource;\n}\n\n/** The state every NumberField part's function props receive (one object, Field's precedent). */\nexport interface NumberFieldState {\n /** The shown value: the gesture's value while one is open or in flight, else the optimistic value; `null` when empty. */\n readonly value: number | null;\n /** The shown text: the draft while the user is editing, else `value` formatted. */\n readonly text: string;\n /** A step or commit dispatched through this NumberField is in flight. */\n readonly pending: boolean;\n /** The `disabled` prop, or the enclosing Field's. */\n readonly disabled: boolean;\n /** The `readOnly` prop. */\n readonly readOnly: boolean;\n /** The `required` prop, or the enclosing Field's. */\n readonly required: boolean;\n}\n\n/**\n * Props of `NumberField.Root`.\n *\n * @see https://ui.funstack.work/components/number-field\n */\nexport interface NumberFieldRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"defaultValue\" | \"role\" | \"className\" | \"style\" | \"children\"\n> {\n /** Controlled value; `null` is empty, `undefined` uncontrolled. */\n value?: number | null;\n /**\n * Initial value in uncontrolled mode, and its form-reset target (latest).\n *\n * @defaultValue `null` (empty)\n */\n defaultValue?: number | null;\n /**\n * Runs inside the Root's step transition on every step: the parse of typed text at commit,\n * each key press, each tick of a hold, each wheel event, each platform change, and the revert\n * after a rejected commit (`reason: \"dismiss\"`, uncontrolled). Keep it cheap: adopt the value\n * (`setValue(next)` in the sync prefix is a transition update), start a deferred render.\n */\n valueChangeAction?: ChangeAction<number | null, NumberFieldValueChangeDetails>;\n /**\n * Runs inside the Root's commit transition once per gesture: a typed text's blur or Enter, a\n * hold's release, each key press, each wheel event, a form reset, text typed before hydration.\n * Where the save goes; uncontrolled state is committed when it resolves and reverts when it\n * rejects. May be a Server Function.\n */\n valueCommitAction?: ChangeAction<number | null, NumberFieldValueChangeDetails>;\n /** Native `min` on the hidden input (a constraint) and the lower bound of stepping. */\n min?: number;\n /** Native `max` on the hidden input (a constraint) and the upper bound of stepping. */\n max?: number;\n /**\n * Native `step` and the stepping grid from `min` (else `0`).\n *\n * @defaultValue `1`, or `0.01` when `format.style` is `\"percent\"`\n */\n step?: number;\n /**\n * The step of PageUp / PageDown and Shift+Arrow.\n *\n * @defaultValue `10 × step`\n */\n largeStep?: number;\n /**\n * `Intl.NumberFormatOptions` for the text: `style` `\"decimal\"` (default), `\"percent\"`,\n * `\"currency\"` (with `currency`), `\"unit\"` (with `unit`); fraction digits, grouping, sign\n * display. `notation: \"compact\"` is a dev warning (unparsable).\n */\n format?: Intl.NumberFormatOptions;\n /**\n * BCP 47 tag(s). Pass the page's `lang`; a dev warning fires when\n * `document.documentElement.lang` disagrees and this prop is absent.\n *\n * @defaultValue the runtime's locale (`Intl.NumberFormat().resolvedOptions().locale`)\n */\n locale?: string | readonly string[];\n /**\n * Step with the mouse wheel while the input is focused.\n *\n * @defaultValue `false`\n */\n stepOnWheel?: boolean;\n /**\n * Native `name` on the hidden input.\n *\n * @defaultValue the Field's `name` inside a `Field.Root`\n */\n name?: string;\n /** Native `form` on the hidden input. */\n form?: string;\n /**\n * Disables both inputs and the buttons; inherited by every part.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /**\n * Native `readonly` on both inputs; no stepping (buttons disabled, keys and wheel inert).\n *\n * @defaultValue `false`\n */\n readOnly?: boolean;\n /**\n * Native `required` on the hidden input (empty is `valueMissing`); or the Field's.\n *\n * @defaultValue `false`\n */\n required?: boolean;\n /**\n * What is announced (`ariaNotify()`) after a key press, a wheel event, a click activation and a\n * hold's release. Return `null` to announce nothing.\n *\n * @defaultValue `(_, state) => state.text`\n */\n announce?: (value: number | null, state: NumberFieldState) => string | null;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, NumberFieldState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, NumberFieldState>;\n /** The parts. The function form receives the state. */\n children?: StateValue<ReactNode, NumberFieldState>;\n /** Replace the default `<div>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"div\">, NumberFieldState>;\n}\n\nconst STEP_TYPES = transitionTypes(\"number-field\", \"change\");\nconst COMMIT_TYPES = transitionTypes(\"number-field\", \"commit\");\n\n/** A finite number, or `null` (`NaN` / `Infinity` are treated as empty). */\nfunction sanitize(value: number | null | undefined): number | null | undefined {\n if (value === undefined || value === null) return value;\n return Number.isFinite(value) ? value : null;\n}\n\n/** The `details` fields of both actions. */\nfunction numberFieldDetails(reason: ChangeReason, source: NumberFieldSource) {\n return { reason, source };\n}\n\nfunction identity(value: number | null): number | null {\n return value;\n}\n\n/** The hidden input's value for `value`. */\nfunction hiddenText(value: number | null): string {\n return value === null ? \"\" : String(value);\n}\n\n/**\n * Mount reconciliation's read of the visible input (design 4.5): the value the hydrated text\n * means. The client's own formatting of `current` is `current`. Focused text is still being typed\n * (even a partial `12,` or `-`): handed to `adoptDraft`, never overwritten under the caret; the\n * blur commits or reverts it by the ordinary rule. Otherwise the parsed text, or, for another\n * locale's formatting of the same value or text that is no number, `current` with the client's\n * text written back (react-dom kept the hydrated DOM value).\n */\nfunction readVisible(\n visible: HTMLInputElement | null,\n current: number | null,\n formatter: NumberFormatter,\n adoptDraft: (text: string) => void,\n): number | null {\n if (visible === null) return current;\n const domText = visible.value;\n if (domText === formatter.format(current)) return current;\n if (visible.ownerDocument.activeElement === visible) {\n adoptDraft(domText);\n return current;\n }\n const parsed = formatter.parse(domText);\n if (parsed === undefined || Object.is(parsed, current)) {\n visible.value = formatter.format(current);\n return current;\n }\n return parsed;\n}\n\n/**\n * Owns the number field's state (design/components/number-field.md 2): the committed value\n * through `useControllableAction` with `valueCommitAction` (once per gesture), each step through\n * its own transition (`valueChangeAction`), the urgent draft text, the urgent value of the open\n * gesture (`live`), the press-and-hold, the formatter and parser, the announcements, mount\n * reconciliation and form reset (through the hidden input the Input renders).\n *\n * Owned keys (conventions 1.2): `role=\"group\"`, `aria-labelledby` (token-merged: the consumer's,\n * then `NumberField.Label`'s id while one is mounted, then a Field's label id), `data-pending`,\n * `data-disabled`, `data-invalid` (inside a Field).\n *\n * @see https://ui.funstack.work/components/number-field\n */\nexport function NumberFieldRoot(props: NumberFieldRootProps) {\n const {\n value: valueProp,\n defaultValue: defaultValueProp,\n valueChangeAction,\n valueCommitAction,\n min,\n max,\n step: stepProp,\n largeStep: largeStepProp,\n format,\n locale,\n stepOnWheel = false,\n name: nameProp,\n form,\n disabled: disabledProp = false,\n readOnly = false,\n required: requiredProp = false,\n announce,\n className,\n style,\n children,\n render,\n ...rest\n } = props;\n\n const value = sanitize(valueProp);\n const defaultValue = sanitize(defaultValueProp);\n\n // --- Format, bounds -----------------------------------------------------------------------\n\n const key = formatKey(format);\n const localeKey = locale === undefined ? \"\" : JSON.stringify(locale);\n // Memoised on the content of `format` and `locale`, not their identity (an inline object).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const formatter = useMemo(() => createNumberFormatter(locale, format), [localeKey, key]);\n const defaultStep = formatter.percent ? 0.01 : 1;\n const stepValid = stepProp === undefined || (Number.isFinite(stepProp) && stepProp > 0);\n const stepSize = stepProp !== undefined && stepValid ? stepProp : defaultStep;\n const largeStepValid =\n largeStepProp === undefined || (Number.isFinite(largeStepProp) && largeStepProp > 0);\n const largeStep = largeStepProp !== undefined && largeStepValid ? largeStepProp : 10 * stepSize;\n const bounds = useMemo<StepBounds>(\n () => ({\n min: Number.isFinite(min) ? min : undefined,\n max: Number.isFinite(max) ? max : undefined,\n step: stepSize,\n }),\n [min, max, stepSize],\n );\n\n // --- Field ----------------------------------------------------------------------------------\n\n // NumberField.Input registers the control (design 7.1); the Root only resolves the defaults.\n const fieldContext = use(FieldContext);\n const { disabled, required, name } = resolveFieldDefaults(fieldContext, {\n name: nameProp,\n disabled: disabledProp,\n required: requiredProp,\n });\n const fieldInvalid = fieldContext === null ? undefined : fieldContext.state.invalid;\n\n const id = useId();\n const inputId = fieldContext?.ids.control ?? `${id}-input`;\n const labelId = `${id}-label`;\n\n // --- State (design 2) -----------------------------------------------------------------------\n\n const [draft, setDraft] = useState<string | null>(null);\n const draftRef = useRef<string | null>(null);\n const [hold, setHold] = useState<StepDirection | null>(null);\n /** The value the next tick of a hold steps from. */\n const holdBase = useRef<number | null>(null);\n const holdRef = useRef<StepDirection | null>(null);\n const visibleRef = useRef<HTMLInputElement | null>(null);\n const hiddenRef = useRef<HTMLInputElement | null>(null);\n\n const clearDraft = useCallback(() => {\n if (draftRef.current === null) return;\n draftRef.current = null;\n setDraft(null);\n }, []);\n\n /**\n * Writes `next` into the hidden input, then mirrors its validity onto the visible input, which\n * is invalid exactly when the hidden one is (6.2).\n */\n const syncHidden = useCallback((next: number | null) => {\n const hidden = hiddenRef.current;\n if (hidden !== null) {\n const text = hiddenText(next);\n if (hidden.value !== text) hidden.value = text;\n }\n const visible = visibleRef.current;\n if (hidden === null || visible === null) return;\n const message = hidden.validationMessage;\n if (visible.validationMessage !== message) visible.setCustomValidity(message);\n }, []);\n\n // The step and commit core (design 2.4), shared with Slider.\n const {\n shown,\n shownRef,\n optimistic,\n pending,\n pendingSource,\n step,\n commit,\n openGesture,\n captureGesture,\n takeEdit,\n } = useStepCommit<\n number | null,\n number | null,\n NumberFieldSource,\n ReturnType<typeof numberFieldDetails>\n >({\n controlled: value,\n defaultValue,\n initialValue: null,\n stepAction: valueChangeAction,\n commitAction: valueCommitAction,\n stepTypes: STEP_TYPES,\n commitTypes: COMMIT_TYPES,\n warn: { component: \"NumberField.Root\", prop: \"value\" },\n toShown: identity,\n fromShown: identity,\n equals: Object.is,\n details: numberFieldDetails,\n captured: hold !== null,\n // What the text can show is what the form posts (5.4): a step finer than the format's\n // digits is rounded like a typed value.\n normalize: (next) => (next === null ? next : formatter.round(next)),\n // A step clears the draft and writes the hidden input synchronously (section 6).\n onStep: (next) => {\n clearDraft();\n syncHidden(next);\n },\n // `announceValue` is declared below; this runs in an event, long after the render.\n onCommit: (next, source, reason) => {\n if (reason === \"activate\" && source !== \"input\" && source !== null) announceValue(next);\n },\n });\n\n const text = draft ?? formatter.format(shown);\n // The value a button press steps from (4.3 step 3): the parsed draft while one is open.\n const parsedDraft = draft === null ? undefined : formatter.parse(draft);\n const stepBase = parsedDraft === undefined ? shown : parsedDraft;\n\n const state = useMemo<NumberFieldState>(\n () => ({ value: shown, text, pending, disabled, readOnly, required }),\n [shown, text, pending, disabled, readOnly, required],\n );\n\n // A step, a key and a typed commit fire no `input` / `change` on the element the Field hears\n // for the value (the hidden input is written by script): tell it at the commit (design 7.2).\n useFieldValueChange(optimistic, takeEdit);\n\n const latest = useLatest({\n formatter,\n bounds,\n largeStep,\n disabled,\n readOnly,\n announce,\n state,\n });\n\n // --- Announcements (design 8.3) ---------------------------------------------------------------\n\n const announceValue = useCallback(\n (next: number | null) => {\n const visible = visibleRef.current;\n if (visible === null) return;\n const { announce: compose, formatter: f, state: s } = latest.current;\n const nextState: NumberFieldState = { ...s, value: next, text: f.format(next) };\n const message = compose === undefined ? nextState.text : compose(next, nextState);\n if (message !== null) speak(visible, message);\n },\n [latest],\n );\n\n /** The value a key or a button steps from: the parsed draft if one is open, else the shown value. */\n const resolveBase = useCallback((): number | null => {\n const open = draftRef.current;\n if (open !== null) {\n const parsed = latest.current.formatter.parse(open);\n clearDraft();\n if (parsed !== undefined) return parsed;\n }\n return shownRef.current;\n }, [clearDraft, latest, shownRef]);\n\n /** A one-step gesture: a key press, a wheel event, a click activation. */\n const oneStep = useCallback(\n (compute: (base: number | null) => number | null, source: NumberFieldSource, event: Event) => {\n const base = resolveBase();\n openGesture();\n step(compute(base), source, \"activate\", event);\n commit(source, \"activate\", event);\n },\n [commit, openGesture, resolveBase, step],\n );\n\n // --- Typing (design 4.1) ----------------------------------------------------------------------\n\n const typed = useCallback((next: string) => {\n draftRef.current = next;\n setDraft(next);\n }, []);\n\n const commitDraft = useCallback(\n (event: Event) => {\n const open = draftRef.current;\n if (open === null) return;\n const { formatter: f, disabled: off, readOnly: ro } = latest.current;\n if (off || ro) {\n clearDraft();\n return;\n }\n const parsed = f.parse(open);\n // Unparsable: revert to the committed value's text, no dispatch, no error.\n if (parsed === undefined || Object.is(parsed, shownRef.current)) {\n clearDraft();\n return;\n }\n openGesture();\n step(parsed, \"input\", \"activate\", event);\n commit(\"input\", \"activate\", event);\n },\n [clearDraft, commit, latest, openGesture, shownRef, step],\n );\n\n // --- Keyboard and wheel (design 4.2, 4.4) ----------------------------------------------------\n\n const keyDown = useCallback(\n (event: KeyboardEvent) => {\n const { disabled: off, readOnly: ro, bounds: b, largeStep: large } = latest.current;\n // WebKit fires `compositionend` before the confirming keydown, which then has\n // `isComposing === false` and `keyCode === 229` (Combobox's guard).\n if (off || ro || isComposingKey(event)) return;\n if (event.key === \"Enter\") {\n commitDraft(event);\n return;\n }\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const compute = keyStep(event.key, event.shiftKey, b, large);\n if (compute === null) return;\n event.preventDefault();\n oneStep(compute, \"keyboard\", event);\n },\n [commitDraft, latest, oneStep],\n );\n\n const wheel = useCallback(\n (event: WheelEvent) => {\n const { disabled: off, readOnly: ro, bounds: b } = latest.current;\n const visible = visibleRef.current;\n if (off || ro || visible === null || event.deltaY === 0) return;\n // Only while the input is focused; unfocused, the page scrolls.\n if (visible.ownerDocument.activeElement !== visible) return;\n event.preventDefault();\n const n = event.deltaY < 0 ? 1 : -1;\n oneStep((v) => stepValue(v, n, b), \"wheel\", event);\n },\n [latest, oneStep],\n );\n\n // --- Buttons (design 4.3) ---------------------------------------------------------------------\n\n const endHold = useCallback(\n (direction: StepDirection, event: Event | undefined) => {\n if (holdRef.current !== direction) return;\n holdRef.current = null;\n setHold(null);\n commit(direction, \"activate\", event);\n },\n [commit],\n );\n\n const tickHold = useCallback(\n (direction: StepDirection, event: Event | undefined): boolean => {\n if (holdRef.current !== direction) return false;\n const { bounds: b } = latest.current;\n const n = direction === \"increment\" ? 1 : -1;\n const next = stepValue(holdBase.current, n, b);\n holdBase.current = next;\n step(next, direction, \"activate\", event);\n // At the bound: end the hold now, before the button re-renders disabled (a disabled\n // element may not deliver the release).\n if (stepValue(next, n, b) === next) {\n endHold(direction, event);\n return false;\n }\n return true;\n },\n [endHold, latest, step],\n );\n\n const beginHold = useCallback(\n (direction: StepDirection, event: Event): boolean => {\n const { disabled: off, readOnly: ro } = latest.current;\n if (off || ro || holdRef.current !== null) return false;\n const base = resolveBase();\n // A capture alone holds `live` on screen: start it from what is shown.\n captureGesture();\n holdBase.current = base;\n holdRef.current = direction;\n setHold(direction);\n return tickHold(direction, event);\n },\n [captureGesture, latest, resolveBase, tickHold],\n );\n\n const activate = useCallback(\n (direction: StepDirection, event: Event) => {\n const { disabled: off, readOnly: ro, bounds: b } = latest.current;\n if (off || ro || holdRef.current !== null) return;\n const n = direction === \"increment\" ? 1 : -1;\n oneStep((v) => stepValue(v, n, b), direction, event);\n },\n [latest, oneStep],\n );\n\n // --- Labels ---------------------------------------------------------------------------------\n\n const { count: labelCount, register: registerLabel } = useRegisterCount();\n\n // --- Residual browser paths: mount reconciliation and form reset (design 4.5, 6.4) ----------\n\n const resetTarget = useResetTarget(value, defaultValue) ?? null;\n const resetTargetText = hiddenText(resetTarget);\n\n const { onItemMounted } = useNativeGroupReconciliation<number | null>({\n element: hiddenRef as RefObject<FormAssociatedElement | null>,\n readCurrent: () =>\n readVisible(visibleRef.current, shownRef.current, formatter, (text) => {\n draftRef.current = text;\n setDraft(text);\n }),\n readDefault: () => {\n // A reset clears an open draft whatever the target.\n clearDraft();\n return resetTarget;\n },\n base: () => shownRef.current,\n onPlatformChange: (next, event) => {\n openGesture();\n step(next, null, \"platform\", event);\n commit(null, \"platform\", event);\n },\n onResetEvent: () => {\n // react-dom rewrites a controlled text input's `defaultValue` after every update; the\n // visible text's reset target is written right before the reset algorithm reads it.\n const visible = visibleRef.current;\n if (visible !== null) visible.defaultValue = formatter.format(resetTarget);\n },\n });\n\n // --- Development warnings -------------------------------------------------------------------\n\n useNumberFieldDevWarnings({\n value: valueProp,\n defaultValue: defaultValueProp,\n min,\n max,\n bounds,\n stepValid,\n largeStepValid,\n formatter,\n locale,\n });\n\n // An unmount mid-hold leaves nothing behind (the buttons detach their own listeners).\n useEffect(\n () => () => {\n holdRef.current = null;\n },\n [],\n );\n\n // --- Render ---------------------------------------------------------------------------------\n\n const context = useMemo<NumberFieldContextValue>(\n () => ({\n state,\n bounds,\n stepBase,\n pendingSource: pending ? pendingSource : null,\n inputId,\n labelId,\n name,\n form,\n allowsFractions: formatter.allowsFractions || !Number.isInteger(stepSize),\n stepOnWheel,\n resetTargetText,\n fieldInvalid,\n visibleRef,\n hiddenRef,\n typed,\n commitDraft,\n keyDown,\n wheel,\n beginHold,\n tickHold,\n endHold,\n activate,\n syncHidden,\n registerLabel,\n onItemMounted,\n }),\n [\n state,\n bounds,\n stepBase,\n pending,\n pendingSource,\n inputId,\n labelId,\n name,\n form,\n formatter,\n stepSize,\n stepOnWheel,\n resetTargetText,\n fieldInvalid,\n typed,\n commitDraft,\n keyDown,\n wheel,\n beginHold,\n tickHold,\n endHold,\n activate,\n syncHidden,\n registerLabel,\n onItemMounted,\n ],\n );\n\n const labelledBy = mergeTokenLists(labelCount > 0 ? labelId : undefined, fieldContext?.ids.label);\n const libraryProps: Partial<ComponentPropsWithRef<\"div\">> & DataAttributes = {\n role: \"group\",\n ...(labelledBy !== \"\" ? { \"aria-labelledby\": labelledBy } : {}),\n ...(fieldContext !== null ? { \"data-invalid\": dataAttr(fieldInvalid === true) } : {}),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, NumberFieldState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n });\n\n return <NumberFieldContext value={context}>{element}</NumberFieldContext>;\n}\n\nNumberFieldRoot.displayName = \"NumberFieldRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiLA,MAAM,aAAa,gBAAgB,gBAAgB,QAAQ;AAC3D,MAAM,eAAe,gBAAgB,gBAAgB,QAAQ;;AAG7D,SAAS,SAAS,OAA6D;CAC7E,IAAI,UAAU,KAAA,KAAa,UAAU,MAAM,OAAO;CAClD,OAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;;AAGA,SAAS,mBAAmB,QAAsB,QAA2B;CAC3E,OAAO;EAAE;EAAQ;CAAO;AAC1B;AAEA,SAAS,SAAS,OAAqC;CACrD,OAAO;AACT;;AAGA,SAAS,WAAW,OAA8B;CAChD,OAAO,UAAU,OAAO,KAAK,OAAO,KAAK;AAC3C;;;;;;;;;AAUA,SAAS,YACP,SACA,SACA,WACA,YACe;CACf,IAAI,YAAY,MAAM,OAAO;CAC7B,MAAM,UAAU,QAAQ;CACxB,IAAI,YAAY,UAAU,OAAO,OAAO,GAAG,OAAO;CAClD,IAAI,QAAQ,cAAc,kBAAkB,SAAS;EACnD,WAAW,OAAO;EAClB,OAAO;CACT;CACA,MAAM,SAAS,UAAU,MAAM,OAAO;CACtC,IAAI,WAAW,KAAA,KAAa,OAAO,GAAG,QAAQ,OAAO,GAAG;EACtD,QAAQ,QAAQ,UAAU,OAAO,OAAO;EACxC,OAAO;CACT;CACA,OAAO;AACT;;;;;;;;;;;;;;AAeA,SAAgB,gBAAgB,OAA6B;C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SAAS,QAAQ;CACpC;CAEA,MAAM,UAAU,UAA0D;EACxE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;CACF,CAAC;CAED,OAAO,oBAAC,oBAAD;EAAoB,OAAO;EAAU,UAAA;CAA4B,CAAA;AAC1E;AAEA,gBAAgB,cAAc"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
3
2
|
import { useEffect, useRef } from "react";
|
|
4
|
-
|
|
3
|
+
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
4
|
+
// src/number-field/use-number-field-dev-warnings.ts
|
|
5
5
|
const isDev = process.env.NODE_ENV !== "production";
|
|
6
6
|
function languageOf(tag) {
|
|
7
7
|
return tag.split("-")[0]?.toLowerCase() ?? "";
|
|
@@ -22,7 +22,6 @@ function useNumberFieldDevWarnings(options) {
|
|
|
22
22
|
console.error(`NumberField.Root: the page is \`lang="${lang}"\` but NumberField formats as \`${formatter.locale}\` (the runtime's locale); pass \`locale\`.`);
|
|
23
23
|
}, [locale, formatter]);
|
|
24
24
|
}
|
|
25
|
-
//#endregion
|
|
26
25
|
export { useNumberFieldDevWarnings };
|
|
27
26
|
|
|
28
27
|
//# sourceMappingURL=use-number-field-dev-warnings.mjs.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
1
2
|
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
3
|
import "./number-field-context.mjs";
|
|
3
|
-
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
-
//#region src/number-field/use-step-button.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* State of `NumberField.Increment`, `NumberField.Decrement`, passed to the function forms of
|
|
7
6
|
* `className`, `style`, `children` and `render`.
|
|
@@ -40,5 +39,4 @@ export interface NumberFieldIncrementProps extends Omit<ComponentPropsWithRef<"b
|
|
|
40
39
|
* @see https://ui.funstack.work/components/number-field
|
|
41
40
|
*/
|
|
42
41
|
export type NumberFieldDecrementProps = NumberFieldIncrementProps;
|
|
43
|
-
//#endregion
|
|
44
42
|
//# sourceMappingURL=use-step-button.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-step-button.d.mts","names":[],"sources":["../../src/number-field/use-step-button.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-step-button.d.mts","names":[],"sources":["../../src/number-field/use-step-button.ts"],"mappings":";;;;;;;iBAwKiB;;WAEN;;WAEA;;;;;;;iBAQM,kCAAkC,KACjD;;;;;;;EAkBA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;YAQ3C,4BAA4B"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
2
3
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
4
|
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
4
5
|
import { disabledButton, rendersButton } from "../internal/render-element.mjs";
|
|
5
6
|
import { useRender } from "../internal/use-render.mjs";
|
|
6
7
|
import { isAtBound } from "./number-field-arithmetic.mjs";
|
|
7
8
|
import { useNumberFieldContext } from "./number-field-context.mjs";
|
|
8
|
-
|
|
9
|
-
//#region src/number-field/use-step-button.ts
|
|
9
|
+
// src/number-field/use-step-button.ts
|
|
10
10
|
const isDev = process.env.NODE_ENV !== "production";
|
|
11
11
|
/** First repeat after the press, then the interval between repeats (Base UI, React Aria). */
|
|
12
12
|
const HOLD_DELAY = 400;
|
|
@@ -169,7 +169,6 @@ function useStepButtonElement(direction, part, props) {
|
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
//#endregion
|
|
173
172
|
export { useStepButton, useStepButtonElement };
|
|
174
173
|
|
|
175
174
|
//# sourceMappingURL=use-step-button.mjs.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { OTPFieldCharset } from "./otp-field-filter.mjs";
|
|
2
|
-
import { OTPFieldCompleteDetails, OTPFieldRoot, OTPFieldRootProps, OTPFieldState, OTPFieldValueChangeDetails } from "./otp-field-root.mjs";
|
|
3
1
|
import { OTPFieldInput, OTPFieldInputProps } from "./otp-field-input.mjs";
|
|
2
|
+
import { OTPFieldCompleteDetails, OTPFieldRoot, OTPFieldRootProps, OTPFieldState, OTPFieldValueChangeDetails } from "./otp-field-root.mjs";
|
|
4
3
|
import { OTPFieldSlot, OTPFieldSlotProps, OTPFieldSlotState } from "./otp-field-slot.mjs";
|
|
5
|
-
|
|
4
|
+
import { OTPFieldCharset } from "./otp-field-filter.mjs";
|
|
6
5
|
/**
|
|
7
6
|
* OTPField: a field for a short code the user received elsewhere (an SMS or email code, an
|
|
8
7
|
* authenticator's digits, a PIN). `Root` (`div`, owns the text) > `Input` (the one
|
|
@@ -18,6 +17,5 @@ export declare const OTPField: {
|
|
|
18
17
|
readonly Input: typeof OTPFieldInput;
|
|
19
18
|
readonly Slot: typeof OTPFieldSlot;
|
|
20
19
|
};
|
|
21
|
-
//#endregion
|
|
22
20
|
export type { OTPFieldCharset, OTPFieldCompleteDetails, OTPFieldInputProps, OTPFieldRootProps, OTPFieldSlotProps, OTPFieldSlotState, OTPFieldState, OTPFieldValueChangeDetails };
|
|
23
21
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/otp-field/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/otp-field/index.ts"],"mappings":";;;;;;;;;;;;;;qBAca;WACX,aAAI;WACJ,cAAK;WACL,aAAI"}
|
package/dist/otp-field/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OTPFieldInput } from "./otp-field-input.mjs";
|
|
2
2
|
import { OTPFieldRoot } from "./otp-field-root.mjs";
|
|
3
3
|
import { OTPFieldSlot } from "./otp-field-slot.mjs";
|
|
4
|
-
|
|
4
|
+
// src/otp-field/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* OTPField: a field for a short code the user received elsewhere (an SMS or email code, an
|
|
7
7
|
* authenticator's digits, a PIN). `Root` (`div`, owns the text) > `Input` (the one
|
|
@@ -17,7 +17,6 @@ const OTPField = {
|
|
|
17
17
|
Input: OTPFieldInput,
|
|
18
18
|
Slot: OTPFieldSlot
|
|
19
19
|
};
|
|
20
|
-
//#endregion
|
|
21
20
|
export { OTPField };
|
|
22
21
|
|
|
23
22
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createContext, use } from "react";
|
|
3
|
-
|
|
3
|
+
// src/otp-field/otp-field-context.ts
|
|
4
4
|
const OTPFieldContext = createContext(null);
|
|
5
5
|
function useOTPFieldContext(part) {
|
|
6
6
|
const context = use(OTPFieldContext);
|
|
7
7
|
if (context === null) throw new Error(`${part} must be rendered inside an OTPField.Root.`);
|
|
8
8
|
return context;
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
10
|
export { OTPFieldContext, useOTPFieldContext };
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=otp-field-context.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-field-filter.d.mts","names":[],"sources":["../../src/otp-field/otp-field-filter.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"otp-field-filter.d.mts","names":[],"sources":["../../src/otp-field/otp-field-filter.ts"],"mappings":";YAIY"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/otp-field/otp-field-filter.ts
|
|
2
2
|
const CHARSETS = {
|
|
3
3
|
numeric: {
|
|
4
4
|
test: /^[0-9]$/,
|
|
@@ -129,7 +129,6 @@ function activeRange(focused, selectionStart, selectionEnd, length) {
|
|
|
129
129
|
}
|
|
130
130
|
return [Math.min(start, length), Math.min(end, length)];
|
|
131
131
|
}
|
|
132
|
-
//#endregion
|
|
133
132
|
export { activeRange, applyEdit, charsetInputMode, charsetPattern, filterChars, normalizeCode };
|
|
134
133
|
|
|
135
134
|
//# sourceMappingURL=otp-field-filter.mjs.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { CSSProperties, ComponentPropsWithRef } from "react";
|
|
1
2
|
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
3
|
import { OTPFieldState } from "./otp-field-root.mjs";
|
|
3
|
-
import { CSSProperties, ComponentPropsWithRef } from "react";
|
|
4
|
-
//#region src/otp-field/otp-field-input.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Props of `OTPField.Input`.
|
|
7
6
|
*
|
|
@@ -37,5 +36,4 @@ export declare function OTPFieldInput({ className, style, render, ...rest }: OTP
|
|
|
37
36
|
export declare namespace OTPFieldInput {
|
|
38
37
|
var displayName: string;
|
|
39
38
|
}
|
|
40
|
-
//#endregion
|
|
41
39
|
//# sourceMappingURL=otp-field-input.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-field-input.d.mts","names":[],"sources":["../../src/otp-field/otp-field-input.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"otp-field-input.d.mts","names":[],"sources":["../../src/otp-field/otp-field-input.tsx"],"mappings":";;;;;;;;iBAuBiB,2BAA2B,KAC1C;;EAkBA,YAAY,+BAA+B;;;;;EAK3C,QAAQ,WAAW,2BAA2B;;EAE9C,SAAS,WAAW,gCAAgC;;;;;;;;;;;;;;;;;wBAyCtC,gBAAgB,WAAW,OAAO,WAAW,QAAQ,qCAAkB;yBAAvE"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useRef } from "react";
|
|
2
3
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
|
-
import { useRender } from "../internal/use-render.mjs";
|
|
4
|
-
import { useLatest } from "../internal/use-latest.mjs";
|
|
5
|
-
import { useElementCheck } from "../internal/use-element-check.mjs";
|
|
6
|
-
import { useMergedRefs } from "../internal/use-merged-refs.mjs";
|
|
7
4
|
import { useFieldControl } from "../internal/form/use-field-control.mjs";
|
|
8
5
|
import { useFormOwnerEvent } from "../internal/form/use-form-owner-event.mjs";
|
|
6
|
+
import { useElementCheck } from "../internal/use-element-check.mjs";
|
|
7
|
+
import { useLatest } from "../internal/use-latest.mjs";
|
|
8
|
+
import { useMergedRefs } from "../internal/use-merged-refs.mjs";
|
|
9
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
9
10
|
import { useOTPFieldContext } from "./otp-field-context.mjs";
|
|
10
11
|
import { charsetInputMode, charsetPattern } from "./otp-field-filter.mjs";
|
|
11
|
-
|
|
12
|
-
//#region src/otp-field/otp-field-input.tsx
|
|
12
|
+
// src/otp-field/otp-field-input.tsx
|
|
13
13
|
const isDev = process.env.NODE_ENV !== "production";
|
|
14
14
|
/**
|
|
15
15
|
* The Input covers the Root with transparent text and caret (design 6). Functional, owned; the
|
|
@@ -171,7 +171,6 @@ function OTPFieldInput({ className, style, render, ...rest }) {
|
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
OTPFieldInput.displayName = "OTPFieldInput";
|
|
174
|
-
//#endregion
|
|
175
174
|
export { OTPFieldInput };
|
|
176
175
|
|
|
177
176
|
//# sourceMappingURL=otp-field-input.mjs.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
1
2
|
import { Action, ActionDetails, ChangeReason, RenderProp, StateValue, UrgentChangeHandler } from "../internal/types.mjs";
|
|
2
3
|
import { OTPFieldCharset } from "./otp-field-filter.mjs";
|
|
3
|
-
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
-
//#region src/otp-field/otp-field-root.d.ts
|
|
5
4
|
/** Details passed as the second argument of `onValueChange`. */
|
|
6
5
|
export interface OTPFieldValueChangeDetails extends ActionDetails {
|
|
7
6
|
/**
|
|
@@ -148,5 +147,4 @@ export declare function OTPFieldRoot(props: OTPFieldRootProps): import("react").
|
|
|
148
147
|
export declare namespace OTPFieldRoot {
|
|
149
148
|
var displayName: string;
|
|
150
149
|
}
|
|
151
|
-
//#endregion
|
|
152
150
|
//# sourceMappingURL=otp-field-root.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-field-root.d.mts","names":[],"sources":["../../src/otp-field/otp-field-root.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"otp-field-root.d.mts","names":[],"sources":["../../src/otp-field/otp-field-root.tsx"],"mappings":";;;;iBA+CiB,mCAAmC;;;;;;WAMzC,QAAQ;;;iBAIF,gCAAgC;;;;;WAKtC,QAAQ;;;iBAIF;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;;iBAQM,0BAA0B,KACzC;;EAIA;;;;;;EAMA,UAAU;;EAEV;;;;;;EAMA;;;;;;EAMA,gBAAgB,4BAA4B;;;;;;;;EAQ5C,iBAAiB,QAAQ,eAAe,SAAS;;;;;;;;EAQjD;;;;;;EAMA;;EAEA;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA;;;;;;;;;EASA,MAAM;;;;;;;;EAQN;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;;;;wBAiEpC,aAAa,OAAO,oCAAiB,IAAA;yBAArC"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { addTransitionType, use, useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
3
|
import { createActionDetails } from "../internal/action/action-details.mjs";
|
|
3
|
-
import { dataAttr } from "../internal/data-attr.mjs";
|
|
4
|
-
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
5
|
-
import { resolveStateValue } from "../internal/render-element.mjs";
|
|
6
|
-
import { useActionTrigger } from "../internal/action/use-action-trigger.mjs";
|
|
7
|
-
import { useRender } from "../internal/use-render.mjs";
|
|
8
|
-
import { transitionTypes } from "../internal/transition-types.mjs";
|
|
9
|
-
import { useLatest } from "../internal/use-latest.mjs";
|
|
10
4
|
import { callUrgentHandler } from "../internal/action/call-urgent-handler.mjs";
|
|
5
|
+
import { useActionTrigger } from "../internal/action/use-action-trigger.mjs";
|
|
6
|
+
import { dataAttr } from "../internal/data-attr.mjs";
|
|
11
7
|
import { FieldContext } from "../internal/form/field-context.mjs";
|
|
12
8
|
import { resolveFieldDefaults, useFieldValueChange } from "../internal/form/use-field-control.mjs";
|
|
13
9
|
import { useFormReset, useResetTarget } from "../internal/form/use-form-reset.mjs";
|
|
10
|
+
import { resolveStateValue } from "../internal/render-element.mjs";
|
|
11
|
+
import { transitionTypes } from "../internal/transition-types.mjs";
|
|
12
|
+
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
13
|
+
import { useLatest } from "../internal/use-latest.mjs";
|
|
14
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
14
15
|
import { OTPFieldContext } from "./otp-field-context.mjs";
|
|
15
16
|
import { activeRange, applyEdit, filterChars, normalizeCode } from "./otp-field-filter.mjs";
|
|
16
|
-
import { addTransitionType, use, useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
17
17
|
import { jsx } from "react/jsx-runtime";
|
|
18
|
-
|
|
18
|
+
// src/otp-field/otp-field-root.tsx
|
|
19
19
|
const isDev = process.env.NODE_ENV !== "production";
|
|
20
20
|
const COMPLETE_TYPES = transitionTypes("otp-field", "complete");
|
|
21
21
|
const BLURRED = {
|
|
@@ -235,7 +235,7 @@ function OTPFieldRoot(props) {
|
|
|
235
235
|
const input = inputRef.current;
|
|
236
236
|
if (input === null || event.detail > 1 || input.selectionStart !== input.selectionEnd) return;
|
|
237
237
|
let target = null;
|
|
238
|
-
let distance =
|
|
238
|
+
let distance = 1e400;
|
|
239
239
|
for (const [element, index] of slots.current) {
|
|
240
240
|
const box = element.getBoundingClientRect();
|
|
241
241
|
if (box.width === 0 && box.height === 0) continue;
|
|
@@ -394,7 +394,6 @@ function OTPFieldRoot(props) {
|
|
|
394
394
|
});
|
|
395
395
|
}
|
|
396
396
|
OTPFieldRoot.displayName = "OTPFieldRoot";
|
|
397
|
-
//#endregion
|
|
398
397
|
export { OTPFieldRoot };
|
|
399
398
|
|
|
400
399
|
//# sourceMappingURL=otp-field-root.mjs.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
1
2
|
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
3
|
import { OTPFieldState } from "./otp-field-root.mjs";
|
|
3
|
-
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
-
//#region src/otp-field/otp-field-slot.d.ts
|
|
5
4
|
/** The state a Slot's function props receive. */
|
|
6
5
|
export interface OTPFieldSlotState extends OTPFieldState {
|
|
7
6
|
/** The Slot's `index`. */
|
|
@@ -48,5 +47,4 @@ export declare function OTPFieldSlot({ index, className, style, children, render
|
|
|
48
47
|
export declare namespace OTPFieldSlot {
|
|
49
48
|
var displayName: string;
|
|
50
49
|
}
|
|
51
|
-
//#endregion
|
|
52
50
|
//# sourceMappingURL=otp-field-slot.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-field-slot.d.mts","names":[],"sources":["../../src/otp-field/otp-field-slot.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"otp-field-slot.d.mts","names":[],"sources":["../../src/otp-field/otp-field-slot.tsx"],"mappings":";;;;iBAWiB,0BAA0B;;WAEhC;;WAEA;;WAEA;;WAEA;;;;;;;iBAQM,0BAA0B,KACzC;;EAIA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;;;;EAK9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,+BAA+B;;;;;;;;;;;;;wBAyBrC,eACd,OACA,WACA,OACA,UACA,WACG,QACF,oBAAiB;yBAPJ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
2
3
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
4
|
import { useRender } from "../internal/use-render.mjs";
|
|
4
5
|
import { useOTPFieldContext } from "./otp-field-context.mjs";
|
|
5
|
-
|
|
6
|
-
//#region src/otp-field/otp-field-slot.tsx
|
|
6
|
+
// src/otp-field/otp-field-slot.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Never the pointer's target (design 1, 6): a Slot that forms a stacking context (`opacity`,
|
|
9
9
|
* `position`, `transform`, an animation of those) would otherwise paint over the Input and take
|
|
@@ -61,7 +61,6 @@ function OTPFieldSlot({ index, className, style, children, render, ...rest }) {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
OTPFieldSlot.displayName = "OTPFieldSlot";
|
|
64
|
-
//#endregion
|
|
65
64
|
export { OTPFieldSlot };
|
|
66
65
|
|
|
67
66
|
//# sourceMappingURL=otp-field-slot.mjs.map
|
package/dist/popover/index.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import "../internal/platform-attributes.mjs";
|
|
2
|
-
import { PopoverTrigger, PopoverTriggerProps, PopoverTriggerState } from "./popover-trigger.mjs";
|
|
3
2
|
import { PopoverClose, PopoverCloseProps, PopoverCloseState } from "./popover-close.mjs";
|
|
4
|
-
import { PopoverAlign, PopoverPopup, PopoverPopupProps, PopoverPopupState, PopoverSide } from "./popover-popup.mjs";
|
|
5
3
|
import { PopoverDescription, PopoverDescriptionProps, PopoverDescriptionState } from "./popover-description.mjs";
|
|
4
|
+
import { PopoverAlign, PopoverPopup, PopoverPopupProps, PopoverPopupState, PopoverSide } from "./popover-popup.mjs";
|
|
6
5
|
import { PopoverOpenChangeDetails, PopoverRoot, PopoverRootProps, PopoverRootState } from "./popover-root.mjs";
|
|
7
6
|
import { PopoverTitle, PopoverTitleProps, PopoverTitleState } from "./popover-title.mjs";
|
|
8
|
-
|
|
7
|
+
import { PopoverTrigger, PopoverTriggerProps, PopoverTriggerState } from "./popover-trigger.mjs";
|
|
9
8
|
/**
|
|
10
9
|
* Popover built on `popover="auto"` and Invoker Commands: `Root` (no DOM) > `Trigger`
|
|
11
10
|
* (`button[popovertarget]`) + `Popup` (`dialog[popover=auto][aria-modal=false]`) >
|
|
@@ -25,6 +24,5 @@ export declare const Popover: {
|
|
|
25
24
|
readonly Title: typeof PopoverTitle;
|
|
26
25
|
readonly Description: typeof PopoverDescription;
|
|
27
26
|
};
|
|
28
|
-
//#endregion
|
|
29
27
|
export type { PopoverAlign, PopoverCloseProps, PopoverCloseState, PopoverDescriptionProps, PopoverDescriptionState, PopoverOpenChangeDetails, PopoverPopupProps, PopoverPopupState, PopoverRootProps, PopoverRootState, PopoverSide, PopoverTitleProps, PopoverTitleState, PopoverTriggerProps, PopoverTriggerState };
|
|
30
28
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/popover/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/popover/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;qBAqBa;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,cAAK;WACL,cAAK;WACL,oBAAW"}
|
package/dist/popover/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { PopoverPopup } from "./popover-popup.mjs";
|
|
|
4
4
|
import { PopoverRoot } from "./popover-root.mjs";
|
|
5
5
|
import { PopoverTitle } from "./popover-title.mjs";
|
|
6
6
|
import { PopoverTrigger } from "./popover-trigger.mjs";
|
|
7
|
-
|
|
7
|
+
// src/popover/index.ts
|
|
8
8
|
/**
|
|
9
9
|
* Popover built on `popover="auto"` and Invoker Commands: `Root` (no DOM) > `Trigger`
|
|
10
10
|
* (`button[popovertarget]`) + `Popup` (`dialog[popover=auto][aria-modal=false]`) >
|
|
@@ -24,7 +24,6 @@ const Popover = {
|
|
|
24
24
|
Title: PopoverTitle,
|
|
25
25
|
Description: PopoverDescription
|
|
26
26
|
};
|
|
27
|
-
//#endregion
|
|
28
27
|
export { Popover };
|
|
29
28
|
|
|
30
29
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { Action, ActionDetails, RenderProp, StateValue, WhilePending } from "../internal/types.mjs";
|
|
2
1
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
-
|
|
2
|
+
import { Action, ActionDetails, RenderProp, StateValue, WhilePending } from "../internal/types.mjs";
|
|
4
3
|
/**
|
|
5
4
|
* State of `Popover.Close`, passed to the function forms of `className`, `style`, `children` and
|
|
6
5
|
* `render`.
|
|
7
6
|
*/
|
|
8
7
|
export interface PopoverCloseState {
|
|
9
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* From the click until the close this part asked for has committed: the `action` in flight,
|
|
10
|
+
* then the Root's close (an awaited `openChangeAction(false)`, or another pending action the
|
|
11
|
+
* close is entangled with). Also without `action`, in library mode.
|
|
12
|
+
*/
|
|
10
13
|
readonly pending: boolean;
|
|
11
14
|
/** The `disabled` prop. */
|
|
12
15
|
readonly disabled: boolean;
|
|
@@ -33,7 +36,8 @@ export interface PopoverCloseProps extends Omit<ComponentPropsWithRef<"button">,
|
|
|
33
36
|
* cancelled, `aria-disabled="true"` meanwhile). `"run"`: the action runs again (`data-pending`
|
|
34
37
|
* until every run has settled); the popover closes once, when the last run settles and only
|
|
35
38
|
* if the latest run resolved (a rejection leaves it open, as in `"ignore"` mode). No effect
|
|
36
|
-
* without `action
|
|
39
|
+
* without `action`: the part then shows `data-pending` while the Root's close waits, without
|
|
40
|
+
* `aria-disabled`.
|
|
37
41
|
*
|
|
38
42
|
* @defaultValue `"ignore"`
|
|
39
43
|
*/
|
|
@@ -63,7 +67,8 @@ export interface PopoverCloseProps extends Omit<ComponentPropsWithRef<"button">,
|
|
|
63
67
|
* commit). With `action` the action runs first in this part's own transition (`data-pending` on
|
|
64
68
|
* the button, with `aria-disabled`; a second click meanwhile is ignored unless
|
|
65
69
|
* `whilePending="run"`); a rejection leaves the
|
|
66
|
-
* popover open.
|
|
70
|
+
* popover open. With or without `action`, the button has `data-pending` until the close it
|
|
71
|
+
* asked for has committed. It keeps `commandfor` where the Trigger has `popovertarget`: an invoker
|
|
67
72
|
* inside its own popover exposes no state either way, and the `command` event tells the Popup a
|
|
68
73
|
* foreign hide's reason.
|
|
69
74
|
*
|
|
@@ -77,5 +82,4 @@ export declare function PopoverClose({ action, whilePending, disabled, className
|
|
|
77
82
|
export declare namespace PopoverClose {
|
|
78
83
|
var displayName: string;
|
|
79
84
|
}
|
|
80
|
-
//#endregion
|
|
81
85
|
//# sourceMappingURL=popover-close.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-close.d.mts","names":[],"sources":["../../src/popover/popover-close.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"popover-close.d.mts","names":[],"sources":["../../src/popover/popover-close.tsx"],"mappings":";;;;;;iBAkBiB;;;;;;WAMN;;WAEA;;;;;;;iBAQM,0BAA0B,KACzC;;;;;;;;;;;EAaA,SAAS,QAAQ,SAAS;;;;;;;;;;;EAW1B,eAAe;;;;;;;;EAQf;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;;;;;;;;wBAsBvC,eACd,QACA,cACA,UACA,WACA,OACA,UACA,WACG,QACF,oBAAiB;yBATJ"}
|
|
@@ -3,7 +3,7 @@ import { createActionDetails } from "../internal/action/action-details.mjs";
|
|
|
3
3
|
import { isPopoverOpen } from "../internal/overlay/popover-open.mjs";
|
|
4
4
|
import { useOverlayClose } from "../internal/overlay/use-overlay-close.mjs";
|
|
5
5
|
import { usePopoverContext } from "./popover-context.mjs";
|
|
6
|
-
|
|
6
|
+
// src/popover/popover-close.tsx
|
|
7
7
|
/**
|
|
8
8
|
* A close button: `<button type="button" commandfor command="hide-popover">`, or a plain
|
|
9
9
|
* `<button type="button">` with `action` (it does nothing before hydration). In JS-free mode
|
|
@@ -12,7 +12,8 @@ import { usePopoverContext } from "./popover-context.mjs";
|
|
|
12
12
|
* commit). With `action` the action runs first in this part's own transition (`data-pending` on
|
|
13
13
|
* the button, with `aria-disabled`; a second click meanwhile is ignored unless
|
|
14
14
|
* `whilePending="run"`); a rejection leaves the
|
|
15
|
-
* popover open.
|
|
15
|
+
* popover open. With or without `action`, the button has `data-pending` until the close it
|
|
16
|
+
* asked for has committed. It keeps `commandfor` where the Trigger has `popovertarget`: an invoker
|
|
16
17
|
* inside its own popover exposes no state either way, and the `command` event tells the Popup a
|
|
17
18
|
* foreign hide's reason.
|
|
18
19
|
*
|
|
@@ -58,7 +59,6 @@ function PopoverClose({ action, whilePending, disabled = false, className, style
|
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
PopoverClose.displayName = "PopoverClose";
|
|
61
|
-
//#endregion
|
|
62
62
|
export { PopoverClose };
|
|
63
63
|
|
|
64
64
|
//# sourceMappingURL=popover-close.mjs.map
|