@ariakit/react-core 0.3.10 → 0.3.11
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 +50 -0
- package/cjs/__chunks/{TTMCZ7ZN.cjs → 3RUODFRU.cjs} +15 -0
- package/cjs/__chunks/{UBME4GBY.cjs → 63WKH5OP.cjs} +2 -2
- package/cjs/__chunks/{SANV4XBF.cjs → 7EEAHTIW.cjs} +2 -2
- package/cjs/__chunks/{3KZQJDTV.cjs → APFV5PTX.cjs} +2 -2
- package/cjs/__chunks/{DHSZ2ZFJ.cjs → BKU5STIE.cjs} +2 -2
- package/cjs/__chunks/{PHZJAGWK.cjs → IAYTETYN.cjs} +2 -2
- package/cjs/__chunks/{CZOBQEIO.cjs → RM2WCNSU.cjs} +16 -22
- package/cjs/__chunks/{GF6NWLKX.cjs → WWU35JDJ.cjs} +6 -2
- package/cjs/__chunks/{UUTXBBHD.cjs → XAYQLYTN.cjs} +2 -2
- package/cjs/checkbox/checkbox-check.d.cts +6 -3
- package/cjs/checkbox/checkbox-check.d.ts +6 -3
- package/cjs/combobox/combobox-disclosure.cjs +3 -4
- package/cjs/combobox/combobox-item.cjs +2 -2
- package/cjs/combobox/combobox-item.d.cts +13 -1
- package/cjs/combobox/combobox-item.d.ts +13 -1
- package/cjs/combobox/combobox-popover.cjs +34 -5
- package/cjs/combobox/combobox-popover.d.cts +1 -1
- package/cjs/combobox/combobox-popover.d.ts +1 -1
- package/cjs/combobox/combobox.cjs +18 -6
- package/cjs/combobox/combobox.d.cts +26 -1
- package/cjs/combobox/combobox.d.ts +26 -1
- package/cjs/composite/composite-hover.d.cts +10 -1
- package/cjs/composite/composite-hover.d.ts +10 -1
- package/cjs/composite/composite-item.cjs +2 -2
- package/cjs/composite/composite-overflow-disclosure.cjs +2 -2
- package/cjs/composite/composite.cjs +2 -2
- package/cjs/form/form-radio.cjs +3 -3
- package/cjs/menu/menu-bar.cjs +3 -3
- 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 +3 -3
- package/cjs/menu/menu-item-radio.cjs +5 -5
- package/cjs/menu/menu-item.cjs +3 -3
- package/cjs/menu/menu-item.d.cts +8 -1
- package/cjs/menu/menu-item.d.ts +8 -1
- package/cjs/menu/menu-list.cjs +3 -3
- package/cjs/menu/menu-store.d.cts +2 -0
- package/cjs/menu/menu-store.d.ts +2 -0
- package/cjs/menu/menu.cjs +3 -3
- package/cjs/menubar/menubar.cjs +3 -3
- package/cjs/popover/popover.d.cts +2 -0
- package/cjs/popover/popover.d.ts +2 -0
- package/cjs/radio/radio-group.cjs +2 -2
- package/cjs/radio/radio.cjs +3 -3
- package/cjs/select/select-item.cjs +2 -2
- package/cjs/select/select-list.cjs +3 -3
- package/cjs/select/select-popover.cjs +3 -3
- package/cjs/tab/tab-list.cjs +2 -2
- package/cjs/tab/tab-provider.cjs +2 -2
- package/cjs/tab/tab-store.cjs +2 -2
- package/cjs/tab/tab.cjs +2 -2
- package/cjs/toolbar/toolbar-container.cjs +3 -3
- package/cjs/toolbar/toolbar-input.cjs +3 -3
- package/cjs/toolbar/toolbar-item.cjs +3 -3
- package/cjs/toolbar/toolbar.cjs +2 -2
- package/esm/__chunks/{FHDXHZLB.js → 57KNUQTI.js} +16 -22
- package/esm/__chunks/{UV2O3GRQ.js → 7D63S66W.js} +1 -1
- package/esm/__chunks/{TZJDOU75.js → 7R5VX7DV.js} +1 -1
- package/esm/__chunks/{GJYUMUMT.js → 7SHHFY4P.js} +1 -1
- package/esm/__chunks/{QEPSYGAQ.js → CVFC2LN3.js} +1 -1
- package/esm/__chunks/{DHHIMTTV.js → DENCHBDS.js} +1 -1
- package/esm/__chunks/{K5VQ2XTM.js → LZUSNDXA.js} +6 -2
- package/esm/__chunks/{P6VCQ6Q3.js → R2WNOXYG.js} +15 -0
- package/esm/__chunks/{UJUY6GAA.js → W2TTCKOE.js} +1 -1
- package/esm/checkbox/checkbox-check.d.ts +6 -3
- package/esm/combobox/combobox-disclosure.js +3 -4
- package/esm/combobox/combobox-item.d.ts +13 -1
- package/esm/combobox/combobox-item.js +1 -1
- package/esm/combobox/combobox-popover.d.ts +1 -1
- package/esm/combobox/combobox-popover.js +35 -6
- package/esm/combobox/combobox.d.ts +26 -1
- package/esm/combobox/combobox.js +17 -5
- package/esm/composite/composite-hover.d.ts +10 -1
- package/esm/composite/composite-item.js +1 -1
- package/esm/composite/composite-overflow-disclosure.js +1 -1
- package/esm/composite/composite.js +1 -1
- package/esm/form/form-radio.js +2 -2
- package/esm/menu/menu-bar.js +2 -2
- package/esm/menu/menu-item-check.d.ts +14 -0
- package/esm/menu/menu-item-checkbox.js +2 -2
- package/esm/menu/menu-item-radio.js +3 -3
- package/esm/menu/menu-item.d.ts +8 -1
- package/esm/menu/menu-item.js +2 -2
- package/esm/menu/menu-list.js +2 -2
- package/esm/menu/menu-store.d.ts +2 -0
- package/esm/menu/menu.js +2 -2
- package/esm/menubar/menubar.js +2 -2
- package/esm/popover/popover.d.ts +2 -0
- package/esm/radio/radio-group.js +1 -1
- package/esm/radio/radio.js +2 -2
- package/esm/select/select-item.js +1 -1
- package/esm/select/select-list.js +2 -2
- package/esm/select/select-popover.js +2 -2
- package/esm/tab/tab-list.js +1 -1
- package/esm/tab/tab-provider.js +1 -1
- package/esm/tab/tab-store.js +1 -1
- package/esm/tab/tab.js +1 -1
- package/esm/toolbar/toolbar-container.js +2 -2
- package/esm/toolbar/toolbar-input.js +2 -2
- package/esm/toolbar/toolbar-item.js +2 -2
- package/esm/toolbar/toolbar.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# @ariakit/react-core
|
|
2
2
|
|
|
3
|
+
## 0.3.11
|
|
4
|
+
|
|
5
|
+
### Modal Combobox
|
|
6
|
+
|
|
7
|
+
The [Combobox](https://ariakit.org/component/combobox) components now support the [`modal`](https://ariakit.org/reference/combobox-popover#modal) prop on [`ComboboxPopover`](https://ariakit.org/reference/combobox-popover).
|
|
8
|
+
|
|
9
|
+
When a modal combobox is expanded, users can interact with and tab through all the combobox controls, including [`Combobox`](https://ariakit.org/reference/combobox), [`ComboboxDisclosure`](https://ariakit.org/reference/combobox-disclosure), and [`ComboboxCancel`](https://ariakit.org/reference/combobox-cancel), even if they're rendered outside the popover. The rest of the page will be inert.
|
|
10
|
+
|
|
11
|
+
### Controlling the auto-select functionality of Combobox
|
|
12
|
+
|
|
13
|
+
The [`Combobox`](https://ariakit.org/reference/combobox) component now includes a new [`getAutoSelectId`](https://ariakit.org/reference/combobox#getautoselectid) prop. This allows you to specify the [`ComboboxItem`](https://ariakit.org/reference/combobox-item) that should be auto-selected if the [`autoSelect`](https://ariakit.org/reference/combobox#autoselect) prop is `true`.
|
|
14
|
+
|
|
15
|
+
By default, the first _enabled_ item is auto-selected. Now you can customize this behavior by returning the id of another item from [`getAutoSelectId`](https://ariakit.org/reference/combobox#getautoselectid):
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
<Combobox
|
|
19
|
+
autoSelect
|
|
20
|
+
getAutoSelectId={(items) => {
|
|
21
|
+
// Auto select the first enabled item with a value
|
|
22
|
+
const item = items.find((item) => {
|
|
23
|
+
if (item.disabled) return false;
|
|
24
|
+
if (!item.value) return false;
|
|
25
|
+
return true;
|
|
26
|
+
});
|
|
27
|
+
return item?.id;
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Styling Combobox without an active descendant
|
|
33
|
+
|
|
34
|
+
The [`Combobox`](https://ariakit.org/reference/combobox) component now includes a [`data-active-item`](https://ariakit.org/guide/styling#data-active-item) attribute when it's the only active item in the composite widget. In other words, when no [`ComboboxItem`](https://ariakit.org/reference/combobox-item) is active and the focus is solely on the combobox input.
|
|
35
|
+
|
|
36
|
+
You can use this as a CSS selector to style the combobox differently, providing additional affordance to users who pressed <kbd>↑</kbd> on the first item or <kbd>↓</kbd> on the last item. This action would place both virtual and actual DOM focus on the combobox input.
|
|
37
|
+
|
|
38
|
+
```css
|
|
39
|
+
.combobox[data-active-item] {
|
|
40
|
+
outline-width: 2px;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Other updates
|
|
45
|
+
|
|
46
|
+
- Fixed [`useTabStore`](https://ariakit.org/reference/use-tab-store) return value not updating its own reference.
|
|
47
|
+
- Fixed keyboard navigation on [Combobox](https://ariakit.org/components/combobox) when the content element is a grid.
|
|
48
|
+
- Fixed [`ComboboxDisclosure`](https://ariakit.org/reference/combobox-disclosure) to update its `aria-expanded` attribute when the combobox expands.
|
|
49
|
+
- Fixed `Maximum update depth exceeded` warning when rendering multiple collection items on the page.
|
|
50
|
+
- Improved JSDocs.
|
|
51
|
+
- Updated dependencies: `@ariakit/core@0.3.9`
|
|
52
|
+
|
|
3
53
|
## 0.3.10
|
|
4
54
|
|
|
5
55
|
### Overwriting `aria-selected` value on `ComboboxItem`
|
|
@@ -259,18 +259,33 @@ var useCompositeItem = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
259
259
|
const isGrid = !!(item == null ? void 0 : item.rowId);
|
|
260
260
|
const isVertical = state.orientation !== "horizontal";
|
|
261
261
|
const isHorizontal = state.orientation !== "vertical";
|
|
262
|
+
const canHomeEnd = () => {
|
|
263
|
+
if (isGrid)
|
|
264
|
+
return true;
|
|
265
|
+
if (isHorizontal)
|
|
266
|
+
return true;
|
|
267
|
+
if (!state.baseElement)
|
|
268
|
+
return true;
|
|
269
|
+
if (!_dom.isTextField.call(void 0, state.baseElement))
|
|
270
|
+
return true;
|
|
271
|
+
return false;
|
|
272
|
+
};
|
|
262
273
|
const keyMap = {
|
|
263
274
|
ArrowUp: (isGrid || isVertical) && store.up,
|
|
264
275
|
ArrowRight: (isGrid || isHorizontal) && store.next,
|
|
265
276
|
ArrowDown: (isGrid || isVertical) && store.down,
|
|
266
277
|
ArrowLeft: (isGrid || isHorizontal) && store.previous,
|
|
267
278
|
Home: () => {
|
|
279
|
+
if (!canHomeEnd())
|
|
280
|
+
return;
|
|
268
281
|
if (!isGrid || event.ctrlKey) {
|
|
269
282
|
return store == null ? void 0 : store.first();
|
|
270
283
|
}
|
|
271
284
|
return store == null ? void 0 : store.previous(-1);
|
|
272
285
|
},
|
|
273
286
|
End: () => {
|
|
287
|
+
if (!canHomeEnd())
|
|
288
|
+
return;
|
|
274
289
|
if (!isGrid || event.ctrlKey) {
|
|
275
290
|
return store == null ? void 0 : store.last();
|
|
276
291
|
}
|
|
@@ -8,7 +8,7 @@ var _NGEKJJDHcjs = require('./NGEKJJDH.cjs');
|
|
|
8
8
|
var _FQZOOWMHcjs = require('./FQZOOWMH.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _RM2WCNSUcjs = require('./RM2WCNSU.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _TD5MOASJcjs = require('./TD5MOASJ.cjs');
|
|
@@ -159,7 +159,7 @@ var useMenuList = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
159
159
|
"aria-orientation": orientation
|
|
160
160
|
}, props);
|
|
161
161
|
}
|
|
162
|
-
props =
|
|
162
|
+
props = _RM2WCNSUcjs.useComposite.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, composite }, props));
|
|
163
163
|
props = _FQZOOWMHcjs.useCompositeTypeahead.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, typeahead: !hasCombobox }, props));
|
|
164
164
|
return props;
|
|
165
165
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _3RUODFRUcjs = require('./3RUODFRU.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _LYIGAIJFcjs = require('./LYIGAIJF.cjs');
|
|
@@ -21,7 +21,7 @@ var useToolbarItem = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
21
21
|
var _b = _a, { store } = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, ["store"]);
|
|
22
22
|
const context = _LYIGAIJFcjs.useToolbarContext.call(void 0, );
|
|
23
23
|
store = store || context;
|
|
24
|
-
props =
|
|
24
|
+
props = _3RUODFRUcjs.useCompositeItem.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store }, props));
|
|
25
25
|
return props;
|
|
26
26
|
}
|
|
27
27
|
);
|
|
@@ -8,7 +8,7 @@ var _7LBZXSLYcjs = require('./7LBZXSLY.cjs');
|
|
|
8
8
|
var _7KFYPSJOcjs = require('./7KFYPSJO.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _RM2WCNSUcjs = require('./RM2WCNSU.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -64,7 +64,7 @@ var useMenubar = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
64
64
|
"aria-orientation": orientation
|
|
65
65
|
}, props);
|
|
66
66
|
}
|
|
67
|
-
props =
|
|
67
|
+
props = _RM2WCNSUcjs.useComposite.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, composite }, props));
|
|
68
68
|
return props;
|
|
69
69
|
}
|
|
70
70
|
);
|
|
@@ -10,7 +10,7 @@ var _7LBZXSLYcjs = require('./7LBZXSLY.cjs');
|
|
|
10
10
|
var _IPYAEPOTcjs = require('./IPYAEPOT.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _3RUODFRUcjs = require('./3RUODFRU.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -110,7 +110,7 @@ var useMenuItem = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
110
110
|
}, props), {
|
|
111
111
|
onClick
|
|
112
112
|
});
|
|
113
|
-
props =
|
|
113
|
+
props = _3RUODFRUcjs.useCompositeItem.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, preventScrollOnKeyDown }, props));
|
|
114
114
|
props = _IPYAEPOTcjs.useCompositeHover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
115
115
|
store
|
|
116
116
|
}, props), {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var _HEEQY4DZcjs = require('./HEEQY4DZ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _3RUODFRUcjs = require('./3RUODFRU.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -133,7 +133,7 @@ var useRadio = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
133
133
|
onClick,
|
|
134
134
|
onFocus
|
|
135
135
|
});
|
|
136
|
-
props =
|
|
136
|
+
props = _3RUODFRUcjs.useCompositeItem.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, clickOnEnter: !nativeRadio }, props));
|
|
137
137
|
return _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
138
138
|
name: nativeRadio ? name : void 0,
|
|
139
139
|
value: nativeRadio ? value : void 0,
|
|
@@ -48,43 +48,32 @@ function isGrid(items) {
|
|
|
48
48
|
return items.some((item) => !!item.rowId);
|
|
49
49
|
}
|
|
50
50
|
function isPrintableKey(event) {
|
|
51
|
+
const target = event.target;
|
|
52
|
+
if (target && !_dom.isTextField.call(void 0, target))
|
|
53
|
+
return false;
|
|
51
54
|
return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
|
|
52
55
|
}
|
|
53
56
|
function isModifierKey(event) {
|
|
54
57
|
return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
|
|
55
58
|
}
|
|
56
|
-
function canProxyKeyboardEvent(event, state) {
|
|
57
|
-
if (!_events.isSelfTarget.call(void 0, event))
|
|
58
|
-
return false;
|
|
59
|
-
if (isModifierKey(event))
|
|
60
|
-
return false;
|
|
61
|
-
const target = event.target;
|
|
62
|
-
if (!target)
|
|
63
|
-
return true;
|
|
64
|
-
if (_dom.isTextField.call(void 0, target)) {
|
|
65
|
-
if (isPrintableKey(event))
|
|
66
|
-
return false;
|
|
67
|
-
const grid = isGrid(state.renderedItems);
|
|
68
|
-
const focusingInputOnly = state.activeId === null;
|
|
69
|
-
const allowHorizontalNavigationOnItems = grid && !focusingInputOnly;
|
|
70
|
-
const isHomeOrEnd = event.key === "Home" || event.key === "End";
|
|
71
|
-
if (!allowHorizontalNavigationOnItems && isHomeOrEnd)
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
return !event.isPropagationStopped();
|
|
75
|
-
}
|
|
76
59
|
function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
|
|
77
60
|
return _EO6LS72Hcjs.useEvent.call(void 0, (event) => {
|
|
78
61
|
var _a;
|
|
79
62
|
onKeyboardEvent == null ? void 0 : onKeyboardEvent(event);
|
|
80
63
|
if (event.defaultPrevented)
|
|
81
64
|
return;
|
|
65
|
+
if (event.isPropagationStopped())
|
|
66
|
+
return;
|
|
67
|
+
if (!_events.isSelfTarget.call(void 0, event))
|
|
68
|
+
return;
|
|
69
|
+
if (isModifierKey(event))
|
|
70
|
+
return;
|
|
71
|
+
if (isPrintableKey(event))
|
|
72
|
+
return;
|
|
82
73
|
const state = store.getState();
|
|
83
74
|
const activeElement = (_a = _RV3PHHWMcjs.getEnabledItem.call(void 0, store, state.activeId)) == null ? void 0 : _a.element;
|
|
84
75
|
if (!activeElement)
|
|
85
76
|
return;
|
|
86
|
-
if (!canProxyKeyboardEvent(event, state))
|
|
87
|
-
return;
|
|
88
77
|
const _b = event, { view } = _b, eventInit = _AV6KTKLEcjs.__objRest.call(void 0, _b, ["view"]);
|
|
89
78
|
const previousElement = previousElementRef == null ? void 0 : previousElementRef.current;
|
|
90
79
|
if (activeElement !== previousElement) {
|
|
@@ -269,6 +258,8 @@ var useComposite = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
269
258
|
}
|
|
270
259
|
} else if (activeElement) {
|
|
271
260
|
_events.fireBlurEvent.call(void 0, activeElement, event);
|
|
261
|
+
} else if (previousElement) {
|
|
262
|
+
_events.fireBlurEvent.call(void 0, previousElement, event);
|
|
272
263
|
}
|
|
273
264
|
event.stopPropagation();
|
|
274
265
|
} else {
|
|
@@ -296,6 +287,9 @@ var useComposite = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
296
287
|
const isVertical = orientation !== "horizontal";
|
|
297
288
|
const isHorizontal = orientation !== "vertical";
|
|
298
289
|
const grid = isGrid(renderedItems);
|
|
290
|
+
const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End";
|
|
291
|
+
if (isHorizontalKey && _dom.isTextField.call(void 0, event.currentTarget))
|
|
292
|
+
return;
|
|
299
293
|
const up = () => {
|
|
300
294
|
if (grid) {
|
|
301
295
|
const item = items && findFirstEnabledItemInTheLastRow(items);
|
|
@@ -8,6 +8,9 @@ var _N6CR2VNNcjs = require('./N6CR2VNN.cjs');
|
|
|
8
8
|
var _B233QVZEcjs = require('./B233QVZE.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
var _EO6LS72Hcjs = require('./EO6LS72H.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
11
14
|
|
|
12
15
|
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
13
16
|
|
|
@@ -18,8 +21,9 @@ function useTabStoreProps(store, update, props) {
|
|
|
18
21
|
store = _N6CR2VNNcjs.useCompositeStoreProps.call(void 0, store, update, props);
|
|
19
22
|
_B233QVZEcjs.useStoreProps.call(void 0, store, props, "selectedId", "setSelectedId");
|
|
20
23
|
_B233QVZEcjs.useStoreProps.call(void 0, store, props, "selectOnMove");
|
|
21
|
-
const [panels] = _B233QVZEcjs.useStore.call(void 0, () => store.panels, {});
|
|
22
|
-
|
|
24
|
+
const [panels, updatePanels] = _B233QVZEcjs.useStore.call(void 0, () => store.panels, {});
|
|
25
|
+
_EO6LS72Hcjs.useUpdateEffect.call(void 0, updatePanels, [store, updatePanels]);
|
|
26
|
+
return _react.useMemo.call(void 0, () => _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, store), { panels }), [store, panels]);
|
|
23
27
|
}
|
|
24
28
|
function useTabStore(props = {}) {
|
|
25
29
|
const [store, update] = _B233QVZEcjs.useStore.call(void 0, Core.createTabStore, props);
|
|
@@ -8,7 +8,7 @@ var _FQZOOWMHcjs = require('./FQZOOWMH.cjs');
|
|
|
8
8
|
var _2WCJJQSKcjs = require('./2WCJJQSK.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _RM2WCNSUcjs = require('./RM2WCNSU.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _TD5MOASJcjs = require('./TD5MOASJ.cjs');
|
|
@@ -117,7 +117,7 @@ var useSelectList = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
117
117
|
style,
|
|
118
118
|
onKeyDown
|
|
119
119
|
});
|
|
120
|
-
props =
|
|
120
|
+
props = _RM2WCNSUcjs.useComposite.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store }, props), { composite }));
|
|
121
121
|
props = _FQZOOWMHcjs.useCompositeTypeahead.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, typeahead: !hasCombobox }, props));
|
|
122
122
|
return props;
|
|
123
123
|
}
|
|
@@ -28,9 +28,12 @@ export interface CheckboxCheckOptions<T extends As = "span"> extends Options<T>
|
|
|
28
28
|
*/
|
|
29
29
|
store?: CheckboxStore;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* Determines if the check mark should be displayed. This value is
|
|
32
|
+
* automatically derived from the
|
|
33
|
+
* [`store`](https://ariakit.org/reference/checkbox-check#store) prop or the
|
|
34
|
+
* parent [`Checkbox`](https://ariakit.org/reference/checkbox) component.
|
|
35
|
+
*
|
|
36
|
+
* Manually setting this prop will supersede the derived value.
|
|
34
37
|
*/
|
|
35
38
|
checked?: boolean;
|
|
36
39
|
}
|
|
@@ -28,9 +28,12 @@ export interface CheckboxCheckOptions<T extends As = "span"> extends Options<T>
|
|
|
28
28
|
*/
|
|
29
29
|
store?: CheckboxStore;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* Determines if the check mark should be displayed. This value is
|
|
32
|
+
* automatically derived from the
|
|
33
|
+
* [`store`](https://ariakit.org/reference/checkbox-check#store) prop or the
|
|
34
|
+
* parent [`Checkbox`](https://ariakit.org/reference/checkbox) component.
|
|
35
|
+
*
|
|
36
|
+
* Manually setting this prop will supersede the derived value.
|
|
34
37
|
*/
|
|
35
38
|
checked?: boolean;
|
|
36
39
|
}
|
|
@@ -75,13 +75,12 @@ var useComboboxDisclosure = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
75
75
|
const { baseElement } = store.getState();
|
|
76
76
|
store.setDisclosureElement(baseElement);
|
|
77
77
|
});
|
|
78
|
-
const
|
|
79
|
-
(state) => state.open ? "Hide popup" : "Show popup"
|
|
80
|
-
);
|
|
78
|
+
const open = store.useState("open");
|
|
81
79
|
props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
82
80
|
children,
|
|
83
81
|
tabIndex: -1,
|
|
84
|
-
"aria-label":
|
|
82
|
+
"aria-label": open ? "Hide popup" : "Show popup",
|
|
83
|
+
"aria-expanded": open
|
|
85
84
|
}, props), {
|
|
86
85
|
onMouseDown,
|
|
87
86
|
onClick
|
|
@@ -9,7 +9,7 @@ var _IPYAEPOTcjs = require('../__chunks/IPYAEPOT.cjs');
|
|
|
9
9
|
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _3RUODFRUcjs = require('../__chunks/3RUODFRU.cjs');
|
|
13
13
|
require('../__chunks/DAJUUBUI.cjs');
|
|
14
14
|
require('../__chunks/R5A2WTWB.cjs');
|
|
15
15
|
require('../__chunks/RV3PHHWM.cjs');
|
|
@@ -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 = _3RUODFRUcjs.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
|
/**
|
|
@@ -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"
|
|
@@ -94,20 +96,47 @@ var useComboboxPopover = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
94
96
|
props = _LO3RECODcjs.useComboboxList.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, alwaysVisible }, props));
|
|
95
97
|
props = _NVHGMKAEcjs.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;
|
|
@@ -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>>;
|
|
@@ -7,7 +7,7 @@ var _3QW6ELTGcjs = require('../__chunks/3QW6ELTG.cjs');
|
|
|
7
7
|
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _RM2WCNSUcjs = require('../__chunks/RM2WCNSU.cjs');
|
|
11
11
|
require('../__chunks/RV3PHHWM.cjs');
|
|
12
12
|
require('../__chunks/UZNYSPKP.cjs');
|
|
13
13
|
require('../__chunks/BZTDJIVT.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,7 +239,7 @@ 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;
|
|
237
243
|
if (!store)
|
|
238
244
|
return;
|
|
239
245
|
if (!autoSelect && !resetValueOnSelect)
|
|
@@ -249,9 +255,12 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
249
255
|
return () => observer.disconnect();
|
|
250
256
|
}
|
|
251
257
|
if (autoSelect) {
|
|
252
|
-
|
|
258
|
+
const userAutoSelectId = getAutoSelectIdProp(items);
|
|
259
|
+
const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : store.first();
|
|
260
|
+
autoSelectIdRef.current = autoSelectId;
|
|
261
|
+
store.move(autoSelectId != null ? autoSelectId : null);
|
|
253
262
|
} else {
|
|
254
|
-
const element = (
|
|
263
|
+
const element = (_a2 = store.item(activeId)) == null ? void 0 : _a2.element;
|
|
255
264
|
if (element && "scrollIntoView" in element) {
|
|
256
265
|
element.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
257
266
|
}
|
|
@@ -263,6 +272,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
263
272
|
storeValue,
|
|
264
273
|
autoSelect,
|
|
265
274
|
resetValueOnSelect,
|
|
275
|
+
getAutoSelectIdProp,
|
|
266
276
|
items
|
|
267
277
|
]);
|
|
268
278
|
_react.useEffect.call(void 0, () => {
|
|
@@ -395,6 +405,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
395
405
|
});
|
|
396
406
|
const id = _EO6LS72Hcjs.useId.call(void 0, props.id);
|
|
397
407
|
const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0;
|
|
408
|
+
const isActiveItem = store.useState((state) => state.activeId === null);
|
|
398
409
|
props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
399
410
|
id,
|
|
400
411
|
role: "combobox",
|
|
@@ -402,6 +413,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
402
413
|
"aria-haspopup": _dom.getPopupRole.call(void 0, contentElement, "listbox"),
|
|
403
414
|
"aria-expanded": open,
|
|
404
415
|
"aria-controls": contentElement == null ? void 0 : contentElement.id,
|
|
416
|
+
"data-active-item": isActiveItem || void 0,
|
|
405
417
|
value
|
|
406
418
|
}, props), {
|
|
407
419
|
ref: _EO6LS72Hcjs.useMergeRefs.call(void 0, ref, props.ref),
|
|
@@ -411,7 +423,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
411
423
|
onKeyDown,
|
|
412
424
|
onBlur
|
|
413
425
|
});
|
|
414
|
-
props =
|
|
426
|
+
props = _RM2WCNSUcjs.useComposite.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
415
427
|
store,
|
|
416
428
|
focusable
|
|
417
429
|
}, props), {
|