@ariakit/react-core 0.4.3 → 0.4.5
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 +58 -0
- package/cjs/__chunks/{7DQ2LBH2.cjs → 3HMQOCLF.cjs} +23 -5
- package/cjs/__chunks/{AJF5DT5A.cjs → AY5J25V7.cjs} +2 -2
- package/cjs/__chunks/{HFNM6QV4.cjs → DAOFDKV2.cjs} +1 -1
- package/cjs/__chunks/{GYHP7IYG.cjs → DFXPO2ED.cjs} +2 -2
- package/cjs/__chunks/{3C4RFBCG.cjs → EYZZO5IT.cjs} +1 -1
- package/cjs/__chunks/{3MKOUH5M.cjs → GZ2NNSLV.cjs} +4 -4
- package/cjs/__chunks/ISJGSS4S.cjs +16 -0
- package/cjs/__chunks/{A356CGND.cjs → JDCTLYQ4.cjs} +1 -1
- package/cjs/__chunks/{T5BWR4CB.cjs → KDTFHBKU.cjs} +2 -2
- package/cjs/__chunks/{NZSB7HSZ.cjs → LY4LCJM6.cjs} +2 -2
- package/cjs/__chunks/{DCTXNU2X.cjs → N43E53E6.cjs} +3 -3
- package/cjs/__chunks/{IHFGURUM.cjs → NRPEUNJB.cjs} +2 -2
- package/cjs/__chunks/PVLZGFP6.cjs +34 -0
- package/cjs/__chunks/{CWS5RZSU.cjs → QJDA4LG6.cjs} +28 -17
- package/cjs/__chunks/{NDVZ37O3.cjs → RG6U7KAS.cjs} +22 -4
- package/cjs/__chunks/YWAHOWYE.cjs +25 -0
- package/cjs/__chunks/{3XXW4Y4D.cjs → Z2VL7JHX.cjs} +2 -2
- package/cjs/checkbox/checkbox-check.cjs +2 -2
- package/cjs/collection/collection-renderer.d.cts +0 -2
- package/cjs/collection/collection-renderer.d.ts +0 -2
- package/cjs/combobox/combobox-cancel.cjs +4 -4
- package/cjs/combobox/combobox-disclosure.cjs +4 -4
- package/cjs/combobox/combobox-item-check.cjs +2 -2
- package/cjs/combobox/combobox-item.cjs +19 -9
- package/cjs/combobox/combobox-item.d.cts +22 -12
- package/cjs/combobox/combobox-item.d.ts +22 -12
- package/cjs/combobox/combobox-popover.cjs +41 -16
- package/cjs/combobox/combobox-provider.cjs +3 -2
- package/cjs/combobox/combobox-store.cjs +6 -2
- package/cjs/combobox/combobox-store.d.cts +12 -4
- package/cjs/combobox/combobox-store.d.ts +12 -4
- package/cjs/combobox/combobox-value.cjs +32 -0
- package/cjs/combobox/combobox-value.d.cts +41 -0
- package/cjs/combobox/combobox-value.d.ts +41 -0
- package/cjs/combobox/combobox.cjs +79 -32
- package/cjs/combobox/combobox.d.cts +20 -0
- package/cjs/combobox/combobox.d.ts +20 -0
- package/cjs/composite/composite-input.cjs +91 -6
- package/cjs/composite/composite-input.d.cts +2 -0
- package/cjs/composite/composite-input.d.ts +2 -0
- package/cjs/composite/composite-item.cjs +3 -3
- package/cjs/composite/composite-overflow-disclosure.cjs +3 -3
- package/cjs/composite/composite-overflow.cjs +12 -12
- package/cjs/composite/composite-renderer.d.cts +0 -2
- package/cjs/composite/composite-renderer.d.ts +0 -2
- package/cjs/dialog/dialog-backdrop.cjs +3 -3
- package/cjs/dialog/dialog-dismiss.cjs +2 -2
- package/cjs/dialog/dialog.cjs +11 -11
- package/cjs/dialog/dialog.d.cts +4 -0
- package/cjs/dialog/dialog.d.ts +4 -0
- package/cjs/dialog/utils/disable-tree.cjs +3 -3
- package/cjs/dialog/utils/use-prevent-body-scroll.cjs +3 -3
- package/cjs/form/form-checkbox.cjs +1 -1
- package/cjs/form/form-push.cjs +1 -1
- package/cjs/form/form-radio.cjs +4 -4
- package/cjs/hovercard/hovercard-disclosure.cjs +1 -1
- package/cjs/hovercard/hovercard-dismiss.cjs +4 -4
- package/cjs/hovercard/hovercard.cjs +13 -13
- package/cjs/menu/menu-button-arrow.cjs +2 -2
- package/cjs/menu/menu-dismiss.cjs +4 -4
- package/cjs/menu/menu-item-check.cjs +2 -2
- package/cjs/menu/menu-item-checkbox.cjs +4 -4
- package/cjs/menu/menu-item-radio.cjs +7 -7
- package/cjs/menu/menu-item.cjs +4 -4
- package/cjs/menu/menu.cjs +14 -14
- package/cjs/popover/popover-disclosure-arrow.cjs +2 -2
- package/cjs/popover/popover-dismiss.cjs +3 -3
- package/cjs/popover/popover.cjs +12 -12
- package/cjs/radio/radio.cjs +4 -4
- package/cjs/select/select-arrow.cjs +3 -3
- package/cjs/select/select-item-check.cjs +2 -2
- package/cjs/select/select-item.cjs +4 -4
- package/cjs/select/select-popover.cjs +13 -13
- package/cjs/select/select-value.d.cts +8 -7
- package/cjs/select/select-value.d.ts +8 -7
- package/cjs/select/select.cjs +4 -4
- package/cjs/tab/tab-panel.cjs +2 -2
- package/cjs/tab/tab.cjs +7 -7
- package/cjs/tag/tag-context.cjs +25 -0
- package/cjs/tag/tag-context.d.cts +21 -0
- package/cjs/tag/tag-context.d.ts +21 -0
- package/cjs/tag/tag-input.cjs +191 -0
- package/cjs/tag/tag-input.d.cts +122 -0
- package/cjs/tag/tag-input.d.ts +122 -0
- package/cjs/tag/tag-list-label.cjs +56 -0
- package/cjs/tag/tag-list-label.d.cts +55 -0
- package/cjs/tag/tag-list-label.d.ts +55 -0
- package/cjs/tag/tag-list.cjs +141 -0
- package/cjs/tag/tag-list.d.cts +58 -0
- package/cjs/tag/tag-list.d.ts +58 -0
- package/cjs/tag/tag-provider.cjs +26 -0
- package/cjs/tag/tag-provider.d.cts +29 -0
- package/cjs/tag/tag-provider.d.ts +29 -0
- package/cjs/tag/tag-remove.cjs +119 -0
- package/cjs/tag/tag-remove.d.cts +67 -0
- package/cjs/tag/tag-remove.d.ts +67 -0
- package/cjs/tag/tag-store.cjs +15 -0
- package/cjs/tag/tag-store.d.cts +49 -0
- package/cjs/tag/tag-store.d.ts +49 -0
- package/cjs/tag/tag-value.cjs +29 -0
- package/cjs/tag/tag-value.d.cts +41 -0
- package/cjs/tag/tag-value.d.ts +41 -0
- package/cjs/tag/tag-values.cjs +29 -0
- package/cjs/tag/tag-values.d.cts +52 -0
- package/cjs/tag/tag-values.d.ts +52 -0
- package/cjs/tag/tag.cjs +130 -0
- package/cjs/tag/tag.d.cts +74 -0
- package/cjs/tag/tag.d.ts +74 -0
- package/cjs/tag/utils.cjs +8 -0
- package/cjs/tag/utils.d.cts +1 -0
- package/cjs/tag/utils.d.ts +1 -0
- package/cjs/toolbar/toolbar-container.cjs +4 -4
- package/cjs/toolbar/toolbar-input.cjs +4 -8
- package/cjs/toolbar/toolbar-input.d.cts +3 -2
- package/cjs/toolbar/toolbar-input.d.ts +3 -2
- package/cjs/toolbar/toolbar-item.cjs +4 -4
- package/cjs/tooltip/tooltip.cjs +14 -14
- package/combobox/combobox-value/package.json +8 -0
- package/esm/__chunks/{LABIXQLW.js → 44PDY2W5.js} +1 -1
- package/esm/__chunks/{FYNSL2D5.js → 5H3YXAUC.js} +1 -1
- package/esm/__chunks/{6VDNHSLX.js → 65LF6MEO.js} +2 -2
- package/esm/__chunks/{X3V2DT2U.js → 6YVAEELE.js} +1 -1
- package/esm/__chunks/{JCOBPKEI.js → BY6P32UK.js} +1 -1
- package/esm/__chunks/{ZFEEEZVE.js → DLLQM6DZ.js} +22 -4
- package/esm/__chunks/{NN4HLGKS.js → F2RFUFO2.js} +1 -1
- package/esm/__chunks/{NQ4PTILT.js → FGHVVLPU.js} +29 -18
- package/esm/__chunks/{2VWKZYYT.js → H5N72W37.js} +1 -1
- package/esm/__chunks/L7IM35RU.js +16 -0
- package/esm/__chunks/{HW63KLP5.js → M354SEUF.js} +1 -1
- package/esm/__chunks/{RAKW656I.js → Q4PZFBSW.js} +1 -1
- package/esm/__chunks/QNNHZL3W.js +25 -0
- package/esm/__chunks/{C5HA76JU.js → QZJOXZKA.js} +1 -1
- package/esm/__chunks/{XK6CE2M5.js → UKDZLPKH.js} +1 -1
- package/esm/__chunks/{ONUY4D7O.js → VGORKDMQ.js} +26 -8
- package/esm/__chunks/WYDDZRWN.js +34 -0
- package/esm/checkbox/checkbox-check.js +1 -1
- package/esm/collection/collection-renderer.d.ts +0 -2
- package/esm/combobox/combobox-cancel.js +4 -4
- package/esm/combobox/combobox-disclosure.js +4 -4
- package/esm/combobox/combobox-item-check.js +1 -1
- package/esm/combobox/combobox-item.d.ts +22 -12
- package/esm/combobox/combobox-item.js +19 -9
- package/esm/combobox/combobox-popover.js +40 -15
- package/esm/combobox/combobox-provider.js +2 -1
- package/esm/combobox/combobox-store.d.ts +12 -4
- package/esm/combobox/combobox-store.js +5 -1
- package/esm/combobox/combobox-value.d.ts +41 -0
- package/esm/combobox/combobox-value.js +32 -0
- package/esm/combobox/combobox.d.ts +20 -0
- package/esm/combobox/combobox.js +80 -33
- package/esm/composite/composite-input.d.ts +2 -0
- package/esm/composite/composite-input.js +92 -7
- package/esm/composite/composite-item.js +2 -2
- package/esm/composite/composite-overflow-disclosure.js +2 -2
- package/esm/composite/composite-overflow.js +11 -11
- package/esm/composite/composite-renderer.d.ts +0 -2
- package/esm/dialog/dialog-backdrop.js +2 -2
- package/esm/dialog/dialog-dismiss.js +1 -1
- package/esm/dialog/dialog.d.ts +4 -0
- package/esm/dialog/dialog.js +10 -10
- package/esm/dialog/utils/disable-tree.js +2 -2
- package/esm/dialog/utils/use-prevent-body-scroll.js +2 -2
- package/esm/form/form-checkbox.js +1 -1
- package/esm/form/form-push.js +1 -1
- package/esm/form/form-radio.js +3 -3
- package/esm/hovercard/hovercard-disclosure.js +1 -1
- package/esm/hovercard/hovercard-dismiss.js +3 -3
- package/esm/hovercard/hovercard.js +12 -12
- package/esm/menu/menu-button-arrow.js +1 -1
- package/esm/menu/menu-dismiss.js +3 -3
- package/esm/menu/menu-item-check.js +1 -1
- package/esm/menu/menu-item-checkbox.js +3 -3
- package/esm/menu/menu-item-radio.js +5 -5
- package/esm/menu/menu-item.js +3 -3
- package/esm/menu/menu.js +12 -12
- package/esm/popover/popover-disclosure-arrow.js +1 -1
- package/esm/popover/popover-dismiss.js +2 -2
- package/esm/popover/popover.js +11 -11
- package/esm/radio/radio.js +3 -3
- package/esm/select/select-arrow.js +2 -2
- package/esm/select/select-item-check.js +1 -1
- package/esm/select/select-item.js +4 -4
- package/esm/select/select-popover.js +11 -11
- package/esm/select/select-value.d.ts +8 -7
- package/esm/select/select.js +3 -3
- package/esm/tab/tab-panel.js +3 -3
- package/esm/tab/tab.js +5 -5
- package/esm/tag/tag-context.d.ts +21 -0
- package/esm/tag/tag-context.js +25 -0
- package/esm/tag/tag-input.d.ts +122 -0
- package/esm/tag/tag-input.js +191 -0
- package/esm/tag/tag-list-label.d.ts +55 -0
- package/esm/tag/tag-list-label.js +56 -0
- package/esm/tag/tag-list.d.ts +58 -0
- package/esm/tag/tag-list.js +141 -0
- package/esm/tag/tag-provider.d.ts +29 -0
- package/esm/tag/tag-provider.js +26 -0
- package/esm/tag/tag-remove.d.ts +67 -0
- package/esm/tag/tag-remove.js +119 -0
- package/esm/tag/tag-store.d.ts +49 -0
- package/esm/tag/tag-store.js +15 -0
- package/esm/tag/tag-value.d.ts +41 -0
- package/esm/tag/tag-value.js +29 -0
- package/esm/tag/tag-values.d.ts +52 -0
- package/esm/tag/tag-values.js +29 -0
- package/esm/tag/tag.d.ts +74 -0
- package/esm/tag/tag.js +130 -0
- package/esm/tag/utils.d.ts +1 -0
- package/esm/tag/utils.js +8 -0
- package/esm/toolbar/toolbar-container.js +3 -3
- package/esm/toolbar/toolbar-input.d.ts +3 -2
- package/esm/toolbar/toolbar-input.js +3 -7
- package/esm/toolbar/toolbar-item.js +3 -3
- package/esm/tooltip/tooltip.js +12 -12
- package/package.json +86 -2
- package/tag/tag/package.json +8 -0
- package/tag/tag-context/package.json +8 -0
- package/tag/tag-input/package.json +8 -0
- package/tag/tag-list/package.json +8 -0
- package/tag/tag-list-label/package.json +8 -0
- package/tag/tag-provider/package.json +8 -0
- package/tag/tag-remove/package.json +8 -0
- package/tag/tag-store/package.json +8 -0
- package/tag/tag-value/package.json +8 -0
- package/tag/tag-values/package.json +8 -0
- package/tag/utils/package.json +8 -0
- package/cjs/__chunks/WGZQRLXV.cjs +0 -84
- package/esm/__chunks/RPGNBKKU.js +0 -84
- package/cjs/__chunks/{37BRXQN7.cjs → BX2QEIBH.cjs} +3 -3
- package/cjs/__chunks/{PVYTX5U5.cjs → SL55T4ZB.cjs} +2 -2
- package/cjs/__chunks/{TSEXNK3K.cjs → VR6GCLOV.cjs} +2 -2
- package/esm/__chunks/{PTPUIM7N.js → 3TEK3C5Q.js} +3 -3
- package/esm/__chunks/{U2L67A6K.js → BC72XE6E.js} +3 -3
- package/esm/__chunks/{GOXKZAQI.js → CMFBAHKI.js} +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/U4NXCMZ3.cjs');
|
|
4
|
+
var _2IJSEADJcjs = require('../__chunks/2IJSEADJ.cjs');
|
|
6
5
|
|
|
7
6
|
|
|
8
|
-
var
|
|
7
|
+
var _IXJIFLOAcjs = require('../__chunks/IXJIFLOA.cjs');
|
|
8
|
+
require('../__chunks/U4NXCMZ3.cjs');
|
|
9
9
|
require('../__chunks/VPI3EKVY.cjs');
|
|
10
10
|
require('../__chunks/NEK2UEJN.cjs');
|
|
11
11
|
require('../__chunks/77BAEZ2Z.cjs');
|
|
@@ -44,7 +44,7 @@ var children = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
|
44
44
|
stroke: "currentColor",
|
|
45
45
|
strokeLinecap: "round",
|
|
46
46
|
strokeLinejoin: "round",
|
|
47
|
-
strokeWidth:
|
|
47
|
+
strokeWidth: 1.5,
|
|
48
48
|
width: "1em",
|
|
49
49
|
height: "1em",
|
|
50
50
|
pointerEvents: "none",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var _2IJSEADJcjs = require('../__chunks/2IJSEADJ.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
4
7
|
var _BSEVPIKOcjs = require('../__chunks/BSEVPIKO.cjs');
|
|
5
8
|
require('../__chunks/27SIFUY3.cjs');
|
|
6
9
|
require('../__chunks/IXJIFLOA.cjs');
|
|
7
10
|
require('../__chunks/U4NXCMZ3.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _2IJSEADJcjs = require('../__chunks/2IJSEADJ.cjs');
|
|
11
11
|
require('../__chunks/VPI3EKVY.cjs');
|
|
12
12
|
require('../__chunks/NEK2UEJN.cjs');
|
|
13
13
|
require('../__chunks/77BAEZ2Z.cjs');
|
|
@@ -43,7 +43,7 @@ var children = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
|
43
43
|
stroke: "currentColor",
|
|
44
44
|
strokeLinecap: "round",
|
|
45
45
|
strokeLinejoin: "round",
|
|
46
|
-
strokeWidth:
|
|
46
|
+
strokeWidth: 1.5,
|
|
47
47
|
viewBox: "0 0 16 16",
|
|
48
48
|
height: "1em",
|
|
49
49
|
width: "1em",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _JDCTLYQ4cjs = require('../__chunks/JDCTLYQ4.cjs');
|
|
5
5
|
require('../__chunks/ERFHNHON.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ var useComboboxItemCheck = _NGD3IQDBcjs.createHook.call(void 0, function useComb
|
|
|
31
31
|
var _b = _a, { store, checked } = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, ["store", "checked"]);
|
|
32
32
|
const context = _react.useContext.call(void 0, _2IJSEADJcjs.ComboboxItemCheckedContext);
|
|
33
33
|
checked = checked != null ? checked : context;
|
|
34
|
-
props =
|
|
34
|
+
props = _JDCTLYQ4cjs.useCheckboxCheck.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), { checked }));
|
|
35
35
|
return props;
|
|
36
36
|
});
|
|
37
37
|
var ComboboxItemCheck = _NGD3IQDBcjs.forwardRef.call(void 0, function ComboboxItemCheck2(props) {
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
var _Q6QJEXBKcjs = require('../__chunks/Q6QJEXBK.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var _7DQ2LBH2cjs = require('../__chunks/7DQ2LBH2.cjs');
|
|
8
|
-
require('../__chunks/U4NXCMZ3.cjs');
|
|
9
7
|
|
|
10
8
|
|
|
11
9
|
|
|
10
|
+
var _2IJSEADJcjs = require('../__chunks/2IJSEADJ.cjs');
|
|
12
11
|
|
|
13
12
|
|
|
14
|
-
var
|
|
13
|
+
var _3HMQOCLFcjs = require('../__chunks/3HMQOCLF.cjs');
|
|
15
14
|
require('../__chunks/HD5AHCRI.cjs');
|
|
15
|
+
require('../__chunks/U4NXCMZ3.cjs');
|
|
16
16
|
require('../__chunks/6ZZYUFPW.cjs');
|
|
17
17
|
require('../__chunks/VPI3EKVY.cjs');
|
|
18
18
|
require('../__chunks/NEK2UEJN.cjs');
|
|
@@ -74,8 +74,9 @@ var useComboboxItem = _NGD3IQDBcjs.createHook.call(void 0,
|
|
|
74
74
|
store,
|
|
75
75
|
value,
|
|
76
76
|
hideOnClick,
|
|
77
|
-
selectValueOnClick = true,
|
|
78
77
|
setValueOnClick,
|
|
78
|
+
selectValueOnClick = true,
|
|
79
|
+
resetValueOnSelect,
|
|
79
80
|
focusOnHover = false,
|
|
80
81
|
moveOnKeyPress = true,
|
|
81
82
|
getItem: getItemProp
|
|
@@ -83,12 +84,14 @@ var useComboboxItem = _NGD3IQDBcjs.createHook.call(void 0,
|
|
|
83
84
|
"store",
|
|
84
85
|
"value",
|
|
85
86
|
"hideOnClick",
|
|
86
|
-
"selectValueOnClick",
|
|
87
87
|
"setValueOnClick",
|
|
88
|
+
"selectValueOnClick",
|
|
89
|
+
"resetValueOnSelect",
|
|
88
90
|
"focusOnHover",
|
|
89
91
|
"moveOnKeyPress",
|
|
90
92
|
"getItem"
|
|
91
93
|
]);
|
|
94
|
+
var _a2;
|
|
92
95
|
const context = _2IJSEADJcjs.useComboboxScopedContext.call(void 0, );
|
|
93
96
|
store = store || context;
|
|
94
97
|
_misc.invariant.call(void 0,
|
|
@@ -108,11 +111,18 @@ var useComboboxItem = _NGD3IQDBcjs.createHook.call(void 0,
|
|
|
108
111
|
const multiSelectable = store.useState(
|
|
109
112
|
(state) => Array.isArray(state.selectedValue)
|
|
110
113
|
);
|
|
114
|
+
const selected = store.useState(
|
|
115
|
+
(state) => isSelected(state.selectedValue, value)
|
|
116
|
+
);
|
|
117
|
+
const resetValueOnSelectState = store.useState("resetValueOnSelect");
|
|
111
118
|
setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable;
|
|
112
119
|
hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable;
|
|
113
120
|
const onClickProp = props.onClick;
|
|
114
121
|
const setValueOnClickProp = _TW3SFX4Ccjs.useBooleanEvent.call(void 0, setValueOnClick);
|
|
115
122
|
const selectValueOnClickProp = _TW3SFX4Ccjs.useBooleanEvent.call(void 0, selectValueOnClick);
|
|
123
|
+
const resetValueOnSelectProp = _TW3SFX4Ccjs.useBooleanEvent.call(void 0,
|
|
124
|
+
(_a2 = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a2 : multiSelectable
|
|
125
|
+
);
|
|
116
126
|
const hideOnClickProp = _TW3SFX4Ccjs.useBooleanEvent.call(void 0, hideOnClick);
|
|
117
127
|
const onClick = _TW3SFX4Ccjs.useEvent.call(void 0, (event) => {
|
|
118
128
|
onClickProp == null ? void 0 : onClickProp(event);
|
|
@@ -124,6 +134,9 @@ var useComboboxItem = _NGD3IQDBcjs.createHook.call(void 0,
|
|
|
124
134
|
return;
|
|
125
135
|
if (value != null) {
|
|
126
136
|
if (selectValueOnClickProp(event)) {
|
|
137
|
+
if (resetValueOnSelectProp(event)) {
|
|
138
|
+
store == null ? void 0 : store.resetValue();
|
|
139
|
+
}
|
|
127
140
|
store == null ? void 0 : store.setSelectedValue((prevValue) => {
|
|
128
141
|
if (!Array.isArray(prevValue))
|
|
129
142
|
return value;
|
|
@@ -159,9 +172,6 @@ var useComboboxItem = _NGD3IQDBcjs.createHook.call(void 0,
|
|
|
159
172
|
}
|
|
160
173
|
}
|
|
161
174
|
});
|
|
162
|
-
const selected = store.useState(
|
|
163
|
-
(state) => isSelected(state.selectedValue, value)
|
|
164
|
-
);
|
|
165
175
|
if (multiSelectable && selected != null) {
|
|
166
176
|
props = _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
167
177
|
"aria-selected": selected
|
|
@@ -181,7 +191,7 @@ var useComboboxItem = _NGD3IQDBcjs.createHook.call(void 0,
|
|
|
181
191
|
onKeyDown
|
|
182
192
|
});
|
|
183
193
|
const moveOnKeyPressProp = _TW3SFX4Ccjs.useBooleanEvent.call(void 0, moveOnKeyPress);
|
|
184
|
-
props =
|
|
194
|
+
props = _3HMQOCLFcjs.useCompositeItem.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
185
195
|
store
|
|
186
196
|
}, props), {
|
|
187
197
|
getItem,
|
|
@@ -93,6 +93,20 @@ export interface ComboboxItemOptions<T extends ElementType = TagName> extends Co
|
|
|
93
93
|
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
94
94
|
*/
|
|
95
95
|
hideOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
96
|
+
/**
|
|
97
|
+
* Whether to set the combobox
|
|
98
|
+
* [`value`](https://ariakit.org/reference/combobox-provider#value) state
|
|
99
|
+
* using this item's
|
|
100
|
+
* [`value`](https://ariakit.org/reference/combobox-item#value) when the item
|
|
101
|
+
* is clicked. The default is `true`, unless the combobox is
|
|
102
|
+
* [multi-selectable](https://ariakit.org/examples/combobox-multiple).
|
|
103
|
+
*
|
|
104
|
+
* Live examples:
|
|
105
|
+
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
106
|
+
* - [Submenu with
|
|
107
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
108
|
+
*/
|
|
109
|
+
setValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
96
110
|
/**
|
|
97
111
|
* Whether to set the
|
|
98
112
|
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
@@ -108,19 +122,15 @@ export interface ComboboxItemOptions<T extends ElementType = TagName> extends Co
|
|
|
108
122
|
*/
|
|
109
123
|
selectValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
110
124
|
/**
|
|
111
|
-
* Whether to
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* [`
|
|
115
|
-
*
|
|
116
|
-
* [
|
|
117
|
-
*
|
|
118
|
-
* Live examples:
|
|
119
|
-
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
120
|
-
* - [Submenu with
|
|
121
|
-
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
125
|
+
* Whether to reset the the combobox input value when this item is selected or
|
|
126
|
+
* unselected by click. This prop is set to `true` by default if
|
|
127
|
+
* the combobox supports multiple selections. In other words, if the
|
|
128
|
+
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
129
|
+
* or
|
|
130
|
+
* [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue)
|
|
131
|
+
* props are arrays.
|
|
122
132
|
*/
|
|
123
|
-
|
|
133
|
+
resetValueOnSelect?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
124
134
|
/**
|
|
125
135
|
* @default false
|
|
126
136
|
*/
|
|
@@ -93,6 +93,20 @@ export interface ComboboxItemOptions<T extends ElementType = TagName> extends Co
|
|
|
93
93
|
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
94
94
|
*/
|
|
95
95
|
hideOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
96
|
+
/**
|
|
97
|
+
* Whether to set the combobox
|
|
98
|
+
* [`value`](https://ariakit.org/reference/combobox-provider#value) state
|
|
99
|
+
* using this item's
|
|
100
|
+
* [`value`](https://ariakit.org/reference/combobox-item#value) when the item
|
|
101
|
+
* is clicked. The default is `true`, unless the combobox is
|
|
102
|
+
* [multi-selectable](https://ariakit.org/examples/combobox-multiple).
|
|
103
|
+
*
|
|
104
|
+
* Live examples:
|
|
105
|
+
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
106
|
+
* - [Submenu with
|
|
107
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
108
|
+
*/
|
|
109
|
+
setValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
96
110
|
/**
|
|
97
111
|
* Whether to set the
|
|
98
112
|
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
@@ -108,19 +122,15 @@ export interface ComboboxItemOptions<T extends ElementType = TagName> extends Co
|
|
|
108
122
|
*/
|
|
109
123
|
selectValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
110
124
|
/**
|
|
111
|
-
* Whether to
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* [`
|
|
115
|
-
*
|
|
116
|
-
* [
|
|
117
|
-
*
|
|
118
|
-
* Live examples:
|
|
119
|
-
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
120
|
-
* - [Submenu with
|
|
121
|
-
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
125
|
+
* Whether to reset the the combobox input value when this item is selected or
|
|
126
|
+
* unselected by click. This prop is set to `true` by default if
|
|
127
|
+
* the combobox supports multiple selections. In other words, if the
|
|
128
|
+
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
129
|
+
* or
|
|
130
|
+
* [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue)
|
|
131
|
+
* props are arrays.
|
|
122
132
|
*/
|
|
123
|
-
|
|
133
|
+
resetValueOnSelect?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
124
134
|
/**
|
|
125
135
|
* @default false
|
|
126
136
|
*/
|
|
@@ -9,32 +9,32 @@ require('../__chunks/VPI3EKVY.cjs');
|
|
|
9
9
|
require('../__chunks/NEK2UEJN.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _N43E53E6cjs = require('../__chunks/N43E53E6.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
require('../__chunks/
|
|
17
|
-
require('../__chunks/JF225FQ5.cjs');
|
|
18
|
-
require('../__chunks/37BRXQN7.cjs');
|
|
19
|
-
require('../__chunks/MU7F4QWJ.cjs');
|
|
20
|
-
require('../__chunks/PVYTX5U5.cjs');
|
|
21
|
-
require('../__chunks/DLIQLPX4.cjs');
|
|
15
|
+
var _QJDA4LG6cjs = require('../__chunks/QJDA4LG6.cjs');
|
|
16
|
+
require('../__chunks/VR6GCLOV.cjs');
|
|
22
17
|
require('../__chunks/UUJ5Q6IA.cjs');
|
|
23
18
|
require('../__chunks/4H7FYXWQ.cjs');
|
|
19
|
+
require('../__chunks/JF225FQ5.cjs');
|
|
24
20
|
require('../__chunks/JKERATCG.cjs');
|
|
21
|
+
require('../__chunks/BX2QEIBH.cjs');
|
|
22
|
+
require('../__chunks/MU7F4QWJ.cjs');
|
|
23
|
+
require('../__chunks/6IUEXB4L.cjs');
|
|
25
24
|
require('../__chunks/7YLCVXZ7.cjs');
|
|
26
25
|
require('../__chunks/CXZMA435.cjs');
|
|
27
26
|
require('../__chunks/7TN63K2T.cjs');
|
|
27
|
+
require('../__chunks/SL55T4ZB.cjs');
|
|
28
28
|
require('../__chunks/3ND7K6FF.cjs');
|
|
29
|
-
require('../__chunks/
|
|
29
|
+
require('../__chunks/DLIQLPX4.cjs');
|
|
30
30
|
require('../__chunks/AFPGTIIH.cjs');
|
|
31
31
|
require('../__chunks/J3OG6T3B.cjs');
|
|
32
|
+
require('../__chunks/2BIO7R5N.cjs');
|
|
32
33
|
require('../__chunks/PE3KUHN6.cjs');
|
|
33
34
|
require('../__chunks/AXNMZ6L6.cjs');
|
|
34
35
|
require('../__chunks/CVD2AZE2.cjs');
|
|
35
|
-
require('../__chunks/2BIO7R5N.cjs');
|
|
36
|
-
require('../__chunks/R6M66EKZ.cjs');
|
|
37
36
|
require('../__chunks/7CYY7U2A.cjs');
|
|
37
|
+
require('../__chunks/R6M66EKZ.cjs');
|
|
38
38
|
require('../__chunks/77BAEZ2Z.cjs');
|
|
39
39
|
require('../__chunks/GDEDCFNU.cjs');
|
|
40
40
|
require('../__chunks/NTNMOEWE.cjs');
|
|
@@ -48,7 +48,9 @@ require('../__chunks/LLMPAMXI.cjs');
|
|
|
48
48
|
var _NGD3IQDBcjs = require('../__chunks/NGD3IQDB.cjs');
|
|
49
49
|
require('../__chunks/V3ZO7ICA.cjs');
|
|
50
50
|
require('../__chunks/N6YOHUBI.cjs');
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
var _GXMZA6DTcjs = require('../__chunks/GXMZA6DT.cjs');
|
|
52
54
|
require('../__chunks/TW3SFX4C.cjs');
|
|
53
55
|
require('../__chunks/CJDHQUBR.cjs');
|
|
54
56
|
|
|
@@ -58,6 +60,7 @@ require('../__chunks/CJDHQUBR.cjs');
|
|
|
58
60
|
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
59
61
|
|
|
60
62
|
// src/combobox/combobox-popover.tsx
|
|
63
|
+
var _react = require('react');
|
|
61
64
|
var _dom = require('@ariakit/core/utils/dom');
|
|
62
65
|
var _misc = require('@ariakit/core/utils/misc');
|
|
63
66
|
var TagName = "div";
|
|
@@ -79,12 +82,14 @@ var useComboboxPopover = _NGD3IQDBcjs.createHook.call(void 0,
|
|
|
79
82
|
modal,
|
|
80
83
|
tabIndex,
|
|
81
84
|
alwaysVisible,
|
|
85
|
+
autoFocusOnHide = true,
|
|
82
86
|
hideOnInteractOutside = true
|
|
83
87
|
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
84
88
|
"store",
|
|
85
89
|
"modal",
|
|
86
90
|
"tabIndex",
|
|
87
91
|
"alwaysVisible",
|
|
92
|
+
"autoFocusOnHide",
|
|
88
93
|
"hideOnInteractOutside"
|
|
89
94
|
]);
|
|
90
95
|
const context = _2IJSEADJcjs.useComboboxProviderContext.call(void 0, );
|
|
@@ -94,16 +99,21 @@ var useComboboxPopover = _NGD3IQDBcjs.createHook.call(void 0,
|
|
|
94
99
|
process.env.NODE_ENV !== "production" && "ComboboxPopover must receive a `store` prop or be wrapped in a ComboboxProvider component."
|
|
95
100
|
);
|
|
96
101
|
const baseElement = store.useState("baseElement");
|
|
102
|
+
const hiddenByClickOutsideRef = _react.useRef.call(void 0, false);
|
|
103
|
+
const treeSnapshotKey = _GXMZA6DTcjs.useStoreState.call(void 0,
|
|
104
|
+
store.tag,
|
|
105
|
+
(state) => state == null ? void 0 : state.renderedItems.length
|
|
106
|
+
);
|
|
97
107
|
props = _Q6MAE3CVcjs.useComboboxList.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, alwaysVisible }, props));
|
|
98
|
-
props =
|
|
108
|
+
props = _N43E53E6cjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
99
109
|
store,
|
|
100
110
|
modal,
|
|
101
111
|
alwaysVisible,
|
|
102
112
|
backdrop: false,
|
|
103
113
|
autoFocusOnShow: false,
|
|
104
|
-
autoFocusOnHide: false,
|
|
105
114
|
finalFocus: baseElement,
|
|
106
|
-
preserveTabOrderAnchor: null
|
|
115
|
+
preserveTabOrderAnchor: null,
|
|
116
|
+
unstable_treeSnapshotKey: treeSnapshotKey
|
|
107
117
|
}, props), {
|
|
108
118
|
// When the combobox popover is modal, we make sure to include the
|
|
109
119
|
// combobox input and all the combobox controls (cancel, disclosure) in
|
|
@@ -133,6 +143,18 @@ var useComboboxPopover = _NGD3IQDBcjs.createHook.call(void 0,
|
|
|
133
143
|
const controlElements = doc.querySelectorAll(selector);
|
|
134
144
|
return [...elements, ...controlElements];
|
|
135
145
|
},
|
|
146
|
+
// The combobox popover should focus on the combobox input when it hides,
|
|
147
|
+
// unless the event was triggered by a click outside the popover, in which
|
|
148
|
+
// case the input shouldn't be re-focused.
|
|
149
|
+
autoFocusOnHide(element) {
|
|
150
|
+
if (_misc.isFalsyBooleanCallback.call(void 0, autoFocusOnHide, element))
|
|
151
|
+
return false;
|
|
152
|
+
if (hiddenByClickOutsideRef.current) {
|
|
153
|
+
hiddenByClickOutsideRef.current = false;
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
},
|
|
136
158
|
// Make sure we don't hide the popover when the user interacts with the
|
|
137
159
|
// combobox cancel or the combobox disclosure buttons. They will have the
|
|
138
160
|
// aria-controls attribute pointing to either the combobox input or the
|
|
@@ -145,13 +167,16 @@ var useComboboxPopover = _NGD3IQDBcjs.createHook.call(void 0,
|
|
|
145
167
|
if (isController(event.target, contentId, baseId))
|
|
146
168
|
return false;
|
|
147
169
|
const result = typeof hideOnInteractOutside === "function" ? hideOnInteractOutside(event) : hideOnInteractOutside;
|
|
170
|
+
if (result) {
|
|
171
|
+
hiddenByClickOutsideRef.current = event.type === "click";
|
|
172
|
+
}
|
|
148
173
|
return result;
|
|
149
174
|
}
|
|
150
175
|
}));
|
|
151
176
|
return props;
|
|
152
177
|
}
|
|
153
178
|
);
|
|
154
|
-
var ComboboxPopover =
|
|
179
|
+
var ComboboxPopover = _QJDA4LG6cjs.createDialogComponent.call(void 0,
|
|
155
180
|
_NGD3IQDBcjs.forwardRef.call(void 0, function ComboboxPopover2(props) {
|
|
156
181
|
const htmlProps = useComboboxPopover(props);
|
|
157
182
|
return _NGD3IQDBcjs.createElement.call(void 0, TagName, htmlProps);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _RG6U7KAScjs = require('../__chunks/RG6U7KAS.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _2IJSEADJcjs = require('../__chunks/2IJSEADJ.cjs');
|
|
8
|
+
require('../__chunks/PVLZGFP6.cjs');
|
|
8
9
|
require('../__chunks/4H5ZMMOI.cjs');
|
|
9
10
|
require('../__chunks/Q7DU7FP7.cjs');
|
|
10
11
|
require('../__chunks/VPI3EKVY.cjs');
|
|
@@ -24,7 +25,7 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
24
25
|
// src/combobox/combobox-provider.tsx
|
|
25
26
|
var _jsxruntime = require('react/jsx-runtime');
|
|
26
27
|
function ComboboxProvider(props = {}) {
|
|
27
|
-
const store =
|
|
28
|
+
const store = _RG6U7KAScjs.useComboboxStore.call(void 0, props);
|
|
28
29
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _2IJSEADJcjs.ComboboxContextProvider, { value: store, children: props.children });
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _RG6U7KAScjs = require('../__chunks/RG6U7KAS.cjs');
|
|
6
|
+
require('../__chunks/PVLZGFP6.cjs');
|
|
6
7
|
require('../__chunks/4H5ZMMOI.cjs');
|
|
7
8
|
require('../__chunks/Q7DU7FP7.cjs');
|
|
9
|
+
require('../__chunks/VPI3EKVY.cjs');
|
|
10
|
+
require('../__chunks/NEK2UEJN.cjs');
|
|
11
|
+
require('../__chunks/NGD3IQDB.cjs');
|
|
8
12
|
require('../__chunks/6RJSKW2C.cjs');
|
|
9
13
|
require('../__chunks/V3ZO7ICA.cjs');
|
|
10
14
|
require('../__chunks/N6YOHUBI.cjs');
|
|
@@ -15,4 +19,4 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
15
19
|
|
|
16
20
|
|
|
17
21
|
|
|
18
|
-
exports.useComboboxStore =
|
|
22
|
+
exports.useComboboxStore = _RG6U7KAScjs.useComboboxStore; exports.useComboboxStoreProps = _RG6U7KAScjs.useComboboxStoreProps;
|
|
@@ -2,9 +2,12 @@ import * as Core from "@ariakit/core/combobox/combobox-store";
|
|
|
2
2
|
import type { PickRequired } from "@ariakit/core/utils/types";
|
|
3
3
|
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
4
4
|
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
|
|
5
|
+
import type { TagStore } from "../tag/tag-store.js";
|
|
5
6
|
import type { Store } from "../utils/store.js";
|
|
6
7
|
export declare function useComboboxStoreProps<T extends Core.ComboboxStore>(store: T, update: () => void, props: ComboboxStoreProps): T & {
|
|
7
8
|
disclosure: import("../disclosure/disclosure-store.js").DisclosureStore | null | undefined;
|
|
9
|
+
} & {
|
|
10
|
+
tag: TagStore | null | undefined;
|
|
8
11
|
};
|
|
9
12
|
/**
|
|
10
13
|
* Creates a combobox store to control the state of
|
|
@@ -31,9 +34,9 @@ export interface ComboboxStoreItem extends Core.ComboboxStoreItem {
|
|
|
31
34
|
}
|
|
32
35
|
export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Core.ComboboxStoreState<T>, CompositeStoreState<ComboboxStoreItem>, PopoverStoreState {
|
|
33
36
|
}
|
|
34
|
-
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Omit<Core.ComboboxStoreFunctions<T>, "disclosure">, CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
37
|
+
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Pick<ComboboxStoreOptions<T>, "tag">, Omit<Core.ComboboxStoreFunctions<T>, "tag" | "disclosure">, CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
35
38
|
}
|
|
36
|
-
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Omit<Core.ComboboxStoreOptions<T>, "disclosure">, CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions {
|
|
39
|
+
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Omit<Core.ComboboxStoreOptions<T>, "tag" | "disclosure">, CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions {
|
|
37
40
|
/**
|
|
38
41
|
* A callback that gets called when the
|
|
39
42
|
* [`value`](https://ariakit.org/reference/combobox-provider#value) state
|
|
@@ -61,8 +64,13 @@ export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = Com
|
|
|
61
64
|
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
62
65
|
*/
|
|
63
66
|
setSelectedValue?: (value: ComboboxStoreState<T>["selectedValue"]) => void;
|
|
67
|
+
/**
|
|
68
|
+
* A reference to a [tag store](https://ariakit.org/apis/use-tag-store). It's
|
|
69
|
+
* automatically set when rendering a combobox within a tag list.
|
|
70
|
+
*/
|
|
71
|
+
tag?: TagStore | null;
|
|
64
72
|
}
|
|
65
|
-
export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, Omit<Core.ComboboxStoreProps<T>, "disclosure"> {
|
|
73
|
+
export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, Omit<Core.ComboboxStoreProps<T>, "tag" | "disclosure"> {
|
|
66
74
|
}
|
|
67
|
-
export interface ComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreFunctions<T>, Omit<Store<Core.ComboboxStore<T>>, "disclosure"> {
|
|
75
|
+
export interface ComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreFunctions<T>, Omit<Store<Core.ComboboxStore<T>>, "tag" | "disclosure"> {
|
|
68
76
|
}
|
|
@@ -2,9 +2,12 @@ import * as Core from "@ariakit/core/combobox/combobox-store";
|
|
|
2
2
|
import type { PickRequired } from "@ariakit/core/utils/types";
|
|
3
3
|
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
4
4
|
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
|
|
5
|
+
import type { TagStore } from "../tag/tag-store.js";
|
|
5
6
|
import type { Store } from "../utils/store.js";
|
|
6
7
|
export declare function useComboboxStoreProps<T extends Core.ComboboxStore>(store: T, update: () => void, props: ComboboxStoreProps): T & {
|
|
7
8
|
disclosure: import("../disclosure/disclosure-store.js").DisclosureStore | null | undefined;
|
|
9
|
+
} & {
|
|
10
|
+
tag: TagStore | null | undefined;
|
|
8
11
|
};
|
|
9
12
|
/**
|
|
10
13
|
* Creates a combobox store to control the state of
|
|
@@ -31,9 +34,9 @@ export interface ComboboxStoreItem extends Core.ComboboxStoreItem {
|
|
|
31
34
|
}
|
|
32
35
|
export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Core.ComboboxStoreState<T>, CompositeStoreState<ComboboxStoreItem>, PopoverStoreState {
|
|
33
36
|
}
|
|
34
|
-
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Omit<Core.ComboboxStoreFunctions<T>, "disclosure">, CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
37
|
+
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Pick<ComboboxStoreOptions<T>, "tag">, Omit<Core.ComboboxStoreFunctions<T>, "tag" | "disclosure">, CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
35
38
|
}
|
|
36
|
-
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Omit<Core.ComboboxStoreOptions<T>, "disclosure">, CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions {
|
|
39
|
+
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Omit<Core.ComboboxStoreOptions<T>, "tag" | "disclosure">, CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions {
|
|
37
40
|
/**
|
|
38
41
|
* A callback that gets called when the
|
|
39
42
|
* [`value`](https://ariakit.org/reference/combobox-provider#value) state
|
|
@@ -61,8 +64,13 @@ export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = Com
|
|
|
61
64
|
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
62
65
|
*/
|
|
63
66
|
setSelectedValue?: (value: ComboboxStoreState<T>["selectedValue"]) => void;
|
|
67
|
+
/**
|
|
68
|
+
* A reference to a [tag store](https://ariakit.org/apis/use-tag-store). It's
|
|
69
|
+
* automatically set when rendering a combobox within a tag list.
|
|
70
|
+
*/
|
|
71
|
+
tag?: TagStore | null;
|
|
64
72
|
}
|
|
65
|
-
export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, Omit<Core.ComboboxStoreProps<T>, "disclosure"> {
|
|
73
|
+
export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, Omit<Core.ComboboxStoreProps<T>, "tag" | "disclosure"> {
|
|
66
74
|
}
|
|
67
|
-
export interface ComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreFunctions<T>, Omit<Store<Core.ComboboxStore<T>>, "disclosure"> {
|
|
75
|
+
export interface ComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreFunctions<T>, Omit<Store<Core.ComboboxStore<T>>, "tag" | "disclosure"> {
|
|
68
76
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _2IJSEADJcjs = require('../__chunks/2IJSEADJ.cjs');
|
|
5
|
+
require('../__chunks/VPI3EKVY.cjs');
|
|
6
|
+
require('../__chunks/NEK2UEJN.cjs');
|
|
7
|
+
require('../__chunks/77BAEZ2Z.cjs');
|
|
8
|
+
require('../__chunks/GDEDCFNU.cjs');
|
|
9
|
+
require('../__chunks/NTNMOEWE.cjs');
|
|
10
|
+
require('../__chunks/NGD3IQDB.cjs');
|
|
11
|
+
require('../__chunks/TW3SFX4C.cjs');
|
|
12
|
+
require('../__chunks/CJDHQUBR.cjs');
|
|
13
|
+
require('../__chunks/AV6KTKLE.cjs');
|
|
14
|
+
|
|
15
|
+
// src/combobox/combobox-value.tsx
|
|
16
|
+
var _misc = require('@ariakit/core/utils/misc');
|
|
17
|
+
function ComboboxValue({ store, children } = {}) {
|
|
18
|
+
const context = _2IJSEADJcjs.useComboboxContext.call(void 0, );
|
|
19
|
+
store = store || context;
|
|
20
|
+
_misc.invariant.call(void 0,
|
|
21
|
+
store,
|
|
22
|
+
process.env.NODE_ENV !== "production" && "ComboboxValue must receive a `store` prop or be wrapped in a ComboboxProvider component."
|
|
23
|
+
);
|
|
24
|
+
const value = store.useState("value");
|
|
25
|
+
if (children) {
|
|
26
|
+
return children(value);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
exports.ComboboxValue = ComboboxValue;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ComboboxStore, ComboboxStoreState } from "./combobox-store.js";
|
|
3
|
+
/**
|
|
4
|
+
* Renders the current
|
|
5
|
+
* [`value`](https://ariakit.org/reference/use-combobox-store#value) state in
|
|
6
|
+
* the [combobox store](https://ariakit.org/reference/use-combobox-store).
|
|
7
|
+
*
|
|
8
|
+
* As a value component, it doesn't render any DOM elements and therefore
|
|
9
|
+
* doesn't accept HTML props.
|
|
10
|
+
*
|
|
11
|
+
* It takes a
|
|
12
|
+
* [`children`](https://ariakit.org/reference/combobox-value#children) function
|
|
13
|
+
* that gets called with the current value as an argument. This can be used as
|
|
14
|
+
* an uncontrolled API to render the combobox value in a custom way.
|
|
15
|
+
* @see https://ariakit.org/components/combobox
|
|
16
|
+
* @example
|
|
17
|
+
* ```jsx {3-5}
|
|
18
|
+
* <ComboboxProvider>
|
|
19
|
+
* <Combobox />
|
|
20
|
+
* <ComboboxValue>
|
|
21
|
+
* {(value) => `Current value: ${value}`}
|
|
22
|
+
* </ComboboxValue>
|
|
23
|
+
* </ComboboxProvider>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function ComboboxValue({ store, children }?: ComboboxValueProps): ReactNode;
|
|
27
|
+
export interface ComboboxValueProps {
|
|
28
|
+
/**
|
|
29
|
+
* Object returned by the
|
|
30
|
+
* [`useComboboxStore`](https://ariakit.org/reference/use-combobox-store)
|
|
31
|
+
* hook. If not provided, the closest
|
|
32
|
+
* [`ComboboxProvider`](https://ariakit.org/reference/combobox-provider)
|
|
33
|
+
* component's context will be used.
|
|
34
|
+
*/
|
|
35
|
+
store?: ComboboxStore;
|
|
36
|
+
/**
|
|
37
|
+
* A function that gets called with the current value as an argument. It can
|
|
38
|
+
* be used to render the combobox value in a custom way.
|
|
39
|
+
*/
|
|
40
|
+
children?: (value: ComboboxStoreState["value"]) => ReactNode;
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ComboboxStore, ComboboxStoreState } from "./combobox-store.js";
|
|
3
|
+
/**
|
|
4
|
+
* Renders the current
|
|
5
|
+
* [`value`](https://ariakit.org/reference/use-combobox-store#value) state in
|
|
6
|
+
* the [combobox store](https://ariakit.org/reference/use-combobox-store).
|
|
7
|
+
*
|
|
8
|
+
* As a value component, it doesn't render any DOM elements and therefore
|
|
9
|
+
* doesn't accept HTML props.
|
|
10
|
+
*
|
|
11
|
+
* It takes a
|
|
12
|
+
* [`children`](https://ariakit.org/reference/combobox-value#children) function
|
|
13
|
+
* that gets called with the current value as an argument. This can be used as
|
|
14
|
+
* an uncontrolled API to render the combobox value in a custom way.
|
|
15
|
+
* @see https://ariakit.org/components/combobox
|
|
16
|
+
* @example
|
|
17
|
+
* ```jsx {3-5}
|
|
18
|
+
* <ComboboxProvider>
|
|
19
|
+
* <Combobox />
|
|
20
|
+
* <ComboboxValue>
|
|
21
|
+
* {(value) => `Current value: ${value}`}
|
|
22
|
+
* </ComboboxValue>
|
|
23
|
+
* </ComboboxProvider>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function ComboboxValue({ store, children }?: ComboboxValueProps): ReactNode;
|
|
27
|
+
export interface ComboboxValueProps {
|
|
28
|
+
/**
|
|
29
|
+
* Object returned by the
|
|
30
|
+
* [`useComboboxStore`](https://ariakit.org/reference/use-combobox-store)
|
|
31
|
+
* hook. If not provided, the closest
|
|
32
|
+
* [`ComboboxProvider`](https://ariakit.org/reference/combobox-provider)
|
|
33
|
+
* component's context will be used.
|
|
34
|
+
*/
|
|
35
|
+
store?: ComboboxStore;
|
|
36
|
+
/**
|
|
37
|
+
* A function that gets called with the current value as an argument. It can
|
|
38
|
+
* be used to render the combobox value in a custom way.
|
|
39
|
+
*/
|
|
40
|
+
children?: (value: ComboboxStoreState["value"]) => ReactNode;
|
|
41
|
+
}
|