@funstack/ui 0.1.0-alpha.0 → 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/README.md +1 -1
- 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 +24 -0
- package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -0
- package/dist/checkbox-group/checkbox-group-item.d.mts +56 -0
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -0
- package/dist/checkbox-group/checkbox-group-item.mjs +92 -0
- package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -0
- package/dist/checkbox-group/checkbox-group-label.d.mts +21 -0
- package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -0
- package/dist/checkbox-group/checkbox-group-label.mjs +30 -0
- package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -0
- package/dist/checkbox-group/checkbox-group-parent.d.mts +68 -0
- package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -0
- package/dist/checkbox-group/checkbox-group-parent.mjs +145 -0
- package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -0
- package/dist/checkbox-group/checkbox-group-root.d.mts +103 -0
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -0
- package/dist/checkbox-group/checkbox-group-root.mjs +310 -0
- package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -0
- package/dist/checkbox-group/index.d.mts +23 -0
- package/dist/checkbox-group/index.d.mts.map +1 -0
- package/dist/checkbox-group/index.mjs +23 -0
- package/dist/checkbox-group/index.mjs.map +1 -0
- 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 +43 -27
- 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 -44
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts +14 -8
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +77 -14
- 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 +101 -4
- package/dist/index.mjs +19 -1
- package/dist/internal/anchor-position.d.mts +15 -0
- package/dist/internal/anchor-position.d.mts.map +1 -0
- package/dist/internal/anchor-position.mjs +190 -0
- package/dist/internal/anchor-position.mjs.map +1 -0
- 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 +18 -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/sync-presence.mjs +19 -0
- package/dist/internal/sync-presence.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 +69 -0
- package/dist/internal/use-action-trigger.mjs.map +1 -0
- package/dist/internal/use-controllable-action.mjs +35 -13
- package/dist/internal/use-controllable-action.mjs.map +1 -1
- package/dist/internal/use-delayed-pair.mjs +40 -0
- package/dist/internal/use-delayed-pair.mjs.map +1 -0
- package/dist/internal/use-exit-animation.mjs +75 -0
- package/dist/internal/use-exit-animation.mjs.map +1 -0
- 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 +8 -7
- 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 +279 -0
- package/dist/internal/use-popover-popup.mjs.map +1 -0
- package/dist/internal/use-popover-root.d.mts +2 -0
- package/dist/internal/use-popover-root.mjs +147 -0
- package/dist/internal/use-popover-root.mjs.map +1 -0
- package/dist/internal/use-popover-trigger.mjs +87 -0
- package/dist/internal/use-popover-trigger.mjs.map +1 -0
- 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 +38 -0
- package/dist/menu/index.d.mts.map +1 -0
- package/dist/menu/index.mjs +38 -0
- package/dist/menu/index.mjs.map +1 -0
- package/dist/menu/menu-checkbox-item.d.mts +42 -0
- package/dist/menu/menu-checkbox-item.d.mts.map +1 -0
- package/dist/menu/menu-checkbox-item.mjs +72 -0
- package/dist/menu/menu-checkbox-item.mjs.map +1 -0
- 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.d.mts +1 -0
- package/dist/menu/menu-context.mjs +71 -0
- package/dist/menu/menu-context.mjs.map +1 -0
- package/dist/menu/menu-dom.mjs +83 -0
- package/dist/menu/menu-dom.mjs.map +1 -0
- package/dist/menu/menu-group.d.mts +48 -0
- package/dist/menu/menu-group.d.mts.map +1 -0
- package/dist/menu/menu-group.mjs +70 -0
- package/dist/menu/menu-group.mjs.map +1 -0
- package/dist/menu/menu-hover.mjs +29 -0
- package/dist/menu/menu-hover.mjs.map +1 -0
- package/dist/menu/menu-item.d.mts +49 -0
- package/dist/menu/menu-item.d.mts.map +1 -0
- package/dist/menu/menu-item.mjs +57 -0
- package/dist/menu/menu-item.mjs.map +1 -0
- package/dist/menu/menu-popup.d.mts +97 -0
- package/dist/menu/menu-popup.d.mts.map +1 -0
- package/dist/menu/menu-popup.mjs +404 -0
- package/dist/menu/menu-popup.mjs.map +1 -0
- package/dist/menu/menu-radio-group.d.mts +37 -0
- package/dist/menu/menu-radio-group.d.mts.map +1 -0
- package/dist/menu/menu-radio-group.mjs +77 -0
- package/dist/menu/menu-radio-group.mjs.map +1 -0
- package/dist/menu/menu-radio-item.d.mts +33 -0
- package/dist/menu/menu-radio-item.d.mts.map +1 -0
- package/dist/menu/menu-radio-item.mjs +63 -0
- package/dist/menu/menu-radio-item.mjs.map +1 -0
- package/dist/menu/menu-root.d.mts +59 -0
- package/dist/menu/menu-root.d.mts.map +1 -0
- package/dist/menu/menu-root.mjs +152 -0
- package/dist/menu/menu-root.mjs.map +1 -0
- package/dist/menu/menu-submenu-trigger.d.mts +31 -0
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -0
- package/dist/menu/menu-submenu-trigger.mjs +108 -0
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -0
- package/dist/menu/menu-trigger.d.mts +40 -0
- package/dist/menu/menu-trigger.d.mts.map +1 -0
- package/dist/menu/menu-trigger.mjs +92 -0
- package/dist/menu/menu-trigger.mjs.map +1 -0
- package/dist/menu/use-menu-item.mjs +54 -0
- package/dist/menu/use-menu-item.mjs.map +1 -0
- 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/index.d.mts +28 -0
- package/dist/popover/index.d.mts.map +1 -0
- package/dist/popover/index.mjs +28 -0
- package/dist/popover/index.mjs.map +1 -0
- package/dist/popover/popover-close.d.mts +47 -0
- package/dist/popover/popover-close.d.mts.map +1 -0
- package/dist/popover/popover-close.mjs +96 -0
- package/dist/popover/popover-close.mjs.map +1 -0
- package/dist/popover/popover-context.mjs +26 -0
- package/dist/popover/popover-context.mjs.map +1 -0
- package/dist/popover/popover-description.d.mts +22 -0
- package/dist/popover/popover-description.d.mts.map +1 -0
- package/dist/popover/popover-description.mjs +28 -0
- package/dist/popover/popover-description.mjs.map +1 -0
- package/dist/popover/popover-popup.d.mts +96 -0
- package/dist/popover/popover-popup.d.mts.map +1 -0
- package/dist/popover/popover-popup.mjs +108 -0
- package/dist/popover/popover-popup.mjs.map +1 -0
- package/dist/popover/popover-root.d.mts +64 -0
- package/dist/popover/popover-root.d.mts.map +1 -0
- package/dist/popover/popover-root.mjs +39 -0
- package/dist/popover/popover-root.mjs.map +1 -0
- package/dist/popover/popover-title.d.mts +23 -0
- package/dist/popover/popover-title.d.mts.map +1 -0
- package/dist/popover/popover-title.mjs +28 -0
- package/dist/popover/popover-title.mjs.map +1 -0
- package/dist/popover/popover-trigger.d.mts +41 -0
- package/dist/popover/popover-trigger.d.mts.map +1 -0
- package/dist/popover/popover-trigger.mjs +40 -0
- package/dist/popover/popover-trigger.mjs.map +1 -0
- 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.d.mts.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +2 -7
- package/dist/radio-group/radio-group-item.mjs.map +1 -1
- 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-context.mjs +2 -1
- package/dist/tabs/tabs-context.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.d.mts +1 -1
- package/dist/tabs/tabs-list.d.mts.map +1 -1
- package/dist/tabs/tabs-list.mjs +18 -10
- package/dist/tabs/tabs-list.mjs.map +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.d.mts +1 -1
- package/dist/tabs/tabs-tab.d.mts.map +1 -1
- package/dist/tabs/tabs-tab.mjs +9 -5
- 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 +38 -14
- 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 +127 -89
- package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
- package/package.json +17 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Action, RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { ToastActionDetails, ToastItem } from "./toast.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/toast/toast-action.d.ts
|
|
5
|
+
export interface ToastActionState {
|
|
6
|
+
/** This part's action is in flight. */
|
|
7
|
+
readonly pending: boolean;
|
|
8
|
+
readonly toast: ToastItem;
|
|
9
|
+
}
|
|
10
|
+
export interface ToastActionProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "className" | "style" | "children"> {
|
|
11
|
+
/**
|
|
12
|
+
* Runs in this part's own transition: `data-pending` on the Action and the Root, the toast's
|
|
13
|
+
* timer paused. When it resolves the toast closes with `reason: "activate"` (unless
|
|
14
|
+
* `closeOnSettle` is `false`); a rejection keeps the toast and reaches the nearest Error
|
|
15
|
+
* Boundary above the Viewport. A caught error counts as success and closes the toast: rethrow
|
|
16
|
+
* after `toast.update`, or use `closeOnSettle={false}`. Default: the toast's `action.action`.
|
|
17
|
+
*/
|
|
18
|
+
action?: Action<[details: ToastActionDetails]>;
|
|
19
|
+
/** Close the toast when the action resolves. Default `true`. */
|
|
20
|
+
closeOnSettle?: boolean;
|
|
21
|
+
/** Default: the toast's `action.label`. */
|
|
22
|
+
children?: StateValue<ReactNode, ToastActionState>;
|
|
23
|
+
className?: StateValue<string | undefined, ToastActionState>;
|
|
24
|
+
style?: StateValue<CSSProperties | undefined, ToastActionState>;
|
|
25
|
+
render?: RenderProp<ComponentPropsWithRef<"button">, ToastActionState>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The toast's action button (Undo, Retry, View): a `button type="button"` whose `action` runs as
|
|
29
|
+
* a transition. Renders nothing when neither the part nor the toast has an action. Never natively
|
|
30
|
+
* disabled while pending: a second click meanwhile is ignored and the Action is `aria-disabled`.
|
|
31
|
+
*
|
|
32
|
+
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`, `aria-disabled`,
|
|
33
|
+
* `data-pending`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function ToastAction({ action, closeOnSettle, children, className, style, render, ...rest }: ToastActionProps): ReactNode;
|
|
36
|
+
export declare namespace ToastAction {
|
|
37
|
+
var displayName: string;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//# sourceMappingURL=toast-action.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-action.d.mts","names":[],"sources":["../../src/toast/toast-action.tsx"],"mappings":";;;;iBAYiB;;WAEN;WACA,OAAO;;iBAGD,yBAAyB,KACxC;;;;;;;;EAUA,SAAS,QAAQ,SAAS;;EAE1B;;EAEA,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,iCAAiC;;;;;;;;;;wBAWvC,cACd,QACA,eACA,UACA,WACA,OACA,WACG,QACF,mBAAgB;yBARH"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createActionDetails } from "../internal/action-details.mjs";
|
|
3
|
+
import { dataAttr } from "../internal/data-attr.mjs";
|
|
4
|
+
import { useActionTrigger } from "../internal/use-action-trigger.mjs";
|
|
5
|
+
import { rendersButton } from "../internal/render-element.mjs";
|
|
6
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
7
|
+
import { useToastRootContext } from "./toast-context.mjs";
|
|
8
|
+
import { useLayoutEffect, useState } from "react";
|
|
9
|
+
//#region src/toast/toast-action.tsx
|
|
10
|
+
/**
|
|
11
|
+
* The toast's action button (Undo, Retry, View): a `button type="button"` whose `action` runs as
|
|
12
|
+
* a transition. Renders nothing when neither the part nor the toast has an action. Never natively
|
|
13
|
+
* disabled while pending: a second click meanwhile is ignored and the Action is `aria-disabled`.
|
|
14
|
+
*
|
|
15
|
+
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`, `aria-disabled`,
|
|
16
|
+
* `data-pending`.
|
|
17
|
+
*/
|
|
18
|
+
function ToastAction({ action, closeOnSettle = true, children, className, style, render, ...rest }) {
|
|
19
|
+
const root = useToastRootContext("Toast.Action");
|
|
20
|
+
const { pending, run } = useActionTrigger();
|
|
21
|
+
const [token] = useState(() => ({}));
|
|
22
|
+
const effective = action ?? root.toast.action?.action;
|
|
23
|
+
const { setActionPending } = root;
|
|
24
|
+
useLayoutEffect(() => {
|
|
25
|
+
if (!pending) return;
|
|
26
|
+
setActionPending(token, true);
|
|
27
|
+
return () => setActionPending(token, false);
|
|
28
|
+
}, [
|
|
29
|
+
pending,
|
|
30
|
+
setActionPending,
|
|
31
|
+
token
|
|
32
|
+
]);
|
|
33
|
+
const state = {
|
|
34
|
+
pending,
|
|
35
|
+
toast: root.toast
|
|
36
|
+
};
|
|
37
|
+
const onClick = (event) => {
|
|
38
|
+
if (effective === void 0 || rest.disabled === true) return;
|
|
39
|
+
const native = event.nativeEvent;
|
|
40
|
+
const details = createActionDetails(native, { id: root.toast.id });
|
|
41
|
+
if (!run(() => effective(details), () => {
|
|
42
|
+
if (closeOnSettle) root.close("activate", native);
|
|
43
|
+
})) event.preventDefault();
|
|
44
|
+
};
|
|
45
|
+
const libraryProps = {
|
|
46
|
+
...rendersButton(render) && { type: "button" },
|
|
47
|
+
onClick,
|
|
48
|
+
"aria-disabled": pending ? true : void 0,
|
|
49
|
+
"data-pending": dataAttr(pending)
|
|
50
|
+
};
|
|
51
|
+
const element = useRender({
|
|
52
|
+
defaultElement: "button",
|
|
53
|
+
render,
|
|
54
|
+
state,
|
|
55
|
+
className,
|
|
56
|
+
style,
|
|
57
|
+
children: children ?? root.toast.action?.label,
|
|
58
|
+
props: rest,
|
|
59
|
+
libraryProps
|
|
60
|
+
});
|
|
61
|
+
return effective === void 0 ? null : element;
|
|
62
|
+
}
|
|
63
|
+
ToastAction.displayName = "ToastAction";
|
|
64
|
+
//#endregion
|
|
65
|
+
export { ToastAction };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=toast-action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-action.mjs","names":[],"sources":["../../src/toast/toast-action.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { Action, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastActionDetails, ToastItem } from \"./toast.js\";\nimport { useToastRootContext } from \"./toast-context.js\";\n\nexport interface ToastActionState {\n /** This part's action is in flight. */\n readonly pending: boolean;\n readonly toast: ToastItem;\n}\n\nexport interface ToastActionProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs in this part's own transition: `data-pending` on the Action and the Root, the toast's\n * timer paused. When it resolves the toast closes with `reason: \"activate\"` (unless\n * `closeOnSettle` is `false`); a rejection keeps the toast and reaches the nearest Error\n * Boundary above the Viewport. A caught error counts as success and closes the toast: rethrow\n * after `toast.update`, or use `closeOnSettle={false}`. Default: the toast's `action.action`.\n */\n action?: Action<[details: ToastActionDetails]>;\n /** Close the toast when the action resolves. Default `true`. */\n closeOnSettle?: boolean;\n /** Default: the toast's `action.label`. */\n children?: StateValue<ReactNode, ToastActionState>;\n className?: StateValue<string | undefined, ToastActionState>;\n style?: StateValue<CSSProperties | undefined, ToastActionState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ToastActionState>;\n}\n\n/**\n * The toast's action button (Undo, Retry, View): a `button type=\"button\"` whose `action` runs as\n * a transition. Renders nothing when neither the part nor the toast has an action. Never natively\n * disabled while pending: a second click meanwhile is ignored and the Action is `aria-disabled`.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`, `aria-disabled`,\n * `data-pending`.\n */\nexport function ToastAction({\n action,\n closeOnSettle = true,\n children,\n className,\n style,\n render,\n ...rest\n}: ToastActionProps) {\n const root = useToastRootContext(\"Toast.Action\");\n const { pending, run } = useActionTrigger();\n const [token] = useState(() => ({}));\n const effective = action ?? root.toast.action?.action;\n const { setActionPending } = root;\n\n // The Root (and through it the Viewport's timer) sees this part's pending state.\n useLayoutEffect(() => {\n if (!pending) return;\n setActionPending(token, true);\n return () => setActionPending(token, false);\n }, [pending, setActionPending, token]);\n\n const state: ToastActionState = { pending, toast: root.toast };\n\n const onClick = (event: MouseEvent<HTMLElement>): void => {\n if (effective === undefined || rest.disabled === true) return;\n const native = event.nativeEvent;\n const details = createActionDetails(native, { id: root.toast.id });\n // A second click while this Action's own run is in flight starts nothing and is cancelled\n // (the hook's guard, #81): one Undo, one Retry.\n const started = run(\n () => effective(details),\n () => {\n // Closing is idempotent: a dismissal meanwhile already closed it.\n if (closeOnSettle) root.close(\"activate\", native);\n },\n );\n if (!started) event.preventDefault();\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n onClick,\n // Exactly while `data-pending` (#81). Owned, so an idle Action removes a render element's own.\n \"aria-disabled\": pending ? true : undefined,\n \"data-pending\": dataAttr(pending),\n };\n\n const element = useRender<ComponentPropsWithRef<\"button\">, ToastActionState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children: children ?? root.toast.action?.label,\n props: rest,\n libraryProps,\n });\n return effective === undefined ? null : element;\n}\n\nToastAction.displayName = \"ToastAction\";\n"],"mappings":";;;;;;;;;;;;;;;;;AA+CA,SAAgB,YAAY,EAC1B,QACA,gBAAgB,MAChB,UACA,WACA,OACA,QACA,GAAG,QACgB;CACnB,MAAM,OAAO,oBAAoB,cAAc;CAC/C,MAAM,EAAE,SAAS,QAAQ,iBAAiB;CAC1C,MAAM,CAAC,SAAS,gBAAgB,CAAC,EAAE;CACnC,MAAM,YAAY,UAAU,KAAK,MAAM,QAAQ;CAC/C,MAAM,EAAE,qBAAqB;CAG7B,sBAAsB;EACpB,IAAI,CAAC,SAAS;EACd,iBAAiB,OAAO,IAAI;EAC5B,aAAa,iBAAiB,OAAO,KAAK;CAC5C,GAAG;EAAC;EAAS;EAAkB;CAAK,CAAC;CAErC,MAAM,QAA0B;EAAE;EAAS,OAAO,KAAK;CAAM;CAE7D,MAAM,WAAW,UAAyC;EACxD,IAAI,cAAc,KAAA,KAAa,KAAK,aAAa,MAAM;EACvD,MAAM,SAAS,MAAM;EACrB,MAAM,UAAU,oBAAoB,QAAQ,EAAE,IAAI,KAAK,MAAM,GAAG,CAAC;EAUjE,IAAI,CAPY,UACR,UAAU,OAAO,SACjB;GAEJ,IAAI,eAAe,KAAK,MAAM,YAAY,MAAM;EAClD,CAES,GAAG,MAAM,eAAe;CACrC;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EACvD;EAEA,iBAAiB,UAAU,OAAO,KAAA;EAClC,gBAAgB,SAAS,OAAO;CAClC;CAEA,MAAM,UAAU,UAA6D;EAC3E,gBAAgB;EAChB;EACA;EACA;EACA;EACA,UAAU,YAAY,KAAK,MAAM,QAAQ;EACzC,OAAO;EACP;CACF,CAAC;CACD,OAAO,cAAc,KAAA,IAAY,OAAO;AAC1C;AAEA,YAAY,cAAc"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { ToastItem } from "./toast.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/toast/toast-close.d.ts
|
|
5
|
+
export interface ToastCloseState {
|
|
6
|
+
readonly toast: ToastItem;
|
|
7
|
+
}
|
|
8
|
+
export interface ToastCloseProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "className" | "style" | "children"> {
|
|
9
|
+
children?: StateValue<ReactNode, ToastCloseState>;
|
|
10
|
+
className?: StateValue<string | undefined, ToastCloseState>;
|
|
11
|
+
style?: StateValue<CSSProperties | undefined, ToastCloseState>;
|
|
12
|
+
render?: RenderProp<ComponentPropsWithRef<"button">, ToastCloseState>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Dismisses the toast (`reason: "dismiss"`, the same as Escape). Label it yourself (`aria-label`
|
|
16
|
+
* or text). No Invoker Command: `hide-popover` would hide the whole region.
|
|
17
|
+
*
|
|
18
|
+
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ToastClose({ children, className, style, render, ...rest }: ToastCloseProps): ReactNode;
|
|
21
|
+
export declare namespace ToastClose {
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//# sourceMappingURL=toast-close.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-close.d.mts","names":[],"sources":["../../src/toast/toast-close.tsx"],"mappings":";;;;iBASiB;WACN,OAAO;;iBAGD,wBAAwB,KACvC;EAGA,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,iCAAiC;;;;;;;;wBAWvC,aAAa,UAAU,WAAW,OAAO,WAAW,QAAQ,kBAAe;yBAA3E"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { rendersButton } from "../internal/render-element.mjs";
|
|
3
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
4
|
+
import { useToastRootContext } from "./toast-context.mjs";
|
|
5
|
+
import { useCallback } from "react";
|
|
6
|
+
//#region src/toast/toast-close.tsx
|
|
7
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
8
|
+
/**
|
|
9
|
+
* Dismisses the toast (`reason: "dismiss"`, the same as Escape). Label it yourself (`aria-label`
|
|
10
|
+
* or text). No Invoker Command: `hide-popover` would hide the whole region.
|
|
11
|
+
*
|
|
12
|
+
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`.
|
|
13
|
+
*/
|
|
14
|
+
function ToastClose({ children, className, style, render, ...rest }) {
|
|
15
|
+
const root = useToastRootContext("Toast.Close");
|
|
16
|
+
const devRef = useCallback((element) => {
|
|
17
|
+
if (isDev) queueMicrotask(() => {
|
|
18
|
+
if (!element.isConnected) return;
|
|
19
|
+
if (!(element.hasAttribute("aria-label") || element.hasAttribute("aria-labelledby") || (element.textContent ?? "").trim() !== "")) console.error("Toast.Close: the button has no accessible name. Give it text or an `aria-label`.");
|
|
20
|
+
});
|
|
21
|
+
return () => {};
|
|
22
|
+
}, []);
|
|
23
|
+
const onClick = (event) => {
|
|
24
|
+
if (rest.disabled === true) return;
|
|
25
|
+
root.close("dismiss", event.nativeEvent);
|
|
26
|
+
};
|
|
27
|
+
const libraryProps = {
|
|
28
|
+
...rendersButton(render) && { type: "button" },
|
|
29
|
+
onClick
|
|
30
|
+
};
|
|
31
|
+
return useRender({
|
|
32
|
+
defaultElement: "button",
|
|
33
|
+
render,
|
|
34
|
+
state: { toast: root.toast },
|
|
35
|
+
className,
|
|
36
|
+
style,
|
|
37
|
+
children,
|
|
38
|
+
props: rest,
|
|
39
|
+
libraryProps,
|
|
40
|
+
ref: devRef
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
ToastClose.displayName = "ToastClose";
|
|
44
|
+
//#endregion
|
|
45
|
+
export { ToastClose };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=toast-close.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-close.mjs","names":[],"sources":["../../src/toast/toast-close.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastItem } from \"./toast.js\";\nimport { useToastRootContext } from \"./toast-context.js\";\n\nexport interface ToastCloseState {\n readonly toast: ToastItem;\n}\n\nexport interface ToastCloseProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n children?: StateValue<ReactNode, ToastCloseState>;\n className?: StateValue<string | undefined, ToastCloseState>;\n style?: StateValue<CSSProperties | undefined, ToastCloseState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ToastCloseState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Dismisses the toast (`reason: \"dismiss\"`, the same as Escape). Label it yourself (`aria-label`\n * or text). No Invoker Command: `hide-popover` would hide the whole region.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`.\n */\nexport function ToastClose({ children, className, style, render, ...rest }: ToastCloseProps) {\n const root = useToastRootContext(\"Toast.Close\");\n\n const devRef = useCallback((element: HTMLElement) => {\n if (isDev) {\n // After the commit: the text may come from children rendered in the same commit.\n queueMicrotask(() => {\n if (!element.isConnected) return;\n const named =\n element.hasAttribute(\"aria-label\") ||\n element.hasAttribute(\"aria-labelledby\") ||\n (element.textContent ?? \"\").trim() !== \"\";\n if (!named) {\n console.error(\n \"Toast.Close: the button has no accessible name. Give it text or an `aria-label`.\",\n );\n }\n });\n }\n return () => {};\n }, []);\n\n const onClick = (event: MouseEvent<HTMLElement>): void => {\n if (rest.disabled === true) return;\n root.close(\"dismiss\", event.nativeEvent);\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n onClick,\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, ToastCloseState>({\n defaultElement: \"button\",\n render,\n state: { toast: root.toast },\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: devRef,\n });\n}\n\nToastClose.displayName = \"ToastClose\";\n"],"mappings":";;;;;;AAuBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;AAQvC,SAAgB,WAAW,EAAE,UAAU,WAAW,OAAO,QAAQ,GAAG,QAAyB;CAC3F,MAAM,OAAO,oBAAoB,aAAa;CAE9C,MAAM,SAAS,aAAa,YAAyB;EACnD,IAAI,OAEF,qBAAqB;GACnB,IAAI,CAAC,QAAQ,aAAa;GAK1B,IAAI,EAHF,QAAQ,aAAa,YAAY,KACjC,QAAQ,aAAa,iBAAiB,MACrC,QAAQ,eAAe,GAAA,CAAI,KAAK,MAAM,KAEvC,QAAQ,MACN,kFACF;EAEJ,CAAC;EAEH,aAAa,CAAC;CAChB,GAAG,CAAC,CAAC;CAEL,MAAM,WAAW,UAAyC;EACxD,IAAI,KAAK,aAAa,MAAM;EAC5B,KAAK,MAAM,WAAW,MAAM,WAAW;CACzC;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EACvD;CACF;CAEA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA,OAAO,EAAE,OAAO,KAAK,MAAM;EAC3B;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;AACH;AAEA,WAAW,cAAc"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, use } from "react";
|
|
3
|
+
//#region src/toast/toast-context.ts
|
|
4
|
+
const ToastViewportContext = createContext(null);
|
|
5
|
+
function useToastViewportContext(part) {
|
|
6
|
+
const context = use(ToastViewportContext);
|
|
7
|
+
if (context === null) throw new Error(`${part} must be rendered inside a Toast.Viewport.`);
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
const ToastRootContext = createContext(null);
|
|
11
|
+
function useToastRootContext(part) {
|
|
12
|
+
const context = use(ToastRootContext);
|
|
13
|
+
if (context === null) throw new Error(`${part} must be rendered inside a Toast.Root.`);
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ToastRootContext, ToastViewportContext, useToastRootContext, useToastViewportContext };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=toast-context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-context.mjs","names":[],"sources":["../../src/toast/toast-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { ChangeReason } from \"../internal/types.js\";\nimport type { ToastItem, ToastPriority } from \"./toast.js\";\n\n/** What a Root (and the parts under it) need from the Viewport. Stable for the Viewport's life. */\nexport interface ToastViewportContextValue {\n /** Close toasts (`ending: true`), moving focus out first and scheduling `closeAction`. */\n readonly close: (ids: readonly string[], reason: ChangeReason, event: Event | undefined) => void;\n /** Remove an ending toast once its exit animations finished. */\n readonly drop: (id: string) => void;\n /** An action dispatched through the toast's Action part is (no longer) in flight. */\n readonly setActionPending: (id: string, pending: boolean) => void;\n /** The toast's content is (no longer) suspended behind the Root's guard. */\n readonly setSuspended: (id: string, suspended: boolean) => void;\n /** The Root's element, for arrow keys, the hotkey and focus moves; `null` to unregister. */\n readonly registerRoot: (id: string, element: HTMLElement | null) => void;\n /** Focus the next (`1`) or previous (`-1`) toast's Root, without wrapping. */\n readonly focusSibling: (id: string, direction: 1 | -1) => void;\n /** Queue an announcement; skipped when `text` equals the last one announced for `id`. */\n readonly announce: (id: string, text: string | null, priority: ToastPriority) => void;\n /** The Viewport's `announce` prop, read at announcement time. */\n readonly announcer: () => ((toast: ToastItem) => string | null) | undefined;\n /**\n * The animations that ran in the toast before it was marked ending (kept until it is dropped\n * or replaced): its exit waits only for the others.\n */\n readonly exitBaseline: (id: string) => ReadonlySet<Animation> | undefined;\n}\n\nexport const ToastViewportContext = createContext<ToastViewportContextValue | null>(null);\n\nexport function useToastViewportContext(part: string): ToastViewportContextValue {\n const context = use(ToastViewportContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Toast.Viewport.`);\n }\n return context;\n}\n\n/** What the parts inside a Root need. */\nexport interface ToastRootContextValue {\n readonly toast: ToastItem;\n readonly ids: { readonly title: string; readonly description: string };\n /** Root state, so Title and Description can resolve their function props against it. */\n readonly state: ToastRootStateShape;\n readonly registerTitle: (element: HTMLElement | null) => void;\n readonly registerDescription: (element: HTMLElement | null) => void;\n /** An Action part's run is (no longer) in flight; `token` identifies the part. */\n readonly setActionPending: (token: object, pending: boolean) => void;\n /**\n * A Title or Description committed: mounted, or shown again by a Suspense boundary inside the\n * Root (the consumer's skeleton), so the Root announces the text that now exists.\n */\n readonly contentCommitted: () => void;\n /** The Suspense guard mounted (`true`) or unmounted (`false`). */\n readonly setSuspended: (suspended: boolean) => void;\n /** Close this toast. */\n readonly close: (reason: ChangeReason, event: Event | undefined) => void;\n}\n\n/** Same shape as `ToastRootState` (declared in toast-root.tsx). */\nexport interface ToastRootStateShape {\n readonly toast: ToastItem;\n readonly pending: boolean;\n readonly ending: boolean;\n readonly type: string | undefined;\n readonly priority: ToastPriority;\n}\n\nexport const ToastRootContext = createContext<ToastRootContextValue | null>(null);\n\nexport function useToastRootContext(part: string): ToastRootContextValue {\n const context = use(ToastRootContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Toast.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AA8BA,MAAa,uBAAuB,cAAgD,IAAI;AAExF,SAAgB,wBAAwB,MAAyC;CAC/E,MAAM,UAAU,IAAI,oBAAoB;CACxC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,2CAA2C;CAErE,OAAO;AACT;AAgCA,MAAa,mBAAmB,cAA4C,IAAI;AAEhF,SAAgB,oBAAoB,MAAqC;CACvE,MAAM,UAAU,IAAI,gBAAgB;CACpC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,uCAAuC;CAEjE,OAAO;AACT"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { ToastRootState } from "./toast-root.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/toast/toast-description.d.ts
|
|
5
|
+
export interface ToastDescriptionProps extends Omit<ComponentPropsWithRef<"p">, "id" | "className" | "style" | "children"> {
|
|
6
|
+
/** Default: the toast's `description`. Without either, nothing is rendered. */
|
|
7
|
+
children?: StateValue<ReactNode, ToastRootState>;
|
|
8
|
+
className?: StateValue<string | undefined, ToastRootState>;
|
|
9
|
+
style?: StateValue<CSSProperties | undefined, ToastRootState>;
|
|
10
|
+
render?: RenderProp<ComponentPropsWithRef<"p">, ToastRootState>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The toast's description: a `p` whose id the Root references with `aria-describedby`. Renders
|
|
14
|
+
* nothing when the part has no `children` and the toast no `description`. Its text is part of the
|
|
15
|
+
* default announcement.
|
|
16
|
+
*
|
|
17
|
+
* Owned key (conventions 1.2): `id`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ToastDescription({ children, className, style, render, ...rest }: ToastDescriptionProps): ReactNode;
|
|
20
|
+
export declare namespace ToastDescription {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//# sourceMappingURL=toast-description.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-description.d.mts","names":[],"sources":["../../src/toast/toast-description.tsx"],"mappings":";;;;iBAQiB,8BAA8B,KAC7C;;EAIA,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,4BAA4B;;;;;;;;;wBAUlC,mBACd,UACA,WACA,OACA,WACG,QACF,wBAAqB;yBANR"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
3
|
+
import { useToastRootContext } from "./toast-context.mjs";
|
|
4
|
+
import { useLayoutEffect } from "react";
|
|
5
|
+
//#region src/toast/toast-description.tsx
|
|
6
|
+
/**
|
|
7
|
+
* The toast's description: a `p` whose id the Root references with `aria-describedby`. Renders
|
|
8
|
+
* nothing when the part has no `children` and the toast no `description`. Its text is part of the
|
|
9
|
+
* default announcement.
|
|
10
|
+
*
|
|
11
|
+
* Owned key (conventions 1.2): `id`.
|
|
12
|
+
*/
|
|
13
|
+
function ToastDescription({ children, className, style, render, ...rest }) {
|
|
14
|
+
const root = useToastRootContext("Toast.Description");
|
|
15
|
+
const content = children ?? root.toast.description;
|
|
16
|
+
const { contentCommitted } = root;
|
|
17
|
+
useLayoutEffect(() => contentCommitted(), [contentCommitted]);
|
|
18
|
+
const element = useRender({
|
|
19
|
+
defaultElement: "p",
|
|
20
|
+
render,
|
|
21
|
+
state: root.state,
|
|
22
|
+
className,
|
|
23
|
+
style,
|
|
24
|
+
children: content,
|
|
25
|
+
props: rest,
|
|
26
|
+
libraryProps: { id: root.ids.description },
|
|
27
|
+
ref: root.registerDescription
|
|
28
|
+
});
|
|
29
|
+
return content == null || content === false ? null : element;
|
|
30
|
+
}
|
|
31
|
+
ToastDescription.displayName = "ToastDescription";
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ToastDescription };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=toast-description.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-description.mjs","names":[],"sources":["../../src/toast/toast-description.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect } 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 { useToastRootContext } from \"./toast-context.js\";\nimport type { ToastRootState } from \"./toast-root.js\";\n\nexport interface ToastDescriptionProps extends Omit<\n ComponentPropsWithRef<\"p\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n /** Default: the toast's `description`. Without either, nothing is rendered. */\n children?: StateValue<ReactNode, ToastRootState>;\n className?: StateValue<string | undefined, ToastRootState>;\n style?: StateValue<CSSProperties | undefined, ToastRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"p\">, ToastRootState>;\n}\n\n/**\n * The toast's description: a `p` whose id the Root references with `aria-describedby`. Renders\n * nothing when the part has no `children` and the toast no `description`. Its text is part of the\n * default announcement.\n *\n * Owned key (conventions 1.2): `id`.\n */\nexport function ToastDescription({\n children,\n className,\n style,\n render,\n ...rest\n}: ToastDescriptionProps) {\n const root = useToastRootContext(\"Toast.Description\");\n const content = children ?? root.toast.description;\n // Mounted, or revealed by a Suspense boundary inside the Root: announce the text now present.\n const { contentCommitted } = root;\n useLayoutEffect(() => contentCommitted(), [contentCommitted]);\n const element = useRender<ComponentPropsWithRef<\"p\">, ToastRootState>({\n defaultElement: \"p\",\n render,\n state: root.state,\n className,\n style,\n children: content,\n props: rest,\n libraryProps: { id: root.ids.description },\n ref: root.registerDescription,\n });\n return content == null || content === false ? null : element;\n}\n\nToastDescription.displayName = \"ToastDescription\";\n"],"mappings":";;;;;;;;;;;;AA0BA,SAAgB,iBAAiB,EAC/B,UACA,WACA,OACA,QACA,GAAG,QACqB;CACxB,MAAM,OAAO,oBAAoB,mBAAmB;CACpD,MAAM,UAAU,YAAY,KAAK,MAAM;CAEvC,MAAM,EAAE,qBAAqB;CAC7B,sBAAsB,iBAAiB,GAAG,CAAC,gBAAgB,CAAC;CAC5D,MAAM,UAAU,UAAsD;EACpE,gBAAgB;EAChB;EACA,OAAO,KAAK;EACZ;EACA;EACA,UAAU;EACV,OAAO;EACP,cAAc,EAAE,IAAI,KAAK,IAAI,YAAY;EACzC,KAAK,KAAK;CACZ,CAAC;CACD,OAAO,WAAW,QAAQ,YAAY,QAAQ,OAAO;AACvD;AAEA,iBAAiB,cAAc"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { ToastItem, ToastPriority } from "./toast.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/toast/toast-root.d.ts
|
|
5
|
+
export interface ToastRootState {
|
|
6
|
+
readonly toast: ToastItem;
|
|
7
|
+
/** `toast.pending`: its promise is unsettled or its Action runs. */
|
|
8
|
+
readonly pending: boolean;
|
|
9
|
+
/** `toast.ending`: closed, kept for its exit animation. */
|
|
10
|
+
readonly ending: boolean;
|
|
11
|
+
readonly type: string | undefined;
|
|
12
|
+
readonly priority: ToastPriority;
|
|
13
|
+
}
|
|
14
|
+
export interface ToastRootProps extends Omit<ComponentPropsWithRef<"div">, "role" | "className" | "style" | "children" | "onKeyDown"> {
|
|
15
|
+
/** The toast to render: an item of the Viewport's `state.toasts`. */
|
|
16
|
+
toast: ToastItem;
|
|
17
|
+
children?: StateValue<ReactNode, ToastRootState>;
|
|
18
|
+
className?: StateValue<string | undefined, ToastRootState>;
|
|
19
|
+
style?: StateValue<CSSProperties | undefined, ToastRootState>;
|
|
20
|
+
render?: RenderProp<ComponentPropsWithRef<"div">, ToastRootState>;
|
|
21
|
+
/**
|
|
22
|
+
* Rendered by the Root's own Suspense guard while `children` suspend, in place of the
|
|
23
|
+
* invisible default. The toast's timer and announcement wait for the reveal either way.
|
|
24
|
+
* Parts inside it (a visually hidden `<Toast.Title>` giving the toast a name) gate nothing.
|
|
25
|
+
*/
|
|
26
|
+
fallback?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* One toast: a focusable `div[role=dialog]` (`alertdialog` for `priority: "high"`) named by its
|
|
30
|
+
* Title and described by its Description. Escape dismisses it, ArrowDown / ArrowUp move to the
|
|
31
|
+
* next / previous toast. Its children render inside a Suspense guard whose fallback is the
|
|
32
|
+
* `fallback` prop (invisible by default), so a toast whose content suspends does not pull the whole Viewport into a boundary above it.
|
|
33
|
+
* When the toast closes it stays with `data-ending` (and `inert`) until its exit animations end.
|
|
34
|
+
*
|
|
35
|
+
* Owned keys (conventions 1.2): `role`, `tabIndex`, `aria-labelledby`, `aria-describedby`,
|
|
36
|
+
* `inert`, `data-type`, `data-pending`, `data-ending`, `onKeyDown`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ToastRoot({ toast: item, children, className, style, render, fallback, ...rest }: ToastRootProps): import("react").JSX.Element;
|
|
39
|
+
export declare namespace ToastRoot {
|
|
40
|
+
var displayName: string;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//# sourceMappingURL=toast-root.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-root.d.mts","names":[],"sources":["../../src/toast/toast-root.tsx"],"mappings":";;;;iBAaiB;WACN,OAAO;;WAEP;;WAEA;WACA;WACA,UAAU;;iBAGJ,uBAAuB,KACtC;;EAIA,OAAO;EACP,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,8BAA8B;;;;;;EAMlD,WAAW;;;;;;;;;;;;wBA2BG,YACd,OAAO,MACP,UACA,WACA,OACA,QACA,aACG,QACF,iCAAc,IAAA;yBARD"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
|
+
import { resolveStateValue } from "../internal/render-element.mjs";
|
|
4
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
5
|
+
import { useLatest } from "../internal/use-latest.mjs";
|
|
6
|
+
import { exitAnimations } from "../internal/use-exit-animation.mjs";
|
|
7
|
+
import { ToastRootContext, useToastRootContext, useToastViewportContext } from "./toast-context.mjs";
|
|
8
|
+
import { Suspense, useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
//#region src/toast/toast-root.tsx
|
|
11
|
+
/**
|
|
12
|
+
* The Suspense guard's fallback: renders the Root's `fallback` (nothing by default) and tells
|
|
13
|
+
* the Root its content is suspended, so the timer and the announcement wait for the reveal
|
|
14
|
+
* (design 3.5, 21).
|
|
15
|
+
*/
|
|
16
|
+
function SuspenseGuard({ children }) {
|
|
17
|
+
const { setSuspended } = useToastRootContext("Toast.Root");
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
setSuspended(true);
|
|
20
|
+
return () => setSuspended(false);
|
|
21
|
+
}, [setSuspended]);
|
|
22
|
+
return children;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* One toast: a focusable `div[role=dialog]` (`alertdialog` for `priority: "high"`) named by its
|
|
26
|
+
* Title and described by its Description. Escape dismisses it, ArrowDown / ArrowUp move to the
|
|
27
|
+
* next / previous toast. Its children render inside a Suspense guard whose fallback is the
|
|
28
|
+
* `fallback` prop (invisible by default), so a toast whose content suspends does not pull the whole Viewport into a boundary above it.
|
|
29
|
+
* When the toast closes it stays with `data-ending` (and `inert`) until its exit animations end.
|
|
30
|
+
*
|
|
31
|
+
* Owned keys (conventions 1.2): `role`, `tabIndex`, `aria-labelledby`, `aria-describedby`,
|
|
32
|
+
* `inert`, `data-type`, `data-pending`, `data-ending`, `onKeyDown`.
|
|
33
|
+
*/
|
|
34
|
+
function ToastRoot({ toast: item, children, className, style, render, fallback = null, ...rest }) {
|
|
35
|
+
const viewport = useToastViewportContext("Toast.Root");
|
|
36
|
+
const id = item.id;
|
|
37
|
+
const baseId = useId();
|
|
38
|
+
const ids = useMemo(() => ({
|
|
39
|
+
title: `${baseId}title`,
|
|
40
|
+
description: `${baseId}description`
|
|
41
|
+
}), [baseId]);
|
|
42
|
+
const elementRef = useRef(null);
|
|
43
|
+
const titleRef = useRef(null);
|
|
44
|
+
const descriptionRef = useRef(null);
|
|
45
|
+
const pendingTokens = useRef(/* @__PURE__ */ new Set());
|
|
46
|
+
const [actionPending, setActionPendingState] = useState(false);
|
|
47
|
+
const suspendedRef = useRef(false);
|
|
48
|
+
const [suspended, setSuspendedState] = useState(false);
|
|
49
|
+
const idRef = useLatest(id);
|
|
50
|
+
const announcedOnce = useRef(false);
|
|
51
|
+
const revealQueued = useRef(false);
|
|
52
|
+
const setActionPending = useCallback((token, pending) => {
|
|
53
|
+
const tokens = pendingTokens.current;
|
|
54
|
+
if (pending) tokens.add(token);
|
|
55
|
+
else tokens.delete(token);
|
|
56
|
+
const any = tokens.size > 0;
|
|
57
|
+
setActionPendingState(any);
|
|
58
|
+
viewport.setActionPending(idRef.current, any);
|
|
59
|
+
}, [viewport, idRef]);
|
|
60
|
+
const setSuspended = useCallback((value) => {
|
|
61
|
+
suspendedRef.current = value;
|
|
62
|
+
setSuspendedState(value);
|
|
63
|
+
viewport.setSuspended(idRef.current, value);
|
|
64
|
+
}, [viewport, idRef]);
|
|
65
|
+
const close = useCallback((reason, event) => viewport.close([idRef.current], reason, event), [viewport, idRef]);
|
|
66
|
+
const registerTitle = useCallback((element) => {
|
|
67
|
+
titleRef.current = element;
|
|
68
|
+
}, []);
|
|
69
|
+
const registerDescription = useCallback((element) => {
|
|
70
|
+
descriptionRef.current = element;
|
|
71
|
+
}, []);
|
|
72
|
+
const pending = item.pending || actionPending;
|
|
73
|
+
const priority = item.priority ?? "normal";
|
|
74
|
+
const announceNow = () => {
|
|
75
|
+
if (item.ending || suspendedRef.current) return;
|
|
76
|
+
const resolver = item.announce ?? viewport.announcer();
|
|
77
|
+
let text;
|
|
78
|
+
if (resolver !== void 0) text = resolver(item);
|
|
79
|
+
else text = [titleRef.current?.textContent, descriptionRef.current?.textContent].map((t) => (t ?? "").trim()).filter((t) => t !== "").join(" ");
|
|
80
|
+
viewport.announce(item.id, text, priority);
|
|
81
|
+
};
|
|
82
|
+
const announceRef = useLatest(announceNow);
|
|
83
|
+
const contentCommitted = useCallback(() => {
|
|
84
|
+
if (!announcedOnce.current || revealQueued.current) return;
|
|
85
|
+
revealQueued.current = true;
|
|
86
|
+
queueMicrotask(() => {
|
|
87
|
+
revealQueued.current = false;
|
|
88
|
+
announceRef.current();
|
|
89
|
+
});
|
|
90
|
+
}, [announceRef]);
|
|
91
|
+
const state = useMemo(() => ({
|
|
92
|
+
toast: item,
|
|
93
|
+
pending,
|
|
94
|
+
ending: item.ending,
|
|
95
|
+
type: item.type,
|
|
96
|
+
priority
|
|
97
|
+
}), [
|
|
98
|
+
item,
|
|
99
|
+
pending,
|
|
100
|
+
priority
|
|
101
|
+
]);
|
|
102
|
+
const context = useMemo(() => ({
|
|
103
|
+
toast: item,
|
|
104
|
+
ids,
|
|
105
|
+
state,
|
|
106
|
+
registerTitle,
|
|
107
|
+
registerDescription,
|
|
108
|
+
contentCommitted,
|
|
109
|
+
setActionPending,
|
|
110
|
+
setSuspended,
|
|
111
|
+
close
|
|
112
|
+
}), [
|
|
113
|
+
item,
|
|
114
|
+
ids,
|
|
115
|
+
state,
|
|
116
|
+
registerTitle,
|
|
117
|
+
registerDescription,
|
|
118
|
+
contentCommitted,
|
|
119
|
+
setActionPending,
|
|
120
|
+
setSuspended,
|
|
121
|
+
close
|
|
122
|
+
]);
|
|
123
|
+
const rootRef = useCallback((element) => {
|
|
124
|
+
elementRef.current = element;
|
|
125
|
+
viewport.registerRoot(id, element);
|
|
126
|
+
return () => {
|
|
127
|
+
if (elementRef.current === element) elementRef.current = null;
|
|
128
|
+
viewport.registerRoot(id, null);
|
|
129
|
+
};
|
|
130
|
+
}, [viewport, id]);
|
|
131
|
+
useLayoutEffect(() => {
|
|
132
|
+
announcedOnce.current = true;
|
|
133
|
+
announceRef.current();
|
|
134
|
+
}, [
|
|
135
|
+
item,
|
|
136
|
+
suspended,
|
|
137
|
+
priority,
|
|
138
|
+
announceRef
|
|
139
|
+
]);
|
|
140
|
+
useLayoutEffect(() => {
|
|
141
|
+
if (!item.ending) return;
|
|
142
|
+
const element = elementRef.current;
|
|
143
|
+
const baseline = viewport.exitBaseline(item.id);
|
|
144
|
+
const animations = element === null ? [] : exitAnimations(element, baseline);
|
|
145
|
+
if (animations.length === 0) {
|
|
146
|
+
viewport.drop(item.id);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
let cancelled = false;
|
|
150
|
+
Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {
|
|
151
|
+
if (!cancelled) viewport.drop(item.id);
|
|
152
|
+
});
|
|
153
|
+
return () => {
|
|
154
|
+
cancelled = true;
|
|
155
|
+
};
|
|
156
|
+
}, [
|
|
157
|
+
item.ending,
|
|
158
|
+
item.id,
|
|
159
|
+
viewport
|
|
160
|
+
]);
|
|
161
|
+
const onKeyDown = (event) => {
|
|
162
|
+
if (event.defaultPrevented || item.ending) return;
|
|
163
|
+
if (event.key === "Escape") {
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
close("dismiss", event.nativeEvent);
|
|
166
|
+
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
viewport.focusSibling(id, event.key === "ArrowDown" ? 1 : -1);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const libraryProps = {
|
|
172
|
+
role: priority === "high" ? "alertdialog" : "dialog",
|
|
173
|
+
tabIndex: 0,
|
|
174
|
+
"aria-labelledby": ids.title,
|
|
175
|
+
"aria-describedby": ids.description,
|
|
176
|
+
inert: item.ending || void 0,
|
|
177
|
+
"data-type": item.type,
|
|
178
|
+
"data-pending": dataAttr(pending),
|
|
179
|
+
"data-ending": dataAttr(item.ending),
|
|
180
|
+
onKeyDown
|
|
181
|
+
};
|
|
182
|
+
const element = useRender({
|
|
183
|
+
defaultElement: "div",
|
|
184
|
+
render,
|
|
185
|
+
state,
|
|
186
|
+
className,
|
|
187
|
+
style,
|
|
188
|
+
children: (s) => /* @__PURE__ */ jsx(Suspense, {
|
|
189
|
+
fallback: /* @__PURE__ */ jsx(SuspenseGuard, { children: fallback }),
|
|
190
|
+
children: resolveStateValue(children, s)
|
|
191
|
+
}),
|
|
192
|
+
props: rest,
|
|
193
|
+
libraryProps,
|
|
194
|
+
ref: rootRef
|
|
195
|
+
});
|
|
196
|
+
return /* @__PURE__ */ jsx(ToastRootContext, {
|
|
197
|
+
value: context,
|
|
198
|
+
children: element
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
ToastRoot.displayName = "ToastRoot";
|
|
202
|
+
//#endregion
|
|
203
|
+
export { ToastRoot };
|
|
204
|
+
|
|
205
|
+
//# sourceMappingURL=toast-root.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-root.mjs","names":[],"sources":["../../src/toast/toast-root.tsx"],"sourcesContent":["\"use client\";\nimport { Suspense, useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, KeyboardEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { exitAnimations } from \"../internal/use-exit-animation.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastItem, ToastPriority } from \"./toast.js\";\nimport { ToastRootContext, useToastRootContext, useToastViewportContext } from \"./toast-context.js\";\nimport type { ToastRootContextValue } from \"./toast-context.js\";\n\nexport interface ToastRootState {\n readonly toast: ToastItem;\n /** `toast.pending`: its promise is unsettled or its Action runs. */\n readonly pending: boolean;\n /** `toast.ending`: closed, kept for its exit animation. */\n readonly ending: boolean;\n readonly type: string | undefined;\n readonly priority: ToastPriority;\n}\n\nexport interface ToastRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"role\" | \"className\" | \"style\" | \"children\" | \"onKeyDown\"\n> {\n /** The toast to render: an item of the Viewport's `state.toasts`. */\n toast: ToastItem;\n children?: StateValue<ReactNode, ToastRootState>;\n className?: StateValue<string | undefined, ToastRootState>;\n style?: StateValue<CSSProperties | undefined, ToastRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, ToastRootState>;\n /**\n * Rendered by the Root's own Suspense guard while `children` suspend, in place of the\n * invisible default. The toast's timer and announcement wait for the reveal either way.\n * Parts inside it (a visually hidden `<Toast.Title>` giving the toast a name) gate nothing.\n */\n fallback?: ReactNode;\n}\n\n/**\n * The Suspense guard's fallback: renders the Root's `fallback` (nothing by default) and tells\n * the Root its content is suspended, so the timer and the announcement wait for the reveal\n * (design 3.5, 21).\n */\nfunction SuspenseGuard({ children }: { children: ReactNode }) {\n const { setSuspended } = useToastRootContext(\"Toast.Root\");\n useLayoutEffect(() => {\n setSuspended(true);\n return () => setSuspended(false);\n }, [setSuspended]);\n return children;\n}\n\n/**\n * One toast: a focusable `div[role=dialog]` (`alertdialog` for `priority: \"high\"`) named by its\n * Title and described by its Description. Escape dismisses it, ArrowDown / ArrowUp move to the\n * next / previous toast. Its children render inside a Suspense guard whose fallback is the\n * `fallback` prop (invisible by default), so a toast whose content suspends does not pull the whole Viewport into a boundary above it.\n * When the toast closes it stays with `data-ending` (and `inert`) until its exit animations end.\n *\n * Owned keys (conventions 1.2): `role`, `tabIndex`, `aria-labelledby`, `aria-describedby`,\n * `inert`, `data-type`, `data-pending`, `data-ending`, `onKeyDown`.\n */\nexport function ToastRoot({\n toast: item,\n children,\n className,\n style,\n render,\n fallback = null,\n ...rest\n}: ToastRootProps) {\n const viewport = useToastViewportContext(\"Toast.Root\");\n const id = item.id;\n const baseId = useId();\n const ids = useMemo(\n () => ({ title: `${baseId}title`, description: `${baseId}description` }),\n [baseId],\n );\n const elementRef = useRef<HTMLElement | null>(null);\n const titleRef = useRef<HTMLElement | null>(null);\n const descriptionRef = useRef<HTMLElement | null>(null);\n\n // Action pending, aggregated over the Action parts inside (normally one).\n const pendingTokens = useRef(new Set<object>());\n const [actionPending, setActionPendingState] = useState(false);\n // Suspended content behind the guard: a ref for effects of the same commit, state to re-run\n // the announcement once it reveals.\n const suspendedRef = useRef(false);\n const [suspended, setSuspendedState] = useState(false);\n\n const idRef = useLatest(id);\n // The Root's announcement effect has run once: later Title / Description commits are reveals.\n const announcedOnce = useRef(false);\n const revealQueued = useRef(false);\n\n const setActionPending = useCallback(\n (token: object, pending: boolean) => {\n const tokens = pendingTokens.current;\n if (pending) tokens.add(token);\n else tokens.delete(token);\n const any = tokens.size > 0;\n setActionPendingState(any);\n viewport.setActionPending(idRef.current, any);\n },\n [viewport, idRef],\n );\n\n const setSuspended = useCallback(\n (value: boolean) => {\n suspendedRef.current = value;\n setSuspendedState(value);\n viewport.setSuspended(idRef.current, value);\n },\n [viewport, idRef],\n );\n\n const close = useCallback(\n (reason: Parameters<ToastRootContextValue[\"close\"]>[0], event: Event | undefined) =>\n viewport.close([idRef.current], reason, event),\n [viewport, idRef],\n );\n\n const registerTitle = useCallback((element: HTMLElement | null) => {\n titleRef.current = element;\n }, []);\n const registerDescription = useCallback((element: HTMLElement | null) => {\n descriptionRef.current = element;\n }, []);\n\n const pending = item.pending || actionPending;\n const priority = item.priority ?? \"normal\";\n\n // Announce once the content has committed un-suspended (design 5): the Title and Description\n // text exists now. The Viewport skips text it already announced for this toast and speaks the\n // batch a microtask later.\n const announceNow = (): void => {\n if (item.ending || suspendedRef.current) return;\n const resolver = item.announce ?? viewport.announcer();\n let text: string | null;\n if (resolver !== undefined) text = resolver(item);\n else {\n text = [titleRef.current?.textContent, descriptionRef.current?.textContent]\n .map((t) => (t ?? \"\").trim())\n .filter((t) => t !== \"\")\n .join(\" \");\n }\n viewport.announce(item.id, text, priority);\n };\n const announceRef = useLatest(announceNow);\n\n // A Title or Description inside the consumer's own `<Suspense>` commits after the Root (the\n // boundary's retry does not re-run the Root's effect). Read once the whole reveal committed,\n // so a Title and a Description revealed together are announced as one text.\n const contentCommitted = useCallback(() => {\n if (!announcedOnce.current || revealQueued.current) return;\n revealQueued.current = true;\n queueMicrotask(() => {\n revealQueued.current = false;\n announceRef.current();\n });\n }, [announceRef]);\n const state = useMemo<ToastRootState>(\n () => ({ toast: item, pending, ending: item.ending, type: item.type, priority }),\n [item, pending, priority],\n );\n\n const context = useMemo<ToastRootContextValue>(\n () => ({\n toast: item,\n ids,\n state,\n registerTitle,\n registerDescription,\n contentCommitted,\n setActionPending,\n setSuspended,\n close,\n }),\n [\n item,\n ids,\n state,\n registerTitle,\n registerDescription,\n contentCommitted,\n setActionPending,\n setSuspended,\n close,\n ],\n );\n\n const rootRef = useCallback(\n (element: HTMLElement) => {\n elementRef.current = element;\n viewport.registerRoot(id, element);\n return () => {\n if (elementRef.current === element) elementRef.current = null;\n viewport.registerRoot(id, null);\n };\n },\n [viewport, id],\n );\n\n // A layout effect, so toasts announce in queue order (before the Viewport's own effect\n // announces the queued ones).\n useLayoutEffect(() => {\n announcedOnce.current = true;\n announceRef.current();\n }, [item, suspended, priority, announceRef]);\n\n // Exit (design 10.2): keep the ending toast until the animations the ending state started\n // settle, then drop it. Animations that ran before (a progress bar, paused with the region or\n // not) are not waited for: the Viewport recorded them just before marking the toast ending.\n useLayoutEffect(() => {\n if (!item.ending) return;\n const element = elementRef.current;\n const baseline = viewport.exitBaseline(item.id);\n const animations = element === null ? [] : exitAnimations(element, baseline);\n if (animations.length === 0) {\n viewport.drop(item.id);\n return;\n }\n let cancelled = false;\n void Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {\n if (!cancelled) viewport.drop(item.id);\n });\n return () => {\n cancelled = true;\n };\n }, [item.ending, item.id, viewport]);\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>): void => {\n if (event.defaultPrevented || item.ending) return;\n if (event.key === \"Escape\") {\n event.preventDefault();\n close(\"dismiss\", event.nativeEvent);\n } else if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n viewport.focusSibling(id, event.key === \"ArrowDown\" ? 1 : -1);\n }\n };\n\n const libraryProps: ComponentPropsWithRef<\"div\"> & DataAttributes = {\n role: priority === \"high\" ? \"alertdialog\" : \"dialog\",\n tabIndex: 0,\n \"aria-labelledby\": ids.title,\n \"aria-describedby\": ids.description,\n inert: item.ending || undefined,\n \"data-type\": item.type,\n \"data-pending\": dataAttr(pending),\n \"data-ending\": dataAttr(item.ending),\n onKeyDown,\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, ToastRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children: (s: ToastRootState) => (\n <Suspense fallback={<SuspenseGuard>{fallback}</SuspenseGuard>}>\n {resolveStateValue(children, s)}\n </Suspense>\n ),\n props: rest,\n libraryProps,\n ref: rootRef,\n });\n\n return <ToastRootContext value={context}>{element}</ToastRootContext>;\n}\n\nToastRoot.displayName = \"ToastRoot\";\n"],"mappings":";;;;;;;;;;;;;;;AA8CA,SAAS,cAAc,EAAE,YAAqC;CAC5D,MAAM,EAAE,iBAAiB,oBAAoB,YAAY;CACzD,sBAAsB;EACpB,aAAa,IAAI;EACjB,aAAa,aAAa,KAAK;CACjC,GAAG,CAAC,YAAY,CAAC;CACjB,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,UAAU,EACxB,OAAO,MACP,UACA,WACA,OACA,QACA,WAAW,MACX,GAAG,QACc;CACjB,MAAM,WAAW,wBAAwB,YAAY;CACrD,MAAM,KAAK,KAAK;CAChB,MAAM,SAAS,MAAM;CACrB,MAAM,MAAM,eACH;EAAE,OAAO,GAAG,OAAO;EAAQ,aAAa,GAAG,OAAO;CAAa,IACtE,CAAC,MAAM,CACT;CACA,MAAM,aAAa,OAA2B,IAAI;CAClD,MAAM,WAAW,OAA2B,IAAI;CAChD,MAAM,iBAAiB,OAA2B,IAAI;CAGtD,MAAM,gBAAgB,uBAAO,IAAI,IAAY,CAAC;CAC9C,MAAM,CAAC,eAAe,yBAAyB,SAAS,KAAK;CAG7D,MAAM,eAAe,OAAO,KAAK;CACjC,MAAM,CAAC,WAAW,qBAAqB,SAAS,KAAK;CAErD,MAAM,QAAQ,UAAU,EAAE;CAE1B,MAAM,gBAAgB,OAAO,KAAK;CAClC,MAAM,eAAe,OAAO,KAAK;CAEjC,MAAM,mBAAmB,aACtB,OAAe,YAAqB;EACnC,MAAM,SAAS,cAAc;EAC7B,IAAI,SAAS,OAAO,IAAI,KAAK;OACxB,OAAO,OAAO,KAAK;EACxB,MAAM,MAAM,OAAO,OAAO;EAC1B,sBAAsB,GAAG;EACzB,SAAS,iBAAiB,MAAM,SAAS,GAAG;CAC9C,GACA,CAAC,UAAU,KAAK,CAClB;CAEA,MAAM,eAAe,aAClB,UAAmB;EAClB,aAAa,UAAU;EACvB,kBAAkB,KAAK;EACvB,SAAS,aAAa,MAAM,SAAS,KAAK;CAC5C,GACA,CAAC,UAAU,KAAK,CAClB;CAEA,MAAM,QAAQ,aACX,QAAuD,UACtD,SAAS,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,KAAK,GAC/C,CAAC,UAAU,KAAK,CAClB;CAEA,MAAM,gBAAgB,aAAa,YAAgC;EACjE,SAAS,UAAU;CACrB,GAAG,CAAC,CAAC;CACL,MAAM,sBAAsB,aAAa,YAAgC;EACvE,eAAe,UAAU;CAC3B,GAAG,CAAC,CAAC;CAEL,MAAM,UAAU,KAAK,WAAW;CAChC,MAAM,WAAW,KAAK,YAAY;CAKlC,MAAM,oBAA0B;EAC9B,IAAI,KAAK,UAAU,aAAa,SAAS;EACzC,MAAM,WAAW,KAAK,YAAY,SAAS,UAAU;EACrD,IAAI;EACJ,IAAI,aAAa,KAAA,GAAW,OAAO,SAAS,IAAI;OAE9C,OAAO,CAAC,SAAS,SAAS,aAAa,eAAe,SAAS,WAAW,CAAC,CACxE,KAAK,OAAO,KAAK,GAAA,CAAI,KAAK,CAAC,CAAC,CAC5B,QAAQ,MAAM,MAAM,EAAE,CAAC,CACvB,KAAK,GAAG;EAEb,SAAS,SAAS,KAAK,IAAI,MAAM,QAAQ;CAC3C;CACA,MAAM,cAAc,UAAU,WAAW;CAKzC,MAAM,mBAAmB,kBAAkB;EACzC,IAAI,CAAC,cAAc,WAAW,aAAa,SAAS;EACpD,aAAa,UAAU;EACvB,qBAAqB;GACnB,aAAa,UAAU;GACvB,YAAY,QAAQ;EACtB,CAAC;CACH,GAAG,CAAC,WAAW,CAAC;CAChB,MAAM,QAAQ,eACL;EAAE,OAAO;EAAM;EAAS,QAAQ,KAAK;EAAQ,MAAM,KAAK;EAAM;CAAS,IAC9E;EAAC;EAAM;EAAS;CAAQ,CAC1B;CAEA,MAAM,UAAU,eACP;EACL,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,UAAU,aACb,YAAyB;EACxB,WAAW,UAAU;EACrB,SAAS,aAAa,IAAI,OAAO;EACjC,aAAa;GACX,IAAI,WAAW,YAAY,SAAS,WAAW,UAAU;GACzD,SAAS,aAAa,IAAI,IAAI;EAChC;CACF,GACA,CAAC,UAAU,EAAE,CACf;CAIA,sBAAsB;EACpB,cAAc,UAAU;EACxB,YAAY,QAAQ;CACtB,GAAG;EAAC;EAAM;EAAW;EAAU;CAAW,CAAC;CAK3C,sBAAsB;EACpB,IAAI,CAAC,KAAK,QAAQ;EAClB,MAAM,UAAU,WAAW;EAC3B,MAAM,WAAW,SAAS,aAAa,KAAK,EAAE;EAC9C,MAAM,aAAa,YAAY,OAAO,CAAC,IAAI,eAAe,SAAS,QAAQ;EAC3E,IAAI,WAAW,WAAW,GAAG;GAC3B,SAAS,KAAK,KAAK,EAAE;GACrB;EACF;EACA,IAAI,YAAY;EAChB,QAAa,WAAW,WAAW,KAAK,cAAc,UAAU,QAAQ,CAAC,CAAC,CAAC,WAAW;GACpF,IAAI,CAAC,WAAW,SAAS,KAAK,KAAK,EAAE;EACvC,CAAC;EACD,aAAa;GACX,YAAY;EACd;CACF,GAAG;EAAC,KAAK;EAAQ,KAAK;EAAI;CAAQ,CAAC;CAEnC,MAAM,aAAa,UAA4C;EAC7D,IAAI,MAAM,oBAAoB,KAAK,QAAQ;EAC3C,IAAI,MAAM,QAAQ,UAAU;GAC1B,MAAM,eAAe;GACrB,MAAM,WAAW,MAAM,WAAW;EACpC,OAAO,IAAI,MAAM,QAAQ,eAAe,MAAM,QAAQ,WAAW;GAC/D,MAAM,eAAe;GACrB,SAAS,aAAa,IAAI,MAAM,QAAQ,cAAc,IAAI,EAAE;EAC9D;CACF;CAEA,MAAM,eAA8D;EAClE,MAAM,aAAa,SAAS,gBAAgB;EAC5C,UAAU;EACV,mBAAmB,IAAI;EACvB,oBAAoB,IAAI;EACxB,OAAO,KAAK,UAAU,KAAA;EACtB,aAAa,KAAK;EAClB,gBAAgB,SAAS,OAAO;EAChC,eAAe,SAAS,KAAK,MAAM;EACnC;CACF;CAEA,MAAM,UAAU,UAAwD;EACtE,gBAAgB;EAChB;EACA;EACA;EACA;EACA,WAAW,MACT,oBAAC,UAAD;GAAU,UAAU,oBAAC,eAAD,EAAA,UAAgB,SAAwB,CAAA;GACzD,UAAA,kBAAkB,UAAU,CAAC;EACtB,CAAA;EAEZ,OAAO;EACP;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,kBAAD;EAAkB,OAAO;EAAU,UAAA;CAA0B,CAAA;AACtE;AAEA,UAAU,cAAc"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { ToastRootState } from "./toast-root.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/toast/toast-title.d.ts
|
|
5
|
+
export interface ToastTitleProps extends Omit<ComponentPropsWithRef<"div">, "id" | "className" | "style" | "children"> {
|
|
6
|
+
/** Default: the toast's `title`. */
|
|
7
|
+
children?: StateValue<ReactNode, ToastRootState>;
|
|
8
|
+
className?: StateValue<string | undefined, ToastRootState>;
|
|
9
|
+
style?: StateValue<CSSProperties | undefined, ToastRootState>;
|
|
10
|
+
render?: RenderProp<ComponentPropsWithRef<"div">, ToastRootState>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The toast's name: a `div` whose id the Root references with `aria-labelledby`. Not a heading,
|
|
14
|
+
* so transient notifications stay out of heading navigation. Its text is part of the default
|
|
15
|
+
* announcement.
|
|
16
|
+
*
|
|
17
|
+
* Owned key (conventions 1.2): `id`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ToastTitle({ children, className, style, render, ...rest }: ToastTitleProps): ReactNode;
|
|
20
|
+
export declare namespace ToastTitle {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//# sourceMappingURL=toast-title.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-title.d.mts","names":[],"sources":["../../src/toast/toast-title.tsx"],"mappings":";;;;iBAQiB,wBAAwB,KACvC;;EAIA,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,8BAA8B;;;;;;;;;wBAUpC,aAAa,UAAU,WAAW,OAAO,WAAW,QAAQ,kBAAe;yBAA3E"}
|