@ariakit/react-components 0.1.1 → 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 +51 -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":"form-remove.d.ts","names":["StringLike","Props","ElementType","ButtonOptions","FormStore","TagName","useFormRemove","FormRemoveOptions","Hook","FormRemove","FormRemoveProps","props","ReactElement","JSXElementConstructor","T","store","name","index","autoFocusOnClick"],"sources":["../../src/form/form-remove.d.ts"],"mappings":";;;;;;;cAKcK,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;
|
|
1
|
+
{"version":3,"file":"form-remove.d.ts","names":["StringLike","Props","ElementType","ButtonOptions","FormStore","TagName","useFormRemove","FormRemoveOptions","Hook","FormRemove","FormRemoveProps","props","ReactElement","JSXElementConstructor","T","store","name","index","autoFocusOnClick"],"sources":["../../src/form/form-remove.d.ts"],"mappings":";;;;;;;cAKcK,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;AA2B7B;;;;AAAmG;AAuCnG;;;;;;;;;AAAiJ;AACjJ;AArEiD,cA6B5BC,aAAAA,iCAA8CE,IAAAA,WAAeD,iBAAiB;;;;;;;;;;;;;;;;;;;;;;AAiE/E;AAEpB;;;;;;;;;;;;;;;;cA5BqBE,UAAAA,GAAaE,KAAAA,EAAOD,eAAe,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UAC3GN,iBAAAA,WAA4BL,WAAAA,GAAcG,OAAAA,UAAiBF,aAAAA,CAAcW,CAAAA;EA2BC;AAAA;;;;;;EAnBvFC,KAAAA,GAAQX,SAAAA;;;;;;;EAORY,IAAAA,EAAMhB,UAAAA;;;;EAINiB,KAAAA;;;;;;EAMAC,gBAAAA;AAAAA;AAAAA,KAEQR,eAAAA,WAA0BR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,iBAAAA,CAAkBO,CAAAA"}
|
package/dist/form/form-remove.js
CHANGED
|
@@ -39,9 +39,10 @@ function findPushButton(items, name) {
|
|
|
39
39
|
* const values = useStoreState(store, "values");
|
|
40
40
|
*
|
|
41
41
|
* <Form store={store}>
|
|
42
|
-
* {values.languages.map((
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* {values.languages.map((language, i) => {
|
|
43
|
+
* if (language == null) return null;
|
|
44
|
+
* return <FormInput key={i} name={store.names.languages[i]} />;
|
|
45
|
+
* })}
|
|
45
46
|
* <Role {...props}>Remove first language</Role>
|
|
46
47
|
* </Form>
|
|
47
48
|
* ```
|
|
@@ -49,7 +50,7 @@ function findPushButton(items, name) {
|
|
|
49
50
|
const useFormRemove = createHook(function useFormRemove({ store, name: nameProp, index, autoFocusOnClick = true, ...props }) {
|
|
50
51
|
const context = useFormContext();
|
|
51
52
|
store = store || context;
|
|
52
|
-
invariant(store, "FormRemove must be wrapped in a Form component.");
|
|
53
|
+
invariant(store, process.env.NODE_ENV !== "production" && "FormRemove must be wrapped in a Form component.");
|
|
53
54
|
const name = String(nameProp);
|
|
54
55
|
const onClickProp = props.onClick;
|
|
55
56
|
const onClick = useEvent((event) => {
|
|
@@ -88,7 +89,7 @@ const useFormRemove = createHook(function useFormRemove({ store, name: nameProp,
|
|
|
88
89
|
* prop to `false`.
|
|
89
90
|
* @see https://ariakit.com/components/form
|
|
90
91
|
* @example
|
|
91
|
-
* ```jsx {
|
|
92
|
+
* ```jsx {15}
|
|
92
93
|
* const form = useFormStore({
|
|
93
94
|
* defaultValues: {
|
|
94
95
|
* languages: ["JavaScript", "PHP"],
|
|
@@ -98,12 +99,15 @@ const useFormRemove = createHook(function useFormRemove({ store, name: nameProp,
|
|
|
98
99
|
* const values = useStoreState(form, "values");
|
|
99
100
|
*
|
|
100
101
|
* <Form store={form}>
|
|
101
|
-
* {values.languages.map((
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* <
|
|
105
|
-
*
|
|
106
|
-
*
|
|
102
|
+
* {values.languages.map((language, i) => {
|
|
103
|
+
* if (language == null) return null;
|
|
104
|
+
* return (
|
|
105
|
+
* <div key={i}>
|
|
106
|
+
* <FormInput name={form.names.languages[i]} />
|
|
107
|
+
* <FormRemove name={form.names.languages} index={i} />
|
|
108
|
+
* </div>
|
|
109
|
+
* );
|
|
110
|
+
* })}
|
|
107
111
|
* </Form>
|
|
108
112
|
* ```
|
|
109
113
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-remove.js","names":[],"sources":["../../src/form/form-remove.tsx"],"sourcesContent":["import type { StringLike } from \"@ariakit/components/form/types\";\nimport {\n useEvent,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { isTextField, invariant } from \"@ariakit/utils\";\nimport type { ElementType, MouseEvent } from \"react\";\nimport type { ButtonOptions } from \"../button/button.tsx\";\nimport { useButton } from \"../button/button.tsx\";\nimport { useFormContext } from \"./form-context.tsx\";\nimport type { FormStore, FormStoreState } from \"./form-store.ts\";\n\nconst TagName = \"button\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\nfunction findNextOrPreviousField(\n items: FormStoreState[\"items\"] | undefined,\n name: string,\n index: number,\n) {\n const fields = items?.filter(\n (item) => item.type === \"field\" && item.name.startsWith(name),\n );\n const regex = new RegExp(`^${name}\\\\.(\\\\d+)`);\n const nextField = fields?.find((field) => {\n const fieldIndex = field.name.replace(regex, \"$1\");\n return Number.parseInt(fieldIndex, 10) > index;\n });\n if (nextField) return nextField;\n return fields?.reverse().find((field) => {\n const fieldIndex = field.name.replace(regex, \"$1\");\n return Number.parseInt(fieldIndex, 10) < index;\n });\n}\n\nfunction findPushButton(\n items: FormStoreState[\"items\"] | undefined,\n name: string,\n) {\n return items?.find((item) => item.type === \"button\" && item.name === name);\n}\n\n/**\n * Returns props to create a `FormRemove` component.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx\n * const store = useFormStore({\n * defaultValues: {\n * languages: [\"JavaScript\", \"PHP\"],\n * },\n * });\n * const props = useFormRemove({\n * store,\n * name: store.names.languages,\n * index: 0,\n * });\n * const values = useStoreState(store, \"values\");\n *\n * <Form store={store}>\n * {values.languages.map((
|
|
1
|
+
{"version":3,"file":"form-remove.js","names":[],"sources":["../../src/form/form-remove.tsx"],"sourcesContent":["import type { StringLike } from \"@ariakit/components/form/types\";\nimport {\n useEvent,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { isTextField, invariant } from \"@ariakit/utils\";\nimport type { ElementType, MouseEvent } from \"react\";\nimport type { ButtonOptions } from \"../button/button.tsx\";\nimport { useButton } from \"../button/button.tsx\";\nimport { useFormContext } from \"./form-context.tsx\";\nimport type { FormStore, FormStoreState } from \"./form-store.ts\";\n\nconst TagName = \"button\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\nfunction findNextOrPreviousField(\n items: FormStoreState[\"items\"] | undefined,\n name: string,\n index: number,\n) {\n const fields = items?.filter(\n (item) => item.type === \"field\" && item.name.startsWith(name),\n );\n const regex = new RegExp(`^${name}\\\\.(\\\\d+)`);\n const nextField = fields?.find((field) => {\n const fieldIndex = field.name.replace(regex, \"$1\");\n return Number.parseInt(fieldIndex, 10) > index;\n });\n if (nextField) return nextField;\n return fields?.reverse().find((field) => {\n const fieldIndex = field.name.replace(regex, \"$1\");\n return Number.parseInt(fieldIndex, 10) < index;\n });\n}\n\nfunction findPushButton(\n items: FormStoreState[\"items\"] | undefined,\n name: string,\n) {\n return items?.find((item) => item.type === \"button\" && item.name === name);\n}\n\n/**\n * Returns props to create a `FormRemove` component.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx\n * const store = useFormStore({\n * defaultValues: {\n * languages: [\"JavaScript\", \"PHP\"],\n * },\n * });\n * const props = useFormRemove({\n * store,\n * name: store.names.languages,\n * index: 0,\n * });\n * const values = useStoreState(store, \"values\");\n *\n * <Form store={store}>\n * {values.languages.map((language, i) => {\n * if (language == null) return null;\n * return <FormInput key={i} name={store.names.languages[i]} />;\n * })}\n * <Role {...props}>Remove first language</Role>\n * </Form>\n * ```\n */\nexport const useFormRemove = createHook<TagName, FormRemoveOptions>(\n function useFormRemove({\n store,\n name: nameProp,\n index,\n autoFocusOnClick = true,\n ...props\n }) {\n const context = useFormContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"FormRemove must be wrapped in a Form component.\",\n );\n\n const name = String(nameProp);\n const onClickProp = props.onClick;\n\n const onClick = useEvent((event: MouseEvent<HTMLType>) => {\n onClickProp?.(event);\n if (event.defaultPrevented) return;\n if (!store) return;\n store.removeValue(name, index);\n if (!autoFocusOnClick) return;\n const { items } = store.getState();\n const item = findNextOrPreviousField(items, name, index);\n const element = item?.element;\n if (element) {\n element.focus();\n if (isTextField(element)) {\n element.select();\n }\n } else {\n const pushButton = findPushButton(items, name);\n pushButton?.element?.focus();\n }\n });\n\n props = {\n ...props,\n onClick,\n };\n\n props = useButton(props);\n\n return props;\n },\n);\n\n/**\n * Renders a button that will remove an item from an array field in the form\n * when clicked.\n *\n * The [`name`](https://ariakit.com/reference/form-remove#name) prop must be\n * provided to identify the array field. Similarly, the\n * [`index`](https://ariakit.com/reference/form-remove#index) prop is required\n * to pinpoint the item to remove.\n *\n * By default, the button will automatically move focus to the next field in the\n * form when clicked, or to the previous field if there isn't a next field. This\n * behavior can be disabled by setting the\n * [`autoFocusOnClick`](https://ariakit.com/reference/form-remove#autofocusonclick)\n * prop to `false`.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx {15}\n * const form = useFormStore({\n * defaultValues: {\n * languages: [\"JavaScript\", \"PHP\"],\n * },\n * });\n *\n * const values = useStoreState(form, \"values\");\n *\n * <Form store={form}>\n * {values.languages.map((language, i) => {\n * if (language == null) return null;\n * return (\n * <div key={i}>\n * <FormInput name={form.names.languages[i]} />\n * <FormRemove name={form.names.languages} index={i} />\n * </div>\n * );\n * })}\n * </Form>\n * ```\n */\nexport const FormRemove = forwardRef(function FormRemove(\n props: FormRemoveProps,\n) {\n const htmlProps = useFormRemove(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface FormRemoveOptions<\n T extends ElementType = TagName,\n> extends ButtonOptions<T> {\n /**\n * Object returned by the\n * [`useFormStore`](https://ariakit.com/reference/use-form-store) hook. If not\n * provided, the closest [`Form`](https://ariakit.com/reference/form) or\n * [`FormProvider`](https://ariakit.com/reference/form-provider) components'\n * context will be used.\n */\n store?: FormStore;\n /**\n * Name of the array field. This can either be a string or a reference to a\n * field name from the\n * [`names`](https://ariakit.com/reference/use-form-store#names) object in the\n * store, for type safety.\n */\n name: StringLike;\n /**\n * Index of the item to remove.\n */\n index: number;\n /**\n * Whether the focus should be moved to the next or previous field when the\n * button is clicked.\n * @default true\n */\n autoFocusOnClick?: boolean;\n}\n\nexport type FormRemoveProps<T extends ElementType = TagName> = Props<\n T,\n FormRemoveOptions<T>\n>;\n"],"mappings":";;;;;;AAmBA,MAAA,UAAS;SAKD,wBACH,OAAS,MAAK,OAAA;CAEjB,MAAM,SAAQ,OAAI,QAAW,SAAK,KAAU,SAAA,WAAA,KAAA,KAAA,WAAA,IAAA,CAAA;CAC5C,MAAM,QAAA,IAAY,OAAA,IAAQ,KAAM,UAAU;OACxC,YAAM,QAAmB,MAAK,UAAQ;EACtC,MAAA,aAAc,MAAS,KAAA,QAAc,OAAI,IAAA;EAC1C,OAAA,OAAA,SAAA,YAAA,EAAA,IAAA;CACD,CAAA;CACA,IAAA,WAAe,OAAA;QACP,QAAA,QAAa,EAAA,MAAW,UAAQ;EACtC,MAAA,aAAc,MAAS,KAAA,QAAc,OAAI,IAAA;EAC1C,OAAA,OAAA,SAAA,YAAA,EAAA,IAAA;CACH,CAAA;AAEA;SAIS,eAAa,OAAS,MAAK;CACpC,OAAA,OAAA,MAAA,SAAA,KAAA,SAAA,YAAA,KAAA,SAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAoCI,gBAAgB,WAAe,SAAA,cAAA,EAAA,OAAA,MAAA,UAAA,OAAA,mBAAA,MAAA,GAAA,SAAA;CAC/B,MAAA,UAAQ,eAAS;CAEjB,QAAA,SAEE;CAIF,UAAM,OAAO,QAAO,IAAQ,aAAA,gBAAA,iDAAA;CAC5B,MAAM,OAAA,OAAc,QAAM;CAE1B,MAAM,cAAU,MAAU;OACxB,UAAc,UAAK,UAAA;EACnB,cAAU,KAAA;EACV,IAAI,MAAC,kBAAO;EACZ,IAAA,CAAA,OAAM;EACN,MAAK,YAAA,MAAkB,KAAA;EACvB,IAAA,CAAA,kBAAkB;EAElB,MAAM,EAAA,UADO,MAAA,SAAA;EAEb,MAAI,UAAS,wBAAA,OAAA,MAAA,KAAA,GAAA;MACX,SAAQ;GACR,QAAI,MAAA;GAGN,IAAA,YACqB,OAAe,GAAA,QACzB,OAAG;EAEf,OAAA,eAAA,OAAA,IAAA,GAAA,SAAA,MAAA;CAED,CAAA;SACK;EACH,GAAA;EACF;CAEA;CAEA,QAAO,UAAA,KAAA;CAEX,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA4CE,aAAO,WAAc,SADH,WACoB,OAAC;CACxC,OAAA,cAAA,SAAA,cAAA,KAAA,CAAA"}
|
|
@@ -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 FormStore } from "../form-store-C4Kf5QHm.js";
|
|
3
3
|
import { Props } from "@ariakit/react-utils";
|
|
4
4
|
import { ElementType } from "react";
|
|
@@ -34,7 +34,7 @@ declare const useFormReset: import("@ariakit/react-utils").Hook<"button", FormRe
|
|
|
34
34
|
* </Form>
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
declare const FormReset: (props: FormResetProps) => import("react").ReactElement<
|
|
37
|
+
declare const FormReset: (props: FormResetProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
38
38
|
interface FormResetOptions<T extends ElementType = TagName> extends ButtonOptions<T> {
|
|
39
39
|
/**
|
|
40
40
|
* Object returned by the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-reset.d.ts","names":["Props","ElementType","ButtonOptions","FormStore","TagName","useFormReset","FormResetOptions","Hook","FormReset","FormResetProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/form/form-reset.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;AAa7B;;AAfiD,cAe5BC,YAAAA,iCAA6CE,IAAAA,WAAeD,gBAAgB;;AAAA;AAgBjG;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"form-reset.d.ts","names":["Props","ElementType","ButtonOptions","FormStore","TagName","useFormReset","FormResetOptions","Hook","FormReset","FormResetProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/form/form-reset.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;AAa7B;;AAfiD,cAe5BC,YAAAA,iCAA6CE,IAAAA,WAAeD,gBAAgB;;AAAA;AAgBjG;;;;;;;;;AAA+I;AAC/I;;;cADqBE,SAAAA,GAAYE,KAAAA,EAAOD,cAAc,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACzGN,gBAAAA,WAA2BL,WAAAA,GAAcG,OAAAA,UAAiBF,aAAAA,CAAcW,CAAAA;EAAAA;;;;;;;EAQrFC,KAAAA,GAAQX,SAAAA;AAAAA;AAAAA,KAEAM,cAAAA,WAAyBR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,gBAAAA,CAAiBO,CAAAA"}
|
package/dist/form/form-reset.js
CHANGED
|
@@ -21,7 +21,7 @@ const TagName = "button";
|
|
|
21
21
|
const useFormReset = createHook(function useFormReset({ store, ...props }) {
|
|
22
22
|
const context = useFormContext();
|
|
23
23
|
store = store || context;
|
|
24
|
-
invariant(store, "FormReset must be wrapped in a Form component.");
|
|
24
|
+
invariant(store, process.env.NODE_ENV !== "production" && "FormReset must be wrapped in a Form component.");
|
|
25
25
|
props = {
|
|
26
26
|
type: "reset",
|
|
27
27
|
disabled: useStoreState(store, "submitting"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-reset.js","names":[],"sources":["../../src/form/form-reset.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { createElement, createHook, forwardRef } from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { invariant } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport type { ButtonOptions } from \"../button/button.tsx\";\nimport { useButton } from \"../button/button.tsx\";\nimport { useFormContext } from \"./form-context.tsx\";\nimport type { FormStore } from \"./form-store.ts\";\n\nconst TagName = \"button\" satisfies ElementType;\ntype TagName = typeof TagName;\n\n/**\n * Returns props to create a `FormReset` component.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx\n * const store = useFormStore();\n * const props = useFormReset({ store });\n * <Form store={store}>\n * <Role {...props}>Reset</Role>\n * </Form>\n * ```\n */\nexport const useFormReset = createHook<TagName, FormResetOptions>(\n function useFormReset({ store, ...props }) {\n const context = useFormContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"FormReset must be wrapped in a Form component.\",\n );\n\n props = {\n type: \"reset\",\n disabled: useStoreState(store, \"submitting\"),\n ...props,\n };\n\n props = useButton(props);\n\n return props;\n },\n);\n\n/**\n * Renders a button that resets the form to its initial values, as defined by\n * the\n * [`defaultValues`](https://ariakit.com/reference/use-form-store#defaultvalues)\n * prop given to the form store.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx {4}\n * const form = useFormStore();\n *\n * <Form store={form}>\n * <FormReset>Reset</FormReset>\n * </Form>\n * ```\n */\nexport const FormReset = forwardRef(function FormReset(props: FormResetProps) {\n const htmlProps = useFormReset(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface FormResetOptions<\n T extends ElementType = TagName,\n> extends ButtonOptions<T> {\n /**\n * Object returned by the\n * [`useFormStore`](https://ariakit.com/reference/use-form-store) hook. If not\n * provided, the closest [`Form`](https://ariakit.com/reference/form) or\n * [`FormProvider`](https://ariakit.com/reference/form-provider) components'\n * context will be used.\n */\n store?: FormStore;\n}\n\nexport type FormResetProps<T extends ElementType = TagName> = Props<\n T,\n FormResetOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;MA2BI,eAAgB,WAAe,SAAA,aAAA,EAAA,OAAA,GAAA,SAAA;CAC/B,MAAA,UAAQ,eAAS;CAEjB,QAAA,
|
|
1
|
+
{"version":3,"file":"form-reset.js","names":[],"sources":["../../src/form/form-reset.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { createElement, createHook, forwardRef } from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { invariant } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport type { ButtonOptions } from \"../button/button.tsx\";\nimport { useButton } from \"../button/button.tsx\";\nimport { useFormContext } from \"./form-context.tsx\";\nimport type { FormStore } from \"./form-store.ts\";\n\nconst TagName = \"button\" satisfies ElementType;\ntype TagName = typeof TagName;\n\n/**\n * Returns props to create a `FormReset` component.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx\n * const store = useFormStore();\n * const props = useFormReset({ store });\n * <Form store={store}>\n * <Role {...props}>Reset</Role>\n * </Form>\n * ```\n */\nexport const useFormReset = createHook<TagName, FormResetOptions>(\n function useFormReset({ store, ...props }) {\n const context = useFormContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"FormReset must be wrapped in a Form component.\",\n );\n\n props = {\n type: \"reset\",\n disabled: useStoreState(store, \"submitting\"),\n ...props,\n };\n\n props = useButton(props);\n\n return props;\n },\n);\n\n/**\n * Renders a button that resets the form to its initial values, as defined by\n * the\n * [`defaultValues`](https://ariakit.com/reference/use-form-store#defaultvalues)\n * prop given to the form store.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx {4}\n * const form = useFormStore();\n *\n * <Form store={form}>\n * <FormReset>Reset</FormReset>\n * </Form>\n * ```\n */\nexport const FormReset = forwardRef(function FormReset(props: FormResetProps) {\n const htmlProps = useFormReset(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface FormResetOptions<\n T extends ElementType = TagName,\n> extends ButtonOptions<T> {\n /**\n * Object returned by the\n * [`useFormStore`](https://ariakit.com/reference/use-form-store) hook. If not\n * provided, the closest [`Form`](https://ariakit.com/reference/form) or\n * [`FormProvider`](https://ariakit.com/reference/form-provider) components'\n * context will be used.\n */\n store?: FormStore;\n}\n\nexport type FormResetProps<T extends ElementType = TagName> = Props<\n T,\n FormResetOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;MA2BI,eAAgB,WAAe,SAAA,aAAA,EAAA,OAAA,GAAA,SAAA;CAC/B,MAAA,UAAQ,eAAS;CAEjB,QAAA,SAEE;CAIF,UAAQ,OAAA,QAAA,IAAA,aAAA,gBAAA,gDAAA;SACA;EACN,MAAA;EACA,UAAG,cAAA,OAAA,YAAA;EACL,GAAA;CAEA;CAEA,QAAO,UAAA,KAAA;CAEX,OAAA;;;;;;;;;;;;;;;;;MAmBE,YAAO,WAAc,SADH,UAAa,OACQ;CACxC,OAAA,cAAA,SAAA,aAAA,KAAA,CAAA"}
|
|
@@ -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 FormStore } from "../form-store-C4Kf5QHm.js";
|
|
3
3
|
import { Props } from "@ariakit/react-utils";
|
|
4
4
|
import { ElementType } from "react";
|
|
@@ -36,7 +36,7 @@ declare const useFormSubmit: import("@ariakit/react-utils").Hook<"button", FormS
|
|
|
36
36
|
* </Form>
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
declare const FormSubmit: (props: FormSubmitProps) => import("react").ReactElement<
|
|
39
|
+
declare const FormSubmit: (props: FormSubmitProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
40
40
|
interface FormSubmitOptions<T extends ElementType = TagName> extends ButtonOptions<T> {
|
|
41
41
|
/**
|
|
42
42
|
* Object returned by the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-submit.d.ts","names":["Props","ElementType","ButtonOptions","FormStore","TagName","useFormSubmit","FormSubmitOptions","Hook","FormSubmit","FormSubmitProps","props","ReactElement","JSXElementConstructor","T","store","accessibleWhenDisabled"],"sources":["../../src/form/form-submit.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;AAa7B;;AAfiD,cAe5BC,aAAAA,iCAA8CE,IAAAA,WAAeD,iBAAiB;;AAAA;AAkBnG;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"form-submit.d.ts","names":["Props","ElementType","ButtonOptions","FormStore","TagName","useFormSubmit","FormSubmitOptions","Hook","FormSubmit","FormSubmitProps","props","ReactElement","JSXElementConstructor","T","store","accessibleWhenDisabled"],"sources":["../../src/form/form-submit.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;AAa7B;;AAfiD,cAe5BC,aAAAA,iCAA8CE,IAAAA,WAAeD,iBAAiB;;AAAA;AAkBnG;;;;;;;;;AAAiJ;AACjJ;;;;;cADqBE,UAAAA,GAAaE,KAAAA,EAAOD,eAAe,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UAC3GN,iBAAAA,WAA4BL,WAAAA,GAAcG,OAAAA,UAAiBF,aAAAA,CAAcW,CAAAA;EAY/CA;;;;;;;EAJvCC,KAAAA,GAAQX,SAAAA;EARgED;;;EAYxEa,sBAAAA,GAAyBb,aAAAA,CAAcW,CAAAA;AAAAA;AAAAA,KAE/BJ,eAAAA,WAA0BR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,iBAAAA,CAAkBO,CAAAA"}
|
package/dist/form/form-submit.js
CHANGED
|
@@ -21,7 +21,7 @@ const TagName = "button";
|
|
|
21
21
|
const useFormSubmit = createHook(function useFormSubmit({ store, accessibleWhenDisabled = true, ...props }) {
|
|
22
22
|
const context = useFormContext();
|
|
23
23
|
store = store || context;
|
|
24
|
-
invariant(store, "FormSubmit must be wrapped in a Form component.");
|
|
24
|
+
invariant(store, process.env.NODE_ENV !== "production" && "FormSubmit must be wrapped in a Form component.");
|
|
25
25
|
props = {
|
|
26
26
|
type: "submit",
|
|
27
27
|
disabled: useStoreState(store, "submitting"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-submit.js","names":[],"sources":["../../src/form/form-submit.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { createElement, createHook, forwardRef } from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { invariant } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport type { ButtonOptions } from \"../button/button.tsx\";\nimport { useButton } from \"../button/button.tsx\";\nimport { useFormContext } from \"./form-context.tsx\";\nimport type { FormStore } from \"./form-store.ts\";\n\nconst TagName = \"button\" satisfies ElementType;\ntype TagName = typeof TagName;\n\n/**\n * Returns props to create a `FormReset` component.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx\n * const store = useFormStore();\n * const props = useFormSubmit({ store });\n * <Form store={store}>\n * <Role {...props}>Submit</Role>\n * </Form>\n * ```\n */\nexport const useFormSubmit = createHook<TagName, FormSubmitOptions>(\n function useFormSubmit({ store, accessibleWhenDisabled = true, ...props }) {\n const context = useFormContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"FormSubmit must be wrapped in a Form component.\",\n );\n\n props = {\n type: \"submit\",\n disabled: useStoreState(store, \"submitting\"),\n ...props,\n };\n\n props = useButton({ ...props, accessibleWhenDisabled });\n\n return props;\n },\n);\n\n/**\n * Renders a native submit button inside a form. The button will be\n * [`disabled`](https://ariakit.com/reference/form-submit#disabled) while the\n * form is submitting, but it will remain accessible to keyboard and screen\n * reader users thanks to the\n * [`accessibleWhenDisabled`](https://ariakit.com/reference/form-submit#accessiblewhendisabled)\n * prop that's enabled by default.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx {4}\n * const form = useFormStore();\n *\n * <Form store={form}>\n * <FormSubmit>Submit</FormSubmit>\n * </Form>\n * ```\n */\nexport const FormSubmit = forwardRef(function FormSubmit(\n props: FormSubmitProps,\n) {\n const htmlProps = useFormSubmit(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface FormSubmitOptions<\n T extends ElementType = TagName,\n> extends ButtonOptions<T> {\n /**\n * Object returned by the\n * [`useFormStore`](https://ariakit.com/reference/use-form-store) hook. If not\n * provided, the closest [`Form`](https://ariakit.com/reference/form) or\n * [`FormProvider`](https://ariakit.com/reference/form-provider) components'\n * context will be used.\n */\n store?: FormStore;\n /**\n * @default true\n */\n accessibleWhenDisabled?: ButtonOptions<T>[\"accessibleWhenDisabled\"];\n}\n\nexport type FormSubmitProps<T extends ElementType = TagName> = Props<\n T,\n FormSubmitOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;MA2BI,gBAAgB,WAAe,SAAA,cAAA,EAAA,OAAA,yBAAA,MAAA,GAAA,SAAA;CAC/B,MAAA,UAAQ,eAAS;CAEjB,QAAA,
|
|
1
|
+
{"version":3,"file":"form-submit.js","names":[],"sources":["../../src/form/form-submit.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { createElement, createHook, forwardRef } from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { invariant } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport type { ButtonOptions } from \"../button/button.tsx\";\nimport { useButton } from \"../button/button.tsx\";\nimport { useFormContext } from \"./form-context.tsx\";\nimport type { FormStore } from \"./form-store.ts\";\n\nconst TagName = \"button\" satisfies ElementType;\ntype TagName = typeof TagName;\n\n/**\n * Returns props to create a `FormReset` component.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx\n * const store = useFormStore();\n * const props = useFormSubmit({ store });\n * <Form store={store}>\n * <Role {...props}>Submit</Role>\n * </Form>\n * ```\n */\nexport const useFormSubmit = createHook<TagName, FormSubmitOptions>(\n function useFormSubmit({ store, accessibleWhenDisabled = true, ...props }) {\n const context = useFormContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"FormSubmit must be wrapped in a Form component.\",\n );\n\n props = {\n type: \"submit\",\n disabled: useStoreState(store, \"submitting\"),\n ...props,\n };\n\n props = useButton({ ...props, accessibleWhenDisabled });\n\n return props;\n },\n);\n\n/**\n * Renders a native submit button inside a form. The button will be\n * [`disabled`](https://ariakit.com/reference/form-submit#disabled) while the\n * form is submitting, but it will remain accessible to keyboard and screen\n * reader users thanks to the\n * [`accessibleWhenDisabled`](https://ariakit.com/reference/form-submit#accessiblewhendisabled)\n * prop that's enabled by default.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx {4}\n * const form = useFormStore();\n *\n * <Form store={form}>\n * <FormSubmit>Submit</FormSubmit>\n * </Form>\n * ```\n */\nexport const FormSubmit = forwardRef(function FormSubmit(\n props: FormSubmitProps,\n) {\n const htmlProps = useFormSubmit(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface FormSubmitOptions<\n T extends ElementType = TagName,\n> extends ButtonOptions<T> {\n /**\n * Object returned by the\n * [`useFormStore`](https://ariakit.com/reference/use-form-store) hook. If not\n * provided, the closest [`Form`](https://ariakit.com/reference/form) or\n * [`FormProvider`](https://ariakit.com/reference/form-provider) components'\n * context will be used.\n */\n store?: FormStore;\n /**\n * @default true\n */\n accessibleWhenDisabled?: ButtonOptions<T>[\"accessibleWhenDisabled\"];\n}\n\nexport type FormSubmitProps<T extends ElementType = TagName> = Props<\n T,\n FormSubmitOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;MA2BI,gBAAgB,WAAe,SAAA,cAAA,EAAA,OAAA,yBAAA,MAAA,GAAA,SAAA;CAC/B,MAAA,UAAQ,eAAS;CAEjB,QAAA,SAEE;CAIF,UAAQ,OAAA,QAAA,IAAA,aAAA,gBAAA,iDAAA;SACA;EACN,MAAA;EACA,UAAG,cAAA,OAAA,YAAA;EACL,GAAA;CAEA;SAAuB,UAAA;EAAO,GAAA;EAAwB;CAEtD,CAAA;CAEJ,OAAA;;;;;;;;;;;;;;;;;;;MAuBE,aAAO,WAAc,SADH,WACoB,OAAC;CACxC,OAAA,cAAA,SAAA,cAAA,KAAA,CAAA"}
|
package/dist/form/form.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ declare const useForm: import("@ariakit/react-utils").Hook<"form", FormOptions<"
|
|
|
46
46
|
* </Form>
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
declare const Form: (props: FormProps) => import("react").ReactElement<
|
|
49
|
+
declare const Form: (props: FormProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
50
50
|
interface FormOptions<_T extends ElementType = TagName> extends Options {
|
|
51
51
|
/**
|
|
52
52
|
* Object returned by the
|
package/dist/form/form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","names":["Options","Props","ElementType","FormStore","TagName","useForm","FormOptions","Hook","Form","FormProps","props","ReactElement","JSXElementConstructor","_T","store","validateOnChange","validateOnBlur","resetOnUnmount","resetOnSubmit","autoFocusOnSubmit","T"],"sources":["../../src/form/form.d.ts"],"mappings":";;;;;cAGcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;AAFoB,cAa5BC,OAAAA,iCAAwCE,IAAAA,SAAaD,WAAW;;;;AAAA;AA+BrF;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"form.d.ts","names":["Options","Props","ElementType","FormStore","TagName","useForm","FormOptions","Hook","Form","FormProps","props","ReactElement","JSXElementConstructor","_T","store","validateOnChange","validateOnBlur","resetOnUnmount","resetOnSubmit","autoFocusOnSubmit","T"],"sources":["../../src/form/form.d.ts"],"mappings":";;;;;cAGcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;AAFoB,cAa5BC,OAAAA,iCAAwCE,IAAAA,SAAaD,WAAW;;;;AAAA;AA+BrF;;;;;;;;;AAAqI;AACrI;;;;;;;;;;;;;;;;cADqBE,IAAAA,GAAOE,KAAAA,EAAOD,SAAS,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UAC/FN,WAAAA,YAAuBJ,WAAAA,GAAcE,OAAAA,UAAiBJ,OAAAA;EAwCnEkB;;;AAMiB;AAErB;;;EAxCIJ,KAAAA,GAAQX,SAAAA;EAwCkCC;;;;;;;;EA/B1CW,gBAAAA;EA+B0CX;;;;;;AAAiC;EAvB3EY,cAAAA;;;;;;;;EAQAC,cAAAA;;;;;;;EAOAC,aAAAA;;;;;;EAMAC,iBAAAA;AAAAA;AAAAA,KAEQV,SAAAA,WAAoBP,WAAAA,GAAcE,OAAAA,IAAWH,KAAAA,CAAMmB,CAAAA,EAAGd,WAAAA,CAAYc,CAAAA"}
|
package/dist/form/form.js
CHANGED
|
@@ -26,7 +26,7 @@ function getFirstInvalidField(items) {
|
|
|
26
26
|
const useForm = createHook(function useForm({ store, validateOnChange = true, validateOnBlur = true, resetOnUnmount = false, resetOnSubmit = true, autoFocusOnSubmit = true, ...props }) {
|
|
27
27
|
const context = useFormContext();
|
|
28
28
|
store = store || context;
|
|
29
|
-
invariant(store, "Form must receive a `store` prop or be wrapped in a FormProvider component.");
|
|
29
|
+
invariant(store, process.env.NODE_ENV !== "production" && "Form must receive a `store` prop or be wrapped in a FormProvider component.");
|
|
30
30
|
const ref = useRef(null);
|
|
31
31
|
const values = useStoreState(store, "values");
|
|
32
32
|
const submitSucceed = useStoreState(store, "submitSucceed");
|
package/dist/form/form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","names":[],"sources":["../../src/form/form.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport {\n useEvent,\n useInitialValue,\n useMergeRefs,\n useTagName,\n useUpdateEffect,\n useWrapElement,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Options, Props } from \"@ariakit/react-utils\";\nimport { isTextField, invariant } from \"@ariakit/utils\";\nimport type { ElementType, FocusEvent, FormEvent } from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { FormScopedContextProvider, useFormContext } from \"./form-context.tsx\";\nimport type { FormStore, FormStoreState } from \"./form-store.ts\";\n\nconst TagName = \"form\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\nfunction isField(element: HTMLElement, items: FormStoreState[\"items\"]) {\n return items.some(\n (item) => item.type === \"field\" && item.element === element,\n );\n}\n\nfunction getFirstInvalidField(items: FormStoreState[\"items\"]) {\n return items.find(\n (item) =>\n item.type === \"field\" &&\n item.element?.getAttribute(\"aria-invalid\") === \"true\",\n );\n}\n\n/**\n * Returns props to create a `Form` component.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx\n * const store = useFormStore();\n * const props = useForm({ store, render: <form /> });\n * <Role {...props} />\n * ```\n */\nexport const useForm = createHook<TagName, FormOptions>(function useForm({\n store,\n validateOnChange = true,\n validateOnBlur = true,\n resetOnUnmount = false,\n resetOnSubmit = true,\n autoFocusOnSubmit = true,\n ...props\n}) {\n const context = useFormContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"Form must receive a `store` prop or be wrapped in a FormProvider component.\",\n );\n\n const ref = useRef<HTMLType>(null);\n const values = useStoreState(store, \"values\");\n const submitSucceed = useStoreState(store, \"submitSucceed\");\n const submitFailed = useStoreState(store, \"submitFailed\");\n const items = useStoreState(store, \"items\");\n const defaultValues = useInitialValue(values);\n\n useEffect(\n () => (resetOnUnmount ? store?.reset : undefined),\n [resetOnUnmount, store],\n );\n\n useUpdateEffect(() => {\n if (!validateOnChange) return;\n if (values === defaultValues) return;\n void store?.validate();\n }, [validateOnChange, values, defaultValues, store]);\n\n useEffect(() => {\n if (!resetOnSubmit) return;\n if (!submitSucceed) return;\n store?.reset();\n }, [resetOnSubmit, submitSucceed, store]);\n\n const [shouldFocusOnSubmit, setShouldFocusOnSubmit] = useState(false);\n\n useEffect(() => {\n if (!shouldFocusOnSubmit) return;\n if (!submitFailed) return;\n const field = getFirstInvalidField(items);\n const element = field?.element;\n if (!element) return;\n setShouldFocusOnSubmit(false);\n element.focus();\n if (isTextField(element)) {\n element.select();\n }\n // oxlint-disable-next-line exhaustive-deps\n }, [autoFocusOnSubmit, submitFailed, items]);\n\n const onSubmitProp = props.onSubmit;\n\n const onSubmit = useEvent((event:
|
|
1
|
+
{"version":3,"file":"form.js","names":[],"sources":["../../src/form/form.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport {\n useEvent,\n useInitialValue,\n useMergeRefs,\n useTagName,\n useUpdateEffect,\n useWrapElement,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Options, Props } from \"@ariakit/react-utils\";\nimport { isTextField, invariant } from \"@ariakit/utils\";\nimport type { ElementType, FocusEvent, FormEvent } from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { FormScopedContextProvider, useFormContext } from \"./form-context.tsx\";\nimport type { FormStore, FormStoreState } from \"./form-store.ts\";\n\nconst TagName = \"form\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\nfunction isField(element: HTMLElement, items: FormStoreState[\"items\"]) {\n return items.some(\n (item) => item.type === \"field\" && item.element === element,\n );\n}\n\nfunction getFirstInvalidField(items: FormStoreState[\"items\"]) {\n return items.find(\n (item) =>\n item.type === \"field\" &&\n item.element?.getAttribute(\"aria-invalid\") === \"true\",\n );\n}\n\n/**\n * Returns props to create a `Form` component.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx\n * const store = useFormStore();\n * const props = useForm({ store, render: <form /> });\n * <Role {...props} />\n * ```\n */\nexport const useForm = createHook<TagName, FormOptions>(function useForm({\n store,\n validateOnChange = true,\n validateOnBlur = true,\n resetOnUnmount = false,\n resetOnSubmit = true,\n autoFocusOnSubmit = true,\n ...props\n}) {\n const context = useFormContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"Form must receive a `store` prop or be wrapped in a FormProvider component.\",\n );\n\n const ref = useRef<HTMLType>(null);\n const values = useStoreState(store, \"values\");\n const submitSucceed = useStoreState(store, \"submitSucceed\");\n const submitFailed = useStoreState(store, \"submitFailed\");\n const items = useStoreState(store, \"items\");\n const defaultValues = useInitialValue(values);\n\n useEffect(\n () => (resetOnUnmount ? store?.reset : undefined),\n [resetOnUnmount, store],\n );\n\n useUpdateEffect(() => {\n if (!validateOnChange) return;\n if (values === defaultValues) return;\n void store?.validate();\n }, [validateOnChange, values, defaultValues, store]);\n\n useEffect(() => {\n if (!resetOnSubmit) return;\n if (!submitSucceed) return;\n store?.reset();\n }, [resetOnSubmit, submitSucceed, store]);\n\n const [shouldFocusOnSubmit, setShouldFocusOnSubmit] = useState(false);\n\n useEffect(() => {\n if (!shouldFocusOnSubmit) return;\n if (!submitFailed) return;\n const field = getFirstInvalidField(items);\n const element = field?.element;\n if (!element) return;\n setShouldFocusOnSubmit(false);\n element.focus();\n if (isTextField(element)) {\n element.select();\n }\n // oxlint-disable-next-line exhaustive-deps\n }, [autoFocusOnSubmit, submitFailed, items]);\n\n const onSubmitProp = props.onSubmit;\n // React 19 types submit handlers with SubmitEvent instead of FormEvent.\n type SubmitEvent = Parameters<NonNullable<typeof onSubmitProp>>[0];\n\n const onSubmit = useEvent((event: SubmitEvent) => {\n onSubmitProp?.(event);\n if (event.defaultPrevented) return;\n event.preventDefault();\n void store?.submit();\n if (!autoFocusOnSubmit) return;\n setShouldFocusOnSubmit(true);\n });\n\n const onBlurProp = props.onBlur;\n\n const onBlur = useEvent((event: FocusEvent<HTMLType>) => {\n onBlurProp?.(event);\n if (event.defaultPrevented) return;\n if (!validateOnBlur) return;\n if (!store) return;\n if (!isField(event.target, store.getState().items)) return;\n void store.validate();\n });\n\n const onResetProp = props.onReset;\n\n const onReset = useEvent((event: FormEvent<HTMLType>) => {\n onResetProp?.(event);\n if (event.defaultPrevented) return;\n event.preventDefault();\n store?.reset();\n });\n\n props = useWrapElement(\n props,\n (element) => (\n <FormScopedContextProvider value={store}>\n {element}\n </FormScopedContextProvider>\n ),\n [store],\n );\n\n const tagName = useTagName(ref, TagName);\n\n props = {\n role: tagName !== \"form\" ? \"form\" : undefined,\n noValidate: true,\n ...props,\n ref: useMergeRefs(ref, props.ref),\n onSubmit,\n onBlur,\n onReset,\n };\n\n return props;\n});\n\n/**\n * Renders a form element and provides a [form\n * store](https://ariakit.com/reference/use-form-store) to its controls.\n *\n * The form is automatically validated on change and on blur. This behavior can\n * be disabled with the\n * [`validateOnChange`](https://ariakit.com/reference/form#validateonchange) and\n * [`validateOnBlur`](https://ariakit.com/reference/form#validateonblur) props.\n *\n * When the form is submitted with errors, the first invalid field is\n * automatically focused thanks to the\n * [`autoFocusOnSubmit`](https://ariakit.com/reference/form#autofocusonsubmit)\n * prop. If it's successful, the\n * [`resetOnSubmit`](https://ariakit.com/reference/form#resetonsubmit) prop\n * ensures the form is reset to its initial values as defined by the\n * [`defaultValues`](https://ariakit.com/reference/use-form-store#defaultvalues)\n * option on the [store](https://ariakit.com/reference/use-form-store).\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx {5-8}\n * const form = useFormStore({\n * defaultValues: { username: \"johndoe\" },\n * });\n *\n * <Form store={form}>\n * <FormLabel name={form.names.username}>Username</FormLabel>\n * <FormInput name={form.names.username} />\n * </Form>\n * ```\n */\nexport const Form = forwardRef(function Form(props: FormProps) {\n const htmlProps = useForm(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface FormOptions<_T extends ElementType = TagName> extends Options {\n /**\n * Object returned by the\n * [`useFormStore`](https://ariakit.com/reference/use-form-store) hook. If not\n * provided, the closest\n * [`FormProvider`](https://ariakit.com/reference/form-provider) component's\n * context will be used.\n */\n store?: FormStore;\n /**\n * Determines if the form should invoke the validation callbacks registered\n * with\n * [`useValidate`](https://ariakit.com/reference/use-form-store#usevalidate)\n * when the [`values`](https://ariakit.com/reference/use-form-store#values)\n * change.\n * @default true\n */\n validateOnChange?: boolean;\n /**\n * Determines if the form should invoke the validation callbacks registered\n * with\n * [`useValidate`](https://ariakit.com/reference/use-form-store#usevalidate)\n * when a field loses focus.\n * @default true\n */\n validateOnBlur?: boolean;\n /**\n * Determines if the form state should reset to its\n * [`defaultValues`](https://ariakit.com/reference/use-form-store#defaultvalues)\n * when the [`Form`](https://ariakit.com/reference/form) component is\n * unmounted.\n * @default false\n */\n resetOnUnmount?: boolean;\n /**\n * Determines if the form state should be reset to its\n * [`defaultValues`](https://ariakit.com/reference/use-form-store#defaultvalues)\n * upon successful form submission.\n * @default true\n */\n resetOnSubmit?: boolean;\n /**\n * Determines if the form should automatically focus on the first invalid\n * field when the form is submitted.\n * @default true\n */\n autoFocusOnSubmit?: boolean;\n}\n\nexport type FormProps<T extends ElementType = TagName> = Props<\n T,\n FormOptions<T>\n>;\n"],"mappings":";;;;;;;;AAuBA,MAAA,UAAS;SACA,QAAM,SACV,OAAS;CAEd,OAAA,MAAA,MAAA,SAAA,KAAA,SAAA,WAAA,KAAA,YAAA,OAAA;AAEA;SACS,qBAEH,OAAK;CAGX,OAAA,MAAA,MAAA,SAAA,KAAA,SAAA,WAAA,KAAA,SAAA,aAAA,cAAA,MAAA,MAAA;;;;;;;;;;;;MAqBE,UAAM,WAAU,SAAe,QAAA,EAAA,OAAA,mBAAA,MAAA,iBAAA,MAAA,iBAAA,OAAA,gBAAA,MAAA,oBAAA,MAAA,GAAA,SAAA;CAC/B,MAAA,UAAQ,eAAS;CAEjB,QAAA,SAEE;CAIF,UAAM,OAAM,QAAqB,IAAA,aAAA,gBAAA,6EAAA;CACjC,MAAM,MAAA,OAAS,IAAA;CACf,MAAM,SAAA,cAAgB,OAAc,QAAO;CAC3C,MAAM,gBAAe,cAAc,OAAO,eAAc;CACxD,MAAM,eAAQ,cAAqB,OAAO,cAAA;CAC1C,MAAM,QAAA,cAAgB,OAAA,OAAgB;CAEtC,MAAA,gBACS,gBAAiB,MAAO;CAIjC,gBAAA,iBAAsB,OAAA,QAAA,KAAA,GAAA,CAAA,gBAAA,KAAA,CAAA;uBACf;EACL,IAAI,CAAA,kBAAW;EACf,IAAK,WAAO,eAAS;EACvB,OAAG,SAAA;IAAC;EAAkB;EAAQ;EAAe;EAAM;CAEnD,CAAA;iBACO;EACL,IAAI,CAAC,eAAe;EACpB,IAAA,CAAA,eAAa;EACf,OAAG,MAAA;IAAC;EAAe;EAAe;EAAM;CAExC,CAAA;CAEA,MAAA,CAAA,qBAAgB,0BAAA,SAAA,KAAA;iBACT;EACL,IAAI,CAAC,qBAAc;EAEnB,IAAA,CAAA,cADc;EAEd,MAAK,UAAS,qBAAA,KAAA,GAAA;EACd,IAAA,CAAA,SAAA;EACA,uBAAc,KAAA;EACd,QAAI,MAAA;EAIN,IAAG,YAAA,OAAA,GAAA,QAAA,OAAA;IAAC;EAAmB;EAAc;EAAM;CAE3C,CAAA;CAIA,MAAM,eAAW,MAAU;OACzB,WAAe,UAAK,UAAA;EACpB,eAAU,KAAA;EACV,IAAA,MAAM,kBAAe;EACrB,MAAK,eAAc;EACnB,OAAK,OAAA;EACL,IAAA,CAAA,mBAAuB;EACxB,uBAAA,IAAA;CAED,CAAA;CAEA,MAAM,aAAS,MAAU;OACvB,SAAa,UAAK,UAAA;EAClB,aAAU,KAAA;EACV,IAAI,MAAC,kBAAgB;EACrB,IAAI,CAAC,gBAAO;EACZ,IAAI,CAAC,OAAA;EACL,IAAK,CAAA,QAAM,MAAS,QAAA,MAAA,SAAA,EAAA,KAAA,GAAA;EACrB,MAAA,SAAA;CAED,CAAA;CAEA,MAAM,cAAU,MAAU;OACxB,UAAc,UAAK,UAAA;EACnB,cAAU,KAAA;EACV,IAAA,MAAM,kBAAe;EACrB,MAAA,eAAa;EACd,OAAA,MAAA;CAED,CAAA;SAGsC,eAAA,QAAA,YAAA,oBAAA,2BAAA;;EAEP,UAG/B;CAIA,CAAA,GAAA,CAAA,KAAQ,CAAA;SAFQ;EAId,MAAA,WAAY,KAAA,OAAA,MAAA,SAAA,SAAA,KAAA;EACZ,YAAG;EACH,GAAA;EACA,KAAA,aAAA,KAAA,MAAA,GAAA;EACA;EACA;EACF;CAEA;CACD,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkCC,OAAO,WAAc,SADH,KAAA,OACqB;CACxC,OAAA,cAAA,SAAA,QAAA,KAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as useGroupLabel, n as GroupLabelOptions, r as GroupLabelProps, t as GroupLabel } from "../group-label-
|
|
1
|
+
import { i as useGroupLabel, n as GroupLabelOptions, r as GroupLabelProps, t as GroupLabel } from "../group-label-BKYqD4Sj.js";
|
|
2
2
|
export { GroupLabel, GroupLabelOptions, GroupLabelProps, useGroupLabel };
|
package/dist/group/group.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as useGroup, n as GroupOptions, r as GroupProps, t as Group } from "../group-
|
|
1
|
+
import { i as useGroup, n as GroupOptions, r as GroupProps, t as Group } from "../group-nGD9e6Dj.js";
|
|
2
2
|
export { Group, GroupOptions, GroupProps, useGroup };
|
|
@@ -29,9 +29,9 @@ declare const useGroupLabel: import("@ariakit/react-utils").Hook<"div", GroupLab
|
|
|
29
29
|
* </Group>
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
declare const GroupLabel: (props: GroupLabelProps) => import("react").ReactElement<
|
|
32
|
+
declare const GroupLabel: (props: GroupLabelProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
33
33
|
interface GroupLabelOptions<_T extends ElementType = TagName> extends Options {}
|
|
34
34
|
type GroupLabelProps<T extends ElementType = TagName> = Props<T, GroupLabelOptions<T>>;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { useGroupLabel as i, GroupLabelOptions as n, GroupLabelProps as r, GroupLabel as t };
|
|
37
|
-
//# sourceMappingURL=group-label-
|
|
37
|
+
//# sourceMappingURL=group-label-BKYqD4Sj.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-label-
|
|
1
|
+
{"version":3,"file":"group-label-BKYqD4Sj.d.ts","names":["Options","Props","ElementType","TagName","useGroupLabel","GroupLabelOptions","Hook","GroupLabel","GroupLabelProps","props","ReactElement","JSXElementConstructor","_T","T"],"sources":["../src/group/group-label.d.ts"],"mappings":";;;;cAEcG,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFY;;;;AACpB;AAAA;;;;AACQ;AAa7B;;AAfyC,cAepBC,aAAAA,iCAA8CE,IAAAA,QAAYD,iBAAiB;;AAAA;AAahG;;;;;;;;;AAAiJ;cAA5HE,UAAAA,GAAaE,KAAAA,EAAOD,eAAe,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UAC3GN,iBAAAA,YAA6BH,WAAAA,GAAcC,OAAAA,UAAiBH,OAAAA;AAAAA,KAEjEQ,eAAAA,WAA0BN,WAAAA,GAAcC,OAAAA,IAAWF,KAAAA,CAAMY,CAAAA,EAAGR,iBAAAA,CAAkBQ,CAAAA"}
|
|
@@ -24,9 +24,9 @@ declare const useGroup: import("@ariakit/react-utils").Hook<"div", Options>;
|
|
|
24
24
|
* <Group>Group</Group>
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
declare const Group: (props: GroupProps) => import("react").ReactElement<
|
|
27
|
+
declare const Group: (props: GroupProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
28
28
|
type GroupOptions<_T extends ElementType = TagName> = Options;
|
|
29
29
|
type GroupProps<T extends ElementType = TagName> = Props<T, GroupOptions<T>>;
|
|
30
30
|
//#endregion
|
|
31
31
|
export { useGroup as i, GroupOptions as n, GroupProps as r, Group as t };
|
|
32
|
-
//# sourceMappingURL=group-
|
|
32
|
+
//# sourceMappingURL=group-nGD9e6Dj.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-
|
|
1
|
+
{"version":3,"file":"group-nGD9e6Dj.d.ts","names":["Options","Props","ElementType","TagName","useGroup","Hook","Group","GroupProps","props","ReactElement","JSXElementConstructor","GroupOptions","_T","T"],"sources":["../src/group/group.d.ts"],"mappings":";;;;cAEcG,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFY;;;;AACpB;AAAA;;;;AADoB,cAYpBC,QAAAA,iCAAyCC,IAAAA,QAAYL,OAAO;AAAjF;;;;AAAiF;AAWjF;;;;;AAXA,cAWqBM,KAAAA,GAAQE,KAAAA,EAAOD,UAAU,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,KACtGC,YAAAA,YAAwBT,WAAAA,GAAcC,OAAAA,IAAWH,OAAAA;AAAAA,KACjDO,UAAAA,WAAqBL,WAAAA,GAAcC,OAAAA,IAAWF,KAAAA,CAAMY,CAAAA,EAAGF,YAAAA,CAAaE,CAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as useHeading, n as HeadingOptions, r as HeadingProps, t as Heading } from "../heading-
|
|
1
|
+
import { i as useHeading, n as HeadingOptions, r as HeadingProps, t as Heading } from "../heading-D_AmeqL5.js";
|
|
2
2
|
export { Heading, HeadingOptions, HeadingProps, useHeading };
|
package/dist/heading/heading.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { HeadingContext } from "./heading-context.js";
|
|
3
3
|
import { createElement, createHook, forwardRef, useMergeRefs, useTagName } from "@ariakit/react-utils";
|
|
4
|
-
import { useContext,
|
|
4
|
+
import { useContext, useRef } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/heading/heading.tsx
|
|
7
7
|
const TagName = "h1";
|
|
@@ -21,7 +21,7 @@ const useHeading = createHook(function useHeading(props) {
|
|
|
21
21
|
const level = useContext(HeadingContext) || 1;
|
|
22
22
|
const Element = `h${level}`;
|
|
23
23
|
const tagName = useTagName(ref, Element);
|
|
24
|
-
const isNativeHeading =
|
|
24
|
+
const isNativeHeading = !!tagName && /^h\d$/.test(tagName);
|
|
25
25
|
props = {
|
|
26
26
|
render: /* @__PURE__ */ jsx(Element, {}),
|
|
27
27
|
role: !isNativeHeading ? "heading" : void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.js","names":[],"sources":["../../src/heading/heading.tsx"],"sourcesContent":["import {\n useMergeRefs,\n useTagName,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Options, Props } from \"@ariakit/react-utils\";\nimport type { ElementType } from \"react\";\nimport { useContext,
|
|
1
|
+
{"version":3,"file":"heading.js","names":[],"sources":["../../src/heading/heading.tsx"],"sourcesContent":["import {\n useMergeRefs,\n useTagName,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Options, Props } from \"@ariakit/react-utils\";\nimport type { ElementType } from \"react\";\nimport { useContext, useRef } from \"react\";\nimport { HeadingContext } from \"./heading-context.tsx\";\nimport type { HeadingLevels } from \"./utils.ts\";\n\ntype HeadingElements = `h${HeadingLevels}`;\nconst TagName = \"h1\" satisfies ElementType;\ntype TagName = HeadingElements;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\n/**\n * Returns props to create a `Heading` component. The element type (or the\n * `aria-level` prop, if the element type is not a native heading) is determined\n * by the context level provided by the parent `HeadingLevel` component.\n * @see https://ariakit.com/components/heading\n * @example\n * ```jsx\n * const props = useHeading();\n * <Role {...props}>Heading</Role>\n * ```\n */\nexport const useHeading = createHook<TagName, HeadingOptions>(\n function useHeading(props) {\n const ref = useRef<HTMLType>(null);\n const level: HeadingLevels = useContext(HeadingContext) || 1;\n const Element = `h${level}` as const;\n const tagName = useTagName(ref, Element);\n const isNativeHeading = !!tagName && /^h\\d$/.test(tagName);\n\n props = {\n render: <Element />,\n role: !isNativeHeading ? \"heading\" : undefined,\n \"aria-level\": !isNativeHeading ? level : undefined,\n ...props,\n ref: useMergeRefs(ref, props.ref),\n };\n\n return props;\n },\n);\n\n/**\n * Renders a heading element. The element type (or the `aria-level` attribute,\n * if the element type is not a native heading) is determined by the context\n * level provided by the closest\n * [`HeadingLevel`](https://ariakit.com/reference/heading-level) ancestor.\n * @see https://ariakit.com/components/heading\n * @example\n * ```jsx\n * <HeadingLevel>\n * <Heading>Heading 1</Heading>\n * <HeadingLevel>\n * <Heading>Heading 2</Heading>\n * </HeadingLevel>\n * </HeadingLevel>\n * ```\n */\nexport const Heading = forwardRef(function Heading(props: HeadingProps) {\n const htmlProps = useHeading(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface HeadingOptions<\n _T extends ElementType = TagName,\n> extends Options {}\n\nexport type HeadingProps<T extends ElementType = TagName> = Props<\n T,\n HeadingOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;MA+BI,aAAY,WAAqB,SAAA,WAAA,OAAA;CACjC,MAAM,MAAA,OAAuB,IAAA;CAC7B,MAAM,QAAA,WAAc,cAAA,KAAA;CACpB,MAAM,UAAU,IAAA;CAChB,MAAM,UAAA,WAAoB,KAAA,OAAW;CAErC,MAAA,kBAAQ,CAAA,CAAA,WAAA,QAAA,KAAA,OAAA;SACN;EACA,QAAO,oBAAkB,SAAY,CAAA,CAAA;EACrC,MAAA,CAAA,kBAAe,YAAkB,KAAQ;EACzC,cAAG,CAAA,kBAAA,QAAA,KAAA;EACH,GAAA;EACF,KAAA,aAAA,KAAA,MAAA,GAAA;CAEA;CAEJ,OAAA;;;;;;;;;;;;;;;;;;MAoBE,UAAO,WAAc,SADH,QAAW,OACU;CACxC,OAAA,cAAA,SAAA,WAAA,KAAA,CAAA"}
|
|
@@ -34,9 +34,9 @@ declare const useHeading: import("@ariakit/react-utils").Hook<"h1" | "h2" | "h3"
|
|
|
34
34
|
* </HeadingLevel>
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
declare const Heading: (props: HeadingProps) => import("react").ReactElement<
|
|
37
|
+
declare const Heading: (props: HeadingProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
38
38
|
interface HeadingOptions<_T extends ElementType = TagName> extends Options {}
|
|
39
39
|
type HeadingProps<T extends ElementType = TagName> = Props<T, HeadingOptions<T>>;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { useHeading as i, HeadingOptions as n, HeadingProps as r, Heading as t };
|
|
42
|
-
//# sourceMappingURL=heading-
|
|
42
|
+
//# sourceMappingURL=heading-D_AmeqL5.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading-
|
|
1
|
+
{"version":3,"file":"heading-D_AmeqL5.d.ts","names":["Options","Props","ElementType","HeadingLevels","HeadingElements","TagName","useHeading","HeadingOptions","Hook","Heading","HeadingProps","props","ReactElement","JSXElementConstructor","_T","T"],"sources":["../src/heading/heading.d.ts"],"mappings":";;;;;KAGKI,eAAAA,OAAsBD,aAAa;AAAA,cAC1BE,OAAAA;AAAAA,KACTA,OAAAA,GAAUD,eAAe;;;;AAFU;AAAA;;;;AACnB;AAAA;;cAaAE,UAAAA,iCAA2CE,IAAAA,0CAA8CD,cAAc;;AAZ9F;AAY9B;;;;AAA4H;AAiB5H;;;;;;;;;cAAqBE,OAAAA,GAAUE,KAAAA,EAAOD,YAAY,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACrGN,cAAAA,YAA0BL,WAAAA,GAAcG,OAAAA,UAAiBL,OAAAA;AAAAA,KAE9DU,YAAAA,WAAuBR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMc,CAAAA,EAAGR,cAAAA,CAAeQ,CAAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as FocusableOptions } from "../focusable-
|
|
1
|
+
import { n as FocusableOptions } from "../focusable-dBZH13-T.js";
|
|
2
2
|
import { t as HovercardStore } from "../hovercard-store-gIeoQEn_.js";
|
|
3
3
|
import { Props } from "@ariakit/react-utils";
|
|
4
4
|
import { ElementType, MouseEvent } from "react";
|
|
@@ -31,7 +31,7 @@ declare const useHovercardAnchor: import("@ariakit/react-utils").Hook<"a", Hover
|
|
|
31
31
|
* </HovercardProvider>
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
declare const HovercardAnchor: (props: HovercardAnchorProps) => import("react").ReactElement<
|
|
34
|
+
declare const HovercardAnchor: (props: HovercardAnchorProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
35
35
|
interface HovercardAnchorOptions<T extends ElementType = TagName> extends FocusableOptions<T> {
|
|
36
36
|
/**
|
|
37
37
|
* Object returned by the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hovercard-anchor.d.ts","names":["Props","BooleanOrCallback","ElementType","MouseEvent","ReactMouseEvent","FocusableOptions","HovercardStore","TagName","useHovercardAnchor","HovercardAnchorOptions","Hook","HovercardAnchor","HovercardAnchorProps","props","ReactElement","JSXElementConstructor","T","HTMLElement","store","showOnHover"],"sources":["../../src/hovercard/hovercard-anchor.d.ts"],"mappings":";;;;;;;cAKcO,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF8B;;;;AACtC;AAAA;;;;AACQ;AAY7B;AAd2D,cActCC,kBAAAA,iCAAmDE,IAAAA,MAAUD,sBAAsB;;;AAAA;AAaxG;;;;;;;;;cAAqBE,eAAAA,GAAkBE,KAAAA,EAAOD,oBAAoB,qBAAqBE,YAAAA
|
|
1
|
+
{"version":3,"file":"hovercard-anchor.d.ts","names":["Props","BooleanOrCallback","ElementType","MouseEvent","ReactMouseEvent","FocusableOptions","HovercardStore","TagName","useHovercardAnchor","HovercardAnchorOptions","Hook","HovercardAnchor","HovercardAnchorProps","props","ReactElement","JSXElementConstructor","T","HTMLElement","store","showOnHover"],"sources":["../../src/hovercard/hovercard-anchor.d.ts"],"mappings":";;;;;;;cAKcO,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF8B;;;;AACtC;AAAA;;;;AACQ;AAY7B;AAd2D,cActCC,kBAAAA,iCAAmDE,IAAAA,MAAUD,sBAAsB;;;AAAA;AAaxG;;;;;;;;;cAAqBE,eAAAA,GAAkBE,KAAAA,EAAOD,oBAAoB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACrHN,sBAAAA,WAAiCP,WAAAA,GAAcK,OAAAA,UAAiBF,gBAAAA,CAAiBW,CAAAA;EAA3D;;;;;;;EAQnCE,KAAAA,GAAQZ,cAAAA;EAWML;;;;;;;;;;EAAdkB,WAAAA,GAAclB,iBAAAA,CAAkBG,UAAAA,CAAgBa,WAAAA;AAAAA;AAAAA,KAExCL,oBAAAA,WAA+BV,WAAAA,GAAcK,OAAAA,IAAWP,KAAAA,CAAMgB,CAAAA,EAAGP,sBAAAA,CAAuBO,CAAAA"}
|
|
@@ -20,7 +20,7 @@ const TagName = "a";
|
|
|
20
20
|
const useHovercardAnchor = createHook(function useHovercardAnchor({ store, showOnHover = true, ...props }) {
|
|
21
21
|
const context = useHovercardProviderContext();
|
|
22
22
|
store = store || context;
|
|
23
|
-
invariant(store, "HovercardAnchor must receive a `store` prop or be wrapped in a HovercardProvider component.");
|
|
23
|
+
invariant(store, process.env.NODE_ENV !== "production" && "HovercardAnchor must receive a `store` prop or be wrapped in a HovercardProvider component.");
|
|
24
24
|
const disabled = disabledFromProps(props);
|
|
25
25
|
const showTimeoutRef = useRef(0);
|
|
26
26
|
useEffect(() => () => window.clearTimeout(showTimeoutRef.current), []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hovercard-anchor.js","names":[],"sources":["../../src/hovercard/hovercard-anchor.tsx"],"sourcesContent":["import {\n useBooleanEvent,\n useEvent,\n useIsMouseMoving,\n useMergeRefs,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport {\n addGlobalEventListener,\n disabledFromProps,\n invariant,\n} from \"@ariakit/utils\";\nimport type { BooleanOrCallback } from \"@ariakit/utils\";\nimport type { ElementType, MouseEvent as ReactMouseEvent } from \"react\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport type { FocusableOptions } from \"../focusable/focusable.tsx\";\nimport { useFocusable } from \"../focusable/focusable.tsx\";\nimport { useHovercardProviderContext } from \"./hovercard-context.tsx\";\nimport type { HovercardStore } from \"./hovercard-store.ts\";\n\nconst TagName = \"a\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\n/**\n * Returns props to create a `HovercardAnchor` component.\n * @see https://ariakit.com/components/hovercard\n * @example\n * ```jsx\n * const store = useHovercardStore();\n * const props = useHovercardAnchor({ store });\n * <Role {...props} render={<a />}>@username</Role>\n * <Hovercard store={store}>Details</Hovercard>\n * ```\n */\nexport const useHovercardAnchor = createHook<TagName, HovercardAnchorOptions>(\n function useHovercardAnchor({ store, showOnHover = true, ...props }) {\n const context = useHovercardProviderContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"HovercardAnchor must receive a `store` prop or be wrapped in a HovercardProvider component.\",\n );\n\n const disabled = disabledFromProps(props);\n const showTimeoutRef = useRef(0);\n\n // Clear the show timeout if the anchor is unmounted\n useEffect(() => () => window.clearTimeout(showTimeoutRef.current), []);\n\n // Clear the show timeout if the mouse leaves the anchor element. We're\n // using the native mouseleave event instead of React's onMouseLeave so we\n // bypass the event.stopPropagation() logic set on the Hovercard component\n // for when the mouse is moving toward the Hovercard.\n useEffect(() => {\n const onMouseLeave = (event: MouseEvent) => {\n if (!store) return;\n const { anchorElement } = store.getState();\n if (!anchorElement) return;\n if (event.target !== anchorElement) return;\n window.clearTimeout(showTimeoutRef.current);\n showTimeoutRef.current = 0;\n };\n return addGlobalEventListener(\"mouseleave\", onMouseLeave, true);\n }, [store]);\n\n const onMouseMoveProp = props.onMouseMove;\n const showOnHoverProp = useBooleanEvent(showOnHover);\n const isMouseMoving = useIsMouseMoving();\n\n const onMouseMove = useEvent((event: ReactMouseEvent<HTMLType>) => {\n onMouseMoveProp?.(event);\n if (disabled) return;\n if (!store) return;\n if (event.defaultPrevented) return;\n if (showTimeoutRef.current) return;\n if (!isMouseMoving()) return;\n if (!showOnHoverProp(event)) return;\n const element = event.currentTarget;\n store.setAnchorElement(element);\n store.setDisclosureElement(element);\n const { showTimeout, timeout } = store.getState();\n const showHovercard = () => {\n showTimeoutRef.current = 0;\n // Let's check again if the mouse is moving. This is to avoid showing\n // the hovercard on mobile clicks or after clicking on the anchor.\n if (!isMouseMoving()) return;\n store?.setAnchorElement(element);\n store?.show();\n queueMicrotask(() => {\n // We need to set the anchor element as the hovercard disclosure\n // element only when the hovercard is shown so it doesn't get\n // assigned an arbitrary element by the dialog component.\n store?.setDisclosureElement(element);\n });\n };\n const timeoutMs = showTimeout ?? timeout;\n if (timeoutMs === 0) {\n showHovercard();\n } else {\n showTimeoutRef.current = window.setTimeout(showHovercard, timeoutMs);\n }\n });\n\n const onClickProp = props.onClick;\n\n const onClick = useEvent((event: ReactMouseEvent<HTMLType>) => {\n onClickProp?.(event);\n if (!store) return;\n // Resets showOnHover when the anchor is clicked so the consumer (for\n // example, TooltipAnchor) has the chance to prevent the hovercard from\n // showing on mousemove after a click.\n window.clearTimeout(showTimeoutRef.current);\n showTimeoutRef.current = 0;\n });\n\n const ref = useCallback(\n (element: HTMLElement | null) => {\n if (!store) return;\n const { anchorElement } = store.getState();\n if (anchorElement?.isConnected) return;\n // We can set the anchor element only if it isn't already set or if it's\n // not linked to the DOM. This helps prevent the anchor element from\n // being reassigned to a different element when using multiple anchors\n // and new anchors are added to the DOM.\n store.setAnchorElement(element);\n },\n [store],\n );\n\n props = {\n ...props,\n ref: useMergeRefs(ref, props.ref),\n onMouseMove,\n onClick,\n };\n\n props = useFocusable<TagName>(props);\n\n return props;\n },\n);\n\n/**\n * Renders an anchor element that will open a\n * [`Hovercard`](https://ariakit.com/reference/hovercard) popup on hover.\n * @see https://ariakit.com/components/hovercard\n * @example\n * ```jsx {2}\n * <HovercardProvider>\n * <HovercardAnchor>@username</HovercardAnchor>\n * <Hovercard>Details</Hovercard>\n * </HovercardProvider>\n * ```\n */\nexport const HovercardAnchor = forwardRef(function HovercardAnchor(\n props: HovercardAnchorProps,\n) {\n const htmlProps = useHovercardAnchor(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface HovercardAnchorOptions<\n T extends ElementType = TagName,\n> extends FocusableOptions<T> {\n /**\n * Object returned by the\n * [`useHovercardStore`](https://ariakit.com/reference/use-hovercard-store)\n * hook. If not provided, the closest\n * [`HovercardProvider`](https://ariakit.com/reference/hovercard-provider)\n * component's context will be used.\n */\n store?: HovercardStore;\n /**\n * Shows the content element based on the user's _hover intent_ over the\n * anchor element. This behavior purposely ignores mobile touch and\n * unintentional mouse enter events, like those that happen during scrolling.\n *\n * Live examples:\n * - [Navigation Menubar](https://ariakit.com/examples/menubar-navigation)\n * - [Sliding Menu](https://ariakit.com/examples/menu-slide)\n * @default true\n */\n showOnHover?: BooleanOrCallback<ReactMouseEvent<HTMLElement>>;\n}\n\nexport type HovercardAnchorProps<T extends ElementType = TagName> = Props<\n T,\n HovercardAnchorOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;MAwCI,qBAAgB,WAAA,SAA4B,mBAAA,EAAA,OAAA,cAAA,MAAA,GAAA,SAAA;CAC5C,MAAA,UAAQ,4BAAS;CAEjB,QAAA,
|
|
1
|
+
{"version":3,"file":"hovercard-anchor.js","names":[],"sources":["../../src/hovercard/hovercard-anchor.tsx"],"sourcesContent":["import {\n useBooleanEvent,\n useEvent,\n useIsMouseMoving,\n useMergeRefs,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport {\n addGlobalEventListener,\n disabledFromProps,\n invariant,\n} from \"@ariakit/utils\";\nimport type { BooleanOrCallback } from \"@ariakit/utils\";\nimport type { ElementType, MouseEvent as ReactMouseEvent } from \"react\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport type { FocusableOptions } from \"../focusable/focusable.tsx\";\nimport { useFocusable } from \"../focusable/focusable.tsx\";\nimport { useHovercardProviderContext } from \"./hovercard-context.tsx\";\nimport type { HovercardStore } from \"./hovercard-store.ts\";\n\nconst TagName = \"a\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\n/**\n * Returns props to create a `HovercardAnchor` component.\n * @see https://ariakit.com/components/hovercard\n * @example\n * ```jsx\n * const store = useHovercardStore();\n * const props = useHovercardAnchor({ store });\n * <Role {...props} render={<a />}>@username</Role>\n * <Hovercard store={store}>Details</Hovercard>\n * ```\n */\nexport const useHovercardAnchor = createHook<TagName, HovercardAnchorOptions>(\n function useHovercardAnchor({ store, showOnHover = true, ...props }) {\n const context = useHovercardProviderContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"HovercardAnchor must receive a `store` prop or be wrapped in a HovercardProvider component.\",\n );\n\n const disabled = disabledFromProps(props);\n const showTimeoutRef = useRef(0);\n\n // Clear the show timeout if the anchor is unmounted\n useEffect(() => () => window.clearTimeout(showTimeoutRef.current), []);\n\n // Clear the show timeout if the mouse leaves the anchor element. We're\n // using the native mouseleave event instead of React's onMouseLeave so we\n // bypass the event.stopPropagation() logic set on the Hovercard component\n // for when the mouse is moving toward the Hovercard.\n useEffect(() => {\n const onMouseLeave = (event: MouseEvent) => {\n if (!store) return;\n const { anchorElement } = store.getState();\n if (!anchorElement) return;\n if (event.target !== anchorElement) return;\n window.clearTimeout(showTimeoutRef.current);\n showTimeoutRef.current = 0;\n };\n return addGlobalEventListener(\"mouseleave\", onMouseLeave, true);\n }, [store]);\n\n const onMouseMoveProp = props.onMouseMove;\n const showOnHoverProp = useBooleanEvent(showOnHover);\n const isMouseMoving = useIsMouseMoving();\n\n const onMouseMove = useEvent((event: ReactMouseEvent<HTMLType>) => {\n onMouseMoveProp?.(event);\n if (disabled) return;\n if (!store) return;\n if (event.defaultPrevented) return;\n if (showTimeoutRef.current) return;\n if (!isMouseMoving()) return;\n if (!showOnHoverProp(event)) return;\n const element = event.currentTarget;\n store.setAnchorElement(element);\n store.setDisclosureElement(element);\n const { showTimeout, timeout } = store.getState();\n const showHovercard = () => {\n showTimeoutRef.current = 0;\n // Let's check again if the mouse is moving. This is to avoid showing\n // the hovercard on mobile clicks or after clicking on the anchor.\n if (!isMouseMoving()) return;\n store?.setAnchorElement(element);\n store?.show();\n queueMicrotask(() => {\n // We need to set the anchor element as the hovercard disclosure\n // element only when the hovercard is shown so it doesn't get\n // assigned an arbitrary element by the dialog component.\n store?.setDisclosureElement(element);\n });\n };\n const timeoutMs = showTimeout ?? timeout;\n if (timeoutMs === 0) {\n showHovercard();\n } else {\n showTimeoutRef.current = window.setTimeout(showHovercard, timeoutMs);\n }\n });\n\n const onClickProp = props.onClick;\n\n const onClick = useEvent((event: ReactMouseEvent<HTMLType>) => {\n onClickProp?.(event);\n if (!store) return;\n // Resets showOnHover when the anchor is clicked so the consumer (for\n // example, TooltipAnchor) has the chance to prevent the hovercard from\n // showing on mousemove after a click.\n window.clearTimeout(showTimeoutRef.current);\n showTimeoutRef.current = 0;\n });\n\n const ref = useCallback(\n (element: HTMLElement | null) => {\n if (!store) return;\n const { anchorElement } = store.getState();\n if (anchorElement?.isConnected) return;\n // We can set the anchor element only if it isn't already set or if it's\n // not linked to the DOM. This helps prevent the anchor element from\n // being reassigned to a different element when using multiple anchors\n // and new anchors are added to the DOM.\n store.setAnchorElement(element);\n },\n [store],\n );\n\n props = {\n ...props,\n ref: useMergeRefs(ref, props.ref),\n onMouseMove,\n onClick,\n };\n\n props = useFocusable<TagName>(props);\n\n return props;\n },\n);\n\n/**\n * Renders an anchor element that will open a\n * [`Hovercard`](https://ariakit.com/reference/hovercard) popup on hover.\n * @see https://ariakit.com/components/hovercard\n * @example\n * ```jsx {2}\n * <HovercardProvider>\n * <HovercardAnchor>@username</HovercardAnchor>\n * <Hovercard>Details</Hovercard>\n * </HovercardProvider>\n * ```\n */\nexport const HovercardAnchor = forwardRef(function HovercardAnchor(\n props: HovercardAnchorProps,\n) {\n const htmlProps = useHovercardAnchor(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface HovercardAnchorOptions<\n T extends ElementType = TagName,\n> extends FocusableOptions<T> {\n /**\n * Object returned by the\n * [`useHovercardStore`](https://ariakit.com/reference/use-hovercard-store)\n * hook. If not provided, the closest\n * [`HovercardProvider`](https://ariakit.com/reference/hovercard-provider)\n * component's context will be used.\n */\n store?: HovercardStore;\n /**\n * Shows the content element based on the user's _hover intent_ over the\n * anchor element. This behavior purposely ignores mobile touch and\n * unintentional mouse enter events, like those that happen during scrolling.\n *\n * Live examples:\n * - [Navigation Menubar](https://ariakit.com/examples/menubar-navigation)\n * - [Sliding Menu](https://ariakit.com/examples/menu-slide)\n * @default true\n */\n showOnHover?: BooleanOrCallback<ReactMouseEvent<HTMLElement>>;\n}\n\nexport type HovercardAnchorProps<T extends ElementType = TagName> = Props<\n T,\n HovercardAnchorOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;MAwCI,qBAAgB,WAAA,SAA4B,mBAAA,EAAA,OAAA,cAAA,MAAA,GAAA,SAAA;CAC5C,MAAA,UAAQ,4BAAS;CAEjB,QAAA,SAEE;CAIF,UAAM,OAAW,QAAA,IAAA,aAAuB,gBAAA,6FAAA;CACxC,MAAM,WAAA,kBAAyB,KAAA;CAG/B,MAAA,iBAAsB,OAAO,CAAA;CAM7B,sBAAgB,OAAA,aAAA,eAAA,OAAA,GAAA,CAAA,CAAA;iBACR;QACC,gBAAO,UAAA;GACZ,IAAA,CAAA,OAAQ;GACR,MAAK,EAAA,kBAAe,MAAA,SAAA;GACpB,IAAI,CAAA,eAAM;GACV,IAAA,MAAO,WAAa,eAAe;GACnC,OAAA,aAAe,eAAU,OAAA;GAC3B,eAAA,UAAA;EACA;EACF,OAAI,uBAAM,cAAA,cAAA,IAAA;CAEV,GAAA,CAAA,KAAM,CAAA;CACN,MAAM,kBAAkB,MAAA;CACxB,MAAM,kBAAgB,gBAAiB,WAAA;CAEvC,MAAM,gBAAc,iBAAU;OAC5B,cAAkB,UAAK,UAAA;EACvB,kBAAc,KAAA;EACd,IAAI,UAAQ;EACZ,IAAI,CAAA,OAAM;EACV,IAAI,MAAA,kBAAwB;EAC5B,IAAI,eAAe,SAAG;EACtB,IAAI,CAAC,cAAA,GAAgB;EACrB,IAAA,CAAA,gBAAgB,KAAM,GAAA;EACtB,MAAM,UAAA,MAAA;EACN,MAAM,iBAAA,OAAqB;EAC3B,MAAM,qBAAe,OAAY;EACjC,MAAM,EAAA,aAAA,YAAsB,MAAA,SAAA;QAC1B,sBAAyB;GAGzB,eAAK,UAAiB;GACtB,IAAA,CAAA,cAAO,GAAA;GACP,OAAO,iBAAK,OAAA;GACZ,OAAA,KAAA;wBAIS;IACR,OAAA,qBAAA,OAAA;GACH,CAAA;EACA;EACA,MAAI,YAAc,eAChB;oBAEA,GAAe,cAAU;OAE5B,eAAA,UAAA,OAAA,WAAA,eAAA,SAAA;CAED,CAAA;CAEA,MAAM,cAAU,MAAU;OACxB,UAAc,UAAK,UAAA;EACnB,cAAY,KAAA;EAIZ,IAAA,CAAA,OAAO;EACP,OAAA,aAAe,eAAU,OAAA;EAC1B,eAAA,UAAA;CAED,CAAA;OAES,MAAA,aAAO,YAAA;EACZ,IAAA,CAAA,OAAQ;EACR,MAAI,EAAA,kBAAe,MAAa,SAAA;EAKhC,IAAA,eAAM,aAAwB;EAChC,MACC,iBACH,OAAA;CAEA,GAAA,CAAA,KAAQ,CAAA;SACH;EACH,GAAA;EACA,KAAA,aAAA,KAAA,MAAA,GAAA;EACA;EACF;CAEA;CAEA,QAAO,aAAA,KAAA;CAEX,OAAA;;;;;;;;;;;;;;MAkBE,kBAAqB,WADH,SAAA,gBACqB,OAAA;CACxC,OAAA,cAAA,SAAA,mBAAA,KAAA,CAAA"}
|
|
@@ -36,7 +36,7 @@ declare const useHovercardArrow: import("@ariakit/react-utils").Hook<"div", Hove
|
|
|
36
36
|
* </HovercardProvider>
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
declare const HovercardArrow: (props: HovercardArrowProps) => import("react").ReactElement<
|
|
39
|
+
declare const HovercardArrow: (props: HovercardArrowProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
40
40
|
interface HovercardArrowOptions<T extends ElementType = TagName> extends PopoverArrowOptions<T> {
|
|
41
41
|
/**
|
|
42
42
|
* Object returned by the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hovercard-arrow.d.ts","names":["Props","ElementType","PopoverArrowOptions","HovercardStore","TagName","useHovercardArrow","HovercardArrowOptions","Hook","HovercardArrow","HovercardArrowProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/hovercard/hovercard-arrow.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF8B;;;;AACtC;AAAA;;;;AACQ;AAc7B;;;AAhB2D,cAgBtCC,iBAAAA,iCAAkDE,IAAAA,QAAYD,qBAAqB;AAAA;AAiBxG;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"hovercard-arrow.d.ts","names":["Props","ElementType","PopoverArrowOptions","HovercardStore","TagName","useHovercardArrow","HovercardArrowOptions","Hook","HovercardArrow","HovercardArrowProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/hovercard/hovercard-arrow.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF8B;;;;AACtC;AAAA;;;;AACQ;AAc7B;;;AAhB2D,cAgBtCC,iBAAAA,iCAAkDE,IAAAA,QAAYD,qBAAqB;AAAA;AAiBxG;;;;;;;;;AAAyJ;AACzJ;;;;;AAlBwG,cAiBnFE,cAAAA,GAAiBE,KAAAA,EAAOD,mBAAmB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACnHN,qBAAAA,WAAgCL,WAAAA,GAAcG,OAAAA,UAAiBF,mBAAAA,CAAoBW,CAAAA;EAApBX;;;;;;;;EAS5EY,KAAAA,GAAQX,cAAAA;AAAAA;AAAAA,KAEAM,mBAAAA,WAA8BR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,qBAAAA,CAAsBO,CAAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as HovercardStore } from "../hovercard-store-gIeoQEn_.js";
|
|
2
|
-
import { n as PopoverDescriptionOptions } from "../popover-description-
|
|
2
|
+
import { n as PopoverDescriptionOptions } from "../popover-description-DbW4mVBb.js";
|
|
3
3
|
import { Props } from "@ariakit/react-utils";
|
|
4
4
|
import { ElementType } from "react";
|
|
5
5
|
|
|
@@ -33,7 +33,7 @@ declare const useHovercardDescription: import("@ariakit/react-utils").Hook<"p",
|
|
|
33
33
|
* </HovercardProvider>
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
declare const HovercardDescription: (props: HovercardDescriptionProps) => import("react").ReactElement<
|
|
36
|
+
declare const HovercardDescription: (props: HovercardDescriptionProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
37
37
|
interface HovercardDescriptionOptions<T extends ElementType = TagName> extends PopoverDescriptionOptions<T> {
|
|
38
38
|
/**
|
|
39
39
|
* Object returned by the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hovercard-description.d.ts","names":["Props","ElementType","PopoverDescriptionOptions","HovercardStore","TagName","useHovercardDescription","HovercardDescriptionOptions","Hook","HovercardDescription","HovercardDescriptionProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/hovercard/hovercard-description.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF8B;;;;AACtC;AAAA;;;;AACQ;AAa7B;;AAf2D,cAetCC,uBAAAA,iCAAwDE,IAAAA,MAAUD,2BAA2B;;AAAA;AAelH;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"hovercard-description.d.ts","names":["Props","ElementType","PopoverDescriptionOptions","HovercardStore","TagName","useHovercardDescription","HovercardDescriptionOptions","Hook","HovercardDescription","HovercardDescriptionProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/hovercard/hovercard-description.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF8B;;;;AACtC;AAAA;;;;AACQ;AAa7B;;AAf2D,cAetCC,uBAAAA,iCAAwDE,IAAAA,MAAUD,2BAA2B;;AAAA;AAelH;;;;;;;;;AAAqK;AACrK;;cADqBE,oBAAAA,GAAuBE,KAAAA,EAAOD,yBAAyB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UAC/HN,2BAAAA,WAAsCL,WAAAA,GAAcG,OAAAA,UAAiBF,yBAAAA,CAA0BW,CAAAA;EAA3CT;;;;;;;;EASjEU,KAAAA,GAAQX,cAAAA;AAAAA;AAAAA,KAEAM,yBAAAA,WAAoCR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,2BAAAA,CAA4BO,CAAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as DialogDisclosureOptions } from "../dialog-disclosure-
|
|
1
|
+
import { n as DialogDisclosureOptions } from "../dialog-disclosure-DSESk5pv.js";
|
|
2
2
|
import { t as HovercardStore } from "../hovercard-store-gIeoQEn_.js";
|
|
3
3
|
import { Props } from "@ariakit/react-utils";
|
|
4
4
|
import { ElementType } from "react";
|
|
@@ -34,7 +34,7 @@ declare const useHovercardDisclosure: import("@ariakit/react-utils").Hook<"butto
|
|
|
34
34
|
* </HovercardProvider>
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
declare const HovercardDisclosure: (props: HovercardDisclosureProps) => import("react").ReactElement<
|
|
37
|
+
declare const HovercardDisclosure: (props: HovercardDisclosureProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
38
38
|
interface HovercardDisclosureOptions<T extends ElementType = TagName> extends DialogDisclosureOptions<T> {
|
|
39
39
|
/**
|
|
40
40
|
* Object returned by the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hovercard-disclosure.d.ts","names":["Props","ElementType","DialogDisclosureOptions","HovercardStore","TagName","useHovercardDisclosure","HovercardDisclosureOptions","Hook","HovercardDisclosure","HovercardDisclosureProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/hovercard/hovercard-disclosure.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF8B;;;;AACtC;AAAA;;;;AACQ;AAa7B;;AAf2D,cAetCC,sBAAAA,iCAAuDE,IAAAA,WAAeD,0BAA0B;;AAAA;AAgBrH;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"hovercard-disclosure.d.ts","names":["Props","ElementType","DialogDisclosureOptions","HovercardStore","TagName","useHovercardDisclosure","HovercardDisclosureOptions","Hook","HovercardDisclosure","HovercardDisclosureProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/hovercard/hovercard-disclosure.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF8B;;;;AACtC;AAAA;;;;AACQ;AAa7B;;AAf2D,cAetCC,sBAAAA,iCAAuDE,IAAAA,WAAeD,0BAA0B;;AAAA;AAgBrH;;;;;;;;;AAAmK;AACnK;;;cADqBE,mBAAAA,GAAsBE,KAAAA,EAAOD,wBAAwB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UAC7HN,0BAAAA,WAAqCL,WAAAA,GAAcG,OAAAA,UAAiBF,uBAAAA,CAAwBW,CAAAA;EAAAA;;;;;;;EAQzGC,KAAAA,GAAQX,cAAAA;AAAAA;AAAAA,KAEAM,wBAAAA,WAAmCR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,0BAAAA,CAA2BO,CAAAA"}
|