@ariakit/react-components 0.1.0 → 0.1.2
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/CHANGELOG.md +56 -0
- package/dist/button/button.d.ts +1 -1
- package/dist/{button-Cp853csH.d.ts → button-CVWcOgxs.d.ts} +3 -3
- package/dist/{button-Cp853csH.d.ts.map → button-CVWcOgxs.d.ts.map} +1 -1
- package/dist/checkbox/checkbox-check.d.ts +1 -1
- package/dist/checkbox/checkbox-check.d.ts.map +1 -1
- package/dist/checkbox/checkbox.d.ts +2 -2
- package/dist/checkbox/checkbox.d.ts.map +1 -1
- package/dist/collection/collection-item-offscreen.d.ts +1 -1
- package/dist/collection/collection-item-offscreen.js +1 -1
- package/dist/collection/collection-item-offscreen.js.map +1 -1
- package/dist/collection/collection-item.d.ts +1 -1
- package/dist/collection/collection-renderer.d.ts +1 -1
- package/dist/collection/collection-renderer.js +1 -1
- package/dist/collection/collection-renderer.js.map +1 -1
- package/dist/collection/collection.d.ts +1 -1
- package/dist/collection/collection.d.ts.map +1 -1
- package/dist/{collection-item-offscreen-DyXa-sqj.d.ts → collection-item-offscreen-B5E5vNFi.d.ts} +2 -2
- package/dist/{collection-item-offscreen-DyXa-sqj.d.ts.map → collection-item-offscreen-B5E5vNFi.d.ts.map} +1 -1
- package/dist/{collection-item-C-g2BwVF.d.ts → collection-item-pvEWNoNs.d.ts} +2 -2
- package/dist/{collection-item-C-g2BwVF.d.ts.map → collection-item-pvEWNoNs.d.ts.map} +1 -1
- package/dist/{collection-renderer-DsPD9ksD.d.ts → collection-renderer-BhzF21Du.d.ts} +29 -15
- package/dist/collection-renderer-BhzF21Du.d.ts.map +1 -0
- package/dist/combobox/combobox-cancel.d.ts +2 -2
- package/dist/combobox/combobox-cancel.d.ts.map +1 -1
- package/dist/combobox/combobox-cancel.js +1 -1
- package/dist/combobox/combobox-cancel.js.map +1 -1
- package/dist/combobox/combobox-disclosure.d.ts +2 -2
- package/dist/combobox/combobox-disclosure.d.ts.map +1 -1
- package/dist/combobox/combobox-disclosure.js +1 -1
- package/dist/combobox/combobox-disclosure.js.map +1 -1
- package/dist/combobox/combobox-group-label.d.ts +1 -1
- package/dist/combobox/combobox-group-label.d.ts.map +1 -1
- package/dist/combobox/combobox-group.d.ts +1 -1
- package/dist/combobox/combobox-group.d.ts.map +1 -1
- package/dist/combobox/combobox-group.js +1 -1
- package/dist/combobox/combobox-group.js.map +1 -1
- package/dist/combobox/combobox-item-check.d.ts +1 -1
- package/dist/combobox/combobox-item-check.d.ts.map +1 -1
- package/dist/combobox/combobox-item-value.d.ts +1 -1
- package/dist/combobox/combobox-item-value.d.ts.map +1 -1
- package/dist/combobox/combobox-item.d.ts +3 -3
- package/dist/combobox/combobox-item.d.ts.map +1 -1
- package/dist/combobox/combobox-item.js +1 -1
- package/dist/combobox/combobox-item.js.map +1 -1
- package/dist/combobox/combobox-label.d.ts +1 -1
- package/dist/combobox/combobox-label.d.ts.map +1 -1
- package/dist/combobox/combobox-label.js +1 -1
- package/dist/combobox/combobox-label.js.map +1 -1
- package/dist/combobox/combobox-list.d.ts +1 -1
- package/dist/combobox/combobox-list.d.ts.map +1 -1
- package/dist/combobox/combobox-list.js +1 -1
- package/dist/combobox/combobox-list.js.map +1 -1
- package/dist/combobox/combobox-popover.d.ts +1 -1
- package/dist/combobox/combobox-popover.js +1 -1
- package/dist/combobox/combobox-popover.js.map +1 -1
- package/dist/combobox/combobox-row.d.ts +1 -1
- package/dist/combobox/combobox-row.d.ts.map +1 -1
- package/dist/combobox/combobox-row.js +1 -1
- package/dist/combobox/combobox-row.js.map +1 -1
- package/dist/combobox/combobox-separator.d.ts +1 -1
- package/dist/combobox/combobox-separator.d.ts.map +1 -1
- package/dist/combobox/combobox-separator.js +1 -1
- package/dist/combobox/combobox-separator.js.map +1 -1
- package/dist/combobox/combobox-value.js +1 -1
- package/dist/combobox/combobox-value.js.map +1 -1
- package/dist/combobox/combobox.d.ts +3 -3
- package/dist/combobox/combobox.d.ts.map +1 -1
- package/dist/combobox/combobox.js +16 -2
- package/dist/combobox/combobox.js.map +1 -1
- package/dist/command/command.d.ts +1 -1
- package/dist/{command-DckndCUK.d.ts → command-B9C8p3_S.d.ts} +3 -3
- package/dist/{command-DckndCUK.d.ts.map → command-B9C8p3_S.d.ts.map} +1 -1
- package/dist/composite/composite-container.d.ts +1 -1
- package/dist/composite/composite-container.d.ts.map +1 -1
- package/dist/composite/composite-container.js +2 -2
- package/dist/composite/composite-container.js.map +1 -1
- package/dist/composite/composite-group-label.d.ts +2 -2
- package/dist/composite/composite-group-label.d.ts.map +1 -1
- package/dist/composite/composite-group.d.ts +2 -2
- package/dist/composite/composite-group.d.ts.map +1 -1
- package/dist/composite/composite-hover.d.ts +1 -1
- package/dist/composite/composite-hover.js +9 -13
- package/dist/composite/composite-hover.js.map +1 -1
- package/dist/composite/composite-input.d.ts +1 -1
- package/dist/composite/composite-input.d.ts.map +1 -1
- package/dist/composite/composite-input.js +1 -1
- package/dist/composite/composite-input.js.map +1 -1
- package/dist/composite/composite-item-offscreen.d.ts +2 -2
- package/dist/composite/composite-item-offscreen.js +2 -2
- package/dist/composite/composite-item-offscreen.js.map +1 -1
- package/dist/composite/composite-item.d.ts +1 -1
- package/dist/composite/composite-item.js +2 -2
- package/dist/composite/composite-item.js.map +1 -1
- package/dist/composite/composite-overflow-disclosure.d.ts +2 -2
- package/dist/composite/composite-overflow-disclosure.d.ts.map +1 -1
- package/dist/composite/composite-overflow.d.ts +2 -2
- package/dist/composite/composite-overflow.d.ts.map +1 -1
- package/dist/composite/composite-renderer.d.ts +28 -14
- package/dist/composite/composite-renderer.d.ts.map +1 -1
- package/dist/composite/composite-renderer.js +2 -2
- package/dist/composite/composite-renderer.js.map +1 -1
- package/dist/composite/composite-row.d.ts +1 -1
- package/dist/composite/composite-row.d.ts.map +1 -1
- package/dist/composite/composite-row.js +3 -3
- package/dist/composite/composite-row.js.map +1 -1
- package/dist/composite/composite-separator.d.ts +2 -2
- package/dist/composite/composite-separator.d.ts.map +1 -1
- package/dist/composite/composite-separator.js +3 -3
- package/dist/composite/composite-separator.js.map +1 -1
- package/dist/composite/composite-typeahead.d.ts +1 -1
- package/dist/composite/composite-typeahead.js +3 -3
- package/dist/composite/composite-typeahead.js.map +1 -1
- package/dist/composite/composite.d.ts +1 -1
- package/dist/composite/composite.js +3 -3
- package/dist/composite/composite.js.map +1 -1
- package/dist/{composite-DLvyFHMq.d.ts → composite-KBhCGLEy.d.ts} +3 -3
- package/dist/{composite-DLvyFHMq.d.ts.map → composite-KBhCGLEy.d.ts.map} +1 -1
- package/dist/{composite-hover-C7ul163w.d.ts → composite-hover-BpXq3T8J.d.ts} +2 -2
- package/dist/{composite-hover-C7ul163w.d.ts.map → composite-hover-BpXq3T8J.d.ts.map} +1 -1
- package/dist/{composite-item-B4WTelVz.d.ts → composite-item-d4UXaZ84.d.ts} +4 -4
- package/dist/{composite-item-B4WTelVz.d.ts.map → composite-item-d4UXaZ84.d.ts.map} +1 -1
- package/dist/{composite-typeahead-DDhpyKqm.d.ts → composite-typeahead-0euW43GU.d.ts} +2 -2
- package/dist/{composite-typeahead-DDhpyKqm.d.ts.map → composite-typeahead-0euW43GU.d.ts.map} +1 -1
- package/dist/dialog/dialog-backdrop.d.ts +1 -1
- package/dist/dialog/dialog-description.d.ts +1 -1
- package/dist/dialog/dialog-disclosure.d.ts +1 -1
- package/dist/dialog/dialog-disclosure.js +1 -1
- package/dist/dialog/dialog-disclosure.js.map +1 -1
- package/dist/dialog/dialog-dismiss.d.ts +1 -1
- package/dist/dialog/dialog-heading.d.ts +1 -1
- package/dist/dialog/dialog.d.ts +1 -1
- package/dist/dialog/dialog.js +18 -6
- package/dist/dialog/dialog.js.map +1 -1
- package/dist/dialog/utils/disable-accessibility-tree-outside.d.ts +1 -3
- package/dist/dialog/utils/disable-accessibility-tree-outside.d.ts.map +1 -1
- package/dist/dialog/utils/disable-accessibility-tree-outside.js +1 -15
- package/dist/dialog/utils/disable-accessibility-tree-outside.js.map +1 -1
- package/dist/dialog/utils/use-hide-on-interact-outside.d.ts +1 -1
- package/dist/dialog/utils/use-hide-on-interact-outside.js +2 -2
- package/dist/dialog/utils/use-hide-on-interact-outside.js.map +1 -1
- package/dist/dialog/utils/use-prevent-body-scroll.js +2 -1
- package/dist/dialog/utils/use-prevent-body-scroll.js.map +1 -1
- package/dist/dialog/utils/use-previous-mouse-down-ref.d.ts +1 -1
- package/dist/dialog/utils/use-previous-mouse-down-ref.d.ts.map +1 -1
- package/dist/{dialog-C__C-zX2.d.ts → dialog-D23r2ZWj.d.ts} +4 -4
- package/dist/{dialog-C__C-zX2.d.ts.map → dialog-D23r2ZWj.d.ts.map} +1 -1
- package/dist/{dialog-description-BCZJ1Kyd.d.ts → dialog-description-CJGxnEvk.d.ts} +2 -2
- package/dist/{dialog-description-BCZJ1Kyd.d.ts.map → dialog-description-CJGxnEvk.d.ts.map} +1 -1
- package/dist/{dialog-disclosure-DLD10zlb.d.ts → dialog-disclosure-DSESk5pv.d.ts} +3 -3
- package/dist/{dialog-disclosure-DLD10zlb.d.ts.map → dialog-disclosure-DSESk5pv.d.ts.map} +1 -1
- package/dist/{dialog-dismiss-CnwEbzc6.d.ts → dialog-dismiss-DW3XQYvp.d.ts} +3 -3
- package/dist/{dialog-dismiss-CnwEbzc6.d.ts.map → dialog-dismiss-DW3XQYvp.d.ts.map} +1 -1
- package/dist/{dialog-heading-DQvnOfZH.d.ts → dialog-heading-DGA5d8VH.d.ts} +3 -3
- package/dist/{dialog-heading-DQvnOfZH.d.ts.map → dialog-heading-DGA5d8VH.d.ts.map} +1 -1
- package/dist/disclosure/disclosure-content.js +1 -1
- package/dist/disclosure/disclosure-content.js.map +1 -1
- package/dist/disclosure/disclosure.d.ts +1 -1
- package/dist/disclosure/disclosure.js +1 -1
- package/dist/disclosure/disclosure.js.map +1 -1
- package/dist/{disclosure-CQ37hPVP.d.ts → disclosure-C4F4sCVZ.d.ts} +3 -3
- package/dist/{disclosure-CQ37hPVP.d.ts.map → disclosure-C4F4sCVZ.d.ts.map} +1 -1
- package/dist/focus-trap/focus-trap-region.d.ts +1 -1
- package/dist/focus-trap/focus-trap-region.d.ts.map +1 -1
- package/dist/focus-trap/focus-trap.d.ts +1 -1
- package/dist/focus-trap/focus-trap.d.ts.map +1 -1
- package/dist/focusable/focusable-container.d.ts +1 -1
- package/dist/focusable/focusable-container.d.ts.map +1 -1
- package/dist/focusable/focusable.d.ts +1 -1
- package/dist/focusable/focusable.js +49 -8
- package/dist/focusable/focusable.js.map +1 -1
- package/dist/{focusable-B00tOxtB.d.ts → focusable-dBZH13-T.d.ts} +2 -2
- package/dist/{focusable-B00tOxtB.d.ts.map → focusable-dBZH13-T.d.ts.map} +1 -1
- package/dist/form/form-checkbox.d.ts +1 -1
- package/dist/form/form-checkbox.d.ts.map +1 -1
- package/dist/form/form-checkbox.js +1 -1
- package/dist/form/form-checkbox.js.map +1 -1
- package/dist/form/form-control.d.ts +2 -2
- package/dist/form/form-control.d.ts.map +1 -1
- package/dist/form/form-control.js +1 -1
- package/dist/form/form-control.js.map +1 -1
- package/dist/form/form-description.d.ts +2 -2
- package/dist/form/form-description.d.ts.map +1 -1
- package/dist/form/form-description.js +1 -1
- package/dist/form/form-description.js.map +1 -1
- package/dist/form/form-error.d.ts +2 -2
- package/dist/form/form-error.d.ts.map +1 -1
- package/dist/form/form-error.js +1 -1
- package/dist/form/form-error.js.map +1 -1
- package/dist/form/form-field.d.ts +1 -1
- package/dist/form/form-field.d.ts.map +1 -1
- package/dist/form/form-group-label.d.ts +2 -2
- package/dist/form/form-group-label.d.ts.map +1 -1
- package/dist/form/form-group.d.ts +2 -2
- package/dist/form/form-group.d.ts.map +1 -1
- package/dist/form/form-input.d.ts +2 -2
- package/dist/form/form-input.d.ts.map +1 -1
- package/dist/form/form-input.js +1 -1
- package/dist/form/form-input.js.map +1 -1
- package/dist/form/form-label.d.ts +2 -2
- package/dist/form/form-label.d.ts.map +1 -1
- package/dist/form/form-label.js +1 -1
- package/dist/form/form-label.js.map +1 -1
- package/dist/form/form-push.d.ts +3 -3
- package/dist/form/form-push.d.ts.map +1 -1
- package/dist/form/form-push.js +1 -1
- package/dist/form/form-push.js.map +1 -1
- package/dist/form/form-radio-group.d.ts +1 -1
- package/dist/form/form-radio-group.d.ts.map +1 -1
- package/dist/form/form-radio.d.ts +1 -1
- package/dist/form/form-radio.d.ts.map +1 -1
- package/dist/form/form-radio.js +1 -1
- package/dist/form/form-radio.js.map +1 -1
- package/dist/form/form-remove.d.ts +16 -12
- package/dist/form/form-remove.d.ts.map +1 -1
- package/dist/form/form-remove.js +15 -11
- package/dist/form/form-remove.js.map +1 -1
- package/dist/form/form-reset.d.ts +2 -2
- package/dist/form/form-reset.d.ts.map +1 -1
- package/dist/form/form-reset.js +1 -1
- package/dist/form/form-reset.js.map +1 -1
- package/dist/form/form-submit.d.ts +2 -2
- package/dist/form/form-submit.d.ts.map +1 -1
- package/dist/form/form-submit.js +1 -1
- package/dist/form/form-submit.js.map +1 -1
- package/dist/form/form.d.ts +1 -1
- package/dist/form/form.d.ts.map +1 -1
- package/dist/form/form.js +1 -1
- package/dist/form/form.js.map +1 -1
- package/dist/group/group-label.d.ts +1 -1
- package/dist/group/group.d.ts +1 -1
- package/dist/{group-label-C16IDs1b.d.ts → group-label-BKYqD4Sj.d.ts} +2 -2
- package/dist/{group-label-C16IDs1b.d.ts.map → group-label-BKYqD4Sj.d.ts.map} +1 -1
- package/dist/{group-CamegDJA.d.ts → group-nGD9e6Dj.d.ts} +2 -2
- package/dist/{group-CamegDJA.d.ts.map → group-nGD9e6Dj.d.ts.map} +1 -1
- package/dist/heading/heading.d.ts +1 -1
- package/dist/heading/heading.js +2 -2
- package/dist/heading/heading.js.map +1 -1
- package/dist/{heading-zY9g_9K-.d.ts → heading-D_AmeqL5.d.ts} +2 -2
- package/dist/{heading-zY9g_9K-.d.ts.map → heading-D_AmeqL5.d.ts.map} +1 -1
- package/dist/hovercard/hovercard-anchor.d.ts +2 -2
- package/dist/hovercard/hovercard-anchor.d.ts.map +1 -1
- package/dist/hovercard/hovercard-anchor.js +1 -1
- package/dist/hovercard/hovercard-anchor.js.map +1 -1
- package/dist/hovercard/hovercard-arrow.d.ts +1 -1
- package/dist/hovercard/hovercard-arrow.d.ts.map +1 -1
- package/dist/hovercard/hovercard-description.d.ts +2 -2
- package/dist/hovercard/hovercard-description.d.ts.map +1 -1
- package/dist/hovercard/hovercard-disclosure.d.ts +2 -2
- package/dist/hovercard/hovercard-disclosure.d.ts.map +1 -1
- package/dist/hovercard/hovercard-disclosure.js +4 -4
- package/dist/hovercard/hovercard-disclosure.js.map +1 -1
- package/dist/hovercard/hovercard-dismiss.d.ts +2 -2
- package/dist/hovercard/hovercard-dismiss.d.ts.map +1 -1
- package/dist/hovercard/hovercard-heading.d.ts +2 -2
- package/dist/hovercard/hovercard-heading.d.ts.map +1 -1
- package/dist/hovercard/hovercard.d.ts +1 -1
- package/dist/hovercard/hovercard.js +2 -2
- package/dist/hovercard/hovercard.js.map +1 -1
- package/dist/menu/menu-arrow.d.ts +2 -2
- package/dist/menu/menu-arrow.d.ts.map +1 -1
- package/dist/menu/menu-bar-provider.js +1 -1
- package/dist/menu/menu-bar-provider.js.map +1 -1
- package/dist/menu/menu-bar-store.d.ts +3 -3
- package/dist/menu/menu-bar-store.js +3 -3
- package/dist/menu/menu-bar-store.js.map +1 -1
- package/dist/menu/menu-bar.d.ts +1 -1
- package/dist/menu/menu-bar.d.ts.map +1 -1
- package/dist/menu/menu-bar.js +1 -1
- package/dist/menu/menu-bar.js.map +1 -1
- package/dist/menu/menu-button-arrow.d.ts +2 -2
- package/dist/menu/menu-button-arrow.d.ts.map +1 -1
- package/dist/menu/menu-button.d.ts +3 -3
- package/dist/menu/menu-button.d.ts.map +1 -1
- package/dist/menu/menu-button.js +1 -1
- package/dist/menu/menu-button.js.map +1 -1
- package/dist/menu/menu-context.d.ts +10 -3
- package/dist/menu/menu-context.d.ts.map +1 -1
- package/dist/menu/menu-context.js +8 -1
- package/dist/menu/menu-context.js.map +1 -1
- package/dist/menu/menu-description.d.ts +2 -2
- package/dist/menu/menu-description.d.ts.map +1 -1
- package/dist/menu/menu-dismiss.d.ts +2 -2
- package/dist/menu/menu-dismiss.d.ts.map +1 -1
- package/dist/menu/menu-group-label.d.ts +2 -2
- package/dist/menu/menu-group-label.d.ts.map +1 -1
- package/dist/menu/menu-group.d.ts +2 -2
- package/dist/menu/menu-group.d.ts.map +1 -1
- package/dist/menu/menu-heading.d.ts +2 -2
- package/dist/menu/menu-heading.d.ts.map +1 -1
- package/dist/menu/menu-item-check.d.ts +2 -2
- package/dist/menu/menu-item-check.d.ts.map +1 -1
- package/dist/menu/menu-item-checkbox.d.ts +2 -2
- package/dist/menu/menu-item-checkbox.d.ts.map +1 -1
- package/dist/menu/menu-item-checkbox.js +1 -1
- package/dist/menu/menu-item-checkbox.js.map +1 -1
- package/dist/menu/menu-item-radio.d.ts +2 -2
- package/dist/menu/menu-item-radio.d.ts.map +1 -1
- package/dist/menu/menu-item-radio.js +1 -1
- package/dist/menu/menu-item-radio.js.map +1 -1
- package/dist/menu/menu-item.d.ts +5 -5
- package/dist/menu/menu-item.d.ts.map +1 -1
- package/dist/menu/menu-item.js +8 -4
- package/dist/menu/menu-item.js.map +1 -1
- package/dist/menu/menu-list.d.ts +4 -4
- package/dist/menu/menu-list.d.ts.map +1 -1
- package/dist/menu/menu-list.js +6 -2
- package/dist/menu/menu-list.js.map +1 -1
- package/dist/menu/menu-provider.d.ts +1 -1
- package/dist/menu/menu-separator.d.ts +2 -2
- package/dist/menu/menu-separator.d.ts.map +1 -1
- package/dist/menu/menu-store.d.ts +1 -1
- package/dist/menu/menu.js +1 -1
- package/dist/menu/menu.js.map +1 -1
- package/dist/{menu-store-0CKKmNek.d.ts → menu-store-BpTJdcL8.d.ts} +2 -2
- package/dist/{menu-store-0CKKmNek.d.ts.map → menu-store-BpTJdcL8.d.ts.map} +1 -1
- package/dist/menubar/menubar-context.d.ts +2 -3
- package/dist/menubar/menubar-context.d.ts.map +1 -1
- package/dist/menubar/menubar-context.js +1 -3
- package/dist/menubar/menubar-context.js.map +1 -1
- package/dist/menubar/menubar-provider.d.ts +1 -1
- package/dist/menubar/menubar-store.d.ts +1 -1
- package/dist/menubar/menubar-store.js +2 -2
- package/dist/menubar/menubar-store.js.map +1 -1
- package/dist/menubar/menubar.d.ts +3 -3
- package/dist/menubar/menubar.d.ts.map +1 -1
- package/dist/{menubar-store-3h0eNIbS.d.ts → menubar-store-C553OKBw.d.ts} +3 -3
- package/dist/{menubar-store-3h0eNIbS.d.ts.map → menubar-store-C553OKBw.d.ts.map} +1 -1
- package/dist/popover/popover-anchor.d.ts +1 -1
- package/dist/popover/popover-arrow.d.ts +1 -1
- package/dist/popover/popover-arrow.d.ts.map +1 -1
- package/dist/popover/popover-arrow.js +4 -4
- package/dist/popover/popover-arrow.js.map +1 -1
- package/dist/popover/popover-description.d.ts +1 -1
- package/dist/popover/popover-disclosure-arrow.d.ts +1 -1
- package/dist/popover/popover-disclosure-arrow.d.ts.map +1 -1
- package/dist/popover/popover-disclosure-arrow.js +1 -1
- package/dist/popover/popover-disclosure-arrow.js.map +1 -1
- package/dist/popover/popover-disclosure.d.ts +3 -3
- package/dist/popover/popover-disclosure.d.ts.map +1 -1
- package/dist/popover/popover-disclosure.js +1 -1
- package/dist/popover/popover-disclosure.js.map +1 -1
- package/dist/popover/popover-dismiss.d.ts +1 -1
- package/dist/popover/popover-heading.d.ts +1 -1
- package/dist/popover/popover.d.ts +1 -1
- package/dist/popover/popover.js +2 -2
- package/dist/popover/popover.js.map +1 -1
- package/dist/{popover-CCqiRKqg.d.ts → popover-B9PxE5iP.d.ts} +10 -2
- package/dist/popover-B9PxE5iP.d.ts.map +1 -0
- package/dist/{popover-anchor-PgfeXyzs.d.ts → popover-anchor-W18KUmuM.d.ts} +2 -2
- package/dist/{popover-anchor-PgfeXyzs.d.ts.map → popover-anchor-W18KUmuM.d.ts.map} +1 -1
- package/dist/{popover-description-DU753dah.d.ts → popover-description-DbW4mVBb.d.ts} +3 -3
- package/dist/{popover-description-DU753dah.d.ts.map → popover-description-DbW4mVBb.d.ts.map} +1 -1
- package/dist/{popover-dismiss-DPeI6Zse.d.ts → popover-dismiss-CQFvuLzJ.d.ts} +3 -3
- package/dist/{popover-dismiss-DPeI6Zse.d.ts.map → popover-dismiss-CQFvuLzJ.d.ts.map} +1 -1
- package/dist/{popover-heading-DGsr6D5W.d.ts → popover-heading-DC8rYnwo.d.ts} +3 -3
- package/dist/{popover-heading-DGsr6D5W.d.ts.map → popover-heading-DC8rYnwo.d.ts.map} +1 -1
- package/dist/portal/portal.d.ts +1 -1
- package/dist/{portal-CMBWiayp.d.ts → portal-CKFTfCWH.d.ts} +2 -2
- package/dist/{portal-CMBWiayp.d.ts.map → portal-CKFTfCWH.d.ts.map} +1 -1
- package/dist/radio/radio-group.d.ts +2 -2
- package/dist/radio/radio-group.d.ts.map +1 -1
- package/dist/radio/radio-group.js +1 -1
- package/dist/radio/radio-group.js.map +1 -1
- package/dist/radio/radio.d.ts +2 -2
- package/dist/radio/radio.d.ts.map +1 -1
- package/dist/select/select-arrow.d.ts +1 -1
- package/dist/select/select-arrow.d.ts.map +1 -1
- package/dist/select/select-dismiss.d.ts +2 -2
- package/dist/select/select-dismiss.d.ts.map +1 -1
- package/dist/select/select-group-label.d.ts +1 -1
- package/dist/select/select-group-label.d.ts.map +1 -1
- package/dist/select/select-group.d.ts +1 -1
- package/dist/select/select-group.d.ts.map +1 -1
- package/dist/select/select-heading.d.ts +2 -2
- package/dist/select/select-heading.d.ts.map +1 -1
- package/dist/select/select-item-check.d.ts +1 -1
- package/dist/select/select-item-check.d.ts.map +1 -1
- package/dist/select/select-item.d.ts +3 -3
- package/dist/select/select-item.d.ts.map +1 -1
- package/dist/select/select-item.js +1 -1
- package/dist/select/select-item.js.map +1 -1
- package/dist/select/select-label.d.ts +1 -1
- package/dist/select/select-label.d.ts.map +1 -1
- package/dist/select/select-label.js +1 -1
- package/dist/select/select-label.js.map +1 -1
- package/dist/select/select-list.d.ts +3 -3
- package/dist/select/select-list.d.ts.map +1 -1
- package/dist/select/select-list.js +1 -1
- package/dist/select/select-list.js.map +1 -1
- package/dist/select/select-popover.d.ts +1 -1
- package/dist/select/select-renderer.d.ts +2 -2
- package/dist/select/select-renderer.d.ts.map +1 -1
- package/dist/select/select-row.d.ts +1 -1
- package/dist/select/select-row.d.ts.map +1 -1
- package/dist/select/select-row.js +1 -1
- package/dist/select/select-row.js.map +1 -1
- package/dist/select/select-separator.d.ts +1 -1
- package/dist/select/select-separator.d.ts.map +1 -1
- package/dist/select/select.d.ts +2 -2
- package/dist/select/select.d.ts.map +1 -1
- package/dist/select/select.js +1 -1
- package/dist/select/select.js.map +1 -1
- package/dist/separator/separator.d.ts +1 -1
- package/dist/{separator--ozQfMcK.d.ts → separator-BnvSVwBa.d.ts} +2 -2
- package/dist/{separator--ozQfMcK.d.ts.map → separator-BnvSVwBa.d.ts.map} +1 -1
- package/dist/tab/tab-list.d.ts +2 -2
- package/dist/tab/tab-list.d.ts.map +1 -1
- package/dist/tab/tab-list.js +1 -1
- package/dist/tab/tab-list.js.map +1 -1
- package/dist/tab/tab-panel.d.ts +3 -3
- package/dist/tab/tab-panel.d.ts.map +1 -1
- package/dist/tab/tab-panel.js +2 -3
- package/dist/tab/tab-panel.js.map +1 -1
- package/dist/tab/tab.d.ts +2 -2
- package/dist/tab/tab.d.ts.map +1 -1
- package/dist/tab/tab.js +1 -1
- package/dist/tab/tab.js.map +1 -1
- package/dist/tag/tag-input.d.ts +2 -2
- package/dist/tag/tag-input.d.ts.map +1 -1
- package/dist/tag/tag-input.js +1 -2
- package/dist/tag/tag-input.js.map +1 -1
- package/dist/tag/tag-list-label.d.ts +2 -2
- package/dist/tag/tag-list-label.d.ts.map +1 -1
- package/dist/tag/tag-list-label.js +1 -1
- package/dist/tag/tag-list-label.js.map +1 -1
- package/dist/tag/tag-list.d.ts +2 -2
- package/dist/tag/tag-list.d.ts.map +1 -1
- package/dist/tag/tag-list.js +1 -1
- package/dist/tag/tag-list.js.map +1 -1
- package/dist/tag/tag-remove.d.ts +1 -1
- package/dist/tag/tag-remove.d.ts.map +1 -1
- package/dist/tag/tag-remove.js +1 -2
- package/dist/tag/tag-remove.js.map +1 -1
- package/dist/tag/tag-value.js +1 -1
- package/dist/tag/tag-value.js.map +1 -1
- package/dist/tag/tag-values.js +1 -1
- package/dist/tag/tag-values.js.map +1 -1
- package/dist/tag/tag.d.ts +2 -2
- package/dist/tag/tag.d.ts.map +1 -1
- package/dist/tag/tag.js +1 -1
- package/dist/tag/tag.js.map +1 -1
- package/dist/toolbar/toolbar-container.d.ts +1 -1
- package/dist/toolbar/toolbar-container.d.ts.map +1 -1
- package/dist/toolbar/toolbar-input.d.ts +1 -1
- package/dist/toolbar/toolbar-input.d.ts.map +1 -1
- package/dist/toolbar/toolbar-item.d.ts +2 -2
- package/dist/toolbar/toolbar-item.d.ts.map +1 -1
- package/dist/toolbar/toolbar-separator.d.ts +1 -1
- package/dist/toolbar/toolbar-separator.d.ts.map +1 -1
- package/dist/toolbar/toolbar.d.ts +2 -2
- package/dist/toolbar/toolbar.d.ts.map +1 -1
- package/dist/tooltip/tooltip-anchor.d.ts +1 -1
- package/dist/tooltip/tooltip-anchor.d.ts.map +1 -1
- package/dist/tooltip/tooltip-anchor.js +15 -4
- package/dist/tooltip/tooltip-anchor.js.map +1 -1
- package/dist/tooltip/tooltip-arrow.d.ts +1 -1
- package/dist/tooltip/tooltip-arrow.d.ts.map +1 -1
- package/dist/tooltip/tooltip-arrow.js +1 -1
- package/dist/tooltip/tooltip-arrow.js.map +1 -1
- package/dist/tooltip/tooltip.js +1 -1
- package/dist/tooltip/tooltip.js.map +1 -1
- package/dist/visually-hidden/visually-hidden.d.ts +1 -1
- package/dist/visually-hidden/visually-hidden.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/collection/collection-item-offscreen.tsx +1 -1
- package/src/combobox/combobox.tsx +47 -1
- package/src/composite/composite-container.tsx +2 -2
- package/src/composite/composite-hover.tsx +8 -14
- package/src/composite/composite-item-offscreen.tsx +2 -2
- package/src/composite/composite-item.tsx +2 -2
- package/src/composite/composite-renderer.tsx +2 -2
- package/src/composite/composite-row.tsx +2 -2
- package/src/composite/composite-separator.tsx +2 -2
- package/src/composite/composite-typeahead.tsx +2 -2
- package/src/composite/composite.tsx +3 -3
- package/src/dialog/dialog.tsx +33 -10
- package/src/dialog/utils/disable-accessibility-tree-outside.ts +0 -25
- package/src/dialog/utils/use-hide-on-interact-outside.ts +3 -2
- package/src/focusable/focusable.tsx +53 -10
- package/src/form/form-remove.tsx +14 -10
- package/src/form/form.tsx +3 -1
- package/src/heading/heading.tsx +2 -5
- package/src/hovercard/hovercard-disclosure.tsx +18 -4
- package/src/hovercard/hovercard.tsx +1 -1
- package/src/menu/menu-bar-store.ts +2 -2
- package/src/menu/menu-context.tsx +8 -0
- package/src/menu/menu-item.tsx +18 -1
- package/src/menu/menu-list.tsx +15 -0
- package/src/menubar/menubar-context.tsx +0 -5
- package/src/menubar/menubar-store.ts +2 -2
- package/src/popover/popover-arrow.tsx +3 -3
- package/src/popover/popover.tsx +8 -0
- package/src/tab/tab-panel.tsx +1 -1
- package/src/tag/tag-input.tsx +0 -1
- package/src/tag/tag-remove.tsx +0 -1
- package/src/tooltip/tooltip-anchor.tsx +23 -8
- package/dist/collection-renderer-DsPD9ksD.d.ts.map +0 -1
- package/dist/popover-CCqiRKqg.d.ts.map +0 -1
- package/src/hovercard/utils/__tests__/polygon-test.ts +0 -66
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":[],"sources":["../../src/dialog/dialog.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport {\n useBooleanEvent,\n useEvent,\n useId,\n useMergeRefs,\n usePortalRef,\n useSafeLayoutEffect,\n useWrapElement,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { sync } from \"@ariakit/store\";\nimport {\n contains,\n getActiveElement,\n getDocument,\n getWindow,\n addGlobalEventListener,\n getFirstTabbableIn,\n isFocusable,\n chain,\n isSafari,\n} from \"@ariakit/utils\";\nimport type { BooleanOrCallback } from \"@ariakit/utils\";\nimport type {\n ComponentPropsWithRef,\n ElementType,\n FC,\n ReactElement,\n KeyboardEvent as ReactKeyboardEvent,\n RefObject,\n SyntheticEvent,\n} from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { DisclosureContentOptions } from \"../disclosure/disclosure-content.tsx\";\nimport {\n isHidden,\n useDisclosureContent,\n} from \"../disclosure/disclosure-content.tsx\";\nimport { useFocusableContainer } from \"../focusable/focusable-container.tsx\";\nimport type { FocusableOptions } from \"../focusable/focusable.tsx\";\nimport { useFocusable } from \"../focusable/focusable.tsx\";\nimport { HeadingLevel } from \"../heading/heading-level.tsx\";\nimport type { PortalOptions } from \"../portal/portal.tsx\";\nimport { usePortal } from \"../portal/portal.tsx\";\nimport { DialogBackdrop } from \"./dialog-backdrop.tsx\";\nimport {\n DialogDescriptionContext,\n DialogHeadingContext,\n DialogScopedContextProvider,\n useDialogProviderContext,\n} from \"./dialog-context.tsx\";\nimport type { DialogStore } from \"./dialog-store.ts\";\nimport { useDialogStore } from \"./dialog-store.ts\";\nimport { disableTree, disableTreeOutside } from \"./utils/disable-tree.ts\";\nimport { isElementMarked, markTreeOutside } from \"./utils/mark-tree-outside.ts\";\nimport { prependHiddenDismiss } from \"./utils/prepend-hidden-dismiss.ts\";\nimport { supportsInert } from \"./utils/supports-inert.ts\";\nimport { useHideOnInteractOutside } from \"./utils/use-hide-on-interact-outside.ts\";\nimport { useNestedDialogs } from \"./utils/use-nested-dialogs.tsx\";\nimport { usePreventBodyScroll } from \"./utils/use-prevent-body-scroll.ts\";\nimport { createWalkTreeSnapshot } from \"./utils/walk-tree-outside.ts\";\n\nconst TagName = \"div\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\nconst isSafariBrowser = isSafari();\n\nfunction isAlreadyFocusingAnotherElement(dialog?: HTMLElement | null) {\n const activeElement = getActiveElement(dialog);\n if (!activeElement) return false;\n if (dialog && contains(dialog, activeElement)) return false;\n if (isFocusable(activeElement)) return true;\n return false;\n}\n\nfunction getElementFromProp(\n prop?: HTMLElement | RefObject<HTMLElement | null> | null,\n focusable = false,\n) {\n if (!prop) return null;\n const element = \"current\" in prop ? prop.current : prop;\n if (!element) return null;\n if (focusable) return isFocusable(element) ? element : null;\n return element;\n}\n\n/**\n * Returns props to create a `Dialog` component.\n * @see https://ariakit.com/components/dialog\n * @example\n * ```jsx\n * const store = useDialogStore();\n * const props = useDialog({ store });\n * <Role {...props}>Dialog</Role>\n * ```\n */\nexport const useDialog = createHook<TagName, DialogOptions>(function useDialog({\n store: storeProp,\n open: openProp,\n onClose,\n focusable = true,\n modal = true,\n portal = modal,\n backdrop = modal,\n hideOnEscape = true,\n hideOnInteractOutside = true,\n getPersistentElements,\n preventBodyScroll = modal,\n autoFocusOnShow = true,\n autoFocusOnHide = true,\n initialFocus,\n finalFocus,\n unmountOnHide,\n unstable_treeSnapshotKey,\n ...props\n}) {\n const context = useDialogProviderContext();\n const ref = useRef<HTMLType>(null);\n\n const store = useDialogStore({\n store: storeProp || context,\n open: openProp,\n setOpen(open) {\n if (open) return;\n const dialog = ref.current;\n if (!dialog) return;\n const event = new Event(\"close\", { bubbles: false, cancelable: true });\n if (onClose) {\n dialog.addEventListener(\"close\", onClose, { once: true });\n }\n dialog.dispatchEvent(event);\n if (!event.defaultPrevented) return;\n store.setOpen(true);\n },\n });\n\n // domReady can be also the portal node element so it's updated when the\n // portal node changes (like in between re-renders), triggering effects\n // again.\n const { portalRef, domReady } = usePortalRef(portal, props.portalRef);\n // Sets preserveTabOrder to true only if the dialog is not a modal and is\n // open.\n const preserveTabOrderProp = props.preserveTabOrder;\n const preserveTabOrder = useStoreState(\n store,\n (state) => preserveTabOrderProp && !modal && state.mounted,\n );\n const id = useId(props.id);\n const open = useStoreState(store, \"open\");\n const mounted = useStoreState(store, \"mounted\");\n const contentElement = useStoreState(store, \"contentElement\");\n const hidden = isHidden(mounted, props.hidden, props.alwaysVisible);\n\n usePreventBodyScroll(contentElement, id, preventBodyScroll && !hidden);\n\n // Tracks whether the dialog was hidden by an outside click or context menu.\n // When true, focusOnHide skips focus restoration to match native HTML\n // behavior where trigger buttons don't receive focus when you click outside.\n // Reset when the dialog opens to avoid stale flags from prevented closes\n // (e.g., onClose calling event.preventDefault), async closes with\n // animations, or when autoFocusOnHide is disabled.\n const interactedOutsideRef = useRef(false);\n useSafeLayoutEffect(() => {\n return sync(store, [\"open\"], (state) => {\n if (!state.open) return;\n interactedOutsideRef.current = false;\n });\n }, [store]);\n useHideOnInteractOutside(\n store,\n hideOnInteractOutside,\n domReady,\n interactedOutsideRef,\n );\n\n const { wrapElement, nestedDialogs } = useNestedDialogs(store);\n props = useWrapElement(props, wrapElement, [wrapElement]);\n\n // On Safari, buttons don't receive focus on mousedown unless they have an\n // explicit tabIndex. Non-Ariakit buttons (which don't go through\n // useFocusable) won't have this, so activeElement may still be BODY when the\n // dialog opens. We track the last mousedown target as a fallback.\n const lastMousedownRef = useRef<Element | null>(null);\n\n if (isSafariBrowser) {\n useEffect(() => {\n if (!domReady) return;\n const dialog = ref.current;\n if (!dialog) return;\n const doc = getDocument(dialog);\n const onMousedown = (event: MouseEvent) => {\n lastMousedownRef.current = event.target as Element;\n };\n doc.addEventListener(\"mousedown\", onMousedown, true);\n return () => {\n doc.removeEventListener(\"mousedown\", onMousedown, true);\n };\n }, [domReady]);\n }\n\n // Sets disclosure element using the current active element right after the\n // dialog is opened.\n useSafeLayoutEffect(() => {\n if (!open) return;\n const dialog = ref.current;\n const activeElement = getActiveElement(dialog, true);\n if (!activeElement) return;\n if (activeElement.tagName === \"BODY\") {\n // Safari fallback: use the last mousedown target when activeElement is\n // BODY (happens with native buttons that lack an explicit tabIndex).\n const fallback = lastMousedownRef.current;\n lastMousedownRef.current = null;\n if (!fallback?.isConnected) return;\n if (!isFocusable(fallback)) return;\n if (dialog && contains(dialog, fallback)) return;\n store.setDisclosureElement(fallback as HTMLElement);\n return;\n }\n // The disclosure element can't be inside the dialog.\n if (dialog && contains(dialog, activeElement)) return;\n store.setDisclosureElement(activeElement);\n }, [store, open]);\n\n // Sets --dialog-viewport-height CSS variable to the height of the visual\n // viewport. This allows the dialog to be positioned correctly when the\n // viewport height changes (e.g., when the keyboard is shown on mobile).\n useEffect(() => {\n if (!mounted) return;\n if (!domReady) return;\n const dialog = ref.current;\n if (!dialog) return;\n const win = getWindow(dialog);\n const viewport = win.visualViewport || win;\n const setViewportHeight = () => {\n const height = win.visualViewport?.height ?? win.innerHeight;\n dialog.style.setProperty(\"--dialog-viewport-height\", `${height}px`);\n };\n setViewportHeight();\n viewport.addEventListener(\"resize\", setViewportHeight);\n return () => {\n viewport.removeEventListener(\"resize\", setViewportHeight);\n };\n }, [mounted, domReady]);\n\n // Renders a hidden dismiss button at the top of the modal dialog element. So\n // that screen reader users aren't trapped in the dialog when there's no\n // visible dismiss button.\n useEffect(() => {\n if (!modal) return;\n if (!mounted) return;\n if (!domReady) return;\n const dialog = ref.current;\n if (!dialog) return;\n // If there's already a DialogDismiss component, it does nothing.\n const existingDismiss = dialog.querySelector(\"[data-dialog-dismiss]\");\n if (existingDismiss) return;\n return prependHiddenDismiss(dialog, store.hide);\n }, [store, modal, mounted, domReady]);\n\n // When the dialog is animated, the open state will be false and the mounted\n // state will be true. The dialog will still be visible until the animation is\n // complete. We need to disable the dialog tree completely in this case. TODO:\n // We should probably do this in a more generic way in the DisclosureContent\n // component.\n useSafeLayoutEffect(() => {\n if (!supportsInert()) return;\n if (open) return;\n if (!mounted) return;\n if (!domReady) return;\n const dialog = ref.current;\n if (!dialog) return;\n return disableTree(dialog);\n }, [open, mounted, domReady]);\n\n const canTakeTreeSnapshot = open && domReady;\n\n useSafeLayoutEffect(() => {\n if (!id) return;\n if (!canTakeTreeSnapshot) return;\n const dialog = ref.current;\n // When the dialog opens, we capture a snapshot of the document. This\n // snapshot is then used to disable elements outside the dialog in the\n // subsequent effect. However, the issue arises as this next effect also\n // relies on nested dialogs. Meaning, each time a nested dialog is rendered,\n // we capture a new document snapshot, which might disable third-party\n // dialogs. Hence, we take the snapshot here, independent of any nested\n // dialogs.\n return createWalkTreeSnapshot(id, [dialog]);\n }, [id, canTakeTreeSnapshot, unstable_treeSnapshotKey]);\n\n const getPersistentElementsProp = useEvent(getPersistentElements);\n\n // Disables/enables the element tree around the modal dialog element.\n useSafeLayoutEffect(() => {\n if (!id) return;\n if (!canTakeTreeSnapshot) return;\n const { disclosureElement } = store.getState();\n const dialog = ref.current;\n const persistentElements = getPersistentElementsProp() || [];\n const allElements = [\n dialog,\n ...persistentElements,\n ...nestedDialogs.map((dialog) => dialog.getState().contentElement),\n ];\n if (modal) {\n return chain(\n markTreeOutside(id, allElements),\n disableTreeOutside(id, allElements),\n );\n }\n return markTreeOutside(id, [disclosureElement, ...allElements]);\n }, [\n id,\n store,\n canTakeTreeSnapshot,\n getPersistentElementsProp,\n nestedDialogs,\n modal,\n unstable_treeSnapshotKey,\n ]);\n\n const mayAutoFocusOnShow = !!autoFocusOnShow;\n const autoFocusOnShowProp = useBooleanEvent(autoFocusOnShow);\n // We have to wait for the dialog to be mounted before allowing focusable\n // elements to be auto focused. Otherwise, there could be unintended scroll\n // jumps. See select-animated browser tests.\n const [autoFocusEnabled, setAutoFocusEnabled] = useState(false);\n\n // Auto focus on show.\n useEffect(() => {\n if (!open) return;\n if (!mayAutoFocusOnShow) return;\n // Makes sure to wait for the portalNode to be created before moving focus.\n // This is useful for when the Dialog component is unmounted when hidden.\n if (!domReady) return;\n // The dialog element may change for different reasons. For example, when\n // the modal or portal props change, the HTML structure will also change,\n // which will affect the dialog element reference. That's why we're\n // listening to contentElement state here instead of getting the ref.current\n // value. This ensures this effect will re-run when the dialog element\n // reference changes.\n if (!contentElement?.isConnected) return;\n const element =\n getElementFromProp(initialFocus, true) ||\n // If no initial focus is specified, we try to focus the first element\n // with the autofocus attribute. If it's an Ariakit component, the\n // Focusable component will consume the autoFocus prop and add the\n // data-autofocus attribute to the element instead.\n contentElement.querySelector<HTMLElement>(\n \"[data-autofocus=true],[autofocus]\",\n ) ||\n // We have to fallback to the first focusable element otherwise portaled\n // dialogs with preserveTabOrder set to true will not receive focus\n // properly because the elements aren't tabbable until the dialog receives\n // focus.\n getFirstTabbableIn(contentElement, true, portal && preserveTabOrder) ||\n // Finally, we fallback to the dialog element itself.\n contentElement;\n const isElementFocusable = isFocusable(element);\n if (!autoFocusOnShowProp(isElementFocusable ? element : null)) return;\n setAutoFocusEnabled(true);\n queueMicrotask(() => {\n // If the dialog was closed between scheduling and executing this\n // microtask, skip the focus call. Otherwise, focusing a now-hidden\n // element could steal focus from the disclosure that focusOnHide already\n // restored.\n if (!store.getState().open) return;\n element.focus();\n // Safari doesn't scroll to the element on focus, so we have to do it\n // manually here.\n if (!isSafariBrowser) return;\n if (!isElementFocusable) return;\n element.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n });\n }, [\n open,\n mayAutoFocusOnShow,\n domReady,\n contentElement,\n initialFocus,\n portal,\n preserveTabOrder,\n store,\n autoFocusOnShowProp,\n ]);\n\n const mayAutoFocusOnHide = !!autoFocusOnHide;\n const autoFocusOnHideProp = useBooleanEvent(autoFocusOnHide);\n\n // Sets a `hasOpened` flag on an effect so we only auto focus on hide if the\n // dialog was open before.\n const [hasOpened, setHasOpened] = useState(false);\n\n useSafeLayoutEffect(() => {\n if (!open) return;\n setHasOpened(true);\n return () => setHasOpened(false);\n }, [open]);\n\n const focusOnHide = useCallback(\n (dialog: HTMLElement | null, retry = true) => {\n // Hide was triggered by clicking or right-clicking outside the dialog.\n // Native HTML dialogs and popovers don't restore focus to the trigger\n // in this case, so we skip focus restoration entirely.\n if (interactedOutsideRef.current) return;\n const { disclosureElement } = store.getState();\n // Hide was triggered by a click/focus on a tabbable element outside the\n // dialog. We won't change focus then.\n if (isAlreadyFocusingAnotherElement(dialog)) return;\n let element = getElementFromProp(finalFocus) || disclosureElement;\n if (element?.id) {\n const doc = getDocument(element);\n const selector = `[aria-activedescendant=\"${element.id}\"]`;\n const composite = doc.querySelector<HTMLElement>(selector);\n // If the element is an item in a composite widget that handles focus\n // with the `aria-activedescendant` attribute, we want to focus on the\n // composite element itself.\n if (composite) {\n element = composite;\n }\n }\n // If the element is not focusable by the time the dialog is hidden, it's\n // probably because it's an element inside another popover or menu that\n // also got hidden when this dialog was shown. We'll try to focus on their\n // disclosure element instead.\n if (element && !isFocusable(element)) {\n const maybeParentDialog = element.closest(\"[data-dialog]\");\n if (maybeParentDialog?.id) {\n const doc = getDocument(maybeParentDialog);\n const selector = `[aria-controls~=\"${maybeParentDialog.id}\"]`;\n const control = doc.querySelector<HTMLElement>(selector);\n if (control) {\n element = control;\n }\n }\n }\n const isElementFocusable = element && isFocusable(element);\n if (!isElementFocusable && retry) {\n // If the element is still not focusable by this time, we retry once\n // again on the next frame. This is sometimes necessary because there\n // may be nested dialogs that still need a tick to remove the inert\n // attribute from elements outside.\n requestAnimationFrame(() => focusOnHide(dialog, false));\n return;\n }\n if (!autoFocusOnHideProp(isElementFocusable ? element : null)) return;\n if (!isElementFocusable) return;\n element?.focus();\n },\n [store, finalFocus, autoFocusOnHideProp],\n );\n\n const focusedOnHideRef = useRef(false);\n\n // Auto focus on hide with an always rendered dialog.\n useSafeLayoutEffect(() => {\n if (open) return;\n if (!hasOpened) return;\n if (!mayAutoFocusOnHide) return;\n const dialog = ref.current;\n // We don't want to focus on hide twice if the dialog is not unmounted, so\n // we set this flag here that will be checked in the cleanup effect below.\n focusedOnHideRef.current = true;\n focusOnHide(dialog);\n }, [open, hasOpened, domReady, mayAutoFocusOnHide, focusOnHide]);\n\n // Auto focus on hide with a dialog that gets unmounted when hidden.\n useEffect(() => {\n if (!hasOpened) return;\n if (!mayAutoFocusOnHide) return;\n const dialog = ref.current;\n return () => {\n if (focusedOnHideRef.current) {\n focusedOnHideRef.current = false;\n return;\n }\n focusOnHide(dialog);\n };\n }, [hasOpened, mayAutoFocusOnHide, focusOnHide]);\n\n const hideOnEscapeProp = useBooleanEvent(hideOnEscape);\n\n // Hide on Escape.\n useEffect(() => {\n if (!domReady) return;\n if (!mounted) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\") return;\n if (event.defaultPrevented) return;\n const dialog = ref.current;\n if (!dialog) return;\n // Ignore the event if the current dialog is marked by another dialog.\n // This guarantees that only the topmost dialog will close on Escape.\n if (isElementMarked(dialog)) return;\n const target = event.target as Element | null;\n if (!target) return;\n const { disclosureElement } = store.getState();\n // This considers valid targets only the disclosure element or descendants\n // of the dialog element.\n const isValidTarget = () => {\n if (target.tagName === \"BODY\") return true;\n if (contains(dialog, target)) return true;\n if (!disclosureElement) return true;\n if (contains(disclosureElement, target)) return true;\n return false;\n };\n if (!isValidTarget()) return;\n if (!hideOnEscapeProp(event)) return;\n store.hide();\n };\n // We're attatching the listener to the document instead of the dialog\n // element so we can listen to the Escape key anywhere in the document, even\n // when the dialog is not focused. By using the capture phase, users can\n // call `event.stopPropagation()` on the `hideOnEscape` function prop.\n const win = contentElement ? getWindow(contentElement) : undefined;\n return addGlobalEventListener(\"keydown\", onKeyDown, true, win);\n }, [store, domReady, mounted, contentElement, hideOnEscapeProp]);\n\n // Resets the heading levels inside the modal dialog so they start with h1.\n props = useWrapElement(\n props,\n (element) => (\n <HeadingLevel level={modal ? 1 : undefined}>{element}</HeadingLevel>\n ),\n [modal],\n );\n\n const hiddenProp = props.hidden;\n const alwaysVisible = props.alwaysVisible;\n\n // Wraps the dialog with a backdrop element if the backdrop prop is truthy.\n props = useWrapElement(\n props,\n (element) => {\n if (!backdrop) return element;\n return (\n <>\n <DialogBackdrop\n store={store}\n backdrop={backdrop}\n hidden={hiddenProp}\n alwaysVisible={alwaysVisible}\n />\n {element}\n </>\n );\n },\n [store, backdrop, hiddenProp, alwaysVisible],\n );\n\n const [headingId, setHeadingId] = useState<string>();\n const [descriptionId, setDescriptionId] = useState<string>();\n\n props = useWrapElement(\n props,\n (element) => (\n <DialogScopedContextProvider value={store}>\n <DialogHeadingContext.Provider value={setHeadingId}>\n <DialogDescriptionContext.Provider value={setDescriptionId}>\n {element}\n </DialogDescriptionContext.Provider>\n </DialogHeadingContext.Provider>\n </DialogScopedContextProvider>\n ),\n [store],\n );\n\n props = {\n \"data-dialog\": \"\",\n role: \"dialog\",\n tabIndex: focusable ? -1 : undefined,\n \"aria-labelledby\": props[\"aria-label\"] != null ? undefined : headingId,\n \"aria-describedby\": descriptionId,\n ...props,\n id,\n ref: useMergeRefs(ref, props.ref),\n };\n\n props = useFocusableContainer({\n ...props,\n autoFocusOnShow: autoFocusEnabled,\n });\n props = useDisclosureContent({ store, ...props });\n props = useFocusable({ ...props, focusable });\n props = usePortal({ portal, ...props, portalRef, preserveTabOrder });\n\n return props;\n});\n\nexport function createDialogComponent<T extends DialogOptions>(\n Component: FC<T>,\n useProviderContext = useDialogProviderContext,\n) {\n return forwardRef(function DialogComponent(props: T) {\n const context = useProviderContext();\n const store = props.store || context;\n const mounted = useStoreState(\n store,\n (state) => !props.unmountOnHide || state?.mounted || !!props.open,\n );\n if (!mounted) return null;\n return <Component {...props} />;\n });\n}\n\n/**\n * Renders a dialog similar to the native `dialog` element that's rendered in a\n * [`portal`](https://ariakit.com/reference/dialog#portal) by default.\n *\n * The dialog can be either\n * [`modal`](https://ariakit.com/reference/dialog#modal) or non-modal. The\n * visibility state can be controlled with the\n * [`open`](https://ariakit.com/reference/dialog#open) and\n * [`onClose`](https://ariakit.com/reference/dialog#onclose) props.\n * @see https://ariakit.com/components/dialog\n * @example\n * ```jsx {4-6}\n * const [open, setOpen] = useState(false);\n *\n * <button onClick={() => setOpen(true)}>Open dialog</button>\n * <Dialog open={open} onClose={() => setOpen(false)}>\n * Dialog\n * </Dialog>\n * ```\n */\nexport const Dialog = createDialogComponent(\n forwardRef(function Dialog(props: DialogProps) {\n const htmlProps = useDialog(props);\n return createElement(TagName, htmlProps);\n }),\n useDialogProviderContext,\n);\n\nexport interface DialogOptions<T extends ElementType = TagName>\n extends FocusableOptions<T>, PortalOptions<T>, DisclosureContentOptions<T> {\n /**\n * Object returned by the\n * [`useDialogStore`](https://ariakit.com/reference/use-dialog-store) hook. If\n * not provided, the closest\n * [`DialogProvider`](https://ariakit.com/reference/dialog-provider)\n * component's context will be used. Otherwise, an internal store will be\n * created.\n */\n store?: DialogStore;\n /**\n * Controls the open state of the dialog. This is similar to the\n * [`open`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/open)\n * attribute on native dialog elements.\n *\n * Live examples:\n * - [Dialog with scrollable\n * backdrop](https://ariakit.com/examples/dialog-backdrop-scrollable)\n * - [Dialog with details &\n * summary](https://ariakit.com/examples/dialog-details)\n * - [Warning on Dialog\n * hide](https://ariakit.com/examples/dialog-hide-warning)\n * - [Dialog with Menu](https://ariakit.com/examples/dialog-menu)\n */\n open?: boolean;\n /**\n * This is an event handler prop triggered when the dialog's `close` event is\n * dispatched. The `close` event is similar to the native dialog\n * [`close`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/close_event)\n * event. The only difference is that this event can be canceled with\n * `event.preventDefault()`, which will prevent the dialog from hiding.\n *\n * It's important to note that this event only fires when the dialog store's\n * [`open`](https://ariakit.com/reference/use-dialog-store#open) state is set\n * to `false`. If the controlled\n * [`open`](https://ariakit.com/reference/dialog#open) prop value changes, or\n * if the dialog's visibility is altered in any other way (such as unmounting\n * the dialog without adjusting the open state), this event won't be\n * triggered.\n *\n * Live examples:\n * - [Dialog with scrollable\n * backdrop](https://ariakit.com/examples/dialog-backdrop-scrollable)\n * - [Dialog with details &\n * summary](https://ariakit.com/examples/dialog-details)\n * - [Warning on Dialog\n * hide](https://ariakit.com/examples/dialog-hide-warning)\n * - [Dialog with Menu](https://ariakit.com/examples/dialog-menu)\n */\n onClose?: (event: Event) => void;\n /**\n * Determines whether the dialog is modal. Modal dialogs have distinct states\n * and behaviors:\n * - The [`portal`](https://ariakit.com/reference/dialog#portal) and\n * [`preventBodyScroll`](https://ariakit.com/reference/dialog#preventbodyscroll)\n * props are set to `true`. They can still be manually set to `false`.\n * - When using the [`Heading`](https://ariakit.com/reference/heading) or\n * [`DialogHeading`](https://ariakit.com/reference/dialog-heading)\n * components within the dialog, their level will be reset so they start\n * with `h1`.\n * - A visually hidden dismiss button will be rendered if the\n * [`DialogDismiss`](https://ariakit.com/reference/dialog-dismiss) component\n * hasn't been used. This allows screen reader users to close the dialog.\n * - When the dialog is open, element tree outside it will be inert.\n *\n * Live examples:\n * - [Combobox with Tabs](https://ariakit.com/examples/combobox-tabs)\n * - [Dialog with details &\n * summary](https://ariakit.com/examples/dialog-details)\n * - [Form with Select](https://ariakit.com/examples/form-select)\n * - [Context menu](https://ariakit.com/examples/menu-context-menu)\n * - [Responsive Popover](https://ariakit.com/examples/popover-responsive)\n * @default true\n */\n modal?: boolean;\n /**\n * Determines whether there will be a backdrop behind the dialog. On modal\n * dialogs, this is `true` by default. Besides a `boolean`, this prop can also\n * be a React component or JSX element that will be rendered as the backdrop.\n *\n * **Note**: If a custom component is used, it must [accept ref and spread all\n * props to its underlying DOM\n * element](https://ariakit.com/guide/composition#custom-components-must-be-open-for-extension),\n * the same way a native element would.\n *\n * Live examples:\n * - [Animated Dialog](https://ariakit.com/examples/dialog-animated)\n * - [Dialog with scrollable\n * backdrop](https://ariakit.com/examples/dialog-backdrop-scrollable)\n * - [Dialog with\n * Motion](https://ariakit.com/examples/dialog-framer-motion)\n * - [Dialog with Menu](https://ariakit.com/examples/dialog-menu)\n * - [Nested Dialog](https://ariakit.com/examples/dialog-nested)\n * - [Dialog with Next.js App\n * Router](https://ariakit.com/examples/dialog-next-router)\n * @example\n * ```jsx\n * <Dialog backdrop={<div className=\"backdrop\" />} />\n * ```\n */\n backdrop?:\n | boolean\n | ReactElement<ComponentPropsWithRef<\"div\">>\n | ElementType<ComponentPropsWithRef<\"div\">>;\n /**\n * Determines if the dialog will hide when the user presses the Escape key.\n *\n * This prop can be either a boolean or a function that accepts an event as an\n * argument and returns a boolean. The event object represents the keydown\n * event that initiated the hide action, which could be either a native\n * keyboard event or a React synthetic event.\n *\n * **Note**: When placing Ariakit dialogs inside third-party dialogs, using\n * `event.stopPropagation()` within this function will stop the event from\n * reaching the third-party dialog, closing only the Ariakit dialog.\n * @default true\n */\n hideOnEscape?: BooleanOrCallback<KeyboardEvent | ReactKeyboardEvent>;\n /**\n * Determines if the dialog should hide when the user clicks or focuses on an\n * element outside the dialog.\n *\n * This prop can be either a boolean or a function that takes an event as an\n * argument and returns a boolean. The event object represents the event that\n * triggered the action, which could be a native event or a React synthetic\n * event of various types.\n *\n * Live examples:\n * - [Selection Popover](https://ariakit.com/examples/popover-selection)\n * @default true\n */\n hideOnInteractOutside?: BooleanOrCallback<Event | SyntheticEvent>;\n /**\n * When a dialog is open, the elements outside of it are disabled to prevent\n * interaction if the dialog is\n * [`modal`](https://ariakit.com/reference/dialog#modal). For non-modal\n * dialogs, interacting with elements outside the dialog prompts it to close.\n *\n * This function allows you to return an iterable collection of elements that\n * will be considered as part of the dialog, thus excluding them from this\n * behavior.\n *\n * **Note**: The elements returned by this function must exist in the DOM when\n * the dialog opens.\n *\n * Live examples:\n * - [Dialog with\n * React-Toastify](https://ariakit.com/examples/dialog-react-toastify)\n */\n getPersistentElements?: () => Iterable<Element>;\n /**\n * Determines whether the body scrolling will be prevented when the dialog is\n * shown. This is automatically set to `true` when the dialog is\n * [`modal`](https://ariakit.com/reference/dialog#modal). You can disable this\n * prop if you want to implement your own logic.\n */\n preventBodyScroll?: boolean;\n /**\n * Determines whether an element inside the dialog will receive focus when the\n * dialog is shown. By default, this is usually the first tabbable element in\n * the dialog or the dialog itself. The\n * [`initialFocus`](https://ariakit.com/reference/dialog#initialfocus) prop\n * can be used to set a different element to receive focus.\n *\n * Live examples:\n * - [Warning on Dialog\n * hide](https://ariakit.com/examples/dialog-hide-warning)\n * - [Sliding Menu](https://ariakit.com/examples/menu-slide)\n * - [Selection Popover](https://ariakit.com/examples/popover-selection)\n * @default true\n */\n autoFocusOnShow?: BooleanOrCallback<HTMLElement | null>;\n /**\n * Determines whether an element outside of the dialog will be focused when\n * the dialog is hidden if another element hasn't been focused in the action\n * of hiding the dialog (for example, by clicking or tabbing into another\n * tabbable element outside of the dialog).\n *\n * By default, this is usually the disclosure element. The\n * [`finalFocus`](https://ariakit.com/reference/dialog#finalfocus) prop can be\n * used to define a different element to be focused.\n *\n * Live examples:\n * - [Dialog with Next.js App\n * Router](https://ariakit.com/examples/dialog-next-router)\n * - [Sliding menu](https://ariakit.com/examples/menu-slide)\n * @default true\n */\n autoFocusOnHide?: BooleanOrCallback<HTMLElement | null>;\n /**\n * Specifies the element that will receive focus when the dialog is first\n * opened. It can be an `HTMLElement` or a `React.RefObject` with an\n * `HTMLElement`.\n *\n * If\n * [`autoFocusOnShow`](https://ariakit.com/reference/dialog#autofocusonshow)\n * is set to `false`, this prop will have no effect. If left unset, the dialog\n * will attempt to determine the initial focus element in the following order:\n * 1. A [Focusable](https://ariakit.com/components/focusable) element with an\n * [`autoFocus`](https://ariakit.com/reference/focusable#autofocus) prop.\n * 2. The first tabbable element inside the dialog.\n * 3. The first focusable element inside the dialog.\n * 4. The dialog element itself.\n */\n initialFocus?: HTMLElement | RefObject<HTMLElement | null> | null;\n /**\n * Determines the element that will receive focus once the dialog is closed,\n * provided that no other element has been focused while the dialog was being\n * hidden (e.g., by clicking or tabbing into another tabbable element outside\n * of the dialog).\n * - If\n * [`autoFocusOnHide`](https://ariakit.com/reference/dialog#autofocusonhide)\n * is set to `false`, this prop will have no effect.\n * - If left unset, the element that was focused before the dialog was opened\n * will be focused again.\n */\n finalFocus?: HTMLElement | RefObject<HTMLElement | null> | null;\n /**\n * @private\n */\n unstable_treeSnapshotKey?: string | number | boolean | null;\n}\n\nexport type Dial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oC,eAAA,QAAA,YAAA,oBAAA,6BAAA;;YACI,oBAAA,qBAAA,UAAA;;aACM,oBAAA,yBAAA,UAAA;;IAEP,UAAA;GACN,CAAA;EACJ,CAAA;CAKjC,CAAA,GAAA,CAAA,KAAQ,CAAA;SACN;EACA,eAAM;EACN,MAAA;EACA,UAAA,YAAmB,KAAM,KAAA;EACzB,mBAAA,MAAoB,iBAAA,OAAA,KAAA,IAAA;EACpB,oBAAG;EACH,GAAA;EACA;EACF,KAAA,aAAA,KAAA,MAAA,GAAA;CAEA;SACK,sBAAA;EACH,GAAA;EACD,iBAAA;CACD,CAAA;SAA+B,qBAAA;EAAO;EAAU,GAAA;CAChD,CAAA;SAA0B,aAAA;EAAO,GAAA;EAAW;CAC5C,CAAA;SAAoB,UAAA;EAAQ;EAAU,GAAA;EAAW;EAAkB;CAEnE,CAAA;CACD,OAAA;AAED,CAAA;SAIS,sBAAoB,WAAA,qBAA0B,0BAAA;QAC7C,WAAU,SAAA,gBAAmB,OAAA;EAMnC,MAJgB,UAAA,mBADa;EAM7B,IAAA,CAAA,cAAO,MAAA,SAAC,UAAc,UAAQ,CAAA,MAAA,iBAAA,OAAA,WAAA,CAAA,CAAA,MAAA,IAAA,GAAA,OAAA;EAC/B,OAAA,oBAAA,WAAA,EAAA,GAAA,MAAA,CAAA;CACH,CAAA;;;;;;;;;;;;;;;;;;;;;;MAyBI,SAAO,sBADW,WACqB,SAAA,OAAA,OAAA;CACxC,OACD,cAAA,SACF,UAAA,KAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"dialog.js","names":[],"sources":["../../src/dialog/dialog.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport {\n useBooleanEvent,\n useEvent,\n useId,\n useMergeRefs,\n usePortalRef,\n useSafeLayoutEffect,\n useWrapElement,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { sync } from \"@ariakit/store\";\nimport {\n contains,\n getActiveElement,\n getDocument,\n getWindow,\n addGlobalEventListener,\n getFirstTabbableIn,\n isElement,\n isNode,\n isFocusable,\n chain,\n isSafari,\n} from \"@ariakit/utils\";\nimport type { BooleanOrCallback } from \"@ariakit/utils\";\nimport type {\n ComponentPropsWithRef,\n ElementType,\n FC,\n ReactElement,\n KeyboardEvent as ReactKeyboardEvent,\n RefObject,\n SyntheticEvent,\n} from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { DisclosureContentOptions } from \"../disclosure/disclosure-content.tsx\";\nimport {\n isHidden,\n useDisclosureContent,\n} from \"../disclosure/disclosure-content.tsx\";\nimport { useFocusableContainer } from \"../focusable/focusable-container.tsx\";\nimport type { FocusableOptions } from \"../focusable/focusable.tsx\";\nimport { useFocusable } from \"../focusable/focusable.tsx\";\nimport { HeadingLevel } from \"../heading/heading-level.tsx\";\nimport type { PortalOptions } from \"../portal/portal.tsx\";\nimport { usePortal } from \"../portal/portal.tsx\";\nimport { DialogBackdrop } from \"./dialog-backdrop.tsx\";\nimport {\n DialogDescriptionContext,\n DialogHeadingContext,\n DialogScopedContextProvider,\n useDialogProviderContext,\n} from \"./dialog-context.tsx\";\nimport type { DialogStore } from \"./dialog-store.ts\";\nimport { useDialogStore } from \"./dialog-store.ts\";\nimport { disableTree, disableTreeOutside } from \"./utils/disable-tree.ts\";\nimport { isElementMarked, markTreeOutside } from \"./utils/mark-tree-outside.ts\";\nimport { prependHiddenDismiss } from \"./utils/prepend-hidden-dismiss.ts\";\nimport { supportsInert } from \"./utils/supports-inert.ts\";\nimport { useHideOnInteractOutside } from \"./utils/use-hide-on-interact-outside.ts\";\nimport { useNestedDialogs } from \"./utils/use-nested-dialogs.tsx\";\nimport { usePreventBodyScroll } from \"./utils/use-prevent-body-scroll.ts\";\nimport { createWalkTreeSnapshot } from \"./utils/walk-tree-outside.ts\";\n\nconst TagName = \"div\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\nconst isSafariBrowser = isSafari();\n\nfunction isAlreadyFocusingAnotherElement(dialog?: HTMLElement | null) {\n const activeElement = getActiveElement(dialog);\n if (!activeElement) return false;\n if (dialog && contains(dialog, activeElement)) return false;\n if (isFocusable(activeElement)) return true;\n return false;\n}\n\nfunction getElementFromProp(\n prop?: HTMLElement | RefObject<HTMLElement | null> | null,\n focusable = false,\n) {\n if (!prop) return null;\n const element = \"current\" in prop ? prop.current : prop;\n if (!element) return null;\n if (focusable) return isFocusable(element) ? element : null;\n return element;\n}\n\n/**\n * Returns props to create a `Dialog` component.\n * @see https://ariakit.com/components/dialog\n * @example\n * ```jsx\n * const store = useDialogStore();\n * const props = useDialog({ store });\n * <Role {...props}>Dialog</Role>\n * ```\n */\nexport const useDialog = createHook<TagName, DialogOptions>(function useDialog({\n store: storeProp,\n open: openProp,\n onClose,\n focusable = true,\n modal = true,\n portal = modal,\n backdrop = modal,\n hideOnEscape = true,\n hideOnInteractOutside = true,\n getPersistentElements,\n preventBodyScroll = modal,\n autoFocusOnShow = true,\n autoFocusOnHide = true,\n initialFocus,\n finalFocus,\n unmountOnHide,\n unstable_treeSnapshotKey,\n ...props\n}) {\n const context = useDialogProviderContext();\n const ref = useRef<HTMLType>(null);\n\n const store = useDialogStore({\n store: storeProp || context,\n open: openProp,\n setOpen(open) {\n if (open) return;\n const dialog = ref.current;\n if (!dialog) return;\n const event = new Event(\"close\", { bubbles: false, cancelable: true });\n if (onClose) {\n dialog.addEventListener(\"close\", onClose, { once: true });\n }\n dialog.dispatchEvent(event);\n if (!event.defaultPrevented) return;\n store.setOpen(true);\n },\n });\n\n // domReady can be also the portal node element so it's updated when the\n // portal node changes (like in between re-renders), triggering effects\n // again.\n const { portalRef, domReady } = usePortalRef(portal, props.portalRef);\n // Sets preserveTabOrder to true only if the dialog is not a modal and is\n // open.\n const preserveTabOrderProp = props.preserveTabOrder;\n const preserveTabOrder = useStoreState(\n store,\n (state) => preserveTabOrderProp && !modal && state.mounted,\n );\n const id = useId(props.id);\n const open = useStoreState(store, \"open\");\n const mounted = useStoreState(store, \"mounted\");\n const contentElement = useStoreState(store, \"contentElement\");\n const hidden = isHidden(mounted, props.hidden, props.alwaysVisible);\n\n usePreventBodyScroll(contentElement, id, preventBodyScroll && !hidden);\n\n // Tracks whether the dialog was hidden by an outside click or context menu.\n // When true, focusOnHide skips focus restoration to match native HTML\n // behavior where trigger buttons don't receive focus when you click outside.\n // Reset when the dialog opens to avoid stale flags from prevented closes\n // (e.g., onClose calling event.preventDefault), async closes with\n // animations, or when autoFocusOnHide is disabled.\n const interactedOutsideRef = useRef(false);\n useSafeLayoutEffect(() => {\n return sync(store, [\"open\"], (state) => {\n if (!state.open) return;\n interactedOutsideRef.current = false;\n });\n }, [store]);\n useHideOnInteractOutside(\n store,\n hideOnInteractOutside,\n domReady,\n interactedOutsideRef,\n );\n\n const { wrapElement, nestedDialogs } = useNestedDialogs(store);\n props = useWrapElement(props, wrapElement, [wrapElement]);\n\n // On Safari, buttons don't receive focus on mousedown unless they have an\n // explicit tabIndex. Non-Ariakit buttons (which don't go through\n // useFocusable) won't have this, so activeElement may still be BODY when the\n // dialog opens. We track the last mousedown target as a fallback.\n const lastMousedownRef = useRef<Element | null>(null);\n\n if (isSafariBrowser) {\n useEffect(() => {\n if (!domReady) return;\n const dialog = ref.current;\n if (!dialog) return;\n const doc = getDocument(dialog);\n const onMousedown = (event: MouseEvent) => {\n lastMousedownRef.current = event.target as Element;\n };\n doc.addEventListener(\"mousedown\", onMousedown, true);\n return () => {\n doc.removeEventListener(\"mousedown\", onMousedown, true);\n };\n }, [domReady]);\n }\n\n // Sets disclosure element using the current active element right after the\n // dialog is opened.\n useSafeLayoutEffect(() => {\n if (!open) return;\n const dialog = ref.current;\n const activeElement = getActiveElement(dialog, true);\n if (!activeElement) return;\n if (activeElement.tagName === \"BODY\") {\n // Safari fallback: use the last mousedown target when activeElement is\n // BODY (happens with native buttons that lack an explicit tabIndex).\n const fallback = lastMousedownRef.current;\n lastMousedownRef.current = null;\n if (!fallback?.isConnected) return;\n if (!isFocusable(fallback)) return;\n if (dialog && contains(dialog, fallback)) return;\n store.setDisclosureElement(fallback as HTMLElement);\n return;\n }\n // The disclosure element can't be inside the dialog.\n if (dialog && contains(dialog, activeElement)) return;\n store.setDisclosureElement(activeElement);\n }, [store, open]);\n\n // Sets --dialog-viewport-height CSS variable to the height of the visual\n // viewport. This allows the dialog to be positioned correctly when the\n // viewport height changes (e.g., when the keyboard is shown on mobile).\n useEffect(() => {\n if (!mounted) return;\n if (!domReady) return;\n const dialog = ref.current;\n if (!dialog) return;\n const win = getWindow(dialog);\n const viewport = win.visualViewport || win;\n const setViewportHeight = () => {\n const height = win.visualViewport?.height ?? win.innerHeight;\n dialog.style.setProperty(\"--dialog-viewport-height\", `${height}px`);\n };\n setViewportHeight();\n viewport.addEventListener(\"resize\", setViewportHeight);\n return () => {\n viewport.removeEventListener(\"resize\", setViewportHeight);\n };\n }, [mounted, domReady]);\n\n // Renders a hidden dismiss button at the top of the modal dialog element. So\n // that screen reader users aren't trapped in the dialog when there's no\n // visible dismiss button.\n useEffect(() => {\n if (!modal) return;\n if (!mounted) return;\n if (!domReady) return;\n const dialog = ref.current;\n if (!dialog) return;\n // If there's already a DialogDismiss component, it does nothing.\n const existingDismiss = dialog.querySelector(\"[data-dialog-dismiss]\");\n if (existingDismiss) return;\n return prependHiddenDismiss(dialog, store.hide);\n }, [store, modal, mounted, domReady]);\n\n // When the dialog is animated, the open state will be false and the mounted\n // state will be true. The dialog will still be visible until the animation is\n // complete. We need to disable the dialog tree completely in this case. TODO:\n // We should probably do this in a more generic way in the DisclosureContent\n // component.\n useSafeLayoutEffect(() => {\n if (!supportsInert()) return;\n if (open) return;\n if (!mounted) return;\n if (!domReady) return;\n const dialog = ref.current;\n if (!dialog) return;\n return disableTree(dialog);\n }, [open, mounted, domReady]);\n\n const canTakeTreeSnapshot = open && domReady;\n\n useSafeLayoutEffect(() => {\n if (!id) return;\n if (!canTakeTreeSnapshot) return;\n const dialog = ref.current;\n // When the dialog opens, we capture a snapshot of the document. This\n // snapshot is then used to disable elements outside the dialog in the\n // subsequent effect. However, the issue arises as this next effect also\n // relies on nested dialogs. Meaning, each time a nested dialog is rendered,\n // we capture a new document snapshot, which might disable third-party\n // dialogs. Hence, we take the snapshot here, independent of any nested\n // dialogs.\n return createWalkTreeSnapshot(id, [dialog]);\n }, [id, canTakeTreeSnapshot, unstable_treeSnapshotKey]);\n\n const getPersistentElementsProp = useEvent(getPersistentElements);\n\n // Disables/enables the element tree around the modal dialog element.\n useSafeLayoutEffect(() => {\n if (!id) return;\n if (!canTakeTreeSnapshot) return;\n const { disclosureElement } = store.getState();\n const dialog = ref.current;\n const persistentElements = getPersistentElementsProp() || [];\n const allElements = [\n dialog,\n ...persistentElements,\n ...nestedDialogs.map((dialog) => dialog.getState().contentElement),\n ];\n if (modal) {\n return chain(\n markTreeOutside(id, allElements),\n disableTreeOutside(id, allElements),\n );\n }\n return markTreeOutside(id, [disclosureElement, ...allElements]);\n }, [\n id,\n store,\n canTakeTreeSnapshot,\n getPersistentElementsProp,\n nestedDialogs,\n modal,\n unstable_treeSnapshotKey,\n ]);\n\n const mayAutoFocusOnShow = !!autoFocusOnShow;\n const autoFocusOnShowProp = useBooleanEvent(autoFocusOnShow);\n // We have to wait for the dialog to be mounted before allowing focusable\n // elements to be auto focused. Otherwise, there could be unintended scroll\n // jumps. See select-animated browser tests.\n const [autoFocusEnabled, setAutoFocusEnabled] = useState(false);\n\n // Auto focus on show.\n useEffect(() => {\n if (!open) return;\n if (!mayAutoFocusOnShow) return;\n // Makes sure to wait for the portalNode to be created before moving focus.\n // This is useful for when the Dialog component is unmounted when hidden.\n if (!domReady) return;\n // The dialog element may change for different reasons. For example, when\n // the modal or portal props change, the HTML structure will also change,\n // which will affect the dialog element reference. That's why we're\n // listening to contentElement state here instead of getting the ref.current\n // value. This ensures this effect will re-run when the dialog element\n // reference changes.\n if (!contentElement?.isConnected) return;\n const element =\n getElementFromProp(initialFocus, true) ||\n // If no initial focus is specified, we try to focus the first element\n // with the autofocus attribute. If it's an Ariakit component, the\n // Focusable component will consume the autoFocus prop and add the\n // data-autofocus attribute to the element instead.\n contentElement.querySelector<HTMLElement>(\n \"[data-autofocus=true],[autofocus]\",\n ) ||\n // We have to fallback to the first focusable element otherwise portaled\n // dialogs with preserveTabOrder set to true will not receive focus\n // properly because the elements aren't tabbable until the dialog receives\n // focus.\n getFirstTabbableIn(contentElement, true, portal && preserveTabOrder) ||\n // Finally, we fallback to the dialog element itself.\n contentElement;\n const isElementFocusable = isFocusable(element);\n if (!autoFocusOnShowProp(isElementFocusable ? element : null)) return;\n setAutoFocusEnabled(true);\n queueMicrotask(() => {\n // If the dialog was closed between scheduling and executing this\n // microtask, skip the focus call. Otherwise, focusing a now-hidden\n // element could steal focus from the disclosure that focusOnHide already\n // restored.\n if (!store.getState().open) return;\n element.focus();\n // Safari doesn't scroll to the element on focus, so we have to do it\n // manually here.\n if (!isSafariBrowser) return;\n if (!isElementFocusable) return;\n element.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n });\n }, [\n open,\n mayAutoFocusOnShow,\n domReady,\n contentElement,\n initialFocus,\n portal,\n preserveTabOrder,\n store,\n autoFocusOnShowProp,\n ]);\n\n const mayAutoFocusOnHide = !!autoFocusOnHide;\n const autoFocusOnHideProp = useBooleanEvent(autoFocusOnHide);\n\n // Sets a `hasOpened` flag on an effect so we only auto focus on hide if the\n // dialog was open before.\n const [hasOpened, setHasOpened] = useState(false);\n\n useSafeLayoutEffect(() => {\n if (!open) return;\n setHasOpened(true);\n return () => setHasOpened(false);\n }, [open]);\n\n const focusOnHide = useCallback(\n (dialog: HTMLElement | null, retry = true) => {\n // Hide was triggered by clicking or right-clicking outside the dialog.\n // Native HTML dialogs and popovers don't restore focus to the trigger\n // in this case, so we skip focus restoration entirely.\n if (interactedOutsideRef.current) return;\n const { disclosureElement } = store.getState();\n // Hide was triggered by a click/focus on a tabbable element outside the\n // dialog. We won't change focus then.\n if (isAlreadyFocusingAnotherElement(dialog)) return;\n let element = getElementFromProp(finalFocus) || disclosureElement;\n if (element?.id) {\n const doc = getDocument(element);\n const selector = `[aria-activedescendant=\"${element.id}\"]`;\n const composite = doc.querySelector<HTMLElement>(selector);\n // If the element is an item in a composite widget that handles focus\n // with the `aria-activedescendant` attribute, we want to focus on the\n // composite element itself.\n if (composite) {\n element = composite;\n }\n }\n // If the element is not focusable by the time the dialog is hidden, it's\n // probably because it's an element inside another popover or menu that\n // also got hidden when this dialog was shown. We'll try to focus on their\n // disclosure element instead.\n if (element && !isFocusable(element)) {\n const maybeParentDialog = element.closest(\"[data-dialog]\");\n if (maybeParentDialog?.id) {\n const doc = getDocument(maybeParentDialog);\n const selector = `[aria-controls~=\"${maybeParentDialog.id}\"]`;\n const control = doc.querySelector<HTMLElement>(selector);\n if (control) {\n element = control;\n }\n }\n }\n const isElementFocusable = element && isFocusable(element);\n if (!isElementFocusable && retry) {\n // If the element is still not focusable by this time, we retry once\n // again on the next frame. This is sometimes necessary because there\n // may be nested dialogs that still need a tick to remove the inert\n // attribute from elements outside.\n requestAnimationFrame(() => focusOnHide(dialog, false));\n return;\n }\n if (!autoFocusOnHideProp(isElementFocusable ? element : null)) return;\n if (!isElementFocusable) return;\n element?.focus();\n },\n [store, finalFocus, autoFocusOnHideProp],\n );\n\n const focusedOnHideRef = useRef(false);\n\n // Auto focus on hide with an always rendered dialog.\n useSafeLayoutEffect(() => {\n if (open) return;\n if (!hasOpened) return;\n if (!mayAutoFocusOnHide) return;\n const dialog = ref.current;\n // We don't want to focus on hide twice if the dialog is not unmounted, so\n // we set this flag here that will be checked in the cleanup effect below.\n focusedOnHideRef.current = true;\n focusOnHide(dialog);\n }, [open, hasOpened, domReady, mayAutoFocusOnHide, focusOnHide]);\n\n // Auto focus on hide with a dialog that gets unmounted when hidden.\n useEffect(() => {\n if (!hasOpened) return;\n if (!mayAutoFocusOnHide) return;\n const dialog = ref.current;\n return () => {\n if (focusedOnHideRef.current) {\n focusedOnHideRef.current = false;\n return;\n }\n focusOnHide(dialog);\n };\n }, [hasOpened, mayAutoFocusOnHide, focusOnHide]);\n\n const hideOnEscapeProp = useBooleanEvent(hideOnEscape);\n\n // Hide on Escape.\n useEffect(() => {\n if (!domReady) return;\n if (!mounted) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\") return;\n if (event.defaultPrevented) return;\n const dialog = ref.current;\n if (!dialog) return;\n // Ignore the event if the current dialog is marked by another dialog.\n // This guarantees that only the topmost dialog will close on Escape.\n if (isElementMarked(dialog)) return;\n const target = event.target;\n // Guard against non-node targets (e.g. a synthetic event dispatched on\n // window) so `contains` doesn't throw. `isNode` rather than `isElement`\n // keeps non-element nodes working with `contains`, as before.\n if (!isNode(target)) return;\n const { disclosureElement } = store.getState();\n // This considers valid targets only the disclosure element or descendants\n // of the dialog element.\n const isValidTarget = () => {\n if (isElement(target) && target.tagName === \"BODY\") return true;\n if (contains(dialog, target)) return true;\n if (!disclosureElement) return true;\n if (contains(disclosureElement, target)) return true;\n return false;\n };\n if (!isValidTarget()) return;\n if (!hideOnEscapeProp(event)) return;\n store.hide();\n };\n // We're attatching the listener to the document instead of the dialog\n // element so we can listen to the Escape key anywhere in the document, even\n // when the dialog is not focused. By using the capture phase, users can\n // call `event.stopPropagation()` on the `hideOnEscape` function prop.\n const win = contentElement ? getWindow(contentElement) : undefined;\n return addGlobalEventListener(\"keydown\", onKeyDown, true, win);\n }, [store, domReady, mounted, contentElement, hideOnEscapeProp]);\n\n // Resets the heading levels inside the modal dialog so they start with h1.\n props = useWrapElement(\n props,\n (element) => (\n <HeadingLevel level={modal ? 1 : undefined}>{element}</HeadingLevel>\n ),\n [modal],\n );\n\n const hiddenProp = props.hidden;\n const alwaysVisible = props.alwaysVisible;\n\n // Wraps the dialog with a backdrop element if the backdrop prop is truthy.\n props = useWrapElement(\n props,\n (element) => {\n if (!backdrop) return element;\n return (\n <>\n <DialogBackdrop\n store={store}\n backdrop={backdrop}\n hidden={hiddenProp}\n alwaysVisible={alwaysVisible}\n />\n {element}\n </>\n );\n },\n [store, backdrop, hiddenProp, alwaysVisible],\n );\n\n const [headingId, setHeadingId] = useState<string>();\n const [descriptionId, setDescriptionId] = useState<string>();\n\n props = useWrapElement(\n props,\n (element) => (\n <DialogScopedContextProvider value={store}>\n <DialogHeadingContext.Provider value={setHeadingId}>\n <DialogDescriptionContext.Provider value={setDescriptionId}>\n {element}\n </DialogDescriptionContext.Provider>\n </DialogHeadingContext.Provider>\n </DialogScopedContextProvider>\n ),\n [store],\n );\n\n props = {\n \"data-dialog\": \"\",\n role: \"dialog\",\n tabIndex: focusable ? -1 : undefined,\n \"aria-labelledby\": props[\"aria-label\"] != null ? undefined : headingId,\n \"aria-describedby\": descriptionId,\n ...props,\n id,\n ref: useMergeRefs(ref, props.ref),\n };\n\n props = useFocusableContainer({\n ...props,\n autoFocusOnShow: autoFocusEnabled,\n });\n props = useDisclosureContent({ store, ...props });\n props = useFocusable({ ...props, focusable });\n props = usePortal({ portal, ...props, portalRef, preserveTabOrder });\n\n return props;\n});\n\nexport function createDialogComponent<T extends DialogOptions>(\n Component: FC<T>,\n useProviderContext = useDialogProviderContext,\n) {\n return forwardRef(function DialogComponent(props: T) {\n const context = useProviderContext();\n const store = props.store || context;\n const mounted = useStoreState(\n store,\n (state) => !props.unmountOnHide || state?.mounted || !!props.open,\n );\n if (!mounted) return null;\n return <Component {...props} />;\n });\n}\n\nconst DialogImpl = forwardRef(function DialogImpl(props: DialogProps) {\n const htmlProps = useDialog(props);\n return createElement(TagName, htmlProps);\n});\n\nconst DialogWithStore = createDialogComponent(\n DialogImpl,\n useDialogProviderContext,\n);\n\nconst DialogWithInternalStore = forwardRef(function DialogWithInternalStore(\n props: DialogProps,\n) {\n const store = useDialogStore({ open: props.open });\n return <DialogWithStore {...props} store={store} />;\n});\n\n/**\n * Renders a dialog similar to the native `dialog` element that's rendered in a\n * [`portal`](https://ariakit.com/reference/dialog#portal) by default.\n *\n * The dialog can be either\n * [`modal`](https://ariakit.com/reference/dialog#modal) or non-modal. The\n * visibility state can be controlled with the\n * [`open`](https://ariakit.com/reference/dialog#open) and\n * [`onClose`](https://ariakit.com/reference/dialog#onclose) props.\n * @see https://ariakit.com/components/dialog\n * @example\n * ```jsx {4-6}\n * const [open, setOpen] = useState(false);\n *\n * <button onClick={() => setOpen(true)}>Open dialog</button>\n * <Dialog open={open} onClose={() => setOpen(false)}>\n * Dialog\n * </Dialog>\n * ```\n */\nexport const Dialog = forwardRef(function Dialog(props: DialogProps) {\n const context = useDialogProviderContext();\n // The hoisted store is only needed for the unmountOnHide mounted-state gate.\n if (props.store || context || !props.unmountOnHide) {\n return <DialogWithStore {...props} />;\n }\n return <DialogWithInternalStore {...props} />;\n});\n\nexport interface DialogOptions<T extends ElementType = TagName>\n extends FocusableOptions<T>, PortalOptions<T>, DisclosureContentOptions<T> {\n /**\n * Object returned by the\n * [`useDialogStore`](https://ariakit.com/reference/use-dialog-store) hook. If\n * not provided, the closest\n * [`DialogProvider`](https://ariakit.com/reference/dialog-provider)\n * component's context will be used. Otherwise, an internal store will be\n * created.\n */\n store?: DialogStore;\n /**\n * Controls the open state of the dialog. This is similar to the\n * [`open`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/open)\n * attribute on native dialog elements.\n *\n * Live examples:\n * - [Dialog with scrollable\n * backdrop](https://ariakit.com/examples/dialog-backdrop-scrollable)\n * - [Dialog with details &\n * summary](https://ariakit.com/examples/dialog-details)\n * - [Warning on Dialog\n * hide](https://ariakit.com/examples/dialog-hide-warning)\n * - [Dialog with Menu](https://ariakit.com/examples/dialog-menu)\n */\n open?: boolean;\n /**\n * This is an event handler prop triggered when the dialog's `close` event is\n * dispatched. The `close` event is similar to the native dialog\n * [`close`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/close_event)\n * event. The only difference is that this event can be canceled with\n * `event.preventDefault()`, which will prevent the dialog from hiding.\n *\n * It's important to note that this event only fires when the dialog store's\n * [`open`](https://ariakit.com/reference/use-dialog-store#open) state is set\n * to `false`. If the controlled\n * [`open`](https://ariakit.com/reference/dialog#open) prop value changes, or\n * if the dialog's visibility is altered in any other way (such as unmounting\n * the dialog without adjusting the open state), this event won't be\n * triggered.\n *\n * Live examples:\n * - [Dialog with scrollable\n * backdrop](https://ariakit.com/examples/dialog-backdrop-scrollable)\n * - [Dialog with details &\n * summary](https://ariakit.com/examples/dialog-details)\n * - [Warning on Dialog\n * hide](https://ariakit.com/examples/dialog-hide-warning)\n * - [Dialog with Menu](https://ariakit.com/examples/dialog-menu)\n */\n onClose?: (event: Event) => void;\n /**\n * Determines whether the dialog is modal. Modal dialogs have distinct states\n * and behaviors:\n * - The [`portal`](https://ariakit.com/reference/dialog#portal) and\n * [`preventBodyScroll`](https://ariakit.com/reference/dialog#preventbodyscroll)\n * props are set to `true`. They can still be manually set to `false`.\n * - When using the [`Heading`](https://ariakit.com/reference/heading) or\n * [`DialogHeading`](https://ariakit.com/reference/dialog-heading)\n * components within the dialog, their level will be reset so they start\n * with `h1`.\n * - A visually hidden dismiss button will be rendered if the\n * [`DialogDismiss`](https://ariakit.com/reference/dialog-dismiss) component\n * hasn't been used. This allows screen reader users to close the dialog.\n * - When the dialog is open, element tree outside it will be inert.\n *\n * Live examples:\n * - [Combobox with Tabs](https://ariakit.com/examples/combobox-tabs)\n * - [Dialog with details &\n * summary](https://ariakit.com/examples/dialog-details)\n * - [Form with Select](https://ariakit.com/examples/form-select)\n * - [Context menu](https://ariakit.com/examples/menu-context-menu)\n * - [Responsive Popover](https://ariakit.com/examples/popover-responsive)\n * @default true\n */\n modal?: boolean;\n /**\n * Determines whether there will be a backdrop behind the dialog. On modal\n * dialogs, this is `true` by default. Besides a `boolean`, this prop can also\n * be a React component or JSX element that will be rendered as the backdrop.\n *\n * **Note**: If a custom component is used, it must [accept ref and spread all\n * props to its underlying DOM\n * element](https://ariakit.com/guide/composition#custom-components-must-be-open-for-extension),\n * the same way a native element would.\n *\n * Live examples:\n * - [Animated Dialog](https://ariakit.com/examples/dialog-animated)\n * - [Dialog with scrollable\n * backdrop](https://ariakit.com/examples/dialog-backdrop-scrollable)\n * - [Dialog with\n * Motion](https://ariakit.com/examples/dialog-framer-motion)\n * - [Dialog with Menu](https://ariakit.com/examples/dialog-menu)\n * - [Nested Dialog](https://ariakit.com/examples/dialog-nested)\n * - [Dialog with Next.js App\n * Router](https://ariakit.com/examples/dialog-next-router)\n * @example\n * ```jsx\n * <Dialog backdrop={<div className=\"backdrop\" />} />\n * ```\n */\n backdrop?:\n | boolean\n | ReactElement<ComponentPropsWithRef<\"div\">>\n | ElementType<ComponentPropsWithRef<\"div\">>;\n /**\n * Determines if the dialog will hide when the user presses the Escape key.\n *\n * This prop can be either a boolean or a function that accepts an event as an\n * argument and returns a boolean. The event object represents the keydown\n * event that initiated the hide action, which could be either a native\n * keyboard event or a React synthetic event.\n *\n * **Note**: When placing Ariakit dialogs inside third-party dialogs, using\n * `event.stopPropagation()` within this function will stop the event from\n * reaching the third-party dialog, closing only the Ariakit dialog.\n * @default true\n */\n hideOnEscape?: BooleanOrCallback<KeyboardEvent | ReactKeyboardEvent>;\n /**\n * Determines if the dialog should hide when the user clicks or focuses on an\n * element outside the dialog.\n *\n * This prop can be either a boolean or a function that takes an event as an\n * argument and returns a boolean. The event object represents the event that\n * triggered the action, which could be a native event or a React synthetic\n * event of various types.\n *\n * Live examples:\n * - [Selection Popover](https://ariakit.com/examples/popover-selection)\n * @default true\n */\n hideOnInteractOutside?: BooleanOrCallback<Event | SyntheticEvent>;\n /**\n * When a dialog is open, the elements outside of it are disabled to prevent\n * interaction if the dialog is\n * [`modal`](https://ariakit.com/reference/dialog#modal). For non-modal\n * dialogs, interacting with elements outside the dialog prompts it to close.\n *\n * This function allows you to return an iterable collection of elements that\n * will be considered as part of the dialog, thus excluding them from this\n * behavior.\n *\n * **Note**: The elements returned by this function must exist in the DOM when\n * the dialog opens.\n *\n * Live examples:\n * - [Dialog with\n * React-Toastify](https://ariakit.com/examples/dialog-react-toastify)\n */\n getPersistentElements?: () => Iterable<Element>;\n /**\n * Determines whether the body scrolling will be prevented when the dialog is\n * shown. This is automatically set to `true` when the dialog is\n * [`modal`](https://ariakit.com/reference/dialog#modal). You can disable this\n * prop if you want to implement your own logic.\n */\n preventBodyScroll?: boolean;\n /**\n * Determines whether an element inside the dialog will receive focus when the\n * dialog is shown. By default, this is usually the first tabbable element in\n * the dialog or the dialog itself. The\n * [`initialFocus`](https://ariakit.com/reference/dialog#initialfocus) prop\n * can be used to set a different element to receive focus.\n *\n * Live examples:\n * - [Warning on Dialog\n * hide](https://ariakit.com/examples/dialog-hide-warning)\n * - [Sliding Menu](https://ariakit.com/examples/menu-slide)\n * - [Selection Popover](https://ariakit.com/examples/popover-selection)\n * @default true\n */\n autoFocusOnShow?: BooleanOrCallback<HTMLElement | null>;\n /**\n * Determines whether an element outside of the dialog will be focused when\n * the dialog is hidden if another element hasn't been focused in the action\n * of hiding the dialog (for example, by clicking or tabbing into another\n * tabbable element outside of the dialog).\n *\n * By default, this is usually the disclosure element. The\n * [`finalFocus`](https://ariakit.com/reference/dialog#finalfocus) prop can be\n * used to define a different element to be focused.\n *\n * Live examples:\n * - [Dialog with Next.js App\n * Router](https://ariakit.com/examples/dialog-next-router)\n * - [Sliding menu](https://ariakit.com/examples/menu-slide)\n * @default true\n */\n autoFocusOnHide?: BooleanOrCallback<HTMLElement | null>;\n /**\n * Specifies the element that will receive focus when the dialog is first\n * opened. It can be an `HTMLElement` or a `React.RefObject` with an\n * `HTMLElement`.\n *\n * If\n * [`autoFocusOnShow`](https://ariakit.com/reference/dialog#autofocusonshow)\n * is set to `false`, this prop will have no effect. If left unset, the dialog\n * will attempt to determine the initial focus element in the following order:\n * 1. A [Focusable](https://ariakit.com/components/focusable) element with an\n * [`autoFocus`](https://ariakit.com/reference/focusable#autofocus) prop.\n * 2. The first tabbable element inside the dialog.\n * 3. The first focusable element inside the dialog.\n * 4. The dialog element itself.\n */\n initialFocus?: HTMLElement | RefObject<HTMLElement | null> | null;\n /**\n * Determines the element that will receive focus once the dialog is closed,\n * provided that no other element has been focused while the dialog was being\n * hidden (e.g., by clicking or tabbing into another tabbable element outside\n * of the dialog).\n * - If\n * [`autoFocusOnHide`](https://ariakit.com/reference/dialog#autofocusonhide)\n * is set to `false`, this prop will have no effect.\n * - If left unset, the element that was focused before the dialog was opened\n * will be focused again.\n */\n finalFocus?: HTMLElement | RefObject<HTMLElement | null> | null;\n /**\n * @private\n */\n unstable_treeSnapshotKey?: string | number | boolean | null;\n}\n\nexport type DialogProps<T extends ElementType = TagName> = Props<\n T,\n DialogOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwEA,MAAM,UAAA;AAEN,MAAA,kBAAS,SAAA;SACD,gCAAiC,QAAM;CAC7C,MAAK,gBAAe,iBAAO,MAAA;CAC3B,IAAI,CAAA,eAAU,OAAS;CACvB,IAAI,UAAA,SAAY,QAAa,aAAU,GAAA,OAAA;CACvC,IAAA,YAAO,aAAA,GAAA,OAAA;CACT,OAAA;AAEA;SAIO,mBAAa,MAAA,YAAA,OAAA;CAClB,IAAA,CAAA,MAAM,OAAU;CAChB,MAAK,UAAS,aAAO,OAAA,KAAA,UAAA;CACrB,IAAI,CAAA,SAAA,OAAW;CACf,IAAA,WAAO,OAAA,YAAA,OAAA,IAAA,UAAA;CACT,OAAA;;;;;;;;;;;;MAgCE,YAAgB,WAAA,SAAA,UAAyB,EAAA,OAAA,WAAA,MAAA,UAAA,SAAA,YAAA,MAAA,QAAA,MAAA,SAAA,OAAA,WAAA,OAAA,eAAA,MAAA,wBAAA,MAAA,uBAAA,oBAAA,OAAA,kBAAA,MAAA,kBAAA,MAAA,cAAA,YAAA,eAAA,0BAAA,GAAA,SAAA;CACzC,MAAM,UAAM,yBAAqB;CAEjC,MAAM,MAAA,OAAQ,IAAA;OACZ,QAAO,eAAa;EACpB,OAAM,aAAA;EACN,MAAA;UACM,MAAM;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AHE,kBAAqB,sBAAiB,WAAC,SAAA,WAAA,OAAA;CAI9B,OACT,cAAA,SACF,UAAA,KAAA,CAAA;AAEA,CAAA,GAAA,wBAAM;MAGJ,0BAA+B,WAAM,SAAY,wBAAA,OAAA;CACjD,MAAA,QAAO,eAAC,EAAA,MAAA,MAAA,KAAD,CAAA;QAAqB,oBAAA,iBAAA;EAAc,GAAA;EAAQ;CACnD,CAAA;;;;;;;;;;;;;;;;;;;;;;MAuBC,SAAM,WAAU,SAAA,OAAyB,OAAA;CAEzC,MAAI,UAAM,yBAA2B;CAGrC,IAAA,MAAO,SAAA,WAAC,CAAA,MAAA,eAAD,OAAqC,oBAAA,iBAAA,EAAA,GAAA,MAAA,CAAA;CAC7C,OAAA,oBAAA,yBAAA,EAAA,GAAA,MAAA,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
//#region src/dialog/utils/disable-accessibility-tree-outside.d.ts
|
|
2
|
-
type Elements = Array<Element | null>;
|
|
3
2
|
declare function hideElementFromAccessibilityTree(element: Element): () => void;
|
|
4
|
-
declare function disableAccessibilityTreeOutside(id: string, elements: Elements): () => void;
|
|
5
3
|
//#endregion
|
|
6
|
-
export {
|
|
4
|
+
export { hideElementFromAccessibilityTree };
|
|
7
5
|
//# sourceMappingURL=disable-accessibility-tree-outside.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disable-accessibility-tree-outside.d.ts","names":["
|
|
1
|
+
{"version":3,"file":"disable-accessibility-tree-outside.d.ts","names":["hideElementFromAccessibilityTree","Element","element"],"sources":["../../../src/dialog/utils/disable-accessibility-tree-outside.d.ts"],"mappings":";iBAAwBA,gCAAAA,CAAiCE,OAAgB,EAAPD,OAAO"}
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { isBackdrop } from "./is-backdrop.js";
|
|
3
2
|
import { setAttribute } from "./orchestrate.js";
|
|
4
|
-
import { walkTreeOutside } from "./walk-tree-outside.js";
|
|
5
3
|
//#region src/dialog/utils/disable-accessibility-tree-outside.ts
|
|
6
4
|
function hideElementFromAccessibilityTree(element) {
|
|
7
5
|
return setAttribute(element, "aria-hidden", "true");
|
|
8
6
|
}
|
|
9
|
-
function disableAccessibilityTreeOutside(id, elements) {
|
|
10
|
-
const cleanups = [];
|
|
11
|
-
const ids = elements.map((el) => el?.id);
|
|
12
|
-
walkTreeOutside(id, elements, (element) => {
|
|
13
|
-
if (isBackdrop(element, ...ids)) return;
|
|
14
|
-
cleanups.unshift(hideElementFromAccessibilityTree(element));
|
|
15
|
-
});
|
|
16
|
-
const restoreAccessibilityTree = () => {
|
|
17
|
-
for (const cleanup of cleanups) cleanup();
|
|
18
|
-
};
|
|
19
|
-
return restoreAccessibilityTree;
|
|
20
|
-
}
|
|
21
7
|
//#endregion
|
|
22
|
-
export {
|
|
8
|
+
export { hideElementFromAccessibilityTree };
|
|
23
9
|
|
|
24
10
|
//# sourceMappingURL=disable-accessibility-tree-outside.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disable-accessibility-tree-outside.js","names":[],"sources":["../../../src/dialog/utils/disable-accessibility-tree-outside.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"disable-accessibility-tree-outside.js","names":[],"sources":["../../../src/dialog/utils/disable-accessibility-tree-outside.ts"],"sourcesContent":["import { setAttribute } from \"./orchestrate.ts\";\n\nexport function hideElementFromAccessibilityTree(element: Element) {\n return setAttribute(element, \"aria-hidden\", \"true\");\n}\n"],"mappings":";;;SAGS,iCAAsB,SAAqB;CACpD,OAAA,aAAA,SAAA,eAAA,MAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as DialogStore } from "../../dialog-store-Cjt12T_Y.js";
|
|
2
|
-
import { n as DialogOptions } from "../../dialog-
|
|
2
|
+
import { n as DialogOptions } from "../../dialog-D23r2ZWj.js";
|
|
3
3
|
import { MutableRefObject } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/dialog/utils/use-hide-on-interact-outside.d.ts
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { isElementMarked } from "./mark-tree-outside.js";
|
|
3
3
|
import { usePreviousMouseDownRef } from "./use-previous-mouse-down-ref.js";
|
|
4
4
|
import { useEvent, useSafeLayoutEffect } from "@ariakit/react-utils";
|
|
5
|
-
import { addGlobalEventListener, contains, getDocument, getWindow } from "@ariakit/utils";
|
|
5
|
+
import { addGlobalEventListener, contains, getDocument, getWindow, isElement } from "@ariakit/utils";
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
7
7
|
import { useStoreState } from "@ariakit/react-store";
|
|
8
8
|
//#region src/dialog/utils/use-hide-on-interact-outside.ts
|
|
@@ -51,7 +51,7 @@ function useEventOutside({ store, type, listener, capture, domReady }) {
|
|
|
51
51
|
const { contentElement, disclosureElement } = store.getState();
|
|
52
52
|
const target = event.target;
|
|
53
53
|
if (!contentElement) return;
|
|
54
|
-
if (!target) return;
|
|
54
|
+
if (!isElement(target)) return;
|
|
55
55
|
if (!isInDocument(target)) return;
|
|
56
56
|
if (contains(contentElement, target)) return;
|
|
57
57
|
if (isDisclosure(disclosureElement, target)) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-hide-on-interact-outside.js","names":[],"sources":["../../../src/dialog/utils/use-hide-on-interact-outside.ts"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { useEvent, useSafeLayoutEffect } from \"@ariakit/react-utils\";\nimport {\n contains,\n getDocument,\n getWindow,\n addGlobalEventListener,\n} from \"@ariakit/utils\";\nimport type { MutableRefObject } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport type { DialogStore } from \"../dialog-store.ts\";\nimport type { DialogOptions } from \"../dialog.tsx\";\nimport { isElementMarked } from \"./mark-tree-outside.ts\";\nimport { usePreviousMouseDownRef } from \"./use-previous-mouse-down-ref.ts\";\n\ninterface EventOutsideOptions {\n store: DialogStore;\n type: string;\n listener: (event: Event) => void;\n capture?: boolean;\n domReady?: boolean | HTMLElement | null;\n}\n\nfunction isInDocument(target: Element) {\n if (target.tagName === \"HTML\") return true;\n return contains(getDocument(target).body, target);\n}\n\nfunction isDisclosure(disclosure: Element | null, target: Element) {\n if (!disclosure) return false;\n if (contains(disclosure, target)) return true;\n const activeId = target.getAttribute(\"aria-activedescendant\");\n if (activeId) {\n const activeElement = getDocument(disclosure).getElementById(activeId);\n if (activeElement) {\n return contains(disclosure, activeElement);\n }\n }\n return false;\n}\n\nfunction isMouseEventOnDialog(event: Event | MouseEvent, dialog: Element) {\n if (!(\"clientY\" in event)) return false;\n const rect = dialog.getBoundingClientRect();\n if (rect.width === 0 || rect.height === 0) return false;\n return (\n rect.top <= event.clientY &&\n event.clientY <= rect.top + rect.height &&\n rect.left <= event.clientX &&\n event.clientX <= rect.left + rect.width\n );\n}\n\nfunction useEventOutside({\n store,\n type,\n listener,\n capture,\n domReady,\n}: EventOutsideOptions) {\n const callListener = useEvent(listener);\n const open = useStoreState(store, \"open\");\n const contentElement = useStoreState(store, \"contentElement\");\n const focusedRef = useRef(false);\n\n useSafeLayoutEffect(() => {\n if (!open) return;\n if (!domReady) return;\n if (!contentElement) return;\n const onFocus = () => {\n focusedRef.current = true;\n };\n contentElement.addEventListener(\"focusin\", onFocus, true);\n return () => contentElement.removeEventListener(\"focusin\", onFocus, true);\n }, [open, domReady, contentElement]);\n\n useEffect(() => {\n if (!open) return;\n const onEvent = (event: Event) => {\n const { contentElement, disclosureElement } = store.getState();\n const target = event.target
|
|
1
|
+
{"version":3,"file":"use-hide-on-interact-outside.js","names":[],"sources":["../../../src/dialog/utils/use-hide-on-interact-outside.ts"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { useEvent, useSafeLayoutEffect } from \"@ariakit/react-utils\";\nimport {\n contains,\n getDocument,\n getWindow,\n addGlobalEventListener,\n isElement,\n} from \"@ariakit/utils\";\nimport type { MutableRefObject } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport type { DialogStore } from \"../dialog-store.ts\";\nimport type { DialogOptions } from \"../dialog.tsx\";\nimport { isElementMarked } from \"./mark-tree-outside.ts\";\nimport { usePreviousMouseDownRef } from \"./use-previous-mouse-down-ref.ts\";\n\ninterface EventOutsideOptions {\n store: DialogStore;\n type: string;\n listener: (event: Event) => void;\n capture?: boolean;\n domReady?: boolean | HTMLElement | null;\n}\n\nfunction isInDocument(target: Element) {\n if (target.tagName === \"HTML\") return true;\n return contains(getDocument(target).body, target);\n}\n\nfunction isDisclosure(disclosure: Element | null, target: Element) {\n if (!disclosure) return false;\n if (contains(disclosure, target)) return true;\n const activeId = target.getAttribute(\"aria-activedescendant\");\n if (activeId) {\n const activeElement = getDocument(disclosure).getElementById(activeId);\n if (activeElement) {\n return contains(disclosure, activeElement);\n }\n }\n return false;\n}\n\nfunction isMouseEventOnDialog(event: Event | MouseEvent, dialog: Element) {\n if (!(\"clientY\" in event)) return false;\n const rect = dialog.getBoundingClientRect();\n if (rect.width === 0 || rect.height === 0) return false;\n return (\n rect.top <= event.clientY &&\n event.clientY <= rect.top + rect.height &&\n rect.left <= event.clientX &&\n event.clientX <= rect.left + rect.width\n );\n}\n\nfunction useEventOutside({\n store,\n type,\n listener,\n capture,\n domReady,\n}: EventOutsideOptions) {\n const callListener = useEvent(listener);\n const open = useStoreState(store, \"open\");\n const contentElement = useStoreState(store, \"contentElement\");\n const focusedRef = useRef(false);\n\n useSafeLayoutEffect(() => {\n if (!open) return;\n if (!domReady) return;\n if (!contentElement) return;\n const onFocus = () => {\n focusedRef.current = true;\n };\n contentElement.addEventListener(\"focusin\", onFocus, true);\n return () => contentElement.removeEventListener(\"focusin\", onFocus, true);\n }, [open, domReady, contentElement]);\n\n useEffect(() => {\n if (!open) return;\n const onEvent = (event: Event) => {\n const { contentElement, disclosureElement } = store.getState();\n const target = event.target;\n if (!contentElement) return;\n if (!isElement(target)) return;\n // When an element is unmounted right after it receives focus, the focus\n // event is triggered after that, when the element isn't part of the\n // current document anymore. We just ignore it.\n if (!isInDocument(target)) return;\n // Event inside dialog\n if (contains(contentElement, target)) return;\n // Event on disclosure\n if (isDisclosure(disclosureElement, target)) return;\n // Event on focus trap\n if (target.hasAttribute(\"data-focus-trap\")) return;\n // Clicked on dialog's bounding box\n if (isMouseEventOnDialog(event, contentElement)) return;\n // We need to check if the content element has been focused at least once\n // before checking if it's marked. This is so hovercards and tooltips\n // don't stay open when new nodes are added to the DOM and focused.\n const focused = focusedRef.current;\n if (focused && !isElementMarked(target, contentElement.id)) return;\n // Finally, if the target has been marked as \"outside\" or is an ancestor\n // of the content element, we call the listener.\n callListener(event);\n };\n const win = contentElement ? getWindow(contentElement) : undefined;\n return addGlobalEventListener(type, onEvent, capture, win);\n }, [open, capture, store, type, callListener, contentElement]);\n}\n\nfunction shouldHideOnInteractOutside(\n hideOnInteractOutside: DialogOptions[\"hideOnInteractOutside\"],\n event: Event,\n) {\n if (typeof hideOnInteractOutside === \"function\") {\n return hideOnInteractOutside(event);\n }\n return !!hideOnInteractOutside;\n}\n\nexport function useHideOnInteractOutside(\n store: DialogStore,\n hideOnInteractOutside: DialogOptions[\"hideOnInteractOutside\"],\n domReady?: boolean | HTMLElement | null,\n interactedOutsideRef?: MutableRefObject<boolean>,\n) {\n const open = useStoreState(store, \"open\");\n const contentElement = useStoreState(store, \"contentElement\");\n const contentWindow = contentElement ? getWindow(contentElement) : undefined;\n const previousMouseDownRef = usePreviousMouseDownRef(open, contentWindow);\n const props = { store, domReady, capture: true };\n\n useEventOutside({\n ...props,\n type: \"click\",\n listener: (event) => {\n const { contentElement } = store.getState();\n const previousMouseDown = previousMouseDownRef.current as Element | null;\n // If there's no previously mousedown'd element, this probably means that\n // the dialog opened with a mousedown event, and a subsequent click event\n // was dispatched outside of the dialog. See form-select example. We just\n // ignore this.\n if (!previousMouseDown) return;\n // This prevents the dialog from closing by dragging the cursor (for\n // example, selecting some text inside the dialog and releasing the mouse\n // outside of it). See:\n // - https://github.com/ariakit/ariakit/issues/1336\n // - https://github.com/ariakit/ariakit/issues/2330\n if (!isElementMarked(previousMouseDown, contentElement?.id)) return;\n if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;\n if (interactedOutsideRef) {\n interactedOutsideRef.current = true;\n }\n store.hide();\n },\n });\n\n useEventOutside({\n ...props,\n type: \"focusin\",\n listener: (event) => {\n const { contentElement } = store.getState();\n if (!contentElement) return;\n // Fix for https://github.com/ariakit/ariakit/issues/619\n if (event.target === getDocument(contentElement)) return;\n if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;\n store.hide();\n },\n });\n\n useEventOutside({\n ...props,\n type: \"contextmenu\",\n listener: (event) => {\n if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;\n if (interactedOutsideRef) {\n interactedOutsideRef.current = true;\n }\n store.hide();\n },\n });\n}\n"],"mappings":";;;;;;;;SAyBM,aAAO,QAAY;CACvB,IAAA,OAAO,YAAS,QAAY,OAAQ;CACtC,OAAA,SAAA,YAAA,MAAA,EAAA,MAAA,MAAA;AAEA;SACO,aAAY,YAAO,QAAA;CACxB,IAAI,CAAA,YAAS,OAAA;CACb,IAAA,SAAM,YAAkB,MAAA,GAAA,OAAa;CACrC,MAAI,WAAU,OAAA,aAAA,uBAAA;KACZ,UAAM;EACN,MAAI,gBACF,YAAO,UAAS,EAAA,eAAyB,QAAA;EAE7C,IAAA,eAAA,OAAA,SAAA,YAAA,aAAA;CACA;CACF,OAAA;AAEA;SACQ,qBAAqB,OAAO,QAAA;CAClC,IAAA,EAAM,aAAO,QAAO,OAAA;CACpB,MAAI,OAAK,OAAU,sBAAqB;CACxC,IAAA,KACE,UAAY,KAAA,KAAM,WAClB,GAAM,OAAA;CAIV,OAAA,KAAA,OAAA,MAAA,WAAA,MAAA,WAAA,KAAA,MAAA,KAAA,UAAA,KAAA,QAAA,MAAA,WAAA,MAAA,WAAA,KAAA,OAAA,KAAA;AAEA;SAOQ,gBAAe,EAAA,OAAS,MAAQ,UAAA,SAAA,YA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,UAAA,cAAA,IAAA,KAAA,CAAA;OAAE,QAAA;EAAO;EAAU;EAAc,SAAA;CAE/C;iBACK;EACH,GAAA;EACA,MAAA;aACU,UAAA;GACR,MAAM,EAAA,mBAAoB,MAAA,SAAA;GAK1B,MAAK,oBAAmB,qBAAA;GAMxB,IAAI,CAAC,mBAAgB;GACrB,IAAI,CAAC,gBAAA,mBAA4B,gBAAuB,EAAA,GAAK;GAC7D,IAAI,CAAA,4BACF,uBAAqB,KAAU,GAAA;GAEjC,IAAA,sBAAW,qBAAA,UAAA;GACb,MAAA,KAAA;EACD;CAED,CAAA;iBACK;EACH,GAAA;EACA,MAAA;aACU,UAAA;GACR,MAAK,EAAA,mBAAgB,MAAA,SAAA;GAErB,IAAI,CAAA,gBAAiB;GACrB,IAAI,MAAC,WAAA,YAA4B,cAAA,GAAA;GACjC,IAAA,CAAA,4BAAW,uBAAA,KAAA,GAAA;GACb,MAAA,KAAA;EACD;CAED,CAAA;iBACK;EACH,GAAA;EACA,MAAA;aACO,UAAA;GACL,IAAI,CAAA,4BACF,uBAAqB,KAAU,GAAA;GAEjC,IAAA,sBAAW,qBAAA,UAAA;GACb,MAAA,KAAA;EACD;CACH,CAAA"}
|
|
@@ -43,7 +43,8 @@ function usePreventBodyScroll(contentElement, contentId, enabled) {
|
|
|
43
43
|
});
|
|
44
44
|
return () => {
|
|
45
45
|
restoreStyle();
|
|
46
|
-
|
|
46
|
+
// istanbul ignore next: JSDOM doesn't implement window.scrollTo
|
|
47
|
+
if (process.env.NODE_ENV !== "test") win.scrollTo({
|
|
47
48
|
left: scrollX,
|
|
48
49
|
top: scrollY,
|
|
49
50
|
behavior: "instant"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-prevent-body-scroll.js","names":[],"sources":["../../../src/dialog/utils/use-prevent-body-scroll.ts"],"sourcesContent":["// Based on https://github.com/floating-ui/floating-ui/blob/1201e72e67a80e479122293d46d96c9bbc8f156d/packages/react-dom-interactions/src/FloatingOverlay.tsx\nimport { getDocument, getWindow, chain, isApple, isMac } from \"@ariakit/utils\";\nimport { useEffect } from \"react\";\nimport { assignStyle, setCSSProperty } from \"./orchestrate.ts\";\nimport { useRootDialog } from \"./use-root-dialog.ts\";\n\nfunction getPaddingProperty(documentElement: HTMLElement) {\n // RTL <body> scrollbar\n const documentLeft = documentElement.getBoundingClientRect().left;\n const scrollbarX = Math.round(documentLeft) + documentElement.scrollLeft;\n return scrollbarX ? \"paddingLeft\" : \"paddingRight\";\n}\n\nexport function usePreventBodyScroll(\n contentElement: HTMLElement | null,\n contentId?: string,\n enabled?: boolean,\n) {\n const isRootDialog = useRootDialog({\n attribute: \"data-dialog-prevent-body-scroll\",\n contentElement,\n contentId,\n enabled,\n });\n\n useEffect(() => {\n if (!isRootDialog()) return;\n if (!contentElement) return;\n const doc = getDocument(contentElement);\n const win = getWindow(contentElement);\n const { documentElement, body } = doc;\n const cssScrollbarWidth =\n documentElement.style.getPropertyValue(\"--scrollbar-width\");\n const scrollbarWidth = cssScrollbarWidth\n ? Number.parseInt(cssScrollbarWidth, 10)\n : win.innerWidth - documentElement.clientWidth;\n\n const setScrollbarWidthProperty = () =>\n setCSSProperty(\n documentElement,\n \"--scrollbar-width\",\n `${scrollbarWidth}px`,\n );\n\n const paddingProperty = getPaddingProperty(documentElement);\n\n const setStyle = () =>\n assignStyle(body, {\n overflow: \"hidden\",\n [paddingProperty]: `${scrollbarWidth}px`,\n });\n\n // Only iOS doesn't respect `overflow: hidden` on document.body\n const setIOSStyle = () => {\n const { scrollX, scrollY, visualViewport } = win;\n\n // iOS 12 does not support `visuaViewport`.\n const offsetLeft = visualViewport?.offsetLeft ?? 0;\n const offsetTop = visualViewport?.offsetTop ?? 0;\n\n const restoreStyle = assignStyle(body, {\n position: \"fixed\",\n overflow: \"hidden\",\n top: `${-(scrollY - Math.floor(offsetTop))}px`,\n left: `${-(scrollX - Math.floor(offsetLeft))}px`,\n right: \"0\",\n [paddingProperty]: `${scrollbarWidth}px`,\n });\n\n return () => {\n restoreStyle();\n // istanbul ignore next: JSDOM doesn't implement window.scrollTo\n if (process.env.NODE_ENV !== \"test\") {\n win.scrollTo({ left: scrollX, top: scrollY, behavior: \"instant\" });\n }\n };\n };\n\n const isIOS = isApple() && !isMac();\n\n return chain(\n setScrollbarWidthProperty(),\n isIOS ? setIOSStyle() : setStyle(),\n );\n }, [isRootDialog, contentElement]);\n}\n"],"mappings":";;;;;;SAQQ,mBAAe,iBAAgB;CAErC,MAAA,eAD8B,gBAAgB,sBAAgB,EAAA;CAEhE,OAAA,KAAA,MAAA,YAAA,IAAA,gBAAA,aAAA,gBAAA;AAEA;SAKQ,qBAAe,gBAAc,WAAA,SAAA;OACjC,eAAW,cAAA;EACX,WAAA;EACA;EACA;EACD;CAED,CAAA;iBACO;EACL,IAAI,CAAC,aAAA,GAAgB;EACrB,IAAA,CAAA,gBAAY;EACZ,MAAM,MAAM,YAAU,cAAc;EACpC,MAAM,MAAE,UAAA,cAA0B;EAClC,MAAM,EAAA,iBAAA,SACJ;EACF,MAAM,oBAAiB,gBAAA,MACnB,iBAAgB,mBAChB;EAEJ,MAAM,iBAAA,oBACJ,OAAA,SACE,mBACA,EAAA,IAAA,IAAA,aACG,gBACL;EAEF,MAAM,kCAAkB,eAAmB,iBAAe,qBAAA,GAAA,eAAA,GAAA;EAE1D,MAAM,kBACJ,mBAAkB,eAAA;QAChB,iBAAU,YAAA,MAAA;aACT;IACF,kBAAA,GAAA,eAAA;EAGH,CAAA;QACE,oBAAiB;GAGjB,MAAM,EAAA,SAAA,SAAa,mBAAgB;GACnC,MAAM,aAAY,gBAAgB,cAAa;GAE/C,MAAM,YAAA,gBAA2B,aAAM;SACrC,eAAU,YAAA,MAAA;IACV,UAAU;IACV,UAAU;IACV,KAAA,GAAM,EAAG,UAAE,KAAU,MAAK,SAAM,GAAU;IAC1C,MAAA,GAAO,EAAA,UAAA,KAAA,MAAA,UAAA,GAAA;WACN;KACF,kBAAA,GAAA,eAAA;GAED,CAAA;gBACE
|
|
1
|
+
{"version":3,"file":"use-prevent-body-scroll.js","names":[],"sources":["../../../src/dialog/utils/use-prevent-body-scroll.ts"],"sourcesContent":["// Based on https://github.com/floating-ui/floating-ui/blob/1201e72e67a80e479122293d46d96c9bbc8f156d/packages/react-dom-interactions/src/FloatingOverlay.tsx\nimport { getDocument, getWindow, chain, isApple, isMac } from \"@ariakit/utils\";\nimport { useEffect } from \"react\";\nimport { assignStyle, setCSSProperty } from \"./orchestrate.ts\";\nimport { useRootDialog } from \"./use-root-dialog.ts\";\n\nfunction getPaddingProperty(documentElement: HTMLElement) {\n // RTL <body> scrollbar\n const documentLeft = documentElement.getBoundingClientRect().left;\n const scrollbarX = Math.round(documentLeft) + documentElement.scrollLeft;\n return scrollbarX ? \"paddingLeft\" : \"paddingRight\";\n}\n\nexport function usePreventBodyScroll(\n contentElement: HTMLElement | null,\n contentId?: string,\n enabled?: boolean,\n) {\n const isRootDialog = useRootDialog({\n attribute: \"data-dialog-prevent-body-scroll\",\n contentElement,\n contentId,\n enabled,\n });\n\n useEffect(() => {\n if (!isRootDialog()) return;\n if (!contentElement) return;\n const doc = getDocument(contentElement);\n const win = getWindow(contentElement);\n const { documentElement, body } = doc;\n const cssScrollbarWidth =\n documentElement.style.getPropertyValue(\"--scrollbar-width\");\n const scrollbarWidth = cssScrollbarWidth\n ? Number.parseInt(cssScrollbarWidth, 10)\n : win.innerWidth - documentElement.clientWidth;\n\n const setScrollbarWidthProperty = () =>\n setCSSProperty(\n documentElement,\n \"--scrollbar-width\",\n `${scrollbarWidth}px`,\n );\n\n const paddingProperty = getPaddingProperty(documentElement);\n\n const setStyle = () =>\n assignStyle(body, {\n overflow: \"hidden\",\n [paddingProperty]: `${scrollbarWidth}px`,\n });\n\n // Only iOS doesn't respect `overflow: hidden` on document.body\n const setIOSStyle = () => {\n const { scrollX, scrollY, visualViewport } = win;\n\n // iOS 12 does not support `visuaViewport`.\n const offsetLeft = visualViewport?.offsetLeft ?? 0;\n const offsetTop = visualViewport?.offsetTop ?? 0;\n\n const restoreStyle = assignStyle(body, {\n position: \"fixed\",\n overflow: \"hidden\",\n top: `${-(scrollY - Math.floor(offsetTop))}px`,\n left: `${-(scrollX - Math.floor(offsetLeft))}px`,\n right: \"0\",\n [paddingProperty]: `${scrollbarWidth}px`,\n });\n\n return () => {\n restoreStyle();\n // istanbul ignore next: JSDOM doesn't implement window.scrollTo\n if (process.env.NODE_ENV !== \"test\") {\n win.scrollTo({ left: scrollX, top: scrollY, behavior: \"instant\" });\n }\n };\n };\n\n const isIOS = isApple() && !isMac();\n\n return chain(\n setScrollbarWidthProperty(),\n isIOS ? setIOSStyle() : setStyle(),\n );\n }, [isRootDialog, contentElement]);\n}\n"],"mappings":";;;;;;SAQQ,mBAAe,iBAAgB;CAErC,MAAA,eAD8B,gBAAgB,sBAAgB,EAAA;CAEhE,OAAA,KAAA,MAAA,YAAA,IAAA,gBAAA,aAAA,gBAAA;AAEA;SAKQ,qBAAe,gBAAc,WAAA,SAAA;OACjC,eAAW,cAAA;EACX,WAAA;EACA;EACA;EACD;CAED,CAAA;iBACO;EACL,IAAI,CAAC,aAAA,GAAgB;EACrB,IAAA,CAAA,gBAAY;EACZ,MAAM,MAAM,YAAU,cAAc;EACpC,MAAM,MAAE,UAAA,cAA0B;EAClC,MAAM,EAAA,iBAAA,SACJ;EACF,MAAM,oBAAiB,gBAAA,MACnB,iBAAgB,mBAChB;EAEJ,MAAM,iBAAA,oBACJ,OAAA,SACE,mBACA,EAAA,IAAA,IAAA,aACG,gBACL;EAEF,MAAM,kCAAkB,eAAmB,iBAAe,qBAAA,GAAA,eAAA,GAAA;EAE1D,MAAM,kBACJ,mBAAkB,eAAA;QAChB,iBAAU,YAAA,MAAA;aACT;IACF,kBAAA,GAAA,eAAA;EAGH,CAAA;QACE,oBAAiB;GAGjB,MAAM,EAAA,SAAA,SAAa,mBAAgB;GACnC,MAAM,aAAY,gBAAgB,cAAa;GAE/C,MAAM,YAAA,gBAA2B,aAAM;SACrC,eAAU,YAAA,MAAA;IACV,UAAU;IACV,UAAU;IACV,KAAA,GAAM,EAAG,UAAE,KAAU,MAAK,SAAM,GAAU;IAC1C,MAAA,GAAO,EAAA,UAAA,KAAA,MAAA,UAAA,GAAA;WACN;KACF,kBAAA,GAAA,eAAA;GAED,CAAA;gBACE;;;QAGiB,QAAM,IAAA,aAAA,QAAA,IAAA,SAAA;KAAS,MAAK;KAAS,KAAA;KAAqB,UAAA;IAErE,CAAA;GACF;EAEA;EAEA,MAAA,QACE,QAAA,KAAA,CAAA,MAAA;EAGJ,OAAI,MAAA,0BAA6B,GAAA,QAAA,YAAA,IAAA,SAAA,CAAA;CACnC,GAAA,CAAA,cAAA,cAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/dialog/utils/use-previous-mouse-down-ref.d.ts
|
|
2
|
-
declare function usePreviousMouseDownRef(enabled?: boolean, scope?: Window): import("react").
|
|
2
|
+
declare function usePreviousMouseDownRef(enabled?: boolean, scope?: Window): import("react").RefObject<EventTarget | null>;
|
|
3
3
|
//#endregion
|
|
4
4
|
export { usePreviousMouseDownRef };
|
|
5
5
|
//# sourceMappingURL=use-previous-mouse-down-ref.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-previous-mouse-down-ref.d.ts","names":["usePreviousMouseDownRef","Window","EventTarget","enabled","scope","
|
|
1
|
+
{"version":3,"file":"use-previous-mouse-down-ref.d.ts","names":["usePreviousMouseDownRef","Window","EventTarget","enabled","scope","RefObject"],"sources":["../../../src/dialog/utils/use-previous-mouse-down-ref.d.ts"],"mappings":";iBAAwBA,uBAAAA,CAAwBG,OAAAA,YAAmBC,KAAAA,GAAQH,MAAAA,mBAAyBI,SAAAA,CAAUH,WAAW"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as FocusableOptions } from "./focusable-
|
|
1
|
+
import { n as FocusableOptions } from "./focusable-dBZH13-T.js";
|
|
2
2
|
import { t as DialogStore } from "./dialog-store-Cjt12T_Y.js";
|
|
3
3
|
import { n as DisclosureContentOptions } from "./disclosure-content-BbPkZgAc.js";
|
|
4
|
-
import { n as PortalOptions } from "./portal-
|
|
4
|
+
import { n as PortalOptions } from "./portal-CKFTfCWH.js";
|
|
5
5
|
import { Props } from "@ariakit/react-utils";
|
|
6
6
|
import { ComponentPropsWithRef, ElementType, FC, KeyboardEvent as KeyboardEvent$1, ReactElement, RefObject, SyntheticEvent } from "react";
|
|
7
7
|
import { BooleanOrCallback } from "@ariakit/utils";
|
|
@@ -41,7 +41,7 @@ declare function createDialogComponent<T extends DialogOptions>(Component: FC<T>
|
|
|
41
41
|
* </Dialog>
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
declare const Dialog: (props: DialogProps
|
|
44
|
+
declare const Dialog: (props: DialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
45
|
interface DialogOptions<T extends ElementType = TagName> extends FocusableOptions<T>, PortalOptions<T>, DisclosureContentOptions<T> {
|
|
46
46
|
/**
|
|
47
47
|
* Object returned by the
|
|
@@ -264,4 +264,4 @@ interface DialogOptions<T extends ElementType = TagName> extends FocusableOption
|
|
|
264
264
|
type DialogProps<T extends ElementType = TagName> = Props<T, DialogOptions<T>>;
|
|
265
265
|
//#endregion
|
|
266
266
|
export { useDialog as a, createDialogComponent as i, DialogOptions as n, DialogProps as r, Dialog as t };
|
|
267
|
-
//# sourceMappingURL=dialog-
|
|
267
|
+
//# sourceMappingURL=dialog-D23r2ZWj.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-
|
|
1
|
+
{"version":3,"file":"dialog-D23r2ZWj.d.ts","names":["Props","BooleanOrCallback","ComponentPropsWithRef","ElementType","FC","ReactElement","KeyboardEvent","ReactKeyboardEvent","RefObject","SyntheticEvent","DisclosureContentOptions","FocusableOptions","PortalOptions","DialogStore","TagName","useDialog","DialogOptions","Hook","createDialogComponent","T","Component","useProviderContext","props","JSX","Element","Dialog","DialogProps","Event","Iterable","HTMLElement","store","open","onClose","event","modal","backdrop","hideOnEscape","hideOnInteractOutside","getPersistentElements","preventBodyScroll","autoFocusOnShow","autoFocusOnHide","initialFocus","finalFocus","unstable_treeSnapshotKey"],"sources":["../src/dialog/dialog.d.ts"],"mappings":";;;;;;;;;cAOcc,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFwB;;;;AAChC;AAAA;;;;AACQ;AAFwB,cAahCC,SAAAA,iCAA0CE,IAAAA,QAAYD,aAAa;AAAA,iBAChEE,qBAAAA,WAAgCF,aAAAA,CAAAA,CAAeI,SAAAA,EAAWhB,EAAAA,CAAGe,CAAAA,GAAIE,kBAAAA,SAA2BR,WAAAA,gBAA2BS,KAAAA,EAAOH,CAAAA,iCAAkCI,GAAAA,CAAIC,OAAAA;;;AADpG;AACxF;;;;;;;;;;;;;;;;;cAqBqBC,MAAAA,GAASH,KAAAA,EAAOI,WAAW,iCAAiCH,GAAAA,CAAIC,OAAAA;AAAAA,UACpER,aAAAA,WAAwBb,WAAAA,GAAcW,OAAAA,UAAiBH,gBAAAA,CAAiBQ,CAAAA,GAAIP,aAAAA,CAAcO,CAAAA,GAAIT,wBAAAA,CAAyBS,CAAAA;EAtBgDI;;;AAAW;AAqBnM;;;;EAUIO,KAAAA,GAAQjB,WAAAA;EAVkBS;;;;AAA8D;AAC5F;;;;;;;;;EAwBIS,IAAAA;EA4EkC7B;;;;;;;;;;;;;;;;;;;;;;;;EAnDlC8B,OAAAA,IAAWC,KAAAA,EAAON,KAAAA;EAjDiH;;;;;;;;;;;;;;;;;;;;;;;;EA0EnIO,KAAAA;EAwCiC5B;;;;;;;;;;;;;;;;;;;;;;;;;EAdjC6B,QAAAA,aAAqB9B,YAAAA,CAAaH,qBAAAA,WAAgCC,WAAAA,CAAYD,qBAAAA;EAqHtD;AAE5B;;;;;;;;;;;;EAzGIkC,YAAAA,GAAenC,iBAAAA,CAAkBK,aAAAA,GAAgBC,eAAAA;EAyGLO;;;;;;AAAmC;;;;;;;EA3F/EuB,qBAAAA,GAAwBpC,iBAAAA,CAAkB0B,KAAAA,GAAQlB,cAAAA;;;;;;;;;;;;;;;;;;EAkBlD6B,qBAAAA,SAA8BV,QAAAA,CAASJ,OAAAA;;;;;;;EAOvCe,iBAAAA;;;;;;;;;;;;;;;EAeAC,eAAAA,GAAkBvC,iBAAAA,CAAkB4B,WAAAA;;;;;;;;;;;;;;;;;EAiBpCY,eAAAA,GAAkBxC,iBAAAA,CAAkB4B,WAAAA;;;;;;;;;;;;;;;;EAgBpCa,YAAAA,GAAeb,WAAAA,GAAcrB,SAAAA,CAAUqB,WAAAA;;;;;;;;;;;;EAYvCc,UAAAA,GAAad,WAAAA,GAAcrB,SAAAA,CAAUqB,WAAAA;;;;EAIrCe,wBAAAA;AAAAA;AAAAA,KAEQlB,WAAAA,WAAsBvB,WAAAA,GAAcW,OAAAA,IAAWd,KAAAA,CAAMmB,CAAAA,EAAGH,aAAAA,CAAcG,CAAAA"}
|
|
@@ -32,7 +32,7 @@ declare const useDialogDescription: import("@ariakit/react-utils").Hook<"p", Dia
|
|
|
32
32
|
* </Dialog>
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
declare const DialogDescription: (props: DialogDescriptionProps) => import("react").ReactElement<
|
|
35
|
+
declare const DialogDescription: (props: DialogDescriptionProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
36
36
|
interface DialogDescriptionOptions<_T extends ElementType = TagName> extends Options {
|
|
37
37
|
/**
|
|
38
38
|
* Object returned by the
|
|
@@ -45,4 +45,4 @@ interface DialogDescriptionOptions<_T extends ElementType = TagName> extends Opt
|
|
|
45
45
|
type DialogDescriptionProps<T extends ElementType = TagName> = Props<T, DialogDescriptionOptions<T>>;
|
|
46
46
|
//#endregion
|
|
47
47
|
export { useDialogDescription as i, DialogDescriptionOptions as n, DialogDescriptionProps as r, DialogDescription as t };
|
|
48
|
-
//# sourceMappingURL=dialog-description-
|
|
48
|
+
//# sourceMappingURL=dialog-description-CJGxnEvk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-description-
|
|
1
|
+
{"version":3,"file":"dialog-description-CJGxnEvk.d.ts","names":["Options","Props","ElementType","DialogStore","TagName","useDialogDescription","DialogDescriptionOptions","Hook","DialogDescription","DialogDescriptionProps","props","ReactElement","JSXElementConstructor","_T","store","T"],"sources":["../src/dialog/dialog-description.d.ts"],"mappings":";;;;;cAGcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFwB;;;;AAChC;AAAA;;;;AACQ;AAa7B;;AAfqD,cAehCC,oBAAAA,iCAAqDE,IAAAA,MAAUD,wBAAwB;;AAAA;AAe5G;;;;;;;;;AAA+J;AAC/J;;cADqBE,iBAAAA,GAAoBE,KAAAA,EAAOD,sBAAsB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACzHN,wBAAAA,YAAoCJ,WAAAA,GAAcE,OAAAA,UAAiBJ,OAAAA;EAAjBI;;;;;;EAO/DU,KAAAA,GAAQX,WAAAA;AAAAA;AAAAA,KAEAM,sBAAAA,WAAiCP,WAAAA,GAAcE,OAAAA,IAAWH,KAAAA,CAAMc,CAAAA,EAAGT,wBAAAA,CAAyBS,CAAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as DialogStore } from "./dialog-store-Cjt12T_Y.js";
|
|
2
|
-
import { n as DisclosureOptions } from "./disclosure-
|
|
2
|
+
import { n as DisclosureOptions } from "./disclosure-C4F4sCVZ.js";
|
|
3
3
|
import { Props } from "@ariakit/react-utils";
|
|
4
4
|
import { ElementType } from "react";
|
|
5
5
|
|
|
@@ -30,7 +30,7 @@ declare const useDialogDisclosure: import("@ariakit/react-utils").Hook<"button",
|
|
|
30
30
|
* </DialogProvider>
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
declare const DialogDisclosure: (props: DialogDisclosureProps) => import("react").ReactElement<
|
|
33
|
+
declare const DialogDisclosure: (props: DialogDisclosureProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
34
34
|
interface DialogDisclosureOptions<T extends ElementType = TagName> extends DisclosureOptions<T> {
|
|
35
35
|
/**
|
|
36
36
|
* Object returned by the
|
|
@@ -44,4 +44,4 @@ interface DialogDisclosureOptions<T extends ElementType = TagName> extends Discl
|
|
|
44
44
|
type DialogDisclosureProps<T extends ElementType = TagName> = Props<T, DialogDisclosureOptions<T>>;
|
|
45
45
|
//#endregion
|
|
46
46
|
export { useDialogDisclosure as i, DialogDisclosureOptions as n, DialogDisclosureProps as r, DialogDisclosure as t };
|
|
47
|
-
//# sourceMappingURL=dialog-disclosure-
|
|
47
|
+
//# sourceMappingURL=dialog-disclosure-DSESk5pv.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-disclosure-
|
|
1
|
+
{"version":3,"file":"dialog-disclosure-DSESk5pv.d.ts","names":["Props","ElementType","DisclosureOptions","DialogStore","TagName","useDialogDisclosure","DialogDisclosureOptions","Hook","DialogDisclosure","DialogDisclosureProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../src/dialog/dialog-disclosure.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFwB;;;;AAChC;AAAA;;;;AACQ;AAY7B;AAdqD,cAchCC,mBAAAA,iCAAoDE,IAAAA,WAAeD,uBAAuB;;;AAAA;AAa/G;;;;;;;;;cAAqBE,gBAAAA,GAAmBE,KAAAA,EAAOD,qBAAqB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACvHN,uBAAAA,WAAkCL,WAAAA,GAAcG,OAAAA,UAAiBF,iBAAAA,CAAkBW,CAAAA;EAA5D;;;;;;;EAQpCC,KAAAA,GAAQX,WAAAA;AAAAA;AAAAA,KAEAM,qBAAAA,WAAgCR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,uBAAAA,CAAwBO,CAAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ButtonOptions } from "./button-
|
|
1
|
+
import { n as ButtonOptions } from "./button-CVWcOgxs.js";
|
|
2
2
|
import { t as DialogStore } from "./dialog-store-Cjt12T_Y.js";
|
|
3
3
|
import { Props } from "@ariakit/react-utils";
|
|
4
4
|
import { ElementType } from "react";
|
|
@@ -32,7 +32,7 @@ declare const useDialogDismiss: import("@ariakit/react-utils").Hook<"button", Di
|
|
|
32
32
|
* </Dialog>
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
declare const DialogDismiss: (props: DialogDismissProps) => import("react").ReactElement<
|
|
35
|
+
declare const DialogDismiss: (props: DialogDismissProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
36
36
|
interface DialogDismissOptions<T extends ElementType = TagName> extends ButtonOptions<T> {
|
|
37
37
|
/**
|
|
38
38
|
* Object returned by the
|
|
@@ -45,4 +45,4 @@ interface DialogDismissOptions<T extends ElementType = TagName> extends ButtonOp
|
|
|
45
45
|
type DialogDismissProps<T extends ElementType = TagName> = Props<T, DialogDismissOptions<T>>;
|
|
46
46
|
//#endregion
|
|
47
47
|
export { useDialogDismiss as i, DialogDismissOptions as n, DialogDismissProps as r, DialogDismiss as t };
|
|
48
|
-
//# sourceMappingURL=dialog-dismiss-
|
|
48
|
+
//# sourceMappingURL=dialog-dismiss-DW3XQYvp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-dismiss-
|
|
1
|
+
{"version":3,"file":"dialog-dismiss-DW3XQYvp.d.ts","names":["Props","ElementType","ButtonOptions","DialogStore","TagName","useDialogDismiss","DialogDismissOptions","Hook","DialogDismiss","DialogDismissProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../src/dialog/dialog-dismiss.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFwB;;;;AAChC;AAAA;;;;AACQ;AAa7B;;AAfqD,cAehCC,gBAAAA,iCAAiDE,IAAAA,WAAeD,oBAAoB;;AAAA;AAczG;;;;;;;;;AAAuJ;AACvJ;cADqBE,aAAAA,GAAgBE,KAAAA,EAAOD,kBAAkB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACjHN,oBAAAA,WAA+BL,WAAAA,GAAcG,OAAAA,UAAiBF,aAAAA,CAAcW,CAAAA;EAA7CZ;;;;;;EAO5Ca,KAAAA,GAAQX,WAAAA;AAAAA;AAAAA,KAEAM,kBAAAA,WAA6BR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,oBAAAA,CAAqBO,CAAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as DialogStore } from "./dialog-store-Cjt12T_Y.js";
|
|
2
|
-
import { n as HeadingOptions } from "./heading-
|
|
2
|
+
import { n as HeadingOptions } from "./heading-D_AmeqL5.js";
|
|
3
3
|
import { Props } from "@ariakit/react-utils";
|
|
4
4
|
import { ElementType } from "react";
|
|
5
5
|
|
|
@@ -33,7 +33,7 @@ declare const useDialogHeading: import("@ariakit/react-utils").Hook<"h1", Dialog
|
|
|
33
33
|
* </Dialog>
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
declare const DialogHeading: (props: DialogHeadingProps) => import("react").ReactElement<
|
|
36
|
+
declare const DialogHeading: (props: DialogHeadingProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
37
37
|
interface DialogHeadingOptions<T extends ElementType = TagName> extends HeadingOptions<T> {
|
|
38
38
|
/**
|
|
39
39
|
* Object returned by the
|
|
@@ -46,4 +46,4 @@ interface DialogHeadingOptions<T extends ElementType = TagName> extends HeadingO
|
|
|
46
46
|
type DialogHeadingProps<T extends ElementType = TagName> = Props<T, DialogHeadingOptions<T>>;
|
|
47
47
|
//#endregion
|
|
48
48
|
export { useDialogHeading as i, DialogHeadingOptions as n, DialogHeadingProps as r, DialogHeading as t };
|
|
49
|
-
//# sourceMappingURL=dialog-heading-
|
|
49
|
+
//# sourceMappingURL=dialog-heading-DGA5d8VH.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-heading-
|
|
1
|
+
{"version":3,"file":"dialog-heading-DGA5d8VH.d.ts","names":["Props","ElementType","HeadingOptions","DialogStore","TagName","useDialogHeading","DialogHeadingOptions","Hook","DialogHeading","DialogHeadingProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../src/dialog/dialog-heading.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFwB;;;;AAChC;AAAA;;;;AACQ;AAa7B;;AAfqD,cAehCC,gBAAAA,iCAAiDE,IAAAA,OAAWD,oBAAoB;;AAAA;AAerG;;;;;;;;;AAAuJ;AACvJ;;cADqBE,aAAAA,GAAgBE,KAAAA,EAAOD,kBAAkB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACjHN,oBAAAA,WAA+BL,WAAAA,GAAcG,OAAAA,UAAiBF,cAAAA,CAAeW,CAAAA;EAAhCT;;;;;;EAO1DU,KAAAA,GAAQX,WAAAA;AAAAA;AAAAA,KAEAM,kBAAAA,WAA6BR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,oBAAAA,CAAqBO,CAAAA"}
|
|
@@ -44,7 +44,7 @@ function isHidden(mounted, hidden, alwaysVisible) {
|
|
|
44
44
|
const useDisclosureContent = createHook(function useDisclosureContent({ store, alwaysVisible, ...props }) {
|
|
45
45
|
const context = useDisclosureProviderContext();
|
|
46
46
|
store = store || context;
|
|
47
|
-
invariant(store, "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component.");
|
|
47
|
+
invariant(store, process.env.NODE_ENV !== "production" && "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component.");
|
|
48
48
|
const ref = useRef(null);
|
|
49
49
|
const id = useId(props.id);
|
|
50
50
|
const [transition, setTransition] = useState(null);
|