@ariakit/react-core 0.3.10 → 0.3.12
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 +61 -0
- package/cjs/__chunks/{SANV4XBF.cjs → 23HLSVKM.cjs} +2 -2
- package/cjs/__chunks/{GF6NWLKX.cjs → 3XQOWQTT.cjs} +12 -8
- package/cjs/__chunks/{Y22E2GCT.cjs → 4VMHQGZH.cjs} +6 -6
- package/cjs/__chunks/{T5G6DLC6.cjs → 6LVRCU4J.cjs} +2 -2
- package/cjs/__chunks/{FQZOOWMH.cjs → 6PUZ4NWR.cjs} +2 -2
- package/cjs/__chunks/{RV3PHHWM.cjs → 6ZZYUFPW.cjs} +1 -1
- package/cjs/__chunks/{2GETDAIQ.cjs → 7HJPL3H2.cjs} +5 -5
- package/cjs/__chunks/{KQUC6RXT.cjs → BBS4RP44.cjs} +2 -2
- package/cjs/__chunks/{DKOWT2IJ.cjs → CDNJPIEG.cjs} +3 -3
- package/cjs/__chunks/{47RLIVET.cjs → CFKRWKZR.cjs} +10 -10
- package/cjs/__chunks/{V6LYK7WK.cjs → CGIHR7QS.cjs} +7 -7
- package/cjs/__chunks/{LO3RECOD.cjs → D4TG5DM4.cjs} +2 -2
- package/cjs/__chunks/{36QK2QLE.cjs → EKB76T2U.cjs} +9 -9
- package/cjs/__chunks/{7KFYPSJO.cjs → EUHOCOY2.cjs} +4 -4
- package/cjs/__chunks/{PHZJAGWK.cjs → G2ZXRZ2R.cjs} +4 -4
- package/cjs/__chunks/{CZOBQEIO.cjs → H6OLBVHA.cjs} +33 -40
- package/cjs/__chunks/{TTMCZ7ZN.cjs → IO6J4PAN.cjs} +28 -13
- package/cjs/__chunks/{EGAIDKB5.cjs → JAQJG42R.cjs} +5 -5
- package/cjs/__chunks/{VQJ44BSY.cjs → JQS6X2I5.cjs} +4 -4
- package/cjs/__chunks/{NVHGMKAE.cjs → KDG57VZV.cjs} +3 -3
- package/cjs/__chunks/{IGTX5NFA.cjs → KIDFNQ4E.cjs} +4 -4
- package/cjs/__chunks/{N6CR2VNN.cjs → LUL2YWZ3.cjs} +12 -12
- package/cjs/__chunks/{NVRUQ5V7.cjs → LY6FB2NE.cjs} +7 -7
- package/cjs/__chunks/{DHSZ2ZFJ.cjs → NNINKJTT.cjs} +4 -4
- package/cjs/__chunks/{PSR537T6.cjs → NONPPWSF.cjs} +8 -8
- package/cjs/__chunks/{7BPAESN3.cjs → NRGWVSB5.cjs} +5 -5
- package/cjs/__chunks/{QLRXXIBY.cjs → ODJ76C5W.cjs} +7 -7
- package/cjs/__chunks/{B233QVZE.cjs → OLOZ5JT2.cjs} +0 -5
- package/cjs/__chunks/{XDTEICF5.cjs → OZ4FTKEH.cjs} +7 -7
- package/cjs/__chunks/{3KZQJDTV.cjs → RNGIWUQW.cjs} +4 -4
- package/cjs/__chunks/{VQHA56HB.cjs → T7WLYFYV.cjs} +2 -2
- package/cjs/__chunks/{EWKBICMP.cjs → VKHTDADA.cjs} +5 -5
- package/cjs/__chunks/{VSDH37LI.cjs → VPQQSYH7.cjs} +3 -3
- package/cjs/__chunks/{HRKRTCJC.cjs → W5LJEMLB.cjs} +4 -4
- package/cjs/__chunks/{RTT4XR27.cjs → WZ3DRKGP.cjs} +4 -4
- package/cjs/__chunks/{UUTXBBHD.cjs → XA62Y24Z.cjs} +6 -6
- package/cjs/__chunks/{FM5S6RAD.cjs → XW252ITL.cjs} +2 -2
- package/cjs/__chunks/{TD5MOASJ.cjs → YPVQYY4J.cjs} +2 -2
- package/cjs/__chunks/{UBME4GBY.cjs → ZWICHV7O.cjs} +10 -10
- package/cjs/checkbox/checkbox-check.d.cts +6 -3
- package/cjs/checkbox/checkbox-check.d.ts +6 -3
- package/cjs/checkbox/checkbox-provider.cjs +3 -3
- package/cjs/checkbox/checkbox-store.cjs +3 -3
- package/cjs/checkbox/checkbox.cjs +3 -3
- package/cjs/collection/collection-item.d.cts +9 -2
- package/cjs/collection/collection-item.d.ts +9 -2
- package/cjs/collection/collection-provider.cjs +3 -3
- package/cjs/collection/collection-renderer.cjs +3 -3
- package/cjs/collection/collection-store.cjs +3 -3
- package/cjs/combobox/combobox-disclosure.cjs +3 -4
- package/cjs/combobox/combobox-item.cjs +4 -4
- package/cjs/combobox/combobox-item.d.cts +13 -1
- package/cjs/combobox/combobox-item.d.ts +13 -1
- package/cjs/combobox/combobox-list.cjs +4 -4
- package/cjs/combobox/combobox-popover.cjs +45 -16
- package/cjs/combobox/combobox-popover.d.cts +1 -1
- package/cjs/combobox/combobox-popover.d.ts +1 -1
- package/cjs/combobox/combobox-provider.cjs +8 -8
- package/cjs/combobox/combobox-store.cjs +8 -8
- package/cjs/combobox/combobox.cjs +25 -11
- package/cjs/combobox/combobox.d.cts +29 -1
- package/cjs/combobox/combobox.d.ts +29 -1
- package/cjs/composite/composite-container.cjs +4 -4
- package/cjs/composite/composite-hover.d.cts +12 -1
- package/cjs/composite/composite-hover.d.ts +12 -1
- package/cjs/composite/composite-input.cjs +3 -3
- package/cjs/composite/composite-item.cjs +4 -4
- package/cjs/composite/composite-overflow-disclosure.cjs +4 -4
- package/cjs/composite/composite-overflow-store.cjs +6 -6
- package/cjs/composite/composite-overflow.cjs +8 -8
- package/cjs/composite/composite-provider.cjs +4 -4
- package/cjs/composite/composite-renderer.cjs +4 -4
- package/cjs/composite/composite-store.cjs +4 -4
- package/cjs/composite/composite-store.d.cts +6 -5
- package/cjs/composite/composite-store.d.ts +6 -5
- package/cjs/composite/composite-typeahead.cjs +3 -3
- package/cjs/composite/composite.cjs +3 -3
- package/cjs/composite/utils.cjs +2 -2
- package/cjs/dialog/dialog-backdrop.cjs +5 -5
- package/cjs/dialog/dialog-provider.cjs +4 -4
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/dialog/dialog.cjs +7 -7
- package/cjs/dialog/dialog.d.cts +1 -0
- package/cjs/dialog/dialog.d.ts +1 -0
- package/cjs/disclosure/disclosure-content.cjs +3 -3
- package/cjs/disclosure/disclosure-provider.cjs +3 -3
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/disclosure/disclosure-store.d.cts +3 -3
- package/cjs/disclosure/disclosure-store.d.ts +3 -3
- package/cjs/focusable/focusable.d.cts +7 -0
- package/cjs/focusable/focusable.d.ts +7 -0
- package/cjs/form/form-checkbox.cjs +5 -5
- package/cjs/form/form-provider.cjs +4 -4
- package/cjs/form/form-radio.cjs +5 -5
- package/cjs/form/form-store.cjs +4 -4
- package/cjs/hovercard/hovercard-provider.cjs +6 -6
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/hovercard/hovercard.cjs +9 -9
- package/cjs/menu/menu-bar-provider.cjs +6 -6
- package/cjs/menu/menu-bar-store.cjs +6 -6
- package/cjs/menu/menu-bar.cjs +8 -8
- package/cjs/menu/menu-button.cjs +5 -5
- package/cjs/menu/menu-item-check.d.cts +14 -0
- package/cjs/menu/menu-item-check.d.ts +14 -0
- package/cjs/menu/menu-item-checkbox.cjs +9 -9
- package/cjs/menu/menu-item-radio.cjs +7 -7
- package/cjs/menu/menu-item.cjs +5 -5
- package/cjs/menu/menu-item.d.cts +8 -1
- package/cjs/menu/menu-item.d.ts +8 -1
- package/cjs/menu/menu-list.cjs +7 -7
- package/cjs/menu/menu-provider.cjs +9 -9
- package/cjs/menu/menu-store.cjs +9 -9
- package/cjs/menu/menu-store.d.cts +2 -0
- package/cjs/menu/menu-store.d.ts +2 -0
- package/cjs/menu/menu.cjs +17 -17
- package/cjs/menubar/menubar-provider.cjs +6 -6
- package/cjs/menubar/menubar-store.cjs +5 -5
- package/cjs/menubar/menubar.cjs +8 -8
- package/cjs/popover/popover-provider.cjs +5 -5
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/popover/popover.cjs +8 -8
- package/cjs/popover/popover.d.cts +2 -0
- package/cjs/popover/popover.d.ts +2 -0
- package/cjs/radio/radio-group.cjs +3 -3
- package/cjs/radio/radio-provider.cjs +5 -5
- package/cjs/radio/radio-store.cjs +5 -5
- package/cjs/radio/radio.cjs +5 -5
- package/cjs/select/select-item.cjs +4 -4
- package/cjs/select/select-list.cjs +7 -7
- package/cjs/select/select-popover.cjs +14 -14
- package/cjs/select/select-provider.cjs +8 -8
- package/cjs/select/select-renderer.cjs +7 -7
- package/cjs/select/select-store.cjs +8 -8
- package/cjs/select/select.cjs +4 -4
- package/cjs/tab/tab-list.cjs +3 -3
- package/cjs/tab/tab-panel.cjs +5 -5
- package/cjs/tab/tab-panel.d.cts +3 -2
- package/cjs/tab/tab-panel.d.ts +3 -2
- package/cjs/tab/tab-provider.cjs +5 -5
- package/cjs/tab/tab-store.cjs +5 -5
- package/cjs/tab/tab-store.d.cts +6 -2
- package/cjs/tab/tab-store.d.ts +6 -2
- package/cjs/tab/tab.cjs +4 -4
- package/cjs/toolbar/toolbar-container.cjs +7 -7
- package/cjs/toolbar/toolbar-input.cjs +7 -7
- package/cjs/toolbar/toolbar-item.cjs +5 -5
- package/cjs/toolbar/toolbar-provider.cjs +5 -5
- package/cjs/toolbar/toolbar-store.cjs +5 -5
- package/cjs/toolbar/toolbar.cjs +8 -8
- package/cjs/tooltip/tooltip-provider.cjs +7 -7
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- package/cjs/tooltip/tooltip.cjs +10 -10
- package/cjs/utils/store.cjs +2 -2
- package/esm/__chunks/{IXZMWLUE.js → 2QMN5E6B.js} +2 -2
- package/esm/__chunks/{HBGJOTTX.js → 346FK57L.js} +1 -1
- package/esm/__chunks/{6H3EJNCE.js → 3AHQ6JCP.js} +1 -1
- package/esm/__chunks/{6QXBPV75.js → 3IEDWLST.js} +1 -1
- package/esm/__chunks/{GD2VG2KJ.js → 4HD64GHO.js} +1 -1
- package/esm/__chunks/{A6ER4BO6.js → 7GBW5FLS.js} +2 -2
- package/esm/__chunks/{UJUY6GAA.js → 7NHUGSTF.js} +1 -1
- package/esm/__chunks/{FHDXHZLB.js → 7QTPYGNZ.js} +20 -27
- package/esm/__chunks/{SXPADS2D.js → A6XC27R5.js} +1 -1
- package/esm/__chunks/{QUPVK46L.js → BPNXFCFY.js} +2 -2
- package/esm/__chunks/{KOKHD3Z3.js → CLE7NTOY.js} +1 -1
- package/esm/__chunks/{K5VQ2XTM.js → CQMDBRG5.js} +8 -4
- package/esm/__chunks/{4OZYHFMH.js → EKQEJRUF.js} +0 -5
- package/esm/__chunks/{WEU2EOWJ.js → EPBRINPG.js} +3 -3
- package/esm/__chunks/{DYLO4TTE.js → FMVHAVXA.js} +3 -3
- package/esm/__chunks/{DHHIMTTV.js → HHNFDKU2.js} +4 -4
- package/esm/__chunks/{FWQLUQ4T.js → HVBNG5AF.js} +2 -2
- package/esm/__chunks/{UP4ONTQS.js → I4Q3C2VT.js} +1 -1
- package/esm/__chunks/{VZOR43YE.js → IMEG7JN4.js} +2 -2
- package/esm/__chunks/{IIVLUKKG.js → JIZ5C2JK.js} +1 -1
- package/esm/__chunks/{GJYUMUMT.js → JL6IRDFK.js} +2 -2
- package/esm/__chunks/{6L5IUFNE.js → KSKI4NLV.js} +2 -2
- package/esm/__chunks/{QCIQ4F64.js → LEIRFLRL.js} +2 -2
- package/esm/__chunks/{57VLL43X.js → LWHPHW7Q.js} +2 -2
- package/esm/__chunks/{EENTNM7A.js → MG4P3223.js} +2 -2
- package/esm/__chunks/{PDVJHECS.js → PGAEII2Q.js} +4 -4
- package/esm/__chunks/{P6VCQ6Q3.js → QZLXIDNP.js} +17 -2
- package/esm/__chunks/{XCRWZKAW.js → RIL2SEAH.js} +1 -1
- package/esm/__chunks/{SMM5JVLC.js → SFCBA2JZ.js} +1 -1
- package/esm/__chunks/{5L7XBKAC.js → SS66VZAQ.js} +2 -2
- package/esm/__chunks/{UV2O3GRQ.js → SU2GU5JB.js} +3 -3
- package/esm/__chunks/{TZJDOU75.js → UK7JL7PY.js} +2 -2
- package/esm/__chunks/{NYD53BDE.js → XJXP7ZSQ.js} +3 -3
- package/esm/__chunks/{QEPSYGAQ.js → Y6467XPW.js} +2 -2
- package/esm/__chunks/{HDMIVTNE.js → Y6GYTNQ2.js} +1 -1
- package/esm/__chunks/{DKALGMO6.js → ZEXNX5JH.js} +1 -1
- package/esm/__chunks/{EZTAZGGV.js → ZKJ2WLF7.js} +3 -3
- package/esm/__chunks/{6SB7F42L.js → ZSELSBRM.js} +2 -2
- package/esm/__chunks/{A3PM2ZVJ.js → ZU7LQC5V.js} +2 -2
- package/esm/checkbox/checkbox-check.d.ts +6 -3
- package/esm/checkbox/checkbox-provider.js +2 -2
- package/esm/checkbox/checkbox-store.js +2 -2
- package/esm/checkbox/checkbox.js +2 -2
- package/esm/collection/collection-item.d.ts +9 -2
- package/esm/collection/collection-provider.js +2 -2
- package/esm/collection/collection-renderer.js +2 -2
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-disclosure.js +3 -4
- package/esm/combobox/combobox-item.d.ts +13 -1
- package/esm/combobox/combobox-item.js +3 -3
- package/esm/combobox/combobox-list.js +3 -3
- package/esm/combobox/combobox-popover.d.ts +1 -1
- package/esm/combobox/combobox-popover.js +43 -14
- package/esm/combobox/combobox-provider.js +7 -7
- package/esm/combobox/combobox-store.js +7 -7
- package/esm/combobox/combobox.d.ts +29 -1
- package/esm/combobox/combobox.js +24 -10
- package/esm/composite/composite-container.js +3 -3
- package/esm/composite/composite-hover.d.ts +12 -1
- package/esm/composite/composite-input.js +2 -2
- package/esm/composite/composite-item.js +3 -3
- package/esm/composite/composite-overflow-disclosure.js +3 -3
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-overflow.js +7 -7
- package/esm/composite/composite-provider.js +3 -3
- package/esm/composite/composite-renderer.js +3 -3
- package/esm/composite/composite-store.d.ts +6 -5
- package/esm/composite/composite-store.js +3 -3
- package/esm/composite/composite-typeahead.js +2 -2
- package/esm/composite/composite.js +2 -2
- package/esm/composite/utils.js +1 -1
- package/esm/dialog/dialog-backdrop.js +4 -4
- package/esm/dialog/dialog-provider.js +3 -3
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/dialog/dialog.d.ts +1 -0
- package/esm/dialog/dialog.js +6 -6
- package/esm/disclosure/disclosure-content.js +2 -2
- package/esm/disclosure/disclosure-provider.js +2 -2
- package/esm/disclosure/disclosure-store.d.ts +3 -3
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/focusable/focusable.d.ts +7 -0
- package/esm/form/form-checkbox.js +3 -3
- package/esm/form/form-provider.js +3 -3
- package/esm/form/form-radio.js +4 -4
- package/esm/form/form-store.js +3 -3
- package/esm/hovercard/hovercard-provider.js +5 -5
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/hovercard/hovercard.js +8 -8
- package/esm/menu/menu-bar-provider.js +5 -5
- package/esm/menu/menu-bar-store.js +4 -4
- package/esm/menu/menu-bar.js +7 -7
- package/esm/menu/menu-button.js +3 -3
- package/esm/menu/menu-item-check.d.ts +14 -0
- package/esm/menu/menu-item-checkbox.js +6 -6
- package/esm/menu/menu-item-radio.js +5 -5
- package/esm/menu/menu-item.d.ts +8 -1
- package/esm/menu/menu-item.js +4 -4
- package/esm/menu/menu-list.js +6 -6
- package/esm/menu/menu-provider.js +8 -8
- package/esm/menu/menu-store.d.ts +2 -0
- package/esm/menu/menu-store.js +8 -8
- package/esm/menu/menu.js +12 -12
- package/esm/menubar/menubar-provider.js +5 -5
- package/esm/menubar/menubar-store.js +4 -4
- package/esm/menubar/menubar.js +7 -7
- package/esm/popover/popover-provider.js +4 -4
- package/esm/popover/popover-store.js +4 -4
- package/esm/popover/popover.d.ts +2 -0
- package/esm/popover/popover.js +7 -7
- package/esm/radio/radio-group.js +2 -2
- package/esm/radio/radio-provider.js +4 -4
- package/esm/radio/radio-store.js +4 -4
- package/esm/radio/radio.js +4 -4
- package/esm/select/select-item.js +3 -3
- package/esm/select/select-list.js +6 -6
- package/esm/select/select-popover.js +11 -11
- package/esm/select/select-provider.js +7 -7
- package/esm/select/select-renderer.js +3 -3
- package/esm/select/select-store.js +7 -7
- package/esm/select/select.js +3 -3
- package/esm/tab/tab-list.js +2 -2
- package/esm/tab/tab-panel.d.ts +3 -2
- package/esm/tab/tab-panel.js +3 -3
- package/esm/tab/tab-provider.js +4 -4
- package/esm/tab/tab-store.d.ts +6 -2
- package/esm/tab/tab-store.js +4 -4
- package/esm/tab/tab.js +3 -3
- package/esm/toolbar/toolbar-container.js +5 -5
- package/esm/toolbar/toolbar-input.js +5 -5
- package/esm/toolbar/toolbar-item.js +4 -4
- package/esm/toolbar/toolbar-provider.js +4 -4
- package/esm/toolbar/toolbar-store.js +4 -4
- package/esm/toolbar/toolbar.js +6 -6
- package/esm/tooltip/tooltip-provider.js +6 -6
- package/esm/tooltip/tooltip-store.js +6 -6
- package/esm/tooltip/tooltip.js +8 -8
- package/esm/utils/store.js +1 -1
- package/package.json +2 -2
|
@@ -9,10 +9,10 @@ var _IPYAEPOTcjs = require('../__chunks/IPYAEPOT.cjs');
|
|
|
9
9
|
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _IO6J4PANcjs = require('../__chunks/IO6J4PAN.cjs');
|
|
13
13
|
require('../__chunks/DAJUUBUI.cjs');
|
|
14
14
|
require('../__chunks/R5A2WTWB.cjs');
|
|
15
|
-
require('../__chunks/
|
|
15
|
+
require('../__chunks/6ZZYUFPW.cjs');
|
|
16
16
|
require('../__chunks/UZNYSPKP.cjs');
|
|
17
17
|
require('../__chunks/BZTDJIVT.cjs');
|
|
18
18
|
require('../__chunks/UVBBMANL.cjs');
|
|
@@ -25,7 +25,7 @@ require('../__chunks/75KXQZJX.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
var _RNZNGEL4cjs = require('../__chunks/RNZNGEL4.cjs');
|
|
28
|
-
require('../__chunks/
|
|
28
|
+
require('../__chunks/OLOZ5JT2.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
@@ -169,7 +169,7 @@ var useComboboxItem = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
169
169
|
onKeyDown
|
|
170
170
|
});
|
|
171
171
|
const moveOnKeyPressProp = _EO6LS72Hcjs.useBooleanEvent.call(void 0, moveOnKeyPress);
|
|
172
|
-
props =
|
|
172
|
+
props = _IO6J4PANcjs.useCompositeItem.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
173
173
|
store
|
|
174
174
|
}, props), {
|
|
175
175
|
getItem,
|
|
@@ -56,6 +56,11 @@ export interface ComboboxItemOptions<T extends As = "div"> extends CompositeItem
|
|
|
56
56
|
* [`setValueOnClick`](https://ariakit.org/reference/combobox-item#setvalueonclick)
|
|
57
57
|
* is set to `true`, this will be the value of the combobox input when the
|
|
58
58
|
* user clicks on this item.
|
|
59
|
+
* - If
|
|
60
|
+
* [`selectValueOnClick`](https://ariakit.org/reference/combobox-item#selectvalueonclick)
|
|
61
|
+
* is set to `true`, this will be the value of the
|
|
62
|
+
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
63
|
+
* state.
|
|
59
64
|
* - If the
|
|
60
65
|
* [`autoComplete`](https://ariakit.org/reference/combobox#autocomplete)
|
|
61
66
|
* prop on the [`Combobox`](https://ariakit.org/reference/combobox)
|
|
@@ -88,7 +93,12 @@ export interface ComboboxItemOptions<T extends As = "div"> extends CompositeItem
|
|
|
88
93
|
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
89
94
|
* state using this item's
|
|
90
95
|
* [`value`](https://ariakit.org/reference/combobox-item#value) when the item
|
|
91
|
-
* is clicked.
|
|
96
|
+
* is clicked. If a callback is provided, it will only be invoked if the item
|
|
97
|
+
* has a value.
|
|
98
|
+
*
|
|
99
|
+
* Live examples:
|
|
100
|
+
* - [Submenu with
|
|
101
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
92
102
|
* @default true
|
|
93
103
|
*/
|
|
94
104
|
selectValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
@@ -102,6 +112,8 @@ export interface ComboboxItemOptions<T extends As = "div"> extends CompositeItem
|
|
|
102
112
|
*
|
|
103
113
|
* Live examples:
|
|
104
114
|
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
115
|
+
* - [Submenu with
|
|
116
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
105
117
|
*/
|
|
106
118
|
setValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
107
119
|
/**
|
|
@@ -56,6 +56,11 @@ export interface ComboboxItemOptions<T extends As = "div"> extends CompositeItem
|
|
|
56
56
|
* [`setValueOnClick`](https://ariakit.org/reference/combobox-item#setvalueonclick)
|
|
57
57
|
* is set to `true`, this will be the value of the combobox input when the
|
|
58
58
|
* user clicks on this item.
|
|
59
|
+
* - If
|
|
60
|
+
* [`selectValueOnClick`](https://ariakit.org/reference/combobox-item#selectvalueonclick)
|
|
61
|
+
* is set to `true`, this will be the value of the
|
|
62
|
+
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
63
|
+
* state.
|
|
59
64
|
* - If the
|
|
60
65
|
* [`autoComplete`](https://ariakit.org/reference/combobox#autocomplete)
|
|
61
66
|
* prop on the [`Combobox`](https://ariakit.org/reference/combobox)
|
|
@@ -88,7 +93,12 @@ export interface ComboboxItemOptions<T extends As = "div"> extends CompositeItem
|
|
|
88
93
|
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
89
94
|
* state using this item's
|
|
90
95
|
* [`value`](https://ariakit.org/reference/combobox-item#value) when the item
|
|
91
|
-
* is clicked.
|
|
96
|
+
* is clicked. If a callback is provided, it will only be invoked if the item
|
|
97
|
+
* has a value.
|
|
98
|
+
*
|
|
99
|
+
* Live examples:
|
|
100
|
+
* - [Submenu with
|
|
101
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
92
102
|
* @default true
|
|
93
103
|
*/
|
|
94
104
|
selectValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
@@ -102,6 +112,8 @@ export interface ComboboxItemOptions<T extends As = "div"> extends CompositeItem
|
|
|
102
112
|
*
|
|
103
113
|
* Live examples:
|
|
104
114
|
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
115
|
+
* - [Submenu with
|
|
116
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
105
117
|
*/
|
|
106
118
|
setValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
107
119
|
/**
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _D4TG5DM4cjs = require('../__chunks/D4TG5DM4.cjs');
|
|
6
6
|
require('../__chunks/3WCBE6SU.cjs');
|
|
7
7
|
require('../__chunks/UZNYSPKP.cjs');
|
|
8
8
|
require('../__chunks/BZTDJIVT.cjs');
|
|
9
|
-
require('../__chunks/
|
|
9
|
+
require('../__chunks/YPVQYY4J.cjs');
|
|
10
10
|
require('../__chunks/UVBBMANL.cjs');
|
|
11
11
|
require('../__chunks/F2A2ZQDB.cjs');
|
|
12
12
|
require('../__chunks/S6UU7NA4.cjs');
|
|
13
13
|
require('../__chunks/Z3GCTNW4.cjs');
|
|
14
14
|
require('../__chunks/75KXQZJX.cjs');
|
|
15
15
|
require('../__chunks/RNZNGEL4.cjs');
|
|
16
|
-
require('../__chunks/
|
|
16
|
+
require('../__chunks/OLOZ5JT2.cjs');
|
|
17
17
|
require('../__chunks/EO6LS72H.cjs');
|
|
18
18
|
require('../__chunks/CJDHQUBR.cjs');
|
|
19
19
|
require('../__chunks/AV6KTKLE.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
exports.ComboboxList =
|
|
23
|
+
exports.ComboboxList = _D4TG5DM4cjs.ComboboxList; exports.useComboboxList = _D4TG5DM4cjs.useComboboxList;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _D4TG5DM4cjs = require('../__chunks/D4TG5DM4.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
@@ -9,11 +9,11 @@ require('../__chunks/UZNYSPKP.cjs');
|
|
|
9
9
|
require('../__chunks/BZTDJIVT.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _KDG57VZVcjs = require('../__chunks/KDG57VZV.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
require('../__chunks/
|
|
15
|
+
var _EKB76T2Ucjs = require('../__chunks/EKB76T2U.cjs');
|
|
16
|
+
require('../__chunks/WZ3DRKGP.cjs');
|
|
17
17
|
require('../__chunks/NKR65BKC.cjs');
|
|
18
18
|
require('../__chunks/PZL34OVO.cjs');
|
|
19
19
|
require('../__chunks/344F3DYO.cjs');
|
|
@@ -34,7 +34,7 @@ require('../__chunks/XB3G2EO2.cjs');
|
|
|
34
34
|
require('../__chunks/CVD2AZE2.cjs');
|
|
35
35
|
require('../__chunks/2BIO7R5N.cjs');
|
|
36
36
|
require('../__chunks/LAUATD5O.cjs');
|
|
37
|
-
require('../__chunks/
|
|
37
|
+
require('../__chunks/YPVQYY4J.cjs');
|
|
38
38
|
require('../__chunks/UVBBMANL.cjs');
|
|
39
39
|
require('../__chunks/F2A2ZQDB.cjs');
|
|
40
40
|
require('../__chunks/S6UU7NA4.cjs');
|
|
@@ -46,9 +46,9 @@ require('../__chunks/R66IWXK6.cjs');
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
var _RNZNGEL4cjs = require('../__chunks/RNZNGEL4.cjs');
|
|
49
|
-
require('../__chunks/
|
|
50
|
-
require('../__chunks/
|
|
51
|
-
require('../__chunks/
|
|
49
|
+
require('../__chunks/W5LJEMLB.cjs');
|
|
50
|
+
require('../__chunks/JAQJG42R.cjs');
|
|
51
|
+
require('../__chunks/OLOZ5JT2.cjs');
|
|
52
52
|
require('../__chunks/EO6LS72H.cjs');
|
|
53
53
|
require('../__chunks/CJDHQUBR.cjs');
|
|
54
54
|
|
|
@@ -64,7 +64,7 @@ function isController(target, ...ids) {
|
|
|
64
64
|
if (!target)
|
|
65
65
|
return false;
|
|
66
66
|
if ("id" in target) {
|
|
67
|
-
const selector = ids.filter(Boolean).map((id) => `[aria-controls
|
|
67
|
+
const selector = ids.filter(Boolean).map((id) => `[aria-controls~="${id}"]`).join(", ");
|
|
68
68
|
if (!selector)
|
|
69
69
|
return false;
|
|
70
70
|
return _dom.matches.call(void 0, target, selector);
|
|
@@ -75,11 +75,13 @@ var useComboboxPopover = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
75
75
|
(_a) => {
|
|
76
76
|
var _b = _a, {
|
|
77
77
|
store,
|
|
78
|
+
modal,
|
|
78
79
|
tabIndex,
|
|
79
80
|
alwaysVisible,
|
|
80
81
|
hideOnInteractOutside = true
|
|
81
82
|
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
82
83
|
"store",
|
|
84
|
+
"modal",
|
|
83
85
|
"tabIndex",
|
|
84
86
|
"alwaysVisible",
|
|
85
87
|
"hideOnInteractOutside"
|
|
@@ -91,23 +93,50 @@ var useComboboxPopover = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
91
93
|
process.env.NODE_ENV !== "production" && "ComboboxPopover must receive a `store` prop or be wrapped in a ComboboxProvider component."
|
|
92
94
|
);
|
|
93
95
|
const baseElement = store.useState("baseElement");
|
|
94
|
-
props =
|
|
95
|
-
props =
|
|
96
|
+
props = _D4TG5DM4cjs.useComboboxList.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, alwaysVisible }, props));
|
|
97
|
+
props = _KDG57VZVcjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
96
98
|
store,
|
|
99
|
+
modal,
|
|
97
100
|
alwaysVisible,
|
|
101
|
+
backdrop: false,
|
|
98
102
|
autoFocusOnShow: false,
|
|
99
103
|
autoFocusOnHide: false,
|
|
100
104
|
finalFocus: baseElement,
|
|
101
105
|
preserveTabOrderAnchor: null
|
|
102
106
|
}, props), {
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
modal
|
|
107
|
+
// When the combobox popover is modal, we make sure to include the
|
|
108
|
+
// combobox input and all the combobox controls (cancel, disclosure) in
|
|
109
|
+
// the list of persistent elements so they make part of the modal context,
|
|
110
|
+
// allowing users to tab through them.
|
|
111
|
+
getPersistentElements() {
|
|
112
|
+
var _a2;
|
|
113
|
+
const elements = ((_a2 = props.getPersistentElements) == null ? void 0 : _a2.call(props)) || [];
|
|
114
|
+
if (!modal)
|
|
115
|
+
return elements;
|
|
116
|
+
if (!store)
|
|
117
|
+
return elements;
|
|
118
|
+
const { contentElement, baseElement: baseElement2 } = store.getState();
|
|
119
|
+
if (!baseElement2)
|
|
120
|
+
return elements;
|
|
121
|
+
const doc = _dom.getDocument.call(void 0, baseElement2);
|
|
122
|
+
const selectors = [];
|
|
123
|
+
if (contentElement == null ? void 0 : contentElement.id) {
|
|
124
|
+
selectors.push(`[aria-controls~="${contentElement.id}"]`);
|
|
125
|
+
}
|
|
126
|
+
if (baseElement2 == null ? void 0 : baseElement2.id) {
|
|
127
|
+
selectors.push(`[aria-controls~="${baseElement2.id}"]`);
|
|
128
|
+
}
|
|
129
|
+
if (!selectors.length)
|
|
130
|
+
return [...elements, baseElement2];
|
|
131
|
+
const selector = selectors.join(",");
|
|
132
|
+
const controlElements = doc.querySelectorAll(selector);
|
|
133
|
+
return [...elements, ...controlElements];
|
|
134
|
+
},
|
|
106
135
|
// Make sure we don't hide the popover when the user interacts with the
|
|
107
136
|
// combobox cancel or the combobox disclosure buttons. They will have the
|
|
108
137
|
// aria-controls attribute pointing to either the combobox input or the
|
|
109
138
|
// combobox popover elements.
|
|
110
|
-
hideOnInteractOutside
|
|
139
|
+
hideOnInteractOutside(event) {
|
|
111
140
|
var _a2, _b2;
|
|
112
141
|
const state = store == null ? void 0 : store.getState();
|
|
113
142
|
const contentId = (_a2 = state == null ? void 0 : state.contentElement) == null ? void 0 : _a2.id;
|
|
@@ -121,7 +150,7 @@ var useComboboxPopover = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
121
150
|
return props;
|
|
122
151
|
}
|
|
123
152
|
);
|
|
124
|
-
var ComboboxPopover =
|
|
153
|
+
var ComboboxPopover = _EKB76T2Ucjs.createDialogComponent.call(void 0,
|
|
125
154
|
_RNZNGEL4cjs.createComponent.call(void 0, (props) => {
|
|
126
155
|
const htmlProps = useComboboxPopover(props);
|
|
127
156
|
return _RNZNGEL4cjs.createElement.call(void 0, "div", htmlProps);
|
|
@@ -35,6 +35,6 @@ export declare const useComboboxPopover: import("../utils/types.js").Hook<Combob
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
export declare const ComboboxPopover: import("../utils/types.js").Component<ComboboxPopoverOptions<"div">>;
|
|
38
|
-
export interface ComboboxPopoverOptions<T extends As = "div"> extends ComboboxListOptions<T>, Omit<PopoverOptions<T>, "store"
|
|
38
|
+
export interface ComboboxPopoverOptions<T extends As = "div"> extends ComboboxListOptions<T>, Omit<PopoverOptions<T>, "store"> {
|
|
39
39
|
}
|
|
40
40
|
export type ComboboxPopoverProps<T extends As = "div"> = Props<ComboboxPopoverOptions<T>>;
|
|
@@ -35,6 +35,6 @@ export declare const useComboboxPopover: import("../utils/types.js").Hook<Combob
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
export declare const ComboboxPopover: import("../utils/types.js").Component<ComboboxPopoverOptions<"div">>;
|
|
38
|
-
export interface ComboboxPopoverOptions<T extends As = "div"> extends ComboboxListOptions<T>, Omit<PopoverOptions<T>, "store"
|
|
38
|
+
export interface ComboboxPopoverOptions<T extends As = "div"> extends ComboboxListOptions<T>, Omit<PopoverOptions<T>, "store"> {
|
|
39
39
|
}
|
|
40
40
|
export type ComboboxPopoverProps<T extends As = "div"> = Props<ComboboxPopoverOptions<T>>;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _CFKRWKZRcjs = require('../__chunks/CFKRWKZR.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
8
|
-
require('../__chunks/
|
|
9
|
-
require('../__chunks/
|
|
8
|
+
require('../__chunks/LUL2YWZ3.cjs');
|
|
9
|
+
require('../__chunks/CDNJPIEG.cjs');
|
|
10
10
|
require('../__chunks/UZNYSPKP.cjs');
|
|
11
11
|
require('../__chunks/BZTDJIVT.cjs');
|
|
12
12
|
require('../__chunks/UVBBMANL.cjs');
|
|
13
13
|
require('../__chunks/F2A2ZQDB.cjs');
|
|
14
14
|
require('../__chunks/S6UU7NA4.cjs');
|
|
15
15
|
require('../__chunks/RNZNGEL4.cjs');
|
|
16
|
-
require('../__chunks/
|
|
17
|
-
require('../__chunks/
|
|
18
|
-
require('../__chunks/
|
|
19
|
-
require('../__chunks/
|
|
16
|
+
require('../__chunks/NRGWVSB5.cjs');
|
|
17
|
+
require('../__chunks/W5LJEMLB.cjs');
|
|
18
|
+
require('../__chunks/JAQJG42R.cjs');
|
|
19
|
+
require('../__chunks/OLOZ5JT2.cjs');
|
|
20
20
|
require('../__chunks/EO6LS72H.cjs');
|
|
21
21
|
require('../__chunks/CJDHQUBR.cjs');
|
|
22
22
|
require('../__chunks/AV6KTKLE.cjs');
|
|
@@ -24,7 +24,7 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
24
24
|
// src/combobox/combobox-provider.tsx
|
|
25
25
|
var _jsxruntime = require('react/jsx-runtime');
|
|
26
26
|
function ComboboxProvider(props = {}) {
|
|
27
|
-
const store =
|
|
27
|
+
const store = _CFKRWKZRcjs.useComboboxStore.call(void 0, props);
|
|
28
28
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _3WCBE6SUcjs.ComboboxContextProvider, { value: store, children: props.children });
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
8
|
-
require('../__chunks/
|
|
9
|
-
require('../__chunks/
|
|
10
|
-
require('../__chunks/
|
|
11
|
-
require('../__chunks/
|
|
5
|
+
var _CFKRWKZRcjs = require('../__chunks/CFKRWKZR.cjs');
|
|
6
|
+
require('../__chunks/LUL2YWZ3.cjs');
|
|
7
|
+
require('../__chunks/CDNJPIEG.cjs');
|
|
8
|
+
require('../__chunks/NRGWVSB5.cjs');
|
|
9
|
+
require('../__chunks/W5LJEMLB.cjs');
|
|
10
|
+
require('../__chunks/JAQJG42R.cjs');
|
|
11
|
+
require('../__chunks/OLOZ5JT2.cjs');
|
|
12
12
|
require('../__chunks/EO6LS72H.cjs');
|
|
13
13
|
require('../__chunks/CJDHQUBR.cjs');
|
|
14
14
|
require('../__chunks/AV6KTKLE.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.useComboboxStore =
|
|
18
|
+
exports.useComboboxStore = _CFKRWKZRcjs.useComboboxStore; exports.useComboboxStoreProps = _CFKRWKZRcjs.useComboboxStoreProps;
|
|
@@ -7,8 +7,8 @@ var _3QW6ELTGcjs = require('../__chunks/3QW6ELTG.cjs');
|
|
|
7
7
|
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('../__chunks/
|
|
10
|
+
var _H6OLBVHAcjs = require('../__chunks/H6OLBVHA.cjs');
|
|
11
|
+
require('../__chunks/6ZZYUFPW.cjs');
|
|
12
12
|
require('../__chunks/UZNYSPKP.cjs');
|
|
13
13
|
require('../__chunks/BZTDJIVT.cjs');
|
|
14
14
|
require('../__chunks/UVBBMANL.cjs');
|
|
@@ -82,6 +82,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
82
82
|
store,
|
|
83
83
|
focusable = true,
|
|
84
84
|
autoSelect: autoSelectProp = false,
|
|
85
|
+
getAutoSelectId,
|
|
85
86
|
showOnChange = true,
|
|
86
87
|
setValueOnChange = true,
|
|
87
88
|
showOnMouseDown = true,
|
|
@@ -93,6 +94,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
93
94
|
"store",
|
|
94
95
|
"focusable",
|
|
95
96
|
"autoSelect",
|
|
97
|
+
"getAutoSelectId",
|
|
96
98
|
"showOnChange",
|
|
97
99
|
"setValueOnChange",
|
|
98
100
|
"showOnMouseDown",
|
|
@@ -189,6 +191,8 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
189
191
|
storeValue
|
|
190
192
|
]);
|
|
191
193
|
const scrollingElementRef = _react.useRef.call(void 0, null);
|
|
194
|
+
const getAutoSelectIdProp = _EO6LS72Hcjs.useEvent.call(void 0, getAutoSelectId);
|
|
195
|
+
const autoSelectIdRef = _react.useRef.call(void 0, null);
|
|
192
196
|
_react.useEffect.call(void 0, () => {
|
|
193
197
|
if (!open)
|
|
194
198
|
return;
|
|
@@ -204,10 +208,12 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
204
208
|
const onScroll = () => {
|
|
205
209
|
if (!store)
|
|
206
210
|
return;
|
|
211
|
+
if (!canAutoSelectRef.current)
|
|
212
|
+
return;
|
|
207
213
|
const { activeId } = store.getState();
|
|
208
214
|
if (activeId === null)
|
|
209
215
|
return;
|
|
210
|
-
if (activeId ===
|
|
216
|
+
if (activeId === autoSelectIdRef.current)
|
|
211
217
|
return;
|
|
212
218
|
canAutoSelectRef.current = false;
|
|
213
219
|
};
|
|
@@ -233,12 +239,11 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
233
239
|
}, [open]);
|
|
234
240
|
const resetValueOnSelect = store.useState("resetValueOnSelect");
|
|
235
241
|
_EO6LS72Hcjs.useUpdateEffect.call(void 0, () => {
|
|
236
|
-
var _a2
|
|
242
|
+
var _a2;
|
|
243
|
+
const canAutoSelect = canAutoSelectRef.current;
|
|
237
244
|
if (!store)
|
|
238
245
|
return;
|
|
239
|
-
if (!autoSelect && !resetValueOnSelect)
|
|
240
|
-
return;
|
|
241
|
-
if (!canAutoSelectRef.current)
|
|
246
|
+
if ((!autoSelect || !canAutoSelect) && !resetValueOnSelect)
|
|
242
247
|
return;
|
|
243
248
|
const { baseElement, contentElement: contentElement2, activeId } = store.getState();
|
|
244
249
|
if (baseElement && !_focus.hasFocus.call(void 0, baseElement))
|
|
@@ -248,10 +253,13 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
248
253
|
observer.observe(contentElement2, { attributeFilter: ["data-placing"] });
|
|
249
254
|
return () => observer.disconnect();
|
|
250
255
|
}
|
|
251
|
-
if (autoSelect) {
|
|
252
|
-
|
|
256
|
+
if (autoSelect && canAutoSelect) {
|
|
257
|
+
const userAutoSelectId = getAutoSelectIdProp(items);
|
|
258
|
+
const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : store.first();
|
|
259
|
+
autoSelectIdRef.current = autoSelectId;
|
|
260
|
+
store.move(autoSelectId != null ? autoSelectId : null);
|
|
253
261
|
} else {
|
|
254
|
-
const element = (
|
|
262
|
+
const element = (_a2 = store.item(activeId)) == null ? void 0 : _a2.element;
|
|
255
263
|
if (element && "scrollIntoView" in element) {
|
|
256
264
|
element.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
257
265
|
}
|
|
@@ -263,6 +271,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
263
271
|
storeValue,
|
|
264
272
|
autoSelect,
|
|
265
273
|
resetValueOnSelect,
|
|
274
|
+
getAutoSelectIdProp,
|
|
266
275
|
items
|
|
267
276
|
]);
|
|
268
277
|
_react.useEffect.call(void 0, () => {
|
|
@@ -361,6 +370,9 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
361
370
|
const onKeyDown = _EO6LS72Hcjs.useEvent.call(void 0,
|
|
362
371
|
(event) => {
|
|
363
372
|
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
|
|
373
|
+
if (!event.repeat) {
|
|
374
|
+
canAutoSelectRef.current = false;
|
|
375
|
+
}
|
|
364
376
|
if (event.defaultPrevented)
|
|
365
377
|
return;
|
|
366
378
|
if (event.ctrlKey)
|
|
@@ -395,6 +407,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
395
407
|
});
|
|
396
408
|
const id = _EO6LS72Hcjs.useId.call(void 0, props.id);
|
|
397
409
|
const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0;
|
|
410
|
+
const isActiveItem = store.useState((state) => state.activeId === null);
|
|
398
411
|
props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
399
412
|
id,
|
|
400
413
|
role: "combobox",
|
|
@@ -402,6 +415,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
402
415
|
"aria-haspopup": _dom.getPopupRole.call(void 0, contentElement, "listbox"),
|
|
403
416
|
"aria-expanded": open,
|
|
404
417
|
"aria-controls": contentElement == null ? void 0 : contentElement.id,
|
|
418
|
+
"data-active-item": isActiveItem || void 0,
|
|
405
419
|
value
|
|
406
420
|
}, props), {
|
|
407
421
|
ref: _EO6LS72Hcjs.useMergeRefs.call(void 0, ref, props.ref),
|
|
@@ -411,7 +425,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
411
425
|
onKeyDown,
|
|
412
426
|
onBlur
|
|
413
427
|
});
|
|
414
|
-
props =
|
|
428
|
+
props = _H6OLBVHAcjs.useComposite.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
415
429
|
store,
|
|
416
430
|
focusable
|
|
417
431
|
}, props), {
|
|
@@ -3,7 +3,7 @@ import type { BooleanOrCallback, StringWithValue } from "@ariakit/core/utils/typ
|
|
|
3
3
|
import type { CompositeOptions } from "../composite/composite.js";
|
|
4
4
|
import type { PopoverAnchorOptions } from "../popover/popover-anchor.js";
|
|
5
5
|
import type { As, Props } from "../utils/types.js";
|
|
6
|
-
import type { ComboboxStore } from "./combobox-store.js";
|
|
6
|
+
import type { ComboboxStore, ComboboxStoreState } from "./combobox-store.js";
|
|
7
7
|
/**
|
|
8
8
|
* Returns props to create a `Combobox` component.
|
|
9
9
|
* @see https://ariakit.org/components/combobox
|
|
@@ -70,6 +70,34 @@ export interface ComboboxOptions<T extends As = "input"> extends CompositeOption
|
|
|
70
70
|
* @default false
|
|
71
71
|
*/
|
|
72
72
|
autoSelect?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Function that takes the currently rendered items and returns the id of the
|
|
75
|
+
* item to be auto selected when the
|
|
76
|
+
* [`autoSelect`](https://ariakit.org/reference/combobox#autoselect) prop is
|
|
77
|
+
* `true`.
|
|
78
|
+
*
|
|
79
|
+
* By default, the first enabled item is auto selected. This function is handy
|
|
80
|
+
* if you prefer a different item to be auto selected.
|
|
81
|
+
*
|
|
82
|
+
* Live examples:
|
|
83
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
84
|
+
* @example
|
|
85
|
+
* ```jsx
|
|
86
|
+
* <Combobox
|
|
87
|
+
* autoSelect
|
|
88
|
+
* getAutoSelectId={(items) => {
|
|
89
|
+
* // Auto select the first enabled item with a value
|
|
90
|
+
* const item = items.find((item) => {
|
|
91
|
+
* if (item.disabled) return false;
|
|
92
|
+
* if (!item.value) return false;
|
|
93
|
+
* return true;
|
|
94
|
+
* });
|
|
95
|
+
* return item?.id;
|
|
96
|
+
* }}
|
|
97
|
+
* />
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
getAutoSelectId?: (renderedItems: ComboboxStoreState["renderedItems"]) => string | null | undefined;
|
|
73
101
|
/**
|
|
74
102
|
* Whether the items will be filtered based on
|
|
75
103
|
* [`value`](https://ariakit.org/reference/combobox-provider#value) and
|
|
@@ -3,7 +3,7 @@ import type { BooleanOrCallback, StringWithValue } from "@ariakit/core/utils/typ
|
|
|
3
3
|
import type { CompositeOptions } from "../composite/composite.js";
|
|
4
4
|
import type { PopoverAnchorOptions } from "../popover/popover-anchor.js";
|
|
5
5
|
import type { As, Props } from "../utils/types.js";
|
|
6
|
-
import type { ComboboxStore } from "./combobox-store.js";
|
|
6
|
+
import type { ComboboxStore, ComboboxStoreState } from "./combobox-store.js";
|
|
7
7
|
/**
|
|
8
8
|
* Returns props to create a `Combobox` component.
|
|
9
9
|
* @see https://ariakit.org/components/combobox
|
|
@@ -70,6 +70,34 @@ export interface ComboboxOptions<T extends As = "input"> extends CompositeOption
|
|
|
70
70
|
* @default false
|
|
71
71
|
*/
|
|
72
72
|
autoSelect?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Function that takes the currently rendered items and returns the id of the
|
|
75
|
+
* item to be auto selected when the
|
|
76
|
+
* [`autoSelect`](https://ariakit.org/reference/combobox#autoselect) prop is
|
|
77
|
+
* `true`.
|
|
78
|
+
*
|
|
79
|
+
* By default, the first enabled item is auto selected. This function is handy
|
|
80
|
+
* if you prefer a different item to be auto selected.
|
|
81
|
+
*
|
|
82
|
+
* Live examples:
|
|
83
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
84
|
+
* @example
|
|
85
|
+
* ```jsx
|
|
86
|
+
* <Combobox
|
|
87
|
+
* autoSelect
|
|
88
|
+
* getAutoSelectId={(items) => {
|
|
89
|
+
* // Auto select the first enabled item with a value
|
|
90
|
+
* const item = items.find((item) => {
|
|
91
|
+
* if (item.disabled) return false;
|
|
92
|
+
* if (!item.value) return false;
|
|
93
|
+
* return true;
|
|
94
|
+
* });
|
|
95
|
+
* return item?.id;
|
|
96
|
+
* }}
|
|
97
|
+
* />
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
getAutoSelectId?: (renderedItems: ComboboxStoreState["renderedItems"]) => string | null | undefined;
|
|
73
101
|
/**
|
|
74
102
|
* Whether the items will be filtered based on
|
|
75
103
|
* [`value`](https://ariakit.org/reference/combobox-provider#value) and
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../__chunks/
|
|
5
|
+
var _JQS6X2I5cjs = require('../__chunks/JQS6X2I5.cjs');
|
|
6
|
+
require('../__chunks/6ZZYUFPW.cjs');
|
|
7
7
|
require('../__chunks/UZNYSPKP.cjs');
|
|
8
8
|
require('../__chunks/BZTDJIVT.cjs');
|
|
9
9
|
require('../__chunks/RNZNGEL4.cjs');
|
|
10
|
-
require('../__chunks/
|
|
10
|
+
require('../__chunks/OLOZ5JT2.cjs');
|
|
11
11
|
require('../__chunks/EO6LS72H.cjs');
|
|
12
12
|
require('../__chunks/CJDHQUBR.cjs');
|
|
13
13
|
require('../__chunks/AV6KTKLE.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.CompositeContainer =
|
|
17
|
+
exports.CompositeContainer = _JQS6X2I5cjs.CompositeContainer; exports.useCompositeContainer = _JQS6X2I5cjs.useCompositeContainer;
|
|
@@ -43,7 +43,12 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
|
|
|
43
43
|
*/
|
|
44
44
|
store?: CompositeStore;
|
|
45
45
|
/**
|
|
46
|
-
* Determines if the composite item should be
|
|
46
|
+
* Determines if the composite item should be _focused_ when hovered over.
|
|
47
|
+
*
|
|
48
|
+
* Note that the actual DOM focus will stay on the composite element. This
|
|
49
|
+
* item will get the
|
|
50
|
+
* [`data-active-item`](https://ariakit.org/guide/styling#data-active-item)
|
|
51
|
+
* attribute so it can be styled as if it's focused.
|
|
47
52
|
*
|
|
48
53
|
* Live examples:
|
|
49
54
|
* - [Multi-selectable
|
|
@@ -53,6 +58,9 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
|
|
|
53
58
|
* - [Textarea with inline
|
|
54
59
|
* Combobox](https://ariakit.org/examples/combobox-textarea)
|
|
55
60
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
61
|
+
* - [Submenu with
|
|
62
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
63
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
56
64
|
* @default true
|
|
57
65
|
*/
|
|
58
66
|
focusOnHover?: BooleanOrCallback<ReactMouseEvent<HTMLElement>>;
|
|
@@ -66,6 +74,9 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
|
|
|
66
74
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
67
75
|
* - [Combobox with integrated
|
|
68
76
|
* filter](https://ariakit.org/examples/combobox-filtering-integrated)
|
|
77
|
+
* - [Submenu with
|
|
78
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
79
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
69
80
|
*/
|
|
70
81
|
blurOnHoverEnd?: BooleanOrCallback<ReactMouseEvent<HTMLElement>>;
|
|
71
82
|
}
|
|
@@ -43,7 +43,12 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
|
|
|
43
43
|
*/
|
|
44
44
|
store?: CompositeStore;
|
|
45
45
|
/**
|
|
46
|
-
* Determines if the composite item should be
|
|
46
|
+
* Determines if the composite item should be _focused_ when hovered over.
|
|
47
|
+
*
|
|
48
|
+
* Note that the actual DOM focus will stay on the composite element. This
|
|
49
|
+
* item will get the
|
|
50
|
+
* [`data-active-item`](https://ariakit.org/guide/styling#data-active-item)
|
|
51
|
+
* attribute so it can be styled as if it's focused.
|
|
47
52
|
*
|
|
48
53
|
* Live examples:
|
|
49
54
|
* - [Multi-selectable
|
|
@@ -53,6 +58,9 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
|
|
|
53
58
|
* - [Textarea with inline
|
|
54
59
|
* Combobox](https://ariakit.org/examples/combobox-textarea)
|
|
55
60
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
61
|
+
* - [Submenu with
|
|
62
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
63
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
56
64
|
* @default true
|
|
57
65
|
*/
|
|
58
66
|
focusOnHover?: BooleanOrCallback<ReactMouseEvent<HTMLElement>>;
|
|
@@ -66,6 +74,9 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
|
|
|
66
74
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
67
75
|
* - [Combobox with integrated
|
|
68
76
|
* filter](https://ariakit.org/examples/combobox-filtering-integrated)
|
|
77
|
+
* - [Submenu with
|
|
78
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
79
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
69
80
|
*/
|
|
70
81
|
blurOnHoverEnd?: BooleanOrCallback<ReactMouseEvent<HTMLElement>>;
|
|
71
82
|
}
|