@ariakit/core 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/cjs/collection/collection-store.d.cts +3 -0
- package/cjs/collection/collection-store.d.ts +3 -0
- package/cjs/combobox/combobox-store.d.cts +13 -8
- package/cjs/combobox/combobox-store.d.ts +13 -8
- package/cjs/composite/composite-store.d.cts +4 -16
- package/cjs/composite/composite-store.d.ts +4 -16
- package/cjs/hovercard/hovercard-store.d.cts +2 -4
- package/cjs/hovercard/hovercard-store.d.ts +2 -4
- package/cjs/menu/menu-store.d.cts +7 -7
- package/cjs/menu/menu-store.d.ts +7 -7
- package/cjs/radio/radio-store.d.cts +2 -4
- package/cjs/radio/radio-store.d.ts +2 -4
- package/cjs/select/select-store.d.cts +5 -3
- package/cjs/select/select-store.d.ts +5 -3
- package/cjs/tab/tab-store.cjs +24 -4
- package/cjs/tab/tab-store.d.cts +15 -5
- package/cjs/tab/tab-store.d.ts +15 -5
- package/cjs/toolbar/toolbar-store.d.cts +1 -1
- package/cjs/toolbar/toolbar-store.d.ts +1 -1
- package/cjs/tooltip/tooltip-store.d.cts +1 -1
- package/cjs/tooltip/tooltip-store.d.ts +1 -1
- package/cjs/utils/dom.d.cts +6 -5
- package/cjs/utils/dom.d.ts +6 -5
- package/cjs/utils/focus.cjs +1 -1
- package/esm/collection/collection-store.d.ts +3 -0
- package/esm/combobox/combobox-store.d.ts +13 -8
- package/esm/composite/composite-store.d.ts +4 -16
- package/esm/hovercard/hovercard-store.d.ts +2 -4
- package/esm/menu/menu-store.d.ts +7 -7
- package/esm/radio/radio-store.d.ts +2 -4
- package/esm/select/select-store.d.ts +5 -3
- package/esm/tab/tab-store.d.ts +15 -5
- package/esm/tab/tab-store.js +24 -4
- package/esm/toolbar/toolbar-store.d.ts +1 -1
- package/esm/tooltip/tooltip-store.d.ts +1 -1
- package/esm/utils/dom.d.ts +6 -5
- package/esm/utils/focus.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
- Fixed [`Focusable`](https://ariakit.org/reference/focusable) to identify `summary` as a native tabbable element.
|
|
6
|
+
- Added new [`composite`](https://ariakit.org/reference/tab-provider#composite) property to tab store.
|
|
7
|
+
- Improved JSDocs.
|
|
8
|
+
|
|
9
|
+
## 0.4.1
|
|
10
|
+
|
|
11
|
+
- Added [`disclosure`](https://ariakit.org/reference/use-disclosure-store#disclosure-1) property to disclosure stores.
|
|
12
|
+
- Improved JSDocs.
|
|
13
|
+
|
|
3
14
|
## 0.4.0
|
|
4
15
|
|
|
5
16
|
### Improved animation support
|
|
@@ -52,6 +52,9 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
52
52
|
renderItem: BivariantCallback<(item: T) => () => void>;
|
|
53
53
|
/**
|
|
54
54
|
* Gets an item by its id.
|
|
55
|
+
*
|
|
56
|
+
* Live examples:
|
|
57
|
+
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
55
58
|
* @example
|
|
56
59
|
* const item = store.item("item-1");
|
|
57
60
|
*/
|
|
@@ -52,6 +52,9 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
52
52
|
renderItem: BivariantCallback<(item: T) => () => void>;
|
|
53
53
|
/**
|
|
54
54
|
* Gets an item by its id.
|
|
55
|
+
*
|
|
56
|
+
* Live examples:
|
|
57
|
+
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
55
58
|
* @example
|
|
56
59
|
* const item = store.item("item-1");
|
|
57
60
|
*/
|
|
@@ -13,10 +13,16 @@ export interface ComboboxStoreItem extends CompositeStoreItem {
|
|
|
13
13
|
value?: string;
|
|
14
14
|
}
|
|
15
15
|
export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreState<ComboboxStoreItem>, PopoverStoreState {
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/** @default true */
|
|
17
|
+
includesBaseElement: CompositeStoreState<ComboboxStoreItem>["includesBaseElement"];
|
|
18
|
+
/** @default true */
|
|
19
|
+
focusLoop: CompositeStoreState<ComboboxStoreItem>["focusLoop"];
|
|
20
|
+
/** @default true */
|
|
21
|
+
focusWrap: CompositeStoreState<ComboboxStoreItem>["focusWrap"];
|
|
22
|
+
/** @default "vertical" */
|
|
23
|
+
orientation: CompositeStoreState<ComboboxStoreItem>["orientation"];
|
|
24
|
+
/** @default true */
|
|
25
|
+
virtualFocus: CompositeStoreState<ComboboxStoreItem>["virtualFocus"];
|
|
20
26
|
/**
|
|
21
27
|
* The combobox input value.
|
|
22
28
|
*
|
|
@@ -63,6 +69,7 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
63
69
|
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
|
|
64
70
|
* - [Submenu with
|
|
65
71
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
72
|
+
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
66
73
|
*/
|
|
67
74
|
resetValueOnHide: boolean;
|
|
68
75
|
/**
|
|
@@ -100,10 +107,8 @@ export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = C
|
|
|
100
107
|
*/
|
|
101
108
|
setSelectedValue: SetState<ComboboxStoreState<T>["selectedValue"]>;
|
|
102
109
|
}
|
|
103
|
-
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends
|
|
104
|
-
/**
|
|
105
|
-
* @default null
|
|
106
|
-
*/
|
|
110
|
+
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends StoreOptions<ComboboxStoreState<T>, "includesBaseElement" | "focusLoop" | "focusWrap" | "orientation" | "virtualFocus" | "value" | "selectedValue" | "resetValueOnHide" | "resetValueOnSelect">, CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions {
|
|
111
|
+
/** @default null */
|
|
107
112
|
defaultActiveId?: CompositeStoreOptions<ComboboxStoreItem>["activeId"];
|
|
108
113
|
/**
|
|
109
114
|
* The initial value of the combobox input.
|
|
@@ -13,10 +13,16 @@ export interface ComboboxStoreItem extends CompositeStoreItem {
|
|
|
13
13
|
value?: string;
|
|
14
14
|
}
|
|
15
15
|
export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreState<ComboboxStoreItem>, PopoverStoreState {
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/** @default true */
|
|
17
|
+
includesBaseElement: CompositeStoreState<ComboboxStoreItem>["includesBaseElement"];
|
|
18
|
+
/** @default true */
|
|
19
|
+
focusLoop: CompositeStoreState<ComboboxStoreItem>["focusLoop"];
|
|
20
|
+
/** @default true */
|
|
21
|
+
focusWrap: CompositeStoreState<ComboboxStoreItem>["focusWrap"];
|
|
22
|
+
/** @default "vertical" */
|
|
23
|
+
orientation: CompositeStoreState<ComboboxStoreItem>["orientation"];
|
|
24
|
+
/** @default true */
|
|
25
|
+
virtualFocus: CompositeStoreState<ComboboxStoreItem>["virtualFocus"];
|
|
20
26
|
/**
|
|
21
27
|
* The combobox input value.
|
|
22
28
|
*
|
|
@@ -63,6 +69,7 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
63
69
|
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
|
|
64
70
|
* - [Submenu with
|
|
65
71
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
72
|
+
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
66
73
|
*/
|
|
67
74
|
resetValueOnHide: boolean;
|
|
68
75
|
/**
|
|
@@ -100,10 +107,8 @@ export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = C
|
|
|
100
107
|
*/
|
|
101
108
|
setSelectedValue: SetState<ComboboxStoreState<T>["selectedValue"]>;
|
|
102
109
|
}
|
|
103
|
-
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends
|
|
104
|
-
/**
|
|
105
|
-
* @default null
|
|
106
|
-
*/
|
|
110
|
+
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends StoreOptions<ComboboxStoreState<T>, "includesBaseElement" | "focusLoop" | "focusWrap" | "orientation" | "virtualFocus" | "value" | "selectedValue" | "resetValueOnHide" | "resetValueOnSelect">, CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions {
|
|
111
|
+
/** @default null */
|
|
107
112
|
defaultActiveId?: CompositeStoreOptions<ComboboxStoreItem>["activeId"];
|
|
108
113
|
/**
|
|
109
114
|
* The initial value of the combobox input.
|
|
@@ -112,6 +112,9 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
112
112
|
* matches the value of `focusLoop`, it'll wrap between the last item in the
|
|
113
113
|
* last row or column and the first item in the first row or column and
|
|
114
114
|
* vice-versa.
|
|
115
|
+
*
|
|
116
|
+
* Live examples:
|
|
117
|
+
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
115
118
|
* @default false
|
|
116
119
|
*/
|
|
117
120
|
focusLoop: boolean | Orientation;
|
|
@@ -156,7 +159,7 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
156
159
|
* Live examples:
|
|
157
160
|
* - [Submenu with
|
|
158
161
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
159
|
-
* - [
|
|
162
|
+
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
160
163
|
* @default false
|
|
161
164
|
*/
|
|
162
165
|
includesBaseElement: boolean;
|
|
@@ -190,9 +193,6 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
190
193
|
* state _without moving focus_. If you want to move focus, use the
|
|
191
194
|
* [`move`](https://ariakit.org/reference/use-composite-store#move) function
|
|
192
195
|
* instead.
|
|
193
|
-
*
|
|
194
|
-
* Live examples:
|
|
195
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
196
196
|
* @example
|
|
197
197
|
* // Sets the composite element as the active item
|
|
198
198
|
* store.setActiveId(null);
|
|
@@ -226,9 +226,6 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
226
226
|
* Returns the id of the next enabled item based on the current
|
|
227
227
|
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
|
|
228
228
|
* state.
|
|
229
|
-
*
|
|
230
|
-
* Live examples:
|
|
231
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
232
229
|
* @example
|
|
233
230
|
* const nextId = store.next();
|
|
234
231
|
* const nextNextId = store.next(2);
|
|
@@ -238,9 +235,6 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
238
235
|
* Returns the id of the previous enabled item based on the current
|
|
239
236
|
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
|
|
240
237
|
* state.
|
|
241
|
-
*
|
|
242
|
-
* Live examples:
|
|
243
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
244
238
|
* @example
|
|
245
239
|
* const previousId = store.previous();
|
|
246
240
|
* const previousPreviousId = store.previous(2);
|
|
@@ -266,16 +260,10 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
266
260
|
down: (skip?: number) => string | null | undefined;
|
|
267
261
|
/**
|
|
268
262
|
* Returns the id of the first enabled item.
|
|
269
|
-
*
|
|
270
|
-
* Live examples:
|
|
271
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
272
263
|
*/
|
|
273
264
|
first: () => string | null | undefined;
|
|
274
265
|
/**
|
|
275
266
|
* Returns the id of the last enabled item.
|
|
276
|
-
*
|
|
277
|
-
* Live examples:
|
|
278
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
279
267
|
*/
|
|
280
268
|
last: () => string | null | undefined;
|
|
281
269
|
}
|
|
@@ -112,6 +112,9 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
112
112
|
* matches the value of `focusLoop`, it'll wrap between the last item in the
|
|
113
113
|
* last row or column and the first item in the first row or column and
|
|
114
114
|
* vice-versa.
|
|
115
|
+
*
|
|
116
|
+
* Live examples:
|
|
117
|
+
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
115
118
|
* @default false
|
|
116
119
|
*/
|
|
117
120
|
focusLoop: boolean | Orientation;
|
|
@@ -156,7 +159,7 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
156
159
|
* Live examples:
|
|
157
160
|
* - [Submenu with
|
|
158
161
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
159
|
-
* - [
|
|
162
|
+
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
160
163
|
* @default false
|
|
161
164
|
*/
|
|
162
165
|
includesBaseElement: boolean;
|
|
@@ -190,9 +193,6 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
190
193
|
* state _without moving focus_. If you want to move focus, use the
|
|
191
194
|
* [`move`](https://ariakit.org/reference/use-composite-store#move) function
|
|
192
195
|
* instead.
|
|
193
|
-
*
|
|
194
|
-
* Live examples:
|
|
195
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
196
196
|
* @example
|
|
197
197
|
* // Sets the composite element as the active item
|
|
198
198
|
* store.setActiveId(null);
|
|
@@ -226,9 +226,6 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
226
226
|
* Returns the id of the next enabled item based on the current
|
|
227
227
|
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
|
|
228
228
|
* state.
|
|
229
|
-
*
|
|
230
|
-
* Live examples:
|
|
231
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
232
229
|
* @example
|
|
233
230
|
* const nextId = store.next();
|
|
234
231
|
* const nextNextId = store.next(2);
|
|
@@ -238,9 +235,6 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
238
235
|
* Returns the id of the previous enabled item based on the current
|
|
239
236
|
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
|
|
240
237
|
* state.
|
|
241
|
-
*
|
|
242
|
-
* Live examples:
|
|
243
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
244
238
|
* @example
|
|
245
239
|
* const previousId = store.previous();
|
|
246
240
|
* const previousPreviousId = store.previous(2);
|
|
@@ -266,16 +260,10 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
266
260
|
down: (skip?: number) => string | null | undefined;
|
|
267
261
|
/**
|
|
268
262
|
* Returns the id of the first enabled item.
|
|
269
|
-
*
|
|
270
|
-
* Live examples:
|
|
271
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
272
263
|
*/
|
|
273
264
|
first: () => string | null | undefined;
|
|
274
265
|
/**
|
|
275
266
|
* Returns the id of the last enabled item.
|
|
276
|
-
*
|
|
277
|
-
* Live examples:
|
|
278
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
279
267
|
*/
|
|
280
268
|
last: () => string | null | undefined;
|
|
281
269
|
}
|
|
@@ -6,9 +6,7 @@ import type { SetState } from "../utils/types.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function createHovercardStore(props?: HovercardStoreProps): HovercardStore;
|
|
8
8
|
export interface HovercardStoreState extends PopoverStoreState {
|
|
9
|
-
/**
|
|
10
|
-
* @default "bottom"
|
|
11
|
-
*/
|
|
9
|
+
/** @default "bottom" */
|
|
12
10
|
placement: PopoverStoreState["placement"];
|
|
13
11
|
/**
|
|
14
12
|
* The amount of time in milliseconds to wait before showing and hiding the
|
|
@@ -57,7 +55,7 @@ export interface HovercardStoreFunctions extends PopoverStoreFunctions {
|
|
|
57
55
|
*/
|
|
58
56
|
setAutoFocusOnShow: SetState<HovercardStoreState["autoFocusOnShow"]>;
|
|
59
57
|
}
|
|
60
|
-
export interface HovercardStoreOptions extends
|
|
58
|
+
export interface HovercardStoreOptions extends StoreOptions<HovercardStoreState, "placement" | "timeout" | "showTimeout" | "hideTimeout">, PopoverStoreOptions {
|
|
61
59
|
}
|
|
62
60
|
export interface HovercardStoreProps extends HovercardStoreOptions, StoreProps<HovercardStoreState> {
|
|
63
61
|
}
|
|
@@ -6,9 +6,7 @@ import type { SetState } from "../utils/types.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function createHovercardStore(props?: HovercardStoreProps): HovercardStore;
|
|
8
8
|
export interface HovercardStoreState extends PopoverStoreState {
|
|
9
|
-
/**
|
|
10
|
-
* @default "bottom"
|
|
11
|
-
*/
|
|
9
|
+
/** @default "bottom" */
|
|
12
10
|
placement: PopoverStoreState["placement"];
|
|
13
11
|
/**
|
|
14
12
|
* The amount of time in milliseconds to wait before showing and hiding the
|
|
@@ -57,7 +55,7 @@ export interface HovercardStoreFunctions extends PopoverStoreFunctions {
|
|
|
57
55
|
*/
|
|
58
56
|
setAutoFocusOnShow: SetState<HovercardStoreState["autoFocusOnShow"]>;
|
|
59
57
|
}
|
|
60
|
-
export interface HovercardStoreOptions extends
|
|
58
|
+
export interface HovercardStoreOptions extends StoreOptions<HovercardStoreState, "placement" | "timeout" | "showTimeout" | "hideTimeout">, PopoverStoreOptions {
|
|
61
59
|
}
|
|
62
60
|
export interface HovercardStoreProps extends HovercardStoreOptions, StoreProps<HovercardStoreState> {
|
|
63
61
|
}
|
|
@@ -8,6 +8,12 @@ export declare function createMenuStore<T extends MenuStoreValues = MenuStoreVal
|
|
|
8
8
|
export declare function createMenuStore(props?: MenuStoreProps): MenuStore;
|
|
9
9
|
export type MenuStoreValues = Record<string, string | boolean | number | Array<string | number>>;
|
|
10
10
|
export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreState, HovercardStoreState {
|
|
11
|
+
/** @default "vertical" */
|
|
12
|
+
orientation: CompositeStoreState["orientation"];
|
|
13
|
+
/** @default "bottom-start" */
|
|
14
|
+
placement: HovercardStoreState["placement"];
|
|
15
|
+
/** @default 0 */
|
|
16
|
+
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
11
17
|
/**
|
|
12
18
|
* Determines the element that should be focused when the menu is opened.
|
|
13
19
|
*/
|
|
@@ -24,12 +30,6 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
|
|
|
24
30
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
25
31
|
*/
|
|
26
32
|
values: T;
|
|
27
|
-
/** @default "vertical" */
|
|
28
|
-
orientation: CompositeStoreState["orientation"];
|
|
29
|
-
/** @default "bottom-start" */
|
|
30
|
-
placement: HovercardStoreState["placement"];
|
|
31
|
-
/** @default 0 */
|
|
32
|
-
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
33
33
|
}
|
|
34
34
|
export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreFunctions, HovercardStoreFunctions, Pick<MenuStoreOptions, "combobox" | "parent" | "menubar"> {
|
|
35
35
|
/**
|
|
@@ -64,7 +64,7 @@ export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues>
|
|
|
64
64
|
*/
|
|
65
65
|
setValue: BivariantCallback<(name: string, value: SetStateAction<MenuStoreState<T>["values"][string]>) => void>;
|
|
66
66
|
}
|
|
67
|
-
export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> extends
|
|
67
|
+
export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> extends StoreOptions<MenuStoreState<T>, "orientation" | "placement" | "hideTimeout" | "values">, CompositeStoreOptions, HovercardStoreOptions {
|
|
68
68
|
/**
|
|
69
69
|
* A reference to a combobox store. This is used when combining the combobox
|
|
70
70
|
* with a menu (e.g., dropdown menu with a search input). The stores will
|
package/cjs/menu/menu-store.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ export declare function createMenuStore<T extends MenuStoreValues = MenuStoreVal
|
|
|
8
8
|
export declare function createMenuStore(props?: MenuStoreProps): MenuStore;
|
|
9
9
|
export type MenuStoreValues = Record<string, string | boolean | number | Array<string | number>>;
|
|
10
10
|
export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreState, HovercardStoreState {
|
|
11
|
+
/** @default "vertical" */
|
|
12
|
+
orientation: CompositeStoreState["orientation"];
|
|
13
|
+
/** @default "bottom-start" */
|
|
14
|
+
placement: HovercardStoreState["placement"];
|
|
15
|
+
/** @default 0 */
|
|
16
|
+
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
11
17
|
/**
|
|
12
18
|
* Determines the element that should be focused when the menu is opened.
|
|
13
19
|
*/
|
|
@@ -24,12 +30,6 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
|
|
|
24
30
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
25
31
|
*/
|
|
26
32
|
values: T;
|
|
27
|
-
/** @default "vertical" */
|
|
28
|
-
orientation: CompositeStoreState["orientation"];
|
|
29
|
-
/** @default "bottom-start" */
|
|
30
|
-
placement: HovercardStoreState["placement"];
|
|
31
|
-
/** @default 0 */
|
|
32
|
-
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
33
33
|
}
|
|
34
34
|
export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreFunctions, HovercardStoreFunctions, Pick<MenuStoreOptions, "combobox" | "parent" | "menubar"> {
|
|
35
35
|
/**
|
|
@@ -64,7 +64,7 @@ export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues>
|
|
|
64
64
|
*/
|
|
65
65
|
setValue: BivariantCallback<(name: string, value: SetStateAction<MenuStoreState<T>["values"][string]>) => void>;
|
|
66
66
|
}
|
|
67
|
-
export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> extends
|
|
67
|
+
export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> extends StoreOptions<MenuStoreState<T>, "orientation" | "placement" | "hideTimeout" | "values">, CompositeStoreOptions, HovercardStoreOptions {
|
|
68
68
|
/**
|
|
69
69
|
* A reference to a combobox store. This is used when combining the combobox
|
|
70
70
|
* with a menu (e.g., dropdown menu with a search input). The stores will
|
|
@@ -6,9 +6,7 @@ import type { SetState } from "../utils/types.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function createRadioStore({ ...props }?: RadioStoreProps): RadioStore;
|
|
8
8
|
export interface RadioStoreState extends CompositeStoreState {
|
|
9
|
-
/**
|
|
10
|
-
* @default true
|
|
11
|
-
*/
|
|
9
|
+
/** @default true */
|
|
12
10
|
focusLoop: CompositeStoreState["focusLoop"];
|
|
13
11
|
/**
|
|
14
12
|
* The value of the radio group.
|
|
@@ -26,7 +24,7 @@ export interface RadioStoreFunctions extends CompositeStoreFunctions {
|
|
|
26
24
|
*/
|
|
27
25
|
setValue: SetState<RadioStoreState["value"]>;
|
|
28
26
|
}
|
|
29
|
-
export interface RadioStoreOptions extends
|
|
27
|
+
export interface RadioStoreOptions extends StoreOptions<RadioStoreState, "focusLoop" | "value">, CompositeStoreOptions {
|
|
30
28
|
/**
|
|
31
29
|
* The default value of the radio group.
|
|
32
30
|
* @default null
|
|
@@ -6,9 +6,7 @@ import type { SetState } from "../utils/types.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function createRadioStore({ ...props }?: RadioStoreProps): RadioStore;
|
|
8
8
|
export interface RadioStoreState extends CompositeStoreState {
|
|
9
|
-
/**
|
|
10
|
-
* @default true
|
|
11
|
-
*/
|
|
9
|
+
/** @default true */
|
|
12
10
|
focusLoop: CompositeStoreState["focusLoop"];
|
|
13
11
|
/**
|
|
14
12
|
* The value of the radio group.
|
|
@@ -26,7 +24,7 @@ export interface RadioStoreFunctions extends CompositeStoreFunctions {
|
|
|
26
24
|
*/
|
|
27
25
|
setValue: SetState<RadioStoreState["value"]>;
|
|
28
26
|
}
|
|
29
|
-
export interface RadioStoreOptions extends
|
|
27
|
+
export interface RadioStoreOptions extends StoreOptions<RadioStoreState, "focusLoop" | "value">, CompositeStoreOptions {
|
|
30
28
|
/**
|
|
31
29
|
* The default value of the radio group.
|
|
32
30
|
* @default null
|
|
@@ -13,8 +13,6 @@ export interface SelectStoreItem extends CompositeStoreItem {
|
|
|
13
13
|
export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue> extends CompositeStoreState<SelectStoreItem>, PopoverStoreState {
|
|
14
14
|
/** @default true */
|
|
15
15
|
virtualFocus: CompositeStoreState<SelectStoreItem>["virtualFocus"];
|
|
16
|
-
/** @default false */
|
|
17
|
-
includesBaseElement: CompositeStoreState<SelectStoreItem>["includesBaseElement"];
|
|
18
16
|
/** @default null */
|
|
19
17
|
activeId: CompositeStoreState<SelectStoreItem>["activeId"];
|
|
20
18
|
/** @default "vertical" */
|
|
@@ -31,6 +29,8 @@ export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue>
|
|
|
31
29
|
* items](https://ariakit.org/examples/select-item-custom)
|
|
32
30
|
* - [Multi-Select](https://ariakit.org/examples/select-multiple)
|
|
33
31
|
* - [Toolbar with Select](https://ariakit.org/examples/toolbar-select)
|
|
32
|
+
* - [Select with Next.js App
|
|
33
|
+
* Router](https://ariakit.org/examples/select-next-router)
|
|
34
34
|
*/
|
|
35
35
|
value: MutableValue<T>;
|
|
36
36
|
/**
|
|
@@ -77,7 +77,7 @@ export interface SelectStoreFunctions<T extends SelectStoreValue = SelectStoreVa
|
|
|
77
77
|
*/
|
|
78
78
|
setLabelElement: SetState<SelectStoreState<T>["labelElement"]>;
|
|
79
79
|
}
|
|
80
|
-
export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValue> extends
|
|
80
|
+
export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValue> extends StoreOptions<SelectStoreState<T>, "virtualFocus" | "activeId" | "orientation" | "placement" | "value" | "setValueOnMove">, CompositeStoreOptions<SelectStoreItem>, PopoverStoreOptions {
|
|
81
81
|
/**
|
|
82
82
|
* A reference to a combobox store. This is used when combining the combobox
|
|
83
83
|
* with a select (e.g., select with a search input). The stores will share the
|
|
@@ -92,6 +92,8 @@ export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValu
|
|
|
92
92
|
* - [Animated Select](https://ariakit.org/examples/select-animated)
|
|
93
93
|
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
|
|
94
94
|
* - [SelectGroup](https://ariakit.org/examples/select-group)
|
|
95
|
+
* - [Select with Next.js App
|
|
96
|
+
* Router](https://ariakit.org/examples/select-next-router)
|
|
95
97
|
*/
|
|
96
98
|
defaultValue?: SelectStoreState<T>["value"];
|
|
97
99
|
}
|
|
@@ -13,8 +13,6 @@ export interface SelectStoreItem extends CompositeStoreItem {
|
|
|
13
13
|
export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue> extends CompositeStoreState<SelectStoreItem>, PopoverStoreState {
|
|
14
14
|
/** @default true */
|
|
15
15
|
virtualFocus: CompositeStoreState<SelectStoreItem>["virtualFocus"];
|
|
16
|
-
/** @default false */
|
|
17
|
-
includesBaseElement: CompositeStoreState<SelectStoreItem>["includesBaseElement"];
|
|
18
16
|
/** @default null */
|
|
19
17
|
activeId: CompositeStoreState<SelectStoreItem>["activeId"];
|
|
20
18
|
/** @default "vertical" */
|
|
@@ -31,6 +29,8 @@ export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue>
|
|
|
31
29
|
* items](https://ariakit.org/examples/select-item-custom)
|
|
32
30
|
* - [Multi-Select](https://ariakit.org/examples/select-multiple)
|
|
33
31
|
* - [Toolbar with Select](https://ariakit.org/examples/toolbar-select)
|
|
32
|
+
* - [Select with Next.js App
|
|
33
|
+
* Router](https://ariakit.org/examples/select-next-router)
|
|
34
34
|
*/
|
|
35
35
|
value: MutableValue<T>;
|
|
36
36
|
/**
|
|
@@ -77,7 +77,7 @@ export interface SelectStoreFunctions<T extends SelectStoreValue = SelectStoreVa
|
|
|
77
77
|
*/
|
|
78
78
|
setLabelElement: SetState<SelectStoreState<T>["labelElement"]>;
|
|
79
79
|
}
|
|
80
|
-
export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValue> extends
|
|
80
|
+
export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValue> extends StoreOptions<SelectStoreState<T>, "virtualFocus" | "activeId" | "orientation" | "placement" | "value" | "setValueOnMove">, CompositeStoreOptions<SelectStoreItem>, PopoverStoreOptions {
|
|
81
81
|
/**
|
|
82
82
|
* A reference to a combobox store. This is used when combining the combobox
|
|
83
83
|
* with a select (e.g., select with a search input). The stores will share the
|
|
@@ -92,6 +92,8 @@ export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValu
|
|
|
92
92
|
* - [Animated Select](https://ariakit.org/examples/select-animated)
|
|
93
93
|
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
|
|
94
94
|
* - [SelectGroup](https://ariakit.org/examples/select-group)
|
|
95
|
+
* - [Select with Next.js App
|
|
96
|
+
* Router](https://ariakit.org/examples/select-next-router)
|
|
95
97
|
*/
|
|
96
98
|
defaultValue?: SelectStoreState<T>["value"];
|
|
97
99
|
}
|
package/cjs/tab/tab-store.cjs
CHANGED
|
@@ -10,6 +10,8 @@ var _FFZYCAXAcjs = require('../__chunks/FFZYCAXA.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
|
|
14
|
+
|
|
13
15
|
var _B4LYZ4EMcjs = require('../__chunks/B4LYZ4EM.cjs');
|
|
14
16
|
|
|
15
17
|
|
|
@@ -19,12 +21,30 @@ require('../__chunks/ULSPM3Y3.cjs');
|
|
|
19
21
|
|
|
20
22
|
|
|
21
23
|
|
|
24
|
+
|
|
22
25
|
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
23
26
|
|
|
24
27
|
// src/tab/tab-store.ts
|
|
25
|
-
function createTabStore(
|
|
26
|
-
var _a
|
|
27
|
-
|
|
28
|
+
function createTabStore(_a = {}) {
|
|
29
|
+
var _b = _a, {
|
|
30
|
+
composite: parentComposite
|
|
31
|
+
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
32
|
+
"composite"
|
|
33
|
+
]);
|
|
34
|
+
const store = _B4LYZ4EMcjs.mergeStore.call(void 0,
|
|
35
|
+
props.store,
|
|
36
|
+
_B4LYZ4EMcjs.omit.call(void 0, parentComposite, [
|
|
37
|
+
"items",
|
|
38
|
+
"renderedItems",
|
|
39
|
+
"moves",
|
|
40
|
+
"orientation",
|
|
41
|
+
"baseElement",
|
|
42
|
+
"focusLoop",
|
|
43
|
+
"focusShift",
|
|
44
|
+
"focusWrap"
|
|
45
|
+
])
|
|
46
|
+
);
|
|
47
|
+
const syncState = store == null ? void 0 : store.getState();
|
|
28
48
|
const composite = _Y7KNI5NScjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
29
49
|
orientation: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
30
50
|
props.orientation,
|
|
@@ -47,7 +67,7 @@ function createTabStore(props = {}) {
|
|
|
47
67
|
true
|
|
48
68
|
)
|
|
49
69
|
});
|
|
50
|
-
const tab = _B4LYZ4EMcjs.createStore.call(void 0, initialState, composite,
|
|
70
|
+
const tab = _B4LYZ4EMcjs.createStore.call(void 0, initialState, composite, store);
|
|
51
71
|
_B4LYZ4EMcjs.setup.call(void 0,
|
|
52
72
|
tab,
|
|
53
73
|
() => _B4LYZ4EMcjs.sync.call(void 0, tab, ["moves"], () => {
|
package/cjs/tab/tab-store.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.js";
|
|
2
|
-
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
|
+
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
3
3
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
4
|
import type { SetState } from "../utils/types.js";
|
|
5
|
-
export declare function createTabStore(props?: TabStoreProps): TabStore;
|
|
5
|
+
export declare function createTabStore({ composite: parentComposite, ...props }?: TabStoreProps): TabStore;
|
|
6
6
|
export interface TabStoreItem extends CompositeStoreItem {
|
|
7
7
|
dimmed?: boolean;
|
|
8
8
|
}
|
|
@@ -54,6 +54,9 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
54
54
|
setSelectedId: SetState<TabStoreState["selectedId"]>;
|
|
55
55
|
/**
|
|
56
56
|
* A collection store containing the tab panels.
|
|
57
|
+
*
|
|
58
|
+
* Live examples:
|
|
59
|
+
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
57
60
|
*/
|
|
58
61
|
panels: CollectionStore<TabStorePanel>;
|
|
59
62
|
/**
|
|
@@ -62,9 +65,6 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
62
65
|
* state without moving focus, use the
|
|
63
66
|
* [`setSelectedId`](https://ariakit.org/reference/use-tab-store#setselectedid-1)
|
|
64
67
|
* function instead.
|
|
65
|
-
*
|
|
66
|
-
* Live examples:
|
|
67
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
68
68
|
* @example
|
|
69
69
|
* // Selects the tab with id "tab-1"
|
|
70
70
|
* store.select("tab-1");
|
|
@@ -76,12 +76,22 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
76
76
|
select: TabStore["move"];
|
|
77
77
|
}
|
|
78
78
|
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<TabStoreItem> {
|
|
79
|
+
/**
|
|
80
|
+
* A reference to another [composite
|
|
81
|
+
* store](https://ariakit.org/reference/composite-store). This is used when
|
|
82
|
+
* rendering tabs as part of another composite widget such as
|
|
83
|
+
* [Combobox](https://ariakit.org/components/combobox) or
|
|
84
|
+
* [Select](https://ariakit.org/components/select). The stores will share the
|
|
85
|
+
* same state.
|
|
86
|
+
*/
|
|
87
|
+
composite?: CompositeStore | null;
|
|
79
88
|
/**
|
|
80
89
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
81
90
|
* will be automatically set to the first enabled tab.
|
|
82
91
|
*
|
|
83
92
|
* Live examples:
|
|
84
93
|
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
94
|
+
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
85
95
|
*/
|
|
86
96
|
defaultSelectedId?: TabStoreState["selectedId"];
|
|
87
97
|
}
|
package/cjs/tab/tab-store.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.js";
|
|
2
|
-
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
|
+
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
3
3
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
4
|
import type { SetState } from "../utils/types.js";
|
|
5
|
-
export declare function createTabStore(props?: TabStoreProps): TabStore;
|
|
5
|
+
export declare function createTabStore({ composite: parentComposite, ...props }?: TabStoreProps): TabStore;
|
|
6
6
|
export interface TabStoreItem extends CompositeStoreItem {
|
|
7
7
|
dimmed?: boolean;
|
|
8
8
|
}
|
|
@@ -54,6 +54,9 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
54
54
|
setSelectedId: SetState<TabStoreState["selectedId"]>;
|
|
55
55
|
/**
|
|
56
56
|
* A collection store containing the tab panels.
|
|
57
|
+
*
|
|
58
|
+
* Live examples:
|
|
59
|
+
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
57
60
|
*/
|
|
58
61
|
panels: CollectionStore<TabStorePanel>;
|
|
59
62
|
/**
|
|
@@ -62,9 +65,6 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
62
65
|
* state without moving focus, use the
|
|
63
66
|
* [`setSelectedId`](https://ariakit.org/reference/use-tab-store#setselectedid-1)
|
|
64
67
|
* function instead.
|
|
65
|
-
*
|
|
66
|
-
* Live examples:
|
|
67
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
68
68
|
* @example
|
|
69
69
|
* // Selects the tab with id "tab-1"
|
|
70
70
|
* store.select("tab-1");
|
|
@@ -76,12 +76,22 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
76
76
|
select: TabStore["move"];
|
|
77
77
|
}
|
|
78
78
|
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<TabStoreItem> {
|
|
79
|
+
/**
|
|
80
|
+
* A reference to another [composite
|
|
81
|
+
* store](https://ariakit.org/reference/composite-store). This is used when
|
|
82
|
+
* rendering tabs as part of another composite widget such as
|
|
83
|
+
* [Combobox](https://ariakit.org/components/combobox) or
|
|
84
|
+
* [Select](https://ariakit.org/components/select). The stores will share the
|
|
85
|
+
* same state.
|
|
86
|
+
*/
|
|
87
|
+
composite?: CompositeStore | null;
|
|
79
88
|
/**
|
|
80
89
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
81
90
|
* will be automatically set to the first enabled tab.
|
|
82
91
|
*
|
|
83
92
|
* Live examples:
|
|
84
93
|
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
94
|
+
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
85
95
|
*/
|
|
86
96
|
defaultSelectedId?: TabStoreState["selectedId"];
|
|
87
97
|
}
|
|
@@ -12,7 +12,7 @@ export interface ToolbarStoreState extends CompositeStoreState {
|
|
|
12
12
|
}
|
|
13
13
|
export interface ToolbarStoreFunctions extends CompositeStoreFunctions {
|
|
14
14
|
}
|
|
15
|
-
export interface ToolbarStoreOptions extends
|
|
15
|
+
export interface ToolbarStoreOptions extends StoreOptions<ToolbarStoreState, "orientation" | "focusLoop">, CompositeStoreOptions {
|
|
16
16
|
}
|
|
17
17
|
export interface ToolbarStoreProps extends ToolbarStoreOptions, StoreProps<ToolbarStoreState> {
|
|
18
18
|
}
|
|
@@ -12,7 +12,7 @@ export interface ToolbarStoreState extends CompositeStoreState {
|
|
|
12
12
|
}
|
|
13
13
|
export interface ToolbarStoreFunctions extends CompositeStoreFunctions {
|
|
14
14
|
}
|
|
15
|
-
export interface ToolbarStoreOptions extends
|
|
15
|
+
export interface ToolbarStoreOptions extends StoreOptions<ToolbarStoreState, "orientation" | "focusLoop">, CompositeStoreOptions {
|
|
16
16
|
}
|
|
17
17
|
export interface ToolbarStoreProps extends ToolbarStoreOptions, StoreProps<ToolbarStoreState> {
|
|
18
18
|
}
|
|
@@ -25,7 +25,7 @@ export interface TooltipStoreState extends HovercardStoreState {
|
|
|
25
25
|
skipTimeout: number;
|
|
26
26
|
}
|
|
27
27
|
export type TooltipStoreFunctions = HovercardStoreFunctions;
|
|
28
|
-
export interface TooltipStoreOptions extends
|
|
28
|
+
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout">, HovercardStoreOptions {
|
|
29
29
|
}
|
|
30
30
|
export interface TooltipStoreProps extends TooltipStoreOptions, StoreProps<TooltipStoreState> {
|
|
31
31
|
}
|
|
@@ -25,7 +25,7 @@ export interface TooltipStoreState extends HovercardStoreState {
|
|
|
25
25
|
skipTimeout: number;
|
|
26
26
|
}
|
|
27
27
|
export type TooltipStoreFunctions = HovercardStoreFunctions;
|
|
28
|
-
export interface TooltipStoreOptions extends
|
|
28
|
+
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout">, HovercardStoreOptions {
|
|
29
29
|
}
|
|
30
30
|
export interface TooltipStoreProps extends TooltipStoreOptions, StoreProps<TooltipStoreState> {
|
|
31
31
|
}
|
package/cjs/utils/dom.d.cts
CHANGED
|
@@ -104,11 +104,12 @@ export declare function getScrollingElement(element?: Element | null): HTMLEleme
|
|
|
104
104
|
*/
|
|
105
105
|
export declare function isPartiallyHidden(element: Element): boolean;
|
|
106
106
|
/**
|
|
107
|
-
* SelectionRange only works on a few types of input.
|
|
108
|
-
*
|
|
109
|
-
* To avoid it, we check if its type supports SelectionRange first.
|
|
110
|
-
*
|
|
107
|
+
* SelectionRange only works on a few types of input. Calling
|
|
108
|
+
* `setSelectionRange` on a unsupported input type may throw an error on certain
|
|
109
|
+
* browsers. To avoid it, we check if its type supports SelectionRange first. It
|
|
110
|
+
* will be a noop to non-supported types until we find a workaround.
|
|
111
111
|
*
|
|
112
|
-
* @see
|
|
112
|
+
* @see
|
|
113
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
|
|
113
114
|
*/
|
|
114
115
|
export declare function setSelectionRange(element: HTMLInputElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;
|
package/cjs/utils/dom.d.ts
CHANGED
|
@@ -104,11 +104,12 @@ export declare function getScrollingElement(element?: Element | null): HTMLEleme
|
|
|
104
104
|
*/
|
|
105
105
|
export declare function isPartiallyHidden(element: Element): boolean;
|
|
106
106
|
/**
|
|
107
|
-
* SelectionRange only works on a few types of input.
|
|
108
|
-
*
|
|
109
|
-
* To avoid it, we check if its type supports SelectionRange first.
|
|
110
|
-
*
|
|
107
|
+
* SelectionRange only works on a few types of input. Calling
|
|
108
|
+
* `setSelectionRange` on a unsupported input type may throw an error on certain
|
|
109
|
+
* browsers. To avoid it, we check if its type supports SelectionRange first. It
|
|
110
|
+
* will be a noop to non-supported types until we find a workaround.
|
|
111
111
|
*
|
|
112
|
-
* @see
|
|
112
|
+
* @see
|
|
113
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
|
|
113
114
|
*/
|
|
114
115
|
export declare function setSelectionRange(element: HTMLInputElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;
|
package/cjs/utils/focus.cjs
CHANGED
|
@@ -12,7 +12,7 @@ var _UKR6TQI3cjs = require('../__chunks/UKR6TQI3.cjs');
|
|
|
12
12
|
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
13
13
|
|
|
14
14
|
// src/utils/focus.ts
|
|
15
|
-
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
|
|
15
|
+
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
|
|
16
16
|
function hasNegativeTabIndex(element) {
|
|
17
17
|
const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
|
|
18
18
|
return tabIndex < 0;
|
|
@@ -52,6 +52,9 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
52
52
|
renderItem: BivariantCallback<(item: T) => () => void>;
|
|
53
53
|
/**
|
|
54
54
|
* Gets an item by its id.
|
|
55
|
+
*
|
|
56
|
+
* Live examples:
|
|
57
|
+
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
55
58
|
* @example
|
|
56
59
|
* const item = store.item("item-1");
|
|
57
60
|
*/
|
|
@@ -13,10 +13,16 @@ export interface ComboboxStoreItem extends CompositeStoreItem {
|
|
|
13
13
|
value?: string;
|
|
14
14
|
}
|
|
15
15
|
export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreState<ComboboxStoreItem>, PopoverStoreState {
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/** @default true */
|
|
17
|
+
includesBaseElement: CompositeStoreState<ComboboxStoreItem>["includesBaseElement"];
|
|
18
|
+
/** @default true */
|
|
19
|
+
focusLoop: CompositeStoreState<ComboboxStoreItem>["focusLoop"];
|
|
20
|
+
/** @default true */
|
|
21
|
+
focusWrap: CompositeStoreState<ComboboxStoreItem>["focusWrap"];
|
|
22
|
+
/** @default "vertical" */
|
|
23
|
+
orientation: CompositeStoreState<ComboboxStoreItem>["orientation"];
|
|
24
|
+
/** @default true */
|
|
25
|
+
virtualFocus: CompositeStoreState<ComboboxStoreItem>["virtualFocus"];
|
|
20
26
|
/**
|
|
21
27
|
* The combobox input value.
|
|
22
28
|
*
|
|
@@ -63,6 +69,7 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
63
69
|
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
|
|
64
70
|
* - [Submenu with
|
|
65
71
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
72
|
+
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
66
73
|
*/
|
|
67
74
|
resetValueOnHide: boolean;
|
|
68
75
|
/**
|
|
@@ -100,10 +107,8 @@ export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = C
|
|
|
100
107
|
*/
|
|
101
108
|
setSelectedValue: SetState<ComboboxStoreState<T>["selectedValue"]>;
|
|
102
109
|
}
|
|
103
|
-
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends
|
|
104
|
-
/**
|
|
105
|
-
* @default null
|
|
106
|
-
*/
|
|
110
|
+
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends StoreOptions<ComboboxStoreState<T>, "includesBaseElement" | "focusLoop" | "focusWrap" | "orientation" | "virtualFocus" | "value" | "selectedValue" | "resetValueOnHide" | "resetValueOnSelect">, CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions {
|
|
111
|
+
/** @default null */
|
|
107
112
|
defaultActiveId?: CompositeStoreOptions<ComboboxStoreItem>["activeId"];
|
|
108
113
|
/**
|
|
109
114
|
* The initial value of the combobox input.
|
|
@@ -112,6 +112,9 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
112
112
|
* matches the value of `focusLoop`, it'll wrap between the last item in the
|
|
113
113
|
* last row or column and the first item in the first row or column and
|
|
114
114
|
* vice-versa.
|
|
115
|
+
*
|
|
116
|
+
* Live examples:
|
|
117
|
+
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
115
118
|
* @default false
|
|
116
119
|
*/
|
|
117
120
|
focusLoop: boolean | Orientation;
|
|
@@ -156,7 +159,7 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
156
159
|
* Live examples:
|
|
157
160
|
* - [Submenu with
|
|
158
161
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
159
|
-
* - [
|
|
162
|
+
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
160
163
|
* @default false
|
|
161
164
|
*/
|
|
162
165
|
includesBaseElement: boolean;
|
|
@@ -190,9 +193,6 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
190
193
|
* state _without moving focus_. If you want to move focus, use the
|
|
191
194
|
* [`move`](https://ariakit.org/reference/use-composite-store#move) function
|
|
192
195
|
* instead.
|
|
193
|
-
*
|
|
194
|
-
* Live examples:
|
|
195
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
196
196
|
* @example
|
|
197
197
|
* // Sets the composite element as the active item
|
|
198
198
|
* store.setActiveId(null);
|
|
@@ -226,9 +226,6 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
226
226
|
* Returns the id of the next enabled item based on the current
|
|
227
227
|
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
|
|
228
228
|
* state.
|
|
229
|
-
*
|
|
230
|
-
* Live examples:
|
|
231
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
232
229
|
* @example
|
|
233
230
|
* const nextId = store.next();
|
|
234
231
|
* const nextNextId = store.next(2);
|
|
@@ -238,9 +235,6 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
238
235
|
* Returns the id of the previous enabled item based on the current
|
|
239
236
|
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
|
|
240
237
|
* state.
|
|
241
|
-
*
|
|
242
|
-
* Live examples:
|
|
243
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
244
238
|
* @example
|
|
245
239
|
* const previousId = store.previous();
|
|
246
240
|
* const previousPreviousId = store.previous(2);
|
|
@@ -266,16 +260,10 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
266
260
|
down: (skip?: number) => string | null | undefined;
|
|
267
261
|
/**
|
|
268
262
|
* Returns the id of the first enabled item.
|
|
269
|
-
*
|
|
270
|
-
* Live examples:
|
|
271
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
272
263
|
*/
|
|
273
264
|
first: () => string | null | undefined;
|
|
274
265
|
/**
|
|
275
266
|
* Returns the id of the last enabled item.
|
|
276
|
-
*
|
|
277
|
-
* Live examples:
|
|
278
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
279
267
|
*/
|
|
280
268
|
last: () => string | null | undefined;
|
|
281
269
|
}
|
|
@@ -6,9 +6,7 @@ import type { SetState } from "../utils/types.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function createHovercardStore(props?: HovercardStoreProps): HovercardStore;
|
|
8
8
|
export interface HovercardStoreState extends PopoverStoreState {
|
|
9
|
-
/**
|
|
10
|
-
* @default "bottom"
|
|
11
|
-
*/
|
|
9
|
+
/** @default "bottom" */
|
|
12
10
|
placement: PopoverStoreState["placement"];
|
|
13
11
|
/**
|
|
14
12
|
* The amount of time in milliseconds to wait before showing and hiding the
|
|
@@ -57,7 +55,7 @@ export interface HovercardStoreFunctions extends PopoverStoreFunctions {
|
|
|
57
55
|
*/
|
|
58
56
|
setAutoFocusOnShow: SetState<HovercardStoreState["autoFocusOnShow"]>;
|
|
59
57
|
}
|
|
60
|
-
export interface HovercardStoreOptions extends
|
|
58
|
+
export interface HovercardStoreOptions extends StoreOptions<HovercardStoreState, "placement" | "timeout" | "showTimeout" | "hideTimeout">, PopoverStoreOptions {
|
|
61
59
|
}
|
|
62
60
|
export interface HovercardStoreProps extends HovercardStoreOptions, StoreProps<HovercardStoreState> {
|
|
63
61
|
}
|
package/esm/menu/menu-store.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ export declare function createMenuStore<T extends MenuStoreValues = MenuStoreVal
|
|
|
8
8
|
export declare function createMenuStore(props?: MenuStoreProps): MenuStore;
|
|
9
9
|
export type MenuStoreValues = Record<string, string | boolean | number | Array<string | number>>;
|
|
10
10
|
export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreState, HovercardStoreState {
|
|
11
|
+
/** @default "vertical" */
|
|
12
|
+
orientation: CompositeStoreState["orientation"];
|
|
13
|
+
/** @default "bottom-start" */
|
|
14
|
+
placement: HovercardStoreState["placement"];
|
|
15
|
+
/** @default 0 */
|
|
16
|
+
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
11
17
|
/**
|
|
12
18
|
* Determines the element that should be focused when the menu is opened.
|
|
13
19
|
*/
|
|
@@ -24,12 +30,6 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
|
|
|
24
30
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
25
31
|
*/
|
|
26
32
|
values: T;
|
|
27
|
-
/** @default "vertical" */
|
|
28
|
-
orientation: CompositeStoreState["orientation"];
|
|
29
|
-
/** @default "bottom-start" */
|
|
30
|
-
placement: HovercardStoreState["placement"];
|
|
31
|
-
/** @default 0 */
|
|
32
|
-
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
33
33
|
}
|
|
34
34
|
export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreFunctions, HovercardStoreFunctions, Pick<MenuStoreOptions, "combobox" | "parent" | "menubar"> {
|
|
35
35
|
/**
|
|
@@ -64,7 +64,7 @@ export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues>
|
|
|
64
64
|
*/
|
|
65
65
|
setValue: BivariantCallback<(name: string, value: SetStateAction<MenuStoreState<T>["values"][string]>) => void>;
|
|
66
66
|
}
|
|
67
|
-
export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> extends
|
|
67
|
+
export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> extends StoreOptions<MenuStoreState<T>, "orientation" | "placement" | "hideTimeout" | "values">, CompositeStoreOptions, HovercardStoreOptions {
|
|
68
68
|
/**
|
|
69
69
|
* A reference to a combobox store. This is used when combining the combobox
|
|
70
70
|
* with a menu (e.g., dropdown menu with a search input). The stores will
|
|
@@ -6,9 +6,7 @@ import type { SetState } from "../utils/types.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function createRadioStore({ ...props }?: RadioStoreProps): RadioStore;
|
|
8
8
|
export interface RadioStoreState extends CompositeStoreState {
|
|
9
|
-
/**
|
|
10
|
-
* @default true
|
|
11
|
-
*/
|
|
9
|
+
/** @default true */
|
|
12
10
|
focusLoop: CompositeStoreState["focusLoop"];
|
|
13
11
|
/**
|
|
14
12
|
* The value of the radio group.
|
|
@@ -26,7 +24,7 @@ export interface RadioStoreFunctions extends CompositeStoreFunctions {
|
|
|
26
24
|
*/
|
|
27
25
|
setValue: SetState<RadioStoreState["value"]>;
|
|
28
26
|
}
|
|
29
|
-
export interface RadioStoreOptions extends
|
|
27
|
+
export interface RadioStoreOptions extends StoreOptions<RadioStoreState, "focusLoop" | "value">, CompositeStoreOptions {
|
|
30
28
|
/**
|
|
31
29
|
* The default value of the radio group.
|
|
32
30
|
* @default null
|
|
@@ -13,8 +13,6 @@ export interface SelectStoreItem extends CompositeStoreItem {
|
|
|
13
13
|
export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue> extends CompositeStoreState<SelectStoreItem>, PopoverStoreState {
|
|
14
14
|
/** @default true */
|
|
15
15
|
virtualFocus: CompositeStoreState<SelectStoreItem>["virtualFocus"];
|
|
16
|
-
/** @default false */
|
|
17
|
-
includesBaseElement: CompositeStoreState<SelectStoreItem>["includesBaseElement"];
|
|
18
16
|
/** @default null */
|
|
19
17
|
activeId: CompositeStoreState<SelectStoreItem>["activeId"];
|
|
20
18
|
/** @default "vertical" */
|
|
@@ -31,6 +29,8 @@ export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue>
|
|
|
31
29
|
* items](https://ariakit.org/examples/select-item-custom)
|
|
32
30
|
* - [Multi-Select](https://ariakit.org/examples/select-multiple)
|
|
33
31
|
* - [Toolbar with Select](https://ariakit.org/examples/toolbar-select)
|
|
32
|
+
* - [Select with Next.js App
|
|
33
|
+
* Router](https://ariakit.org/examples/select-next-router)
|
|
34
34
|
*/
|
|
35
35
|
value: MutableValue<T>;
|
|
36
36
|
/**
|
|
@@ -77,7 +77,7 @@ export interface SelectStoreFunctions<T extends SelectStoreValue = SelectStoreVa
|
|
|
77
77
|
*/
|
|
78
78
|
setLabelElement: SetState<SelectStoreState<T>["labelElement"]>;
|
|
79
79
|
}
|
|
80
|
-
export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValue> extends
|
|
80
|
+
export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValue> extends StoreOptions<SelectStoreState<T>, "virtualFocus" | "activeId" | "orientation" | "placement" | "value" | "setValueOnMove">, CompositeStoreOptions<SelectStoreItem>, PopoverStoreOptions {
|
|
81
81
|
/**
|
|
82
82
|
* A reference to a combobox store. This is used when combining the combobox
|
|
83
83
|
* with a select (e.g., select with a search input). The stores will share the
|
|
@@ -92,6 +92,8 @@ export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValu
|
|
|
92
92
|
* - [Animated Select](https://ariakit.org/examples/select-animated)
|
|
93
93
|
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
|
|
94
94
|
* - [SelectGroup](https://ariakit.org/examples/select-group)
|
|
95
|
+
* - [Select with Next.js App
|
|
96
|
+
* Router](https://ariakit.org/examples/select-next-router)
|
|
95
97
|
*/
|
|
96
98
|
defaultValue?: SelectStoreState<T>["value"];
|
|
97
99
|
}
|
package/esm/tab/tab-store.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.js";
|
|
2
|
-
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
|
+
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
3
3
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
4
|
import type { SetState } from "../utils/types.js";
|
|
5
|
-
export declare function createTabStore(props?: TabStoreProps): TabStore;
|
|
5
|
+
export declare function createTabStore({ composite: parentComposite, ...props }?: TabStoreProps): TabStore;
|
|
6
6
|
export interface TabStoreItem extends CompositeStoreItem {
|
|
7
7
|
dimmed?: boolean;
|
|
8
8
|
}
|
|
@@ -54,6 +54,9 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
54
54
|
setSelectedId: SetState<TabStoreState["selectedId"]>;
|
|
55
55
|
/**
|
|
56
56
|
* A collection store containing the tab panels.
|
|
57
|
+
*
|
|
58
|
+
* Live examples:
|
|
59
|
+
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
57
60
|
*/
|
|
58
61
|
panels: CollectionStore<TabStorePanel>;
|
|
59
62
|
/**
|
|
@@ -62,9 +65,6 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
62
65
|
* state without moving focus, use the
|
|
63
66
|
* [`setSelectedId`](https://ariakit.org/reference/use-tab-store#setselectedid-1)
|
|
64
67
|
* function instead.
|
|
65
|
-
*
|
|
66
|
-
* Live examples:
|
|
67
|
-
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
68
68
|
* @example
|
|
69
69
|
* // Selects the tab with id "tab-1"
|
|
70
70
|
* store.select("tab-1");
|
|
@@ -76,12 +76,22 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
76
76
|
select: TabStore["move"];
|
|
77
77
|
}
|
|
78
78
|
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<TabStoreItem> {
|
|
79
|
+
/**
|
|
80
|
+
* A reference to another [composite
|
|
81
|
+
* store](https://ariakit.org/reference/composite-store). This is used when
|
|
82
|
+
* rendering tabs as part of another composite widget such as
|
|
83
|
+
* [Combobox](https://ariakit.org/components/combobox) or
|
|
84
|
+
* [Select](https://ariakit.org/components/select). The stores will share the
|
|
85
|
+
* same state.
|
|
86
|
+
*/
|
|
87
|
+
composite?: CompositeStore | null;
|
|
79
88
|
/**
|
|
80
89
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
81
90
|
* will be automatically set to the first enabled tab.
|
|
82
91
|
*
|
|
83
92
|
* Live examples:
|
|
84
93
|
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
94
|
+
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
85
95
|
*/
|
|
86
96
|
defaultSelectedId?: TabStoreState["selectedId"];
|
|
87
97
|
}
|
package/esm/tab/tab-store.js
CHANGED
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
batch,
|
|
10
10
|
createStore,
|
|
11
|
+
mergeStore,
|
|
12
|
+
omit,
|
|
11
13
|
setup,
|
|
12
14
|
sync
|
|
13
15
|
} from "../__chunks/R676XYVY.js";
|
|
@@ -17,14 +19,32 @@ import {
|
|
|
17
19
|
import "../__chunks/RRSZHCH6.js";
|
|
18
20
|
import "../__chunks/7PRQYBBV.js";
|
|
19
21
|
import {
|
|
22
|
+
__objRest,
|
|
20
23
|
__spreadProps,
|
|
21
24
|
__spreadValues
|
|
22
25
|
} from "../__chunks/4R3V3JGP.js";
|
|
23
26
|
|
|
24
27
|
// src/tab/tab-store.ts
|
|
25
|
-
function createTabStore(
|
|
26
|
-
var _a
|
|
27
|
-
|
|
28
|
+
function createTabStore(_a = {}) {
|
|
29
|
+
var _b = _a, {
|
|
30
|
+
composite: parentComposite
|
|
31
|
+
} = _b, props = __objRest(_b, [
|
|
32
|
+
"composite"
|
|
33
|
+
]);
|
|
34
|
+
const store = mergeStore(
|
|
35
|
+
props.store,
|
|
36
|
+
omit(parentComposite, [
|
|
37
|
+
"items",
|
|
38
|
+
"renderedItems",
|
|
39
|
+
"moves",
|
|
40
|
+
"orientation",
|
|
41
|
+
"baseElement",
|
|
42
|
+
"focusLoop",
|
|
43
|
+
"focusShift",
|
|
44
|
+
"focusWrap"
|
|
45
|
+
])
|
|
46
|
+
);
|
|
47
|
+
const syncState = store == null ? void 0 : store.getState();
|
|
28
48
|
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
|
|
29
49
|
orientation: defaultValue(
|
|
30
50
|
props.orientation,
|
|
@@ -47,7 +67,7 @@ function createTabStore(props = {}) {
|
|
|
47
67
|
true
|
|
48
68
|
)
|
|
49
69
|
});
|
|
50
|
-
const tab = createStore(initialState, composite,
|
|
70
|
+
const tab = createStore(initialState, composite, store);
|
|
51
71
|
setup(
|
|
52
72
|
tab,
|
|
53
73
|
() => sync(tab, ["moves"], () => {
|
|
@@ -12,7 +12,7 @@ export interface ToolbarStoreState extends CompositeStoreState {
|
|
|
12
12
|
}
|
|
13
13
|
export interface ToolbarStoreFunctions extends CompositeStoreFunctions {
|
|
14
14
|
}
|
|
15
|
-
export interface ToolbarStoreOptions extends
|
|
15
|
+
export interface ToolbarStoreOptions extends StoreOptions<ToolbarStoreState, "orientation" | "focusLoop">, CompositeStoreOptions {
|
|
16
16
|
}
|
|
17
17
|
export interface ToolbarStoreProps extends ToolbarStoreOptions, StoreProps<ToolbarStoreState> {
|
|
18
18
|
}
|
|
@@ -25,7 +25,7 @@ export interface TooltipStoreState extends HovercardStoreState {
|
|
|
25
25
|
skipTimeout: number;
|
|
26
26
|
}
|
|
27
27
|
export type TooltipStoreFunctions = HovercardStoreFunctions;
|
|
28
|
-
export interface TooltipStoreOptions extends
|
|
28
|
+
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout">, HovercardStoreOptions {
|
|
29
29
|
}
|
|
30
30
|
export interface TooltipStoreProps extends TooltipStoreOptions, StoreProps<TooltipStoreState> {
|
|
31
31
|
}
|
package/esm/utils/dom.d.ts
CHANGED
|
@@ -104,11 +104,12 @@ export declare function getScrollingElement(element?: Element | null): HTMLEleme
|
|
|
104
104
|
*/
|
|
105
105
|
export declare function isPartiallyHidden(element: Element): boolean;
|
|
106
106
|
/**
|
|
107
|
-
* SelectionRange only works on a few types of input.
|
|
108
|
-
*
|
|
109
|
-
* To avoid it, we check if its type supports SelectionRange first.
|
|
110
|
-
*
|
|
107
|
+
* SelectionRange only works on a few types of input. Calling
|
|
108
|
+
* `setSelectionRange` on a unsupported input type may throw an error on certain
|
|
109
|
+
* browsers. To avoid it, we check if its type supports SelectionRange first. It
|
|
110
|
+
* will be a noop to non-supported types until we find a workaround.
|
|
111
111
|
*
|
|
112
|
-
* @see
|
|
112
|
+
* @see
|
|
113
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
|
|
113
114
|
*/
|
|
114
115
|
export declare function setSelectionRange(element: HTMLInputElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;
|
package/esm/utils/focus.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "../__chunks/4R3V3JGP.js";
|
|
13
13
|
|
|
14
14
|
// src/utils/focus.ts
|
|
15
|
-
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
|
|
15
|
+
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
|
|
16
16
|
function hasNegativeTabIndex(element) {
|
|
17
17
|
const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
|
|
18
18
|
return tabIndex < 0;
|