@funstack/ui 0.1.0-alpha.1 → 0.1.0-alpha.11
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 +20 -6
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.mjs +4 -5
- 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 +35 -16
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +6 -7
- package/dist/accordion/accordion-trigger.mjs.map +1 -1
- package/dist/button/button.d.mts +78 -0
- package/dist/button/button.d.mts.map +1 -0
- package/dist/button/button.mjs +77 -0
- package/dist/button/button.mjs.map +1 -0
- package/dist/button/index.d.mts +3 -0
- package/dist/button/index.mjs +1 -0
- package/dist/checkbox/checkbox.d.mts +5 -3
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +27 -11
- 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 +5 -3
- package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +2 -2
- 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 +25 -6
- package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
- package/dist/combobox/combobox-clear.d.mts +37 -0
- package/dist/combobox/combobox-clear.d.mts.map +1 -0
- package/dist/combobox/combobox-clear.mjs +64 -0
- package/dist/combobox/combobox-clear.mjs.map +1 -0
- package/dist/combobox/combobox-context.mjs +23 -0
- package/dist/combobox/combobox-context.mjs.map +1 -0
- package/dist/combobox/combobox-group.d.mts +72 -0
- package/dist/combobox/combobox-group.d.mts.map +1 -0
- package/dist/combobox/combobox-group.mjs +104 -0
- package/dist/combobox/combobox-group.mjs.map +1 -0
- package/dist/combobox/combobox-input.d.mts +42 -0
- package/dist/combobox/combobox-input.d.mts.map +1 -0
- package/dist/combobox/combobox-input.mjs +102 -0
- package/dist/combobox/combobox-input.mjs.map +1 -0
- package/dist/combobox/combobox-label.d.mts +22 -0
- package/dist/combobox/combobox-label.d.mts.map +1 -0
- package/dist/combobox/combobox-label.mjs +32 -0
- package/dist/combobox/combobox-label.mjs.map +1 -0
- package/dist/combobox/combobox-list.d.mts +37 -0
- package/dist/combobox/combobox-list.d.mts.map +1 -0
- package/dist/combobox/combobox-list.mjs +71 -0
- package/dist/combobox/combobox-list.mjs.map +1 -0
- package/dist/combobox/combobox-option.d.mts +45 -0
- package/dist/combobox/combobox-option.d.mts.map +1 -0
- package/dist/combobox/combobox-option.mjs +88 -0
- package/dist/combobox/combobox-option.mjs.map +1 -0
- package/dist/combobox/combobox-popup.d.mts +49 -0
- package/dist/combobox/combobox-popup.d.mts.map +1 -0
- package/dist/combobox/combobox-popup.mjs +91 -0
- package/dist/combobox/combobox-popup.mjs.map +1 -0
- package/dist/combobox/combobox-root.d.mts +136 -0
- package/dist/combobox/combobox-root.d.mts.map +1 -0
- package/dist/combobox/combobox-root.mjs +523 -0
- package/dist/combobox/combobox-root.mjs.map +1 -0
- package/dist/combobox/combobox-trigger.d.mts +40 -0
- package/dist/combobox/combobox-trigger.d.mts.map +1 -0
- package/dist/combobox/combobox-trigger.mjs +99 -0
- package/dist/combobox/combobox-trigger.mjs.map +1 -0
- package/dist/combobox/index.d.mts +36 -0
- package/dist/combobox/index.d.mts.map +1 -0
- package/dist/combobox/index.mjs +36 -0
- package/dist/combobox/index.mjs.map +1 -0
- package/dist/csp/csp-provider.d.mts +25 -0
- package/dist/csp/csp-provider.d.mts.map +1 -0
- package/dist/csp/csp-provider.mjs +24 -0
- package/dist/csp/csp-provider.mjs.map +1 -0
- package/dist/csp/index.d.mts +3 -0
- package/dist/csp/index.mjs +3 -0
- package/dist/csp/style-hashes.d.mts +19 -0
- package/dist/csp/style-hashes.d.mts.map +1 -0
- package/dist/csp/style-hashes.mjs +21 -0
- package/dist/csp/style-hashes.mjs.map +1 -0
- package/dist/dialog/dialog-close.d.mts +22 -10
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +41 -25
- 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 +118 -45
- 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 +68 -13
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +11 -5
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +16 -8
- 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 +34 -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 +79 -4
- package/dist/index.mjs +16 -1
- package/dist/internal/anchor-position.d.mts +11 -3
- package/dist/internal/anchor-position.d.mts.map +1 -1
- package/dist/internal/anchor-position.mjs +180 -6
- package/dist/internal/anchor-position.mjs.map +1 -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/csp-context.mjs +8 -0
- package/dist/internal/csp-context.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/platform-attributes.d.mts +12 -1
- package/dist/internal/platform-attributes.d.mts.map +1 -1
- package/dist/internal/range-value.mjs +51 -0
- package/dist/internal/range-value.mjs.map +1 -0
- package/dist/internal/render-element.mjs +67 -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/tooltip-warm.mjs +29 -0
- package/dist/internal/tooltip-warm.mjs.map +1 -0
- package/dist/internal/types.d.mts +11 -1
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-action-trigger.mjs +17 -6
- package/dist/internal/use-action-trigger.mjs.map +1 -1
- package/dist/internal/use-controllable-action.mjs +35 -13
- 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 +12 -31
- package/dist/internal/use-form-reset.mjs.map +1 -1
- package/dist/internal/use-hydrated-mount.mjs +21 -0
- package/dist/internal/use-hydrated-mount.mjs.map +1 -0
- 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 +184 -0
- package/dist/internal/use-native-select-value.mjs.map +1 -0
- package/dist/internal/use-popover-popup.mjs +33 -28
- package/dist/internal/use-popover-popup.mjs.map +1 -1
- package/dist/internal/use-popover-root.mjs +59 -24
- package/dist/internal/use-popover-root.mjs.map +1 -1
- package/dist/internal/use-popover-trigger.mjs +6 -5
- package/dist/internal/use-popover-trigger.mjs.map +1 -1
- package/dist/internal/use-render.mjs +12 -35
- package/dist/internal/use-render.mjs.map +1 -1
- package/dist/internal/use-resolved-placement.mjs +146 -0
- package/dist/internal/use-resolved-placement.mjs.map +1 -0
- package/dist/internal/use-roving-focus.mjs +301 -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/index.d.mts +5 -1
- package/dist/menu/index.d.mts.map +1 -1
- package/dist/menu/index.mjs +5 -1
- package/dist/menu/index.mjs.map +1 -1
- package/dist/menu/menu-checkbox-item.mjs +2 -1
- package/dist/menu/menu-checkbox-item.mjs.map +1 -1
- package/dist/menu/menu-context-trigger.d.mts +46 -0
- package/dist/menu/menu-context-trigger.d.mts.map +1 -0
- package/dist/menu/menu-context-trigger.mjs +405 -0
- package/dist/menu/menu-context-trigger.mjs.map +1 -0
- package/dist/menu/menu-context.mjs +44 -1
- package/dist/menu/menu-context.mjs.map +1 -1
- package/dist/menu/menu-dom.mjs +49 -3
- package/dist/menu/menu-dom.mjs.map +1 -1
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +4 -3
- package/dist/menu/menu-group.mjs.map +1 -1
- package/dist/menu/menu-item.d.mts +6 -2
- package/dist/menu/menu-item.d.mts.map +1 -1
- package/dist/menu/menu-item.mjs +7 -4
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-popup.d.mts +36 -8
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +219 -22
- package/dist/menu/menu-popup.mjs.map +1 -1
- package/dist/menu/menu-radio-group.mjs +10 -5
- 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.d.mts +5 -0
- package/dist/menu/menu-root.d.mts.map +1 -1
- package/dist/menu/menu-root.mjs +57 -7
- package/dist/menu/menu-root.mjs.map +1 -1
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +28 -12
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +8 -4
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +18 -7
- 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 +17 -0
- package/dist/number-field/number-field-decrement.d.mts.map +1 -0
- package/dist/number-field/number-field-decrement.mjs +20 -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 +37 -0
- package/dist/number-field/number-field-increment.d.mts.map +1 -0
- package/dist/number-field/number-field-increment.mjs +71 -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 +112 -0
- package/dist/number-field/use-step-button.mjs.map +1 -0
- package/dist/popover/popover-close.d.mts +9 -3
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +13 -7
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-popup.d.mts +21 -7
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +23 -8
- package/dist/popover/popover-popup.mjs.map +1 -1
- package/dist/popover/popover-root.mjs +1 -1
- package/dist/popover/popover-trigger.d.mts +8 -4
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +3 -3
- package/dist/popover/popover-trigger.mjs.map +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-item.mjs +2 -2
- 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 +35 -9
- package/dist/radio-group/radio-group-root.mjs.map +1 -1
- package/dist/select/index.d.mts +30 -0
- package/dist/select/index.d.mts.map +1 -0
- package/dist/select/index.mjs +30 -0
- package/dist/select/index.mjs.map +1 -0
- package/dist/select/select-context.mjs +13 -0
- package/dist/select/select-context.mjs.map +1 -0
- package/dist/select/select-dom.mjs +44 -0
- package/dist/select/select-dom.mjs.map +1 -0
- package/dist/select/select-group-label.d.mts +22 -0
- package/dist/select/select-group-label.d.mts.map +1 -0
- package/dist/select/select-group-label.mjs +39 -0
- package/dist/select/select-group-label.mjs.map +1 -0
- package/dist/select/select-group.d.mts +28 -0
- package/dist/select/select-group.d.mts.map +1 -0
- package/dist/select/select-group.mjs +47 -0
- package/dist/select/select-group.mjs.map +1 -0
- package/dist/select/select-option.d.mts +42 -0
- package/dist/select/select-option.d.mts.map +1 -0
- package/dist/select/select-option.mjs +65 -0
- package/dist/select/select-option.mjs.map +1 -0
- package/dist/select/select-root.d.mts +68 -0
- package/dist/select/select-root.d.mts.map +1 -0
- package/dist/select/select-root.mjs +114 -0
- package/dist/select/select-root.mjs.map +1 -0
- package/dist/select/select-separator.d.mts +20 -0
- package/dist/select/select-separator.d.mts.map +1 -0
- package/dist/select/select-separator.mjs +30 -0
- package/dist/select/select-separator.mjs.map +1 -0
- package/dist/select/select-trigger.d.mts +29 -0
- package/dist/select/select-trigger.d.mts.map +1 -0
- package/dist/select/select-trigger.mjs +48 -0
- package/dist/select/select-trigger.mjs.map +1 -0
- package/dist/select/select-value.d.mts +31 -0
- package/dist/select/select-value.d.mts.map +1 -0
- package/dist/select/select-value.mjs +101 -0
- package/dist/select/select-value.mjs.map +1 -0
- 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 +26 -10
- 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-list.mjs +1 -1
- package/dist/tabs/tabs-panel.mjs +1 -1
- package/dist/tabs/tabs-root.mjs +15 -5
- package/dist/tabs/tabs-root.mjs.map +1 -1
- package/dist/tabs/tabs-tab.mjs +3 -2
- 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 +40 -0
- package/dist/toast/toast-action.d.mts.map +1 -0
- package/dist/toast/toast-action.mjs +67 -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.d.mts +4 -1
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +16 -9
- 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 +51 -0
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -0
- package/dist/toggle-group/toggle-group-item.mjs +68 -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 +17 -0
- package/dist/toolbar/index.d.mts.map +1 -0
- package/dist/toolbar/index.mjs +17 -0
- package/dist/toolbar/index.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/index.d.mts +8 -5
- package/dist/tooltip/index.d.mts.map +1 -1
- package/dist/tooltip/index.mjs +6 -3
- package/dist/tooltip/index.mjs.map +1 -1
- package/dist/tooltip/tooltip-arrow.d.mts +30 -0
- package/dist/tooltip/tooltip-arrow.d.mts.map +1 -0
- package/dist/tooltip/tooltip-arrow.mjs +45 -0
- package/dist/tooltip/tooltip-arrow.mjs.map +1 -0
- package/dist/tooltip/tooltip-context.d.mts +7 -0
- package/dist/tooltip/tooltip-context.d.mts.map +1 -1
- package/dist/tooltip/tooltip-context.mjs +2 -1
- package/dist/tooltip/tooltip-context.mjs.map +1 -1
- package/dist/tooltip/tooltip-popup.d.mts +27 -6
- package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
- package/dist/tooltip/tooltip-popup.mjs +36 -7
- package/dist/tooltip/tooltip-popup.mjs.map +1 -1
- package/dist/tooltip/tooltip-root.mjs +18 -2
- package/dist/tooltip/tooltip-root.mjs.map +1 -1
- package/dist/tooltip/tooltip-trigger.d.mts +9 -2
- package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +23 -6
- package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
- package/dist/tooltip/use-tooltip-interaction.mjs +126 -76
- package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
- package/package.json +14 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createActionDetails } from "../internal/action-details.mjs";
|
|
3
|
+
import { dataAttr } from "../internal/data-attr.mjs";
|
|
4
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
5
|
+
import { transitionTypes } from "../internal/transition-types.mjs";
|
|
6
|
+
import { useControllableAction } from "../internal/use-controllable-action.mjs";
|
|
7
|
+
import { fieldInputProps, useFieldControl, useFieldValueChange, useMergedRef } from "../internal/use-field-control.mjs";
|
|
8
|
+
import { SelectContext } from "./select-context.mjs";
|
|
9
|
+
import { useSelectPartRef } from "./select-dom.mjs";
|
|
10
|
+
import { useNativeSelectValue } from "../internal/use-native-select-value.mjs";
|
|
11
|
+
import { useMemo, useRef, useState } from "react";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
//#region src/select/select-root.tsx
|
|
14
|
+
/**
|
|
15
|
+
* The `<select>` itself: owns the value, the transition, the form-reset listener, the mount
|
|
16
|
+
* reconciliation and the re-apply of late options (design/components/select.md 15.2). Renders
|
|
17
|
+
* `value={optimistic}`: react-dom restores a controlled select to its props after every event,
|
|
18
|
+
* and only the sync-lane optimistic value survives that restore.
|
|
19
|
+
*
|
|
20
|
+
* Owned keys (conventions 1.2): `value`, `disabled`, `data-pending`, `data-disabled`, `onChange`;
|
|
21
|
+
* inside a `Field.Root` also `id`, `name`, `required`, `aria-invalid`, `aria-describedby`
|
|
22
|
+
* (token-merged) and `data-invalid`, and `disabled` / `name` / `required` default from the Field.
|
|
23
|
+
*/
|
|
24
|
+
function SelectRoot({ value, defaultValue, valueChangeAction, disabled: disabledProp, className, style, children, render, ...rest }) {
|
|
25
|
+
const { ref: libraryRef, node: selectRef } = useSelectPartRef("Select.Root", "select");
|
|
26
|
+
const field = useFieldControl({
|
|
27
|
+
labelable: true,
|
|
28
|
+
name: rest.name,
|
|
29
|
+
disabled: disabledProp,
|
|
30
|
+
required: rest.required,
|
|
31
|
+
id: rest.id,
|
|
32
|
+
component: "Select.Root"
|
|
33
|
+
});
|
|
34
|
+
const disabled = field.disabled;
|
|
35
|
+
const rootRef = useMergedRef(libraryRef, field.ref);
|
|
36
|
+
const { optimistic, pending, dispatch, latestInFlight, adopt } = useControllableAction({
|
|
37
|
+
controlled: value,
|
|
38
|
+
defaultValue,
|
|
39
|
+
initialValue: "",
|
|
40
|
+
action: valueChangeAction,
|
|
41
|
+
transitionTypes: () => transitionTypes("select"),
|
|
42
|
+
warn: {
|
|
43
|
+
component: "Select.Root",
|
|
44
|
+
prop: "value"
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
useFieldValueChange(optimistic);
|
|
48
|
+
const [mountValue] = useState(value);
|
|
49
|
+
const resetTarget = value === void 0 ? defaultValue : mountValue ?? value;
|
|
50
|
+
const established = useRef(false);
|
|
51
|
+
const dispatchChange = (next, details) => {
|
|
52
|
+
established.current = true;
|
|
53
|
+
dispatch(next, details);
|
|
54
|
+
};
|
|
55
|
+
const { optionMounted } = useNativeSelectValue({
|
|
56
|
+
ref: selectRef,
|
|
57
|
+
optimistic,
|
|
58
|
+
latestInFlight,
|
|
59
|
+
resetTarget,
|
|
60
|
+
adoptDefault: value === void 0 && defaultValue === void 0 ? {
|
|
61
|
+
adopt,
|
|
62
|
+
established: () => established.current
|
|
63
|
+
} : void 0,
|
|
64
|
+
onPlatformChange: (next, event) => dispatchChange(next, createActionDetails(event, { reason: "platform" }))
|
|
65
|
+
});
|
|
66
|
+
const context = useMemo(() => ({
|
|
67
|
+
optimistic,
|
|
68
|
+
pending,
|
|
69
|
+
disabled,
|
|
70
|
+
groupDisabled: false,
|
|
71
|
+
optionMounted
|
|
72
|
+
}), [
|
|
73
|
+
optimistic,
|
|
74
|
+
pending,
|
|
75
|
+
disabled,
|
|
76
|
+
optionMounted
|
|
77
|
+
]);
|
|
78
|
+
const element = useRender({
|
|
79
|
+
defaultElement: "select",
|
|
80
|
+
render,
|
|
81
|
+
state: {
|
|
82
|
+
value: optimistic,
|
|
83
|
+
pending,
|
|
84
|
+
disabled
|
|
85
|
+
},
|
|
86
|
+
className,
|
|
87
|
+
style,
|
|
88
|
+
children,
|
|
89
|
+
props: rest,
|
|
90
|
+
libraryProps: {
|
|
91
|
+
...fieldInputProps(field),
|
|
92
|
+
value: optimistic,
|
|
93
|
+
disabled,
|
|
94
|
+
"data-pending": dataAttr(pending),
|
|
95
|
+
"data-disabled": dataAttr(disabled),
|
|
96
|
+
onChange: (event) => {
|
|
97
|
+
if (disabled) return;
|
|
98
|
+
const next = event.currentTarget.value;
|
|
99
|
+
if (next === optimistic) return;
|
|
100
|
+
dispatchChange(next, createActionDetails(event.nativeEvent, { reason: "activate" }));
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
ref: rootRef
|
|
104
|
+
});
|
|
105
|
+
return /* @__PURE__ */ jsx(SelectContext, {
|
|
106
|
+
value: context,
|
|
107
|
+
children: element
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
SelectRoot.displayName = "SelectRoot";
|
|
111
|
+
//#endregion
|
|
112
|
+
export { SelectRoot };
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=select-root.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-root.mjs","names":[],"sources":["../../src/select/select-root.tsx"],"sourcesContent":["\"use client\";\nimport { useMemo, useRef, useState } from \"react\";\nimport type { ChangeEvent, ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.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 { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useNativeSelectValue } from \"../internal/use-native-select-value.js\";\nimport {\n fieldInputProps,\n useFieldControl,\n useFieldValueChange,\n useMergedRef,\n} from \"../internal/use-field-control.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { SelectContext } from \"./select-context.js\";\nimport type { SelectContextValue } from \"./select-context.js\";\nimport { useSelectPartRef } from \"./select-dom.js\";\n\n/** Details passed as the second argument of `valueChangeAction`. */\nexport interface SelectValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user picked an option (pointer, keyboard, typeahead, or browser autofill,\n * which the library cannot tell from a pick); `details.event` is the native `change` event.\n * `\"platform\"`: the browser changed the value without a pick the library saw: a form reset\n * (`details.event` is the `reset` event), or a pick before hydration / Firefox form-state\n * restoration reconciled at mount (`details.event` is `undefined`).\n */\n readonly reason: ChangeReason;\n}\n\nexport interface SelectRootState {\n /** Optimistic value. Content rendered from it must not suspend. */\n readonly value: string;\n /** An action dispatched through this Select is in flight. */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\nexport interface SelectRootProps extends Omit<\n ComponentPropsWithRef<\"select\">,\n | \"value\"\n | \"defaultValue\"\n | \"onChange\"\n | \"multiple\"\n | \"size\"\n | \"disabled\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /** Controlled value. `undefined` means uncontrolled. Use `\"\"` for the placeholder option. */\n value?: string;\n /**\n * Initial value in uncontrolled mode, and the value a form reset returns to (the latest prop is\n * mirrored into the options' `defaultSelected`). When omitted, the browser's choice (an option\n * whose value is `\"\"`, else the first enabled option) is adopted at mount, without a dispatch,\n * and is what a form reset returns to. Until a pick (or a platform change) sets the value,\n * options that mount later without the adopted one (a Suspense fallback) adopt again.\n */\n defaultValue?: string;\n /**\n * Runs inside the Root's transition whenever the selected option changes. May be sync or async\n * (also a Server Function); rejections reach the nearest Error Boundary and roll the selection\n * back.\n *\n * In engines whose closed select changes the value on every arrow press (Firefox, Safari with\n * native appearance), every press dispatches; the latest dispatch wins. A `setState` placed\n * after your own `await` is not a Transition update; wrap it in `startTransition` (React\n * limitation). Controlled mode is the way to veto a change.\n */\n valueChangeAction?: ChangeAction<string, SelectValueChangeDetails>;\n /** Native `disabled`. Never set by the library while pending. */\n disabled?: boolean;\n className?: StateValue<string | undefined, SelectRootState>;\n style?: StateValue<CSSProperties | undefined, SelectRootState>;\n children?: StateValue<ReactNode, SelectRootState>;\n /** Replace the rendered element. Must keep a `<select>`. */\n render?: RenderProp<ComponentPropsWithRef<\"select\">, SelectRootState>;\n}\n\n/**\n * The `<select>` itself: owns the value, the transition, the form-reset listener, the mount\n * reconciliation and the re-apply of late options (design/components/select.md 15.2). Renders\n * `value={optimistic}`: react-dom restores a controlled select to its props after every event,\n * and only the sync-lane optimistic value survives that restore.\n *\n * Owned keys (conventions 1.2): `value`, `disabled`, `data-pending`, `data-disabled`, `onChange`;\n * inside a `Field.Root` also `id`, `name`, `required`, `aria-invalid`, `aria-describedby`\n * (token-merged) and `data-invalid`, and `disabled` / `name` / `required` default from the Field.\n */\nexport function SelectRoot({\n value,\n defaultValue,\n valueChangeAction,\n disabled: disabledProp,\n className,\n style,\n children,\n render,\n ...rest\n}: SelectRootProps) {\n const { ref: libraryRef, node: selectRef } = useSelectPartRef<HTMLSelectElement>(\n \"Select.Root\",\n \"select\",\n );\n // Inside a Field.Root (design/components/field-form.md 7.2) the Field owns the id and the ARIA\n // wiring, and `name` / `required` / `disabled` default from it.\n const field = useFieldControl({\n labelable: true,\n name: rest.name,\n disabled: disabledProp,\n required: rest.required,\n id: rest.id,\n component: \"Select.Root\",\n });\n const disabled = field.disabled;\n const rootRef = useMergedRef<HTMLSelectElement>(libraryRef, field.ref);\n\n const { optimistic, pending, dispatch, latestInFlight, adopt } = useControllableAction<\n string,\n SelectValueChangeDetails\n >({\n controlled: value,\n defaultValue,\n initialValue: \"\",\n action: valueChangeAction,\n transitionTypes: () => transitionTypes(\"select\"),\n warn: { component: \"Select.Root\", prop: \"value\" },\n });\n // Inside a Field: a value React writes with no event (a rejected action rolling back, a\n // controlled change) re-reads validity and `validate` after the commit.\n useFieldValueChange(optimistic);\n // Deliberately no warning when neither `value` nor `defaultValue` is given: the browser's\n // first-option default is adopted (design decision 3, product-owner decision 4).\n\n // Controlled: the mount-time value is the reset target (conventions 3.8 rule 6). Neither\n // `value` nor `defaultValue`: the value adopted at mount, chosen inside the hook.\n const [mountValue] = useState(value);\n const resetTarget = value === undefined ? defaultValue : (mountValue ?? value);\n\n // Any dispatch, a pick or a platform change, ends the adoption of the browser's default.\n const established = useRef(false);\n const dispatchChange = (next: string, details: SelectValueChangeDetails) => {\n established.current = true;\n dispatch(next, details);\n };\n\n const { optionMounted } = useNativeSelectValue({\n ref: selectRef,\n optimistic,\n latestInFlight,\n resetTarget,\n adoptDefault:\n value === undefined && defaultValue === undefined\n ? { adopt, established: () => established.current }\n : undefined,\n onPlatformChange: (next, event) =>\n dispatchChange(next, createActionDetails(event, { reason: \"platform\" })),\n });\n\n // Memoised (#48): every member is a state value, a prop or a stable callback.\n const context = useMemo<SelectContextValue>(\n () => ({ optimistic, pending, disabled, groupDisabled: false, optionMounted }),\n [optimistic, pending, disabled, optionMounted],\n );\n const state: SelectRootState = { value: optimistic, pending, disabled };\n\n const element = useRender<ComponentPropsWithRef<\"select\">, SelectRootState>({\n defaultElement: \"select\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n ...fieldInputProps(field),\n value: optimistic,\n disabled,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n onChange: (event: ChangeEvent<HTMLSelectElement>) => {\n // A natively disabled select fires no change; this covers `render` elements.\n if (disabled) return;\n const next = event.currentTarget.value;\n // No-op rule against the optimistic value (conventions 2.3, design 4.2).\n if (next === optimistic) return;\n dispatchChange(next, createActionDetails(event.nativeEvent, { reason: \"activate\" }));\n },\n },\n ref: rootRef,\n });\n\n return <SelectContext value={context}>{element}</SelectContext>;\n}\n\nSelectRoot.displayName = \"SelectRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmGA,SAAgB,WAAW,EACzB,OACA,cACA,mBACA,UAAU,cACV,WACA,OACA,UACA,QACA,GAAG,QACe;CAClB,MAAM,EAAE,KAAK,YAAY,MAAM,cAAc,iBAC3C,eACA,QACF;CAGA,MAAM,QAAQ,gBAAgB;EAC5B,WAAW;EACX,MAAM,KAAK;EACX,UAAU;EACV,UAAU,KAAK;EACf,IAAI,KAAK;EACT,WAAW;CACb,CAAC;CACD,MAAM,WAAW,MAAM;CACvB,MAAM,UAAU,aAAgC,YAAY,MAAM,GAAG;CAErE,MAAM,EAAE,YAAY,SAAS,UAAU,gBAAgB,UAAU,sBAG/D;EACA,YAAY;EACZ;EACA,cAAc;EACd,QAAQ;EACR,uBAAuB,gBAAgB,QAAQ;EAC/C,MAAM;GAAE,WAAW;GAAe,MAAM;EAAQ;CAClD,CAAC;CAGD,oBAAoB,UAAU;CAM9B,MAAM,CAAC,cAAc,SAAS,KAAK;CACnC,MAAM,cAAc,UAAU,KAAA,IAAY,eAAgB,cAAc;CAGxE,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,kBAAkB,MAAc,YAAsC;EAC1E,YAAY,UAAU;EACtB,SAAS,MAAM,OAAO;CACxB;CAEA,MAAM,EAAE,kBAAkB,qBAAqB;EAC7C,KAAK;EACL;EACA;EACA;EACA,cACE,UAAU,KAAA,KAAa,iBAAiB,KAAA,IACpC;GAAE;GAAO,mBAAmB,YAAY;EAAQ,IAChD,KAAA;EACN,mBAAmB,MAAM,UACvB,eAAe,MAAM,oBAAoB,OAAO,EAAE,QAAQ,WAAW,CAAC,CAAC;CAC3E,CAAC;CAGD,MAAM,UAAU,eACP;EAAE;EAAY;EAAS;EAAU,eAAe;EAAO;CAAc,IAC5E;EAAC;EAAY;EAAS;EAAU;CAAa,CAC/C;CAGA,MAAM,UAAU,UAA4D;EAC1E,gBAAgB;EAChB;EACA,OAAA;GAL+B,OAAO;GAAY;GAAS;EAKvD;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,GAAG,gBAAgB,KAAK;GACxB,OAAO;GACP;GACA,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;GAClC,WAAW,UAA0C;IAEnD,IAAI,UAAU;IACd,MAAM,OAAO,MAAM,cAAc;IAEjC,IAAI,SAAS,YAAY;IACzB,eAAe,MAAM,oBAAoB,MAAM,aAAa,EAAE,QAAQ,WAAW,CAAC,CAAC;GACrF;EACF;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,eAAD;EAAe,OAAO;EAAU,UAAA;CAAuB,CAAA;AAChE;AAEA,WAAW,cAAc"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { SelectRootState } from "./select-root.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef } from "react";
|
|
4
|
+
//#region src/select/select-separator.d.ts
|
|
5
|
+
export interface SelectSeparatorProps extends Omit<ComponentPropsWithRef<"hr">, "className" | "style" | "children"> {
|
|
6
|
+
className?: StateValue<string | undefined, SelectRootState>;
|
|
7
|
+
style?: StateValue<CSSProperties | undefined, SelectRootState>;
|
|
8
|
+
/** Replace the rendered element. */
|
|
9
|
+
render?: RenderProp<ComponentPropsWithRef<"hr">, SelectRootState>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A decorative `<hr>` between options or groups (exposed as `separator` by Chromium's
|
|
13
|
+
* customizable select; a line in native pickers). Owns no keys.
|
|
14
|
+
*/
|
|
15
|
+
export declare function SelectSeparator({ className, style, render, ...rest }: SelectSeparatorProps): import("react").ReactNode;
|
|
16
|
+
export declare namespace SelectSeparator {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//# sourceMappingURL=select-separator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-separator.d.mts","names":[],"sources":["../../src/select/select-separator.tsx"],"mappings":";;;;iBAOiB,6BAA6B,KAC5C;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,SAAS,WAAW,6BAA6B;;;;;;wBAOnC,kBAAkB,WAAW,OAAO,WAAW,QAAQ,uCAAoB;yBAA3E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { useSelectContext } from "./select-context.mjs";
|
|
4
|
+
//#region src/select/select-separator.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A decorative `<hr>` between options or groups (exposed as `separator` by Chromium's
|
|
7
|
+
* customizable select; a line in native pickers). Owns no keys.
|
|
8
|
+
*/
|
|
9
|
+
function SelectSeparator({ className, style, render, ...rest }) {
|
|
10
|
+
const ctx = useSelectContext("Select.Separator");
|
|
11
|
+
const state = {
|
|
12
|
+
value: ctx.optimistic,
|
|
13
|
+
pending: ctx.pending,
|
|
14
|
+
disabled: ctx.disabled
|
|
15
|
+
};
|
|
16
|
+
return useRender({
|
|
17
|
+
defaultElement: "hr",
|
|
18
|
+
render,
|
|
19
|
+
state,
|
|
20
|
+
className,
|
|
21
|
+
style,
|
|
22
|
+
children: void 0,
|
|
23
|
+
props: rest
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
SelectSeparator.displayName = "SelectSeparator";
|
|
27
|
+
//#endregion
|
|
28
|
+
export { SelectSeparator };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=select-separator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-separator.mjs","names":[],"sources":["../../src/select/select-separator.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useSelectContext } from \"./select-context.js\";\nimport type { SelectRootState } from \"./select-root.js\";\n\nexport interface SelectSeparatorProps extends Omit<\n ComponentPropsWithRef<\"hr\">,\n \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, SelectRootState>;\n style?: StateValue<CSSProperties | undefined, SelectRootState>;\n /** Replace the rendered element. */\n render?: RenderProp<ComponentPropsWithRef<\"hr\">, SelectRootState>;\n}\n\n/**\n * A decorative `<hr>` between options or groups (exposed as `separator` by Chromium's\n * customizable select; a line in native pickers). Owns no keys.\n */\nexport function SelectSeparator({ className, style, render, ...rest }: SelectSeparatorProps) {\n const ctx = useSelectContext(\"Select.Separator\");\n const state: SelectRootState = {\n value: ctx.optimistic,\n pending: ctx.pending,\n disabled: ctx.disabled,\n };\n return useRender<ComponentPropsWithRef<\"hr\">, SelectRootState>({\n defaultElement: \"hr\",\n render,\n state,\n className,\n style,\n children: undefined,\n props: rest,\n });\n}\n\nSelectSeparator.displayName = \"SelectSeparator\";\n"],"mappings":";;;;;;;;AAqBA,SAAgB,gBAAgB,EAAE,WAAW,OAAO,QAAQ,GAAG,QAA8B;CAC3F,MAAM,MAAM,iBAAiB,kBAAkB;CAC/C,MAAM,QAAyB;EAC7B,OAAO,IAAI;EACX,SAAS,IAAI;EACb,UAAU,IAAI;CAChB;CACA,OAAO,UAAwD;EAC7D,gBAAgB;EAChB;EACA;EACA;EACA;EACA,UAAU,KAAA;EACV,OAAO;CACT,CAAC;AACH;AAEA,gBAAgB,cAAc"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { SelectRootState } from "./select-root.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/select/select-trigger.d.ts
|
|
5
|
+
export interface SelectTriggerProps extends Omit<ComponentPropsWithRef<"button">, "type" | "className" | "style" | "children"> {
|
|
6
|
+
className?: StateValue<string | undefined, SelectRootState>;
|
|
7
|
+
style?: StateValue<CSSProperties | undefined, SelectRootState>;
|
|
8
|
+
/**
|
|
9
|
+
* Non-interactive content only (HTML content model of a select's button), usually
|
|
10
|
+
* `<Select.Value />`. Not rendered by engines without customizable select (Firefox today).
|
|
11
|
+
*/
|
|
12
|
+
children?: StateValue<ReactNode, SelectRootState>;
|
|
13
|
+
/** Replace the rendered element. Must keep a `<button>`. */
|
|
14
|
+
render?: RenderProp<ComponentPropsWithRef<"button">, SelectRootState>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The select's own `<button>` (customizable select): replaces the UA button in engines with
|
|
18
|
+
* `appearance: base-select`. Optional; **must be the first child** of `Select.Root`. Its state is
|
|
19
|
+
* the Root's state, so a pending indicator next to `<Select.Value />` goes in its function
|
|
20
|
+
* `children`.
|
|
21
|
+
*
|
|
22
|
+
* Owned keys: `type` (always `"button"`), `data-pending`, `data-disabled`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function SelectTrigger({ className, style, children, render, ...rest }: SelectTriggerProps): ReactNode;
|
|
25
|
+
export declare namespace SelectTrigger {
|
|
26
|
+
var displayName: string;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//# sourceMappingURL=select-trigger.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-trigger.d.mts","names":[],"sources":["../../src/select/select-trigger.tsx"],"mappings":";;;;iBASiB,2BAA2B,KAC1C;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;;;;EAK9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;wBAoBvC,gBAAgB,WAAW,OAAO,UAAU,WAAW,QAAQ,qBAAkB;yBAAjF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
4
|
+
import { useSelectContext } from "./select-context.mjs";
|
|
5
|
+
import { useSelectPartRef } from "./select-dom.mjs";
|
|
6
|
+
//#region src/select/select-trigger.tsx
|
|
7
|
+
function firstChildOfSelect(el) {
|
|
8
|
+
const parent = el.parentElement;
|
|
9
|
+
if (parent?.tagName === "SELECT" && parent.firstElementChild === el) return null;
|
|
10
|
+
return "must be the first child of Select.Root's <select> (HTML content model); elsewhere the browser does not use it as the select's button.";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The select's own `<button>` (customizable select): replaces the UA button in engines with
|
|
14
|
+
* `appearance: base-select`. Optional; **must be the first child** of `Select.Root`. Its state is
|
|
15
|
+
* the Root's state, so a pending indicator next to `<Select.Value />` goes in its function
|
|
16
|
+
* `children`.
|
|
17
|
+
*
|
|
18
|
+
* Owned keys: `type` (always `"button"`), `data-pending`, `data-disabled`.
|
|
19
|
+
*/
|
|
20
|
+
function SelectTrigger({ className, style, children, render, ...rest }) {
|
|
21
|
+
const ctx = useSelectContext("Select.Trigger");
|
|
22
|
+
const state = {
|
|
23
|
+
value: ctx.optimistic,
|
|
24
|
+
pending: ctx.pending,
|
|
25
|
+
disabled: ctx.disabled
|
|
26
|
+
};
|
|
27
|
+
const { ref } = useSelectPartRef("Select.Trigger", "button", firstChildOfSelect);
|
|
28
|
+
return useRender({
|
|
29
|
+
defaultElement: "button",
|
|
30
|
+
render,
|
|
31
|
+
state,
|
|
32
|
+
className,
|
|
33
|
+
style,
|
|
34
|
+
children,
|
|
35
|
+
props: rest,
|
|
36
|
+
libraryProps: {
|
|
37
|
+
type: "button",
|
|
38
|
+
"data-pending": dataAttr(ctx.pending),
|
|
39
|
+
"data-disabled": dataAttr(ctx.disabled)
|
|
40
|
+
},
|
|
41
|
+
ref
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
45
|
+
//#endregion
|
|
46
|
+
export { SelectTrigger };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=select-trigger.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-trigger.mjs","names":[],"sources":["../../src/select/select-trigger.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useSelectContext } from \"./select-context.js\";\nimport { useSelectPartRef } from \"./select-dom.js\";\nimport type { SelectRootState } from \"./select-root.js\";\n\nexport interface SelectTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"type\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, SelectRootState>;\n style?: StateValue<CSSProperties | undefined, SelectRootState>;\n /**\n * Non-interactive content only (HTML content model of a select's button), usually\n * `<Select.Value />`. Not rendered by engines without customizable select (Firefox today).\n */\n children?: StateValue<ReactNode, SelectRootState>;\n /** Replace the rendered element. Must keep a `<button>`. */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, SelectRootState>;\n}\n\nfunction firstChildOfSelect(el: HTMLButtonElement): string | null {\n const parent = el.parentElement;\n if (parent?.tagName === \"SELECT\" && parent.firstElementChild === el) return null;\n return (\n \"must be the first child of Select.Root's <select> (HTML content model); elsewhere the \" +\n \"browser does not use it as the select's button.\"\n );\n}\n\n/**\n * The select's own `<button>` (customizable select): replaces the UA button in engines with\n * `appearance: base-select`. Optional; **must be the first child** of `Select.Root`. Its state is\n * the Root's state, so a pending indicator next to `<Select.Value />` goes in its function\n * `children`.\n *\n * Owned keys: `type` (always `\"button\"`), `data-pending`, `data-disabled`.\n */\nexport function SelectTrigger({ className, style, children, render, ...rest }: SelectTriggerProps) {\n const ctx = useSelectContext(\"Select.Trigger\");\n const state: SelectRootState = {\n value: ctx.optimistic,\n pending: ctx.pending,\n disabled: ctx.disabled,\n };\n const { ref } = useSelectPartRef<HTMLButtonElement>(\n \"Select.Trigger\",\n \"button\",\n firstChildOfSelect,\n );\n return useRender<ComponentPropsWithRef<\"button\">, SelectRootState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n // Explicit: Chromium 156 reports `.type === \"submit\"` for a select's button.\n type: \"button\",\n \"data-pending\": dataAttr(ctx.pending),\n \"data-disabled\": dataAttr(ctx.disabled),\n },\n ref,\n });\n}\n\nSelectTrigger.displayName = \"SelectTrigger\";\n"],"mappings":";;;;;;AAwBA,SAAS,mBAAmB,IAAsC;CAChE,MAAM,SAAS,GAAG;CAClB,IAAI,QAAQ,YAAY,YAAY,OAAO,sBAAsB,IAAI,OAAO;CAC5E,OACE;AAGJ;;;;;;;;;AAUA,SAAgB,cAAc,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,QAA4B;CACjG,MAAM,MAAM,iBAAiB,gBAAgB;CAC7C,MAAM,QAAyB;EAC7B,OAAO,IAAI;EACX,SAAS,IAAI;EACb,UAAU,IAAI;CAChB;CACA,MAAM,EAAE,QAAQ,iBACd,kBACA,UACA,kBACF;CACA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,cAAc;GAEZ,MAAM;GACN,gBAAgB,SAAS,IAAI,OAAO;GACpC,iBAAiB,SAAS,IAAI,QAAQ;EACxC;EACA;CACF,CAAC;AACH;AAEA,cAAc,cAAc"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { SelectRootState } from "./select-root.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef } from "react";
|
|
4
|
+
//#region src/select/select-value.d.ts
|
|
5
|
+
export interface SelectValueProps extends Omit<ComponentPropsWithRef<"selectedcontent">, "children" | "dangerouslySetInnerHTML" | "className" | "style"> {
|
|
6
|
+
className?: StateValue<string | undefined, SelectRootState>;
|
|
7
|
+
style?: StateValue<CSSProperties | undefined, SelectRootState>;
|
|
8
|
+
/** Replace the rendered element. Must keep a `<selectedcontent>`. */
|
|
9
|
+
render?: RenderProp<ComponentPropsWithRef<"selectedcontent">, SelectRootState>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* `<selectedcontent>`: the browser clones the selected option's content into it (inside
|
|
13
|
+
* `Select.Trigger`). It has no `children`. Rendered with `suppressHydrationWarning` and an empty
|
|
14
|
+
* `dangerouslySetInnerHTML` so that hydration accepts the content the parser cloned before React
|
|
15
|
+
* ran (design/components/select.md 3.3).
|
|
16
|
+
*
|
|
17
|
+
* Also keeps it fresh: the platform re-clones only on selection changes, so when React changes
|
|
18
|
+
* the selected option's content (a label, a state function, a Suspense boundary resolving inside
|
|
19
|
+
* it), a `MutationObserver` re-assigns `select.value = select.value`, which re-clones without
|
|
20
|
+
* events and without touching the selection or an open picker (6.3). The same refresh follows a
|
|
21
|
+
* form reset, which Chromium does not re-clone for. Not installed where
|
|
22
|
+
* `HTMLSelectedContentElement` is undefined (Firefox today, jsdom): nothing is cloned there.
|
|
23
|
+
*
|
|
24
|
+
* Owned keys: `dangerouslySetInnerHTML`, `suppressHydrationWarning`, `children`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function SelectValue({ className, style, render, ...rest }: SelectValueProps): import("react").ReactNode;
|
|
27
|
+
export declare namespace SelectValue {
|
|
28
|
+
var displayName: string;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//# sourceMappingURL=select-value.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-value.d.mts","names":[],"sources":["../../src/select/select-value.tsx"],"mappings":";;;;iBAYiB,yBAAyB,KACxC;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,SAAS,WAAW,0CAA0C;;;;;;;;;;;;;;;;;wBA2ChD,cAAc,WAAW,OAAO,WAAW,QAAQ,mCAAgB;yBAAnE"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { useFormReset } from "../internal/use-form-reset.mjs";
|
|
4
|
+
import { useSelectContext } from "./select-context.mjs";
|
|
5
|
+
import { useSelectPartRef } from "./select-dom.mjs";
|
|
6
|
+
import { useLayoutEffect, useMemo } from "react";
|
|
7
|
+
//#region src/select/select-value.tsx
|
|
8
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
9
|
+
/** Where the browser clones options into `<selectedcontent>` (Chromium 135+, Safari 27). */
|
|
10
|
+
function supportsSelectedContent() {
|
|
11
|
+
return typeof globalThis !== "undefined" && "HTMLSelectedContentElement" in globalThis;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Whether a mutation record changes what `<selectedcontent>` shows: a record inside the selected
|
|
15
|
+
* option. Attribute records on the option element itself are ignored (option attributes are not
|
|
16
|
+
* cloned, and the library writes `data-*` there); records inside `<selectedcontent>` are never
|
|
17
|
+
* inside an option, so the refresh's own clone does not loop.
|
|
18
|
+
*/
|
|
19
|
+
function touchesSelected(record, selected) {
|
|
20
|
+
if (record.type === "attributes" && record.target === selected) return false;
|
|
21
|
+
return selected.contains(record.target);
|
|
22
|
+
}
|
|
23
|
+
/** Re-clones the selected option into `<selectedcontent>`. */
|
|
24
|
+
function refresh(select) {
|
|
25
|
+
if (select.selectedIndex === -1) return;
|
|
26
|
+
select.value = select.value;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* `<selectedcontent>`: the browser clones the selected option's content into it (inside
|
|
30
|
+
* `Select.Trigger`). It has no `children`. Rendered with `suppressHydrationWarning` and an empty
|
|
31
|
+
* `dangerouslySetInnerHTML` so that hydration accepts the content the parser cloned before React
|
|
32
|
+
* ran (design/components/select.md 3.3).
|
|
33
|
+
*
|
|
34
|
+
* Also keeps it fresh: the platform re-clones only on selection changes, so when React changes
|
|
35
|
+
* the selected option's content (a label, a state function, a Suspense boundary resolving inside
|
|
36
|
+
* it), a `MutationObserver` re-assigns `select.value = select.value`, which re-clones without
|
|
37
|
+
* events and without touching the selection or an open picker (6.3). The same refresh follows a
|
|
38
|
+
* form reset, which Chromium does not re-clone for. Not installed where
|
|
39
|
+
* `HTMLSelectedContentElement` is undefined (Firefox today, jsdom): nothing is cloned there.
|
|
40
|
+
*
|
|
41
|
+
* Owned keys: `dangerouslySetInnerHTML`, `suppressHydrationWarning`, `children`.
|
|
42
|
+
*/
|
|
43
|
+
function SelectValue({ className, style, render, ...rest }) {
|
|
44
|
+
const ctx = useSelectContext("Select.Value");
|
|
45
|
+
const { ref, node } = useSelectPartRef("Select.Value", "selectedcontent");
|
|
46
|
+
useLayoutEffect(() => {
|
|
47
|
+
const el = node.current;
|
|
48
|
+
if (el === null) return;
|
|
49
|
+
const select = el.closest("select");
|
|
50
|
+
if (select === null) {
|
|
51
|
+
if (isDev) console.error("Select.Value: rendered outside the Select.Root's <select>; put it inside Select.Trigger, the select's first child.");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!supportsSelectedContent()) return;
|
|
55
|
+
const observer = new MutationObserver((records) => {
|
|
56
|
+
const selected = select.options[select.selectedIndex];
|
|
57
|
+
if (selected === void 0) return;
|
|
58
|
+
if (records.some((record) => touchesSelected(record, selected))) refresh(select);
|
|
59
|
+
});
|
|
60
|
+
observer.observe(select, {
|
|
61
|
+
childList: true,
|
|
62
|
+
characterData: true,
|
|
63
|
+
attributes: true,
|
|
64
|
+
subtree: true
|
|
65
|
+
});
|
|
66
|
+
return () => {
|
|
67
|
+
observer.disconnect();
|
|
68
|
+
};
|
|
69
|
+
}, [node]);
|
|
70
|
+
const selectRef = useMemo(() => ({ get current() {
|
|
71
|
+
return node.current?.closest("select") ?? null;
|
|
72
|
+
} }), [node]);
|
|
73
|
+
useFormReset(selectRef, () => {
|
|
74
|
+
const select = selectRef.current;
|
|
75
|
+
if (select !== null && supportsSelectedContent()) refresh(select);
|
|
76
|
+
});
|
|
77
|
+
const state = {
|
|
78
|
+
value: ctx.optimistic,
|
|
79
|
+
pending: ctx.pending,
|
|
80
|
+
disabled: ctx.disabled
|
|
81
|
+
};
|
|
82
|
+
return useRender({
|
|
83
|
+
defaultElement: "selectedcontent",
|
|
84
|
+
render,
|
|
85
|
+
state,
|
|
86
|
+
className,
|
|
87
|
+
style,
|
|
88
|
+
children: void 0,
|
|
89
|
+
props: rest,
|
|
90
|
+
libraryProps: {
|
|
91
|
+
suppressHydrationWarning: true,
|
|
92
|
+
dangerouslySetInnerHTML: { __html: "" }
|
|
93
|
+
},
|
|
94
|
+
ref
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
SelectValue.displayName = "SelectValue";
|
|
98
|
+
//#endregion
|
|
99
|
+
export { SelectValue };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=select-value.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-value.mjs","names":[],"sources":["../../src/select/select-value.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect, useMemo } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useFormReset } from \"../internal/use-form-reset.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useSelectContext } from \"./select-context.js\";\nimport { useSelectPartRef } from \"./select-dom.js\";\nimport type { SelectRootState } from \"./select-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface SelectValueProps extends Omit<\n ComponentPropsWithRef<\"selectedcontent\">,\n \"children\" | \"dangerouslySetInnerHTML\" | \"className\" | \"style\"\n> {\n className?: StateValue<string | undefined, SelectRootState>;\n style?: StateValue<CSSProperties | undefined, SelectRootState>;\n /** Replace the rendered element. Must keep a `<selectedcontent>`. */\n render?: RenderProp<ComponentPropsWithRef<\"selectedcontent\">, SelectRootState>;\n}\n\n/** Where the browser clones options into `<selectedcontent>` (Chromium 135+, Safari 27). */\nfunction supportsSelectedContent(): boolean {\n return typeof globalThis !== \"undefined\" && \"HTMLSelectedContentElement\" in globalThis;\n}\n\n/**\n * Whether a mutation record changes what `<selectedcontent>` shows: a record inside the selected\n * option. Attribute records on the option element itself are ignored (option attributes are not\n * cloned, and the library writes `data-*` there); records inside `<selectedcontent>` are never\n * inside an option, so the refresh's own clone does not loop.\n */\nfunction touchesSelected(record: MutationRecord, selected: HTMLOptionElement): boolean {\n if (record.type === \"attributes\" && record.target === selected) return false;\n return selected.contains(record.target);\n}\n\n/** Re-clones the selected option into `<selectedcontent>`. */\nfunction refresh(select: HTMLSelectElement): void {\n // Nothing selected: assigning the value would select the placeholder (probe case 7).\n if (select.selectedIndex === -1) return;\n // The assignment is the re-clone trigger; it fires no event and keeps the selection.\n const current = select.value;\n select.value = current;\n}\n\n/**\n * `<selectedcontent>`: the browser clones the selected option's content into it (inside\n * `Select.Trigger`). It has no `children`. Rendered with `suppressHydrationWarning` and an empty\n * `dangerouslySetInnerHTML` so that hydration accepts the content the parser cloned before React\n * ran (design/components/select.md 3.3).\n *\n * Also keeps it fresh: the platform re-clones only on selection changes, so when React changes\n * the selected option's content (a label, a state function, a Suspense boundary resolving inside\n * it), a `MutationObserver` re-assigns `select.value = select.value`, which re-clones without\n * events and without touching the selection or an open picker (6.3). The same refresh follows a\n * form reset, which Chromium does not re-clone for. Not installed where\n * `HTMLSelectedContentElement` is undefined (Firefox today, jsdom): nothing is cloned there.\n *\n * Owned keys: `dangerouslySetInnerHTML`, `suppressHydrationWarning`, `children`.\n */\nexport function SelectValue({ className, style, render, ...rest }: SelectValueProps) {\n const ctx = useSelectContext(\"Select.Value\");\n const { ref, node } = useSelectPartRef<HTMLElement>(\"Select.Value\", \"selectedcontent\");\n\n useLayoutEffect(() => {\n const el = node.current;\n if (el === null) return;\n const select = el.closest(\"select\");\n if (select === null) {\n if (isDev) {\n console.error(\n \"Select.Value: rendered outside the Select.Root's <select>; put it inside \" +\n \"Select.Trigger, the select's first child.\",\n );\n }\n return;\n }\n if (!supportsSelectedContent()) return;\n const observer = new MutationObserver((records) => {\n const selected = select.options[select.selectedIndex];\n if (selected === undefined) return;\n if (records.some((record) => touchesSelected(record, selected))) refresh(select);\n });\n observer.observe(select, {\n childList: true,\n characterData: true,\n attributes: true,\n subtree: true,\n });\n return () => {\n observer.disconnect();\n };\n }, [node]);\n\n // A form reset changes the selection without re-cloning (Chromium 156: `form.reset()` leaves\n // the old option's content in <selectedcontent>; memo/developer/select.md). `useFormReset`\n // listens on the select's form owner itself (so neither `stopPropagation()` on the form nor a\n // shadow root hides the event), follows a changed owner or `form` attribute, and calls back in\n // a microtask after an uncancelled reset. React's own reset after a form action is a\n // `form.reset()` too.\n const selectRef = useMemo(\n () => ({\n get current(): HTMLSelectElement | null {\n return node.current?.closest(\"select\") ?? null;\n },\n }),\n [node],\n );\n useFormReset(selectRef, () => {\n const select = selectRef.current;\n if (select !== null && supportsSelectedContent()) refresh(select);\n });\n\n const state: SelectRootState = {\n value: ctx.optimistic,\n pending: ctx.pending,\n disabled: ctx.disabled,\n };\n return useRender<ComponentPropsWithRef<\"selectedcontent\">, SelectRootState>({\n defaultElement: \"selectedcontent\",\n render,\n state,\n className,\n style,\n children: undefined,\n props: rest,\n libraryProps: {\n suppressHydrationWarning: true,\n dangerouslySetInnerHTML: { __html: \"\" },\n },\n ref,\n });\n}\n\nSelectValue.displayName = \"SelectValue\";\n"],"mappings":";;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;AAavC,SAAS,0BAAmC;CAC1C,OAAO,OAAO,eAAe,eAAe,gCAAgC;AAC9E;;;;;;;AAQA,SAAS,gBAAgB,QAAwB,UAAsC;CACrF,IAAI,OAAO,SAAS,gBAAgB,OAAO,WAAW,UAAU,OAAO;CACvE,OAAO,SAAS,SAAS,OAAO,MAAM;AACxC;;AAGA,SAAS,QAAQ,QAAiC;CAEhD,IAAI,OAAO,kBAAkB,IAAI;CAGjC,OAAO,QADS,OAAO;AAEzB;;;;;;;;;;;;;;;;AAiBA,SAAgB,YAAY,EAAE,WAAW,OAAO,QAAQ,GAAG,QAA0B;CACnF,MAAM,MAAM,iBAAiB,cAAc;CAC3C,MAAM,EAAE,KAAK,SAAS,iBAA8B,gBAAgB,iBAAiB;CAErF,sBAAsB;EACpB,MAAM,KAAK,KAAK;EAChB,IAAI,OAAO,MAAM;EACjB,MAAM,SAAS,GAAG,QAAQ,QAAQ;EAClC,IAAI,WAAW,MAAM;GACnB,IAAI,OACF,QAAQ,MACN,oHAEF;GAEF;EACF;EACA,IAAI,CAAC,wBAAwB,GAAG;EAChC,MAAM,WAAW,IAAI,kBAAkB,YAAY;GACjD,MAAM,WAAW,OAAO,QAAQ,OAAO;GACvC,IAAI,aAAa,KAAA,GAAW;GAC5B,IAAI,QAAQ,MAAM,WAAW,gBAAgB,QAAQ,QAAQ,CAAC,GAAG,QAAQ,MAAM;EACjF,CAAC;EACD,SAAS,QAAQ,QAAQ;GACvB,WAAW;GACX,eAAe;GACf,YAAY;GACZ,SAAS;EACX,CAAC;EACD,aAAa;GACX,SAAS,WAAW;EACtB;CACF,GAAG,CAAC,IAAI,CAAC;CAQT,MAAM,YAAY,eACT,EACL,IAAI,UAAoC;EACtC,OAAO,KAAK,SAAS,QAAQ,QAAQ,KAAK;CAC5C,EACF,IACA,CAAC,IAAI,CACP;CACA,aAAa,iBAAiB;EAC5B,MAAM,SAAS,UAAU;EACzB,IAAI,WAAW,QAAQ,wBAAwB,GAAG,QAAQ,MAAM;CAClE,CAAC;CAED,MAAM,QAAyB;EAC7B,OAAO,IAAI;EACX,SAAS,IAAI;EACb,UAAU,IAAI;CAChB;CACA,OAAO,UAAqE;EAC1E,gBAAgB;EAChB;EACA;EACA;EACA;EACA,UAAU,KAAA;EACV,OAAO;EACP,cAAc;GACZ,0BAA0B;GAC1B,yBAAyB,EAAE,QAAQ,GAAG;EACxC;EACA;CACF,CAAC;AACH;AAEA,YAAY,cAAc"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "../internal/platform-attributes.mjs";
|
|
2
|
+
import { SliderOrientation, SliderRootProps, SliderRootState, SliderValue, SliderValueChangeDetails, SliderValueCommitDetails } from "./slider-root.mjs";
|
|
3
|
+
import { SliderTrack, SliderTrackProps, SliderTrackState } from "./slider-track.mjs";
|
|
4
|
+
import { SliderIndicator, SliderIndicatorProps, SliderIndicatorState } from "./slider-indicator.mjs";
|
|
5
|
+
import { SliderLabel, SliderLabelProps } from "./slider-label.mjs";
|
|
6
|
+
import { SliderThumb, SliderThumbProps, SliderThumbState } from "./slider-thumb.mjs";
|
|
7
|
+
import { SliderValuePart, SliderValueProps, SliderValueState } from "./slider-value.mjs";
|
|
8
|
+
//#region src/slider/index.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Slider (WAI-ARIA APG Slider and Slider (Multi-Thumb) patterns): `Root` (`role="group"` with
|
|
11
|
+
* several thumbs), `Label`, `Track` (owns the pointer), `Indicator` (the fill), one `Thumb` per
|
|
12
|
+
* value (a styled element containing a visually hidden native `<input type="range">`), and
|
|
13
|
+
* `Value`. Two actions: `valueChangeAction` on every step (a transition; keep it cheap) and
|
|
14
|
+
* `valueCommitAction` once per gesture (the save; uncontrolled state is committed when it
|
|
15
|
+
* resolves and rolls back when it rejects).
|
|
16
|
+
*/
|
|
17
|
+
export declare const Slider: {
|
|
18
|
+
readonly Root: {
|
|
19
|
+
(props: SliderRootProps<number>): import("react").ReactNode;
|
|
20
|
+
(props: SliderRootProps<readonly number[]>): import("react").ReactNode;
|
|
21
|
+
(props: SliderRootProps<SliderValue>): import("react").ReactNode;
|
|
22
|
+
displayName?: string;
|
|
23
|
+
};
|
|
24
|
+
readonly Label: typeof SliderLabel;
|
|
25
|
+
readonly Track: typeof SliderTrack;
|
|
26
|
+
readonly Indicator: typeof SliderIndicator;
|
|
27
|
+
readonly Thumb: typeof SliderThumb;
|
|
28
|
+
readonly Value: typeof SliderValuePart;
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export type { SliderIndicatorProps, SliderIndicatorState, SliderLabelProps, SliderOrientation, SliderRootProps, SliderRootState, SliderThumbProps, SliderThumbState, SliderTrackProps, SliderTrackState, SliderValue, SliderValueChangeDetails, SliderValueCommitDetails, SliderValueProps, SliderValueState };
|
|
32
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["_$__slider_root_js0.SliderRootProps","_$__slider_root_js0.SliderValue"],"sources":["../../src/slider/index.ts"],"mappings":";;;;;;;;;;;;;;;;qBAkBa;WACX;K,OADWA,0C;;;;;WAEX,cAAK;WACL,cAAK;WACL,kBAAS;WACT,cAAK;WACL,cAAK"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SliderIndicator } from "./slider-indicator.mjs";
|
|
2
|
+
import { SliderLabel } from "./slider-label.mjs";
|
|
3
|
+
import { SliderRoot } from "./slider-root.mjs";
|
|
4
|
+
import { SliderThumb } from "./slider-thumb.mjs";
|
|
5
|
+
import { SliderTrack } from "./slider-track.mjs";
|
|
6
|
+
import { SliderValuePart } from "./slider-value.mjs";
|
|
7
|
+
//#region src/slider/index.ts
|
|
8
|
+
/**
|
|
9
|
+
* Slider (WAI-ARIA APG Slider and Slider (Multi-Thumb) patterns): `Root` (`role="group"` with
|
|
10
|
+
* several thumbs), `Label`, `Track` (owns the pointer), `Indicator` (the fill), one `Thumb` per
|
|
11
|
+
* value (a styled element containing a visually hidden native `<input type="range">`), and
|
|
12
|
+
* `Value`. Two actions: `valueChangeAction` on every step (a transition; keep it cheap) and
|
|
13
|
+
* `valueCommitAction` once per gesture (the save; uncontrolled state is committed when it
|
|
14
|
+
* resolves and rolls back when it rejects).
|
|
15
|
+
*/
|
|
16
|
+
const Slider = {
|
|
17
|
+
Root: SliderRoot,
|
|
18
|
+
Label: SliderLabel,
|
|
19
|
+
Track: SliderTrack,
|
|
20
|
+
Indicator: SliderIndicator,
|
|
21
|
+
Thumb: SliderThumb,
|
|
22
|
+
Value: SliderValuePart
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Slider };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/slider/index.ts"],"sourcesContent":["// Ships the platform attribute typings with this subpath (conventions 7.4). Type-only: the\n// built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { SliderIndicator } from \"./slider-indicator.js\";\nimport { SliderLabel } from \"./slider-label.js\";\nimport { SliderRoot } from \"./slider-root.js\";\nimport { SliderThumb } from \"./slider-thumb.js\";\nimport { SliderTrack } from \"./slider-track.js\";\nimport { SliderValuePart } from \"./slider-value.js\";\n\n/**\n * Slider (WAI-ARIA APG Slider and Slider (Multi-Thumb) patterns): `Root` (`role=\"group\"` with\n * several thumbs), `Label`, `Track` (owns the pointer), `Indicator` (the fill), one `Thumb` per\n * value (a styled element containing a visually hidden native `<input type=\"range\">`), and\n * `Value`. Two actions: `valueChangeAction` on every step (a transition; keep it cheap) and\n * `valueCommitAction` once per gesture (the save; uncontrolled state is committed when it\n * resolves and rolls back when it rejects).\n */\nexport const Slider = {\n Root: SliderRoot,\n Label: SliderLabel,\n Track: SliderTrack,\n Indicator: SliderIndicator,\n Thumb: SliderThumb,\n Value: SliderValuePart,\n} as const;\n\nexport type {\n SliderValue,\n SliderOrientation,\n SliderRootProps,\n SliderRootState,\n SliderValueChangeDetails,\n SliderValueCommitDetails,\n} from \"./slider-root.js\";\nexport type { SliderLabelProps } from \"./slider-label.js\";\nexport type { SliderTrackProps, SliderTrackState } from \"./slider-track.js\";\nexport type { SliderIndicatorProps, SliderIndicatorState } from \"./slider-indicator.js\";\nexport type { SliderThumbProps, SliderThumbState } from \"./slider-thumb.js\";\nexport type { SliderValueProps, SliderValueState } from \"./slider-value.js\";\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,SAAS;CACpB,MAAM;CACN,OAAO;CACP,OAAO;CACP,WAAW;CACX,OAAO;CACP,OAAO;AACT"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { decimalsOf, roundTo } from "../internal/decimal.mjs";
|
|
2
|
+
//#region src/slider/slider-arithmetic.ts
|
|
3
|
+
/** Tolerance for grid computations on binary floating point (`0.3 / 0.1` is `2.9999999999999996`). */
|
|
4
|
+
const EPSILON = 1e-9;
|
|
5
|
+
/**
|
|
6
|
+
* The value a native range with these bounds would hold for `value`: snapped to
|
|
7
|
+
* `min + n × step` (ties toward +∞, the HTML step-mismatch rule), clamped to `[min, max]`, and,
|
|
8
|
+
* when the snapped value exceeds `max`, the last grid point below `max` (so `min 0, max 5,
|
|
9
|
+
* step 2` caps at `4`). Rounded to the decimal places of `step` and `min`. With `max < min` the
|
|
10
|
+
* platform's maximum is `min`.
|
|
11
|
+
*/
|
|
12
|
+
function snap(value, min, max, step) {
|
|
13
|
+
const decimals = Math.max(decimalsOf(step), decimalsOf(min));
|
|
14
|
+
if (!Number.isFinite(value)) return min;
|
|
15
|
+
if (!(max > min)) return roundTo(min, decimals);
|
|
16
|
+
const lastIndex = Math.floor((max - min) / step + EPSILON);
|
|
17
|
+
let index = Math.floor((value - min) / step + .5 + EPSILON);
|
|
18
|
+
if (index > lastIndex) index = lastIndex;
|
|
19
|
+
if (index < 0) index = 0;
|
|
20
|
+
return roundTo(min + index * step, decimals);
|
|
21
|
+
}
|
|
22
|
+
/** Whether `max` is reachable: `max - min` is a whole number of steps. */
|
|
23
|
+
function isMaxReachable(min, max, step) {
|
|
24
|
+
if (!(max > min)) return true;
|
|
25
|
+
const steps = (max - min) / step;
|
|
26
|
+
return Math.abs(steps - Math.round(steps)) < EPSILON * Math.max(1, steps);
|
|
27
|
+
}
|
|
28
|
+
/** Whether `value` is a value a native range with these bounds can hold unchanged. */
|
|
29
|
+
function isOnGrid(value, min, max, step) {
|
|
30
|
+
return Math.abs(snap(value, min, max, step) - value) < EPSILON * Math.max(1, Math.abs(value));
|
|
31
|
+
}
|
|
32
|
+
/** The native `min` / `max` of thumb `index`: the slider's bounds, narrowed by its neighbours. */
|
|
33
|
+
function thumbBounds(values, index, min, max, gap) {
|
|
34
|
+
const decimals = Math.max(decimalsOf(gap), decimalsOf(min));
|
|
35
|
+
const before = values[index - 1];
|
|
36
|
+
const after = values[index + 1];
|
|
37
|
+
return {
|
|
38
|
+
lower: before === void 0 ? min : roundTo(before + gap, decimals),
|
|
39
|
+
upper: after === void 0 ? max : roundTo(after - gap, decimals)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* `next` for thumb `index`, snapped to the slider's grid and clamped between its neighbours
|
|
44
|
+
* (`values[i - 1] + gap`, `values[i + 1] - gap`; on the grid, because every thumb shares `step`
|
|
45
|
+
* and `min`). With no room between the neighbours the thumb keeps its value.
|
|
46
|
+
*/
|
|
47
|
+
function clampToNeighbours(values, index, next, min, max, step, gap) {
|
|
48
|
+
const { lower, upper } = thumbBounds(values, index, min, max, gap);
|
|
49
|
+
const current = values[index] ?? next;
|
|
50
|
+
if (lower > upper + EPSILON) return current;
|
|
51
|
+
return Math.min(Math.max(snap(next, min, max, step), lower), upper);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The value a native input with these attributes would hold for `value` (each thumb's bounds come
|
|
55
|
+
* from `reference`, the values it is rendered against). Used to compare a DOM read with the shown
|
|
56
|
+
* value: jsdom does not sanitise a range's value, browsers do, and a consumer's off-grid value is
|
|
57
|
+
* rendered as given and sanitised by the DOM.
|
|
58
|
+
*/
|
|
59
|
+
function sanitize(values, reference, min, max, step, gap) {
|
|
60
|
+
return values.map((value, index) => {
|
|
61
|
+
const { lower, upper } = thumbBounds(reference, index, min, max, gap);
|
|
62
|
+
return snap(value, lower, Math.max(lower, upper), step);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** Position of `value` in `[min, max]`, in percent, clamped to `0`–`100`. */
|
|
66
|
+
function percent(value, min, max) {
|
|
67
|
+
if (!(max > min)) return 0;
|
|
68
|
+
const fraction = (value - min) / (max - min);
|
|
69
|
+
return Math.min(100, Math.max(0, fraction * 100));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The thumb a track press at `target` moves: the nearest by value. On a tie (two thumbs at one
|
|
73
|
+
* value, or equidistant thumbs) the thumb that can move toward the pointer: the later one when
|
|
74
|
+
* the pointer is above it, else the earlier one.
|
|
75
|
+
*/
|
|
76
|
+
function nearestThumb(values, target) {
|
|
77
|
+
let best = 0;
|
|
78
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
79
|
+
values.forEach((value, index) => {
|
|
80
|
+
const distance = Math.abs(value - target);
|
|
81
|
+
if (distance < bestDistance - EPSILON) {
|
|
82
|
+
best = index;
|
|
83
|
+
bestDistance = distance;
|
|
84
|
+
} else if (Math.abs(distance - bestDistance) <= EPSILON && target > value) best = index;
|
|
85
|
+
});
|
|
86
|
+
return best;
|
|
87
|
+
}
|
|
88
|
+
/** The platform's default value: the midpoint, snapped to the grid; `min` when `max < min`. */
|
|
89
|
+
function platformDefault(min, max, step) {
|
|
90
|
+
if (!(max > min)) return min;
|
|
91
|
+
return snap(min + (max - min) / 2, min, max, step);
|
|
92
|
+
}
|
|
93
|
+
/** Element-wise equality of two value arrays (within floating-point tolerance). */
|
|
94
|
+
function equalValues(a, b) {
|
|
95
|
+
if (a.length !== b.length) return false;
|
|
96
|
+
return a.every((value, index) => {
|
|
97
|
+
const other = b[index];
|
|
98
|
+
return value === other || Math.abs(value - other) < EPSILON * Math.max(1, Math.abs(value));
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { clampToNeighbours, decimalsOf, equalValues, isMaxReachable, isOnGrid, nearestThumb, percent, platformDefault, sanitize, snap, thumbBounds };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=slider-arithmetic.mjs.map
|