@funstack/ui 0.1.0-alpha.2 → 0.1.0-alpha.4
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.map +1 -1
- package/dist/accordion/accordion-item.mjs +18 -4
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.mjs +2 -3
- package/dist/accordion/accordion-panel.mjs.map +1 -1
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +34 -15
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +4 -5
- package/dist/accordion/accordion-trigger.mjs.map +1 -1
- package/dist/checkbox/checkbox.d.mts +5 -3
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +25 -9
- package/dist/checkbox/checkbox.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts +2 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +3 -1
- package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +5 -2
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +24 -5
- package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
- package/dist/combobox/combobox-clear.mjs +2 -1
- package/dist/combobox/combobox-clear.mjs.map +1 -1
- package/dist/combobox/combobox-context.mjs.map +1 -1
- package/dist/combobox/combobox-input.d.mts +3 -1
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +16 -2
- package/dist/combobox/combobox-input.mjs.map +1 -1
- package/dist/combobox/combobox-list.mjs +3 -2
- package/dist/combobox/combobox-list.mjs.map +1 -1
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +7 -2
- package/dist/combobox/combobox-popup.mjs.map +1 -1
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +20 -5
- package/dist/combobox/combobox-root.mjs.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +2 -1
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/dialog/dialog-close.d.mts +17 -10
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +33 -21
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-context.mjs.map +1 -1
- package/dist/dialog/dialog-form.d.mts +23 -10
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +51 -32
- package/dist/dialog/dialog-form.mjs.map +1 -1
- package/dist/dialog/dialog-popup.d.mts +10 -4
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +117 -44
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts +14 -8
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +67 -12
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +3 -2
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +2 -1
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/dialog/index.d.mts +4 -2
- package/dist/dialog/index.d.mts.map +1 -1
- package/dist/dialog/index.mjs +4 -2
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/field/field-control.d.mts +33 -0
- package/dist/field/field-control.d.mts.map +1 -0
- package/dist/field/field-control.mjs +68 -0
- package/dist/field/field-control.mjs.map +1 -0
- package/dist/field/field-description.d.mts +24 -0
- package/dist/field/field-description.d.mts.map +1 -0
- package/dist/field/field-description.mjs +34 -0
- package/dist/field/field-description.mjs.map +1 -0
- package/dist/field/field-error.d.mts +30 -0
- package/dist/field/field-error.d.mts.map +1 -0
- package/dist/field/field-error.mjs +42 -0
- package/dist/field/field-error.mjs.map +1 -0
- package/dist/field/field-label.d.mts +25 -0
- package/dist/field/field-label.d.mts.map +1 -0
- package/dist/field/field-label.mjs +46 -0
- package/dist/field/field-label.mjs.map +1 -0
- package/dist/field/field-root.d.mts +53 -0
- package/dist/field/field-root.d.mts.map +1 -0
- package/dist/field/field-root.mjs +319 -0
- package/dist/field/field-root.mjs.map +1 -0
- package/dist/field/index.d.mts +18 -0
- package/dist/field/index.d.mts.map +1 -0
- package/dist/field/index.mjs +17 -0
- package/dist/field/index.mjs.map +1 -0
- package/dist/form/form-root.d.mts +58 -0
- package/dist/form/form-root.d.mts.map +1 -0
- package/dist/form/form-root.mjs +147 -0
- package/dist/form/form-root.mjs.map +1 -0
- package/dist/form/form-submit.d.mts +31 -0
- package/dist/form/form-submit.d.mts.map +1 -0
- package/dist/form/form-submit.mjs +53 -0
- package/dist/form/form-submit.mjs.map +1 -0
- package/dist/form/index.d.mts +11 -0
- package/dist/form/index.d.mts.map +1 -0
- package/dist/form/index.mjs +11 -0
- package/dist/form/index.mjs.map +1 -0
- package/dist/index.d.mts +53 -1
- package/dist/index.mjs +11 -1
- package/dist/internal/announce.mjs +53 -0
- package/dist/internal/announce.mjs.map +1 -0
- package/dist/internal/content-focus-probe.mjs +42 -0
- package/dist/internal/content-focus-probe.mjs.map +1 -0
- package/dist/internal/decimal.mjs +27 -0
- package/dist/internal/decimal.mjs.map +1 -0
- package/dist/internal/dev-warn.mjs +17 -0
- package/dist/internal/dev-warn.mjs.map +1 -0
- package/dist/internal/field-context.d.mts +19 -0
- package/dist/internal/field-context.d.mts.map +1 -0
- package/dist/internal/field-context.mjs +14 -0
- package/dist/internal/field-context.mjs.map +1 -0
- package/dist/internal/focus-first-invalid.mjs +67 -0
- package/dist/internal/focus-first-invalid.mjs.map +1 -0
- package/dist/internal/form-status-watcher.mjs +31 -0
- package/dist/internal/form-status-watcher.mjs.map +1 -0
- package/dist/internal/modal-registry.mjs +39 -0
- package/dist/internal/modal-registry.mjs.map +1 -0
- package/dist/internal/range-value.mjs +51 -0
- package/dist/internal/range-value.mjs.map +1 -0
- package/dist/internal/render-element.mjs +54 -0
- package/dist/internal/render-element.mjs.map +1 -0
- package/dist/internal/toolbar-context.mjs +17 -0
- package/dist/internal/toolbar-context.mjs.map +1 -0
- package/dist/internal/types.d.mts +3 -1
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-controllable-action.mjs +33 -15
- package/dist/internal/use-controllable-action.mjs.map +1 -1
- package/dist/internal/use-exit-animation.mjs +26 -6
- package/dist/internal/use-exit-animation.mjs.map +1 -1
- package/dist/internal/use-field-control.mjs +109 -0
- package/dist/internal/use-field-control.mjs.map +1 -0
- package/dist/internal/use-form-owner-event.mjs +44 -0
- package/dist/internal/use-form-owner-event.mjs.map +1 -0
- package/dist/internal/use-form-reset.mjs +10 -33
- package/dist/internal/use-form-reset.mjs.map +1 -1
- package/dist/internal/use-latest.mjs +32 -0
- package/dist/internal/use-latest.mjs.map +1 -0
- package/dist/internal/use-modal-registration.mjs +47 -0
- package/dist/internal/use-modal-registration.mjs.map +1 -0
- package/dist/internal/use-native-group-reconciliation.mjs +6 -5
- package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
- package/dist/internal/use-native-select-value.mjs +7 -5
- package/dist/internal/use-native-select-value.mjs.map +1 -1
- package/dist/internal/use-popover-popup.mjs +11 -24
- package/dist/internal/use-popover-popup.mjs.map +1 -1
- package/dist/internal/use-popover-root.mjs +58 -23
- package/dist/internal/use-popover-root.mjs.map +1 -1
- package/dist/internal/use-popover-trigger.mjs +1 -1
- package/dist/internal/use-render.mjs +11 -34
- package/dist/internal/use-render.mjs.map +1 -1
- package/dist/internal/use-roving-focus.mjs +255 -0
- package/dist/internal/use-roving-focus.mjs.map +1 -0
- package/dist/internal/validity.d.mts +24 -0
- package/dist/internal/validity.d.mts.map +1 -0
- package/dist/internal/validity.mjs +108 -0
- package/dist/internal/validity.mjs.map +1 -0
- package/dist/menu/menu-checkbox-item.mjs +2 -1
- package/dist/menu/menu-checkbox-item.mjs.map +1 -1
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +3 -2
- package/dist/menu/menu-group.mjs.map +1 -1
- package/dist/menu/menu-item.mjs +2 -1
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +7 -2
- package/dist/menu/menu-popup.mjs.map +1 -1
- package/dist/menu/menu-radio-group.mjs +9 -4
- package/dist/menu/menu-radio-group.mjs.map +1 -1
- package/dist/menu/menu-radio-item.mjs +2 -1
- package/dist/menu/menu-radio-item.mjs.map +1 -1
- package/dist/menu/menu-root.mjs +1 -1
- package/dist/menu/menu-root.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +2 -1
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +15 -4
- package/dist/menu/menu-trigger.mjs.map +1 -1
- package/dist/meter/index.d.mts +24 -0
- package/dist/meter/index.d.mts.map +1 -0
- package/dist/meter/index.mjs +23 -0
- package/dist/meter/index.mjs.map +1 -0
- package/dist/meter/meter-context.mjs +13 -0
- package/dist/meter/meter-context.mjs.map +1 -0
- package/dist/meter/meter-indicator.d.mts +19 -0
- package/dist/meter/meter-indicator.d.mts.map +1 -0
- package/dist/meter/meter-indicator.mjs +25 -0
- package/dist/meter/meter-indicator.mjs.map +1 -0
- package/dist/meter/meter-label.d.mts +19 -0
- package/dist/meter/meter-label.d.mts.map +1 -0
- package/dist/meter/meter-label.mjs +28 -0
- package/dist/meter/meter-label.mjs.map +1 -0
- package/dist/meter/meter-region.d.mts +4 -0
- package/dist/meter/meter-region.d.mts.map +1 -0
- package/dist/meter/meter-region.mjs +39 -0
- package/dist/meter/meter-region.mjs.map +1 -0
- package/dist/meter/meter-root.d.mts +71 -0
- package/dist/meter/meter-root.d.mts.map +1 -0
- package/dist/meter/meter-root.mjs +83 -0
- package/dist/meter/meter-root.mjs.map +1 -0
- package/dist/meter/meter-track.d.mts +19 -0
- package/dist/meter/meter-track.d.mts.map +1 -0
- package/dist/meter/meter-track.mjs +25 -0
- package/dist/meter/meter-track.mjs.map +1 -0
- package/dist/meter/meter-value.d.mts +20 -0
- package/dist/meter/meter-value.d.mts.map +1 -0
- package/dist/meter/meter-value.mjs +29 -0
- package/dist/meter/meter-value.mjs.map +1 -0
- package/dist/number-field/index.d.mts +26 -0
- package/dist/number-field/index.d.mts.map +1 -0
- package/dist/number-field/index.mjs +26 -0
- package/dist/number-field/index.mjs.map +1 -0
- package/dist/number-field/number-field-arithmetic.mjs +78 -0
- package/dist/number-field/number-field-arithmetic.mjs.map +1 -0
- package/dist/number-field/number-field-context.d.mts +2 -0
- package/dist/number-field/number-field-context.mjs +13 -0
- package/dist/number-field/number-field-context.mjs.map +1 -0
- package/dist/number-field/number-field-decrement.d.mts +16 -0
- package/dist/number-field/number-field-decrement.d.mts.map +1 -0
- package/dist/number-field/number-field-decrement.mjs +19 -0
- package/dist/number-field/number-field-decrement.mjs.map +1 -0
- package/dist/number-field/number-field-format.mjs +279 -0
- package/dist/number-field/number-field-format.mjs.map +1 -0
- package/dist/number-field/number-field-increment.d.mts +32 -0
- package/dist/number-field/number-field-increment.d.mts.map +1 -0
- package/dist/number-field/number-field-increment.mjs +68 -0
- package/dist/number-field/number-field-increment.mjs.map +1 -0
- package/dist/number-field/number-field-input.d.mts +29 -0
- package/dist/number-field/number-field-input.d.mts.map +1 -0
- package/dist/number-field/number-field-input.mjs +163 -0
- package/dist/number-field/number-field-input.mjs.map +1 -0
- package/dist/number-field/number-field-label.d.mts +23 -0
- package/dist/number-field/number-field-label.d.mts.map +1 -0
- package/dist/number-field/number-field-label.mjs +47 -0
- package/dist/number-field/number-field-label.mjs.map +1 -0
- package/dist/number-field/number-field-root.d.mts +108 -0
- package/dist/number-field/number-field-root.d.mts.map +1 -0
- package/dist/number-field/number-field-root.mjs +523 -0
- package/dist/number-field/number-field-root.mjs.map +1 -0
- package/dist/number-field/use-step-button.mjs +107 -0
- package/dist/number-field/use-step-button.mjs.map +1 -0
- package/dist/popover/popover-close.mjs +2 -1
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +7 -2
- package/dist/popover/popover-popup.mjs.map +1 -1
- package/dist/popover/popover-root.mjs +1 -1
- package/dist/progress/index.d.mts +24 -0
- package/dist/progress/index.d.mts.map +1 -0
- package/dist/progress/index.mjs +24 -0
- package/dist/progress/index.mjs.map +1 -0
- package/dist/progress/progress-context.mjs +13 -0
- package/dist/progress/progress-context.mjs.map +1 -0
- package/dist/progress/progress-indicator.d.mts +19 -0
- package/dist/progress/progress-indicator.d.mts.map +1 -0
- package/dist/progress/progress-indicator.mjs +29 -0
- package/dist/progress/progress-indicator.mjs.map +1 -0
- package/dist/progress/progress-label.d.mts +19 -0
- package/dist/progress/progress-label.d.mts.map +1 -0
- package/dist/progress/progress-label.mjs +30 -0
- package/dist/progress/progress-label.mjs.map +1 -0
- package/dist/progress/progress-root.d.mts +68 -0
- package/dist/progress/progress-root.d.mts.map +1 -0
- package/dist/progress/progress-root.mjs +80 -0
- package/dist/progress/progress-root.mjs.map +1 -0
- package/dist/progress/progress-track.d.mts +19 -0
- package/dist/progress/progress-track.d.mts.map +1 -0
- package/dist/progress/progress-track.mjs +29 -0
- package/dist/progress/progress-track.mjs.map +1 -0
- package/dist/progress/progress-value.d.mts +20 -0
- package/dist/progress/progress-value.d.mts.map +1 -0
- package/dist/progress/progress-value.mjs +33 -0
- package/dist/progress/progress-value.mjs.map +1 -0
- package/dist/radio-group/radio-group-root.d.mts +4 -2
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +34 -8
- package/dist/radio-group/radio-group-root.mjs.map +1 -1
- package/dist/select/select-group.d.mts.map +1 -1
- package/dist/select/select-group.mjs +6 -4
- package/dist/select/select-group.mjs.map +1 -1
- package/dist/select/select-root.d.mts +4 -2
- package/dist/select/select-root.d.mts.map +1 -1
- package/dist/select/select-root.mjs +26 -6
- package/dist/select/select-root.mjs.map +1 -1
- package/dist/slider/index.d.mts +32 -0
- package/dist/slider/index.d.mts.map +1 -0
- package/dist/slider/index.mjs +27 -0
- package/dist/slider/index.mjs.map +1 -0
- package/dist/slider/slider-arithmetic.mjs +104 -0
- package/dist/slider/slider-arithmetic.mjs.map +1 -0
- package/dist/slider/slider-context.mjs +13 -0
- package/dist/slider/slider-context.mjs.map +1 -0
- package/dist/slider/slider-indicator.d.mts +22 -0
- package/dist/slider/slider-indicator.d.mts.map +1 -0
- package/dist/slider/slider-indicator.mjs +36 -0
- package/dist/slider/slider-indicator.mjs.map +1 -0
- package/dist/slider/slider-label.d.mts +23 -0
- package/dist/slider/slider-label.d.mts.map +1 -0
- package/dist/slider/slider-label.mjs +44 -0
- package/dist/slider/slider-label.mjs.map +1 -0
- package/dist/slider/slider-root.d.mts +111 -0
- package/dist/slider/slider-root.d.mts.map +1 -0
- package/dist/slider/slider-root.mjs +583 -0
- package/dist/slider/slider-root.mjs.map +1 -0
- package/dist/slider/slider-thumb.d.mts +58 -0
- package/dist/slider/slider-thumb.d.mts.map +1 -0
- package/dist/slider/slider-thumb.mjs +146 -0
- package/dist/slider/slider-thumb.mjs.map +1 -0
- package/dist/slider/slider-track.d.mts +29 -0
- package/dist/slider/slider-track.d.mts.map +1 -0
- package/dist/slider/slider-track.mjs +55 -0
- package/dist/slider/slider-track.mjs.map +1 -0
- package/dist/slider/slider-value.d.mts +34 -0
- package/dist/slider/slider-value.d.mts.map +1 -0
- package/dist/slider/slider-value.mjs +38 -0
- package/dist/slider/slider-value.mjs.map +1 -0
- package/dist/switch/switch.d.mts +5 -3
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +24 -8
- package/dist/switch/switch.mjs.map +1 -1
- package/dist/tabs/tabs-indicator.mjs +2 -1
- package/dist/tabs/tabs-indicator.mjs.map +1 -1
- package/dist/tabs/tabs-root.mjs +13 -3
- package/dist/tabs/tabs-root.mjs.map +1 -1
- package/dist/tabs/tabs-tab.mjs +2 -1
- package/dist/tabs/tabs-tab.mjs.map +1 -1
- package/dist/toast/index.d.mts +25 -0
- package/dist/toast/index.d.mts.map +1 -0
- package/dist/toast/index.mjs +26 -0
- package/dist/toast/index.mjs.map +1 -0
- package/dist/toast/toast-action.d.mts +39 -0
- package/dist/toast/toast-action.d.mts.map +1 -0
- package/dist/toast/toast-action.mjs +65 -0
- package/dist/toast/toast-action.mjs.map +1 -0
- package/dist/toast/toast-close.d.mts +25 -0
- package/dist/toast/toast-close.d.mts.map +1 -0
- package/dist/toast/toast-close.mjs +47 -0
- package/dist/toast/toast-close.mjs.map +1 -0
- package/dist/toast/toast-context.mjs +19 -0
- package/dist/toast/toast-context.mjs.map +1 -0
- package/dist/toast/toast-description.d.mts +24 -0
- package/dist/toast/toast-description.d.mts.map +1 -0
- package/dist/toast/toast-description.mjs +35 -0
- package/dist/toast/toast-description.mjs.map +1 -0
- package/dist/toast/toast-root.d.mts +43 -0
- package/dist/toast/toast-root.d.mts.map +1 -0
- package/dist/toast/toast-root.mjs +205 -0
- package/dist/toast/toast-root.mjs.map +1 -0
- package/dist/toast/toast-title.d.mts +24 -0
- package/dist/toast/toast-title.d.mts.map +1 -0
- package/dist/toast/toast-title.mjs +33 -0
- package/dist/toast/toast-title.mjs.map +1 -0
- package/dist/toast/toast-viewport.d.mts +52 -0
- package/dist/toast/toast-viewport.d.mts.map +1 -0
- package/dist/toast/toast-viewport.mjs +644 -0
- package/dist/toast/toast-viewport.mjs.map +1 -0
- package/dist/toast/toast.d.mts +119 -0
- package/dist/toast/toast.d.mts.map +1 -0
- package/dist/toast/toast.mjs +157 -0
- package/dist/toast/toast.mjs.map +1 -0
- package/dist/toggle/toggle.mjs +2 -1
- package/dist/toggle/toggle.mjs.map +1 -1
- package/dist/toggle-group/index.d.mts +16 -0
- package/dist/toggle-group/index.d.mts.map +1 -0
- package/dist/toggle-group/index.mjs +15 -0
- package/dist/toggle-group/index.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-context.d.mts +4 -0
- package/dist/toggle-group/toggle-group-context.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-context.mjs +13 -0
- package/dist/toggle-group/toggle-group-context.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-item.d.mts +47 -0
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-item.mjs +63 -0
- package/dist/toggle-group/toggle-group-item.mjs.map +1 -0
- package/dist/toggle-group/toggle-group-root.d.mts +95 -0
- package/dist/toggle-group/toggle-group-root.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-root.mjs +211 -0
- package/dist/toggle-group/toggle-group-root.mjs.map +1 -0
- package/dist/toolbar/index.d.mts +18 -0
- package/dist/toolbar/index.d.mts.map +1 -0
- package/dist/toolbar/index.mjs +18 -0
- package/dist/toolbar/index.mjs.map +1 -0
- package/dist/toolbar/toolbar-button.d.mts +42 -0
- package/dist/toolbar/toolbar-button.d.mts.map +1 -0
- package/dist/toolbar/toolbar-button.mjs +50 -0
- package/dist/toolbar/toolbar-button.mjs.map +1 -0
- package/dist/toolbar/toolbar-root.d.mts +38 -0
- package/dist/toolbar/toolbar-root.d.mts.map +1 -0
- package/dist/toolbar/toolbar-root.mjs +66 -0
- package/dist/toolbar/toolbar-root.mjs.map +1 -0
- package/dist/toolbar/toolbar-separator.d.mts +25 -0
- package/dist/toolbar/toolbar-separator.d.mts.map +1 -0
- package/dist/toolbar/toolbar-separator.mjs +31 -0
- package/dist/toolbar/toolbar-separator.mjs.map +1 -0
- package/dist/tooltip/tooltip-popup.mjs +2 -1
- package/dist/tooltip/tooltip-popup.mjs.map +1 -1
- package/dist/tooltip/tooltip-root.mjs +16 -2
- package/dist/tooltip/tooltip-root.mjs.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +2 -1
- package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
- package/package.json +10 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { useFieldContext } from "../internal/field-context.mjs";
|
|
4
|
+
import { useFieldControl, useMergedRef } from "../internal/use-field-control.mjs";
|
|
5
|
+
import { fieldDataAttributes } from "./field-root.mjs";
|
|
6
|
+
import { useCallback, useRef } from "react";
|
|
7
|
+
//#region src/field/field-control.tsx
|
|
8
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
9
|
+
const CONTROL_TAGS = /* @__PURE__ */ new Set([
|
|
10
|
+
"INPUT",
|
|
11
|
+
"TEXTAREA",
|
|
12
|
+
"SELECT"
|
|
13
|
+
]);
|
|
14
|
+
/**
|
|
15
|
+
* The field's native control: an `<input>` (or a `<textarea>` / `<select>` through `render`)
|
|
16
|
+
* wired to the Field: `id` for the Label, `aria-describedby` (the consumer's tokens, the
|
|
17
|
+
* description, the error while shown), an explicit `aria-invalid`, and `name` / `disabled` /
|
|
18
|
+
* `required` from the Field unless given. Everything else passes through, including `onChange`
|
|
19
|
+
* / `value` for a controlled input; the Field's listeners are native and run independently.
|
|
20
|
+
*
|
|
21
|
+
* Owned keys (conventions 1.2): `id`, `name`, `disabled`, `required`, `aria-invalid`,
|
|
22
|
+
* `aria-describedby` (token-merged), `data-invalid`, `data-disabled`, `data-required`,
|
|
23
|
+
* `data-pending`.
|
|
24
|
+
*/
|
|
25
|
+
function FieldControl({ name, disabled, required, className, style, render, ...rest }) {
|
|
26
|
+
const ctx = useFieldContext("Field.Control");
|
|
27
|
+
const { id: consumerId, ...props } = rest;
|
|
28
|
+
const field = useFieldControl({
|
|
29
|
+
labelable: true,
|
|
30
|
+
name,
|
|
31
|
+
disabled,
|
|
32
|
+
required,
|
|
33
|
+
id: consumerId,
|
|
34
|
+
component: "Field.Control"
|
|
35
|
+
});
|
|
36
|
+
const warned = useRef(false);
|
|
37
|
+
const checkElement = useCallback((el) => {
|
|
38
|
+
if (isDev && !warned.current && !CONTROL_TAGS.has(el.tagName)) {
|
|
39
|
+
warned.current = true;
|
|
40
|
+
console.error(`Field.Control: expected to render an <input>, <textarea> or <select> but got <${el.tagName.toLowerCase()}>. Validation, labelling and form participation need a native form control.`);
|
|
41
|
+
}
|
|
42
|
+
return () => {};
|
|
43
|
+
}, []);
|
|
44
|
+
const ref = useMergedRef(checkElement, field.ref);
|
|
45
|
+
return useRender({
|
|
46
|
+
defaultElement: "input",
|
|
47
|
+
render,
|
|
48
|
+
state: ctx.state,
|
|
49
|
+
className,
|
|
50
|
+
style,
|
|
51
|
+
children: void 0,
|
|
52
|
+
props,
|
|
53
|
+
libraryProps: {
|
|
54
|
+
id: field.id,
|
|
55
|
+
name: field.name,
|
|
56
|
+
disabled: field.disabled,
|
|
57
|
+
required: field.required,
|
|
58
|
+
...field.attributes,
|
|
59
|
+
...fieldDataAttributes(ctx.state)
|
|
60
|
+
},
|
|
61
|
+
ref
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
FieldControl.displayName = "FieldControl";
|
|
65
|
+
//#endregion
|
|
66
|
+
export { FieldControl };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=field-control.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-control.mjs","names":[],"sources":["../../src/field/field-control.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useFieldControl, useMergedRef } from \"../internal/use-field-control.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { fieldDataAttributes } from \"./field-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface FieldControlProps extends Omit<\n ComponentPropsWithRef<\"input\">,\n \"id\" | \"aria-invalid\" | \"className\" | \"style\" | \"children\"\n> {\n /** Native `name`; defaults to the Field's `name`. */\n name?: string;\n /** Native `disabled`; the Field's `disabled` also disables the control. Owned. */\n disabled?: boolean;\n /** Native `required`; the Field's `required` also requires the control. Owned. */\n required?: boolean;\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /** Must render an `<input>`, `<textarea>` or `<select>`: `render={<textarea rows={3} />}`. */\n render?: RenderProp<ComponentPropsWithRef<\"input\">, FieldState>;\n}\n\nconst CONTROL_TAGS = new Set([\"INPUT\", \"TEXTAREA\", \"SELECT\"]);\n\n/**\n * The field's native control: an `<input>` (or a `<textarea>` / `<select>` through `render`)\n * wired to the Field: `id` for the Label, `aria-describedby` (the consumer's tokens, the\n * description, the error while shown), an explicit `aria-invalid`, and `name` / `disabled` /\n * `required` from the Field unless given. Everything else passes through, including `onChange`\n * / `value` for a controlled input; the Field's listeners are native and run independently.\n *\n * Owned keys (conventions 1.2): `id`, `name`, `disabled`, `required`, `aria-invalid`,\n * `aria-describedby` (token-merged), `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n */\nexport function FieldControl({\n name,\n disabled,\n required,\n className,\n style,\n render,\n ...rest\n}: FieldControlProps) {\n const ctx = useFieldContext(\"Field.Control\");\n // `id` is not in the props type (the Field owns it); a JS caller's is ignored with a warning.\n const { id: consumerId, ...props } = rest as typeof rest & { id?: string };\n const field = useFieldControl({\n labelable: true,\n name,\n disabled,\n required,\n id: consumerId,\n component: \"Field.Control\",\n });\n const warned = useRef(false);\n const checkElement = useCallback((el: HTMLElement) => {\n if (isDev && !warned.current && !CONTROL_TAGS.has(el.tagName)) {\n warned.current = true;\n console.error(\n \"Field.Control: expected to render an <input>, <textarea> or <select> but got \" +\n `<${el.tagName.toLowerCase()}>. Validation, labelling and form participation need a ` +\n \"native form control.\",\n );\n }\n // A cleanup, so the merged ref never calls this with `null`.\n return () => {};\n }, []);\n const ref = useMergedRef<HTMLElement>(checkElement, field.ref);\n\n return useRender<ComponentPropsWithRef<\"input\">, FieldState>({\n defaultElement: \"input\",\n render,\n state: ctx.state,\n className,\n style,\n children: undefined,\n props,\n libraryProps: {\n id: field.id,\n name: field.name,\n disabled: field.disabled,\n required: field.required,\n ...field.attributes,\n ...fieldDataAttributes(ctx.state),\n },\n ref,\n });\n}\n\nFieldControl.displayName = \"FieldControl\";\n"],"mappings":";;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAkBvC,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAS;CAAY;AAAQ,CAAC;;;;;;;;;;;;AAa5D,SAAgB,aAAa,EAC3B,MACA,UACA,UACA,WACA,OACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,gBAAgB,eAAe;CAE3C,MAAM,EAAE,IAAI,YAAY,GAAG,UAAU;CACrC,MAAM,QAAQ,gBAAgB;EAC5B,WAAW;EACX;EACA;EACA;EACA,IAAI;EACJ,WAAW;CACb,CAAC;CACD,MAAM,SAAS,OAAO,KAAK;CAC3B,MAAM,eAAe,aAAa,OAAoB;EACpD,IAAI,SAAS,CAAC,OAAO,WAAW,CAAC,aAAa,IAAI,GAAG,OAAO,GAAG;GAC7D,OAAO,UAAU;GACjB,QAAQ,MACN,iFACM,GAAG,QAAQ,YAAY,EAAE,4EAEjC;EACF;EAEA,aAAa,CAAC;CAChB,GAAG,CAAC,CAAC;CACL,MAAM,MAAM,aAA0B,cAAc,MAAM,GAAG;CAE7D,OAAO,UAAsD;EAC3D,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA,UAAU,KAAA;EACV;EACA,cAAc;GACZ,IAAI,MAAM;GACV,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,GAAG,MAAM;GACT,GAAG,oBAAoB,IAAI,KAAK;EAClC;EACA;CACF,CAAC;AACH;AAEA,aAAa,cAAc"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { FieldState } from "../internal/field-context.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/field/field-description.d.ts
|
|
5
|
+
export interface FieldDescriptionProps extends Omit<ComponentPropsWithRef<"p">, "id" | "className" | "style" | "children"> {
|
|
6
|
+
className?: StateValue<string | undefined, FieldState>;
|
|
7
|
+
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
8
|
+
children?: StateValue<ReactNode, FieldState>;
|
|
9
|
+
render?: RenderProp<ComponentPropsWithRef<"p">, FieldState>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Help text for the field: a `<p>` whose id the control always lists in `aria-describedby`
|
|
13
|
+
* (a dangling reference when no Description is rendered is skipped by assistive technology, so
|
|
14
|
+
* nothing registers and the server HTML is exact).
|
|
15
|
+
*
|
|
16
|
+
* Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,
|
|
17
|
+
* `data-pending`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function FieldDescription({ className, style, children, render, ...rest }: FieldDescriptionProps): ReactNode;
|
|
20
|
+
export declare namespace FieldDescription {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//# sourceMappingURL=field-description.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-description.d.mts","names":[],"sources":["../../src/field/field-description.tsx"],"mappings":";;;;iBAQiB,8BAA8B,KAC7C;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,4BAA4B;;;;;;;;;;wBAWlC,mBACd,WACA,OACA,UACA,WACG,QACF,wBAAqB;yBANR"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { useFieldContext } from "../internal/field-context.mjs";
|
|
4
|
+
import { fieldDataAttributes } from "./field-root.mjs";
|
|
5
|
+
//#region src/field/field-description.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Help text for the field: a `<p>` whose id the control always lists in `aria-describedby`
|
|
8
|
+
* (a dangling reference when no Description is rendered is skipped by assistive technology, so
|
|
9
|
+
* nothing registers and the server HTML is exact).
|
|
10
|
+
*
|
|
11
|
+
* Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,
|
|
12
|
+
* `data-pending`.
|
|
13
|
+
*/
|
|
14
|
+
function FieldDescription({ className, style, children, render, ...rest }) {
|
|
15
|
+
const ctx = useFieldContext("Field.Description");
|
|
16
|
+
return useRender({
|
|
17
|
+
defaultElement: "p",
|
|
18
|
+
render,
|
|
19
|
+
state: ctx.state,
|
|
20
|
+
className,
|
|
21
|
+
style,
|
|
22
|
+
children,
|
|
23
|
+
props: rest,
|
|
24
|
+
libraryProps: {
|
|
25
|
+
id: ctx.ids.description,
|
|
26
|
+
...fieldDataAttributes(ctx.state)
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
FieldDescription.displayName = "FieldDescription";
|
|
31
|
+
//#endregion
|
|
32
|
+
export { FieldDescription };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=field-description.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-description.mjs","names":[],"sources":["../../src/field/field-description.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { fieldDataAttributes } from \"./field-root.js\";\n\nexport interface FieldDescriptionProps extends Omit<\n ComponentPropsWithRef<\"p\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n children?: StateValue<ReactNode, FieldState>;\n render?: RenderProp<ComponentPropsWithRef<\"p\">, FieldState>;\n}\n\n/**\n * Help text for the field: a `<p>` whose id the control always lists in `aria-describedby`\n * (a dangling reference when no Description is rendered is skipped by assistive technology, so\n * nothing registers and the server HTML is exact).\n *\n * Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n */\nexport function FieldDescription({\n className,\n style,\n children,\n render,\n ...rest\n}: FieldDescriptionProps) {\n const ctx = useFieldContext(\"Field.Description\");\n return useRender<ComponentPropsWithRef<\"p\">, FieldState>({\n defaultElement: \"p\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: { id: ctx.ids.description, ...fieldDataAttributes(ctx.state) },\n });\n}\n\nFieldDescription.displayName = \"FieldDescription\";\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAgB,iBAAiB,EAC/B,WACA,OACA,UACA,QACA,GAAG,QACqB;CACxB,MAAM,MAAM,gBAAgB,mBAAmB;CAC/C,OAAO,UAAkD;EACvD,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GAAE,IAAI,IAAI,IAAI;GAAa,GAAG,oBAAoB,IAAI,KAAK;EAAE;CAC7E,CAAC;AACH;AAEA,iBAAiB,cAAc"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { FieldState } from "../internal/field-context.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/field/field-error.d.ts
|
|
5
|
+
export interface FieldErrorProps extends Omit<ComponentPropsWithRef<"div">, "id" | "className" | "style" | "children"> {
|
|
6
|
+
className?: StateValue<string | undefined, FieldState>;
|
|
7
|
+
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
8
|
+
/**
|
|
9
|
+
* Rendered only while `state.invalid`. Default: `state.messages` joined by a space. A function
|
|
10
|
+
* gets the state: `({ validity, messages }) => validity.valueMissing ? "Enter your email" : messages.join(" ")`.
|
|
11
|
+
* Must not suspend (urgent render, design 2.4).
|
|
12
|
+
*/
|
|
13
|
+
children?: StateValue<ReactNode, FieldState>;
|
|
14
|
+
render?: RenderProp<ComponentPropsWithRef<"div">, FieldState>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The field's error message: a `div` rendered only while an error is shown, whose id the control
|
|
18
|
+
* then lists in `aria-describedby`. No role and no live region: the library focuses the first
|
|
19
|
+
* invalid control after a submission attempt, and focus reads the description (design 4.2).
|
|
20
|
+
* Its presence lets the Field cancel the platform's validation bubble.
|
|
21
|
+
*
|
|
22
|
+
* Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,
|
|
23
|
+
* `data-pending`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function FieldError({ className, style, children, render, ...rest }: FieldErrorProps): ReactNode;
|
|
26
|
+
export declare namespace FieldError {
|
|
27
|
+
var displayName: string;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//# sourceMappingURL=field-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-error.d.mts","names":[],"sources":["../../src/field/field-error.tsx"],"mappings":";;;;iBASiB,wBAAwB,KACvC;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;;;;;EAM9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;wBAgBpC,aACd,WACA,OACA,UACA,WACG,QACF,kBAAe;yBANF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { useFieldContext } from "../internal/field-context.mjs";
|
|
4
|
+
import { fieldDataAttributes } from "./field-root.mjs";
|
|
5
|
+
import { useLayoutEffect } from "react";
|
|
6
|
+
//#region src/field/field-error.tsx
|
|
7
|
+
function defaultChildren(state) {
|
|
8
|
+
return state.messages.join(" ");
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The field's error message: a `div` rendered only while an error is shown, whose id the control
|
|
12
|
+
* then lists in `aria-describedby`. No role and no live region: the library focuses the first
|
|
13
|
+
* invalid control after a submission attempt, and focus reads the description (design 4.2).
|
|
14
|
+
* Its presence lets the Field cancel the platform's validation bubble.
|
|
15
|
+
*
|
|
16
|
+
* Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,
|
|
17
|
+
* `data-pending`.
|
|
18
|
+
*/
|
|
19
|
+
function FieldError({ className, style, children = defaultChildren, render, ...rest }) {
|
|
20
|
+
const ctx = useFieldContext("Field.Error");
|
|
21
|
+
const { registerError } = ctx;
|
|
22
|
+
useLayoutEffect(registerError, [registerError]);
|
|
23
|
+
const element = useRender({
|
|
24
|
+
defaultElement: "div",
|
|
25
|
+
render,
|
|
26
|
+
state: ctx.state,
|
|
27
|
+
className,
|
|
28
|
+
style,
|
|
29
|
+
children,
|
|
30
|
+
props: rest,
|
|
31
|
+
libraryProps: {
|
|
32
|
+
id: ctx.ids.error,
|
|
33
|
+
...fieldDataAttributes(ctx.state)
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return ctx.state.invalid ? element : null;
|
|
37
|
+
}
|
|
38
|
+
FieldError.displayName = "FieldError";
|
|
39
|
+
//#endregion
|
|
40
|
+
export { FieldError };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=field-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-error.mjs","names":[],"sources":["../../src/field/field-error.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { fieldDataAttributes } from \"./field-root.js\";\n\nexport interface FieldErrorProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /**\n * Rendered only while `state.invalid`. Default: `state.messages` joined by a space. A function\n * gets the state: `({ validity, messages }) => validity.valueMissing ? \"Enter your email\" : messages.join(\" \")`.\n * Must not suspend (urgent render, design 2.4).\n */\n children?: StateValue<ReactNode, FieldState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, FieldState>;\n}\n\nfunction defaultChildren(state: FieldState): ReactNode {\n return state.messages.join(\" \");\n}\n\n/**\n * The field's error message: a `div` rendered only while an error is shown, whose id the control\n * then lists in `aria-describedby`. No role and no live region: the library focuses the first\n * invalid control after a submission attempt, and focus reads the description (design 4.2).\n * Its presence lets the Field cancel the platform's validation bubble.\n *\n * Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n */\nexport function FieldError({\n className,\n style,\n children = defaultChildren,\n render,\n ...rest\n}: FieldErrorProps) {\n const ctx = useFieldContext(\"Field.Error\");\n const { registerError } = ctx;\n useLayoutEffect(registerError, [registerError]);\n const element = useRender<ComponentPropsWithRef<\"div\">, FieldState>({\n defaultElement: \"div\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: { id: ctx.ids.error, ...fieldDataAttributes(ctx.state) },\n });\n return ctx.state.invalid ? element : null;\n}\n\nFieldError.displayName = \"FieldError\";\n"],"mappings":";;;;;;AAwBA,SAAS,gBAAgB,OAA8B;CACrD,OAAO,MAAM,SAAS,KAAK,GAAG;AAChC;;;;;;;;;;AAWA,SAAgB,WAAW,EACzB,WACA,OACA,WAAW,iBACX,QACA,GAAG,QACe;CAClB,MAAM,MAAM,gBAAgB,aAAa;CACzC,MAAM,EAAE,kBAAkB;CAC1B,gBAAgB,eAAe,CAAC,aAAa,CAAC;CAC9C,MAAM,UAAU,UAAoD;EAClE,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GAAE,IAAI,IAAI,IAAI;GAAO,GAAG,oBAAoB,IAAI,KAAK;EAAE;CACvE,CAAC;CACD,OAAO,IAAI,MAAM,UAAU,UAAU;AACvC;AAEA,WAAW,cAAc"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { FieldState } from "../internal/field-context.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/field/field-label.d.ts
|
|
5
|
+
export interface FieldLabelProps extends Omit<ComponentPropsWithRef<"label">, "htmlFor" | "id" | "className" | "style" | "children"> {
|
|
6
|
+
className?: StateValue<string | undefined, FieldState>;
|
|
7
|
+
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
8
|
+
children?: StateValue<ReactNode, FieldState>;
|
|
9
|
+
/** Must render a `<label>`. */
|
|
10
|
+
render?: RenderProp<ComponentPropsWithRef<"label">, FieldState>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The field's visible name: `<label for>` pointing at the control. For a group control (a
|
|
14
|
+
* RadioGroup or CheckboxGroup `<fieldset>`) it renders no `for` once the group registered, and
|
|
15
|
+
* the group names itself with `aria-labelledby` → this id (design 4.2).
|
|
16
|
+
*
|
|
17
|
+
* Owned keys (conventions 1.2): `id`, `htmlFor`, `data-invalid`, `data-disabled`,
|
|
18
|
+
* `data-required`, `data-pending`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function FieldLabel({ className, style, children, render, ...rest }: FieldLabelProps): ReactNode;
|
|
21
|
+
export declare namespace FieldLabel {
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//# sourceMappingURL=field-label.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-label.d.mts","names":[],"sources":["../../src/field/field-label.tsx"],"mappings":";;;;iBAWiB,wBAAwB,KACvC;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,gCAAgC;;;;;;;;;;wBAWtC,aAAa,WAAW,OAAO,UAAU,WAAW,QAAQ,kBAAe;yBAA3E"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { useFieldContext } from "../internal/field-context.mjs";
|
|
4
|
+
import { fieldDataAttributes } from "./field-root.mjs";
|
|
5
|
+
import { useCallback, useRef } from "react";
|
|
6
|
+
//#region src/field/field-label.tsx
|
|
7
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
8
|
+
/**
|
|
9
|
+
* The field's visible name: `<label for>` pointing at the control. For a group control (a
|
|
10
|
+
* RadioGroup or CheckboxGroup `<fieldset>`) it renders no `for` once the group registered, and
|
|
11
|
+
* the group names itself with `aria-labelledby` → this id (design 4.2).
|
|
12
|
+
*
|
|
13
|
+
* Owned keys (conventions 1.2): `id`, `htmlFor`, `data-invalid`, `data-disabled`,
|
|
14
|
+
* `data-required`, `data-pending`.
|
|
15
|
+
*/
|
|
16
|
+
function FieldLabel({ className, style, children, render, ...rest }) {
|
|
17
|
+
const ctx = useFieldContext("Field.Label");
|
|
18
|
+
const warned = useRef(false);
|
|
19
|
+
const ref = useCallback((el) => {
|
|
20
|
+
if (isDev && !warned.current && el.tagName !== "LABEL") {
|
|
21
|
+
warned.current = true;
|
|
22
|
+
console.error(`Field.Label: expected to render a <label> element but got <${el.tagName.toLowerCase()}>. Label activation and the control's accessible name need a real <label>.`);
|
|
23
|
+
}
|
|
24
|
+
return () => {};
|
|
25
|
+
}, []);
|
|
26
|
+
return useRender({
|
|
27
|
+
defaultElement: "label",
|
|
28
|
+
render,
|
|
29
|
+
state: ctx.state,
|
|
30
|
+
className,
|
|
31
|
+
style,
|
|
32
|
+
children,
|
|
33
|
+
props: rest,
|
|
34
|
+
libraryProps: {
|
|
35
|
+
id: ctx.ids.label,
|
|
36
|
+
htmlFor: ctx.labelable ? ctx.ids.control : void 0,
|
|
37
|
+
...fieldDataAttributes(ctx.state)
|
|
38
|
+
},
|
|
39
|
+
ref
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
FieldLabel.displayName = "FieldLabel";
|
|
43
|
+
//#endregion
|
|
44
|
+
export { FieldLabel };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=field-label.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-label.mjs","names":[],"sources":["../../src/field/field-label.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { fieldDataAttributes } from \"./field-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface FieldLabelProps extends Omit<\n ComponentPropsWithRef<\"label\">,\n \"htmlFor\" | \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n children?: StateValue<ReactNode, FieldState>;\n /** Must render a `<label>`. */\n render?: RenderProp<ComponentPropsWithRef<\"label\">, FieldState>;\n}\n\n/**\n * The field's visible name: `<label for>` pointing at the control. For a group control (a\n * RadioGroup or CheckboxGroup `<fieldset>`) it renders no `for` once the group registered, and\n * the group names itself with `aria-labelledby` → this id (design 4.2).\n *\n * Owned keys (conventions 1.2): `id`, `htmlFor`, `data-invalid`, `data-disabled`,\n * `data-required`, `data-pending`.\n */\nexport function FieldLabel({ className, style, children, render, ...rest }: FieldLabelProps) {\n const ctx = useFieldContext(\"Field.Label\");\n const warned = useRef(false);\n const ref = useCallback((el: HTMLElement) => {\n if (isDev && !warned.current && el.tagName !== \"LABEL\") {\n warned.current = true;\n console.error(\n `Field.Label: expected to render a <label> element but got <${el.tagName.toLowerCase()}>. ` +\n \"Label activation and the control's accessible name need a real <label>.\",\n );\n }\n // A cleanup, so the merged ref never calls this with `null`.\n return () => {};\n }, []);\n return useRender<ComponentPropsWithRef<\"label\">, FieldState>({\n defaultElement: \"label\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n id: ctx.ids.label,\n htmlFor: ctx.labelable ? ctx.ids.control : undefined,\n ...fieldDataAttributes(ctx.state),\n },\n ref,\n });\n}\n\nFieldLabel.displayName = \"FieldLabel\";\n"],"mappings":";;;;;;AASA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;AAqBvC,SAAgB,WAAW,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,QAAyB;CAC3F,MAAM,MAAM,gBAAgB,aAAa;CACzC,MAAM,SAAS,OAAO,KAAK;CAC3B,MAAM,MAAM,aAAa,OAAoB;EAC3C,IAAI,SAAS,CAAC,OAAO,WAAW,GAAG,YAAY,SAAS;GACtD,OAAO,UAAU;GACjB,QAAQ,MACN,8DAA8D,GAAG,QAAQ,YAAY,EAAE,2EAEzF;EACF;EAEA,aAAa,CAAC;CAChB,GAAG,CAAC,CAAC;CACL,OAAO,UAAsD;EAC3D,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,IAAI,IAAI,IAAI;GACZ,SAAS,IAAI,YAAY,IAAI,IAAI,UAAU,KAAA;GAC3C,GAAG,oBAAoB,IAAI,KAAK;EAClC;EACA;CACF,CAAC;AACH;AAEA,WAAW,cAAc"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { FieldErrorValue, FieldValidity } from "../internal/validity.mjs";
|
|
3
|
+
import { FieldState } from "../internal/field-context.mjs";
|
|
4
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
5
|
+
//#region src/field/field-root.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* A custom constraint: receives the field's submitted value (`formData.get(name)` as a string,
|
|
8
|
+
* `""` when absent) and the whole form's `FormData`. Return a message (or several) for an error,
|
|
9
|
+
* `null` / `undefined` / `""` for none.
|
|
10
|
+
*/
|
|
11
|
+
export type FieldValidate = (value: string, formData: FormData) => FieldErrorValue;
|
|
12
|
+
export interface FieldRootProps extends Omit<ComponentPropsWithRef<"div">, "className" | "style" | "children"> {
|
|
13
|
+
/** Form field name: the control's default `name`, the key in `Form.Root errors`, and the entry `validate` reads. */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** Disables the control (native `disabled`) and marks every part `data-disabled`. */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Makes the control `required` (native) and marks every part `data-required`. */
|
|
18
|
+
required?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* A custom constraint, written into the control with `setCustomValidity`. Sync. Receives the
|
|
21
|
+
* field's submitted value (`formData.get(name)` as a string, `""` when absent) and the whole
|
|
22
|
+
* form's `FormData`, so a cross-field rule can read the other field. Runs at mount, on every
|
|
23
|
+
* `input` / `change` in the form (and a FUNSTACK control's value change), on blur, after a
|
|
24
|
+
* reset, on a submission attempt, and in every commit in which this prop changed identity, so
|
|
25
|
+
* a rule that reads outside state (a list that loads, a sibling value in React state) updates
|
|
26
|
+
* on render. An inline function therefore re-runs on every render of the Field; wrap it in
|
|
27
|
+
* `useCallback` to re-run only when its inputs change. Return a string
|
|
28
|
+
* or strings for an error, `null` / `undefined` / `""` for none. Shown when the platform's
|
|
29
|
+
* `:user-invalid` heuristic says so, like a native constraint. Not serialisable: a Field with
|
|
30
|
+
* `validate` is rendered from a client component.
|
|
31
|
+
*/
|
|
32
|
+
validate?: FieldValidate;
|
|
33
|
+
className?: StateValue<string | undefined, FieldState>;
|
|
34
|
+
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
35
|
+
children?: StateValue<ReactNode, FieldState>;
|
|
36
|
+
render?: RenderProp<ComponentPropsWithRef<"div">, FieldState>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The field: a `div` that owns the ids, the urgent validity mirror, the custom-validity slot
|
|
40
|
+
* (`validate` and the server error), the control registration and the native listeners
|
|
41
|
+
* (design/components/field-form.md 2, 14). `data-pending` is the enclosing form's submission
|
|
42
|
+
* (`useFormStatus`), the one part that folds the form channel into its own state, because a
|
|
43
|
+
* Field has no action of its own.
|
|
44
|
+
*
|
|
45
|
+
* Owned keys (conventions 1.2): `data-invalid`, `data-disabled`, `data-required`, `data-pending`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function FieldRoot({ name, disabled, required, validate, className, style, children, render, ...rest }: FieldRootProps): import("react").JSX.Element;
|
|
48
|
+
export declare namespace FieldRoot {
|
|
49
|
+
var displayName: string;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export type { FieldState, FieldValidity };
|
|
53
|
+
//# sourceMappingURL=field-root.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-root.d.mts","names":[],"sources":["../../src/field/field-root.tsx"],"mappings":";;;;;;;;;;YAiDY,iBAAiB,eAAe,UAAU,aAAa;iBAElD,uBAAuB,KACtC;;EAIA;;EAEA;;EAEA;;;;;;;;;;;;;;EAcA,WAAW;EACX,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;wBA0CpC,YACd,MACA,UACA,UACA,UACA,WACA,OACA,UACA,WACG,QACF,iCAAc,IAAA;yBAVD"}
|