@funstack/ui 0.1.0-alpha.1 → 0.1.0-alpha.10
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 +135 -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,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ToolbarContext } from "../internal/toolbar-context.mjs";
|
|
3
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
4
|
+
import { useRovingFocus } from "../internal/use-roving-focus.mjs";
|
|
5
|
+
import { useMemo, useRef, useSyncExternalStore } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/toolbar/toolbar-root.tsx
|
|
8
|
+
/**
|
|
9
|
+
* First entry: the first item. Natively `disabled` controls are not items; `aria-disabled` ones
|
|
10
|
+
* are, and are entered like any other, as Chromium's native `focusgroup` does (the APG allows
|
|
11
|
+
* focusable disabled items in a toolbar).
|
|
12
|
+
*/
|
|
13
|
+
function firstItem(items) {
|
|
14
|
+
return items[0];
|
|
15
|
+
}
|
|
16
|
+
/** Engine capabilities never change while the page lives. */
|
|
17
|
+
const subscribeNever = () => () => {};
|
|
18
|
+
/**
|
|
19
|
+
* `<div role="toolbar" aria-orientation>` (WAI-ARIA APG Toolbar). Its items are its focusable
|
|
20
|
+
* descendants, found in the DOM: one Tab stop (the last focused item), arrow keys, Home and End
|
|
21
|
+
* between them (design/components/toggle-group.md section 6). Name it with `aria-label` or
|
|
22
|
+
* `aria-labelledby`.
|
|
23
|
+
*
|
|
24
|
+
* Owned keys (conventions 1.2): `role`, `aria-orientation`, `data-orientation`, `onKeyDown`,
|
|
25
|
+
* `onFocus`, `onBlur`, `onPointerDown`, and `focusgroup` while the flag is on.
|
|
26
|
+
*/
|
|
27
|
+
function ToolbarRoot({ orientation = "horizontal", loop = true, experimental_focusgroup = false, className, style, children, render, ...rest }) {
|
|
28
|
+
const native = useSyncExternalStore(subscribeNever, () => experimental_focusgroup && "focusGroup" in HTMLElement.prototype, () => false);
|
|
29
|
+
const rootRef = useRef(null);
|
|
30
|
+
const roving = useRovingFocus(rootRef, {
|
|
31
|
+
orientation,
|
|
32
|
+
loop,
|
|
33
|
+
native,
|
|
34
|
+
entry: firstItem,
|
|
35
|
+
memory: true
|
|
36
|
+
});
|
|
37
|
+
const context = useMemo(() => ({ orientation }), [orientation]);
|
|
38
|
+
const state = { orientation };
|
|
39
|
+
const focusgroup = experimental_focusgroup ? `toolbar ${orientation === "vertical" ? "block" : "inline"} ${loop ? "wrap" : "nowrap"}` : void 0;
|
|
40
|
+
const element = useRender({
|
|
41
|
+
defaultElement: "div",
|
|
42
|
+
render,
|
|
43
|
+
state,
|
|
44
|
+
className,
|
|
45
|
+
style,
|
|
46
|
+
children,
|
|
47
|
+
props: rest,
|
|
48
|
+
libraryProps: {
|
|
49
|
+
role: "toolbar",
|
|
50
|
+
"aria-orientation": orientation,
|
|
51
|
+
"data-orientation": orientation,
|
|
52
|
+
...roving,
|
|
53
|
+
...focusgroup !== void 0 && { focusgroup }
|
|
54
|
+
},
|
|
55
|
+
ref: rootRef
|
|
56
|
+
});
|
|
57
|
+
return /* @__PURE__ */ jsx(ToolbarContext, {
|
|
58
|
+
value: context,
|
|
59
|
+
children: element
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
ToolbarRoot.displayName = "ToolbarRoot";
|
|
63
|
+
//#endregion
|
|
64
|
+
export { ToolbarRoot };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=toolbar-root.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-root.mjs","names":[],"sources":["../../src/toolbar/toolbar-root.tsx"],"sourcesContent":["\"use client\";\nimport { useMemo, useRef, useSyncExternalStore } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { ToolbarContext } from \"../internal/toolbar-context.js\";\nimport type { ToolbarContextValue } from \"../internal/toolbar-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useRovingFocus } from \"../internal/use-roving-focus.js\";\n\nexport type ToolbarOrientation = \"horizontal\" | \"vertical\";\n\nexport interface ToolbarRootState {\n readonly orientation: ToolbarOrientation;\n}\n\nexport interface ToolbarRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"role\"\n | \"aria-orientation\"\n | \"onKeyDown\"\n | \"onFocus\"\n | \"onBlur\"\n | \"onPointerDown\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /** Axis of the arrow keys; also `aria-orientation`. Default `\"horizontal\"`. */\n orientation?: ToolbarOrientation;\n /** Whether arrows wrap from the last item to the first. Default `true`. */\n loop?: boolean;\n /**\n * Render `focusgroup=\"toolbar …\"` and, where the browser implements it, let the browser handle\n * arrow keys, Home and End and the single Tab stop. Chromium 150+ only; elsewhere the JS path\n * stays active. Default `false`.\n */\n experimental_focusgroup?: boolean;\n className?: StateValue<string | undefined, ToolbarRootState>;\n style?: StateValue<CSSProperties | undefined, ToolbarRootState>;\n children?: StateValue<ReactNode, ToolbarRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, ToolbarRootState>;\n}\n\n/**\n * First entry: the first item. Natively `disabled` controls are not items; `aria-disabled` ones\n * are, and are entered like any other, as Chromium's native `focusgroup` does (the APG allows\n * focusable disabled items in a toolbar).\n */\nfunction firstItem(items: readonly HTMLElement[]): HTMLElement | undefined {\n return items[0];\n}\n\n/** Engine capabilities never change while the page lives. */\nconst subscribeNever = () => () => {};\n\n/**\n * `<div role=\"toolbar\" aria-orientation>` (WAI-ARIA APG Toolbar). Its items are its focusable\n * descendants, found in the DOM: one Tab stop (the last focused item), arrow keys, Home and End\n * between them (design/components/toggle-group.md section 6). Name it with `aria-label` or\n * `aria-labelledby`.\n *\n * Owned keys (conventions 1.2): `role`, `aria-orientation`, `data-orientation`, `onKeyDown`,\n * `onFocus`, `onBlur`, `onPointerDown`, and `focusgroup` while the flag is on.\n */\nexport function ToolbarRoot({\n orientation = \"horizontal\",\n loop = true,\n experimental_focusgroup = false,\n className,\n style,\n children,\n render,\n ...rest\n}: ToolbarRootProps) {\n // Conventions 8: the server snapshot is `false`, so hydration markup matches the server.\n const native = useSyncExternalStore(\n subscribeNever,\n () => experimental_focusgroup && \"focusGroup\" in HTMLElement.prototype,\n () => false,\n );\n const rootRef = useRef<HTMLElement | null>(null);\n const roving = useRovingFocus(rootRef, {\n orientation,\n loop,\n native,\n entry: firstItem,\n memory: true,\n });\n\n const context = useMemo<ToolbarContextValue>(() => ({ orientation }), [orientation]);\n const state: ToolbarRootState = { orientation };\n\n const focusgroup = experimental_focusgroup\n ? `toolbar ${orientation === \"vertical\" ? \"block\" : \"inline\"} ${loop ? \"wrap\" : \"nowrap\"}`\n : undefined;\n\n const element = useRender<ComponentPropsWithRef<\"div\">, ToolbarRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n role: \"toolbar\",\n \"aria-orientation\": orientation,\n \"data-orientation\": orientation,\n ...roving,\n ...(focusgroup !== undefined && { focusgroup }),\n },\n ref: rootRef,\n });\n\n return <ToolbarContext value={context}>{element}</ToolbarContext>;\n}\n\nToolbarRoot.displayName = \"ToolbarRoot\";\n"],"mappings":";;;;;;;;;;;;AAgDA,SAAS,UAAU,OAAwD;CACzE,OAAO,MAAM;AACf;;AAGA,MAAM,6BAA6B,CAAC;;;;;;;;;;AAWpC,SAAgB,YAAY,EAC1B,cAAc,cACd,OAAO,MACP,0BAA0B,OAC1B,WACA,OACA,UACA,QACA,GAAG,QACgB;CAEnB,MAAM,SAAS,qBACb,sBACM,2BAA2B,gBAAgB,YAAY,iBACvD,KACR;CACA,MAAM,UAAU,OAA2B,IAAI;CAC/C,MAAM,SAAS,eAAe,SAAS;EACrC;EACA;EACA;EACA,OAAO;EACP,QAAQ;CACV,CAAC;CAED,MAAM,UAAU,eAAoC,EAAE,YAAY,IAAI,CAAC,WAAW,CAAC;CACnF,MAAM,QAA0B,EAAE,YAAY;CAE9C,MAAM,aAAa,0BACf,WAAW,gBAAgB,aAAa,UAAU,SAAS,GAAG,OAAO,SAAS,aAC9E,KAAA;CAEJ,MAAM,UAAU,UAA0D;EACxE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,MAAM;GACN,oBAAoB;GACpB,oBAAoB;GACpB,GAAG;GACH,GAAI,eAAe,KAAA,KAAa,EAAE,WAAW;EAC/C;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAU,UAAA;CAAwB,CAAA;AAClE;AAEA,YAAY,cAAc"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { ToolbarOrientation } from "./toolbar-root.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef } from "react";
|
|
4
|
+
//#region src/toolbar/toolbar-separator.d.ts
|
|
5
|
+
export interface ToolbarSeparatorState {
|
|
6
|
+
/** The separator's own orientation: perpendicular to the Toolbar's. */
|
|
7
|
+
readonly orientation: ToolbarOrientation;
|
|
8
|
+
}
|
|
9
|
+
export interface ToolbarSeparatorProps extends Omit<ComponentPropsWithRef<"hr">, "aria-orientation" | "className" | "style" | "children"> {
|
|
10
|
+
className?: StateValue<string | undefined, ToolbarSeparatorState>;
|
|
11
|
+
style?: StateValue<CSSProperties | undefined, ToolbarSeparatorState>;
|
|
12
|
+
render?: RenderProp<ComponentPropsWithRef<"hr">, ToolbarSeparatorState>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `<hr aria-orientation>` between toolbar items: vertical in a horizontal Toolbar, horizontal in
|
|
16
|
+
* a vertical one. Not focusable, not an item.
|
|
17
|
+
*
|
|
18
|
+
* Owned keys (conventions 1.2): `aria-orientation`, `data-orientation`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ToolbarSeparator({ className, style, render, ...rest }: ToolbarSeparatorProps): import("react").ReactNode;
|
|
21
|
+
export declare namespace ToolbarSeparator {
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//# sourceMappingURL=toolbar-separator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-separator.d.mts","names":[],"sources":["../../src/toolbar/toolbar-separator.tsx"],"mappings":";;;;iBAOiB;;WAEN,aAAa;;iBAGP,8BAA8B,KAC7C;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,6BAA6B;;;;;;;;wBASnC,mBAAmB,WAAW,OAAO,WAAW,QAAQ,wCAAqB;yBAA7E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useToolbarContext } from "../internal/toolbar-context.mjs";
|
|
3
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
4
|
+
//#region src/toolbar/toolbar-separator.tsx
|
|
5
|
+
/**
|
|
6
|
+
* `<hr aria-orientation>` between toolbar items: vertical in a horizontal Toolbar, horizontal in
|
|
7
|
+
* a vertical one. Not focusable, not an item.
|
|
8
|
+
*
|
|
9
|
+
* Owned keys (conventions 1.2): `aria-orientation`, `data-orientation`.
|
|
10
|
+
*/
|
|
11
|
+
function ToolbarSeparator({ className, style, render, ...rest }) {
|
|
12
|
+
const orientation = useToolbarContext()?.orientation === "vertical" ? "horizontal" : "vertical";
|
|
13
|
+
return useRender({
|
|
14
|
+
defaultElement: "hr",
|
|
15
|
+
render,
|
|
16
|
+
state: { orientation },
|
|
17
|
+
className,
|
|
18
|
+
style,
|
|
19
|
+
children: void 0,
|
|
20
|
+
props: rest,
|
|
21
|
+
libraryProps: {
|
|
22
|
+
"aria-orientation": orientation,
|
|
23
|
+
"data-orientation": orientation
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
ToolbarSeparator.displayName = "ToolbarSeparator";
|
|
28
|
+
//#endregion
|
|
29
|
+
export { ToolbarSeparator };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=toolbar-separator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-separator.mjs","names":[],"sources":["../../src/toolbar/toolbar-separator.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { useToolbarContext } from \"../internal/toolbar-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport type { ToolbarOrientation } from \"./toolbar-root.js\";\n\nexport interface ToolbarSeparatorState {\n /** The separator's own orientation: perpendicular to the Toolbar's. */\n readonly orientation: ToolbarOrientation;\n}\n\nexport interface ToolbarSeparatorProps extends Omit<\n ComponentPropsWithRef<\"hr\">,\n \"aria-orientation\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, ToolbarSeparatorState>;\n style?: StateValue<CSSProperties | undefined, ToolbarSeparatorState>;\n render?: RenderProp<ComponentPropsWithRef<\"hr\">, ToolbarSeparatorState>;\n}\n\n/**\n * `<hr aria-orientation>` between toolbar items: vertical in a horizontal Toolbar, horizontal in\n * a vertical one. Not focusable, not an item.\n *\n * Owned keys (conventions 1.2): `aria-orientation`, `data-orientation`.\n */\nexport function ToolbarSeparator({ className, style, render, ...rest }: ToolbarSeparatorProps) {\n const toolbar = useToolbarContext();\n const orientation: ToolbarOrientation =\n toolbar?.orientation === \"vertical\" ? \"horizontal\" : \"vertical\";\n const state: ToolbarSeparatorState = { orientation };\n\n return useRender<ComponentPropsWithRef<\"hr\">, ToolbarSeparatorState>({\n defaultElement: \"hr\",\n render,\n state,\n className,\n style,\n children: undefined,\n props: rest,\n libraryProps: {\n \"aria-orientation\": orientation,\n \"data-orientation\": orientation,\n },\n });\n}\n\nToolbarSeparator.displayName = \"ToolbarSeparator\";\n"],"mappings":";;;;;;;;;;AA2BA,SAAgB,iBAAiB,EAAE,WAAW,OAAO,QAAQ,GAAG,QAA+B;CAE7F,MAAM,cADU,kBAER,CAAC,EAAE,gBAAgB,aAAa,eAAe;CAGvD,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA,OAAA,EALqC,YAKjC;EACJ;EACA;EACA,UAAU,KAAA;EACV,OAAO;EACP,cAAc;GACZ,oBAAoB;GACpB,oBAAoB;EACtB;CACF,CAAC;AACH;AAEA,iBAAiB,cAAc"}
|
package/dist/tooltip/index.d.mts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import "../internal/platform-attributes.mjs";
|
|
2
|
-
import { TooltipAlign,
|
|
3
|
-
import {
|
|
2
|
+
import { TooltipAlign, TooltipProvides, TooltipSide } from "./tooltip-context.mjs";
|
|
3
|
+
import { TooltipArrow, TooltipArrowProps, TooltipArrowState } from "./tooltip-arrow.mjs";
|
|
4
|
+
import { TooltipPopup, TooltipPopupProps, TooltipPopupState } from "./tooltip-popup.mjs";
|
|
4
5
|
import { TooltipRoot, TooltipRootProps, TooltipRootState } from "./tooltip-root.mjs";
|
|
5
6
|
import { TooltipTrigger, TooltipTriggerProps, TooltipTriggerState } from "./tooltip-trigger.mjs";
|
|
6
7
|
//#region src/tooltip/index.d.ts
|
|
7
8
|
/**
|
|
8
9
|
* Tooltip (WAI-ARIA APG Tooltip pattern): `Root` (no DOM) owns the id and the interaction,
|
|
9
10
|
* `Trigger` (button) is hovered or focused, `Popup` (`div[popover] role="tooltip"`) lives in the
|
|
10
|
-
* top layer and is placed with CSS Anchor Positioning
|
|
11
|
-
*
|
|
11
|
+
* top layer and is placed with CSS Anchor Positioning, `Arrow` (decorative `span`) echoes the
|
|
12
|
+
* Popup's resolved side. Open state is browser-owned: no `open` prop, no action, style with
|
|
13
|
+
* `:popover-open`. Render the Popup immediately after the Trigger.
|
|
12
14
|
*/
|
|
13
15
|
export declare const Tooltip: {
|
|
14
16
|
readonly Root: typeof TooltipRoot;
|
|
15
17
|
readonly Trigger: typeof TooltipTrigger;
|
|
16
18
|
readonly Popup: typeof TooltipPopup;
|
|
19
|
+
readonly Arrow: typeof TooltipArrow;
|
|
17
20
|
};
|
|
18
21
|
//#endregion
|
|
19
|
-
export type { TooltipAlign, TooltipPopupProps, TooltipPopupState, TooltipProvides, TooltipRootProps, TooltipRootState, TooltipSide, TooltipTriggerProps, TooltipTriggerState };
|
|
22
|
+
export type { TooltipAlign, TooltipArrowProps, TooltipArrowState, TooltipPopupProps, TooltipPopupState, TooltipProvides, TooltipRootProps, TooltipRootState, TooltipSide, TooltipTriggerProps, TooltipTriggerState };
|
|
20
23
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/tooltip/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/tooltip/index.ts"],"mappings":";;;;;;;;;;;;;;qBAea;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,cAAK"}
|
package/dist/tooltip/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TooltipArrow } from "./tooltip-arrow.mjs";
|
|
1
2
|
import { TooltipPopup } from "./tooltip-popup.mjs";
|
|
2
3
|
import { TooltipRoot } from "./tooltip-root.mjs";
|
|
3
4
|
import { TooltipTrigger } from "./tooltip-trigger.mjs";
|
|
@@ -5,13 +6,15 @@ import { TooltipTrigger } from "./tooltip-trigger.mjs";
|
|
|
5
6
|
/**
|
|
6
7
|
* Tooltip (WAI-ARIA APG Tooltip pattern): `Root` (no DOM) owns the id and the interaction,
|
|
7
8
|
* `Trigger` (button) is hovered or focused, `Popup` (`div[popover] role="tooltip"`) lives in the
|
|
8
|
-
* top layer and is placed with CSS Anchor Positioning
|
|
9
|
-
*
|
|
9
|
+
* top layer and is placed with CSS Anchor Positioning, `Arrow` (decorative `span`) echoes the
|
|
10
|
+
* Popup's resolved side. Open state is browser-owned: no `open` prop, no action, style with
|
|
11
|
+
* `:popover-open`. Render the Popup immediately after the Trigger.
|
|
10
12
|
*/
|
|
11
13
|
const Tooltip = {
|
|
12
14
|
Root: TooltipRoot,
|
|
13
15
|
Trigger: TooltipTrigger,
|
|
14
|
-
Popup: TooltipPopup
|
|
16
|
+
Popup: TooltipPopup,
|
|
17
|
+
Arrow: TooltipArrow
|
|
15
18
|
};
|
|
16
19
|
//#endregion
|
|
17
20
|
export { Tooltip };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/tooltip/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 { TooltipPopup } from \"./tooltip-popup.js\";\nimport { TooltipRoot } from \"./tooltip-root.js\";\nimport { TooltipTrigger } from \"./tooltip-trigger.js\";\n\n/**\n * Tooltip (WAI-ARIA APG Tooltip pattern): `Root` (no DOM) owns the id and the interaction,\n * `Trigger` (button) is hovered or focused, `Popup` (`div[popover] role=\"tooltip\"`) lives in the\n * top layer and is placed with CSS Anchor Positioning. Open state is browser-owned: no `open
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/tooltip/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 { TooltipArrow } from \"./tooltip-arrow.js\";\nimport { TooltipPopup } from \"./tooltip-popup.js\";\nimport { TooltipRoot } from \"./tooltip-root.js\";\nimport { TooltipTrigger } from \"./tooltip-trigger.js\";\n\n/**\n * Tooltip (WAI-ARIA APG Tooltip pattern): `Root` (no DOM) owns the id and the interaction,\n * `Trigger` (button) is hovered or focused, `Popup` (`div[popover] role=\"tooltip\"`) lives in the\n * top layer and is placed with CSS Anchor Positioning, `Arrow` (decorative `span`) echoes the\n * Popup's resolved side. Open state is browser-owned: no `open` prop, no action, style with\n * `:popover-open`. Render the Popup immediately after the Trigger.\n */\nexport const Tooltip = {\n Root: TooltipRoot,\n Trigger: TooltipTrigger,\n Popup: TooltipPopup,\n Arrow: TooltipArrow,\n} as const;\n\nexport type { TooltipRootProps, TooltipRootState, TooltipProvides } from \"./tooltip-root.js\";\nexport type { TooltipTriggerProps, TooltipTriggerState } from \"./tooltip-trigger.js\";\nexport type {\n TooltipPopupProps,\n TooltipPopupState,\n TooltipSide,\n TooltipAlign,\n} from \"./tooltip-popup.js\";\nexport type { TooltipArrowProps, TooltipArrowState } from \"./tooltip-arrow.js\";\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,UAAU;CACrB,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;AACT"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { TooltipAlign, TooltipSide } from "./tooltip-context.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/tooltip/tooltip-arrow.d.ts
|
|
5
|
+
export interface TooltipArrowState {
|
|
6
|
+
/** The Popup's side: resolved while shown (after any flip), requested otherwise. */
|
|
7
|
+
readonly side: TooltipSide | null;
|
|
8
|
+
readonly align: TooltipAlign;
|
|
9
|
+
}
|
|
10
|
+
export interface TooltipArrowProps extends Omit<ComponentPropsWithRef<"span">, "aria-hidden" | "className" | "style" | "children"> {
|
|
11
|
+
className?: StateValue<string | undefined, TooltipArrowState>;
|
|
12
|
+
style?: StateValue<CSSProperties | undefined, TooltipArrowState>;
|
|
13
|
+
children?: StateValue<ReactNode, TooltipArrowState>;
|
|
14
|
+
render?: RenderProp<ComponentPropsWithRef<"span">, TooltipArrowState>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A decorative `<span aria-hidden="true">` inside `Tooltip.Popup` that draws nothing itself: it
|
|
18
|
+
* echoes the Popup's `data-side` / `data-align`, which are the **resolved** placement while the
|
|
19
|
+
* tooltip is shown (design 7.4), so CSS keyed on `[data-side]` puts it on the edge that faces the
|
|
20
|
+
* trigger, after a `position-try-fallbacks` flip as well.
|
|
21
|
+
*
|
|
22
|
+
* Owned keys (conventions 1.2): `aria-hidden`, and `data-side` / `data-align` unless the Popup's
|
|
23
|
+
* `side` is `null`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function TooltipArrow({ className, style, children, render, ...rest }: TooltipArrowProps): ReactNode;
|
|
26
|
+
export declare namespace TooltipArrow {
|
|
27
|
+
var displayName: string;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//# sourceMappingURL=tooltip-arrow.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip-arrow.d.mts","names":[],"sources":["../../src/tooltip/tooltip-arrow.tsx"],"mappings":";;;;iBASiB;;WAEN,MAAM;WACN,OAAO;;iBAGD,0BAA0B,KACzC;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,+BAA+B;;;;;;;;;;;wBAYrC,eAAe,WAAW,OAAO,UAAU,WAAW,QAAQ,oBAAiB;yBAA/E"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { TooltipPopupContext } from "./tooltip-context.mjs";
|
|
4
|
+
import { use } from "react";
|
|
5
|
+
//#region src/tooltip/tooltip-arrow.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A decorative `<span aria-hidden="true">` inside `Tooltip.Popup` that draws nothing itself: it
|
|
8
|
+
* echoes the Popup's `data-side` / `data-align`, which are the **resolved** placement while the
|
|
9
|
+
* tooltip is shown (design 7.4), so CSS keyed on `[data-side]` puts it on the edge that faces the
|
|
10
|
+
* trigger, after a `position-try-fallbacks` flip as well.
|
|
11
|
+
*
|
|
12
|
+
* Owned keys (conventions 1.2): `aria-hidden`, and `data-side` / `data-align` unless the Popup's
|
|
13
|
+
* `side` is `null`.
|
|
14
|
+
*/
|
|
15
|
+
function TooltipArrow({ className, style, children, render, ...rest }) {
|
|
16
|
+
const placement = use(TooltipPopupContext);
|
|
17
|
+
if (placement === null) throw new Error("Tooltip.Arrow must be rendered inside a Tooltip.Popup.");
|
|
18
|
+
const { side, align } = placement;
|
|
19
|
+
const state = {
|
|
20
|
+
side,
|
|
21
|
+
align
|
|
22
|
+
};
|
|
23
|
+
const libraryProps = {
|
|
24
|
+
"aria-hidden": true,
|
|
25
|
+
...side !== null && {
|
|
26
|
+
"data-side": side,
|
|
27
|
+
"data-align": align
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return useRender({
|
|
31
|
+
defaultElement: "span",
|
|
32
|
+
render,
|
|
33
|
+
state,
|
|
34
|
+
className,
|
|
35
|
+
style,
|
|
36
|
+
children,
|
|
37
|
+
props: rest,
|
|
38
|
+
libraryProps
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
TooltipArrow.displayName = "TooltipArrow";
|
|
42
|
+
//#endregion
|
|
43
|
+
export { TooltipArrow };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=tooltip-arrow.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip-arrow.mjs","names":[],"sources":["../../src/tooltip/tooltip-arrow.tsx"],"sourcesContent":["\"use client\";\nimport { use } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { TooltipPopupContext } from \"./tooltip-context.js\";\nimport type { TooltipAlign, TooltipSide } from \"./tooltip-context.js\";\n\nexport interface TooltipArrowState {\n /** The Popup's side: resolved while shown (after any flip), requested otherwise. */\n readonly side: TooltipSide | null;\n readonly align: TooltipAlign;\n}\n\nexport interface TooltipArrowProps extends Omit<\n ComponentPropsWithRef<\"span\">,\n \"aria-hidden\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, TooltipArrowState>;\n style?: StateValue<CSSProperties | undefined, TooltipArrowState>;\n children?: StateValue<ReactNode, TooltipArrowState>;\n render?: RenderProp<ComponentPropsWithRef<\"span\">, TooltipArrowState>;\n}\n\n/**\n * A decorative `<span aria-hidden=\"true\">` inside `Tooltip.Popup` that draws nothing itself: it\n * echoes the Popup's `data-side` / `data-align`, which are the **resolved** placement while the\n * tooltip is shown (design 7.4), so CSS keyed on `[data-side]` puts it on the edge that faces the\n * trigger, after a `position-try-fallbacks` flip as well.\n *\n * Owned keys (conventions 1.2): `aria-hidden`, and `data-side` / `data-align` unless the Popup's\n * `side` is `null`.\n */\nexport function TooltipArrow({ className, style, children, render, ...rest }: TooltipArrowProps) {\n const placement = use(TooltipPopupContext);\n if (placement === null) {\n throw new Error(\"Tooltip.Arrow must be rendered inside a Tooltip.Popup.\");\n }\n const { side, align } = placement;\n const state: TooltipArrowState = { side, align };\n\n const libraryProps: ComponentPropsWithRef<\"span\"> & DataAttributes = {\n \"aria-hidden\": true,\n ...(side !== null && { \"data-side\": side, \"data-align\": align }),\n };\n\n return useRender<ComponentPropsWithRef<\"span\">, TooltipArrowState>({\n defaultElement: \"span\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n });\n}\n\nTooltipArrow.displayName = \"TooltipArrow\";\n"],"mappings":";;;;;;;;;;;;;;AAkCA,SAAgB,aAAa,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,QAA2B;CAC/F,MAAM,YAAY,IAAI,mBAAmB;CACzC,IAAI,cAAc,MAChB,MAAM,IAAI,MAAM,wDAAwD;CAE1E,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,QAA2B;EAAE;EAAM;CAAM;CAE/C,MAAM,eAA+D;EACnE,eAAe;EACf,GAAI,SAAS,QAAQ;GAAE,aAAa;GAAM,cAAc;EAAM;CAChE;CAEA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;CACF,CAAC;AACH;AAEA,aAAa,cAAc"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { AnchorAlign, AnchorSide } from "../internal/anchor-position.mjs";
|
|
1
2
|
//#region src/tooltip/tooltip-context.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* `inline-start` / `inline-end` follow the popup's `direction` (wave 11; conventions 13.1). While
|
|
5
|
+
* shown, the state carries the resolved physical side.
|
|
6
|
+
*/
|
|
7
|
+
export type TooltipSide = AnchorSide;
|
|
8
|
+
export type TooltipAlign = AnchorAlign;
|
|
2
9
|
/** Which accessibility relation the tooltip provides for its trigger (design section 5.1). */
|
|
3
10
|
export type TooltipProvides = "description" | "name";
|
|
4
11
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-context.d.mts","names":[],"sources":["../../src/tooltip/tooltip-context.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"tooltip-context.d.mts","names":[],"sources":["../../src/tooltip/tooltip-context.ts"],"mappings":";;;;;;YAQY,cAAc;YACd,eAAe;;YAGf"}
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
import { createContext, use } from "react";
|
|
3
3
|
//#region src/tooltip/tooltip-context.ts
|
|
4
4
|
const TooltipContext = createContext(null);
|
|
5
|
+
const TooltipPopupContext = createContext(null);
|
|
5
6
|
function useTooltipContext(part) {
|
|
6
7
|
const context = use(TooltipContext);
|
|
7
8
|
if (context === null) throw new Error(`${part} must be rendered inside a Tooltip.Root.`);
|
|
8
9
|
return context;
|
|
9
10
|
}
|
|
10
11
|
//#endregion
|
|
11
|
-
export { TooltipContext, useTooltipContext };
|
|
12
|
+
export { TooltipContext, TooltipPopupContext, useTooltipContext };
|
|
12
13
|
|
|
13
14
|
//# sourceMappingURL=tooltip-context.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-context.mjs","names":[],"sources":["../../src/tooltip/tooltip-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\n\n/** Which accessibility relation the tooltip provides for its trigger (design section 5.1). */\nexport type TooltipProvides = \"description\" | \"name\";\n\nexport interface TooltipContextValue {\n /** Id of the Popup; the Trigger references it through `aria-describedby` / `aria-labelledby`. */\n readonly popupId: string;\n readonly disabled: boolean;\n /** Written onto the Trigger as `interest-delay-start` / `-end` on the native path. */\n readonly delay: number;\n readonly closeDelay: number;\n readonly provides: TooltipProvides;\n /** Trigger and Popup register their elements through callback refs (design 12.2). */\n readonly setTriggerElement: (element: HTMLElement | null) => void;\n readonly setPopupElement: (element: HTMLElement | null) => void;\n /**\n * The Trigger reports whether it renders `interestfor`, so the Root's interaction effect re-runs\n * (and re-detects the native path) when `experimental_interestFor` changes after mount.\n */\n readonly setInterestForRequested: (requested: boolean) => void;\n}\n\nexport const TooltipContext = createContext<TooltipContextValue | null>(null);\n\nexport function useTooltipContext(part: string): TooltipContextValue {\n const context = use(TooltipContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Tooltip.Root.`);\n }\n return context;\n}\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"tooltip-context.mjs","names":[],"sources":["../../src/tooltip/tooltip-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { AnchorAlign, AnchorSide } from \"../internal/anchor-position.js\";\n\n/**\n * `inline-start` / `inline-end` follow the popup's `direction` (wave 11; conventions 13.1). While\n * shown, the state carries the resolved physical side.\n */\nexport type TooltipSide = AnchorSide;\nexport type TooltipAlign = AnchorAlign;\n\n/** Which accessibility relation the tooltip provides for its trigger (design section 5.1). */\nexport type TooltipProvides = \"description\" | \"name\";\n\nexport interface TooltipContextValue {\n /** Id of the Popup; the Trigger references it through `aria-describedby` / `aria-labelledby`. */\n readonly popupId: string;\n readonly disabled: boolean;\n /** Written onto the Trigger as `interest-delay-start` / `-end` on the native path. */\n readonly delay: number;\n readonly closeDelay: number;\n readonly provides: TooltipProvides;\n /** Trigger and Popup register their elements through callback refs (design 12.2). */\n readonly setTriggerElement: (element: HTMLElement | null) => void;\n readonly setPopupElement: (element: HTMLElement | null) => void;\n /**\n * The Trigger reports whether it renders `interestfor`, so the Root's interaction effect re-runs\n * (and re-detects the native path) when `experimental_interestFor` changes after mount.\n */\n readonly setInterestForRequested: (requested: boolean) => void;\n}\n\nexport const TooltipContext = createContext<TooltipContextValue | null>(null);\n\n/** What `Tooltip.Popup` tells its `Tooltip.Arrow`: the placement it renders (design 12.2). */\nexport interface TooltipPopupContextValue {\n /** The resolved side while shown, else the requested one; `null` with `side={null}`. */\n readonly side: TooltipSide | null;\n readonly align: TooltipAlign;\n}\n\nexport const TooltipPopupContext = createContext<TooltipPopupContextValue | null>(null);\n\nexport function useTooltipContext(part: string): TooltipContextValue {\n const context = use(TooltipContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Tooltip.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AAgCA,MAAa,iBAAiB,cAA0C,IAAI;AAS5E,MAAa,sBAAsB,cAA+C,IAAI;AAEtF,SAAgB,kBAAkB,MAAmC;CACnE,MAAM,UAAU,IAAI,cAAc;CAClC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,yCAAyC;CAEnE,OAAO;AACT"}
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { TooltipAlign, TooltipSide } from "./tooltip-context.mjs";
|
|
2
3
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
3
4
|
//#region src/tooltip/tooltip-popup.d.ts
|
|
4
|
-
export type TooltipSide = "top" | "bottom" | "left" | "right";
|
|
5
|
-
export type TooltipAlign = "start" | "center" | "end";
|
|
6
5
|
export interface TooltipPopupState {
|
|
7
6
|
readonly disabled: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* While shown: the physical side the browser placed the popup on (`"top"` / `"bottom"` /
|
|
9
|
+
* `"left"` / `"right"`, after any fallback flip). Otherwise the `side` prop. `null` with
|
|
10
|
+
* `side={null}`.
|
|
11
|
+
*/
|
|
8
12
|
readonly side: TooltipSide | null;
|
|
13
|
+
/** While shown: the resolved alignment; otherwise the `align` prop. */
|
|
9
14
|
readonly align: TooltipAlign;
|
|
10
15
|
}
|
|
11
16
|
export interface TooltipPopupProps extends Omit<ComponentPropsWithRef<"div">, "id" | "popover" | "role" | "className" | "style" | "children"> {
|
|
12
17
|
/**
|
|
13
18
|
* Placement relative to the trigger through inline `position-area`, with
|
|
14
|
-
* `position-try-fallbacks` flipping it when it does not fit. Default `"top"`. `
|
|
15
|
-
* inline
|
|
19
|
+
* `position-try-fallbacks` flipping it when it does not fit. Default `"top"`. `"inline-start"` /
|
|
20
|
+
* `"inline-end"` follow the popup's direction. `null` emits no inline positioning (and no
|
|
21
|
+
* `data-side` / `data-align`), so a stylesheet owns placement.
|
|
16
22
|
*/
|
|
17
23
|
side?: TooltipSide | null;
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Alignment along the side. Default `"center"`. On a top / bottom side `start` / `end` are
|
|
26
|
+
* inline-relative (mirrored under `direction: rtl`); on the other sides they are the top /
|
|
27
|
+
* bottom edges. Ignored when `side` is `null`.
|
|
28
|
+
*/
|
|
19
29
|
align?: TooltipAlign;
|
|
20
30
|
/**
|
|
21
31
|
* Experimental (Chrome 151+, Firefox 153+; Safari 27.0 treats it as `"manual"`). Renders
|
|
@@ -38,12 +48,23 @@ export interface TooltipPopupProps extends Omit<ComponentPropsWithRef<"div">, "i
|
|
|
38
48
|
* anchored to the trigger implicitly (`interestfor` or `showPopover({ source })`). Open state is
|
|
39
49
|
* browser-owned: style it with `:popover-open` and animate it with `@starting-style` in CSS.
|
|
40
50
|
*
|
|
51
|
+
* `data-side` / `data-align` are where the browser placed the popup while it is shown (the
|
|
52
|
+
* `position-try-fallbacks` option it applied, read from the computed `position-area`;
|
|
53
|
+
* conventions 13.2) and the requested values otherwise; `Tooltip.Arrow` echoes them.
|
|
54
|
+
*
|
|
55
|
+
* `data-instant` is present while the tooltip is shown by an open that began while another
|
|
56
|
+
* `[role="tooltip"]:popover-open` existed (a warm open, skip-delay), so
|
|
57
|
+
* `[data-instant] { transition: none }` skips its entry animation. Not rendered by this part: the
|
|
58
|
+
* Root's effect writes it on the element from the popup's `beforetoggle` (on both paths), before
|
|
59
|
+
* the open's first style recalc, and removes it at the close's. No `state` counterpart.
|
|
60
|
+
*
|
|
41
61
|
* Owned keys (conventions 1.2): `id`, `popover`, `role`, `data-disabled`, and `data-side` /
|
|
42
62
|
* `data-align` unless `side` is `null`.
|
|
43
63
|
*/
|
|
44
|
-
export declare function TooltipPopup({ side, align, experimental_hint, className, style, children, render, ...rest }: TooltipPopupProps):
|
|
64
|
+
export declare function TooltipPopup({ side: sideProp, align: alignProp, experimental_hint, className, style, children, render, ...rest }: TooltipPopupProps): import("react").JSX.Element;
|
|
45
65
|
export declare namespace TooltipPopup {
|
|
46
66
|
var displayName: string;
|
|
47
67
|
}
|
|
48
68
|
//#endregion
|
|
69
|
+
export type { TooltipAlign, TooltipSide };
|
|
49
70
|
//# sourceMappingURL=tooltip-popup.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-popup.d.mts","names":[],"sources":["../../src/tooltip/tooltip-popup.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tooltip-popup.d.mts","names":[],"sources":["../../src/tooltip/tooltip-popup.tsx"],"mappings":";;;;iBAeiB;WACN;;;;;;WAMA,MAAM;;WAEN,OAAO;;iBAGD,0BAA0B,KACzC;;;;;;;EASA,OAAO;;;;;;EAMP,QAAQ;;;;;;;EAOR;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;;;;EAK9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;;;;;;;;;;wBAqBpC,eACd,MAAM,UACN,OAAO,WACP,mBACA,WACA,OACA,UACA,WACG,QACF,oCAAiB,IAAA;yBATJ"}
|
|
@@ -1,24 +1,49 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { mergeRefs } from "../internal/merge-props.mjs";
|
|
4
|
+
import { resolveStateValue } from "../internal/render-element.mjs";
|
|
5
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
6
|
+
import { TooltipPopupContext, useTooltipContext } from "./tooltip-context.mjs";
|
|
4
7
|
import { POSITION_TRY_FALLBACKS, positionArea } from "../internal/anchor-position.mjs";
|
|
5
|
-
import {
|
|
8
|
+
import { useResolvedPlacement } from "../internal/use-resolved-placement.mjs";
|
|
9
|
+
import { useMemo } from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
11
|
//#region src/tooltip/tooltip-popup.tsx
|
|
7
12
|
/**
|
|
8
13
|
* The tooltip content: a `div` with `popover` and `role="tooltip"`, shown in the top layer and
|
|
9
14
|
* anchored to the trigger implicitly (`interestfor` or `showPopover({ source })`). Open state is
|
|
10
15
|
* browser-owned: style it with `:popover-open` and animate it with `@starting-style` in CSS.
|
|
11
16
|
*
|
|
17
|
+
* `data-side` / `data-align` are where the browser placed the popup while it is shown (the
|
|
18
|
+
* `position-try-fallbacks` option it applied, read from the computed `position-area`;
|
|
19
|
+
* conventions 13.2) and the requested values otherwise; `Tooltip.Arrow` echoes them.
|
|
20
|
+
*
|
|
21
|
+
* `data-instant` is present while the tooltip is shown by an open that began while another
|
|
22
|
+
* `[role="tooltip"]:popover-open` existed (a warm open, skip-delay), so
|
|
23
|
+
* `[data-instant] { transition: none }` skips its entry animation. Not rendered by this part: the
|
|
24
|
+
* Root's effect writes it on the element from the popup's `beforetoggle` (on both paths), before
|
|
25
|
+
* the open's first style recalc, and removes it at the close's. No `state` counterpart.
|
|
26
|
+
*
|
|
12
27
|
* Owned keys (conventions 1.2): `id`, `popover`, `role`, `data-disabled`, and `data-side` /
|
|
13
28
|
* `data-align` unless `side` is `null`.
|
|
14
29
|
*/
|
|
15
|
-
function TooltipPopup({ side = "top", align = "center", experimental_hint = false, className, style, children, render, ...rest }) {
|
|
30
|
+
function TooltipPopup({ side: sideProp = "top", align: alignProp = "center", experimental_hint = false, className, style, children, render, ...rest }) {
|
|
16
31
|
const ctx = useTooltipContext("Tooltip.Popup");
|
|
32
|
+
const placement = useResolvedPlacement({
|
|
33
|
+
side: sideProp,
|
|
34
|
+
align: alignProp
|
|
35
|
+
});
|
|
36
|
+
const { side, align } = placement;
|
|
17
37
|
const state = {
|
|
18
38
|
disabled: ctx.disabled,
|
|
19
39
|
side,
|
|
20
40
|
align
|
|
21
41
|
};
|
|
42
|
+
const arrow = useMemo(() => ({
|
|
43
|
+
side,
|
|
44
|
+
align
|
|
45
|
+
}), [side, align]);
|
|
46
|
+
const ref = useMemo(() => mergeRefs(ctx.setPopupElement, placement.ref), [ctx.setPopupElement, placement.ref]);
|
|
22
47
|
const libraryProps = {
|
|
23
48
|
id: ctx.popupId,
|
|
24
49
|
popover: experimental_hint ? "hint" : "manual",
|
|
@@ -29,20 +54,24 @@ function TooltipPopup({ side = "top", align = "center", experimental_hint = fals
|
|
|
29
54
|
"data-align": align
|
|
30
55
|
}
|
|
31
56
|
};
|
|
32
|
-
|
|
57
|
+
const element = useRender({
|
|
33
58
|
defaultElement: "div",
|
|
34
59
|
render,
|
|
35
60
|
state,
|
|
36
61
|
className,
|
|
37
|
-
style:
|
|
38
|
-
positionArea: positionArea(
|
|
62
|
+
style: sideProp === null ? style : (s) => ({
|
|
63
|
+
positionArea: positionArea(sideProp, alignProp),
|
|
39
64
|
positionTryFallbacks: POSITION_TRY_FALLBACKS,
|
|
40
65
|
...resolveStateValue(style, s)
|
|
41
66
|
}),
|
|
42
67
|
children,
|
|
43
68
|
props: rest,
|
|
44
69
|
libraryProps,
|
|
45
|
-
ref
|
|
70
|
+
ref
|
|
71
|
+
});
|
|
72
|
+
return /* @__PURE__ */ jsx(TooltipPopupContext, {
|
|
73
|
+
value: arrow,
|
|
74
|
+
children: element
|
|
46
75
|
});
|
|
47
76
|
}
|
|
48
77
|
TooltipPopup.displayName = "TooltipPopup";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-popup.mjs","names":[],"sources":["../../src/tooltip/tooltip-popup.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { POSITION_TRY_FALLBACKS, positionArea } from \"../internal/anchor-position.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { useTooltipContext } from \"./tooltip-context.js\";\
|
|
1
|
+
{"version":3,"file":"tooltip-popup.mjs","names":[],"sources":["../../src/tooltip/tooltip-popup.tsx"],"sourcesContent":["\"use client\";\nimport { useMemo } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { POSITION_TRY_FALLBACKS, positionArea } from \"../internal/anchor-position.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { mergeRefs } from \"../internal/merge-props.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useResolvedPlacement } from \"../internal/use-resolved-placement.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { TooltipPopupContext, useTooltipContext } from \"./tooltip-context.js\";\nimport type { TooltipAlign, TooltipPopupContextValue, TooltipSide } from \"./tooltip-context.js\";\n\nexport type { TooltipAlign, TooltipSide } from \"./tooltip-context.js\";\n\nexport interface TooltipPopupState {\n readonly disabled: boolean;\n /**\n * While shown: the physical side the browser placed the popup on (`\"top\"` / `\"bottom\"` /\n * `\"left\"` / `\"right\"`, after any fallback flip). Otherwise the `side` prop. `null` with\n * `side={null}`.\n */\n readonly side: TooltipSide | null;\n /** While shown: the resolved alignment; otherwise the `align` prop. */\n readonly align: TooltipAlign;\n}\n\nexport interface TooltipPopupProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"id\" | \"popover\" | \"role\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Placement relative to the trigger through inline `position-area`, with\n * `position-try-fallbacks` flipping it when it does not fit. Default `\"top\"`. `\"inline-start\"` /\n * `\"inline-end\"` follow the popup's direction. `null` emits no inline positioning (and no\n * `data-side` / `data-align`), so a stylesheet owns placement.\n */\n side?: TooltipSide | null;\n /**\n * Alignment along the side. Default `\"center\"`. On a top / bottom side `start` / `end` are\n * inline-relative (mirrored under `direction: rtl`); on the other sides they are the top /\n * bottom edges. Ignored when `side` is `null`.\n */\n align?: TooltipAlign;\n /**\n * Experimental (Chrome 151+, Firefox 153+; Safari 27.0 treats it as `\"manual\"`). Renders\n * `popover=\"hint\"` instead of `popover=\"manual\"`: native light dismiss, and the tooltip can\n * open over an `auto` popover (a menu) without closing it. The JS Escape / pointerdown handling\n * stays in place for engines that do not know `hint`. Default `false`.\n */\n experimental_hint?: boolean;\n className?: StateValue<string | undefined, TooltipPopupState>;\n style?: StateValue<CSSProperties | undefined, TooltipPopupState>;\n /**\n * Rendered at mount (hidden by the popover's `display: none`), not at open time. Tooltip\n * content should be static; if it must suspend, put the `<Suspense>` boundary inside the Popup.\n */\n children?: StateValue<ReactNode, TooltipPopupState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, TooltipPopupState>;\n}\n\n/**\n * The tooltip content: a `div` with `popover` and `role=\"tooltip\"`, shown in the top layer and\n * anchored to the trigger implicitly (`interestfor` or `showPopover({ source })`). Open state is\n * browser-owned: style it with `:popover-open` and animate it with `@starting-style` in CSS.\n *\n * `data-side` / `data-align` are where the browser placed the popup while it is shown (the\n * `position-try-fallbacks` option it applied, read from the computed `position-area`;\n * conventions 13.2) and the requested values otherwise; `Tooltip.Arrow` echoes them.\n *\n * `data-instant` is present while the tooltip is shown by an open that began while another\n * `[role=\"tooltip\"]:popover-open` existed (a warm open, skip-delay), so\n * `[data-instant] { transition: none }` skips its entry animation. Not rendered by this part: the\n * Root's effect writes it on the element from the popup's `beforetoggle` (on both paths), before\n * the open's first style recalc, and removes it at the close's. No `state` counterpart.\n *\n * Owned keys (conventions 1.2): `id`, `popover`, `role`, `data-disabled`, and `data-side` /\n * `data-align` unless `side` is `null`.\n */\nexport function TooltipPopup({\n side: sideProp = \"top\",\n align: alignProp = \"center\",\n experimental_hint = false,\n className,\n style,\n children,\n render,\n ...rest\n}: TooltipPopupProps) {\n const ctx = useTooltipContext(\"Tooltip.Popup\");\n const placement = useResolvedPlacement({ side: sideProp, align: alignProp });\n const { side, align } = placement;\n const state: TooltipPopupState = { disabled: ctx.disabled, side, align };\n const arrow = useMemo<TooltipPopupContextValue>(() => ({ side, align }), [side, align]);\n const ref = useMemo(\n () => mergeRefs(ctx.setPopupElement, placement.ref),\n [ctx.setPopupElement, placement.ref],\n );\n\n const libraryProps: ComponentPropsWithRef<\"div\"> & DataAttributes = {\n id: ctx.popupId,\n popover: experimental_hint ? \"hint\" : \"manual\",\n role: \"tooltip\",\n \"data-disabled\": dataAttr(ctx.disabled),\n // Not owned with `side={null}`: the stylesheet (or a render element) may set them.\n ...(side !== null && { \"data-side\": side, \"data-align\": align }),\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, TooltipPopupState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n // The inline placement is the requested one (the browser keeps choosing from it) and sits\n // under the consumer's style: the consumer wins (design 3).\n style:\n sideProp === null\n ? style\n : (s) => ({\n positionArea: positionArea(sideProp, alignProp),\n positionTryFallbacks: POSITION_TRY_FALLBACKS,\n ...resolveStateValue(style, s),\n }),\n children,\n props: rest,\n libraryProps,\n ref,\n });\n\n return <TooltipPopupContext value={arrow}>{element}</TooltipPopupContext>;\n}\n\nTooltipPopup.displayName = \"TooltipPopup\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,SAAgB,aAAa,EAC3B,MAAM,WAAW,OACjB,OAAO,YAAY,UACnB,oBAAoB,OACpB,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,YAAY,qBAAqB;EAAE,MAAM;EAAU,OAAO;CAAU,CAAC;CAC3E,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,QAA2B;EAAE,UAAU,IAAI;EAAU;EAAM;CAAM;CACvE,MAAM,QAAQ,eAAyC;EAAE;EAAM;CAAM,IAAI,CAAC,MAAM,KAAK,CAAC;CACtF,MAAM,MAAM,cACJ,UAAU,IAAI,iBAAiB,UAAU,GAAG,GAClD,CAAC,IAAI,iBAAiB,UAAU,GAAG,CACrC;CAEA,MAAM,eAA8D;EAClE,IAAI,IAAI;EACR,SAAS,oBAAoB,SAAS;EACtC,MAAM;EACN,iBAAiB,SAAS,IAAI,QAAQ;EAEtC,GAAI,SAAS,QAAQ;GAAE,aAAa;GAAM,cAAc;EAAM;CAChE;CAEA,MAAM,UAAU,UAA2D;EACzE,gBAAgB;EAChB;EACA;EACA;EAGA,OACE,aAAa,OACT,SACC,OAAO;GACN,cAAc,aAAa,UAAU,SAAS;GAC9C,sBAAsB;GACtB,GAAG,kBAAkB,OAAO,CAAC;EAC/B;EACN;EACA,OAAO;EACP;EACA;CACF,CAAC;CAED,OAAO,oBAAC,qBAAD;EAAqB,OAAO;EAAQ,UAAA;CAA6B,CAAA;AAC1E;AAEA,aAAa,cAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { resolveStateValue } from "../internal/
|
|
2
|
+
import { resolveStateValue } from "../internal/render-element.mjs";
|
|
3
3
|
import { TooltipContext } from "./tooltip-context.mjs";
|
|
4
4
|
import { useTooltipInteraction } from "./use-tooltip-interaction.mjs";
|
|
5
5
|
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
@@ -50,6 +50,22 @@ function TooltipRoot({ delay = 250, closeDelay = 150, disabled = false, provides
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
TooltipRoot.displayName = "TooltipRoot";
|
|
53
|
+
/**
|
|
54
|
+
* The containers that move focus among their items with the arrow keys (roving tabindex, or a
|
|
55
|
+
* native `focusgroup`): Menu, Tabs, Toolbar, a radio group, and the other APG composites, plus
|
|
56
|
+
* `role="group"`, which a standalone `ToggleGroup.Root` renders while its roving engine writes
|
|
57
|
+
* the Items' `tabindex` (#75, design/components/toggle-group.md 18).
|
|
58
|
+
*/
|
|
59
|
+
const COMPOSITE = "[role=\"menu\"],[role=\"menubar\"],[role=\"tablist\"],[role=\"toolbar\"],[role=\"group\"],[role=\"radiogroup\"],[role=\"listbox\"],[role=\"grid\"],[role=\"treegrid\"],[role=\"tree\"],[focusgroup]";
|
|
60
|
+
/**
|
|
61
|
+
* Whether keyboard users can focus the trigger: it is in the tab order, or it is a
|
|
62
|
+
* roving-tabindex item (`tabindex="-1"` set explicitly, so script can focus it) inside a
|
|
63
|
+
* composite widget that moves focus to it (#57).
|
|
64
|
+
*/
|
|
65
|
+
function isKeyboardReachable(trigger) {
|
|
66
|
+
if (trigger.tabIndex >= 0) return true;
|
|
67
|
+
return trigger.hasAttribute("tabindex") && trigger.parentElement?.closest(COMPOSITE) != null;
|
|
68
|
+
}
|
|
53
69
|
/** Development-only checks that need the mounted elements (design 12.5). Each fires once. */
|
|
54
70
|
function useTooltipDevWarnings(trigger, popup, provides) {
|
|
55
71
|
const warned = useRef({
|
|
@@ -65,7 +81,7 @@ function useTooltipDevWarnings(trigger, popup, provides) {
|
|
|
65
81
|
w.label = true;
|
|
66
82
|
console.error("[Tooltip] provides=\"name\" together with aria-label on the trigger announces the name twice. Remove aria-label.");
|
|
67
83
|
}
|
|
68
|
-
if (trigger
|
|
84
|
+
if (!isKeyboardReachable(trigger) && !w.focusable) {
|
|
69
85
|
w.focusable = true;
|
|
70
86
|
console.error("[Tooltip] The trigger is not focusable; keyboard users cannot open the tooltip. Render a <button> or a link, or set tabIndex={0}.");
|
|
71
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-root.mjs","names":[],"sources":["../../src/tooltip/tooltip-root.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { StateValue } from \"../internal/types.js\";\nimport { resolveStateValue } from \"../internal/use-render.js\";\nimport { TooltipContext } from \"./tooltip-context.js\";\nimport type { TooltipContextValue, TooltipProvides } from \"./tooltip-context.js\";\nimport { useTooltipInteraction } from \"./use-tooltip-interaction.js\";\n\nexport type { TooltipProvides } from \"./tooltip-context.js\";\n\nexport interface TooltipRootState {\n readonly disabled: boolean;\n}\n\nexport interface TooltipRootProps {\n /**\n * Milliseconds from hover or keyboard focus to open. Default 250 (Chromium's\n * `interest-delay-start`). The same delay applies to hover and focus.\n */\n delay?: number;\n /** Milliseconds from de-hover or blur to close. Default 150 (Chromium's `interest-delay-end`). */\n closeDelay?: number;\n /** When true the tooltip never opens. The ARIA relation stays in place. */\n disabled?: boolean;\n /**\n * Which accessibility relation the tooltip provides for the trigger.\n * `\"description\"` (default): `aria-describedby`, for triggers that have their own name.\n * `\"name\"`: `aria-labelledby`, for icon-only triggers; do not also set `aria-label`.\n */\n provides?: TooltipProvides;\n children?: StateValue<ReactNode, TooltipRootState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nconst FOCUSABLE =\n \"a[href],area[href],button,input,select,textarea,iframe,[tabindex],[contenteditable]\";\n\n/**\n * Owns the popup id, the options and the one interaction effect. Renders no DOM, so it has no\n * `ref`, `className` or `style`. The open state is browser-owned (the popover's top-layer state):\n * there is no `open` prop, no action, and no `data-open`; style with `:popover-open`.\n *\n * Render `Tooltip.Popup` immediately after `Tooltip.Trigger` in DOM order: the HTML spec\n * recommends that reading order for popovers, and some screen readers attach an adjacent tooltip\n * to the wrong control otherwise. This is documented, not enforced.\n */\nexport function TooltipRoot({\n delay = 250,\n closeDelay = 150,\n disabled = false,\n provides = \"description\",\n children,\n}: TooltipRootProps) {\n const popupId = useId();\n const [trigger, setTriggerElement] = useState<HTMLElement | null>(null);\n const [popup, setPopupElement] = useState<HTMLElement | null>(null);\n const [interestForRequested, setInterestForRequested] = useState(false);\n\n useTooltipInteraction(trigger, popup, { delay, closeDelay, disabled, interestForRequested });\n useTooltipDevWarnings(trigger, popup, provides);\n\n const context = useMemo<TooltipContextValue>(\n () => ({\n popupId,\n disabled,\n delay,\n closeDelay,\n provides,\n setTriggerElement,\n setPopupElement,\n setInterestForRequested,\n }),\n [popupId, disabled, delay, closeDelay, provides],\n );\n\n const state: TooltipRootState = { disabled };\n return <TooltipContext value={context}>{resolveStateValue(children, state)}</TooltipContext>;\n}\n\nTooltipRoot.displayName = \"TooltipRoot\";\n\n/** Development-only checks that need the mounted elements (design 12.5). Each fires once. */\nfunction useTooltipDevWarnings(\n trigger: HTMLElement | null,\n popup: HTMLElement | null,\n provides: TooltipProvides,\n): void {\n const warned = useRef({ label: false, focusable: false, interactive: false });\n useEffect(() => {\n if (!isDev) return;\n const w = warned.current;\n if (trigger !== null) {\n if (provides === \"name\" && trigger.hasAttribute(\"aria-label\") && !w.label) {\n w.label = true;\n console.error(\n '[Tooltip] provides=\"name\" together with aria-label on the trigger announces the name twice. Remove aria-label.',\n );\n }\n if (trigger
|
|
1
|
+
{"version":3,"file":"tooltip-root.mjs","names":[],"sources":["../../src/tooltip/tooltip-root.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { StateValue } from \"../internal/types.js\";\nimport { resolveStateValue } from \"../internal/use-render.js\";\nimport { TooltipContext } from \"./tooltip-context.js\";\nimport type { TooltipContextValue, TooltipProvides } from \"./tooltip-context.js\";\nimport { useTooltipInteraction } from \"./use-tooltip-interaction.js\";\n\nexport type { TooltipProvides } from \"./tooltip-context.js\";\n\nexport interface TooltipRootState {\n readonly disabled: boolean;\n}\n\nexport interface TooltipRootProps {\n /**\n * Milliseconds from hover or keyboard focus to open. Default 250 (Chromium's\n * `interest-delay-start`). The same delay applies to hover and focus.\n */\n delay?: number;\n /** Milliseconds from de-hover or blur to close. Default 150 (Chromium's `interest-delay-end`). */\n closeDelay?: number;\n /** When true the tooltip never opens. The ARIA relation stays in place. */\n disabled?: boolean;\n /**\n * Which accessibility relation the tooltip provides for the trigger.\n * `\"description\"` (default): `aria-describedby`, for triggers that have their own name.\n * `\"name\"`: `aria-labelledby`, for icon-only triggers; do not also set `aria-label`.\n */\n provides?: TooltipProvides;\n children?: StateValue<ReactNode, TooltipRootState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nconst FOCUSABLE =\n \"a[href],area[href],button,input,select,textarea,iframe,[tabindex],[contenteditable]\";\n\n/**\n * Owns the popup id, the options and the one interaction effect. Renders no DOM, so it has no\n * `ref`, `className` or `style`. The open state is browser-owned (the popover's top-layer state):\n * there is no `open` prop, no action, and no `data-open`; style with `:popover-open`.\n *\n * Render `Tooltip.Popup` immediately after `Tooltip.Trigger` in DOM order: the HTML spec\n * recommends that reading order for popovers, and some screen readers attach an adjacent tooltip\n * to the wrong control otherwise. This is documented, not enforced.\n */\nexport function TooltipRoot({\n delay = 250,\n closeDelay = 150,\n disabled = false,\n provides = \"description\",\n children,\n}: TooltipRootProps) {\n const popupId = useId();\n const [trigger, setTriggerElement] = useState<HTMLElement | null>(null);\n const [popup, setPopupElement] = useState<HTMLElement | null>(null);\n const [interestForRequested, setInterestForRequested] = useState(false);\n\n useTooltipInteraction(trigger, popup, { delay, closeDelay, disabled, interestForRequested });\n useTooltipDevWarnings(trigger, popup, provides);\n\n const context = useMemo<TooltipContextValue>(\n () => ({\n popupId,\n disabled,\n delay,\n closeDelay,\n provides,\n setTriggerElement,\n setPopupElement,\n setInterestForRequested,\n }),\n [popupId, disabled, delay, closeDelay, provides],\n );\n\n const state: TooltipRootState = { disabled };\n return <TooltipContext value={context}>{resolveStateValue(children, state)}</TooltipContext>;\n}\n\nTooltipRoot.displayName = \"TooltipRoot\";\n\n/**\n * The containers that move focus among their items with the arrow keys (roving tabindex, or a\n * native `focusgroup`): Menu, Tabs, Toolbar, a radio group, and the other APG composites, plus\n * `role=\"group\"`, which a standalone `ToggleGroup.Root` renders while its roving engine writes\n * the Items' `tabindex` (#75, design/components/toggle-group.md 18).\n */\nconst COMPOSITE =\n '[role=\"menu\"],[role=\"menubar\"],[role=\"tablist\"],[role=\"toolbar\"],[role=\"group\"],[role=\"radiogroup\"],[role=\"listbox\"],[role=\"grid\"],[role=\"treegrid\"],[role=\"tree\"],[focusgroup]';\n\n/**\n * Whether keyboard users can focus the trigger: it is in the tab order, or it is a\n * roving-tabindex item (`tabindex=\"-1\"` set explicitly, so script can focus it) inside a\n * composite widget that moves focus to it (#57).\n */\nfunction isKeyboardReachable(trigger: HTMLElement): boolean {\n if (trigger.tabIndex >= 0) return true;\n return trigger.hasAttribute(\"tabindex\") && trigger.parentElement?.closest(COMPOSITE) != null;\n}\n\n/** Development-only checks that need the mounted elements (design 12.5). Each fires once. */\nfunction useTooltipDevWarnings(\n trigger: HTMLElement | null,\n popup: HTMLElement | null,\n provides: TooltipProvides,\n): void {\n const warned = useRef({ label: false, focusable: false, interactive: false });\n useEffect(() => {\n if (!isDev) return;\n const w = warned.current;\n if (trigger !== null) {\n if (provides === \"name\" && trigger.hasAttribute(\"aria-label\") && !w.label) {\n w.label = true;\n console.error(\n '[Tooltip] provides=\"name\" together with aria-label on the trigger announces the name twice. Remove aria-label.',\n );\n }\n if (!isKeyboardReachable(trigger) && !w.focusable) {\n w.focusable = true;\n console.error(\n \"[Tooltip] The trigger is not focusable; keyboard users cannot open the tooltip. Render a <button> or a link, or set tabIndex={0}.\",\n );\n }\n }\n if (popup !== null && popup.querySelector(FOCUSABLE) !== null && !w.interactive) {\n w.interactive = true;\n console.error(\n \"[Tooltip] Tooltips must not contain interactive content. Use a non-modal dialog or a popover instead.\",\n );\n }\n }, [trigger, popup, provides]);\n}\n"],"mappings":";;;;;;;AAkCA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,MAAM,YACJ;;;;;;;;;;AAWF,SAAgB,YAAY,EAC1B,QAAQ,KACR,aAAa,KACb,WAAW,OACX,WAAW,eACX,YACmB;CACnB,MAAM,UAAU,MAAM;CACtB,MAAM,CAAC,SAAS,qBAAqB,SAA6B,IAAI;CACtE,MAAM,CAAC,OAAO,mBAAmB,SAA6B,IAAI;CAClE,MAAM,CAAC,sBAAsB,2BAA2B,SAAS,KAAK;CAEtE,sBAAsB,SAAS,OAAO;EAAE;EAAO;EAAY;EAAU;CAAqB,CAAC;CAC3F,sBAAsB,SAAS,OAAO,QAAQ;CAE9C,MAAM,UAAU,eACP;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EAAC;EAAS;EAAU;EAAO;EAAY;CAAQ,CACjD;CAGA,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAU,UAAA,kBAAkB,UAAU,EADlC,SACsC,CAAC;CAAkB,CAAA;AAC7F;AAEA,YAAY,cAAc;;;;;;;AAQ1B,MAAM,YACJ;;;;;;AAOF,SAAS,oBAAoB,SAA+B;CAC1D,IAAI,QAAQ,YAAY,GAAG,OAAO;CAClC,OAAO,QAAQ,aAAa,UAAU,KAAK,QAAQ,eAAe,QAAQ,SAAS,KAAK;AAC1F;;AAGA,SAAS,sBACP,SACA,OACA,UACM;CACN,MAAM,SAAS,OAAO;EAAE,OAAO;EAAO,WAAW;EAAO,aAAa;CAAM,CAAC;CAC5E,gBAAgB;EACd,IAAI,CAAC,OAAO;EACZ,MAAM,IAAI,OAAO;EACjB,IAAI,YAAY,MAAM;GACpB,IAAI,aAAa,UAAU,QAAQ,aAAa,YAAY,KAAK,CAAC,EAAE,OAAO;IACzE,EAAE,QAAQ;IACV,QAAQ,MACN,kHACF;GACF;GACA,IAAI,CAAC,oBAAoB,OAAO,KAAK,CAAC,EAAE,WAAW;IACjD,EAAE,YAAY;IACd,QAAQ,MACN,mIACF;GACF;EACF;EACA,IAAI,UAAU,QAAQ,MAAM,cAAc,SAAS,MAAM,QAAQ,CAAC,EAAE,aAAa;GAC/E,EAAE,cAAc;GAChB,QAAQ,MACN,uGACF;EACF;CACF,GAAG;EAAC;EAAS;EAAO;CAAQ,CAAC;AAC/B"}
|