@funstack/ui 0.1.0-alpha.22 → 0.1.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion/accordion-context.mjs +1 -2
- package/dist/accordion/accordion-item.d.mts +1 -3
- package/dist/accordion/accordion-item.d.mts.map +1 -1
- package/dist/accordion/accordion-item.mjs +14 -8
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.d.mts +1 -3
- package/dist/accordion/accordion-panel.d.mts.map +1 -1
- package/dist/accordion/accordion-panel.mjs +3 -4
- package/dist/accordion/accordion-root.d.mts +1 -3
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +12 -15
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.d.mts +1 -3
- package/dist/accordion/accordion-trigger.d.mts.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +4 -5
- package/dist/accordion/index.d.mts +0 -2
- package/dist/accordion/index.d.mts.map +1 -1
- package/dist/accordion/index.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-action.d.mts +5 -5
- package/dist/alert-dialog/alert-dialog-action.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-action.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-action.mjs.map +1 -1
- package/dist/alert-dialog/alert-dialog-cancel.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-cancel.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-cancel.mjs +4 -5
- package/dist/alert-dialog/alert-dialog-context.mjs +2 -3
- package/dist/alert-dialog/alert-dialog-description.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-description.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-description.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-form.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-form.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-form.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-popup.d.mts +1 -3
- package/dist/alert-dialog/alert-dialog-popup.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-popup.mjs +3 -4
- package/dist/alert-dialog/alert-dialog-root.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-root.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-root.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-title.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-title.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-title.mjs +1 -2
- package/dist/alert-dialog/alert-dialog-trigger.d.mts +0 -2
- package/dist/alert-dialog/alert-dialog-trigger.d.mts.map +1 -1
- package/dist/alert-dialog/alert-dialog-trigger.mjs +1 -2
- package/dist/alert-dialog/index.d.mts +0 -2
- package/dist/alert-dialog/index.d.mts.map +1 -1
- package/dist/alert-dialog/index.mjs +1 -2
- package/dist/avatar/avatar-context.mjs +1 -2
- package/dist/avatar/avatar-fallback.d.mts +1 -3
- package/dist/avatar/avatar-fallback.d.mts.map +1 -1
- package/dist/avatar/avatar-fallback.mjs +1 -2
- package/dist/avatar/avatar-image.d.mts +1 -3
- package/dist/avatar/avatar-image.d.mts.map +1 -1
- package/dist/avatar/avatar-image.mjs +2 -3
- package/dist/avatar/avatar-root.d.mts +1 -3
- package/dist/avatar/avatar-root.d.mts.map +1 -1
- package/dist/avatar/avatar-root.mjs +2 -3
- package/dist/avatar/index.d.mts +1 -3
- package/dist/avatar/index.d.mts.map +1 -1
- package/dist/avatar/index.mjs +1 -2
- package/dist/bin/skill-installer.mjs +1 -2
- package/dist/button/button.d.mts +1 -3
- package/dist/button/button.d.mts.map +1 -1
- package/dist/button/button.mjs +4 -5
- package/dist/checkbox/checkbox.d.mts +1 -3
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +2 -3
- package/dist/checkbox-group/checkbox-group-context.mjs +1 -2
- package/dist/checkbox-group/checkbox-group-item.d.mts +1 -3
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +5 -6
- package/dist/checkbox-group/checkbox-group-label.d.mts +1 -3
- package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.mjs +1 -2
- package/dist/checkbox-group/checkbox-group-parent.d.mts +1 -3
- package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +7 -8
- package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +1 -3
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +7 -8
- package/dist/checkbox-group/index.d.mts +1 -3
- package/dist/checkbox-group/index.d.mts.map +1 -1
- package/dist/checkbox-group/index.mjs +1 -2
- package/dist/collapsible/collapsible-context.mjs +1 -2
- package/dist/collapsible/collapsible-panel.d.mts +1 -3
- package/dist/collapsible/collapsible-panel.d.mts.map +1 -1
- package/dist/collapsible/collapsible-panel.mjs +3 -4
- package/dist/collapsible/collapsible-root.d.mts +1 -3
- package/dist/collapsible/collapsible-root.d.mts.map +1 -1
- package/dist/collapsible/collapsible-root.mjs +18 -18
- package/dist/collapsible/collapsible-root.mjs.map +1 -1
- package/dist/collapsible/collapsible-trigger.d.mts +1 -3
- package/dist/collapsible/collapsible-trigger.d.mts.map +1 -1
- package/dist/collapsible/collapsible-trigger.mjs +4 -5
- package/dist/collapsible/index.d.mts +0 -2
- package/dist/collapsible/index.d.mts.map +1 -1
- package/dist/collapsible/index.mjs +1 -2
- package/dist/combobox/chip-text.mjs +1 -2
- package/dist/combobox/combobox-chips.d.mts +1 -3
- package/dist/combobox/combobox-chips.d.mts.map +1 -1
- package/dist/combobox/combobox-chips.mjs +3 -4
- package/dist/combobox/combobox-clear.d.mts +1 -3
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +2 -3
- package/dist/combobox/combobox-context.mjs +1 -2
- package/dist/combobox/combobox-group.d.mts +1 -3
- package/dist/combobox/combobox-group.d.mts.map +1 -1
- package/dist/combobox/combobox-group.mjs +2 -3
- package/dist/combobox/combobox-input.d.mts +1 -3
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +5 -6
- package/dist/combobox/combobox-keyboard.mjs +2 -3
- package/dist/combobox/combobox-label.d.mts +1 -3
- package/dist/combobox/combobox-label.d.mts.map +1 -1
- package/dist/combobox/combobox-label.mjs +2 -3
- package/dist/combobox/combobox-list.d.mts +1 -3
- package/dist/combobox/combobox-list.d.mts.map +1 -1
- package/dist/combobox/combobox-list.mjs +3 -4
- package/dist/combobox/combobox-option.d.mts +1 -3
- package/dist/combobox/combobox-option.d.mts.map +1 -1
- package/dist/combobox/combobox-option.mjs +2 -3
- package/dist/combobox/combobox-popup.d.mts +1 -3
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +4 -5
- package/dist/combobox/combobox-root.d.mts +1 -3
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +14 -15
- package/dist/combobox/combobox-trigger.d.mts +1 -3
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +5 -6
- package/dist/combobox/index.d.mts +1 -3
- package/dist/combobox/index.d.mts.map +1 -1
- package/dist/combobox/index.mjs +1 -2
- package/dist/combobox/use-combobox-form.mjs +3 -5
- package/dist/combobox/use-combobox-form.mjs.map +1 -1
- package/dist/combobox/use-combobox-text.mjs +3 -4
- package/dist/csp/csp-provider.d.mts +0 -2
- package/dist/csp/csp-provider.d.mts.map +1 -1
- package/dist/csp/csp-provider.mjs +2 -3
- package/dist/csp/style-hashes.d.mts +0 -2
- package/dist/csp/style-hashes.d.mts.map +1 -1
- package/dist/csp/style-hashes.mjs +1 -2
- package/dist/dialog/dialog-close.d.mts +10 -6
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +5 -5
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-context.mjs +1 -2
- package/dist/dialog/dialog-description.d.mts +1 -3
- package/dist/dialog/dialog-description.d.mts.map +1 -1
- package/dist/dialog/dialog-description.mjs +1 -2
- package/dist/dialog/dialog-dismiss.mjs +51 -21
- package/dist/dialog/dialog-dismiss.mjs.map +1 -1
- package/dist/dialog/dialog-form.d.mts +1 -3
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +6 -7
- package/dist/dialog/dialog-popup.d.mts +2 -4
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +10 -11
- package/dist/dialog/dialog-root.d.mts +1 -3
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +3 -4
- package/dist/dialog/dialog-title.d.mts +1 -3
- package/dist/dialog/dialog-title.d.mts.map +1 -1
- package/dist/dialog/dialog-title.mjs +1 -2
- package/dist/dialog/dialog-trigger.d.mts +1 -3
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +4 -5
- package/dist/dialog/index.d.mts +1 -3
- package/dist/dialog/index.d.mts.map +1 -1
- package/dist/dialog/index.mjs +1 -2
- package/dist/docs/components/accordion.md +1 -1
- package/dist/docs/components/alert-dialog.md +15 -7
- package/dist/docs/components/collapsible.md +1 -1
- package/dist/docs/components/dialog.md +14 -6
- package/dist/docs/components/drawer.md +3 -3
- package/dist/docs/components/menu.md +3 -3
- package/dist/docs/components/popover.md +6 -6
- package/dist/docs/concepts/pending-and-optimistic.md +1 -0
- package/dist/docs/roadmap.md +4 -0
- package/dist/drawer/drawer-close.d.mts +0 -2
- package/dist/drawer/drawer-close.d.mts.map +1 -1
- package/dist/drawer/drawer-close.mjs +1 -2
- package/dist/drawer/drawer-description.d.mts +0 -2
- package/dist/drawer/drawer-description.d.mts.map +1 -1
- package/dist/drawer/drawer-description.mjs +1 -2
- package/dist/drawer/drawer-form.d.mts +0 -2
- package/dist/drawer/drawer-form.d.mts.map +1 -1
- package/dist/drawer/drawer-form.mjs +1 -2
- package/dist/drawer/drawer-popup.d.mts +2 -4
- package/dist/drawer/drawer-popup.d.mts.map +1 -1
- package/dist/drawer/drawer-popup.mjs +3 -4
- package/dist/drawer/drawer-root.d.mts +0 -2
- package/dist/drawer/drawer-root.d.mts.map +1 -1
- package/dist/drawer/drawer-root.mjs +1 -2
- package/dist/drawer/drawer-swipe.d.mts +0 -2
- package/dist/drawer/drawer-swipe.d.mts.map +1 -1
- package/dist/drawer/drawer-swipe.mjs +1 -2
- package/dist/drawer/drawer-swipe.mjs.map +1 -1
- package/dist/drawer/drawer-title.d.mts +0 -2
- package/dist/drawer/drawer-title.d.mts.map +1 -1
- package/dist/drawer/drawer-title.mjs +1 -2
- package/dist/drawer/drawer-trigger.d.mts +0 -2
- package/dist/drawer/drawer-trigger.d.mts.map +1 -1
- package/dist/drawer/drawer-trigger.mjs +1 -2
- package/dist/drawer/index.d.mts +0 -2
- package/dist/drawer/index.d.mts.map +1 -1
- package/dist/drawer/index.mjs +1 -2
- package/dist/field/field-control.d.mts +2 -4
- package/dist/field/field-control.d.mts.map +1 -1
- package/dist/field/field-control.mjs +6 -7
- package/dist/field/field-description.d.mts +2 -4
- package/dist/field/field-description.d.mts.map +1 -1
- package/dist/field/field-description.mjs +2 -3
- package/dist/field/field-error.d.mts +2 -4
- package/dist/field/field-error.d.mts.map +1 -1
- package/dist/field/field-error.mjs +3 -4
- package/dist/field/field-label.d.mts +2 -4
- package/dist/field/field-label.d.mts.map +1 -1
- package/dist/field/field-label.mjs +3 -4
- package/dist/field/field-root.d.mts +2 -4
- package/dist/field/field-root.d.mts.map +1 -1
- package/dist/field/field-root.mjs +11 -16
- package/dist/field/field-root.mjs.map +1 -1
- package/dist/field/index.d.mts +0 -2
- package/dist/field/index.d.mts.map +1 -1
- package/dist/field/index.mjs +1 -2
- package/dist/field/use-server-error-visibility.mjs +1 -2
- package/dist/form/form-root.d.mts +1 -3
- package/dist/form/form-root.d.mts.map +1 -1
- package/dist/form/form-root.mjs +8 -9
- package/dist/form/form-submit.d.mts +1 -3
- package/dist/form/form-submit.d.mts.map +1 -1
- package/dist/form/form-submit.mjs +3 -4
- package/dist/form/index.d.mts +0 -2
- package/dist/form/index.d.mts.map +1 -1
- package/dist/form/index.mjs +1 -2
- package/dist/hover-card/hover-card-context.mjs +1 -2
- package/dist/hover-card/hover-card-popup.d.mts +2 -4
- package/dist/hover-card/hover-card-popup.d.mts.map +1 -1
- package/dist/hover-card/hover-card-popup.mjs +6 -7
- package/dist/hover-card/hover-card-root.d.mts +1 -3
- package/dist/hover-card/hover-card-root.d.mts.map +1 -1
- package/dist/hover-card/hover-card-root.mjs +3 -4
- package/dist/hover-card/hover-card-trigger.d.mts +1 -3
- package/dist/hover-card/hover-card-trigger.d.mts.map +1 -1
- package/dist/hover-card/hover-card-trigger.mjs +5 -6
- package/dist/hover-card/index.d.mts +0 -2
- package/dist/hover-card/index.d.mts.map +1 -1
- package/dist/hover-card/index.mjs +1 -2
- package/dist/hover-card/use-hover-card-interest.mjs +14 -8
- package/dist/hover-card/use-hover-card-interest.mjs.map +1 -1
- package/dist/index.d.mts +41 -35
- package/dist/internal/action/action-details.mjs +1 -2
- package/dist/internal/action/call-urgent-handler.mjs +1 -2
- package/dist/internal/action/report-dropped.mjs +1 -2
- package/dist/internal/action/use-action-trigger.mjs +2 -3
- package/dist/internal/action/use-connected.mjs +1 -2
- package/dist/internal/action/use-controllable-action.mjs +4 -5
- package/dist/internal/action/use-multiple-selection.mjs +4 -5
- package/dist/internal/action/use-pure-trigger.mjs +1 -2
- package/dist/internal/action/use-pure-trigger.mjs.map +1 -1
- package/dist/internal/action/use-step-commit.mjs +3 -4
- package/dist/internal/after-dispatch.mjs +23 -0
- package/dist/internal/after-dispatch.mjs.map +1 -0
- package/dist/internal/announce.mjs +1 -2
- package/dist/internal/arrow-keys.mjs +1 -2
- package/dist/internal/csp-context.mjs +1 -2
- package/dist/internal/data-attr.mjs +1 -2
- package/dist/internal/decimal.mjs +1 -2
- package/dist/internal/details-summary.mjs +51 -3
- package/dist/internal/details-summary.mjs.map +1 -1
- package/dist/internal/dev-warn.mjs +1 -2
- package/dist/internal/dom-order.mjs +1 -2
- package/dist/internal/form/field-context.d.mts +0 -2
- package/dist/internal/form/field-context.d.mts.map +1 -1
- package/dist/internal/form/field-context.mjs +2 -3
- package/dist/internal/form/focus-first-invalid.mjs +2 -3
- package/dist/internal/form/form-status-watcher.mjs +1 -2
- package/dist/internal/form/group-member.mjs +1 -2
- package/dist/internal/form/hidden-values.mjs +1 -2
- package/dist/internal/form/sync-presence.mjs +1 -2
- package/dist/internal/form/use-checkable-input.mjs +2 -3
- package/dist/internal/form/use-field-control.mjs +3 -4
- package/dist/internal/form/use-fieldset-group.mjs +3 -4
- package/dist/internal/form/use-form-owner-event.mjs +1 -2
- package/dist/internal/form/use-form-reset.mjs +10 -8
- package/dist/internal/form/use-form-reset.mjs.map +1 -1
- package/dist/internal/form/use-native-checked.mjs +2 -3
- package/dist/internal/form/use-native-group-reconciliation.mjs +3 -4
- package/dist/internal/form/use-native-select-value.mjs +2 -3
- package/dist/internal/form/validity.d.mts +0 -2
- package/dist/internal/form/validity.d.mts.map +1 -1
- package/dist/internal/form/validity.mjs +1 -2
- package/dist/internal/menubar-context.mjs +1 -2
- package/dist/internal/merge-props.mjs +1 -2
- package/dist/internal/overlay/anchor-position.d.mts +0 -2
- package/dist/internal/overlay/anchor-position.d.mts.map +1 -1
- package/dist/internal/overlay/anchor-position.mjs +1 -2
- package/dist/internal/overlay/content-focus-probe.mjs +1 -2
- package/dist/internal/overlay/css-transition-cut.mjs +1 -2
- package/dist/internal/overlay/css-transition-cut.mjs.map +1 -1
- package/dist/internal/overlay/focus-visible.mjs +1 -2
- package/dist/internal/overlay/invokers.mjs +1 -2
- package/dist/internal/overlay/modal-registry.mjs +1 -2
- package/dist/internal/overlay/overlay-popup.mjs +2 -3
- package/dist/internal/overlay/overlay-show.mjs +1 -2
- package/dist/internal/overlay/popover-open.mjs +1 -2
- package/dist/internal/overlay/trigger-ref.mjs +1 -2
- package/dist/internal/overlay/use-apply-open-state.mjs +1 -2
- package/dist/internal/overlay/use-exit-animation.mjs +1 -2
- package/dist/internal/overlay/use-exit-animation.mjs.map +1 -1
- package/dist/internal/overlay/use-interest-dismiss.mjs +3 -4
- package/dist/internal/overlay/use-modal-registration.mjs +2 -3
- package/dist/internal/overlay/use-overlay-close.mjs +11 -9
- package/dist/internal/overlay/use-overlay-close.mjs.map +1 -1
- package/dist/internal/overlay/use-overlay-root.d.mts +2 -2
- package/dist/internal/overlay/use-overlay-root.mjs +6 -7
- package/dist/internal/overlay/use-popover-popup.mjs +6 -7
- package/dist/internal/overlay/use-popover-trigger.d.mts +2 -4
- package/dist/internal/overlay/use-popover-trigger.d.mts.map +1 -1
- package/dist/internal/overlay/use-popover-trigger.mjs +4 -5
- package/dist/internal/overlay/use-resolved-placement.mjs +4 -5
- package/dist/internal/platform-attributes.d.mts +0 -2
- package/dist/internal/platform-attributes.d.mts.map +1 -1
- package/dist/internal/pointer-capture.mjs +1 -2
- package/dist/internal/range-value.mjs +1 -2
- package/dist/internal/render-element.d.mts +2 -2
- package/dist/internal/render-element.mjs +2 -3
- package/dist/internal/shipped-styles.mjs +1 -2
- package/dist/internal/swipe-arithmetic.mjs +0 -1
- package/dist/internal/swipe.mjs +2 -3
- package/dist/internal/toolbar-context.mjs +1 -2
- package/dist/internal/transition-boundary.mjs +2 -3
- package/dist/internal/transition-types.mjs +1 -2
- package/dist/internal/typeahead.mjs +0 -1
- package/dist/internal/types.d.mts +0 -2
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-active-option.mjs +1 -2
- package/dist/internal/use-deferred-leave.mjs +2 -3
- package/dist/internal/use-delayed-pair.mjs +1 -2
- package/dist/internal/use-dev-warning.mjs +0 -1
- package/dist/internal/use-element-check.mjs +1 -2
- package/dist/internal/use-hydrated-mount.mjs +1 -2
- package/dist/internal/use-item-order.mjs +2 -3
- package/dist/internal/use-latest.mjs +1 -2
- package/dist/internal/use-merged-refs.mjs +2 -3
- package/dist/internal/use-mount-fixed.mjs +2 -3
- package/dist/internal/use-name-warning.mjs +1 -2
- package/dist/internal/use-native-focusgroup.mjs +1 -2
- package/dist/internal/use-option-registry.mjs +3 -4
- package/dist/internal/use-register-count.mjs +1 -2
- package/dist/internal/use-render.d.mts +2 -2
- package/dist/internal/use-render.mjs +2 -3
- package/dist/internal/use-roving-focus.mjs +2 -3
- package/dist/internal/use-value-set.mjs +2 -3
- package/dist/internal/value-set.mjs +1 -2
- package/dist/menu/index.d.mts +2 -4
- package/dist/menu/index.d.mts.map +1 -1
- package/dist/menu/index.mjs +2 -3
- package/dist/menu/menu-checkbox-item.d.mts +1 -3
- package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
- package/dist/menu/menu-checkbox-item.mjs +3 -4
- package/dist/menu/menu-context-trigger.d.mts +1 -3
- package/dist/menu/menu-context-trigger.d.mts.map +1 -1
- package/dist/menu/menu-context-trigger.mjs +4 -5
- package/dist/menu/menu-context.mjs +1 -2
- package/dist/menu/menu-dom.mjs +1 -2
- package/dist/menu/menu-gestures.mjs +1 -2
- package/dist/menu/menu-group.d.mts +1 -3
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +2 -3
- package/dist/menu/menu-hover.mjs +1 -2
- package/dist/menu/menu-item.d.mts +3 -4
- package/dist/menu/menu-item.d.mts.map +1 -1
- package/dist/menu/menu-item.mjs +6 -3
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-outside.mjs +1 -2
- package/dist/menu/menu-point.mjs +1 -2
- package/dist/menu/menu-popup.d.mts +2 -4
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +13 -14
- package/dist/menu/menu-radio-group.d.mts +1 -3
- package/dist/menu/menu-radio-group.d.mts.map +1 -1
- package/dist/menu/menu-radio-group.mjs +3 -4
- package/dist/menu/menu-radio-item.d.mts +1 -3
- package/dist/menu/menu-radio-item.d.mts.map +1 -1
- package/dist/menu/menu-radio-item.mjs +2 -3
- package/dist/menu/menu-root.d.mts +1 -3
- package/dist/menu/menu-root.d.mts.map +1 -1
- package/dist/menu/menu-root.mjs +4 -5
- package/dist/menu/menu-submenu-trigger.d.mts +1 -3
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +5 -6
- package/dist/menu/menu-trigger.d.mts +1 -3
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +5 -6
- package/dist/menu/use-menu-item.mjs +2 -3
- package/dist/menu/use-menu-keyboard.mjs +2 -3
- package/dist/menubar/menubar.d.mts +1 -3
- package/dist/menubar/menubar.d.mts.map +1 -1
- package/dist/menubar/menubar.mjs +7 -8
- package/dist/meter/index.d.mts +1 -3
- package/dist/meter/index.d.mts.map +1 -1
- package/dist/meter/index.mjs +1 -2
- package/dist/meter/meter-context.mjs +1 -2
- package/dist/meter/meter-indicator.d.mts +1 -3
- package/dist/meter/meter-indicator.d.mts.map +1 -1
- package/dist/meter/meter-indicator.mjs +1 -2
- package/dist/meter/meter-label.d.mts +1 -3
- package/dist/meter/meter-label.d.mts.map +1 -1
- package/dist/meter/meter-label.mjs +1 -2
- package/dist/meter/meter-region.d.mts +0 -2
- package/dist/meter/meter-region.d.mts.map +1 -1
- package/dist/meter/meter-region.mjs +1 -2
- package/dist/meter/meter-root.d.mts +1 -3
- package/dist/meter/meter-root.d.mts.map +1 -1
- package/dist/meter/meter-root.mjs +4 -5
- package/dist/meter/meter-track.d.mts +1 -3
- package/dist/meter/meter-track.d.mts.map +1 -1
- package/dist/meter/meter-track.mjs +1 -2
- package/dist/meter/meter-value.d.mts +1 -3
- package/dist/meter/meter-value.d.mts.map +1 -1
- package/dist/meter/meter-value.mjs +1 -2
- package/dist/multi-select/index.d.mts +1 -3
- package/dist/multi-select/index.d.mts.map +1 -1
- package/dist/multi-select/index.mjs +1 -2
- package/dist/multi-select/multi-select-context.mjs +1 -2
- package/dist/multi-select/multi-select-group.d.mts +1 -3
- package/dist/multi-select/multi-select-group.d.mts.map +1 -1
- package/dist/multi-select/multi-select-group.mjs +2 -3
- package/dist/multi-select/multi-select-keyboard.mjs +1 -2
- package/dist/multi-select/multi-select-label.d.mts +1 -3
- package/dist/multi-select/multi-select-label.d.mts.map +1 -1
- package/dist/multi-select/multi-select-label.mjs +2 -3
- package/dist/multi-select/multi-select-list.d.mts +1 -3
- package/dist/multi-select/multi-select-list.d.mts.map +1 -1
- package/dist/multi-select/multi-select-list.mjs +3 -4
- package/dist/multi-select/multi-select-option.d.mts +1 -3
- package/dist/multi-select/multi-select-option.d.mts.map +1 -1
- package/dist/multi-select/multi-select-option.mjs +3 -4
- package/dist/multi-select/multi-select-popup.d.mts +1 -3
- package/dist/multi-select/multi-select-popup.d.mts.map +1 -1
- package/dist/multi-select/multi-select-popup.mjs +5 -6
- package/dist/multi-select/multi-select-root.d.mts +1 -3
- package/dist/multi-select/multi-select-root.d.mts.map +1 -1
- package/dist/multi-select/multi-select-root.mjs +12 -13
- package/dist/multi-select/multi-select-trigger.d.mts +1 -3
- package/dist/multi-select/multi-select-trigger.d.mts.map +1 -1
- package/dist/multi-select/multi-select-trigger.mjs +8 -9
- package/dist/multi-select/multi-select-value.d.mts +1 -3
- package/dist/multi-select/multi-select-value.d.mts.map +1 -1
- package/dist/multi-select/multi-select-value.mjs +1 -2
- package/dist/navigation-menu/index.d.mts +0 -2
- package/dist/navigation-menu/index.d.mts.map +1 -1
- package/dist/navigation-menu/index.mjs +1 -2
- package/dist/navigation-menu/navigation-menu-context.mjs +1 -2
- package/dist/navigation-menu/navigation-menu-item.d.mts +1 -3
- package/dist/navigation-menu/navigation-menu-item.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-item.mjs +3 -4
- package/dist/navigation-menu/navigation-menu-link.d.mts +1 -3
- package/dist/navigation-menu/navigation-menu-link.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-link.mjs +4 -5
- package/dist/navigation-menu/navigation-menu-list.d.mts +1 -3
- package/dist/navigation-menu/navigation-menu-list.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-list.mjs +1 -2
- package/dist/navigation-menu/navigation-menu-popup.d.mts +2 -4
- package/dist/navigation-menu/navigation-menu-popup.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-popup.mjs +8 -9
- package/dist/navigation-menu/navigation-menu-root.d.mts +1 -3
- package/dist/navigation-menu/navigation-menu-root.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-root.mjs +1 -2
- package/dist/navigation-menu/navigation-menu-trigger.d.mts +0 -2
- package/dist/navigation-menu/navigation-menu-trigger.d.mts.map +1 -1
- package/dist/navigation-menu/navigation-menu-trigger.mjs +2 -3
- package/dist/number-field/index.d.mts +2 -4
- package/dist/number-field/index.d.mts.map +1 -1
- package/dist/number-field/index.mjs +1 -2
- package/dist/number-field/number-field-arithmetic.mjs +1 -2
- package/dist/number-field/number-field-context.d.mts +1 -3
- package/dist/number-field/number-field-context.d.mts.map +1 -1
- package/dist/number-field/number-field-context.mjs +1 -2
- package/dist/number-field/number-field-decrement.d.mts +0 -2
- package/dist/number-field/number-field-decrement.d.mts.map +1 -1
- package/dist/number-field/number-field-decrement.mjs +1 -2
- package/dist/number-field/number-field-format.mjs +1 -2
- package/dist/number-field/number-field-increment.d.mts +0 -2
- package/dist/number-field/number-field-increment.d.mts.map +1 -1
- package/dist/number-field/number-field-increment.mjs +1 -2
- package/dist/number-field/number-field-input.d.mts +1 -3
- package/dist/number-field/number-field-input.d.mts.map +1 -1
- package/dist/number-field/number-field-input.mjs +4 -5
- package/dist/number-field/number-field-label.d.mts +1 -3
- package/dist/number-field/number-field-label.d.mts.map +1 -1
- package/dist/number-field/number-field-label.mjs +3 -4
- package/dist/number-field/number-field-root.d.mts +1 -3
- package/dist/number-field/number-field-root.d.mts.map +1 -1
- package/dist/number-field/number-field-root.mjs +7 -8
- package/dist/number-field/number-field-root.mjs.map +1 -1
- package/dist/number-field/use-number-field-dev-warnings.mjs +2 -3
- package/dist/number-field/use-step-button.d.mts +1 -3
- package/dist/number-field/use-step-button.d.mts.map +1 -1
- package/dist/number-field/use-step-button.mjs +2 -3
- package/dist/otp-field/index.d.mts +2 -4
- package/dist/otp-field/index.d.mts.map +1 -1
- package/dist/otp-field/index.mjs +1 -2
- package/dist/otp-field/otp-field-context.mjs +1 -2
- package/dist/otp-field/otp-field-filter.d.mts +0 -2
- package/dist/otp-field/otp-field-filter.d.mts.map +1 -1
- package/dist/otp-field/otp-field-filter.mjs +1 -2
- package/dist/otp-field/otp-field-input.d.mts +1 -3
- package/dist/otp-field/otp-field-input.d.mts.map +1 -1
- package/dist/otp-field/otp-field-input.mjs +6 -7
- package/dist/otp-field/otp-field-root.d.mts +1 -3
- package/dist/otp-field/otp-field-root.d.mts.map +1 -1
- package/dist/otp-field/otp-field-root.mjs +10 -11
- package/dist/otp-field/otp-field-slot.d.mts +1 -3
- package/dist/otp-field/otp-field-slot.d.mts.map +1 -1
- package/dist/otp-field/otp-field-slot.mjs +2 -3
- package/dist/popover/index.d.mts +2 -4
- package/dist/popover/index.d.mts.map +1 -1
- package/dist/popover/index.mjs +1 -2
- package/dist/popover/popover-close.d.mts +10 -6
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +3 -3
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-context.mjs +1 -2
- package/dist/popover/popover-description.d.mts +1 -3
- package/dist/popover/popover-description.d.mts.map +1 -1
- package/dist/popover/popover-description.mjs +1 -2
- package/dist/popover/popover-popup.d.mts +2 -4
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +4 -5
- package/dist/popover/popover-root.d.mts +1 -3
- package/dist/popover/popover-root.d.mts.map +1 -1
- package/dist/popover/popover-root.mjs +2 -3
- package/dist/popover/popover-title.d.mts +1 -3
- package/dist/popover/popover-title.d.mts.map +1 -1
- package/dist/popover/popover-title.mjs +1 -2
- package/dist/popover/popover-trigger.d.mts +1 -3
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +2 -3
- package/dist/progress/index.d.mts +1 -3
- package/dist/progress/index.d.mts.map +1 -1
- package/dist/progress/index.mjs +1 -2
- package/dist/progress/progress-context.mjs +1 -2
- package/dist/progress/progress-indicator.d.mts +1 -3
- package/dist/progress/progress-indicator.d.mts.map +1 -1
- package/dist/progress/progress-indicator.mjs +1 -2
- package/dist/progress/progress-label.d.mts +1 -3
- package/dist/progress/progress-label.d.mts.map +1 -1
- package/dist/progress/progress-label.mjs +1 -2
- package/dist/progress/progress-root.d.mts +1 -3
- package/dist/progress/progress-root.d.mts.map +1 -1
- package/dist/progress/progress-root.mjs +4 -5
- package/dist/progress/progress-track.d.mts +1 -3
- package/dist/progress/progress-track.d.mts.map +1 -1
- package/dist/progress/progress-track.mjs +1 -2
- package/dist/progress/progress-value.d.mts +1 -3
- package/dist/progress/progress-value.d.mts.map +1 -1
- package/dist/progress/progress-value.mjs +1 -2
- package/dist/radio-group/index.d.mts +1 -3
- package/dist/radio-group/index.d.mts.map +1 -1
- package/dist/radio-group/index.mjs +1 -2
- package/dist/radio-group/radio-group-context.mjs +1 -2
- package/dist/radio-group/radio-group-item.d.mts +1 -3
- package/dist/radio-group/radio-group-item.d.mts.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +3 -4
- package/dist/radio-group/radio-group-label.d.mts +1 -3
- package/dist/radio-group/radio-group-label.d.mts.map +1 -1
- package/dist/radio-group/radio-group-label.mjs +1 -2
- package/dist/radio-group/radio-group-root.d.mts +1 -3
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +4 -5
- package/dist/select/index.d.mts +1 -3
- package/dist/select/index.d.mts.map +1 -1
- package/dist/select/index.mjs +1 -2
- package/dist/select/select-context.mjs +1 -2
- package/dist/select/select-dom.mjs +2 -3
- package/dist/select/select-group-label.d.mts +1 -3
- package/dist/select/select-group-label.d.mts.map +1 -1
- package/dist/select/select-group-label.mjs +1 -2
- package/dist/select/select-group.d.mts +1 -3
- package/dist/select/select-group.d.mts.map +1 -1
- package/dist/select/select-group.mjs +2 -3
- package/dist/select/select-option.d.mts +1 -3
- package/dist/select/select-option.d.mts.map +1 -1
- package/dist/select/select-option.mjs +3 -4
- package/dist/select/select-root.d.mts +1 -3
- package/dist/select/select-root.d.mts.map +1 -1
- package/dist/select/select-root.mjs +6 -7
- package/dist/select/select-separator.d.mts +1 -3
- package/dist/select/select-separator.d.mts.map +1 -1
- package/dist/select/select-separator.mjs +1 -2
- package/dist/select/select-trigger.d.mts +1 -3
- package/dist/select/select-trigger.d.mts.map +1 -1
- package/dist/select/select-trigger.mjs +1 -2
- package/dist/select/select-value.d.mts +1 -3
- package/dist/select/select-value.d.mts.map +1 -1
- package/dist/select/select-value.mjs +3 -4
- package/dist/select/select-value.mjs.map +1 -1
- package/dist/separator/separator.d.mts +1 -3
- package/dist/separator/separator.d.mts.map +1 -1
- package/dist/separator/separator.mjs +1 -2
- package/dist/slider/index.d.mts +2 -4
- package/dist/slider/index.d.mts.map +1 -1
- package/dist/slider/index.mjs +1 -2
- package/dist/slider/slider-arithmetic.mjs +1 -2
- package/dist/slider/slider-context.mjs +1 -2
- package/dist/slider/slider-indicator.d.mts +1 -3
- package/dist/slider/slider-indicator.d.mts.map +1 -1
- package/dist/slider/slider-indicator.mjs +1 -2
- package/dist/slider/slider-label.d.mts +1 -3
- package/dist/slider/slider-label.d.mts.map +1 -1
- package/dist/slider/slider-label.mjs +3 -4
- package/dist/slider/slider-root.d.mts +1 -3
- package/dist/slider/slider-root.d.mts.map +1 -1
- package/dist/slider/slider-root.mjs +8 -9
- package/dist/slider/slider-thumb.d.mts +1 -3
- package/dist/slider/slider-thumb.d.mts.map +1 -1
- package/dist/slider/slider-thumb.mjs +5 -6
- package/dist/slider/slider-track.d.mts +1 -3
- package/dist/slider/slider-track.d.mts.map +1 -1
- package/dist/slider/slider-track.mjs +2 -3
- package/dist/slider/slider-value.d.mts +1 -3
- package/dist/slider/slider-value.d.mts.map +1 -1
- package/dist/slider/slider-value.mjs +1 -2
- package/dist/slider/use-slider-dev-warnings.mjs +2 -3
- package/dist/slider/use-thumb-registry.mjs +1 -2
- package/dist/switch/switch.d.mts +1 -3
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +2 -3
- package/dist/tabs/index.d.mts +0 -2
- package/dist/tabs/index.d.mts.map +1 -1
- package/dist/tabs/index.mjs +1 -2
- package/dist/tabs/tabs-context.d.mts +0 -2
- package/dist/tabs/tabs-context.d.mts.map +1 -1
- package/dist/tabs/tabs-context.mjs +1 -2
- package/dist/tabs/tabs-ids.mjs +1 -2
- package/dist/tabs/tabs-indicator.d.mts +1 -3
- package/dist/tabs/tabs-indicator.d.mts.map +1 -1
- package/dist/tabs/tabs-indicator.mjs +1 -2
- package/dist/tabs/tabs-list.d.mts +1 -3
- package/dist/tabs/tabs-list.d.mts.map +1 -1
- package/dist/tabs/tabs-list.mjs +4 -5
- package/dist/tabs/tabs-panel.d.mts +1 -3
- package/dist/tabs/tabs-panel.d.mts.map +1 -1
- package/dist/tabs/tabs-panel.mjs +4 -5
- package/dist/tabs/tabs-root.d.mts +1 -3
- package/dist/tabs/tabs-root.d.mts.map +1 -1
- package/dist/tabs/tabs-root.mjs +5 -6
- package/dist/tabs/tabs-tab.d.mts +1 -3
- package/dist/tabs/tabs-tab.d.mts.map +1 -1
- package/dist/tabs/tabs-tab.mjs +3 -4
- package/dist/tabs/use-until-found.mjs +1 -2
- package/dist/toast/index.d.mts +2 -4
- package/dist/toast/index.d.mts.map +1 -1
- package/dist/toast/index.mjs +2 -3
- package/dist/toast/toast-action.d.mts +1 -3
- package/dist/toast/toast-action.d.mts.map +1 -1
- package/dist/toast/toast-action.mjs +2 -3
- package/dist/toast/toast-close.d.mts +1 -3
- package/dist/toast/toast-close.d.mts.map +1 -1
- package/dist/toast/toast-close.mjs +2 -3
- package/dist/toast/toast-context.mjs +1 -2
- package/dist/toast/toast-description.d.mts +1 -3
- package/dist/toast/toast-description.d.mts.map +1 -1
- package/dist/toast/toast-description.mjs +2 -3
- package/dist/toast/toast-hotkey.mjs +1 -2
- package/dist/toast/toast-queue.mjs +1 -2
- package/dist/toast/toast-root.d.mts +1 -3
- package/dist/toast/toast-root.d.mts.map +1 -1
- package/dist/toast/toast-root.mjs +4 -5
- package/dist/toast/toast-root.mjs.map +1 -1
- package/dist/toast/toast-timers.mjs +1 -2
- package/dist/toast/toast-title.d.mts +1 -3
- package/dist/toast/toast-title.d.mts.map +1 -1
- package/dist/toast/toast-title.mjs +2 -3
- package/dist/toast/toast-viewport.d.mts +1 -3
- package/dist/toast/toast-viewport.d.mts.map +1 -1
- package/dist/toast/toast-viewport.mjs +9 -10
- package/dist/toast/toast.d.mts +1 -3
- package/dist/toast/toast.d.mts.map +1 -1
- package/dist/toast/toast.mjs +1 -2
- package/dist/toast/use-modal-portal-host.mjs +2 -3
- package/dist/toast/use-toast-announcements.mjs +2 -3
- package/dist/toast/use-toast-announcements.mjs.map +1 -1
- package/dist/toast/use-toast-focus.mjs +2 -3
- package/dist/toast/use-toast-pauses.mjs +2 -3
- package/dist/toggle/toggle.d.mts +1 -3
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +3 -4
- package/dist/toggle-group/index.d.mts +0 -2
- package/dist/toggle-group/index.d.mts.map +1 -1
- package/dist/toggle-group/index.mjs +1 -2
- package/dist/toggle-group/toggle-group-context.d.mts +0 -2
- package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-context.mjs +1 -2
- package/dist/toggle-group/toggle-group-item.d.mts +1 -3
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-item.mjs +2 -3
- package/dist/toggle-group/toggle-group-root.d.mts +1 -3
- package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-root.mjs +8 -9
- package/dist/toolbar/index.d.mts +0 -2
- package/dist/toolbar/index.d.mts.map +1 -1
- package/dist/toolbar/index.mjs +1 -2
- package/dist/toolbar/toolbar-root.d.mts +1 -3
- package/dist/toolbar/toolbar-root.d.mts.map +1 -1
- package/dist/toolbar/toolbar-root.mjs +3 -4
- package/dist/toolbar/toolbar-separator.d.mts +1 -3
- package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
- package/dist/toolbar/toolbar-separator.mjs +1 -2
- package/dist/tooltip/index.d.mts +0 -2
- package/dist/tooltip/index.d.mts.map +1 -1
- package/dist/tooltip/index.mjs +1 -2
- package/dist/tooltip/tooltip-arrow.d.mts +1 -3
- package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
- package/dist/tooltip/tooltip-arrow.mjs +2 -3
- package/dist/tooltip/tooltip-context.d.mts +0 -2
- package/dist/tooltip/tooltip-context.d.mts.map +1 -1
- package/dist/tooltip/tooltip-context.mjs +1 -2
- package/dist/tooltip/tooltip-popup.d.mts +1 -3
- package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
- package/dist/tooltip/tooltip-popup.mjs +4 -5
- package/dist/tooltip/tooltip-root.d.mts +1 -3
- package/dist/tooltip/tooltip-root.d.mts.map +1 -1
- package/dist/tooltip/tooltip-root.mjs +2 -3
- package/dist/tooltip/tooltip-trigger.d.mts +1 -3
- package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +6 -7
- package/dist/tooltip/tooltip-warm.mjs +1 -2
- package/dist/tooltip/use-tooltip-interaction.mjs +2 -3
- package/package.json +8 -8
- package/skills/funstack-ui-knowledge/SKILL.md +2 -2
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createContext } from "react";
|
|
3
|
-
|
|
3
|
+
// src/accordion/accordion-context.ts
|
|
4
4
|
const AccordionRootContext = createContext(null);
|
|
5
5
|
const AccordionItemContext = createContext(null);
|
|
6
|
-
//#endregion
|
|
7
6
|
export { AccordionItemContext, AccordionRootContext };
|
|
8
7
|
|
|
9
8
|
//# sourceMappingURL=accordion-context.mjs.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
1
|
import { CSSProperties, ComponentPropsWithRef, ReactNode, ViewTransitionClass } from "react";
|
|
3
|
-
|
|
2
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
4
3
|
/**
|
|
5
4
|
* State of `Accordion.Item`, passed to the function forms of `className`, `style`, `children` and
|
|
6
5
|
* `render`.
|
|
@@ -67,5 +66,4 @@ export declare function AccordionItem({ value, defaultOpen, disabled: disabledPr
|
|
|
67
66
|
export declare namespace AccordionItem {
|
|
68
67
|
var displayName: string;
|
|
69
68
|
}
|
|
70
|
-
//#endregion
|
|
71
69
|
//# sourceMappingURL=accordion-item.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-item.d.mts","names":[],"sources":["../../src/accordion/accordion-item.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"accordion-item.d.mts","names":[],"sources":["../../src/accordion/accordion-item.tsx"],"mappings":";;;;;;iBA8BiB;;WAEN;;WAEA;;WAEA;;WAEA;;;;;;;iBAQM,2BAA2B,KAC1C;;EAIA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;;;;EAUA,aAAa;;EAEb,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,kCAAkC;;;;;;;;;wBAUxC,gBACd,OACA,aACA,UAAU,cACV,YACA,WACA,OACA,UACA,WACG,QACF,qBAAkB;yBAVL"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { use, useCallback, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
2
4
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
5
|
+
import { isEcho, noteOpen, useCommittedOpenRecord, useDetailsCheck, writeOpen } from "../internal/details-summary.mjs";
|
|
3
6
|
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
4
|
-
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
5
7
|
import { useRender } from "../internal/use-render.mjs";
|
|
6
|
-
import { useDetailsCheck } from "../internal/details-summary.mjs";
|
|
7
8
|
import { AccordionItemContext, AccordionRootContext } from "./accordion-context.mjs";
|
|
8
|
-
import { use, useCallback, useMemo, useState } from "react";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
|
|
10
|
+
// src/accordion/accordion-item.tsx
|
|
11
11
|
const isDev = process.env.NODE_ENV !== "production";
|
|
12
12
|
/**
|
|
13
13
|
* One accordion entry: the `<details>` element. In library mode its `open` attribute follows
|
|
@@ -29,22 +29,29 @@ function AccordionItem({ value, defaultOpen = false, disabled: disabledProp = fa
|
|
|
29
29
|
useDevWarning(!isLibrary && transition !== void 0, isDev && "Accordion.Item: `transition` has no effect in JS-free mode; the browser toggles the item outside any React transition. Animate `::details-content` with CSS instead.");
|
|
30
30
|
const registerItem = root?.registerItem;
|
|
31
31
|
const checkElement = useDetailsCheck("Accordion.Item", isDev && "toggle, find-in-page, exclusive groups");
|
|
32
|
+
const detailsRef = useRef(null);
|
|
32
33
|
const libraryRef = useCallback((element) => {
|
|
33
34
|
checkElement?.(element);
|
|
35
|
+
if (isLibrary) noteOpen(element);
|
|
36
|
+
detailsRef.current = element;
|
|
34
37
|
const unregister = registerItem?.(value, element);
|
|
35
38
|
return () => {
|
|
39
|
+
detailsRef.current = null;
|
|
36
40
|
unregister?.();
|
|
37
41
|
};
|
|
38
42
|
}, [
|
|
39
43
|
checkElement,
|
|
40
44
|
registerItem,
|
|
41
|
-
value
|
|
45
|
+
value,
|
|
46
|
+
isLibrary
|
|
42
47
|
]);
|
|
48
|
+
useCommittedOpenRecord(detailsRef, committedOpen);
|
|
43
49
|
const onToggle = isLibrary ? (event) => {
|
|
44
50
|
const element = event.currentTarget;
|
|
45
|
-
if (element
|
|
51
|
+
if (isEcho(element)) return;
|
|
52
|
+
noteOpen(element);
|
|
46
53
|
if (disabled) {
|
|
47
|
-
if (!rootPending) element
|
|
54
|
+
if (!rootPending) writeOpen(element, committedOpen === true);
|
|
48
55
|
return;
|
|
49
56
|
}
|
|
50
57
|
root.dispatchFromDom(value, element.open, event.nativeEvent);
|
|
@@ -101,7 +108,6 @@ function AccordionItem({ value, defaultOpen = false, disabled: disabledProp = fa
|
|
|
101
108
|
}));
|
|
102
109
|
}
|
|
103
110
|
AccordionItem.displayName = "AccordionItem";
|
|
104
|
-
//#endregion
|
|
105
111
|
export { AccordionItem };
|
|
106
112
|
|
|
107
113
|
//# sourceMappingURL=accordion-item.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-item.mjs","names":[],"sources":["../../src/accordion/accordion-item.tsx"],"sourcesContent":["\"use client\";\nimport { use, useCallback, useMemo, useState } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n ReactNode,\n SyntheticEvent,\n ViewTransitionClass,\n} from \"react\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { useDetailsCheck } from \"../internal/details-summary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { AccordionItemContext, AccordionRootContext } from \"./accordion-context.js\";\nimport type { AccordionItemContextValue } from \"./accordion-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * State of `Accordion.Item`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface AccordionItemState {\n /** The Item's `value` prop. */\n readonly value: string;\n /** Optimistic open state. `undefined` in JS-free mode (browser-owned, unknown to React). */\n readonly open: boolean | undefined;\n /** This item's open state is changing through an in-flight action. */\n readonly pending: boolean;\n /** Disabled by its own prop or by the Root. */\n readonly disabled: boolean;\n}\n\n/**\n * Props of `Accordion.Item`.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport interface AccordionItemProps extends Omit<\n ComponentPropsWithRef<\"details\">,\n \"open\" | \"name\" | \"onToggle\" | \"className\" | \"style\" | \"children\"\n> {\n /** Identifies the item in the Root's `value`. Required in both modes. */\n value: string;\n /**\n * JS-free mode only: renders the initial `open` attribute; the browser owns it from then on.\n * Ignored (dev warning) in library mode, where the Root's `defaultValue` / `value` decide.\n *\n * @defaultValue `false`\n */\n defaultOpen?: boolean;\n /**\n * Disables this item: the Trigger renders `aria-disabled` and never toggles. Enforced by a\n * click handler, so in JS-free mode it does not hold before hydration or with JS off.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /**\n * Library mode only. Forwarded as `default` to the `<ViewTransition>` around the `<details>`;\n * animates the commit that ends an action (the `open` attribute flip), not the optimistic\n * `data-open` flip. Ignored (dev warning) in JS-free mode.\n *\n * Static: setting or unsetting it remounts the element. Any value, `\"none\"` included, makes a\n * mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms\n * page cross-fade that the next transition waits for).\n */\n transition?: ViewTransitionClass;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, AccordionItemState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, AccordionItemState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, AccordionItemState>;\n /** Must render a `<details>` element. */\n render?: RenderProp<ComponentPropsWithRef<\"details\">, AccordionItemState>;\n}\n\n/**\n * One accordion entry: the `<details>` element. In library mode its `open` attribute follows\n * committed state and `data-open` / `data-pending` follow optimistic state; in JS-free mode (or\n * outside any Root, as a standalone disclosure) the browser owns `open`.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport function AccordionItem({\n value,\n defaultOpen = false,\n disabled: disabledProp = false,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: AccordionItemProps) {\n const root = use(AccordionRootContext);\n const isLibrary = root?.mode === \"library\";\n const disabled = disabledProp || (root?.disabled ?? false);\n const committedOpen = isLibrary ? root.committed.has(value) : undefined;\n const optimisticOpen = isLibrary ? root.optimistic.has(value) : undefined;\n const rootPending = root?.pending ?? false;\n const pending = isLibrary && rootPending && committedOpen !== optimisticOpen;\n // JS-free mode: the prop React writes never changes after the first render, so React never\n // rewrites the attribute the browser now owns.\n const [staticOpen] = useState(defaultOpen);\n\n useDevWarning(\n isLibrary && defaultOpen,\n isDev &&\n \"Accordion.Item: `defaultOpen` is ignored in library mode. Use `defaultValue` or `value` on \" +\n \"Accordion.Root instead.\",\n );\n useDevWarning(\n !isLibrary && transition !== undefined,\n isDev &&\n \"Accordion.Item: `transition` has no effect in JS-free mode; the browser toggles the item \" +\n \"outside any React transition. Animate `::details-content` with CSS instead.\",\n );\n\n const registerItem = root?.registerItem;\n const checkElement = useDetailsCheck(\n \"Accordion.Item\",\n isDev && \"toggle, find-in-page, exclusive groups\",\n );\n const libraryRef = useCallback(\n (element: HTMLDetailsElement) => {\n checkElement?.(element);\n const unregister = registerItem?.(value, element);\n return () => {\n unregister?.();\n };\n },\n [checkElement, registerItem, value],\n );\n\n // Platform path (design 2.3): the Root reconciles pre-hydration clicks on mount and re-applies\n // committed state once nothing is in flight; this handler reports the browser's own flips.\n const onToggle = isLibrary\n ? (event: SyntheticEvent<HTMLDetailsElement>) => {\n const element = event.currentTarget;\n // Read `details.open`, never `ToggleEvent.newState`: `toggle` is coalesced.\n if (element.open === committedOpen) return; // our own commit echoing back\n if (disabled) {\n // A disabled item cannot be opened by the browser either; close it again now or, while\n // an action is in flight, when the Root re-applies committed state.\n if (!rootPending) element.open = committedOpen === true;\n return;\n }\n root.dispatchFromDom(value, element.open, event.nativeEvent);\n }\n : undefined;\n\n const state: AccordionItemState = { value, open: optimisticOpen, pending, disabled };\n const dispatch = root?.dispatch;\n const registerTrigger = root?.registerTrigger;\n // Memoised: changes only with this item's own values, not with every Root change.\n const itemContext = useMemo<AccordionItemContextValue>(\n () => ({\n value,\n disabled,\n committedOpen,\n optimisticOpen,\n pending,\n library: isLibrary,\n dispatch,\n registerTrigger,\n }),\n [value, disabled, committedOpen, optimisticOpen, pending, isLibrary, dispatch, registerTrigger],\n );\n\n const element = useRender<ComponentPropsWithRef<\"details\">, AccordionItemState>({\n defaultElement: \"details\",\n render,\n state,\n className,\n style,\n children,\n ref: libraryRef,\n props: rest,\n // Library-controlled layer: `open`, `name` and `onToggle` are owned by the library in at\n // least one mode, so a `render` element cannot override them either (conventions 1.2).\n libraryProps: {\n open: isLibrary ? committedOpen : staticOpen,\n // A click before hydration changes `open` under React's feet in both modes; the mismatch is\n // expected and reconciled (library mode) or the browser's business (JS-free mode).\n suppressHydrationWarning: true,\n // Owned in both modes: in library mode there is one writer of `open`, so a render element's\n // `name` (a second, platform-level writer) is removed.\n name: !isLibrary ? root?.name : undefined,\n // Only installed in library mode; owning the key in static mode would strip a render\n // element's own `onToggle`.\n ...(isLibrary && { onToggle }),\n \"data-open\": dataAttr(optimisticOpen === true),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n },\n });\n\n return useTransitionBoundary(\n \"Accordion.Item\",\n isLibrary ? transition : undefined,\n <AccordionItemContext value={itemContext}>{element}</AccordionItemContext>,\n );\n}\n\nAccordionItem.displayName = \"AccordionItem\";\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;AAqEvC,SAAgB,cAAc,EAC5B,OACA,cAAc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;EACA;EACA;EACA;EACA;EACA,KAAK;EACL,OAAO;EAGP,cAAc;GACZ,MAAM,YAAY,gBAAgB;GAGlC,0BAA0B;GAG1B,MAAM,CAAC,YAAY,MAAM,OAAO,KAAA;GAGhC,GAAI,aAAa,EAAE,SAAS;GAC5B,aAAa,SAAS,mBAAmB,IAAI;GAC7C,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;EACpC;CACF,CAAC;CAED,OAAO,sBACL,kBACA,YAAY,aAAa,KAAA,GACzB,oBAAC,sBAAD;EAAsB,OAAO;EAAc,UAAA;CAA8B,CAAA,CAC3E;AACF;AAEA,cAAc,cAAc"}
|
|
1
|
+
{"version":3,"file":"accordion-item.mjs","names":[],"sources":["../../src/accordion/accordion-item.tsx"],"sourcesContent":["\"use client\";\nimport { use, useCallback, useMemo, useRef, useState } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n ReactNode,\n SyntheticEvent,\n ViewTransitionClass,\n} from \"react\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport {\n isEcho,\n noteOpen,\n useCommittedOpenRecord,\n useDetailsCheck,\n writeOpen,\n} from \"../internal/details-summary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { AccordionItemContext, AccordionRootContext } from \"./accordion-context.js\";\nimport type { AccordionItemContextValue } from \"./accordion-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * State of `Accordion.Item`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface AccordionItemState {\n /** The Item's `value` prop. */\n readonly value: string;\n /** Optimistic open state. `undefined` in JS-free mode (browser-owned, unknown to React). */\n readonly open: boolean | undefined;\n /** This item's open state is changing through an in-flight action. */\n readonly pending: boolean;\n /** Disabled by its own prop or by the Root. */\n readonly disabled: boolean;\n}\n\n/**\n * Props of `Accordion.Item`.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport interface AccordionItemProps extends Omit<\n ComponentPropsWithRef<\"details\">,\n \"open\" | \"name\" | \"onToggle\" | \"className\" | \"style\" | \"children\"\n> {\n /** Identifies the item in the Root's `value`. Required in both modes. */\n value: string;\n /**\n * JS-free mode only: renders the initial `open` attribute; the browser owns it from then on.\n * Ignored (dev warning) in library mode, where the Root's `defaultValue` / `value` decide.\n *\n * @defaultValue `false`\n */\n defaultOpen?: boolean;\n /**\n * Disables this item: the Trigger renders `aria-disabled` and never toggles. Enforced by a\n * click handler, so in JS-free mode it does not hold before hydration or with JS off.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /**\n * Library mode only. Forwarded as `default` to the `<ViewTransition>` around the `<details>`;\n * animates the commit that ends an action (the `open` attribute flip), not the optimistic\n * `data-open` flip. Ignored (dev warning) in JS-free mode.\n *\n * Static: setting or unsetting it remounts the element. Any value, `\"none\"` included, makes a\n * mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms\n * page cross-fade that the next transition waits for).\n */\n transition?: ViewTransitionClass;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, AccordionItemState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, AccordionItemState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, AccordionItemState>;\n /** Must render a `<details>` element. */\n render?: RenderProp<ComponentPropsWithRef<\"details\">, AccordionItemState>;\n}\n\n/**\n * One accordion entry: the `<details>` element. In library mode its `open` attribute follows\n * committed state and `data-open` / `data-pending` follow optimistic state; in JS-free mode (or\n * outside any Root, as a standalone disclosure) the browser owns `open`.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport function AccordionItem({\n value,\n defaultOpen = false,\n disabled: disabledProp = false,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: AccordionItemProps) {\n const root = use(AccordionRootContext);\n const isLibrary = root?.mode === \"library\";\n const disabled = disabledProp || (root?.disabled ?? false);\n const committedOpen = isLibrary ? root.committed.has(value) : undefined;\n const optimisticOpen = isLibrary ? root.optimistic.has(value) : undefined;\n const rootPending = root?.pending ?? false;\n const pending = isLibrary && rootPending && committedOpen !== optimisticOpen;\n // JS-free mode: the prop React writes never changes after the first render, so React never\n // rewrites the attribute the browser now owns.\n const [staticOpen] = useState(defaultOpen);\n\n useDevWarning(\n isLibrary && defaultOpen,\n isDev &&\n \"Accordion.Item: `defaultOpen` is ignored in library mode. Use `defaultValue` or `value` on \" +\n \"Accordion.Root instead.\",\n );\n useDevWarning(\n !isLibrary && transition !== undefined,\n isDev &&\n \"Accordion.Item: `transition` has no effect in JS-free mode; the browser toggles the item \" +\n \"outside any React transition. Animate `::details-content` with CSS instead.\",\n );\n\n const registerItem = root?.registerItem;\n const checkElement = useDetailsCheck(\n \"Accordion.Item\",\n isDev && \"toggle, find-in-page, exclusive groups\",\n );\n const detailsRef = useRef<HTMLDetailsElement | null>(null);\n const libraryRef = useCallback(\n (element: HTMLDetailsElement) => {\n checkElement?.(element);\n // The known value starts as the DOM value read at attach (design 2.3).\n if (isLibrary) noteOpen(element);\n detailsRef.current = element;\n const unregister = registerItem?.(value, element);\n return () => {\n detailsRef.current = null;\n unregister?.();\n };\n },\n [checkElement, registerItem, value, isLibrary],\n );\n useCommittedOpenRecord(detailsRef, committedOpen);\n\n // Platform path (design 2.3): the Root reconciles pre-hydration clicks on mount and re-applies\n // committed state once nothing is in flight; this handler reports the browser's own flips.\n const onToggle = isLibrary\n ? (event: SyntheticEvent<HTMLDetailsElement>) => {\n const element = event.currentTarget;\n // Read `details.open`, never `ToggleEvent.newState`: `toggle` is coalesced. An echo is\n // recognised by the known value (the library's last write or read), not by committed\n // or intended state, which the browser can bring the DOM back to by itself.\n if (isEcho(element)) return;\n noteOpen(element); // a platform change: now known\n if (disabled) {\n // A disabled item cannot be opened by the browser either; close it again now or, while\n // an action is in flight, when the Root re-applies committed state.\n if (!rootPending) writeOpen(element, committedOpen === true);\n return;\n }\n root.dispatchFromDom(value, element.open, event.nativeEvent);\n }\n : undefined;\n\n const state: AccordionItemState = { value, open: optimisticOpen, pending, disabled };\n const dispatch = root?.dispatch;\n const registerTrigger = root?.registerTrigger;\n // Memoised: changes only with this item's own values, not with every Root change.\n const itemContext = useMemo<AccordionItemContextValue>(\n () => ({\n value,\n disabled,\n committedOpen,\n optimisticOpen,\n pending,\n library: isLibrary,\n dispatch,\n registerTrigger,\n }),\n [value, disabled, committedOpen, optimisticOpen, pending, isLibrary, dispatch, registerTrigger],\n );\n\n const element = useRender<ComponentPropsWithRef<\"details\">, AccordionItemState>({\n defaultElement: \"details\",\n render,\n state,\n className,\n style,\n children,\n ref: libraryRef,\n props: rest,\n // Library-controlled layer: `open`, `name` and `onToggle` are owned by the library in at\n // least one mode, so a `render` element cannot override them either (conventions 1.2).\n libraryProps: {\n open: isLibrary ? committedOpen : staticOpen,\n // A click before hydration changes `open` under React's feet in both modes; the mismatch is\n // expected and reconciled (library mode) or the browser's business (JS-free mode).\n suppressHydrationWarning: true,\n // Owned in both modes: in library mode there is one writer of `open`, so a render element's\n // `name` (a second, platform-level writer) is removed.\n name: !isLibrary ? root?.name : undefined,\n // Only installed in library mode; owning the key in static mode would strip a render\n // element's own `onToggle`.\n ...(isLibrary && { onToggle }),\n \"data-open\": dataAttr(optimisticOpen === true),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n },\n });\n\n return useTransitionBoundary(\n \"Accordion.Item\",\n isLibrary ? transition : undefined,\n <AccordionItemContext value={itemContext}>{element}</AccordionItemContext>,\n );\n}\n\nAccordionItem.displayName = \"AccordionItem\";\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;AAqEvC,SAAgB,cAAc,EAC5B,OACA,cAAc,OACd,UAAU,eAAe,OACzB,YACA,WACA,OACA,UACA,QACA,GAAG,QACkB;CACrB,MAAM,OAA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gB;EAAS;EAAW;EAAU;CAAe,CAChG;CAEA,MAAM,UAAU,UAAgE;EAC9E,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,KAAK;EACL,OAAO;EAGP,cAAc;GACZ,MAAM,YAAY,gBAAgB;GAGlC,0BAA0B;GAG1B,MAAM,CAAC,YAAY,MAAM,OAAO,KAAA;GAGhC,GAAI,aAAa,EAAE,SAAS;GAC5B,aAAa,SAAS,mBAAmB,IAAI;GAC7C,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;EACpC;CACF,CAAC;CAED,OAAO,sBACL,kBACA,YAAY,aAAa,KAAA,GACzB,oBAAC,sBAAD;EAAsB,OAAO;EAAc,UAAA;CAA8B,CAAA,CAC3E;AACF;AAEA,cAAc,cAAc"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
1
|
import { CSSProperties, ComponentPropsWithRef, ReactNode, ViewTransitionClass } from "react";
|
|
3
|
-
|
|
2
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
4
3
|
/**
|
|
5
4
|
* State of `Accordion.Panel`, passed to the function forms of `className`, `style`, `children` and
|
|
6
5
|
* `render`.
|
|
@@ -51,5 +50,4 @@ export declare function AccordionPanel({ transition, className, style, children,
|
|
|
51
50
|
export declare namespace AccordionPanel {
|
|
52
51
|
var displayName: string;
|
|
53
52
|
}
|
|
54
|
-
//#endregion
|
|
55
53
|
//# sourceMappingURL=accordion-panel.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-panel.d.mts","names":[],"sources":["../../src/accordion/accordion-panel.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"accordion-panel.d.mts","names":[],"sources":["../../src/accordion/accordion-panel.tsx"],"mappings":";;;;;;iBAgBiB;;WAEN;;WAEA;;WAEA;;;;;;;iBAQM,4BAA4B,KAC3C;;;;;;;;;EAWA,aAAa;;EAEb,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;;;;;EAM9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,8BAA8B;;;;;;;;wBASpC,iBACd,YACA,WACA,OACA,UACA,WACG,QACF,sBAAmB;yBAPN"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { use } from "react";
|
|
3
|
+
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
2
4
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
5
|
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
4
|
-
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
5
6
|
import { useRender } from "../internal/use-render.mjs";
|
|
6
7
|
import { AccordionItemContext } from "./accordion-context.mjs";
|
|
7
|
-
|
|
8
|
-
//#region src/accordion/accordion-panel.tsx
|
|
8
|
+
// src/accordion/accordion-panel.tsx
|
|
9
9
|
const isDev = process.env.NODE_ENV !== "production";
|
|
10
10
|
/**
|
|
11
11
|
* The item's content region: a `div` inside the `<details>`, after the Trigger. Its visibility
|
|
@@ -36,7 +36,6 @@ function AccordionPanel({ transition, className, style, children, render, ...res
|
|
|
36
36
|
return useTransitionBoundary("Accordion.Panel", isLibrary ? transition : void 0, element);
|
|
37
37
|
}
|
|
38
38
|
AccordionPanel.displayName = "AccordionPanel";
|
|
39
|
-
//#endregion
|
|
40
39
|
export { AccordionPanel };
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=accordion-panel.mjs.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ActionDetails, ChangeAction, ChangeReason, RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
1
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
-
|
|
2
|
+
import { ActionDetails, ChangeAction, ChangeReason, RenderProp, StateValue } from "../internal/types.mjs";
|
|
4
3
|
/**
|
|
5
4
|
* State of `Accordion.Root`, passed to the function forms of `className`, `style`, `children` and
|
|
6
5
|
* `render`.
|
|
@@ -119,6 +118,5 @@ export declare function AccordionRoot(props: AccordionRootProps): import("react"
|
|
|
119
118
|
export declare namespace AccordionRoot {
|
|
120
119
|
var displayName: string;
|
|
121
120
|
}
|
|
122
|
-
//#endregion
|
|
123
121
|
export {};
|
|
124
122
|
//# sourceMappingURL=accordion-root.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-root.d.mts","names":[],"sources":["../../src/accordion/accordion-root.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"accordion-root.d.mts","names":[],"sources":["../../src/accordion/accordion-root.tsx"],"mappings":";;;;;;iBAoCiB;;WAEN;;WAEA;;;iBAIM,oCAAoC;;;;;;;WAO1C,QAAQ;;WAER;;WAEA;;UAGD,+BAA+B,KACvC;;;;;;EASA;;;;;;;;EAQA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,8BAA8B;;;;;;;;iBASnC,mCAAmC;;;;;;EAMlD;;EAEA;;EAEA;;;;;;;;;;;;EAYA,oBAAoB,uBAAuB;;;;;;;;iBAS5B,oCAAoC;;;;;EAKnD;;EAEA;;EAEA;;EAEA,oBAAoB,4BAA4B;;;;;;;;;;;;YAatC,qBAAqB,6BAA6B;;;;;;;wBA8D9C,cAAc,OAAO,qCAAkB,IAAA;yBAAvC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useCallback, useEffectEvent, useId, useLayoutEffect, useMemo, useRef } from "react";
|
|
2
3
|
import { createActionDetails } from "../internal/action/action-details.mjs";
|
|
3
|
-
import {
|
|
4
|
+
import { resolveArrowKey } from "../internal/arrow-keys.mjs";
|
|
4
5
|
import { resolveStateValue } from "../internal/render-element.mjs";
|
|
5
|
-
import {
|
|
6
|
+
import { dataAttr } from "../internal/data-attr.mjs";
|
|
7
|
+
import { noteOpen, writeOpen } from "../internal/details-summary.mjs";
|
|
8
|
+
import { compareDocumentOrder, sortByDocumentOrder } from "../internal/dom-order.mjs";
|
|
6
9
|
import { transitionTypes } from "../internal/transition-types.mjs";
|
|
7
|
-
import { useLatest } from "../internal/use-latest.mjs";
|
|
8
10
|
import { intendedValue, useControllableAction } from "../internal/action/use-controllable-action.mjs";
|
|
9
|
-
import { compareDocumentOrder, sortByDocumentOrder } from "../internal/dom-order.mjs";
|
|
10
11
|
import { useMountFixed } from "../internal/use-mount-fixed.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
12
|
+
import { useLatest } from "../internal/use-latest.mjs";
|
|
13
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
13
14
|
import { useValueSet } from "../internal/use-value-set.mjs";
|
|
15
|
+
import { EMPTY_SET, setsEqual, sortByOrder } from "../internal/value-set.mjs";
|
|
14
16
|
import { AccordionRootContext } from "./accordion-context.mjs";
|
|
15
|
-
import { useCallback, useEffectEvent, useId, useLayoutEffect, useMemo, useRef } from "react";
|
|
16
17
|
import { jsx } from "react/jsx-runtime";
|
|
17
|
-
|
|
18
|
+
// src/accordion/accordion-root.tsx
|
|
18
19
|
const isDev = process.env.NODE_ENV !== "production";
|
|
19
20
|
/**
|
|
20
21
|
* Converts the open set back to the public value. Multiple mode lists the items in `order` (the
|
|
@@ -39,10 +40,6 @@ function reduce(set, item, open, exclusive) {
|
|
|
39
40
|
if (exclusive) return /* @__PURE__ */ new Set([item]);
|
|
40
41
|
return set.has(item) ? set : new Set(set).add(item);
|
|
41
42
|
}
|
|
42
|
-
/** Writes `open` to the DOM; it fires `toggle`, whose handler sees DOM === committed and returns. */
|
|
43
|
-
function applyOpen(element, open) {
|
|
44
|
-
if (element.open !== open) element.open = open;
|
|
45
|
-
}
|
|
46
43
|
function isEnabledTrigger(el) {
|
|
47
44
|
return el.getAttribute("aria-disabled") !== "true";
|
|
48
45
|
}
|
|
@@ -134,9 +131,10 @@ function AccordionRoot(props) {
|
|
|
134
131
|
const base = intendedValue(latestInFlight, optimistic);
|
|
135
132
|
const mismatches = [];
|
|
136
133
|
for (const [element, item] of sortedItems()) {
|
|
134
|
+
noteOpen(element);
|
|
137
135
|
const want = committed.has(item);
|
|
138
136
|
if (element.open === want) continue;
|
|
139
|
-
if (element.hasAttribute("data-disabled"))
|
|
137
|
+
if (element.hasAttribute("data-disabled")) writeOpen(element, want);
|
|
140
138
|
else mismatches.push({
|
|
141
139
|
item,
|
|
142
140
|
open: element.open
|
|
@@ -154,7 +152,7 @@ function AccordionRoot(props) {
|
|
|
154
152
|
}, [isLibrary]);
|
|
155
153
|
useLayoutEffect(() => {
|
|
156
154
|
if (!isLibrary || pending || latestInFlight() !== null) return;
|
|
157
|
-
for (const [element, item] of items.current)
|
|
155
|
+
for (const [element, item] of items.current) writeOpen(element, committed.has(item));
|
|
158
156
|
}, [
|
|
159
157
|
isLibrary,
|
|
160
158
|
pending,
|
|
@@ -231,7 +229,6 @@ function AccordionRoot(props) {
|
|
|
231
229
|
});
|
|
232
230
|
}
|
|
233
231
|
AccordionRoot.displayName = "AccordionRoot";
|
|
234
|
-
//#endregion
|
|
235
232
|
export { AccordionRoot };
|
|
236
233
|
|
|
237
234
|
//# sourceMappingURL=accordion-root.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-root.mjs","names":[],"sources":["../../src/accordion/accordion-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useEffectEvent, useId, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, KeyboardEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action/action-details.js\";\nimport { resolveArrowKey } from \"../internal/arrow-keys.js\";\nimport type { ArrowMove } from \"../internal/arrow-keys.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { compareDocumentOrder, sortByDocumentOrder } from \"../internal/dom-order.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n RenderProp,\n StateValue,\n} from \"../internal/types.js\";\nimport {\n intendedValue,\n useControllableAction,\n} from \"../internal/action/use-controllable-action.js\";\nimport { useMountFixed } from \"../internal/use-mount-fixed.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport { useValueSet } from \"../internal/use-value-set.js\";\nimport { EMPTY_SET, setsEqual, sortByOrder } from \"../internal/value-set.js\";\nimport type { ValueSet } from \"../internal/value-set.js\";\nimport { AccordionRootContext } from \"./accordion-context.js\";\nimport type { AccordionMode, AccordionRootContextValue } from \"./accordion-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * State of `Accordion.Root`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface AccordionRootState {\n /** An action dispatched through this Accordion is in flight (library mode only). */\n readonly pending: boolean;\n /** The Root's `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/** Details passed as the second argument of `valueChangeAction`. */\nexport interface AccordionValueChangeDetails extends ActionDetails {\n /**\n * The shared vocabulary (conventions 2.2); Accordion dispatches two of its values.\n * `\"activate\"`: the user activated a Trigger. `\"platform\"`: the browser changed `open` itself\n * (find-in-page, a text fragment, a click before hydration); `event` is then the `toggle`\n * event, or `undefined` when the mismatch was found on mount.\n */\n readonly reason: ChangeReason;\n /** The item whose open state changed. */\n readonly item: string;\n /** That item's new open state. */\n readonly open: boolean;\n}\n\ninterface AccordionRootBaseProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n // `defaultValue` is also a native HTMLAttributes member; the Accordion's own definition wins.\n \"onKeyDown\" | \"defaultValue\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Disables every item: triggers render `aria-disabled` and never dispatch.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /**\n * Renders `interpolate-size: allow-keywords` on the root so `::details-content` can transition\n * `height` to `auto`. Chromium-only polish today; use the `grid-template-rows` form for a\n * cross-engine animation. Merged with `style`; the consumer's declaration wins.\n *\n * @defaultValue `false`\n */\n experimental_interpolateSize?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, AccordionRootState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, AccordionRootState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, AccordionRootState>;\n /** Replace the default `<div>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"div\">, AccordionRootState>;\n}\n\n/**\n * Props of `Accordion.Root` in multiple mode (the default): any number of items open, `value` is\n * a `string[]`.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport interface AccordionRootMultipleProps extends AccordionRootBaseProps {\n /**\n * Any number of items may be open.\n *\n * @defaultValue `false`\n */\n exclusive?: false;\n /** Controlled open items. `undefined` means uncontrolled; `[]` means none open. */\n value?: string[];\n /** Initial open items in uncontrolled library mode. */\n defaultValue?: string[];\n /**\n * Called with the next open items on every change. Runs inside the Root's transition; may be\n * sync or async (also a Server Function). Rejections reach the nearest Error Boundary.\n *\n * May also be called with `details.reason === \"platform\"` when the browser opened an item\n * itself (find-in-page, a click before hydration); committed state is re-applied to the DOM\n * once the action settles.\n *\n * A `setState` placed after your own `await` is not a Transition update; wrap it in\n * `startTransition` (React limitation).\n */\n valueChangeAction?: ChangeAction<string[], AccordionValueChangeDetails>;\n}\n\n/**\n * Props of `Accordion.Root` in exclusive mode (`exclusive`): at most one item open, `value` is\n * `string | null`.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport interface AccordionRootExclusiveProps extends AccordionRootBaseProps {\n /**\n * At most one item open. JS-free mode: renders the same `name` on every `<details>` (the\n * platform's exclusive group). Library mode: the value is a single item or `null`.\n */\n exclusive: true;\n /** Controlled open item. `undefined` means uncontrolled; `null` means none open. */\n value?: string | null;\n /** Initial open item in uncontrolled library mode. */\n defaultValue?: string | null;\n /** See {@link AccordionRootMultipleProps.valueChangeAction}. */\n valueChangeAction?: ChangeAction<string | null, AccordionValueChangeDetails>;\n}\n\n/**\n * Props of `Accordion.Root`, discriminated on `exclusive`.\n *\n * Without `value`, `defaultValue` and `valueChangeAction` the Accordion runs in **JS-free mode**:\n * the browser owns each `<details open>`, nothing runs on toggle, and `exclusive` renders `name`.\n * With any of them it runs in **library mode**: the summary click is intercepted, `open` is driven\n * by committed state inside a transition, and triggers show optimistic `data-open`.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport type AccordionRootProps = AccordionRootMultipleProps | AccordionRootExclusiveProps;\n\ntype AccordionValue = string[] | string | null;\ntype OpenSet = ValueSet;\n\n/**\n * Converts the open set back to the public value. Multiple mode lists the items in `order` (the\n * registered Items' values in document order, design 2.3), not in the order they were opened;\n * unregistered values keep their insertion order at the end.\n */\nfunction fromSet(set: OpenSet, exclusive: boolean, order: readonly string[]): AccordionValue {\n if (exclusive) {\n const [first] = set;\n return first ?? null;\n }\n return sortByOrder(set, order);\n}\n\n/** The optimistic reducer of design 4.1: add/remove one item, or replace when exclusive. */\nfunction reduce(set: OpenSet, item: string, open: boolean, exclusive: boolean): OpenSet {\n if (!open) {\n if (!set.has(item)) return set;\n const next = new Set(set);\n next.delete(item);\n return next;\n }\n if (exclusive) return new Set([item]);\n return set.has(item) ? set : new Set(set).add(item);\n}\n\n/** Writes `open` to the DOM; it fires `toggle`, whose handler sees DOM === committed and returns. */\nfunction applyOpen(element: HTMLDetailsElement, open: boolean): void {\n if (element.open !== open) element.open = open;\n}\n\nfunction isEnabledTrigger(el: HTMLElement): boolean {\n return el.getAttribute(\"aria-disabled\") !== \"true\";\n}\n\n/**\n * Picks the trigger to focus for a move (ArrowDown / ArrowUp / Home / End, `resolveArrowKey` on\n * the vertical axis): `sorted` is every registered trigger in document order; disabled ones are\n * skipped; arrows wrap. Works when `current` is itself disabled (disabled triggers stay\n * focusable), which is why this is not the roving engine's index arithmetic.\n */\nfunction nextTrigger(\n sorted: readonly HTMLElement[],\n current: HTMLElement,\n move: ArrowMove,\n): HTMLElement | undefined {\n const enabled = sorted.filter(isEnabledTrigger);\n if (enabled.length === 0) return undefined;\n if (move === \"first\") return enabled[0];\n if (move === \"last\") return enabled[enabled.length - 1];\n const position = sorted.indexOf(current);\n if (move === \"next\") {\n return enabled.find((el) => sorted.indexOf(el) > position) ?? enabled[0];\n }\n return enabled.findLast((el) => sorted.indexOf(el) < position) ?? enabled[enabled.length - 1];\n}\n\n/**\n * The accordion container: a `div` that owns the open state, the transition, the context the\n * other parts read, and ArrowUp/ArrowDown/Home/End navigation between triggers.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport function AccordionRoot(props: AccordionRootProps) {\n const {\n exclusive: exclusiveProp = false,\n value,\n defaultValue,\n valueChangeAction,\n disabled = false,\n experimental_interpolateSize = false,\n className,\n style,\n children,\n render,\n ...rest\n } = props;\n\n // Mode is decided once, from the first render's props (design 12).\n const isLibraryNow =\n value !== undefined || defaultValue !== undefined || valueChangeAction !== undefined;\n const mode = useMountFixed<AccordionMode>(\n isLibraryNow ? \"library\" : \"static\",\n isDev &&\n \"Accordion.Root: the mode changed after mount (`value`, `defaultValue` and `valueChangeAction` \" +\n \"were all absent on one render and present on another). Switching between JS-free and \" +\n \"library mode is not supported.\",\n );\n\n // Exclusive or multiple is decided once too, like ToggleGroup's mode (design 12): the reducer,\n // the value shape handed to the action and the static `name` all follow the mounted mode.\n const exclusive = useMountFixed(\n exclusiveProp,\n isDev &&\n \"Accordion.Root: `exclusive` changed after mount. Switching between exclusive and \" +\n \"multiple mode is not supported; the accordion keeps the mode it mounted with.\",\n );\n\n // Both prop variants are narrowed by `exclusive` at the call site; internally one signature.\n const action = valueChangeAction as\n | ChangeAction<AccordionValue, AccordionValueChangeDetails>\n | undefined;\n\n const controlledSet = useValueSet(value);\n const defaultSet = useValueSet(defaultValue);\n\n const items = useRef(new Map<HTMLDetailsElement, string>());\n const triggers = useRef(new Set<HTMLElement>());\n /** The registered Items in document order. Reads the DOM: handlers and effects only. */\n const sortedItems = (): [HTMLDetailsElement, string][] =>\n sortByDocumentOrder([...items.current], ([element]) => element);\n const registeredValues = () => sortedItems().map(([, v]) => v);\n\n const { committed, optimistic, pending, dispatch, latestInFlight } = useControllableAction<\n OpenSet,\n AccordionValueChangeDetails\n >({\n controlled: controlledSet,\n defaultValue: defaultSet,\n initialValue: EMPTY_SET,\n action:\n action && ((next, details) => action(fromSet(next, exclusive, registeredValues()), details)),\n transitionTypes: (_next, _prev, details) =>\n transitionTypes(\"accordion\", details.open ? \"expand\" : \"collapse\"),\n // Multiple: one item per dispatch, re-based on the committed set; it is also how the\n // uncontrolled commit is folded over the resolved dispatches (#150). Exclusive is\n // single-valued: no reducer, so the optimistic value is `next` and the latest dispatch\n // commits it, like Tabs.\n //\n // The mount reconciliation folds every pre-hydration click into one `next` and is dispatched\n // with `whole` (adopted whole, bypassing the reducer). It never sits in a burst behind a\n // click whose action later rejects: it runs only from the Root's mount layout effect, the\n // Root's first possible dispatch (children do not dispatch from layout effects, and no user\n // event can run between a commit and its layout effects). It runs again only when an\n // `<Activity>` re-shows the Root; a pending click's item then has DOM `open` equal to the\n // optimistic value, so `next` equals the intended value and nothing is dispatched.\n reducer: exclusive\n ? undefined\n : (prev, _next, details) => reduce(prev, details.item, details.open, false),\n warn: { component: \"Accordion.Root\", prop: \"value\" },\n });\n\n const registerItem = useCallback((itemValue: string, element: HTMLDetailsElement) => {\n items.current.set(element, itemValue);\n return () => {\n items.current.delete(element);\n };\n }, []);\n\n const registerTrigger = useCallback((element: HTMLElement) => {\n triggers.current.add(element);\n return () => {\n triggers.current.delete(element);\n };\n }, []);\n\n const dispatchChange = useCallback(\n (\n next: OpenSet,\n item: string,\n open: boolean,\n reason: ChangeReason,\n event: Event | undefined,\n whole = false,\n ): void => {\n dispatch(next, createActionDetails(event, { reason, item, open }), { whole });\n },\n [dispatch],\n );\n\n // The two dispatchers below read the last committed optimistic set through `latest`, so they\n // keep one identity and the Items' contexts are reused across open-state changes: a\n // handler only ever runs against the committed UI, so this is the set it closed over before.\n const latest = useLatest({ optimistic, exclusive });\n\n const dispatchFromTrigger = useCallback<AccordionRootContextValue[\"dispatch\"]>(\n (item, open, event) => {\n const { optimistic, exclusive } = latest.current;\n // `next` comes from the optimistic set: what the user sees and intends (design 2.2).\n dispatchChange(reduce(optimistic, item, open, exclusive), item, open, \"activate\", event);\n },\n [dispatchChange, latest],\n );\n\n const dispatchFromDom = useCallback<AccordionRootContextValue[\"dispatchFromDom\"]>(\n (item, open, event) => {\n const { optimistic, exclusive } = latest.current;\n // The browser flipped one item (design 2.3). `next` builds on what the user already\n // intends (the latest in-flight dispatch, else the optimistic set), never on the DOM: a\n // pending optimistic open would otherwise be lost to latest-wins. Exclusive mode therefore\n // lets the toggled item win when it opened (design walkthrough 9.6).\n const base = intendedValue(latestInFlight, optimistic);\n const next = reduce(base, item, open, exclusive);\n if (setsEqual(next, base)) return;\n dispatchChange(next, item, open, \"platform\", event);\n },\n [dispatchChange, latestInFlight, latest],\n );\n\n const isLibrary = mode === \"library\";\n\n // Mount reconciliation (design 2.3): clicks before hydration left some `<details open>` out of\n // step with committed state. Every mismatch is folded into ONE dispatch with reason \"platform\"\n // and no event; disabled items are simply put back. Runs once per mount; the StrictMode re-run\n // is deduplicated against the dispatch just made.\n const reconcileOnMount = useEffectEvent(() => {\n const base = intendedValue(latestInFlight, optimistic);\n const mismatches: { item: string; open: boolean }[] = [];\n for (const [element, item] of sortedItems()) {\n const want = committed.has(item);\n if (element.open === want) continue;\n if (element.hasAttribute(\"data-disabled\")) applyOpen(element, want);\n else mismatches.push({ item, open: element.open });\n }\n if (mismatches.length === 0) return;\n // Exclusive mode: the first opened item in document order wins (the others are re-closed\n // by the re-apply effect); otherwise fold every flip onto the base.\n const opened = exclusive ? mismatches.find((m) => m.open) : undefined;\n const chosen = opened ?? mismatches[0]!;\n const next = opened\n ? new Set([opened.item])\n : mismatches.reduce((set, m) => reduce(set, m.item, m.open, exclusive), base);\n if (setsEqual(next, base)) return;\n dispatchChange(next, chosen.item, chosen.open, \"platform\", undefined, true);\n });\n useLayoutEffect(() => {\n if (isLibrary) reconcileOnMount();\n }, [isLibrary]);\n\n // Re-apply committed state to the DOM once nothing is in flight: closes what find-in-page\n // revealed and the parent refused, or what a rejected action left open. Writing `open` fires\n // `toggle`, whose handler sees DOM === committed and does nothing.\n useLayoutEffect(() => {\n if (!isLibrary || pending || latestInFlight() !== null) return;\n for (const [element, item] of items.current) applyOpen(element, committed.has(item));\n }, [isLibrary, pending, committed, latestInFlight]);\n\n function onKeyDown(event: KeyboardEvent<HTMLDivElement>): void {\n // Vertical only, so no RTL mirroring: ArrowLeft / ArrowRight are not navigation keys.\n const move = resolveArrowKey(event.key, \"vertical\", false);\n if (move === null) return;\n const target = event.target;\n if (!(target instanceof HTMLElement) || !triggers.current.has(target)) return;\n const sorted = [...triggers.current].sort(compareDocumentOrder);\n const next = nextTrigger(sorted, target, move);\n if (next === undefined) return;\n event.preventDefault();\n // A nested Root handles its own triggers; the outer one must not move focus again.\n event.stopPropagation();\n next.focus();\n }\n\n const id = useId();\n const name = !isLibrary && exclusive ? id : undefined;\n const rootPending = isLibrary && pending;\n const state: AccordionRootState = { pending: rootPending, disabled };\n const contextCommitted = isLibrary ? committed : EMPTY_SET;\n const contextOptimistic = isLibrary ? optimistic : EMPTY_SET;\n\n // Memoised (design 12): the dispatchers are stable, so this changes only with the open\n // sets, pending and the props below.\n const context = useMemo<AccordionRootContextValue>(\n () => ({\n mode,\n exclusive,\n name,\n disabled,\n pending: rootPending,\n committed: contextCommitted,\n optimistic: contextOptimistic,\n dispatch: dispatchFromTrigger,\n dispatchFromDom,\n registerItem,\n registerTrigger,\n }),\n [\n mode,\n exclusive,\n name,\n disabled,\n rootPending,\n contextCommitted,\n contextOptimistic,\n dispatchFromTrigger,\n dispatchFromDom,\n registerItem,\n registerTrigger,\n ],\n );\n\n const resolvedStyle = resolveStateValue(style, state);\n const finalStyle: CSSProperties | undefined = experimental_interpolateSize\n ? { interpolateSize: \"allow-keywords\", ...resolvedStyle }\n : resolvedStyle;\n\n const element = useRender<ComponentPropsWithRef<\"div\">, AccordionRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style: finalStyle,\n children,\n props: rest,\n // Library-controlled layer: wins over a `render` element's props (conventions 1.2).\n libraryProps: {\n \"data-pending\": dataAttr(state.pending),\n \"data-disabled\": dataAttr(disabled),\n onKeyDown,\n },\n });\n\n return <AccordionRootContext value={context}>{element}</AccordionRootContext>;\n}\n\nAccordionRoot.displayName = \"AccordionRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;AAgIvC,SAAS,QAAQ,KAAc,WAAoB,OAA0C;CAC3F,IAAI,WAAW;EACb,MAAM,CAAC,SAAS;EAChB,OAAO,SAAS;CAClB;CACA,OAAO,YAAY,KAAK,KAAK;AAC/B;;AAGA,SAAS,OAAO,KAAc,MAAc,MAAe,WAA6B;CACtF,IAAI,CAAC,MAAM;EACT,IAAI,CAAC,IAAI,IAAI,IAAI,GAAG,OAAO;EAC3B,MAAM,OAAO,IAAI,IAAI,GAAG;EACxB,KAAK,OAAO,IAAI;EAChB,OAAO;CACT;CACA,IAAI,WAAW,uBAAO,IAAI,IAAI,CAAC,IAAI,CAAC;CACpC,OAAO,IAAI,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI;AACpD;;AAGA,SAAS,UAAU,SAA6B,MAAqB;CACnE,IAAI,QAAQ,SAAS,MAAM,QAAQ,OAAO;AAC5C;AAEA,SAAS,iBAAiB,IAA0B;CAClD,OAAO,GAAG,aAAa,eAAe,MAAM;AAC9C;;;;;;;AAQA,SAAS,YACP,QACA,SACA,MACyB;CACzB,MAAM,UAAU,OAAO,OAAO,gBAAgB;CAC9C,IAAI,QAAQ,WAAW,GAAG,OAAO,KAAA;CACjC,IAAI,SAAS,SAAS,OAAO,QAAQ;CACrC,IAAI,SAA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AAM,OAAO,CAAC,aAAa,YAAY,KAAK,KAAA;CAC5C,MAAM,cAAc,aAAa;CACjC,MAAM,QAA4B;EAAE,SAAS;EAAa;CAAS;CACnE,MAAM,mBAAmB,YAAY,YAAY;CACjD,MAAM,oBAAoB,YAAY,aAAa;CAInD,MAAM,UAAU,eACP;EACL;EACA;EACA;EACA;EACA,SAAS;EACT,WAAW;EACX,YAAY;EACZ,UAAU;EACV;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,gBAAgB,kBAAkB,OAAO,KAAK;CACpD,MAAM,aAAwC,+BAC1C;EAAE,iBAAiB;EAAkB,GAAG;CAAc,IACtD;CAEJ,MAAM,UAAU,UAA4D;EAC1E,gBAAgB;EAChB;EACA;EACA;EACA,OAAO;EACP;EACA,OAAO;EAEP,cAAc;GACZ,gBAAgB,SAAS,MAAM,OAAO;GACtC,iBAAiB,SAAS,QAAQ;GAClC;EACF;CACF,CAAC;CAED,OAAO,oBAAC,sBAAD;EAAsB,OAAO;EAAU,UAAA;CAA8B,CAAA;AAC9E;AAEA,cAAc,cAAc"}
|
|
1
|
+
{"version":3,"file":"accordion-root.mjs","names":[],"sources":["../../src/accordion/accordion-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useEffectEvent, useId, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, KeyboardEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action/action-details.js\";\nimport { resolveArrowKey } from \"../internal/arrow-keys.js\";\nimport type { ArrowMove } from \"../internal/arrow-keys.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { noteOpen, writeOpen } from \"../internal/details-summary.js\";\nimport { compareDocumentOrder, sortByDocumentOrder } from \"../internal/dom-order.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n RenderProp,\n StateValue,\n} from \"../internal/types.js\";\nimport {\n intendedValue,\n useControllableAction,\n} from \"../internal/action/use-controllable-action.js\";\nimport { useMountFixed } from \"../internal/use-mount-fixed.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport { useValueSet } from \"../internal/use-value-set.js\";\nimport { EMPTY_SET, setsEqual, sortByOrder } from \"../internal/value-set.js\";\nimport type { ValueSet } from \"../internal/value-set.js\";\nimport { AccordionRootContext } from \"./accordion-context.js\";\nimport type { AccordionMode, AccordionRootContextValue } from \"./accordion-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * State of `Accordion.Root`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface AccordionRootState {\n /** An action dispatched through this Accordion is in flight (library mode only). */\n readonly pending: boolean;\n /** The Root's `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/** Details passed as the second argument of `valueChangeAction`. */\nexport interface AccordionValueChangeDetails extends ActionDetails {\n /**\n * The shared vocabulary (conventions 2.2); Accordion dispatches two of its values.\n * `\"activate\"`: the user activated a Trigger. `\"platform\"`: the browser changed `open` itself\n * (find-in-page, a text fragment, a click before hydration); `event` is then the `toggle`\n * event, or `undefined` when the mismatch was found on mount.\n */\n readonly reason: ChangeReason;\n /** The item whose open state changed. */\n readonly item: string;\n /** That item's new open state. */\n readonly open: boolean;\n}\n\ninterface AccordionRootBaseProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n // `defaultValue` is also a native HTMLAttributes member; the Accordion's own definition wins.\n \"onKeyDown\" | \"defaultValue\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Disables every item: triggers render `aria-disabled` and never dispatch.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /**\n * Renders `interpolate-size: allow-keywords` on the root so `::details-content` can transition\n * `height` to `auto`. Chromium-only polish today; use the `grid-template-rows` form for a\n * cross-engine animation. Merged with `style`; the consumer's declaration wins.\n *\n * @defaultValue `false`\n */\n experimental_interpolateSize?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, AccordionRootState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, AccordionRootState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, AccordionRootState>;\n /** Replace the default `<div>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"div\">, AccordionRootState>;\n}\n\n/**\n * Props of `Accordion.Root` in multiple mode (the default): any number of items open, `value` is\n * a `string[]`.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport interface AccordionRootMultipleProps extends AccordionRootBaseProps {\n /**\n * Any number of items may be open.\n *\n * @defaultValue `false`\n */\n exclusive?: false;\n /** Controlled open items. `undefined` means uncontrolled; `[]` means none open. */\n value?: string[];\n /** Initial open items in uncontrolled library mode. */\n defaultValue?: string[];\n /**\n * Called with the next open items on every change. Runs inside the Root's transition; may be\n * sync or async (also a Server Function). Rejections reach the nearest Error Boundary.\n *\n * May also be called with `details.reason === \"platform\"` when the browser opened an item\n * itself (find-in-page, a click before hydration); committed state is re-applied to the DOM\n * once the action settles.\n *\n * A `setState` placed after your own `await` is not a Transition update; wrap it in\n * `startTransition` (React limitation).\n */\n valueChangeAction?: ChangeAction<string[], AccordionValueChangeDetails>;\n}\n\n/**\n * Props of `Accordion.Root` in exclusive mode (`exclusive`): at most one item open, `value` is\n * `string | null`.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport interface AccordionRootExclusiveProps extends AccordionRootBaseProps {\n /**\n * At most one item open. JS-free mode: renders the same `name` on every `<details>` (the\n * platform's exclusive group). Library mode: the value is a single item or `null`.\n */\n exclusive: true;\n /** Controlled open item. `undefined` means uncontrolled; `null` means none open. */\n value?: string | null;\n /** Initial open item in uncontrolled library mode. */\n defaultValue?: string | null;\n /** See {@link AccordionRootMultipleProps.valueChangeAction}. */\n valueChangeAction?: ChangeAction<string | null, AccordionValueChangeDetails>;\n}\n\n/**\n * Props of `Accordion.Root`, discriminated on `exclusive`.\n *\n * Without `value`, `defaultValue` and `valueChangeAction` the Accordion runs in **JS-free mode**:\n * the browser owns each `<details open>`, nothing runs on toggle, and `exclusive` renders `name`.\n * With any of them it runs in **library mode**: the summary click is intercepted, `open` is driven\n * by committed state inside a transition, and triggers show optimistic `data-open`.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport type AccordionRootProps = AccordionRootMultipleProps | AccordionRootExclusiveProps;\n\ntype AccordionValue = string[] | string | null;\ntype OpenSet = ValueSet;\n\n/**\n * Converts the open set back to the public value. Multiple mode lists the items in `order` (the\n * registered Items' values in document order, design 2.3), not in the order they were opened;\n * unregistered values keep their insertion order at the end.\n */\nfunction fromSet(set: OpenSet, exclusive: boolean, order: readonly string[]): AccordionValue {\n if (exclusive) {\n const [first] = set;\n return first ?? null;\n }\n return sortByOrder(set, order);\n}\n\n/** The optimistic reducer of design 4.1: add/remove one item, or replace when exclusive. */\nfunction reduce(set: OpenSet, item: string, open: boolean, exclusive: boolean): OpenSet {\n if (!open) {\n if (!set.has(item)) return set;\n const next = new Set(set);\n next.delete(item);\n return next;\n }\n if (exclusive) return new Set([item]);\n return set.has(item) ? set : new Set(set).add(item);\n}\n\nfunction isEnabledTrigger(el: HTMLElement): boolean {\n return el.getAttribute(\"aria-disabled\") !== \"true\";\n}\n\n/**\n * Picks the trigger to focus for a move (ArrowDown / ArrowUp / Home / End, `resolveArrowKey` on\n * the vertical axis): `sorted` is every registered trigger in document order; disabled ones are\n * skipped; arrows wrap. Works when `current` is itself disabled (disabled triggers stay\n * focusable), which is why this is not the roving engine's index arithmetic.\n */\nfunction nextTrigger(\n sorted: readonly HTMLElement[],\n current: HTMLElement,\n move: ArrowMove,\n): HTMLElement | undefined {\n const enabled = sorted.filter(isEnabledTrigger);\n if (enabled.length === 0) return undefined;\n if (move === \"first\") return enabled[0];\n if (move === \"last\") return enabled[enabled.length - 1];\n const position = sorted.indexOf(current);\n if (move === \"next\") {\n return enabled.find((el) => sorted.indexOf(el) > position) ?? enabled[0];\n }\n return enabled.findLast((el) => sorted.indexOf(el) < position) ?? enabled[enabled.length - 1];\n}\n\n/**\n * The accordion container: a `div` that owns the open state, the transition, the context the\n * other parts read, and ArrowUp/ArrowDown/Home/End navigation between triggers.\n *\n * @see https://ui.funstack.work/components/accordion\n */\nexport function AccordionRoot(props: AccordionRootProps) {\n const {\n exclusive: exclusiveProp = false,\n value,\n defaultValue,\n valueChangeAction,\n disabled = false,\n experimental_interpolateSize = false,\n className,\n style,\n children,\n render,\n ...rest\n } = props;\n\n // Mode is decided once, from the first render's props (design 12).\n const isLibraryNow =\n value !== undefined || defaultValue !== undefined || valueChangeAction !== undefined;\n const mode = useMountFixed<AccordionMode>(\n isLibraryNow ? \"library\" : \"static\",\n isDev &&\n \"Accordion.Root: the mode changed after mount (`value`, `defaultValue` and `valueChangeAction` \" +\n \"were all absent on one render and present on another). Switching between JS-free and \" +\n \"library mode is not supported.\",\n );\n\n // Exclusive or multiple is decided once too, like ToggleGroup's mode (design 12): the reducer,\n // the value shape handed to the action and the static `name` all follow the mounted mode.\n const exclusive = useMountFixed(\n exclusiveProp,\n isDev &&\n \"Accordion.Root: `exclusive` changed after mount. Switching between exclusive and \" +\n \"multiple mode is not supported; the accordion keeps the mode it mounted with.\",\n );\n\n // Both prop variants are narrowed by `exclusive` at the call site; internally one signature.\n const action = valueChangeAction as\n | ChangeAction<AccordionValue, AccordionValueChangeDetails>\n | undefined;\n\n const controlledSet = useValueSet(value);\n const defaultSet = useValueSet(defaultValue);\n\n const items = useRef(new Map<HTMLDetailsElement, string>());\n const triggers = useRef(new Set<HTMLElement>());\n /** The registered Items in document order. Reads the DOM: handlers and effects only. */\n const sortedItems = (): [HTMLDetailsElement, string][] =>\n sortByDocumentOrder([...items.current], ([element]) => element);\n const registeredValues = () => sortedItems().map(([, v]) => v);\n\n const { committed, optimistic, pending, dispatch, latestInFlight } = useControllableAction<\n OpenSet,\n AccordionValueChangeDetails\n >({\n controlled: controlledSet,\n defaultValue: defaultSet,\n initialValue: EMPTY_SET,\n action:\n action && ((next, details) => action(fromSet(next, exclusive, registeredValues()), details)),\n transitionTypes: (_next, _prev, details) =>\n transitionTypes(\"accordion\", details.open ? \"expand\" : \"collapse\"),\n // Multiple: one item per dispatch, re-based on the committed set; it is also how the\n // uncontrolled commit is folded over the resolved dispatches (#150). Exclusive is\n // single-valued: no reducer, so the optimistic value is `next` and the latest dispatch\n // commits it, like Tabs.\n //\n // The mount reconciliation folds every pre-hydration click into one `next` and is dispatched\n // with `whole` (adopted whole, bypassing the reducer). It never sits in a burst behind a\n // click whose action later rejects: it runs only from the Root's mount layout effect, the\n // Root's first possible dispatch (children do not dispatch from layout effects, and no user\n // event can run between a commit and its layout effects). It runs again only when an\n // `<Activity>` re-shows the Root; a pending click's item then has DOM `open` equal to the\n // optimistic value, so `next` equals the intended value and nothing is dispatched.\n reducer: exclusive\n ? undefined\n : (prev, _next, details) => reduce(prev, details.item, details.open, false),\n warn: { component: \"Accordion.Root\", prop: \"value\" },\n });\n\n const registerItem = useCallback((itemValue: string, element: HTMLDetailsElement) => {\n items.current.set(element, itemValue);\n return () => {\n items.current.delete(element);\n };\n }, []);\n\n const registerTrigger = useCallback((element: HTMLElement) => {\n triggers.current.add(element);\n return () => {\n triggers.current.delete(element);\n };\n }, []);\n\n const dispatchChange = useCallback(\n (\n next: OpenSet,\n item: string,\n open: boolean,\n reason: ChangeReason,\n event: Event | undefined,\n whole = false,\n ): void => {\n dispatch(next, createActionDetails(event, { reason, item, open }), { whole });\n },\n [dispatch],\n );\n\n // The two dispatchers below read the last committed optimistic set through `latest`, so they\n // keep one identity and the Items' contexts are reused across open-state changes: a\n // handler only ever runs against the committed UI, so this is the set it closed over before.\n const latest = useLatest({ optimistic, exclusive });\n\n const dispatchFromTrigger = useCallback<AccordionRootContextValue[\"dispatch\"]>(\n (item, open, event) => {\n const { optimistic, exclusive } = latest.current;\n // `next` comes from the optimistic set: what the user sees and intends (design 2.2).\n dispatchChange(reduce(optimistic, item, open, exclusive), item, open, \"activate\", event);\n },\n [dispatchChange, latest],\n );\n\n const dispatchFromDom = useCallback<AccordionRootContextValue[\"dispatchFromDom\"]>(\n (item, open, event) => {\n const { optimistic, exclusive } = latest.current;\n // The browser flipped one item (design 2.3). `next` builds on what the user already\n // intends (the latest in-flight dispatch, else the optimistic set), never on the DOM: a\n // pending optimistic open would otherwise be lost to latest-wins. Exclusive mode therefore\n // lets the toggled item win when it opened (design walkthrough 9.6).\n const base = intendedValue(latestInFlight, optimistic);\n const next = reduce(base, item, open, exclusive);\n if (setsEqual(next, base)) return;\n dispatchChange(next, item, open, \"platform\", event);\n },\n [dispatchChange, latestInFlight, latest],\n );\n\n const isLibrary = mode === \"library\";\n\n // Mount reconciliation (design 2.3): clicks before hydration left some `<details open>` out of\n // step with committed state. Every mismatch is folded into ONE dispatch with reason \"platform\"\n // and no event; disabled items are simply put back. Runs once per mount; the StrictMode re-run\n // is deduplicated against the dispatch just made.\n const reconcileOnMount = useEffectEvent(() => {\n const base = intendedValue(latestInFlight, optimistic);\n const mismatches: { item: string; open: boolean }[] = [];\n for (const [element, item] of sortedItems()) {\n // The value read becomes the known value (design 2.3), at mount and at an Activity re-show.\n noteOpen(element);\n const want = committed.has(item);\n if (element.open === want) continue;\n if (element.hasAttribute(\"data-disabled\")) writeOpen(element, want);\n else mismatches.push({ item, open: element.open });\n }\n if (mismatches.length === 0) return;\n // Exclusive mode: the first opened item in document order wins (the others are re-closed\n // by the re-apply effect); otherwise fold every flip onto the base.\n const opened = exclusive ? mismatches.find((m) => m.open) : undefined;\n const chosen = opened ?? mismatches[0]!;\n const next = opened\n ? new Set([opened.item])\n : mismatches.reduce((set, m) => reduce(set, m.item, m.open, exclusive), base);\n if (setsEqual(next, base)) return;\n dispatchChange(next, chosen.item, chosen.open, \"platform\", undefined, true);\n });\n useLayoutEffect(() => {\n if (isLibrary) reconcileOnMount();\n }, [isLibrary]);\n\n // Re-apply committed state to the DOM once nothing is in flight: closes what find-in-page\n // revealed and the parent refused, or what a rejected action left open. The write records the\n // known value, so the `toggle` it fires is an echo.\n useLayoutEffect(() => {\n if (!isLibrary || pending || latestInFlight() !== null) return;\n for (const [element, item] of items.current) writeOpen(element, committed.has(item));\n }, [isLibrary, pending, committed, latestInFlight]);\n\n function onKeyDown(event: KeyboardEvent<HTMLDivElement>): void {\n // Vertical only, so no RTL mirroring: ArrowLeft / ArrowRight are not navigation keys.\n const move = resolveArrowKey(event.key, \"vertical\", false);\n if (move === null) return;\n const target = event.target;\n if (!(target instanceof HTMLElement) || !triggers.current.has(target)) return;\n const sorted = [...triggers.current].sort(compareDocumentOrder);\n const next = nextTrigger(sorted, target, move);\n if (next === undefined) return;\n event.preventDefault();\n // A nested Root handles its own triggers; the outer one must not move focus again.\n event.stopPropagation();\n next.focus();\n }\n\n const id = useId();\n const name = !isLibrary && exclusive ? id : undefined;\n const rootPending = isLibrary && pending;\n const state: AccordionRootState = { pending: rootPending, disabled };\n const contextCommitted = isLibrary ? committed : EMPTY_SET;\n const contextOptimistic = isLibrary ? optimistic : EMPTY_SET;\n\n // Memoised (design 12): the dispatchers are stable, so this changes only with the open\n // sets, pending and the props below.\n const context = useMemo<AccordionRootContextValue>(\n () => ({\n mode,\n exclusive,\n name,\n disabled,\n pending: rootPending,\n committed: contextCommitted,\n optimistic: contextOptimistic,\n dispatch: dispatchFromTrigger,\n dispatchFromDom,\n registerItem,\n registerTrigger,\n }),\n [\n mode,\n exclusive,\n name,\n disabled,\n rootPending,\n contextCommitted,\n contextOptimistic,\n dispatchFromTrigger,\n dispatchFromDom,\n registerItem,\n registerTrigger,\n ],\n );\n\n const resolvedStyle = resolveStateValue(style, state);\n const finalStyle: CSSProperties | undefined = experimental_interpolateSize\n ? { interpolateSize: \"allow-keywords\", ...resolvedStyle }\n : resolvedStyle;\n\n const element = useRender<ComponentPropsWithRef<\"div\">, AccordionRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style: finalStyle,\n children,\n props: rest,\n // Library-controlled layer: wins over a `render` element's props (conventions 1.2).\n libraryProps: {\n \"data-pending\": dataAttr(state.pending),\n \"data-disabled\": dataAttr(disabled),\n onKeyDown,\n },\n });\n\n return <AccordionRootContext value={context}>{element}</AccordionRootContext>;\n}\n\nAccordionRoot.displayName = \"AccordionRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8BA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;AAgIvC,SAAS,QAAQ,KAAc,WAAoB,OAA0C;CAC3F,IAAI,WAAW;EACb,MAAM,CAAC,SAAS;EAChB,OAAO,SAAS;CAClB;CACA,OAAO,YAAY,KAAK,KAAK;AAC/B;;AAGA,SAAS,OAAO,KAAc,MAAc,MAAe,WAA6B;CACtF,IAAI,CAAC,MAAM;EACT,IAAI,CAAC,IAAI,IAAI,IAAI,GAAG,OAAO;EAC3B,MAAM,OAAO,IAAI,IAAI,GAAG;EACxB,KAAK,OAAO,IAAI;EAChB,OAAO;CACT;CACA,IAAI,WAAW,uBAAO,IAAI,IAAI,CAAC,IAAI,CAAC;CACpC,OAAO,IAAI,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI;AACpD;AAEA,SAAS,iBAAiB,IAA0B;CAClD,OAAO,GAAG,aAAa,eAAe,MAAM;AAC9C;;;;;;;AAQA,SAAS,YACP,QACA,SACA,MACyB;CACzB,MAAM,UAAU,OAAO,OAAO,gBAAgB;CAC9C,IAAI,QAAQ,WAAW,GAAG,OAAO,KAAA;CACjC,IAAI,SAAS,SAAS,OAAO,QAAQ;CACrC,IAAI,SAAS,QAAQ,OAAO,QAAQ,QAAQ,SAAS;CACrD,MAAM,WAAW,OAAO,QAAQ,OAAO;CACvC,IAAI,SAAS,QACX,OAAO,QAAQ,MAAM,OAAO,OAAO,QAAQ,EAAE,IAAI,QAAQ,KAAK,QAAQ;CAExE,OAAO,QAAQ,UAAU,OAAO,OAAO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,UAAU,eACP;EACL;EACA;EACA;EACA;EACA,SAAS;EACT,WAAW;EACX,YAAY;EACZ,UAAU;EACV;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,gBAAgB,kBAAkB,OAAO,KAAK;CACpD,MAAM,aAAwC,+BAC1C;EAAE,iBAAiB;EAAkB,GAAG;CAAc,IACtD;CAEJ,MAAM,UAAU,UAA4D;EAC1E,gBAAgB;EAChB;EACA;EACA;EACA,OAAO;EACP;EACA,OAAO;EAEP,cAAc;GACZ,gBAAgB,SAAS,MAAM,OAAO;GACtC,iBAAiB,SAAS,QAAQ;GAClC;EACF;CACF,CAAC;CAED,OAAO,oBAAC,sBAAD;EAAsB,OAAO;EAAU,UAAA;CAA8B,CAAA;AAC9E;AAEA,cAAc,cAAc"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode, ViewTransitionClass } from "react";
|
|
1
2
|
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
3
|
import { AccordionItemState } from "./accordion-item.mjs";
|
|
3
|
-
import { CSSProperties, ComponentPropsWithRef, ReactNode, ViewTransitionClass } from "react";
|
|
4
|
-
//#region src/accordion/accordion-trigger.d.ts
|
|
5
4
|
/** The trigger is the item's control; it renders the item's state object. */
|
|
6
5
|
export type AccordionTriggerState = AccordionItemState;
|
|
7
6
|
/**
|
|
@@ -41,5 +40,4 @@ export declare function AccordionTrigger({ transition, className, style, childre
|
|
|
41
40
|
export declare namespace AccordionTrigger {
|
|
42
41
|
var displayName: string;
|
|
43
42
|
}
|
|
44
|
-
//#endregion
|
|
45
43
|
//# sourceMappingURL=accordion-trigger.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-trigger.d.mts","names":[],"sources":["../../src/accordion/accordion-trigger.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"accordion-trigger.d.mts","names":[],"sources":["../../src/accordion/accordion-trigger.tsx"],"mappings":";;;;YAqBY,wBAAwB;;;;;;iBAOnB,8BAA8B,KAC7C;;;;;;;;;;EAYA,aAAa;;EAEb,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,kCAAkC;;;;;;;;;;wBAWxC,mBACd,YACA,WACA,OACA,UACA,WACG,QACF,wBAAqB;yBAPR"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { use, useCallback } from "react";
|
|
3
|
+
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
2
4
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
5
|
+
import { interceptSummaryClick, useSummaryCheck } from "../internal/details-summary.mjs";
|
|
3
6
|
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
4
|
-
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
5
7
|
import { useRender } from "../internal/use-render.mjs";
|
|
6
|
-
import { interceptSummaryClick, useSummaryCheck } from "../internal/details-summary.mjs";
|
|
7
8
|
import { AccordionItemContext } from "./accordion-context.mjs";
|
|
8
|
-
|
|
9
|
-
//#region src/accordion/accordion-trigger.tsx
|
|
9
|
+
// src/accordion/accordion-trigger.tsx
|
|
10
10
|
const isDev = process.env.NODE_ENV !== "production";
|
|
11
11
|
/**
|
|
12
12
|
* The item's disclosure control: the `<summary>`, which must be the first child of the Item. In
|
|
@@ -61,7 +61,6 @@ function AccordionTrigger({ transition, className, style, children, render, ...r
|
|
|
61
61
|
return useTransitionBoundary("Accordion.Trigger", isLibrary ? transition : void 0, element);
|
|
62
62
|
}
|
|
63
63
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
64
|
-
//#endregion
|
|
65
64
|
export { AccordionTrigger };
|
|
66
65
|
|
|
67
66
|
//# sourceMappingURL=accordion-trigger.mjs.map
|
|
@@ -3,7 +3,6 @@ import { AccordionItem, AccordionItemProps, AccordionItemState } from "./accordi
|
|
|
3
3
|
import { AccordionPanel, AccordionPanelProps, AccordionPanelState } from "./accordion-panel.mjs";
|
|
4
4
|
import { AccordionRoot, AccordionRootExclusiveProps, AccordionRootMultipleProps, AccordionRootProps, AccordionRootState, AccordionValueChangeDetails } from "./accordion-root.mjs";
|
|
5
5
|
import { AccordionTrigger, AccordionTriggerProps, AccordionTriggerState } from "./accordion-trigger.mjs";
|
|
6
|
-
//#region src/accordion/index.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Accordion built on `<details>`/`<summary>`: `Root` (div) > `Item` (details) > `Trigger`
|
|
9
8
|
* (summary, first child) + `Panel` (div). JS-free when the Root has no value props; a transition
|
|
@@ -17,6 +16,5 @@ export declare const Accordion: {
|
|
|
17
16
|
readonly Trigger: typeof AccordionTrigger;
|
|
18
17
|
readonly Panel: typeof AccordionPanel;
|
|
19
18
|
};
|
|
20
|
-
//#endregion
|
|
21
19
|
export type { AccordionItemProps, AccordionItemState, AccordionPanelProps, AccordionPanelState, AccordionRootExclusiveProps, AccordionRootMultipleProps, AccordionRootProps, AccordionRootState, AccordionTriggerProps, AccordionTriggerState, AccordionValueChangeDetails };
|
|
22
20
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/accordion/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/accordion/index.ts"],"mappings":";;;;;;;;;;;;qBAea;WACX,aAAI;WACJ,aAAI;WACJ,gBAAO;WACP,cAAK"}
|
package/dist/accordion/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { AccordionItem } from "./accordion-item.mjs";
|
|
|
2
2
|
import { AccordionPanel } from "./accordion-panel.mjs";
|
|
3
3
|
import { AccordionRoot } from "./accordion-root.mjs";
|
|
4
4
|
import { AccordionTrigger } from "./accordion-trigger.mjs";
|
|
5
|
-
|
|
5
|
+
// src/accordion/index.ts
|
|
6
6
|
/**
|
|
7
7
|
* Accordion built on `<details>`/`<summary>`: `Root` (div) > `Item` (details) > `Trigger`
|
|
8
8
|
* (summary, first child) + `Panel` (div). JS-free when the Root has no value props; a transition
|
|
@@ -16,7 +16,6 @@ const Accordion = {
|
|
|
16
16
|
Trigger: AccordionTrigger,
|
|
17
17
|
Panel: AccordionPanel
|
|
18
18
|
};
|
|
19
|
-
//#endregion
|
|
20
19
|
export { Accordion };
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Action, RenderProp, StateValue, WhilePending } from "../internal/types.mjs";
|
|
2
|
-
import { DialogCloseDetails, DialogCloseState } from "../dialog/dialog-close.mjs";
|
|
3
1
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
-
|
|
2
|
+
import { DialogCloseDetails, DialogCloseState } from "../dialog/dialog-close.mjs";
|
|
3
|
+
import { Action, RenderProp, StateValue, WhilePending } from "../internal/types.mjs";
|
|
5
4
|
/** State of `AlertDialog.Action`, passed to the function forms of `className`, `style`, `children` and `render`. */
|
|
6
5
|
export type AlertDialogActionState = DialogCloseState;
|
|
7
6
|
/** Details passed to `AlertDialog.Action`'s `action`. */
|
|
@@ -30,7 +29,9 @@ export interface AlertDialogActionProps extends Omit<ComponentPropsWithRef<"butt
|
|
|
30
29
|
/**
|
|
31
30
|
* What a click does while the `action` is pending. `"ignore"`: nothing (the click is
|
|
32
31
|
* cancelled, `aria-disabled="true"` meanwhile). `"run"`: the action runs again; the dialog
|
|
33
|
-
* closes once, after the last run and only if the latest one resolved.
|
|
32
|
+
* closes once, after the last run and only if the latest one resolved. No effect without
|
|
33
|
+
* `action`: the part then shows `data-pending` while the Root's close waits, without
|
|
34
|
+
* `aria-disabled`.
|
|
34
35
|
*
|
|
35
36
|
* @defaultValue `"ignore"`
|
|
36
37
|
*/
|
|
@@ -69,5 +70,4 @@ export declare function AlertDialogAction(props: AlertDialogActionProps): ReactN
|
|
|
69
70
|
export declare namespace AlertDialogAction {
|
|
70
71
|
var displayName: string;
|
|
71
72
|
}
|
|
72
|
-
//#endregion
|
|
73
73
|
//# sourceMappingURL=alert-dialog-action.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog-action.d.mts","names":[],"sources":["../../src/alert-dialog/alert-dialog-action.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"alert-dialog-action.d.mts","names":[],"sources":["../../src/alert-dialog/alert-dialog-action.tsx"],"mappings":";;;;YAOY,yBAAyB;;YAGzB,2BAA2B;;;;;;iBAOtB,+BAA+B,KAC9C;;;;;;;;;;;;;;;EAiBA,SAAS,QAAQ,SAAS;;;;;;;;;;EAU1B,eAAe;;EAEf;;;;;;;EAOA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;wBAevC,kBAAkB,OAAO,yBAAsB;yBAA/C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useDialogClose } from "../dialog/dialog-close.mjs";
|
|
3
|
-
|
|
3
|
+
// src/alert-dialog/alert-dialog-action.tsx
|
|
4
4
|
/**
|
|
5
5
|
* The confirm button: `Dialog.Close` with an `action` (design 3.2). The action runs in this
|
|
6
6
|
* part's own transition (`data-pending` and, by default, `aria-disabled` on the button), then
|
|
@@ -17,7 +17,6 @@ function AlertDialogAction(props) {
|
|
|
17
17
|
return useDialogClose(props, { part: "AlertDialog.Action" });
|
|
18
18
|
}
|
|
19
19
|
AlertDialogAction.displayName = "AlertDialogAction";
|
|
20
|
-
//#endregion
|
|
21
20
|
export { AlertDialogAction };
|
|
22
21
|
|
|
23
22
|
//# sourceMappingURL=alert-dialog-action.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog-action.mjs","names":[],"sources":["../../src/alert-dialog/alert-dialog-action.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useDialogClose } from \"../dialog/dialog-close.js\";\nimport type { DialogCloseDetails, DialogCloseState } from \"../dialog/dialog-close.js\";\nimport type { Action, RenderProp, StateValue, WhilePending } from \"../internal/types.js\";\n\n/** State of `AlertDialog.Action`, passed to the function forms of `className`, `style`, `children` and `render`. */\nexport type AlertDialogActionState = DialogCloseState;\n\n/** Details passed to `AlertDialog.Action`'s `action`. */\nexport type AlertDialogActionDetails = DialogCloseDetails;\n\n/**\n * Props of `AlertDialog.Action`.\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport interface AlertDialogActionProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"value\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * The confirmed work. Runs inside this part's own transition (`data-pending` on the button),\n * then closes the dialog with `value` as `returnValue`: in library mode through the Root\n * (`openChangeAction(false)` awaited, view transition if set), in JS-free mode with\n * `close(value)`. A rejection reaches the nearest Error Boundary above this part and leaves\n * the dialog open. If the dialog was dismissed and opened again while the action ran, the\n * close is dropped. Escape or a Cancel while it runs closes the dialog; the action keeps\n * running (it is hidden, not aborted).\n *\n * With `action` the button is no native close invoker (no `commandfor` / `command`): a click\n * before hydration does nothing, rather than closing the dialog as if the work had been done.\n * The confirm that works before hydration is `AlertDialog.Form`. Without `action` the button\n * only closes the dialog (read `returnValue` in `openChangeAction`).\n */\n action?: Action<[details: AlertDialogActionDetails]>;\n /**\n * What a click does while the `action` is pending. `\"ignore\"`: nothing (the click is\n * cancelled, `aria-disabled=\"true\"` meanwhile). `\"run\"`: the action runs again; the dialog\n * closes once, after the last run and only if the latest one resolved
|
|
1
|
+
{"version":3,"file":"alert-dialog-action.mjs","names":[],"sources":["../../src/alert-dialog/alert-dialog-action.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useDialogClose } from \"../dialog/dialog-close.js\";\nimport type { DialogCloseDetails, DialogCloseState } from \"../dialog/dialog-close.js\";\nimport type { Action, RenderProp, StateValue, WhilePending } from \"../internal/types.js\";\n\n/** State of `AlertDialog.Action`, passed to the function forms of `className`, `style`, `children` and `render`. */\nexport type AlertDialogActionState = DialogCloseState;\n\n/** Details passed to `AlertDialog.Action`'s `action`. */\nexport type AlertDialogActionDetails = DialogCloseDetails;\n\n/**\n * Props of `AlertDialog.Action`.\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport interface AlertDialogActionProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"value\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * The confirmed work. Runs inside this part's own transition (`data-pending` on the button),\n * then closes the dialog with `value` as `returnValue`: in library mode through the Root\n * (`openChangeAction(false)` awaited, view transition if set), in JS-free mode with\n * `close(value)`. A rejection reaches the nearest Error Boundary above this part and leaves\n * the dialog open. If the dialog was dismissed and opened again while the action ran, the\n * close is dropped. Escape or a Cancel while it runs closes the dialog; the action keeps\n * running (it is hidden, not aborted).\n *\n * With `action` the button is no native close invoker (no `commandfor` / `command`): a click\n * before hydration does nothing, rather than closing the dialog as if the work had been done.\n * The confirm that works before hydration is `AlertDialog.Form`. Without `action` the button\n * only closes the dialog (read `returnValue` in `openChangeAction`).\n */\n action?: Action<[details: AlertDialogActionDetails]>;\n /**\n * What a click does while the `action` is pending. `\"ignore\"`: nothing (the click is\n * cancelled, `aria-disabled=\"true\"` meanwhile). `\"run\"`: the action runs again; the dialog\n * closes once, after the last run and only if the latest one resolved. No effect without\n * `action`: the part then shows `data-pending` while the Root's close waits, without\n * `aria-disabled`.\n *\n * @defaultValue `\"ignore\"`\n */\n whilePending?: WhilePending;\n /** Becomes `dialog.returnValue` (and `details.returnValue` of the close request). */\n value?: string;\n /**\n * Never runs or closes. Native `disabled` on a `<button>`; owned. With a link or component\n * `render`, `aria-disabled=\"true\"` instead.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, AlertDialogActionState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, AlertDialogActionState>;\n /** Content, or a function of the part's state (`pending ? \"Deleting…\" : \"Delete\"`). */\n children?: StateValue<ReactNode, AlertDialogActionState>;\n /** Replace the default `<button>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, AlertDialogActionState>;\n}\n\n/**\n * The confirm button: `Dialog.Close` with an `action` (design 3.2). The action runs in this\n * part's own transition (`data-pending` and, by default, `aria-disabled` on the button), then\n * the dialog closes; a rejection leaves it open. Unlike `Dialog.Close`, an Action with `action`\n * renders no `commandfor` / `command`.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,\n * `command`, `value`, `onClick` (library mode, or with `action`), `aria-disabled`,\n * `data-pending`, `data-disabled`.\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport function AlertDialogAction(props: AlertDialogActionProps) {\n // With `action` no native command, as every Close part (#182).\n return useDialogClose(props, { part: \"AlertDialog.Action\" });\n}\n\nAlertDialogAction.displayName = \"AlertDialogAction\";\n"],"mappings":";;;;;;;;;;;;;;;AA6EA,SAAgB,kBAAkB,OAA+B;CAE/D,OAAO,eAAe,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC7D;AAEA,kBAAkB,cAAc"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DialogCloseDetails, DialogCloseProps, DialogCloseState } from "../dialog/dialog-close.mjs";
|
|
2
|
-
//#region src/alert-dialog/alert-dialog-cancel.d.ts
|
|
3
2
|
/** State of `AlertDialog.Cancel`: Dialog.Close's. */
|
|
4
3
|
export type AlertDialogCancelState = DialogCloseState;
|
|
5
4
|
/** Details passed to `AlertDialog.Cancel`'s `action`: Dialog.Close's. */
|
|
@@ -27,5 +26,4 @@ export declare function AlertDialogCancel({ disabled, ref, ...rest }: AlertDialo
|
|
|
27
26
|
export declare namespace AlertDialogCancel {
|
|
28
27
|
var displayName: string;
|
|
29
28
|
}
|
|
30
|
-
//#endregion
|
|
31
29
|
//# sourceMappingURL=alert-dialog-cancel.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog-cancel.d.mts","names":[],"sources":["../../src/alert-dialog/alert-dialog-cancel.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"alert-dialog-cancel.d.mts","names":[],"sources":["../../src/alert-dialog/alert-dialog-cancel.tsx"],"mappings":";;YAcY,yBAAyB;;YAGzB,2BAA2B;;;;;;;YAQ3B,yBAAyB;;;;;;;;;;;;;wBAcrB,oBAAoB,UAAU,QAAQ,QAAQ,yCAAsB;yBAApE"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { useDialogContext } from "../dialog/dialog-context.mjs";
|
|
2
|
+
import { use, useCallback } from "react";
|
|
4
3
|
import { useDialogClose } from "../dialog/dialog-close.mjs";
|
|
4
|
+
import { useDialogContext } from "../dialog/dialog-context.mjs";
|
|
5
5
|
import { useHydratedMount } from "../internal/use-hydrated-mount.mjs";
|
|
6
|
+
import { useMergedRefs } from "../internal/use-merged-refs.mjs";
|
|
6
7
|
import { AlertDialogCancelContext } from "./alert-dialog-context.mjs";
|
|
7
|
-
|
|
8
|
-
//#region src/alert-dialog/alert-dialog-cancel.tsx
|
|
8
|
+
// src/alert-dialog/alert-dialog-cancel.tsx
|
|
9
9
|
/**
|
|
10
10
|
* The safe answer: `Dialog.Close` under another name (`<button type="button" commandfor
|
|
11
11
|
* command="request-close">` in JS-free mode, a close through the Root in library mode), and the
|
|
@@ -44,7 +44,6 @@ function AlertDialogCancel({ disabled, ref, ...rest }) {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
AlertDialogCancel.displayName = "AlertDialogCancel";
|
|
47
|
-
//#endregion
|
|
48
47
|
export { AlertDialogCancel };
|
|
49
48
|
|
|
50
49
|
//# sourceMappingURL=alert-dialog-cancel.mjs.map
|