@ariakit/react-components 0.1.0
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 +20 -0
- package/dist/button/button.d.ts +2 -0
- package/dist/button/button.js +53 -0
- package/dist/button/button.js.map +1 -0
- package/dist/button-Cp853csH.d.ts +34 -0
- package/dist/button-Cp853csH.d.ts.map +1 -0
- package/dist/checkbox/checkbox-check.d.ts +56 -0
- package/dist/checkbox/checkbox-check.d.ts.map +1 -0
- package/dist/checkbox/checkbox-check.js +77 -0
- package/dist/checkbox/checkbox-check.js.map +1 -0
- package/dist/checkbox/checkbox-checked-context.d.ts +5 -0
- package/dist/checkbox/checkbox-checked-context.d.ts.map +1 -0
- package/dist/checkbox/checkbox-checked-context.js +8 -0
- package/dist/checkbox/checkbox-checked-context.js.map +1 -0
- package/dist/checkbox/checkbox-context.d.ts +24 -0
- package/dist/checkbox/checkbox-context.d.ts.map +1 -0
- package/dist/checkbox/checkbox-context.js +26 -0
- package/dist/checkbox/checkbox-context.js.map +1 -0
- package/dist/checkbox/checkbox-provider.d.ts +35 -0
- package/dist/checkbox/checkbox-provider.d.ts.map +1 -0
- package/dist/checkbox/checkbox-provider.js +15 -0
- package/dist/checkbox/checkbox-provider.js.map +1 -0
- package/dist/checkbox/checkbox-store.d.ts +2 -0
- package/dist/checkbox/checkbox-store.js +18 -0
- package/dist/checkbox/checkbox-store.js.map +1 -0
- package/dist/checkbox/checkbox.d.ts +91 -0
- package/dist/checkbox/checkbox.d.ts.map +1 -0
- package/dist/checkbox/checkbox.js +148 -0
- package/dist/checkbox/checkbox.js.map +1 -0
- package/dist/checkbox-store-CYZPR4N4.d.ts +38 -0
- package/dist/checkbox-store-CYZPR4N4.d.ts.map +1 -0
- package/dist/collection/collection-context.d.ts +24 -0
- package/dist/collection/collection-context.d.ts.map +1 -0
- package/dist/collection/collection-context.js +26 -0
- package/dist/collection/collection-context.js.map +1 -0
- package/dist/collection/collection-item-offscreen.d.ts +2 -0
- package/dist/collection/collection-item-offscreen.js +88 -0
- package/dist/collection/collection-item-offscreen.js.map +1 -0
- package/dist/collection/collection-item.d.ts +2 -0
- package/dist/collection/collection-item.js +69 -0
- package/dist/collection/collection-item.js.map +1 -0
- package/dist/collection/collection-provider.d.ts +26 -0
- package/dist/collection/collection-provider.d.ts.map +1 -0
- package/dist/collection/collection-provider.js +15 -0
- package/dist/collection/collection-provider.js.map +1 -0
- package/dist/collection/collection-renderer.d.ts +2 -0
- package/dist/collection/collection-renderer.js +580 -0
- package/dist/collection/collection-renderer.js.map +1 -0
- package/dist/collection/collection-store.d.ts +2 -0
- package/dist/collection/collection-store.js +18 -0
- package/dist/collection/collection-store.js.map +1 -0
- package/dist/collection/collection.d.ts +55 -0
- package/dist/collection/collection.d.ts.map +1 -0
- package/dist/collection/collection.js +55 -0
- package/dist/collection/collection.js.map +1 -0
- package/dist/collection-item-C-g2BwVF.d.ts +84 -0
- package/dist/collection-item-C-g2BwVF.d.ts.map +1 -0
- package/dist/collection-item-offscreen-DyXa-sqj.d.ts +30 -0
- package/dist/collection-item-offscreen-DyXa-sqj.d.ts.map +1 -0
- package/dist/collection-renderer-DsPD9ksD.d.ts +469 -0
- package/dist/collection-renderer-DsPD9ksD.d.ts.map +1 -0
- package/dist/collection-store-CbwzYsWf.d.ts +42 -0
- package/dist/collection-store-CbwzYsWf.d.ts.map +1 -0
- package/dist/combobox/combobox-cancel.d.ts +62 -0
- package/dist/combobox/combobox-cancel.d.ts.map +1 -0
- package/dist/combobox/combobox-cancel.js +98 -0
- package/dist/combobox/combobox-cancel.js.map +1 -0
- package/dist/combobox/combobox-context.d.ts +27 -0
- package/dist/combobox/combobox-context.d.ts.map +1 -0
- package/dist/combobox/combobox-context.js +32 -0
- package/dist/combobox/combobox-context.js.map +1 -0
- package/dist/combobox/combobox-disclosure.d.ts +63 -0
- package/dist/combobox/combobox-disclosure.d.ts.map +1 -0
- package/dist/combobox/combobox-disclosure.js +108 -0
- package/dist/combobox/combobox-disclosure.js.map +1 -0
- package/dist/combobox/combobox-group-label.d.ts +56 -0
- package/dist/combobox/combobox-group-label.d.ts.map +1 -0
- package/dist/combobox/combobox-group-label.js +47 -0
- package/dist/combobox/combobox-group-label.js.map +1 -0
- package/dist/combobox/combobox-group.d.ts +63 -0
- package/dist/combobox/combobox-group.d.ts.map +1 -0
- package/dist/combobox/combobox-group.js +67 -0
- package/dist/combobox/combobox-group.js.map +1 -0
- package/dist/combobox/combobox-item-check.d.ts +61 -0
- package/dist/combobox/combobox-item-check.d.ts.map +1 -0
- package/dist/combobox/combobox-item-check.js +62 -0
- package/dist/combobox/combobox-item-check.js.map +1 -0
- package/dist/combobox/combobox-item-offscreen.d.ts +34 -0
- package/dist/combobox/combobox-item-offscreen.d.ts.map +1 -0
- package/dist/combobox/combobox-item-offscreen.js +53 -0
- package/dist/combobox/combobox-item-offscreen.js.map +1 -0
- package/dist/combobox/combobox-item-value.d.ts +103 -0
- package/dist/combobox/combobox-item-value.d.ts.map +1 -0
- package/dist/combobox/combobox-item-value.js +143 -0
- package/dist/combobox/combobox-item-value.js.map +1 -0
- package/dist/combobox/combobox-item.d.ts +146 -0
- package/dist/combobox/combobox-item.d.ts.map +1 -0
- package/dist/combobox/combobox-item.js +157 -0
- package/dist/combobox/combobox-item.js.map +1 -0
- package/dist/combobox/combobox-label.d.ts +50 -0
- package/dist/combobox/combobox-label.d.ts.map +1 -0
- package/dist/combobox/combobox-label.js +51 -0
- package/dist/combobox/combobox-label.js.map +1 -0
- package/dist/combobox/combobox-list.d.ts +55 -0
- package/dist/combobox/combobox-list.d.ts.map +1 -0
- package/dist/combobox/combobox-list.js +106 -0
- package/dist/combobox/combobox-list.js.map +1 -0
- package/dist/combobox/combobox-popover.d.ts +46 -0
- package/dist/combobox/combobox-popover.d.ts.map +1 -0
- package/dist/combobox/combobox-popover.js +115 -0
- package/dist/combobox/combobox-popover.js.map +1 -0
- package/dist/combobox/combobox-provider.d.ts +30 -0
- package/dist/combobox/combobox-provider.d.ts.map +1 -0
- package/dist/combobox/combobox-provider.js +15 -0
- package/dist/combobox/combobox-provider.js.map +1 -0
- package/dist/combobox/combobox-row.d.ts +66 -0
- package/dist/combobox/combobox-row.d.ts.map +1 -0
- package/dist/combobox/combobox-row.js +70 -0
- package/dist/combobox/combobox-row.js.map +1 -0
- package/dist/combobox/combobox-separator.d.ts +61 -0
- package/dist/combobox/combobox-separator.d.ts.map +1 -0
- package/dist/combobox/combobox-separator.js +60 -0
- package/dist/combobox/combobox-separator.js.map +1 -0
- package/dist/combobox/combobox-store.d.ts +2 -0
- package/dist/combobox/combobox-store.js +33 -0
- package/dist/combobox/combobox-store.js.map +1 -0
- package/dist/combobox/combobox-value.d.ts +49 -0
- package/dist/combobox/combobox-value.d.ts.map +1 -0
- package/dist/combobox/combobox-value.js +40 -0
- package/dist/combobox/combobox-value.js.map +1 -0
- package/dist/combobox/combobox.d.ts +268 -0
- package/dist/combobox/combobox.d.ts.map +1 -0
- package/dist/combobox/combobox.js +399 -0
- package/dist/combobox/combobox.js.map +1 -0
- package/dist/combobox-store-DEVQ45mZ.d.ts +80 -0
- package/dist/combobox-store-DEVQ45mZ.d.ts.map +1 -0
- package/dist/command/command.d.ts +2 -0
- package/dist/command/command.js +130 -0
- package/dist/command/command.js.map +1 -0
- package/dist/command-DckndCUK.d.ts +59 -0
- package/dist/command-DckndCUK.d.ts.map +1 -0
- package/dist/composite/composite-container.d.ts +59 -0
- package/dist/composite/composite-container.d.ts.map +1 -0
- package/dist/composite/composite-container.js +164 -0
- package/dist/composite/composite-container.js.map +1 -0
- package/dist/composite/composite-context.d.ts +34 -0
- package/dist/composite/composite-context.d.ts.map +1 -0
- package/dist/composite/composite-context.js +30 -0
- package/dist/composite/composite-context.js.map +1 -0
- package/dist/composite/composite-group-label.d.ts +55 -0
- package/dist/composite/composite-group-label.d.ts.map +1 -0
- package/dist/composite/composite-group-label.js +46 -0
- package/dist/composite/composite-group-label.js.map +1 -0
- package/dist/composite/composite-group.d.ts +60 -0
- package/dist/composite/composite-group.d.ts.map +1 -0
- package/dist/composite/composite-group.js +51 -0
- package/dist/composite/composite-group.js.map +1 -0
- package/dist/composite/composite-hover.d.ts +2 -0
- package/dist/composite/composite-hover.js +114 -0
- package/dist/composite/composite-hover.js.map +1 -0
- package/dist/composite/composite-input.d.ts +55 -0
- package/dist/composite/composite-input.d.ts.map +1 -0
- package/dist/composite/composite-input.js +91 -0
- package/dist/composite/composite-input.js.map +1 -0
- package/dist/composite/composite-item-offscreen.d.ts +39 -0
- package/dist/composite/composite-item-offscreen.d.ts.map +1 -0
- package/dist/composite/composite-item-offscreen.js +72 -0
- package/dist/composite/composite-item-offscreen.js.map +1 -0
- package/dist/composite/composite-item.d.ts +2 -0
- package/dist/composite/composite-item.js +290 -0
- package/dist/composite/composite-item.js.map +1 -0
- package/dist/composite/composite-overflow-disclosure.d.ts +53 -0
- package/dist/composite/composite-overflow-disclosure.d.ts.map +1 -0
- package/dist/composite/composite-overflow-disclosure.js +84 -0
- package/dist/composite/composite-overflow-disclosure.js.map +1 -0
- package/dist/composite/composite-overflow-store.d.ts +38 -0
- package/dist/composite/composite-overflow-store.d.ts.map +1 -0
- package/dist/composite/composite-overflow-store.js +36 -0
- package/dist/composite/composite-overflow-store.js.map +1 -0
- package/dist/composite/composite-overflow.d.ts +54 -0
- package/dist/composite/composite-overflow.d.ts.map +1 -0
- package/dist/composite/composite-overflow.js +82 -0
- package/dist/composite/composite-overflow.js.map +1 -0
- package/dist/composite/composite-provider.d.ts +28 -0
- package/dist/composite/composite-provider.d.ts.map +1 -0
- package/dist/composite/composite-provider.js +15 -0
- package/dist/composite/composite-provider.js.map +1 -0
- package/dist/composite/composite-renderer.d.ts +329 -0
- package/dist/composite/composite-renderer.d.ts.map +1 -0
- package/dist/composite/composite-renderer.js +121 -0
- package/dist/composite/composite-renderer.js.map +1 -0
- package/dist/composite/composite-row.d.ts +67 -0
- package/dist/composite/composite-row.d.ts.map +1 -0
- package/dist/composite/composite-row.js +86 -0
- package/dist/composite/composite-row.js.map +1 -0
- package/dist/composite/composite-separator.d.ts +61 -0
- package/dist/composite/composite-separator.d.ts.map +1 -0
- package/dist/composite/composite-separator.js +55 -0
- package/dist/composite/composite-separator.js.map +1 -0
- package/dist/composite/composite-store.d.ts +2 -0
- package/dist/composite/composite-store.js +33 -0
- package/dist/composite/composite-store.js.map +1 -0
- package/dist/composite/composite-typeahead.d.ts +2 -0
- package/dist/composite/composite-typeahead.js +126 -0
- package/dist/composite/composite-typeahead.js.map +1 -0
- package/dist/composite/composite.d.ts +2 -0
- package/dist/composite/composite.js +273 -0
- package/dist/composite/composite.js.map +1 -0
- package/dist/composite/utils.d.ts +52 -0
- package/dist/composite/utils.d.ts.map +1 -0
- package/dist/composite/utils.js +93 -0
- package/dist/composite/utils.js.map +1 -0
- package/dist/composite-DLvyFHMq.d.ts +124 -0
- package/dist/composite-DLvyFHMq.d.ts.map +1 -0
- package/dist/composite-hover-C7ul163w.d.ts +103 -0
- package/dist/composite-hover-C7ul163w.d.ts.map +1 -0
- package/dist/composite-item-B4WTelVz.d.ts +141 -0
- package/dist/composite-item-B4WTelVz.d.ts.map +1 -0
- package/dist/composite-store-DyJc-XRA.d.ts +43 -0
- package/dist/composite-store-DyJc-XRA.d.ts.map +1 -0
- package/dist/composite-typeahead-DDhpyKqm.d.ts +63 -0
- package/dist/composite-typeahead-DDhpyKqm.d.ts.map +1 -0
- package/dist/dialog/dialog-backdrop.d.ts +16 -0
- package/dist/dialog/dialog-backdrop.d.ts.map +1 -0
- package/dist/dialog/dialog-backdrop.js +58 -0
- package/dist/dialog/dialog-backdrop.js.map +1 -0
- package/dist/dialog/dialog-context.d.ts +27 -0
- package/dist/dialog/dialog-context.d.ts.map +1 -0
- package/dist/dialog/dialog-context.js +30 -0
- package/dist/dialog/dialog-context.js.map +1 -0
- package/dist/dialog/dialog-description.d.ts +2 -0
- package/dist/dialog/dialog-description.js +53 -0
- package/dist/dialog/dialog-description.js.map +1 -0
- package/dist/dialog/dialog-disclosure.d.ts +2 -0
- package/dist/dialog/dialog-disclosure.js +52 -0
- package/dist/dialog/dialog-disclosure.js.map +1 -0
- package/dist/dialog/dialog-dismiss.d.ts +2 -0
- package/dist/dialog/dialog-dismiss.js +80 -0
- package/dist/dialog/dialog-dismiss.js.map +1 -0
- package/dist/dialog/dialog-heading.d.ts +2 -0
- package/dist/dialog/dialog-heading.js +54 -0
- package/dist/dialog/dialog-heading.js.map +1 -0
- package/dist/dialog/dialog-provider.d.ts +22 -0
- package/dist/dialog/dialog-provider.d.ts.map +1 -0
- package/dist/dialog/dialog-provider.js +26 -0
- package/dist/dialog/dialog-provider.js.map +1 -0
- package/dist/dialog/dialog-store.d.ts +2 -0
- package/dist/dialog/dialog-store.js +28 -0
- package/dist/dialog/dialog-store.js.map +1 -0
- package/dist/dialog/dialog.d.ts +2 -0
- package/dist/dialog/dialog.js +429 -0
- package/dist/dialog/dialog.js.map +1 -0
- package/dist/dialog/utils/disable-accessibility-tree-outside.d.ts +7 -0
- package/dist/dialog/utils/disable-accessibility-tree-outside.d.ts.map +1 -0
- package/dist/dialog/utils/disable-accessibility-tree-outside.js +24 -0
- package/dist/dialog/utils/disable-accessibility-tree-outside.js.map +1 -0
- package/dist/dialog/utils/disable-tree.d.ts +9 -0
- package/dist/dialog/utils/disable-tree.d.ts.map +1 -0
- package/dist/dialog/utils/disable-tree.js +48 -0
- package/dist/dialog/utils/disable-tree.js.map +1 -0
- package/dist/dialog/utils/is-backdrop.d.ts +5 -0
- package/dist/dialog/utils/is-backdrop.d.ts.map +1 -0
- package/dist/dialog/utils/is-backdrop.js +15 -0
- package/dist/dialog/utils/is-backdrop.js.map +1 -0
- package/dist/dialog/utils/is-focus-trap.d.ts +5 -0
- package/dist/dialog/utils/is-focus-trap.d.ts.map +1 -0
- package/dist/dialog/utils/is-focus-trap.js +14 -0
- package/dist/dialog/utils/is-focus-trap.js.map +1 -0
- package/dist/dialog/utils/mark-tree-outside.d.ts +9 -0
- package/dist/dialog/utils/mark-tree-outside.d.ts.map +1 -0
- package/dist/dialog/utils/mark-tree-outside.js +44 -0
- package/dist/dialog/utils/mark-tree-outside.js.map +1 -0
- package/dist/dialog/utils/orchestrate.d.ts +9 -0
- package/dist/dialog/utils/orchestrate.d.ts.map +1 -0
- package/dist/dialog/utils/orchestrate.js +77 -0
- package/dist/dialog/utils/orchestrate.js.map +1 -0
- package/dist/dialog/utils/prepend-hidden-dismiss.d.ts +5 -0
- package/dist/dialog/utils/prepend-hidden-dismiss.d.ts.map +1 -0
- package/dist/dialog/utils/prepend-hidden-dismiss.js +31 -0
- package/dist/dialog/utils/prepend-hidden-dismiss.js.map +1 -0
- package/dist/dialog/utils/supports-inert.d.ts +5 -0
- package/dist/dialog/utils/supports-inert.d.ts.map +1 -0
- package/dist/dialog/utils/supports-inert.js +9 -0
- package/dist/dialog/utils/supports-inert.js.map +1 -0
- package/dist/dialog/utils/use-hide-on-interact-outside.d.ts +9 -0
- package/dist/dialog/utils/use-hide-on-interact-outside.d.ts.map +1 -0
- package/dist/dialog/utils/use-hide-on-interact-outside.js +123 -0
- package/dist/dialog/utils/use-hide-on-interact-outside.js.map +1 -0
- package/dist/dialog/utils/use-nested-dialogs.d.ts +11 -0
- package/dist/dialog/utils/use-nested-dialogs.d.ts.map +1 -0
- package/dist/dialog/utils/use-nested-dialogs.js +40 -0
- package/dist/dialog/utils/use-nested-dialogs.js.map +1 -0
- package/dist/dialog/utils/use-prevent-body-scroll.d.ts +5 -0
- package/dist/dialog/utils/use-prevent-body-scroll.d.ts.map +1 -0
- package/dist/dialog/utils/use-prevent-body-scroll.js +60 -0
- package/dist/dialog/utils/use-prevent-body-scroll.js.map +1 -0
- package/dist/dialog/utils/use-previous-mouse-down-ref.d.ts +5 -0
- package/dist/dialog/utils/use-previous-mouse-down-ref.d.ts.map +1 -0
- package/dist/dialog/utils/use-previous-mouse-down-ref.js +22 -0
- package/dist/dialog/utils/use-previous-mouse-down-ref.js.map +1 -0
- package/dist/dialog/utils/use-root-dialog.d.ts +16 -0
- package/dist/dialog/utils/use-root-dialog.d.ts.map +1 -0
- package/dist/dialog/utils/use-root-dialog.js +47 -0
- package/dist/dialog/utils/use-root-dialog.js.map +1 -0
- package/dist/dialog/utils/walk-tree-outside.d.ts +8 -0
- package/dist/dialog/utils/walk-tree-outside.d.ts.map +1 -0
- package/dist/dialog/utils/walk-tree-outside.js +58 -0
- package/dist/dialog/utils/walk-tree-outside.js.map +1 -0
- package/dist/dialog-C__C-zX2.d.ts +267 -0
- package/dist/dialog-C__C-zX2.d.ts.map +1 -0
- package/dist/dialog-description-BCZJ1Kyd.d.ts +48 -0
- package/dist/dialog-description-BCZJ1Kyd.d.ts.map +1 -0
- package/dist/dialog-disclosure-DLD10zlb.d.ts +47 -0
- package/dist/dialog-disclosure-DLD10zlb.d.ts.map +1 -0
- package/dist/dialog-dismiss-CnwEbzc6.d.ts +48 -0
- package/dist/dialog-dismiss-CnwEbzc6.d.ts.map +1 -0
- package/dist/dialog-heading-DQvnOfZH.d.ts +49 -0
- package/dist/dialog-heading-DQvnOfZH.d.ts.map +1 -0
- package/dist/dialog-store-Cjt12T_Y.d.ts +29 -0
- package/dist/dialog-store-Cjt12T_Y.d.ts.map +1 -0
- package/dist/disclosure/disclosure-content.d.ts +2 -0
- package/dist/disclosure/disclosure-content.js +171 -0
- package/dist/disclosure/disclosure-content.js.map +1 -0
- package/dist/disclosure/disclosure-context.d.ts +24 -0
- package/dist/disclosure/disclosure-context.d.ts.map +1 -0
- package/dist/disclosure/disclosure-context.js +26 -0
- package/dist/disclosure/disclosure-context.js.map +1 -0
- package/dist/disclosure/disclosure-provider.d.ts +23 -0
- package/dist/disclosure/disclosure-provider.d.ts.map +1 -0
- package/dist/disclosure/disclosure-provider.js +27 -0
- package/dist/disclosure/disclosure-provider.js.map +1 -0
- package/dist/disclosure/disclosure-store.d.ts +2 -0
- package/dist/disclosure/disclosure-store.js +32 -0
- package/dist/disclosure/disclosure-store.js.map +1 -0
- package/dist/disclosure/disclosure.d.ts +2 -0
- package/dist/disclosure/disclosure.js +83 -0
- package/dist/disclosure/disclosure.js.map +1 -0
- package/dist/disclosure-CQ37hPVP.d.ts +60 -0
- package/dist/disclosure-CQ37hPVP.d.ts.map +1 -0
- package/dist/disclosure-content-BbPkZgAc.d.ts +88 -0
- package/dist/disclosure-content-BbPkZgAc.d.ts.map +1 -0
- package/dist/disclosure-store-BsaBaRKv.d.ts +58 -0
- package/dist/disclosure-store-BsaBaRKv.d.ts.map +1 -0
- package/dist/focus-trap/focus-trap-region.d.ts +42 -0
- package/dist/focus-trap/focus-trap-region.d.ts.map +1 -0
- package/dist/focus-trap/focus-trap-region.js +69 -0
- package/dist/focus-trap/focus-trap-region.js.map +1 -0
- package/dist/focus-trap/focus-trap.d.ts +31 -0
- package/dist/focus-trap/focus-trap.d.ts.map +1 -0
- package/dist/focus-trap/focus-trap.js +45 -0
- package/dist/focus-trap/focus-trap.js.map +1 -0
- package/dist/focusable/focusable-container.d.ts +43 -0
- package/dist/focusable/focusable-container.d.ts.map +1 -0
- package/dist/focusable/focusable-container.js +41 -0
- package/dist/focusable/focusable-container.js.map +1 -0
- package/dist/focusable/focusable-context.d.ts +5 -0
- package/dist/focusable/focusable-context.d.ts.map +1 -0
- package/dist/focusable/focusable-context.js +8 -0
- package/dist/focusable/focusable-context.js.map +1 -0
- package/dist/focusable/focusable.d.ts +2 -0
- package/dist/focusable/focusable.js +273 -0
- package/dist/focusable/focusable.js.map +1 -0
- package/dist/focusable-B00tOxtB.d.ts +142 -0
- package/dist/focusable-B00tOxtB.d.ts.map +1 -0
- package/dist/form/form-checkbox.d.ts +50 -0
- package/dist/form/form-checkbox.d.ts.map +1 -0
- package/dist/form/form-checkbox.js +73 -0
- package/dist/form/form-checkbox.js.map +1 -0
- package/dist/form/form-context.d.ts +24 -0
- package/dist/form/form-context.d.ts.map +1 -0
- package/dist/form/form-context.js +27 -0
- package/dist/form/form-context.js.map +1 -0
- package/dist/form/form-control.d.ts +100 -0
- package/dist/form/form-control.d.ts.map +1 -0
- package/dist/form/form-control.js +139 -0
- package/dist/form/form-control.js.map +1 -0
- package/dist/form/form-description.d.ts +73 -0
- package/dist/form/form-description.d.ts.map +1 -0
- package/dist/form/form-description.js +83 -0
- package/dist/form/form-description.js.map +1 -0
- package/dist/form/form-error.d.ts +82 -0
- package/dist/form/form-error.d.ts.map +1 -0
- package/dist/form/form-error.js +102 -0
- package/dist/form/form-error.js.map +1 -0
- package/dist/form/form-field.d.ts +73 -0
- package/dist/form/form-field.d.ts.map +1 -0
- package/dist/form/form-field.js +74 -0
- package/dist/form/form-field.js.map +1 -0
- package/dist/form/form-group-label.d.ts +62 -0
- package/dist/form/form-group-label.d.ts.map +1 -0
- package/dist/form/form-group-label.js +54 -0
- package/dist/form/form-group-label.js.map +1 -0
- package/dist/form/form-group.d.ts +64 -0
- package/dist/form/form-group.d.ts.map +1 -0
- package/dist/form/form-group.js +56 -0
- package/dist/form/form-group.js.map +1 -0
- package/dist/form/form-input.d.ts +50 -0
- package/dist/form/form-input.d.ts.map +1 -0
- package/dist/form/form-input.js +74 -0
- package/dist/form/form-input.js.map +1 -0
- package/dist/form/form-label.d.ts +77 -0
- package/dist/form/form-label.d.ts.map +1 -0
- package/dist/form/form-label.js +120 -0
- package/dist/form/form-label.js.map +1 -0
- package/dist/form/form-provider.d.ts +28 -0
- package/dist/form/form-provider.d.ts.map +1 -0
- package/dist/form/form-provider.js +15 -0
- package/dist/form/form-provider.js.map +1 -0
- package/dist/form/form-push.d.ts +102 -0
- package/dist/form/form-push.d.ts.map +1 -0
- package/dist/form/form-push.js +134 -0
- package/dist/form/form-push.js.map +1 -0
- package/dist/form/form-radio-group.d.ts +56 -0
- package/dist/form/form-radio-group.d.ts.map +1 -0
- package/dist/form/form-radio-group.js +68 -0
- package/dist/form/form-radio-group.js.map +1 -0
- package/dist/form/form-radio.d.ts +58 -0
- package/dist/form/form-radio.d.ts.map +1 -0
- package/dist/form/form-radio.js +90 -0
- package/dist/form/form-radio.js.map +1 -0
- package/dist/form/form-remove.d.ts +102 -0
- package/dist/form/form-remove.d.ts.map +1 -0
- package/dist/form/form-remove.js +116 -0
- package/dist/form/form-remove.js.map +1 -0
- package/dist/form/form-reset.d.ts +51 -0
- package/dist/form/form-reset.d.ts.map +1 -0
- package/dist/form/form-reset.js +54 -0
- package/dist/form/form-reset.js.map +1 -0
- package/dist/form/form-store.d.ts +2 -0
- package/dist/form/form-store.js +41 -0
- package/dist/form/form-store.js.map +1 -0
- package/dist/form/form-submit.d.ts +57 -0
- package/dist/form/form-submit.d.ts.map +1 -0
- package/dist/form/form-submit.js +59 -0
- package/dist/form/form-submit.js.map +1 -0
- package/dist/form/form.d.ts +101 -0
- package/dist/form/form.d.ts.map +1 -0
- package/dist/form/form.js +146 -0
- package/dist/form/form.js.map +1 -0
- package/dist/form-store-C4Kf5QHm.d.ts +120 -0
- package/dist/form-store-C4Kf5QHm.d.ts.map +1 -0
- package/dist/group/group-label-context.d.ts +7 -0
- package/dist/group/group-label-context.d.ts.map +1 -0
- package/dist/group/group-label-context.js +8 -0
- package/dist/group/group-label-context.js.map +1 -0
- package/dist/group/group-label.d.ts +2 -0
- package/dist/group/group-label.js +52 -0
- package/dist/group/group-label.js.map +1 -0
- package/dist/group/group.d.ts +2 -0
- package/dist/group/group.js +47 -0
- package/dist/group/group.js.map +1 -0
- package/dist/group-CamegDJA.d.ts +32 -0
- package/dist/group-CamegDJA.d.ts.map +1 -0
- package/dist/group-label-C16IDs1b.d.ts +37 -0
- package/dist/group-label-C16IDs1b.d.ts.map +1 -0
- package/dist/heading/heading-context.d.ts +7 -0
- package/dist/heading/heading-context.d.ts.map +1 -0
- package/dist/heading/heading-context.js +8 -0
- package/dist/heading/heading-context.js.map +1 -0
- package/dist/heading/heading-level.d.ts +35 -0
- package/dist/heading/heading-level.d.ts.map +1 -0
- package/dist/heading/heading-level.js +33 -0
- package/dist/heading/heading-level.js.map +1 -0
- package/dist/heading/heading.d.ts +2 -0
- package/dist/heading/heading.js +56 -0
- package/dist/heading/heading.js.map +1 -0
- package/dist/heading/utils.d.ts +2 -0
- package/dist/heading/utils.js +1 -0
- package/dist/heading-zY9g_9K-.d.ts +42 -0
- package/dist/heading-zY9g_9K-.d.ts.map +1 -0
- package/dist/hovercard/hovercard-anchor.d.ts +59 -0
- package/dist/hovercard/hovercard-anchor.d.ts.map +1 -0
- package/dist/hovercard/hovercard-anchor.js +106 -0
- package/dist/hovercard/hovercard-anchor.js.map +1 -0
- package/dist/hovercard/hovercard-arrow.d.ts +54 -0
- package/dist/hovercard/hovercard-arrow.d.ts.map +1 -0
- package/dist/hovercard/hovercard-arrow.js +51 -0
- package/dist/hovercard/hovercard-arrow.js.map +1 -0
- package/dist/hovercard/hovercard-context.d.ts +24 -0
- package/dist/hovercard/hovercard-context.d.ts.map +1 -0
- package/dist/hovercard/hovercard-context.js +27 -0
- package/dist/hovercard/hovercard-context.js.map +1 -0
- package/dist/hovercard/hovercard-description.d.ts +51 -0
- package/dist/hovercard/hovercard-description.d.ts.map +1 -0
- package/dist/hovercard/hovercard-description.js +42 -0
- package/dist/hovercard/hovercard-description.js.map +1 -0
- package/dist/hovercard/hovercard-disclosure.d.ts +51 -0
- package/dist/hovercard/hovercard-disclosure.d.ts.map +1 -0
- package/dist/hovercard/hovercard-disclosure.js +122 -0
- package/dist/hovercard/hovercard-disclosure.js.map +1 -0
- package/dist/hovercard/hovercard-dismiss.d.ts +50 -0
- package/dist/hovercard/hovercard-dismiss.d.ts.map +1 -0
- package/dist/hovercard/hovercard-dismiss.js +47 -0
- package/dist/hovercard/hovercard-dismiss.js.map +1 -0
- package/dist/hovercard/hovercard-heading.d.ts +51 -0
- package/dist/hovercard/hovercard-heading.d.ts.map +1 -0
- package/dist/hovercard/hovercard-heading.js +42 -0
- package/dist/hovercard/hovercard-heading.js.map +1 -0
- package/dist/hovercard/hovercard-provider.d.ts +23 -0
- package/dist/hovercard/hovercard-provider.d.ts.map +1 -0
- package/dist/hovercard/hovercard-provider.js +27 -0
- package/dist/hovercard/hovercard-provider.js.map +1 -0
- package/dist/hovercard/hovercard-store.d.ts +2 -0
- package/dist/hovercard/hovercard-store.js +31 -0
- package/dist/hovercard/hovercard-store.js.map +1 -0
- package/dist/hovercard/hovercard.d.ts +80 -0
- package/dist/hovercard/hovercard.d.ts.map +1 -0
- package/dist/hovercard/hovercard.js +240 -0
- package/dist/hovercard/hovercard.js.map +1 -0
- package/dist/hovercard/utils/debug-polygon.d.ts +7 -0
- package/dist/hovercard/utils/debug-polygon.d.ts.map +1 -0
- package/dist/hovercard/utils/debug-polygon.js +33 -0
- package/dist/hovercard/utils/debug-polygon.js.map +1 -0
- package/dist/hovercard/utils/polygon.d.ts +9 -0
- package/dist/hovercard/utils/polygon.d.ts.map +1 -0
- package/dist/hovercard/utils/polygon.js +70 -0
- package/dist/hovercard/utils/polygon.js.map +1 -0
- package/dist/hovercard-store-gIeoQEn_.d.ts +30 -0
- package/dist/hovercard-store-gIeoQEn_.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/menu/menu-arrow.d.ts +52 -0
- package/dist/menu/menu-arrow.d.ts.map +1 -0
- package/dist/menu/menu-arrow.js +49 -0
- package/dist/menu/menu-arrow.js.map +1 -0
- package/dist/menu/menu-bar-provider.d.ts +35 -0
- package/dist/menu/menu-bar-provider.d.ts.map +1 -0
- package/dist/menu/menu-bar-provider.js +42 -0
- package/dist/menu/menu-bar-provider.js.map +1 -0
- package/dist/menu/menu-bar-store.d.ts +25 -0
- package/dist/menu/menu-bar-store.d.ts.map +1 -0
- package/dist/menu/menu-bar-store.js +28 -0
- package/dist/menu/menu-bar-store.js.map +1 -0
- package/dist/menu/menu-bar.d.ts +61 -0
- package/dist/menu/menu-bar.d.ts.map +1 -0
- package/dist/menu/menu-bar.js +66 -0
- package/dist/menu/menu-bar.js.map +1 -0
- package/dist/menu/menu-button-arrow.d.ts +65 -0
- package/dist/menu/menu-button-arrow.d.ts.map +1 -0
- package/dist/menu/menu-button-arrow.js +62 -0
- package/dist/menu/menu-button-arrow.js.map +1 -0
- package/dist/menu/menu-button.d.ts +67 -0
- package/dist/menu/menu-button.d.ts.map +1 -0
- package/dist/menu/menu-button.js +183 -0
- package/dist/menu/menu-button.js.map +1 -0
- package/dist/menu/menu-context.d.ts +47 -0
- package/dist/menu/menu-context.d.ts.map +1 -0
- package/dist/menu/menu-context.js +52 -0
- package/dist/menu/menu-context.js.map +1 -0
- package/dist/menu/menu-description.d.ts +50 -0
- package/dist/menu/menu-description.d.ts.map +1 -0
- package/dist/menu/menu-description.js +42 -0
- package/dist/menu/menu-description.js.map +1 -0
- package/dist/menu/menu-dismiss.d.ts +49 -0
- package/dist/menu/menu-dismiss.d.ts.map +1 -0
- package/dist/menu/menu-dismiss.js +47 -0
- package/dist/menu/menu-dismiss.js.map +1 -0
- package/dist/menu/menu-group-label.d.ts +55 -0
- package/dist/menu/menu-group-label.d.ts.map +1 -0
- package/dist/menu/menu-group-label.js +47 -0
- package/dist/menu/menu-group-label.js.map +1 -0
- package/dist/menu/menu-group.d.ts +61 -0
- package/dist/menu/menu-group.d.ts.map +1 -0
- package/dist/menu/menu-group.js +53 -0
- package/dist/menu/menu-group.js.map +1 -0
- package/dist/menu/menu-heading.d.ts +50 -0
- package/dist/menu/menu-heading.d.ts.map +1 -0
- package/dist/menu/menu-heading.js +42 -0
- package/dist/menu/menu-heading.js.map +1 -0
- package/dist/menu/menu-item-check.d.ts +58 -0
- package/dist/menu/menu-item-check.d.ts.map +1 -0
- package/dist/menu/menu-item-check.js +60 -0
- package/dist/menu/menu-item-check.js.map +1 -0
- package/dist/menu/menu-item-checkbox.d.ts +104 -0
- package/dist/menu/menu-item-checkbox.d.ts.map +1 -0
- package/dist/menu/menu-item-checkbox.js +151 -0
- package/dist/menu/menu-item-checkbox.js.map +1 -0
- package/dist/menu/menu-item-radio.d.ts +91 -0
- package/dist/menu/menu-item-radio.d.ts.map +1 -0
- package/dist/menu/menu-item-radio.js +121 -0
- package/dist/menu/menu-item-radio.js.map +1 -0
- package/dist/menu/menu-item.d.ts +75 -0
- package/dist/menu/menu-item.d.ts.map +1 -0
- package/dist/menu/menu-item.js +122 -0
- package/dist/menu/menu-item.js.map +1 -0
- package/dist/menu/menu-list.d.ts +59 -0
- package/dist/menu/menu-list.d.ts.map +1 -0
- package/dist/menu/menu-list.js +168 -0
- package/dist/menu/menu-list.js.map +1 -0
- package/dist/menu/menu-provider.d.ts +29 -0
- package/dist/menu/menu-provider.d.ts.map +1 -0
- package/dist/menu/menu-provider.js +15 -0
- package/dist/menu/menu-provider.js.map +1 -0
- package/dist/menu/menu-separator.d.ts +59 -0
- package/dist/menu/menu-separator.d.ts.map +1 -0
- package/dist/menu/menu-separator.js +57 -0
- package/dist/menu/menu-separator.js.map +1 -0
- package/dist/menu/menu-store.d.ts +2 -0
- package/dist/menu/menu-store.js +40 -0
- package/dist/menu/menu-store.js.map +1 -0
- package/dist/menu/menu.d.ts +49 -0
- package/dist/menu/menu.d.ts.map +1 -0
- package/dist/menu/menu.js +169 -0
- package/dist/menu/menu.js.map +1 -0
- package/dist/menu-store-0CKKmNek.d.ts +83 -0
- package/dist/menu-store-0CKKmNek.d.ts.map +1 -0
- package/dist/menubar/menubar-context.d.ts +25 -0
- package/dist/menubar/menubar-context.d.ts.map +1 -0
- package/dist/menubar/menubar-context.js +29 -0
- package/dist/menubar/menubar-context.js.map +1 -0
- package/dist/menubar/menubar-provider.d.ts +37 -0
- package/dist/menubar/menubar-provider.d.ts.map +1 -0
- package/dist/menubar/menubar-provider.js +41 -0
- package/dist/menubar/menubar-provider.js.map +1 -0
- package/dist/menubar/menubar-store.d.ts +2 -0
- package/dist/menubar/menubar-store.js +27 -0
- package/dist/menubar/menubar-store.js.map +1 -0
- package/dist/menubar/menubar.d.ts +71 -0
- package/dist/menubar/menubar.d.ts.map +1 -0
- package/dist/menubar/menubar.js +88 -0
- package/dist/menubar/menubar.js.map +1 -0
- package/dist/menubar-store-3h0eNIbS.d.ts +26 -0
- package/dist/menubar-store-3h0eNIbS.d.ts.map +1 -0
- package/dist/popover/popover-anchor.d.ts +2 -0
- package/dist/popover/popover-anchor.js +45 -0
- package/dist/popover/popover-anchor.js.map +1 -0
- package/dist/popover/popover-arrow-path.d.ts +5 -0
- package/dist/popover/popover-arrow-path.d.ts.map +1 -0
- package/dist/popover/popover-arrow-path.js +7 -0
- package/dist/popover/popover-arrow-path.js.map +1 -0
- package/dist/popover/popover-arrow.d.ts +65 -0
- package/dist/popover/popover-arrow.d.ts.map +1 -0
- package/dist/popover/popover-arrow.js +160 -0
- package/dist/popover/popover-arrow.js.map +1 -0
- package/dist/popover/popover-context.d.ts +24 -0
- package/dist/popover/popover-context.d.ts.map +1 -0
- package/dist/popover/popover-context.js +27 -0
- package/dist/popover/popover-context.js.map +1 -0
- package/dist/popover/popover-description.d.ts +2 -0
- package/dist/popover/popover-description.js +42 -0
- package/dist/popover/popover-description.js.map +1 -0
- package/dist/popover/popover-disclosure-arrow.d.ts +62 -0
- package/dist/popover/popover-disclosure-arrow.d.ts.map +1 -0
- package/dist/popover/popover-disclosure-arrow.js +81 -0
- package/dist/popover/popover-disclosure-arrow.js.map +1 -0
- package/dist/popover/popover-disclosure.d.ts +38 -0
- package/dist/popover/popover-disclosure.d.ts.map +1 -0
- package/dist/popover/popover-disclosure.js +66 -0
- package/dist/popover/popover-disclosure.js.map +1 -0
- package/dist/popover/popover-dismiss.d.ts +2 -0
- package/dist/popover/popover-dismiss.js +47 -0
- package/dist/popover/popover-dismiss.js.map +1 -0
- package/dist/popover/popover-heading.d.ts +2 -0
- package/dist/popover/popover-heading.js +42 -0
- package/dist/popover/popover-heading.js.map +1 -0
- package/dist/popover/popover-provider.d.ts +23 -0
- package/dist/popover/popover-provider.d.ts.map +1 -0
- package/dist/popover/popover-provider.js +27 -0
- package/dist/popover/popover-provider.js.map +1 -0
- package/dist/popover/popover-store.d.ts +2 -0
- package/dist/popover/popover-store.js +30 -0
- package/dist/popover/popover-store.js.map +1 -0
- package/dist/popover/popover.d.ts +2 -0
- package/dist/popover/popover.js +312 -0
- package/dist/popover/popover.js.map +1 -0
- package/dist/popover-CCqiRKqg.d.ts +181 -0
- package/dist/popover-CCqiRKqg.d.ts.map +1 -0
- package/dist/popover-anchor-PgfeXyzs.d.ts +47 -0
- package/dist/popover-anchor-PgfeXyzs.d.ts.map +1 -0
- package/dist/popover-description-DU753dah.d.ts +51 -0
- package/dist/popover-description-DU753dah.d.ts.map +1 -0
- package/dist/popover-dismiss-DPeI6Zse.d.ts +50 -0
- package/dist/popover-dismiss-DPeI6Zse.d.ts.map +1 -0
- package/dist/popover-heading-DGsr6D5W.d.ts +51 -0
- package/dist/popover-heading-DGsr6D5W.d.ts.map +1 -0
- package/dist/popover-store-Bc-l5VVO.d.ts +29 -0
- package/dist/popover-store-Bc-l5VVO.d.ts.map +1 -0
- package/dist/portal/portal-context.d.ts +21 -0
- package/dist/portal/portal-context.d.ts.map +1 -0
- package/dist/portal/portal-context.js +24 -0
- package/dist/portal/portal-context.js.map +1 -0
- package/dist/portal/portal.d.ts +2 -0
- package/dist/portal/portal.js +242 -0
- package/dist/portal/portal.js.map +1 -0
- package/dist/portal-CMBWiayp.d.ts +149 -0
- package/dist/portal-CMBWiayp.d.ts.map +1 -0
- package/dist/radio/radio-context.d.ts +24 -0
- package/dist/radio/radio-context.d.ts.map +1 -0
- package/dist/radio/radio-context.js +27 -0
- package/dist/radio/radio-context.js.map +1 -0
- package/dist/radio/radio-group.d.ts +51 -0
- package/dist/radio/radio-group.d.ts.map +1 -0
- package/dist/radio/radio-group.js +60 -0
- package/dist/radio/radio-group.js.map +1 -0
- package/dist/radio/radio-provider.d.ts +25 -0
- package/dist/radio/radio-provider.d.ts.map +1 -0
- package/dist/radio/radio-provider.js +29 -0
- package/dist/radio/radio-provider.js.map +1 -0
- package/dist/radio/radio-store.d.ts +2 -0
- package/dist/radio/radio-store.js +33 -0
- package/dist/radio/radio-store.js.map +1 -0
- package/dist/radio/radio.d.ts +76 -0
- package/dist/radio/radio.d.ts.map +1 -0
- package/dist/radio/radio.js +143 -0
- package/dist/radio/radio.js.map +1 -0
- package/dist/radio-store-DOZ_1RSk.d.ts +36 -0
- package/dist/radio-store-DOZ_1RSk.d.ts.map +1 -0
- package/dist/role/role.d.ts +34 -0
- package/dist/role/role.d.ts.map +1 -0
- package/dist/role/role.js +68 -0
- package/dist/role/role.js.map +1 -0
- package/dist/select/select-arrow.d.ts +60 -0
- package/dist/select/select-arrow.d.ts.map +1 -0
- package/dist/select/select-arrow.js +58 -0
- package/dist/select/select-arrow.js.map +1 -0
- package/dist/select/select-context.d.ts +27 -0
- package/dist/select/select-context.d.ts.map +1 -0
- package/dist/select/select-context.js +31 -0
- package/dist/select/select-context.js.map +1 -0
- package/dist/select/select-dismiss.d.ts +59 -0
- package/dist/select/select-dismiss.d.ts.map +1 -0
- package/dist/select/select-dismiss.js +56 -0
- package/dist/select/select-dismiss.js.map +1 -0
- package/dist/select/select-group-label.d.ts +61 -0
- package/dist/select/select-group-label.d.ts.map +1 -0
- package/dist/select/select-group-label.js +52 -0
- package/dist/select/select-group-label.js.map +1 -0
- package/dist/select/select-group.d.ts +62 -0
- package/dist/select/select-group.d.ts.map +1 -0
- package/dist/select/select-group.js +53 -0
- package/dist/select/select-group.js.map +1 -0
- package/dist/select/select-heading.d.ts +59 -0
- package/dist/select/select-heading.d.ts.map +1 -0
- package/dist/select/select-heading.js +62 -0
- package/dist/select/select-heading.js.map +1 -0
- package/dist/select/select-item-check.d.ts +59 -0
- package/dist/select/select-item-check.d.ts.map +1 -0
- package/dist/select/select-item-check.js +61 -0
- package/dist/select/select-item-check.js.map +1 -0
- package/dist/select/select-item-offscreen.d.ts +37 -0
- package/dist/select/select-item-offscreen.d.ts.map +1 -0
- package/dist/select/select-item-offscreen.js +38 -0
- package/dist/select/select-item-offscreen.js.map +1 -0
- package/dist/select/select-item.d.ts +108 -0
- package/dist/select/select-item.d.ts.map +1 -0
- package/dist/select/select-item.js +143 -0
- package/dist/select/select-item.js.map +1 -0
- package/dist/select/select-label.d.ts +55 -0
- package/dist/select/select-label.d.ts.map +1 -0
- package/dist/select/select-label.js +70 -0
- package/dist/select/select-label.js.map +1 -0
- package/dist/select/select-list.d.ts +80 -0
- package/dist/select/select-list.d.ts.map +1 -0
- package/dist/select/select-list.js +143 -0
- package/dist/select/select-list.js.map +1 -0
- package/dist/select/select-popover.d.ts +44 -0
- package/dist/select/select-popover.d.ts.map +1 -0
- package/dist/select/select-popover.js +59 -0
- package/dist/select/select-popover.js.map +1 -0
- package/dist/select/select-provider.d.ts +30 -0
- package/dist/select/select-provider.d.ts.map +1 -0
- package/dist/select/select-provider.js +15 -0
- package/dist/select/select-provider.js.map +1 -0
- package/dist/select/select-renderer.d.ts +44 -0
- package/dist/select/select-renderer.d.ts.map +1 -0
- package/dist/select/select-renderer.js +61 -0
- package/dist/select/select-renderer.js.map +1 -0
- package/dist/select/select-row.d.ts +63 -0
- package/dist/select/select-row.d.ts.map +1 -0
- package/dist/select/select-row.js +67 -0
- package/dist/select/select-row.js.map +1 -0
- package/dist/select/select-separator.d.ts +60 -0
- package/dist/select/select-separator.d.ts.map +1 -0
- package/dist/select/select-separator.js +57 -0
- package/dist/select/select-separator.js.map +1 -0
- package/dist/select/select-store.d.ts +2 -0
- package/dist/select/select-store.js +31 -0
- package/dist/select/select-store.js.map +1 -0
- package/dist/select/select-value.d.ts +84 -0
- package/dist/select/select-value.d.ts.map +1 -0
- package/dist/select/select-value.js +18 -0
- package/dist/select/select-value.js.map +1 -0
- package/dist/select/select.d.ts +89 -0
- package/dist/select/select.d.ts.map +1 -0
- package/dist/select/select.js +211 -0
- package/dist/select/select.js.map +1 -0
- package/dist/select-store-BsLTAyKh.d.ts +68 -0
- package/dist/select-store-BsLTAyKh.d.ts.map +1 -0
- package/dist/separator/separator.d.ts +2 -0
- package/dist/separator/separator.js +36 -0
- package/dist/separator/separator.js.map +1 -0
- package/dist/separator--ozQfMcK.d.ts +36 -0
- package/dist/separator--ozQfMcK.d.ts.map +1 -0
- package/dist/store.d.ts +1 -0
- package/dist/store.js +2 -0
- package/dist/tab/tab-context.d.ts +24 -0
- package/dist/tab/tab-context.d.ts.map +1 -0
- package/dist/tab/tab-context.js +27 -0
- package/dist/tab/tab-context.js.map +1 -0
- package/dist/tab/tab-list.d.ts +55 -0
- package/dist/tab/tab-list.d.ts.map +1 -0
- package/dist/tab/tab-list.js +71 -0
- package/dist/tab/tab-list.js.map +1 -0
- package/dist/tab/tab-panel.d.ts +122 -0
- package/dist/tab/tab-panel.d.ts.map +1 -0
- package/dist/tab/tab-panel.js +169 -0
- package/dist/tab/tab-panel.js.map +1 -0
- package/dist/tab/tab-provider.d.ts +26 -0
- package/dist/tab/tab-provider.d.ts.map +1 -0
- package/dist/tab/tab-provider.js +30 -0
- package/dist/tab/tab-provider.js.map +1 -0
- package/dist/tab/tab-store.d.ts +77 -0
- package/dist/tab/tab-store.d.ts.map +1 -0
- package/dist/tab/tab-store.js +55 -0
- package/dist/tab/tab-store.js.map +1 -0
- package/dist/tab/tab.d.ts +56 -0
- package/dist/tab/tab.d.ts.map +1 -0
- package/dist/tab/tab.js +115 -0
- package/dist/tab/tab.js.map +1 -0
- package/dist/tag/tag-context.d.ts +26 -0
- package/dist/tag/tag-context.d.ts.map +1 -0
- package/dist/tag/tag-context.js +30 -0
- package/dist/tag/tag-context.js.map +1 -0
- package/dist/tag/tag-input.d.ts +126 -0
- package/dist/tag/tag-input.d.ts.map +1 -0
- package/dist/tag/tag-input.js +162 -0
- package/dist/tag/tag-input.js.map +1 -0
- package/dist/tag/tag-list-label.d.ts +59 -0
- package/dist/tag/tag-list-label.d.ts.map +1 -0
- package/dist/tag/tag-list-label.js +62 -0
- package/dist/tag/tag-list-label.js.map +1 -0
- package/dist/tag/tag-list.d.ts +62 -0
- package/dist/tag/tag-list.d.ts.map +1 -0
- package/dist/tag/tag-list.js +127 -0
- package/dist/tag/tag-list.js.map +1 -0
- package/dist/tag/tag-provider.d.ts +34 -0
- package/dist/tag/tag-provider.d.ts.map +1 -0
- package/dist/tag/tag-provider.js +38 -0
- package/dist/tag/tag-provider.js.map +1 -0
- package/dist/tag/tag-remove.d.ts +71 -0
- package/dist/tag/tag-remove.d.ts.map +1 -0
- package/dist/tag/tag-remove.js +102 -0
- package/dist/tag/tag-remove.js.map +1 -0
- package/dist/tag/tag-store.d.ts +2 -0
- package/dist/tag/tag-store.js +38 -0
- package/dist/tag/tag-store.js.map +1 -0
- package/dist/tag/tag-value.d.ts +49 -0
- package/dist/tag/tag-value.d.ts.map +1 -0
- package/dist/tag/tag-value.js +40 -0
- package/dist/tag/tag-value.js.map +1 -0
- package/dist/tag/tag-values.d.ts +60 -0
- package/dist/tag/tag-values.d.ts.map +1 -0
- package/dist/tag/tag-values.js +50 -0
- package/dist/tag/tag-values.js.map +1 -0
- package/dist/tag/tag.d.ts +78 -0
- package/dist/tag/tag.d.ts.map +1 -0
- package/dist/tag/tag.js +114 -0
- package/dist/tag/tag.js.map +1 -0
- package/dist/tag/utils.d.ts +5 -0
- package/dist/tag/utils.d.ts.map +1 -0
- package/dist/tag/utils.js +15 -0
- package/dist/tag/utils.js.map +1 -0
- package/dist/tag-store-xANOvuGo.d.ts +49 -0
- package/dist/tag-store-xANOvuGo.d.ts.map +1 -0
- package/dist/toolbar/toolbar-container.d.ts +41 -0
- package/dist/toolbar/toolbar-container.d.ts.map +1 -0
- package/dist/toolbar/toolbar-container.js +53 -0
- package/dist/toolbar/toolbar-container.js.map +1 -0
- package/dist/toolbar/toolbar-context.d.ts +24 -0
- package/dist/toolbar/toolbar-context.d.ts.map +1 -0
- package/dist/toolbar/toolbar-context.js +27 -0
- package/dist/toolbar/toolbar-context.js.map +1 -0
- package/dist/toolbar/toolbar-input.d.ts +39 -0
- package/dist/toolbar/toolbar-input.d.ts.map +1 -0
- package/dist/toolbar/toolbar-input.js +47 -0
- package/dist/toolbar/toolbar-input.js.map +1 -0
- package/dist/toolbar/toolbar-item.d.ts +47 -0
- package/dist/toolbar/toolbar-item.d.ts.map +1 -0
- package/dist/toolbar/toolbar-item.js +45 -0
- package/dist/toolbar/toolbar-item.js.map +1 -0
- package/dist/toolbar/toolbar-provider.d.ts +26 -0
- package/dist/toolbar/toolbar-provider.d.ts.map +1 -0
- package/dist/toolbar/toolbar-provider.js +30 -0
- package/dist/toolbar/toolbar-provider.js.map +1 -0
- package/dist/toolbar/toolbar-separator.d.ts +51 -0
- package/dist/toolbar/toolbar-separator.d.ts.map +1 -0
- package/dist/toolbar/toolbar-separator.js +49 -0
- package/dist/toolbar/toolbar-separator.js.map +1 -0
- package/dist/toolbar/toolbar-store.d.ts +2 -0
- package/dist/toolbar/toolbar-store.js +31 -0
- package/dist/toolbar/toolbar-store.js.map +1 -0
- package/dist/toolbar/toolbar.d.ts +50 -0
- package/dist/toolbar/toolbar.d.ts.map +1 -0
- package/dist/toolbar/toolbar.js +66 -0
- package/dist/toolbar/toolbar.js.map +1 -0
- package/dist/toolbar-store-Cs-9cGHx.d.ts +30 -0
- package/dist/toolbar-store-Cs-9cGHx.d.ts.map +1 -0
- package/dist/tooltip/tooltip-anchor.d.ts +53 -0
- package/dist/tooltip/tooltip-anchor.d.ts.map +1 -0
- package/dist/tooltip/tooltip-anchor.js +121 -0
- package/dist/tooltip/tooltip-anchor.js.map +1 -0
- package/dist/tooltip/tooltip-arrow.d.ts +54 -0
- package/dist/tooltip/tooltip-arrow.d.ts.map +1 -0
- package/dist/tooltip/tooltip-arrow.js +54 -0
- package/dist/tooltip/tooltip-arrow.js.map +1 -0
- package/dist/tooltip/tooltip-context.d.ts +24 -0
- package/dist/tooltip/tooltip-context.d.ts.map +1 -0
- package/dist/tooltip/tooltip-context.js +27 -0
- package/dist/tooltip/tooltip-context.js.map +1 -0
- package/dist/tooltip/tooltip-provider.d.ts +23 -0
- package/dist/tooltip/tooltip-provider.d.ts.map +1 -0
- package/dist/tooltip/tooltip-provider.js +27 -0
- package/dist/tooltip/tooltip-provider.js.map +1 -0
- package/dist/tooltip/tooltip-store.d.ts +30 -0
- package/dist/tooltip/tooltip-store.d.ts.map +1 -0
- package/dist/tooltip/tooltip-store.js +30 -0
- package/dist/tooltip/tooltip-store.js.map +1 -0
- package/dist/tooltip/tooltip.d.ts +61 -0
- package/dist/tooltip/tooltip.d.ts.map +1 -0
- package/dist/tooltip/tooltip.js +81 -0
- package/dist/tooltip/tooltip.js.map +1 -0
- package/dist/utils-DUF1aMov.d.ts +5 -0
- package/dist/utils-DUF1aMov.d.ts.map +1 -0
- package/dist/visually-hidden/visually-hidden.d.ts +37 -0
- package/dist/visually-hidden/visually-hidden.d.ts.map +1 -0
- package/dist/visually-hidden/visually-hidden.js +53 -0
- package/dist/visually-hidden/visually-hidden.js.map +1 -0
- package/license +21 -0
- package/package.json +936 -0
- package/readme.md +19 -0
- package/src/button/button.tsx +76 -0
- package/src/checkbox/checkbox-check.tsx +116 -0
- package/src/checkbox/checkbox-checked-context.tsx +3 -0
- package/src/checkbox/checkbox-context.tsx +27 -0
- package/src/checkbox/checkbox-provider.tsx +53 -0
- package/src/checkbox/checkbox-store.ts +76 -0
- package/src/checkbox/checkbox.tsx +271 -0
- package/src/collection/collection-context.tsx +27 -0
- package/src/collection/collection-item-offscreen.tsx +157 -0
- package/src/collection/collection-item.tsx +136 -0
- package/src/collection/collection-provider.tsx +47 -0
- package/src/collection/collection-renderer.tsx +994 -0
- package/src/collection/collection-store.ts +84 -0
- package/src/collection/collection.tsx +93 -0
- package/src/combobox/combobox-cancel.tsx +153 -0
- package/src/combobox/combobox-context.tsx +49 -0
- package/src/combobox/combobox-disclosure.tsx +162 -0
- package/src/combobox/combobox-group-label.tsx +74 -0
- package/src/combobox/combobox-group.tsx +100 -0
- package/src/combobox/combobox-item-check.tsx +83 -0
- package/src/combobox/combobox-item-offscreen.tsx +87 -0
- package/src/combobox/combobox-item-value.tsx +231 -0
- package/src/combobox/combobox-item.tsx +363 -0
- package/src/combobox/combobox-label.tsx +89 -0
- package/src/combobox/combobox-list.tsx +176 -0
- package/src/combobox/combobox-popover.tsx +179 -0
- package/src/combobox/combobox-provider.tsx +50 -0
- package/src/combobox/combobox-row.tsx +102 -0
- package/src/combobox/combobox-separator.tsx +90 -0
- package/src/combobox/combobox-store.ts +168 -0
- package/src/combobox/combobox-value.tsx +63 -0
- package/src/combobox/combobox.tsx +900 -0
- package/src/command/command.tsx +215 -0
- package/src/composite/composite-container.tsx +278 -0
- package/src/composite/composite-context.tsx +53 -0
- package/src/composite/composite-group-label.tsx +73 -0
- package/src/composite/composite-group.tsx +77 -0
- package/src/composite/composite-hover.tsx +230 -0
- package/src/composite/composite-input.tsx +147 -0
- package/src/composite/composite-item-offscreen.tsx +112 -0
- package/src/composite/composite-item.tsx +567 -0
- package/src/composite/composite-overflow-disclosure.ts +117 -0
- package/src/composite/composite-overflow-store.ts +61 -0
- package/src/composite/composite-overflow.tsx +123 -0
- package/src/composite/composite-provider.tsx +47 -0
- package/src/composite/composite-renderer.tsx +231 -0
- package/src/composite/composite-row.tsx +133 -0
- package/src/composite/composite-separator.tsx +96 -0
- package/src/composite/composite-store.ts +101 -0
- package/src/composite/composite-typeahead.tsx +246 -0
- package/src/composite/composite.tsx +592 -0
- package/src/composite/utils.ts +121 -0
- package/src/dialog/dialog-backdrop.tsx +71 -0
- package/src/dialog/dialog-context.tsx +43 -0
- package/src/dialog/dialog-description.tsx +86 -0
- package/src/dialog/dialog-disclosure.tsx +84 -0
- package/src/dialog/dialog-dismiss.tsx +113 -0
- package/src/dialog/dialog-heading.tsx +88 -0
- package/src/dialog/dialog-provider.tsx +28 -0
- package/src/dialog/dialog-store.ts +51 -0
- package/src/dialog/dialog.tsx +866 -0
- package/src/dialog/utils/disable-accessibility-tree-outside.ts +30 -0
- package/src/dialog/utils/disable-tree.ts +81 -0
- package/src/dialog/utils/is-backdrop.ts +12 -0
- package/src/dialog/utils/is-focus-trap.ts +11 -0
- package/src/dialog/utils/mark-tree-outside.ts +67 -0
- package/src/dialog/utils/orchestrate.ts +123 -0
- package/src/dialog/utils/prepend-hidden-dismiss.ts +35 -0
- package/src/dialog/utils/supports-inert.ts +5 -0
- package/src/dialog/utils/use-hide-on-interact-outside.ts +181 -0
- package/src/dialog/utils/use-nested-dialogs.tsx +55 -0
- package/src/dialog/utils/use-prevent-body-scroll.ts +86 -0
- package/src/dialog/utils/use-previous-mouse-down-ref.ts +19 -0
- package/src/dialog/utils/use-root-dialog.ts +49 -0
- package/src/dialog/utils/walk-tree-outside.ts +85 -0
- package/src/disclosure/disclosure-content.tsx +344 -0
- package/src/disclosure/disclosure-context.tsx +27 -0
- package/src/disclosure/disclosure-provider.tsx +29 -0
- package/src/disclosure/disclosure-store.ts +85 -0
- package/src/disclosure/disclosure.tsx +144 -0
- package/src/focus-trap/focus-trap-region.tsx +112 -0
- package/src/focus-trap/focus-trap.tsx +60 -0
- package/src/focusable/focusable-container.tsx +75 -0
- package/src/focusable/focusable-context.tsx +3 -0
- package/src/focusable/focusable.tsx +559 -0
- package/src/form/form-checkbox.tsx +106 -0
- package/src/form/form-context.tsx +34 -0
- package/src/form/form-control.tsx +227 -0
- package/src/form/form-description.tsx +142 -0
- package/src/form/form-error.tsx +156 -0
- package/src/form/form-field.tsx +94 -0
- package/src/form/form-group-label.tsx +79 -0
- package/src/form/form-group.tsx +79 -0
- package/src/form/form-input.tsx +104 -0
- package/src/form/form-label.tsx +192 -0
- package/src/form/form-provider.tsx +49 -0
- package/src/form/form-push.tsx +200 -0
- package/src/form/form-radio-group.tsx +93 -0
- package/src/form/form-radio.tsx +122 -0
- package/src/form/form-remove.tsx +198 -0
- package/src/form/form-reset.tsx +85 -0
- package/src/form/form-store.ts +195 -0
- package/src/form/form-submit.tsx +93 -0
- package/src/form/form.tsx +249 -0
- package/src/group/group-label-context.tsx +6 -0
- package/src/group/group-label.tsx +75 -0
- package/src/group/group.tsx +69 -0
- package/src/heading/heading-context.tsx +4 -0
- package/src/heading/heading-level.tsx +42 -0
- package/src/heading/heading.tsx +81 -0
- package/src/heading/utils.ts +1 -0
- package/src/hovercard/hovercard-anchor.tsx +195 -0
- package/src/hovercard/hovercard-arrow.tsx +74 -0
- package/src/hovercard/hovercard-context.tsx +34 -0
- package/src/hovercard/hovercard-description.tsx +69 -0
- package/src/hovercard/hovercard-disclosure.tsx +196 -0
- package/src/hovercard/hovercard-dismiss.tsx +70 -0
- package/src/hovercard/hovercard-heading.tsx +68 -0
- package/src/hovercard/hovercard-provider.tsx +29 -0
- package/src/hovercard/hovercard-store.ts +58 -0
- package/src/hovercard/hovercard.tsx +445 -0
- package/src/hovercard/utils/__tests__/polygon-test.ts +66 -0
- package/src/hovercard/utils/debug-polygon.ts +37 -0
- package/src/hovercard/utils/polygon.ts +96 -0
- package/src/index.ts +1 -0
- package/src/menu/menu-arrow.tsx +69 -0
- package/src/menu/menu-bar-provider.tsx +44 -0
- package/src/menu/menu-bar-store.ts +54 -0
- package/src/menu/menu-bar.tsx +84 -0
- package/src/menu/menu-button-arrow.tsx +85 -0
- package/src/menu/menu-button.tsx +338 -0
- package/src/menu/menu-context.tsx +76 -0
- package/src/menu/menu-description.tsx +67 -0
- package/src/menu/menu-dismiss.tsx +69 -0
- package/src/menu/menu-group-label.tsx +72 -0
- package/src/menu/menu-group.tsx +76 -0
- package/src/menu/menu-heading.tsx +67 -0
- package/src/menu/menu-item-check.tsx +79 -0
- package/src/menu/menu-item-checkbox.tsx +227 -0
- package/src/menu/menu-item-radio.tsx +198 -0
- package/src/menu/menu-item.tsx +223 -0
- package/src/menu/menu-list.tsx +230 -0
- package/src/menu/menu-provider.tsx +42 -0
- package/src/menu/menu-separator.tsx +79 -0
- package/src/menu/menu-store.ts +155 -0
- package/src/menu/menu.tsx +274 -0
- package/src/menubar/menubar-context.tsx +39 -0
- package/src/menubar/menubar-provider.tsx +43 -0
- package/src/menubar/menubar-store.ts +48 -0
- package/src/menubar/menubar.tsx +145 -0
- package/src/popover/popover-anchor.tsx +74 -0
- package/src/popover/popover-arrow-path.ts +21 -0
- package/src/popover/popover-arrow.tsx +228 -0
- package/src/popover/popover-context.tsx +34 -0
- package/src/popover/popover-description.tsx +69 -0
- package/src/popover/popover-disclosure-arrow.tsx +135 -0
- package/src/popover/popover-disclosure.tsx +101 -0
- package/src/popover/popover-dismiss.tsx +70 -0
- package/src/popover/popover-heading.tsx +68 -0
- package/src/popover/popover-provider.tsx +29 -0
- package/src/popover/popover-store.ts +53 -0
- package/src/popover/popover.tsx +649 -0
- package/src/portal/portal-context.tsx +19 -0
- package/src/portal/portal.tsx +493 -0
- package/src/radio/radio-context.tsx +34 -0
- package/src/radio/radio-group.tsx +103 -0
- package/src/radio/radio-provider.tsx +29 -0
- package/src/radio/radio-store.ts +64 -0
- package/src/radio/radio.tsx +242 -0
- package/src/role/role.tsx +88 -0
- package/src/select/select-arrow.tsx +80 -0
- package/src/select/select-context.tsx +46 -0
- package/src/select/select-dismiss.tsx +79 -0
- package/src/select/select-group-label.tsx +78 -0
- package/src/select/select-group.tsx +79 -0
- package/src/select/select-heading.tsx +98 -0
- package/src/select/select-item-check.tsx +80 -0
- package/src/select/select-item-offscreen.tsx +59 -0
- package/src/select/select-item.tsx +294 -0
- package/src/select/select-label.tsx +117 -0
- package/src/select/select-list.tsx +251 -0
- package/src/select/select-popover.tsx +67 -0
- package/src/select/select-provider.tsx +45 -0
- package/src/select/select-renderer.tsx +160 -0
- package/src/select/select-row.tsx +97 -0
- package/src/select/select-separator.tsx +80 -0
- package/src/select/select-store.ts +139 -0
- package/src/select/select-value.tsx +108 -0
- package/src/select/select.tsx +371 -0
- package/src/separator/separator.tsx +54 -0
- package/src/store.ts +1 -0
- package/src/tab/tab-context.tsx +34 -0
- package/src/tab/tab-list.tsx +120 -0
- package/src/tab/tab-panel.tsx +314 -0
- package/src/tab/tab-provider.tsx +30 -0
- package/src/tab/tab-store.ts +124 -0
- package/src/tab/tab.tsx +208 -0
- package/src/tag/tag-context.tsx +40 -0
- package/src/tag/tag-input.tsx +321 -0
- package/src/tag/tag-list-label.tsx +102 -0
- package/src/tag/tag-list.tsx +210 -0
- package/src/tag/tag-provider.tsx +38 -0
- package/src/tag/tag-remove.tsx +174 -0
- package/src/tag/tag-store.ts +72 -0
- package/src/tag/tag-value.tsx +63 -0
- package/src/tag/tag-values.tsx +74 -0
- package/src/tag/tag.tsx +199 -0
- package/src/tag/utils.ts +12 -0
- package/src/toolbar/toolbar-container.tsx +67 -0
- package/src/toolbar/toolbar-context.tsx +34 -0
- package/src/toolbar/toolbar-input.tsx +64 -0
- package/src/toolbar/toolbar-item.tsx +72 -0
- package/src/toolbar/toolbar-provider.tsx +32 -0
- package/src/toolbar/toolbar-separator.tsx +71 -0
- package/src/toolbar/toolbar-store.ts +52 -0
- package/src/toolbar/toolbar.tsx +119 -0
- package/src/tooltip/tooltip-anchor.tsx +210 -0
- package/src/tooltip/tooltip-arrow.tsx +84 -0
- package/src/tooltip/tooltip-context.tsx +34 -0
- package/src/tooltip/tooltip-provider.tsx +29 -0
- package/src/tooltip/tooltip-store.ts +53 -0
- package/src/tooltip/tooltip.tsx +153 -0
- package/src/visually-hidden/visually-hidden.tsx +67 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CollectionContextProvider, CollectionScopedContextProvider } from "../collection/collection-context.js";
|
|
3
|
+
import { createStoreContext } from "@ariakit/react-utils";
|
|
4
|
+
//#region src/form/form-context.tsx
|
|
5
|
+
const ctx = createStoreContext([CollectionContextProvider], [CollectionScopedContextProvider]);
|
|
6
|
+
/**
|
|
7
|
+
* Returns the form store from the nearest form container.
|
|
8
|
+
* @example
|
|
9
|
+
* function FormInput() {
|
|
10
|
+
* const store = useFormContext();
|
|
11
|
+
*
|
|
12
|
+
* if (!store) {
|
|
13
|
+
* throw new Error("FormInput must be wrapped in FormProvider");
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* // Use the store...
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
const useFormContext = ctx.useContext;
|
|
20
|
+
const useFormScopedContext = ctx.useScopedContext;
|
|
21
|
+
const useFormProviderContext = ctx.useProviderContext;
|
|
22
|
+
const FormContextProvider = ctx.ContextProvider;
|
|
23
|
+
const FormScopedContextProvider = ctx.ScopedContextProvider;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { FormContextProvider, FormScopedContextProvider, useFormContext, useFormProviderContext, useFormScopedContext };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=form-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-context.js","names":[],"sources":["../../src/form/form-context.tsx"],"sourcesContent":["import { createStoreContext } from \"@ariakit/react-utils\";\nimport {\n CollectionContextProvider,\n CollectionScopedContextProvider,\n} from \"../collection/collection-context.tsx\";\nimport type { FormStore } from \"./form-store.ts\";\n\nconst ctx = createStoreContext<FormStore>(\n [CollectionContextProvider],\n [CollectionScopedContextProvider],\n);\n\n/**\n * Returns the form store from the nearest form container.\n * @example\n * function FormInput() {\n * const store = useFormContext();\n *\n * if (!store) {\n * throw new Error(\"FormInput must be wrapped in FormProvider\");\n * }\n *\n * // Use the store...\n * }\n */\nexport const useFormContext = ctx.useContext;\n\nexport const useFormScopedContext = ctx.useScopedContext;\n\nexport const useFormProviderContext = ctx.useProviderContext;\n\nexport const FormContextProvider = ctx.ContextProvider;\n\nexport const FormScopedContextProvider = ctx.ScopedContextProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,MAAa,iBAAA,IAAA;AAEb,MAAa,uBAAA,IAAyB;AAEtC,MAAa,yBAAsB,IAAI;AAEvC,MAAa,sBAAA,IAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { n as CollectionItemOptions } from "../collection-item-C-g2BwVF.js";
|
|
2
|
+
import { t as FormStore } from "../form-store-C4Kf5QHm.js";
|
|
3
|
+
import { Props } from "@ariakit/react-utils";
|
|
4
|
+
import { ElementType, FocusEvent } from "react";
|
|
5
|
+
import { BooleanOrCallback } from "@ariakit/utils";
|
|
6
|
+
import { StringLike } from "@ariakit/components/form/types";
|
|
7
|
+
|
|
8
|
+
//#region src/form/form-control.d.ts
|
|
9
|
+
declare const TagName = "input";
|
|
10
|
+
type TagName = typeof TagName;
|
|
11
|
+
/**
|
|
12
|
+
* Returns props to create a `FormControl` component. Unlike `useFormInput`,
|
|
13
|
+
* this hook doesn't automatically returns the `value` and `onChange` props.
|
|
14
|
+
* This is so we can use it not only for native form elements but also for
|
|
15
|
+
* custom components whose value is not controlled by the native `value` and
|
|
16
|
+
* `onChange` props.
|
|
17
|
+
* @see https://ariakit.com/components/form
|
|
18
|
+
* @example
|
|
19
|
+
* ```jsx
|
|
20
|
+
* const store = useFormStore({ defaultValues: { content: "" } });
|
|
21
|
+
* const props = useFormControl({ store, name: store.names.content });
|
|
22
|
+
* const value = store.useValue(store.names.content);
|
|
23
|
+
*
|
|
24
|
+
* <Form store={store}>
|
|
25
|
+
* <FormLabel name={store.names.content}>Content</FormLabel>
|
|
26
|
+
* <Role
|
|
27
|
+
* {...props}
|
|
28
|
+
* value={value}
|
|
29
|
+
* onChange={(value) => store.setValue(store.names.content, value)}
|
|
30
|
+
* render={<Editor />}
|
|
31
|
+
* />
|
|
32
|
+
* </Form>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const useFormControl: import("@ariakit/react-utils").Hook<"input", FormControlOptions<"input">>;
|
|
36
|
+
/**
|
|
37
|
+
* Abstract component that renders a form control. Unlike
|
|
38
|
+
* [`FormInput`](https://ariakit.com/reference/form-input), this component
|
|
39
|
+
* doesn't automatically pass the `value` and `onChange` props down to the
|
|
40
|
+
* underlying element. This is so we can use it not only for native form
|
|
41
|
+
* elements but also for custom components whose value is not controlled by the
|
|
42
|
+
* native `value` and `onChange` props.
|
|
43
|
+
* @see https://ariakit.com/components/form
|
|
44
|
+
* @example
|
|
45
|
+
* ```jsx {11-19}
|
|
46
|
+
* const form = useFormStore({
|
|
47
|
+
* defaultValues: {
|
|
48
|
+
* content: "",
|
|
49
|
+
* },
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* const value = form.useValue(form.names.content);
|
|
53
|
+
*
|
|
54
|
+
* <Form store={form}>
|
|
55
|
+
* <FormLabel name={form.names.content}>Content</FormLabel>
|
|
56
|
+
* <FormControl
|
|
57
|
+
* name={form.names.content}
|
|
58
|
+
* render={
|
|
59
|
+
* <Editor
|
|
60
|
+
* value={value}
|
|
61
|
+
* onChange={(value) => form.setValue(form.names.content, value)}
|
|
62
|
+
* />
|
|
63
|
+
* }
|
|
64
|
+
* />
|
|
65
|
+
* </Form>
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
declare const FormControl: (props: FormControlProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
69
|
+
interface FormControlOptions<T extends ElementType = TagName> extends CollectionItemOptions<T> {
|
|
70
|
+
/**
|
|
71
|
+
* Object returned by the
|
|
72
|
+
* [`useFormStore`](https://ariakit.com/reference/use-form-store) hook. If not
|
|
73
|
+
* provided, the closest [`Form`](https://ariakit.com/reference/form) or
|
|
74
|
+
* [`FormProvider`](https://ariakit.com/reference/form-provider) components'
|
|
75
|
+
* context will be used.
|
|
76
|
+
*/
|
|
77
|
+
store?: FormStore;
|
|
78
|
+
/**
|
|
79
|
+
* Field name. This can either be a string corresponding to an existing
|
|
80
|
+
* property name in the
|
|
81
|
+
* [`values`](https://ariakit.com/reference/use-form-store#values) state of
|
|
82
|
+
* the store, or a reference to a field name from the
|
|
83
|
+
* [`names`](https://ariakit.com/reference/use-form-store#names) object in the
|
|
84
|
+
* store, ensuring type safety.
|
|
85
|
+
*
|
|
86
|
+
* Live examples:
|
|
87
|
+
* - [FormRadio](https://ariakit.com/examples/form-radio)
|
|
88
|
+
* - [Form with Select](https://ariakit.com/examples/form-select)
|
|
89
|
+
*/
|
|
90
|
+
name: StringLike;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the field should be marked touched on blur.
|
|
93
|
+
* @default true
|
|
94
|
+
*/
|
|
95
|
+
touchOnBlur?: BooleanOrCallback<FocusEvent>;
|
|
96
|
+
}
|
|
97
|
+
type FormControlProps<T extends ElementType = TagName> = Props<T, FormControlOptions<T>>;
|
|
98
|
+
//#endregion
|
|
99
|
+
export { FormControl, FormControlOptions, FormControlProps, useFormControl };
|
|
100
|
+
//# sourceMappingURL=form-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-control.d.ts","names":["StringLike","Props","BooleanOrCallback","ElementType","FocusEvent","CollectionItemOptions","FormStore","TagName","useFormControl","FormControlOptions","Hook","FormControl","FormControlProps","props","ReactElement","JSXElementConstructor","T","store","name","touchOnBlur"],"sources":["../../src/form/form-control.d.ts"],"mappings":";;;;;;;;cAMcO,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;AAyB7B;;;;AAAoG;AAiCpG;;;;;;;;;AA5DiD,cA2B5BC,cAAAA,iCAA+CE,IAAAA,UAAcD,kBAAkB;AAkCpG;;;;;;;;;;;;;;;;;;;;;;;;;;AA0B8C;AAE9C;;;;;AA5BA,cADqBE,WAAAA,GAAcE,KAAAA,EAAOD,gBAAgB,qBAAqBE,YAAAA,+BAA2CC,qBAAAA;AAAAA,UACzGN,kBAAAA,WAA6BN,WAAAA,GAAcI,OAAAA,UAAiBF,qBAAAA,CAAsBW,CAAAA;EA4B1BP;;;;;;;EApBrEQ,KAAAA,GAAQX,SAAAA;EAoB0DU;;;;AAAuB;;;;;;;;EAPzFE,IAAAA,EAAMlB,UAAAA;;;;;EAKNmB,WAAAA,GAAcjB,iBAAAA,CAAkBE,UAAAA;AAAAA;AAAAA,KAExBQ,gBAAAA,WAA2BT,WAAAA,GAAcI,OAAAA,IAAWN,KAAAA,CAAMe,CAAAA,EAAGP,kBAAAA,CAAmBO,CAAAA"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCollectionItem } from "../collection/collection-item.js";
|
|
3
|
+
import { useFormContext } from "./form-context.js";
|
|
4
|
+
import { createElement, createHook, forwardRef, memo, useBooleanEvent, useEvent, useId, useMergeRefs } from "@ariakit/react-utils";
|
|
5
|
+
import { cx, getDocument, invariant } from "@ariakit/utils";
|
|
6
|
+
import { useCallback, useRef } from "react";
|
|
7
|
+
import { useStoreState } from "@ariakit/react-store";
|
|
8
|
+
//#region src/form/form-control.tsx
|
|
9
|
+
const TagName = "input";
|
|
10
|
+
function getNamedElement(ref, name) {
|
|
11
|
+
const element = ref.current;
|
|
12
|
+
if (!element) return null;
|
|
13
|
+
if (element.name === name) return element;
|
|
14
|
+
if (element.form) return element.form.elements.namedItem(name);
|
|
15
|
+
return getDocument(element).getElementsByName(name)[0];
|
|
16
|
+
}
|
|
17
|
+
function useItem(store, name, type) {
|
|
18
|
+
return useStoreState(store, (state) => state.items.find((item) => item.type === type && item.name === name));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns props to create a `FormControl` component. Unlike `useFormInput`,
|
|
22
|
+
* this hook doesn't automatically returns the `value` and `onChange` props.
|
|
23
|
+
* This is so we can use it not only for native form elements but also for
|
|
24
|
+
* custom components whose value is not controlled by the native `value` and
|
|
25
|
+
* `onChange` props.
|
|
26
|
+
* @see https://ariakit.com/components/form
|
|
27
|
+
* @example
|
|
28
|
+
* ```jsx
|
|
29
|
+
* const store = useFormStore({ defaultValues: { content: "" } });
|
|
30
|
+
* const props = useFormControl({ store, name: store.names.content });
|
|
31
|
+
* const value = store.useValue(store.names.content);
|
|
32
|
+
*
|
|
33
|
+
* <Form store={store}>
|
|
34
|
+
* <FormLabel name={store.names.content}>Content</FormLabel>
|
|
35
|
+
* <Role
|
|
36
|
+
* {...props}
|
|
37
|
+
* value={value}
|
|
38
|
+
* onChange={(value) => store.setValue(store.names.content, value)}
|
|
39
|
+
* render={<Editor />}
|
|
40
|
+
* />
|
|
41
|
+
* </Form>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
const useFormControl = createHook(function useFormControl({ store, name: nameProp, getItem: getItemProp, touchOnBlur = true, ...props }) {
|
|
45
|
+
const context = useFormContext();
|
|
46
|
+
store = store || context;
|
|
47
|
+
invariant(store, "FormControl must be wrapped in a Form component.");
|
|
48
|
+
const name = String(nameProp);
|
|
49
|
+
const id = useId(props.id);
|
|
50
|
+
const ref = useRef(null);
|
|
51
|
+
store.useValidate(async () => {
|
|
52
|
+
const element = getNamedElement(ref, name);
|
|
53
|
+
if (!element) return;
|
|
54
|
+
await Promise.resolve();
|
|
55
|
+
if ("validity" in element && !element.validity.valid) store?.setError(name, element.validationMessage);
|
|
56
|
+
});
|
|
57
|
+
const getItem = useCallback((item) => {
|
|
58
|
+
const nextItem = {
|
|
59
|
+
...item,
|
|
60
|
+
id: id || item.id,
|
|
61
|
+
name,
|
|
62
|
+
type: "field"
|
|
63
|
+
};
|
|
64
|
+
if (getItemProp) return getItemProp(nextItem);
|
|
65
|
+
return nextItem;
|
|
66
|
+
}, [
|
|
67
|
+
id,
|
|
68
|
+
name,
|
|
69
|
+
getItemProp
|
|
70
|
+
]);
|
|
71
|
+
const onBlurProp = props.onBlur;
|
|
72
|
+
const touchOnBlurProp = useBooleanEvent(touchOnBlur);
|
|
73
|
+
const onBlur = useEvent((event) => {
|
|
74
|
+
onBlurProp?.(event);
|
|
75
|
+
if (event.defaultPrevented) return;
|
|
76
|
+
if (!touchOnBlurProp(event)) return;
|
|
77
|
+
store?.setFieldTouched(name, true);
|
|
78
|
+
});
|
|
79
|
+
const label = useItem(store, name, "label");
|
|
80
|
+
const error = useItem(store, name, "error");
|
|
81
|
+
const description = useItem(store, name, "description");
|
|
82
|
+
const describedBy = cx(error?.id, description?.id, props["aria-describedby"]);
|
|
83
|
+
const invalid = useStoreState(store, () => !!store?.getError(name) && store.getFieldTouched(name));
|
|
84
|
+
props = {
|
|
85
|
+
"aria-labelledby": props["aria-label"] != null ? void 0 : label?.id,
|
|
86
|
+
"aria-invalid": invalid,
|
|
87
|
+
...props,
|
|
88
|
+
id,
|
|
89
|
+
"aria-describedby": describedBy || void 0,
|
|
90
|
+
ref: useMergeRefs(ref, props.ref),
|
|
91
|
+
onBlur
|
|
92
|
+
};
|
|
93
|
+
props = useCollectionItem({
|
|
94
|
+
store,
|
|
95
|
+
...props,
|
|
96
|
+
name,
|
|
97
|
+
getItem
|
|
98
|
+
});
|
|
99
|
+
return props;
|
|
100
|
+
});
|
|
101
|
+
/**
|
|
102
|
+
* Abstract component that renders a form control. Unlike
|
|
103
|
+
* [`FormInput`](https://ariakit.com/reference/form-input), this component
|
|
104
|
+
* doesn't automatically pass the `value` and `onChange` props down to the
|
|
105
|
+
* underlying element. This is so we can use it not only for native form
|
|
106
|
+
* elements but also for custom components whose value is not controlled by the
|
|
107
|
+
* native `value` and `onChange` props.
|
|
108
|
+
* @see https://ariakit.com/components/form
|
|
109
|
+
* @example
|
|
110
|
+
* ```jsx {11-19}
|
|
111
|
+
* const form = useFormStore({
|
|
112
|
+
* defaultValues: {
|
|
113
|
+
* content: "",
|
|
114
|
+
* },
|
|
115
|
+
* });
|
|
116
|
+
*
|
|
117
|
+
* const value = form.useValue(form.names.content);
|
|
118
|
+
*
|
|
119
|
+
* <Form store={form}>
|
|
120
|
+
* <FormLabel name={form.names.content}>Content</FormLabel>
|
|
121
|
+
* <FormControl
|
|
122
|
+
* name={form.names.content}
|
|
123
|
+
* render={
|
|
124
|
+
* <Editor
|
|
125
|
+
* value={value}
|
|
126
|
+
* onChange={(value) => form.setValue(form.names.content, value)}
|
|
127
|
+
* />
|
|
128
|
+
* }
|
|
129
|
+
* />
|
|
130
|
+
* </Form>
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
const FormControl = memo(forwardRef(function FormControl(props) {
|
|
134
|
+
return createElement(TagName, useFormControl(props));
|
|
135
|
+
}));
|
|
136
|
+
//#endregion
|
|
137
|
+
export { FormControl, useFormControl };
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=form-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-control.js","names":[],"sources":["../../src/form/form-control.tsx"],"sourcesContent":["import type { StringLike } from \"@ariakit/components/form/types\";\nimport { useStoreState } from \"@ariakit/react-store\";\nimport {\n useBooleanEvent,\n useEvent,\n useId,\n useMergeRefs,\n createElement,\n createHook,\n forwardRef,\n memo,\n} from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { getDocument, cx, invariant } from \"@ariakit/utils\";\nimport type { BooleanOrCallback } from \"@ariakit/utils\";\nimport type { ElementType, FocusEvent, RefObject } from \"react\";\nimport { useCallback, useRef } from \"react\";\nimport type { CollectionItemOptions } from \"../collection/collection-item.tsx\";\nimport { useCollectionItem } from \"../collection/collection-item.tsx\";\nimport { useFormContext } from \"./form-context.tsx\";\nimport type { FormStore } from \"./form-store.ts\";\n\nconst TagName = \"input\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\ntype ItemType = \"label\" | \"error\" | \"description\";\n\nfunction getNamedElement(\n ref: RefObject<HTMLInputElement | null>,\n name: string,\n) {\n const element = ref.current;\n if (!element) return null;\n if (element.name === name) return element;\n if (element.form) {\n return element.form.elements.namedItem(name) as HTMLInputElement | null;\n }\n const document = getDocument(element);\n return document.getElementsByName(name)[0] as HTMLInputElement | null;\n}\n\nfunction useItem(store: FormStore, name: string, type: ItemType) {\n return useStoreState(store, (state) =>\n state.items.find((item) => item.type === type && item.name === name),\n );\n}\n\n/**\n * Returns props to create a `FormControl` component. Unlike `useFormInput`,\n * this hook doesn't automatically returns the `value` and `onChange` props.\n * This is so we can use it not only for native form elements but also for\n * custom components whose value is not controlled by the native `value` and\n * `onChange` props.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx\n * const store = useFormStore({ defaultValues: { content: \"\" } });\n * const props = useFormControl({ store, name: store.names.content });\n * const value = store.useValue(store.names.content);\n *\n * <Form store={store}>\n * <FormLabel name={store.names.content}>Content</FormLabel>\n * <Role\n * {...props}\n * value={value}\n * onChange={(value) => store.setValue(store.names.content, value)}\n * render={<Editor />}\n * />\n * </Form>\n * ```\n */\nexport const useFormControl = createHook<TagName, FormControlOptions>(\n function useFormControl({\n store,\n name: nameProp,\n getItem: getItemProp,\n touchOnBlur = true,\n ...props\n }) {\n const context = useFormContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"FormControl must be wrapped in a Form component.\",\n );\n\n const name = String(nameProp);\n const id = useId(props.id);\n const ref = useRef<HTMLType>(null);\n\n store.useValidate(async () => {\n const element = getNamedElement(ref, name);\n if (!element) return;\n // Flush microtasks to make sure the validity state is up to date\n await Promise.resolve();\n if (\"validity\" in element && !element.validity.valid) {\n store?.setError(name, element.validationMessage);\n }\n });\n\n const getItem = useCallback<NonNullable<CollectionItemOptions[\"getItem\"]>>(\n (item) => {\n const nextItem = { ...item, id: id || item.id, name, type: \"field\" };\n if (getItemProp) {\n return getItemProp(nextItem);\n }\n return nextItem;\n },\n [id, name, getItemProp],\n );\n\n const onBlurProp = props.onBlur;\n const touchOnBlurProp = useBooleanEvent(touchOnBlur);\n\n const onBlur = useEvent((event: FocusEvent<HTMLType>) => {\n onBlurProp?.(event);\n if (event.defaultPrevented) return;\n if (!touchOnBlurProp(event)) return;\n store?.setFieldTouched(name, true);\n });\n\n const label = useItem(store, name, \"label\");\n const error = useItem(store, name, \"error\");\n const description = useItem(store, name, \"description\");\n const describedBy = cx(\n error?.id,\n description?.id,\n props[\"aria-describedby\"],\n );\n\n const invalid = useStoreState(\n store,\n () => !!store?.getError(name) && store.getFieldTouched(name),\n );\n\n props = {\n \"aria-labelledby\": props[\"aria-label\"] != null ? undefined : label?.id,\n \"aria-invalid\": invalid,\n ...props,\n id,\n \"aria-describedby\": describedBy || undefined,\n ref: useMergeRefs(ref, props.ref),\n onBlur,\n };\n\n props = useCollectionItem<TagName>({ store, ...props, name, getItem });\n\n return props;\n },\n);\n\n/**\n * Abstract component that renders a form control. Unlike\n * [`FormInput`](https://ariakit.com/reference/form-input), this component\n * doesn't automatically pass the `value` and `onChange` props down to the\n * underlying element. This is so we can use it not only for native form\n * elements but also for custom components whose value is not controlled by the\n * native `value` and `onChange` props.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx {11-19}\n * const form = useFormStore({\n * defaultValues: {\n * content: \"\",\n * },\n * });\n *\n * const value = form.useValue(form.names.content);\n *\n * <Form store={form}>\n * <FormLabel name={form.names.content}>Content</FormLabel>\n * <FormControl\n * name={form.names.content}\n * render={\n * <Editor\n * value={value}\n * onChange={(value) => form.setValue(form.names.content, value)}\n * />\n * }\n * />\n * </Form>\n * ```\n */\nexport const FormControl = memo(\n forwardRef(function FormControl(props: FormControlProps) {\n const htmlProps = useFormControl(props);\n return createElement(TagName, htmlProps);\n }),\n);\n\nexport interface FormControlOptions<\n T extends ElementType = TagName,\n> extends CollectionItemOptions<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 * Field name. This can either be a string corresponding to an existing\n * property name in the\n * [`values`](https://ariakit.com/reference/use-form-store#values) state of\n * the store, or a reference to a field name from the\n * [`names`](https://ariakit.com/reference/use-form-store#names) object in the\n * store, ensuring type safety.\n *\n * Live examples:\n * - [FormRadio](https://ariakit.com/examples/form-radio)\n * - [Form with Select](https://ariakit.com/examples/form-select)\n */\n name: StringLike;\n /**\n * Whether the field should be marked touched on blur.\n * @default true\n */\n touchOnBlur?: BooleanOrCallback<FocusEvent>;\n}\n\nexport type FormControlProps<T extends ElementType = TagName> = Props<\n T,\n FormControlOptions<T>\n>;\n"],"mappings":";;;;;;;;AA2BA,MAAA,UAAS;SAID,gBAAc,KAAA,MAAA;CACpB,MAAK,UAAS,IAAA;CACd,IAAI,CAAA,SAAQ,OAAS;CACrB,IAAI,QAAQ,SACV,MAAO,OAAQ;CAGjB,IAAA,QADiB,MAAA,OAAY,QACb,KAAA,SAAkB,UAAM,IAAA;CAC1C,OAAA,YAAA,OAAA,EAAA,kBAAA,IAAA,EAAA;AAEA;SACS,QAAA,OAAc,MAAQ,MAAA;CAG/B,OAAA,cAAA,QAAA,UAAA,MAAA,MAAA,MAAA,SAAA,KAAA,SAAA,QAAA,KAAA,SAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;MAkCI,iBAAgB,WAAe,SAAA,eAAA,EAAA,OAAA,MAAA,UAAA,SAAA,aAAA,cAAA,MAAA,GAAA,SAAA;CAC/B,MAAA,UAAQ,eAAS;CAEjB,QAAA,SAGI;CAGJ,UAAM,OAAO,kDAAe;CAC5B,MAAM,OAAK,OAAM,QAAQ;CACzB,MAAM,KAAA,MAAM,MAAqB,EAAA;CAEjC,MAAM,MAAA,OAAY,IAAA;OAChB,YAAgB,YAAA;EAChB,MAAK,UAAS,gBAAA,KAAA,IAAA;EAEd,IAAA,CAAA,SAAc;EACd,MAAI,QAAA,QAAc;EAGnB,IAAA,cAAA,WAAA,CAAA,QAAA,SAAA,OAAA,OAAA,SAAA,MAAA,QAAA,iBAAA;CAED,CAAA;OAEI,UAAM,aAAW,SAAA;QAAK,WAAA;GAAM,GAAA;GAAmB,IAAA,MAAA,KAAA;GAAM;GAAc,MAAA;EACnE;EAGA,IAAA,aAAO,OAAA,YAAA,QAAA;EACT,OACA;IAAC;EAAI;EAAM;EACb;CAEA,CAAA;CACA,MAAM,aAAA,MAAkB;CAExB,MAAM,kBAAS,gBAA0C,WAAA;OACvD,SAAa,UAAK,UAAA;EAClB,aAAU,KAAA;EACV,IAAI,MAAC,kBAAqB;EAC1B,IAAA,CAAA,gBAAO,KAAgB,GAAM;EAC9B,OAAA,gBAAA,MAAA,IAAA;CAED,CAAA;CACA,MAAM,QAAQ,QAAQ,OAAO,MAAM,OAAO;CAC1C,MAAM,QAAA,QAAc,OAAQ,MAAO,OAAM;CACzC,MAAM,cAAc,QAClB,OACA,MAAA,aACA;CAGF,MAAM,cAAU,GAAA,OACd,IAAA,aACQ,IAAA,MAAO,mBAAwB;CAGzC,MAAA,UAAQ,cAAA,aAAA,CAAA,CAAA,OAAA,SAAA,IAAA,KAAA,MAAA,gBAAA,IAAA,CAAA;SACN;EACA,mBAAgB,MAAA,iBAAA,OAAA,KAAA,IAAA,OAAA;EAChB,gBAAG;EACH,GAAA;EACA;EACA,oBAAkB,eAAc,KAAA;EAChC,KAAA,aAAA,KAAA,MAAA,GAAA;EACF;CAEA;SAAqC,kBAAA;EAAO;EAAU,GAAA;EAAM;EAAS;CAErE,CAAA;CAEJ,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAqCI,cAAO,KAAc,WADH,SAAA,YACqB,OAAA;CACxC,OACH,cAAA,SAAA,eAAA,KAAA,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { n as CollectionItemOptions } from "../collection-item-C-g2BwVF.js";
|
|
2
|
+
import { t as FormStore } from "../form-store-C4Kf5QHm.js";
|
|
3
|
+
import { Props } from "@ariakit/react-utils";
|
|
4
|
+
import { ElementType } from "react";
|
|
5
|
+
import { StringLike } from "@ariakit/components/form/types";
|
|
6
|
+
|
|
7
|
+
//#region src/form/form-description.d.ts
|
|
8
|
+
declare const TagName = "div";
|
|
9
|
+
type TagName = typeof TagName;
|
|
10
|
+
/**
|
|
11
|
+
* Returns props to create a `FormDescription` component.
|
|
12
|
+
* @see https://ariakit.com/components/form
|
|
13
|
+
* @example
|
|
14
|
+
* ```jsx
|
|
15
|
+
* const store = useFormStore({ defaultValues: { password: "" } });
|
|
16
|
+
* const props = useFormDescription({ store, name: store.names.password });
|
|
17
|
+
* <Form store={store}>
|
|
18
|
+
* <FormLabel name={store.names.password}>Password</FormLabel>
|
|
19
|
+
* <FormInput name={store.names.password} type="password" />
|
|
20
|
+
* <Role {...props}>Password with at least 8 characters.</Role>
|
|
21
|
+
* </Form>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const useFormDescription: import("@ariakit/react-utils").Hook<"div", FormDescriptionOptions<"div">>;
|
|
25
|
+
/**
|
|
26
|
+
* Renders a description element for a form field, which will automatically
|
|
27
|
+
* receive an `aria-describedby` attribute pointing to this element.
|
|
28
|
+
* @see https://ariakit.com/components/form
|
|
29
|
+
* @example
|
|
30
|
+
* ```jsx {10-12}
|
|
31
|
+
* const form = useFormStore({
|
|
32
|
+
* defaultValues: {
|
|
33
|
+
* password: "",
|
|
34
|
+
* },
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* <Form store={form}>
|
|
38
|
+
* <FormLabel name={form.names.password}>Password</FormLabel>
|
|
39
|
+
* <FormInput name={form.names.password} type="password" />
|
|
40
|
+
* <FormDescription name={form.names.password}>
|
|
41
|
+
* Password with at least 8 characters.
|
|
42
|
+
* </FormDescription>
|
|
43
|
+
* </Form>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare const FormDescription: (props: FormDescriptionProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
47
|
+
interface FormDescriptionOptions<T extends ElementType = TagName> extends CollectionItemOptions<T> {
|
|
48
|
+
/**
|
|
49
|
+
* Object returned by the
|
|
50
|
+
* [`useFormStore`](https://ariakit.com/reference/use-form-store) hook. If not
|
|
51
|
+
* provided, the closest [`Form`](https://ariakit.com/reference/form) or
|
|
52
|
+
* [`FormProvider`](https://ariakit.com/reference/form-provider) components'
|
|
53
|
+
* context will be used.
|
|
54
|
+
*/
|
|
55
|
+
store?: FormStore;
|
|
56
|
+
/**
|
|
57
|
+
* Name of the field described by this element. This can either be a string or
|
|
58
|
+
* a reference to a field name from the
|
|
59
|
+
* [`names`](https://ariakit.com/reference/use-form-store#names) object in the
|
|
60
|
+
* store, for type safety.
|
|
61
|
+
* @example
|
|
62
|
+
* ```jsx
|
|
63
|
+
* <FormDescription name="password">
|
|
64
|
+
* Password with at least 8 characters.
|
|
65
|
+
* </FormDescription>
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
name: StringLike;
|
|
69
|
+
}
|
|
70
|
+
type FormDescriptionProps<T extends ElementType = TagName> = Props<T, FormDescriptionOptions<T>>;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { FormDescription, FormDescriptionOptions, FormDescriptionProps, useFormDescription };
|
|
73
|
+
//# sourceMappingURL=form-description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-description.d.ts","names":["StringLike","Props","ElementType","CollectionItemOptions","FormStore","TagName","useFormDescription","FormDescriptionOptions","Hook","FormDescription","FormDescriptionProps","props","ReactElement","JSXElementConstructor","T","store","name"],"sources":["../../src/form/form-description.d.ts"],"mappings":";;;;;;;cAKcK,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;AAe7B;;;;AAjBiD,cAiB5BC,kBAAAA,iCAAmDE,IAAAA,QAAYD,sBAAsB;AAsB1G;;;;;;;;;AAAuJ;AACvJ;;;;;;;;;;;AADA,cAAqBE,eAAAA,GAAkBE,KAAAA,EAAOD,oBAAoB,qBAAqBE,YAAAA,+BAA2CC,qBAAAA;AAAAA,UACjHN,sBAAAA,WAAiCL,WAAAA,GAAcG,OAAAA,UAAiBF,qBAAAA,CAAsBW,CAAAA;EAAvCT;;;;;;;EAQ5DU,KAAAA,GAAQX,SAAAA;EAaQ;AAEpB;;;;;;;;;;;EAFIY,IAAAA,EAAMhB,UAAAA;AAAAA;AAAAA,KAEEU,oBAAAA,WAA+BR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,sBAAAA,CAAuBO,CAAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCollectionItem } from "../collection/collection-item.js";
|
|
3
|
+
import { useFormContext } from "./form-context.js";
|
|
4
|
+
import { createElement, createHook, forwardRef, memo, useId, useMergeRefs } from "@ariakit/react-utils";
|
|
5
|
+
import { invariant } from "@ariakit/utils";
|
|
6
|
+
import { useCallback, useRef } from "react";
|
|
7
|
+
//#region src/form/form-description.tsx
|
|
8
|
+
const TagName = "div";
|
|
9
|
+
/**
|
|
10
|
+
* Returns props to create a `FormDescription` component.
|
|
11
|
+
* @see https://ariakit.com/components/form
|
|
12
|
+
* @example
|
|
13
|
+
* ```jsx
|
|
14
|
+
* const store = useFormStore({ defaultValues: { password: "" } });
|
|
15
|
+
* const props = useFormDescription({ store, name: store.names.password });
|
|
16
|
+
* <Form store={store}>
|
|
17
|
+
* <FormLabel name={store.names.password}>Password</FormLabel>
|
|
18
|
+
* <FormInput name={store.names.password} type="password" />
|
|
19
|
+
* <Role {...props}>Password with at least 8 characters.</Role>
|
|
20
|
+
* </Form>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
const useFormDescription = createHook(function useFormDescription({ store, name: nameProp, getItem: getItemProp, ...props }) {
|
|
24
|
+
const context = useFormContext();
|
|
25
|
+
store = store || context;
|
|
26
|
+
invariant(store, "FormDescription must be wrapped in a Form component.");
|
|
27
|
+
const id = useId(props.id);
|
|
28
|
+
const ref = useRef(null);
|
|
29
|
+
const name = String(nameProp);
|
|
30
|
+
const getItem = useCallback((item) => {
|
|
31
|
+
const nextItem = {
|
|
32
|
+
...item,
|
|
33
|
+
id: id || item.id,
|
|
34
|
+
name,
|
|
35
|
+
type: "description"
|
|
36
|
+
};
|
|
37
|
+
if (getItemProp) return getItemProp(nextItem);
|
|
38
|
+
return nextItem;
|
|
39
|
+
}, [
|
|
40
|
+
id,
|
|
41
|
+
name,
|
|
42
|
+
getItemProp
|
|
43
|
+
]);
|
|
44
|
+
props = {
|
|
45
|
+
...props,
|
|
46
|
+
id,
|
|
47
|
+
ref: useMergeRefs(ref, props.ref)
|
|
48
|
+
};
|
|
49
|
+
props = useCollectionItem({
|
|
50
|
+
store,
|
|
51
|
+
...props,
|
|
52
|
+
getItem
|
|
53
|
+
});
|
|
54
|
+
return props;
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Renders a description element for a form field, which will automatically
|
|
58
|
+
* receive an `aria-describedby` attribute pointing to this element.
|
|
59
|
+
* @see https://ariakit.com/components/form
|
|
60
|
+
* @example
|
|
61
|
+
* ```jsx {10-12}
|
|
62
|
+
* const form = useFormStore({
|
|
63
|
+
* defaultValues: {
|
|
64
|
+
* password: "",
|
|
65
|
+
* },
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* <Form store={form}>
|
|
69
|
+
* <FormLabel name={form.names.password}>Password</FormLabel>
|
|
70
|
+
* <FormInput name={form.names.password} type="password" />
|
|
71
|
+
* <FormDescription name={form.names.password}>
|
|
72
|
+
* Password with at least 8 characters.
|
|
73
|
+
* </FormDescription>
|
|
74
|
+
* </Form>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
const FormDescription = memo(forwardRef(function FormDescription(props) {
|
|
78
|
+
return createElement(TagName, useFormDescription(props));
|
|
79
|
+
}));
|
|
80
|
+
//#endregion
|
|
81
|
+
export { FormDescription, useFormDescription };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=form-description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-description.js","names":[],"sources":["../../src/form/form-description.tsx"],"sourcesContent":["import type { StringLike } from \"@ariakit/components/form/types\";\nimport {\n useId,\n useMergeRefs,\n createElement,\n createHook,\n forwardRef,\n memo,\n} from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { invariant } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport { useCallback, useRef } from \"react\";\nimport type { CollectionItemOptions } from \"../collection/collection-item.tsx\";\nimport { useCollectionItem } from \"../collection/collection-item.tsx\";\nimport { useFormContext } from \"./form-context.tsx\";\nimport type { FormStore } from \"./form-store.ts\";\n\nconst TagName = \"div\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\n/**\n * Returns props to create a `FormDescription` component.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx\n * const store = useFormStore({ defaultValues: { password: \"\" } });\n * const props = useFormDescription({ store, name: store.names.password });\n * <Form store={store}>\n * <FormLabel name={store.names.password}>Password</FormLabel>\n * <FormInput name={store.names.password} type=\"password\" />\n * <Role {...props}>Password with at least 8 characters.</Role>\n * </Form>\n * ```\n */\nexport const useFormDescription = createHook<TagName, FormDescriptionOptions>(\n function useFormDescription({\n store,\n name: nameProp,\n getItem: getItemProp,\n ...props\n }) {\n const context = useFormContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"FormDescription must be wrapped in a Form component.\",\n );\n\n const id = useId(props.id);\n const ref = useRef<HTMLType>(null);\n const name = String(nameProp);\n\n const getItem = useCallback<NonNullable<CollectionItemOptions[\"getItem\"]>>(\n (item) => {\n const nextItem = {\n ...item,\n id: id || item.id,\n name,\n type: \"description\",\n };\n if (getItemProp) {\n return getItemProp(nextItem);\n }\n return nextItem;\n },\n [id, name, getItemProp],\n );\n\n props = {\n ...props,\n id,\n ref: useMergeRefs(ref, props.ref),\n };\n\n props = useCollectionItem({ store, ...props, getItem });\n\n return props;\n },\n);\n\n/**\n * Renders a description element for a form field, which will automatically\n * receive an `aria-describedby` attribute pointing to this element.\n * @see https://ariakit.com/components/form\n * @example\n * ```jsx {10-12}\n * const form = useFormStore({\n * defaultValues: {\n * password: \"\",\n * },\n * });\n *\n * <Form store={form}>\n * <FormLabel name={form.names.password}>Password</FormLabel>\n * <FormInput name={form.names.password} type=\"password\" />\n * <FormDescription name={form.names.password}>\n * Password with at least 8 characters.\n * </FormDescription>\n * </Form>\n * ```\n */\nexport const FormDescription = memo(\n forwardRef(function FormDescription(props: FormDescriptionProps) {\n const htmlProps = useFormDescription(props);\n return createElement(TagName, htmlProps);\n }),\n);\n\nexport interface FormDescriptionOptions<\n T extends ElementType = TagName,\n> extends CollectionItemOptions<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 field described by this element. This can either be a string or\n * a reference to a field name from the\n * [`names`](https://ariakit.com/reference/use-form-store#names) object in the\n * store, for type safety.\n * @example\n * ```jsx\n * <FormDescription name=\"password\">\n * Password with at least 8 characters.\n * </FormDescription>\n * ```\n */\n name: StringLike;\n}\n\nexport type FormDescriptionProps<T extends ElementType = TagName> = Props<\n T,\n FormDescriptionOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;MA2CI,qBAAgB,WAAe,SAAA,mBAAA,EAAA,OAAA,MAAA,UAAA,SAAA,aAAA,GAAA,SAAA;CAC/B,MAAA,UAAQ,eAAS;CAEjB,QAAA,SAGI;CAGJ,UAAM,OAAW,sDAAQ;CACzB,MAAM,KAAA,MAAM,MAAqB,EAAA;CACjC,MAAM,MAAA,OAAO,IAAO;CAEpB,MAAM,OAAA,OAAU,QAAA;OAEZ,UAAM,aAAW,SAAA;QACZ,WAAA;GACH,GAAA;GACA,IAAA,MAAA,KAAA;GACA;GACF,MAAA;EACA;EAGA,IAAA,aAAO,OAAA,YAAA,QAAA;EACT,OACA;IAAC;EAAI;EAAM;EACb;CAEA,CAAA;SACK;EACH,GAAA;EACA;EACF,KAAA,aAAA,KAAA,MAAA,GAAA;CAEA;SAA4B,kBAAA;EAAO;EAAU,GAAA;EAAS;CAEtD,CAAA;CAEJ,OAAA;;;;;;;;;;;;;;;;;;;;;;;MA0BI,kBAAqB,KAAA,WADH,SAAA,gBACqB,OAAA;CACxC,OACH,cAAA,SAAA,mBAAA,KAAA,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { n as CollectionItemOptions } from "../collection-item-C-g2BwVF.js";
|
|
2
|
+
import { t as FormStore } from "../form-store-C4Kf5QHm.js";
|
|
3
|
+
import { Props } from "@ariakit/react-utils";
|
|
4
|
+
import { ElementType } from "react";
|
|
5
|
+
import { StringLike } from "@ariakit/components/form/types";
|
|
6
|
+
|
|
7
|
+
//#region src/form/form-error.d.ts
|
|
8
|
+
declare const TagName = "div";
|
|
9
|
+
type TagName = typeof TagName;
|
|
10
|
+
/**
|
|
11
|
+
* Returns props to create a `FormDescription` component.
|
|
12
|
+
* @see https://ariakit.com/components/form
|
|
13
|
+
* @example
|
|
14
|
+
* ```jsx
|
|
15
|
+
* const store = useFormStore({ defaultValues: { email: "" } });
|
|
16
|
+
* const props = useFormError({ store, name: store.names.email });
|
|
17
|
+
*
|
|
18
|
+
* store.useValidate(() => {
|
|
19
|
+
* if (!store.getValue(store.names.email)) {
|
|
20
|
+
* store.setError(store.names.email, "Email is required!");
|
|
21
|
+
* }
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* <Form store={store}>
|
|
25
|
+
* <FormLabel name={store.names.email}>Email</FormLabel>
|
|
26
|
+
* <FormInput name={store.names.email} />
|
|
27
|
+
* <Role {...props} />
|
|
28
|
+
* </Form>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare const useFormError: import("@ariakit/react-utils").Hook<"div", FormErrorOptions<"div">>;
|
|
32
|
+
/**
|
|
33
|
+
* Renders an element that shows an error message. The `children` will
|
|
34
|
+
* automatically display the error message defined in the store.
|
|
35
|
+
* @see https://ariakit.com/components/form
|
|
36
|
+
* @example
|
|
37
|
+
* ```jsx {16}
|
|
38
|
+
* const form = useFormStore({
|
|
39
|
+
* defaultValues: {
|
|
40
|
+
* email: "",
|
|
41
|
+
* },
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* form.useValidate(() => {
|
|
45
|
+
* if (!form.values.email) {
|
|
46
|
+
* form.setError(form.names.email, "Email is required!");
|
|
47
|
+
* }
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* <Form store={form}>
|
|
51
|
+
* <FormLabel name={form.names.email}>Email</FormLabel>
|
|
52
|
+
* <FormInput name={form.names.email} />
|
|
53
|
+
* <FormError name={form.names.email} />
|
|
54
|
+
* </Form>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare const FormError: (props: FormErrorProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
58
|
+
interface FormErrorOptions<T extends ElementType = TagName> extends CollectionItemOptions<T> {
|
|
59
|
+
/**
|
|
60
|
+
* Object returned by the
|
|
61
|
+
* [`useFormStore`](https://ariakit.com/reference/use-form-store) hook. If not
|
|
62
|
+
* provided, the closest [`Form`](https://ariakit.com/reference/form) or
|
|
63
|
+
* [`FormProvider`](https://ariakit.com/reference/form-provider) components'
|
|
64
|
+
* context will be used.
|
|
65
|
+
*/
|
|
66
|
+
store?: FormStore;
|
|
67
|
+
/**
|
|
68
|
+
* Name of the field associated with this error. This can either be a string
|
|
69
|
+
* or a reference to a field name from the
|
|
70
|
+
* [`names`](https://ariakit.com/reference/use-form-store#names) object in the
|
|
71
|
+
* store, for type safety.
|
|
72
|
+
* @example
|
|
73
|
+
* ```jsx
|
|
74
|
+
* <FormError name="password" />
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
name: StringLike;
|
|
78
|
+
}
|
|
79
|
+
type FormErrorProps<T extends ElementType = TagName> = Props<T, FormErrorOptions<T>>;
|
|
80
|
+
//#endregion
|
|
81
|
+
export { FormError, FormErrorOptions, FormErrorProps, useFormError };
|
|
82
|
+
//# sourceMappingURL=form-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-error.d.ts","names":["StringLike","Props","ElementType","CollectionItemOptions","FormStore","TagName","useFormError","FormErrorOptions","Hook","FormError","FormErrorProps","props","ReactElement","JSXElementConstructor","T","store","name"],"sources":["../../src/form/form-error.d.ts"],"mappings":";;;;;;;cAKcK,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFoB;;;;AAC5B;AAAA;;;;AACQ;AAsB7B;;;;AAA8F;AA0B9F;;;;;;AAlDiD,cAwB5BC,YAAAA,iCAA6CE,IAAAA,QAAYD,gBAAgB;;;AA0B6C;AAC3I;;;;;;;;;;;;;;;;;;;;;AAmBoB;cApBCE,SAAAA,GAAYE,KAAAA,EAAOD,cAAc,qBAAqBE,YAAAA,+BAA2CC,qBAAAA;AAAAA,UACrGN,gBAAAA,WAA2BL,WAAAA,GAAcG,OAAAA,UAAiBF,qBAAAA,CAAsBW,CAAAA;EAqBvEA;;;;;;;EAbtBC,KAAAA,GAAQX,SAAAA;EAauD;;;;;;;;;AAAsB;EAFrFY,IAAAA,EAAMhB,UAAAA;AAAAA;AAAAA,KAEEU,cAAAA,WAAyBR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,gBAAAA,CAAiBO,CAAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCollectionItem } from "../collection/collection-item.js";
|
|
3
|
+
import { useFormContext } from "./form-context.js";
|
|
4
|
+
import { createElement, createHook, forwardRef, memo, useId, useMergeRefs } from "@ariakit/react-utils";
|
|
5
|
+
import { invariant } from "@ariakit/utils";
|
|
6
|
+
import { useCallback, useRef } from "react";
|
|
7
|
+
import { useStoreState } from "@ariakit/react-store";
|
|
8
|
+
//#region src/form/form-error.tsx
|
|
9
|
+
const TagName = "div";
|
|
10
|
+
/**
|
|
11
|
+
* Returns props to create a `FormDescription` component.
|
|
12
|
+
* @see https://ariakit.com/components/form
|
|
13
|
+
* @example
|
|
14
|
+
* ```jsx
|
|
15
|
+
* const store = useFormStore({ defaultValues: { email: "" } });
|
|
16
|
+
* const props = useFormError({ store, name: store.names.email });
|
|
17
|
+
*
|
|
18
|
+
* store.useValidate(() => {
|
|
19
|
+
* if (!store.getValue(store.names.email)) {
|
|
20
|
+
* store.setError(store.names.email, "Email is required!");
|
|
21
|
+
* }
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* <Form store={store}>
|
|
25
|
+
* <FormLabel name={store.names.email}>Email</FormLabel>
|
|
26
|
+
* <FormInput name={store.names.email} />
|
|
27
|
+
* <Role {...props} />
|
|
28
|
+
* </Form>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
const useFormError = createHook(function useFormError({ store, name: nameProp, getItem: getItemProp, ...props }) {
|
|
32
|
+
const context = useFormContext();
|
|
33
|
+
store = store || context;
|
|
34
|
+
invariant(store, "FormError must be wrapped in a Form component.");
|
|
35
|
+
const id = useId(props.id);
|
|
36
|
+
const ref = useRef(null);
|
|
37
|
+
const name = String(nameProp);
|
|
38
|
+
const getItem = useCallback((item) => {
|
|
39
|
+
const nextItem = {
|
|
40
|
+
...item,
|
|
41
|
+
id: id || item.id,
|
|
42
|
+
name,
|
|
43
|
+
type: "error"
|
|
44
|
+
};
|
|
45
|
+
if (getItemProp) return getItemProp(nextItem);
|
|
46
|
+
return nextItem;
|
|
47
|
+
}, [
|
|
48
|
+
id,
|
|
49
|
+
name,
|
|
50
|
+
getItemProp
|
|
51
|
+
]);
|
|
52
|
+
props = {
|
|
53
|
+
role: "alert",
|
|
54
|
+
children: useStoreState(store, () => {
|
|
55
|
+
const error = store?.getError(name);
|
|
56
|
+
if (error == null) return;
|
|
57
|
+
if (!store?.getFieldTouched(name)) return;
|
|
58
|
+
return error;
|
|
59
|
+
}),
|
|
60
|
+
...props,
|
|
61
|
+
id,
|
|
62
|
+
ref: useMergeRefs(ref, props.ref)
|
|
63
|
+
};
|
|
64
|
+
props = useCollectionItem({
|
|
65
|
+
store,
|
|
66
|
+
...props,
|
|
67
|
+
getItem
|
|
68
|
+
});
|
|
69
|
+
return props;
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Renders an element that shows an error message. The `children` will
|
|
73
|
+
* automatically display the error message defined in the store.
|
|
74
|
+
* @see https://ariakit.com/components/form
|
|
75
|
+
* @example
|
|
76
|
+
* ```jsx {16}
|
|
77
|
+
* const form = useFormStore({
|
|
78
|
+
* defaultValues: {
|
|
79
|
+
* email: "",
|
|
80
|
+
* },
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* form.useValidate(() => {
|
|
84
|
+
* if (!form.values.email) {
|
|
85
|
+
* form.setError(form.names.email, "Email is required!");
|
|
86
|
+
* }
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* <Form store={form}>
|
|
90
|
+
* <FormLabel name={form.names.email}>Email</FormLabel>
|
|
91
|
+
* <FormInput name={form.names.email} />
|
|
92
|
+
* <FormError name={form.names.email} />
|
|
93
|
+
* </Form>
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
const FormError = memo(forwardRef(function FormError(props) {
|
|
97
|
+
return createElement(TagName, useFormError(props));
|
|
98
|
+
}));
|
|
99
|
+
//#endregion
|
|
100
|
+
export { FormError, useFormError };
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=form-error.js.map
|