@ariakit/core 0.4.5 → 0.4.6
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 +8 -0
- package/cjs/__chunks/{KL74MAHB.cjs → 3HYNC3XA.cjs} +2 -2
- package/cjs/__chunks/{QD2A4YF6.cjs → 4W3OYRR3.cjs} +2 -2
- package/cjs/__chunks/{MHZQJPY3.cjs → B4AKUC4S.cjs} +2 -2
- package/cjs/__chunks/{2D5LEVE7.cjs → D7M2PCAQ.cjs} +6 -6
- package/cjs/__chunks/{IMYW2UAC.cjs → Q2WCPTYS.cjs} +4 -22
- package/cjs/checkbox/checkbox-store.d.cts +2 -2
- package/cjs/checkbox/checkbox-store.d.ts +2 -2
- package/cjs/collection/collection-store.cjs +3 -3
- package/cjs/collection/collection-store.d.cts +2 -2
- package/cjs/collection/collection-store.d.ts +2 -2
- package/cjs/combobox/combobox-store.cjs +16 -7
- package/cjs/combobox/combobox-store.d.cts +5 -5
- package/cjs/combobox/combobox-store.d.ts +5 -5
- package/cjs/composite/composite-overflow-store.d.cts +2 -2
- package/cjs/composite/composite-overflow-store.d.ts +2 -2
- package/cjs/composite/composite-store.cjs +4 -4
- package/cjs/composite/composite-store.d.cts +3 -3
- package/cjs/composite/composite-store.d.ts +3 -3
- package/cjs/dialog/dialog-store.d.cts +2 -2
- package/cjs/dialog/dialog-store.d.ts +2 -2
- package/cjs/disclosure/disclosure-store.d.cts +2 -2
- package/cjs/disclosure/disclosure-store.d.ts +2 -2
- package/cjs/form/form-store.cjs +3 -3
- package/cjs/form/form-store.d.cts +4 -4
- package/cjs/form/form-store.d.ts +4 -4
- package/cjs/form/types.d.cts +3 -3
- package/cjs/form/types.d.ts +3 -3
- package/cjs/hovercard/hovercard-store.d.cts +3 -3
- package/cjs/hovercard/hovercard-store.d.ts +3 -3
- package/cjs/menu/menu-bar-store.cjs +5 -5
- package/cjs/menu/menu-bar-store.d.cts +2 -2
- package/cjs/menu/menu-bar-store.d.ts +2 -2
- package/cjs/menu/menu-store.cjs +4 -4
- package/cjs/menu/menu-store.d.cts +6 -6
- package/cjs/menu/menu-store.d.ts +6 -6
- package/cjs/menubar/menubar-store.cjs +5 -5
- package/cjs/menubar/menubar-store.d.cts +2 -2
- package/cjs/menubar/menubar-store.d.ts +2 -2
- package/cjs/popover/popover-store.d.cts +3 -3
- package/cjs/popover/popover-store.d.ts +3 -3
- package/cjs/radio/radio-store.cjs +4 -4
- package/cjs/radio/radio-store.d.cts +3 -3
- package/cjs/radio/radio-store.d.ts +3 -3
- package/cjs/select/select-store.cjs +16 -6
- package/cjs/select/select-store.d.cts +17 -9
- package/cjs/select/select-store.d.ts +17 -9
- package/cjs/tab/tab-store.cjs +45 -12
- package/cjs/tab/tab-store.d.cts +7 -6
- package/cjs/tab/tab-store.d.ts +7 -6
- package/cjs/tag/tag-store.cjs +4 -4
- package/cjs/tag/tag-store.d.cts +3 -3
- package/cjs/tag/tag-store.d.ts +3 -3
- package/cjs/toolbar/toolbar-store.cjs +4 -4
- package/cjs/toolbar/toolbar-store.d.cts +2 -2
- package/cjs/toolbar/toolbar-store.d.ts +2 -2
- package/cjs/tooltip/tooltip-store.d.cts +2 -2
- package/cjs/tooltip/tooltip-store.d.ts +2 -2
- package/cjs/utils/dom.cjs +2 -6
- package/cjs/utils/dom.d.cts +1 -17
- package/cjs/utils/dom.d.ts +1 -17
- package/cjs/utils/events.cjs +20 -15
- package/cjs/utils/events.d.cts +1 -1
- package/cjs/utils/events.d.ts +1 -1
- package/cjs/utils/focus.cjs +13 -15
- package/cjs/utils/focus.d.cts +1 -1
- package/cjs/utils/focus.d.ts +1 -1
- package/cjs/utils/misc.d.cts +1 -1
- package/cjs/utils/misc.d.ts +1 -1
- package/cjs/utils/platform.cjs +3 -3
- package/cjs/utils/store.d.cts +3 -3
- package/cjs/utils/store.d.ts +3 -3
- package/esm/__chunks/{QAI5BPCY.js → CLSHHUGK.js} +1 -1
- package/esm/__chunks/{ABMC67JW.js → EQPTKGFA.js} +1 -1
- package/esm/__chunks/{IUORCTET.js → I2NJJ3XW.js} +3 -21
- package/esm/__chunks/{K7A7LTR3.js → P3MTNH46.js} +1 -1
- package/esm/__chunks/{YVUNPQHS.js → PBSSD2DM.js} +1 -1
- package/esm/checkbox/checkbox-store.d.ts +2 -2
- package/esm/collection/collection-store.d.ts +2 -2
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-store.d.ts +5 -5
- package/esm/combobox/combobox-store.js +16 -7
- package/esm/composite/composite-overflow-store.d.ts +2 -2
- package/esm/composite/composite-store.d.ts +3 -3
- package/esm/composite/composite-store.js +3 -3
- package/esm/dialog/dialog-store.d.ts +2 -2
- package/esm/disclosure/disclosure-store.d.ts +2 -2
- package/esm/form/form-store.d.ts +4 -4
- package/esm/form/form-store.js +2 -2
- package/esm/form/types.d.ts +3 -3
- package/esm/hovercard/hovercard-store.d.ts +3 -3
- package/esm/menu/menu-bar-store.d.ts +2 -2
- package/esm/menu/menu-bar-store.js +4 -4
- package/esm/menu/menu-store.d.ts +6 -6
- package/esm/menu/menu-store.js +3 -3
- package/esm/menubar/menubar-store.d.ts +2 -2
- package/esm/menubar/menubar-store.js +4 -4
- package/esm/popover/popover-store.d.ts +3 -3
- package/esm/radio/radio-store.d.ts +3 -3
- package/esm/radio/radio-store.js +3 -3
- package/esm/select/select-store.d.ts +17 -9
- package/esm/select/select-store.js +15 -5
- package/esm/tab/tab-store.d.ts +7 -6
- package/esm/tab/tab-store.js +43 -10
- package/esm/tag/tag-store.d.ts +3 -3
- package/esm/tag/tag-store.js +3 -3
- package/esm/toolbar/toolbar-store.d.ts +2 -2
- package/esm/toolbar/toolbar-store.js +3 -3
- package/esm/tooltip/tooltip-store.d.ts +2 -2
- package/esm/utils/dom.d.ts +1 -17
- package/esm/utils/dom.js +1 -5
- package/esm/utils/events.d.ts +1 -1
- package/esm/utils/events.js +17 -12
- package/esm/utils/focus.d.ts +1 -1
- package/esm/utils/focus.js +5 -7
- package/esm/utils/misc.d.ts +1 -1
- package/esm/utils/platform.js +2 -2
- package/esm/utils/store.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createMenubarStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/P3MTNH46.js";
|
|
5
|
+
import "../__chunks/PBSSD2DM.js";
|
|
6
|
+
import "../__chunks/EQPTKGFA.js";
|
|
7
7
|
import "../__chunks/7PRQYBBV.js";
|
|
8
8
|
import "../__chunks/R676XYVY.js";
|
|
9
9
|
import "../__chunks/22HHDS5F.js";
|
|
10
|
-
import "../__chunks/
|
|
10
|
+
import "../__chunks/I2NJJ3XW.js";
|
|
11
11
|
import "../__chunks/4R3V3JGP.js";
|
|
12
12
|
|
|
13
13
|
// src/menu/menu-bar-store.ts
|
package/esm/menu/menu-store.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ComboboxStore } from "../combobox/combobox-store.
|
|
2
|
-
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.
|
|
3
|
-
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.
|
|
4
|
-
import type { Store, StoreOptions, StoreProps } from "../utils/store.
|
|
5
|
-
import type { BivariantCallback, PickRequired, SetState, SetStateAction } from "../utils/types.
|
|
6
|
-
import type { MenuBarStore } from "./menu-bar-store.
|
|
1
|
+
import type { ComboboxStore } from "../combobox/combobox-store.ts";
|
|
2
|
+
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.ts";
|
|
3
|
+
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.ts";
|
|
4
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
5
|
+
import type { BivariantCallback, PickRequired, SetState, SetStateAction } from "../utils/types.ts";
|
|
6
|
+
import type { MenuBarStore } from "./menu-bar-store.ts";
|
|
7
7
|
export declare function createMenuStore<T extends MenuStoreValues = MenuStoreValues>(props: PickRequired<MenuStoreProps<T>, "values" | "defaultValues">): MenuStore<T>;
|
|
8
8
|
export declare function createMenuStore(props?: MenuStoreProps): MenuStore;
|
|
9
9
|
export type MenuStoreValues = Record<string, string | boolean | number | Array<string | number>>;
|
package/esm/menu/menu-store.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "../__chunks/BRS7GKWU.js";
|
|
5
5
|
import {
|
|
6
6
|
createCompositeStore
|
|
7
|
-
} from "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
7
|
+
} from "../__chunks/PBSSD2DM.js";
|
|
8
|
+
import "../__chunks/EQPTKGFA.js";
|
|
9
9
|
import "../__chunks/7PRQYBBV.js";
|
|
10
10
|
import "../__chunks/MFZZDIHG.js";
|
|
11
11
|
import "../__chunks/5RJNXXU2.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
applyState,
|
|
24
24
|
defaultValue
|
|
25
25
|
} from "../__chunks/22HHDS5F.js";
|
|
26
|
-
import "../__chunks/
|
|
26
|
+
import "../__chunks/I2NJJ3XW.js";
|
|
27
27
|
import {
|
|
28
28
|
__objRest,
|
|
29
29
|
__spreadProps,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.
|
|
2
|
-
import type { Store, StoreProps } from "../utils/store.
|
|
1
|
+
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.ts";
|
|
2
|
+
import type { Store, StoreProps } from "../utils/store.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a menubar store.
|
|
5
5
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createMenubarStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/P3MTNH46.js";
|
|
5
|
+
import "../__chunks/PBSSD2DM.js";
|
|
6
|
+
import "../__chunks/EQPTKGFA.js";
|
|
7
7
|
import "../__chunks/7PRQYBBV.js";
|
|
8
8
|
import "../__chunks/R676XYVY.js";
|
|
9
9
|
import "../__chunks/22HHDS5F.js";
|
|
10
|
-
import "../__chunks/
|
|
10
|
+
import "../__chunks/I2NJJ3XW.js";
|
|
11
11
|
import "../__chunks/4R3V3JGP.js";
|
|
12
12
|
export {
|
|
13
13
|
createMenubarStore
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DialogStoreFunctions, DialogStoreOptions, DialogStoreState } from "../dialog/dialog-store.
|
|
2
|
-
import type { Store, StoreOptions, StoreProps } from "../utils/store.
|
|
3
|
-
import type { SetState } from "../utils/types.
|
|
1
|
+
import type { DialogStoreFunctions, DialogStoreOptions, DialogStoreState } from "../dialog/dialog-store.ts";
|
|
2
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
3
|
+
import type { SetState } from "../utils/types.ts";
|
|
4
4
|
type BasePlacement = "top" | "bottom" | "left" | "right";
|
|
5
5
|
type Placement = BasePlacement | `${BasePlacement}-start` | `${BasePlacement}-end`;
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.
|
|
2
|
-
import type { Store, StoreOptions, StoreProps } from "../utils/store.
|
|
3
|
-
import type { SetState } from "../utils/types.
|
|
1
|
+
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.ts";
|
|
2
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
3
|
+
import type { SetState } from "../utils/types.ts";
|
|
4
4
|
/**
|
|
5
5
|
* Creates a radio store.
|
|
6
6
|
*/
|
package/esm/radio/radio-store.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/PBSSD2DM.js";
|
|
5
|
+
import "../__chunks/EQPTKGFA.js";
|
|
6
6
|
import "../__chunks/7PRQYBBV.js";
|
|
7
7
|
import {
|
|
8
8
|
createStore
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
defaultValue
|
|
12
12
|
} from "../__chunks/22HHDS5F.js";
|
|
13
|
-
import "../__chunks/
|
|
13
|
+
import "../__chunks/I2NJJ3XW.js";
|
|
14
14
|
import {
|
|
15
15
|
__objRest,
|
|
16
16
|
__spreadProps,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ComboboxStore } from "../combobox/combobox-store.
|
|
2
|
-
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.
|
|
3
|
-
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.
|
|
4
|
-
import type { Store, StoreOptions, StoreProps } from "../utils/store.
|
|
5
|
-
import type { PickRequired, SetState } from "../utils/types.
|
|
1
|
+
import type { ComboboxStore } from "../combobox/combobox-store.ts";
|
|
2
|
+
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.ts";
|
|
3
|
+
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.ts";
|
|
4
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
5
|
+
import type { PickRequired, SetState } from "../utils/types.ts";
|
|
6
6
|
type MutableValue<T extends SelectStoreValue = SelectStoreValue> = T extends string ? string : T;
|
|
7
7
|
export declare function createSelectStore<T extends SelectStoreValue = SelectStoreValue>(props: PickRequired<SelectStoreProps<T>, "value" | "defaultValue">): SelectStore<T>;
|
|
8
8
|
export declare function createSelectStore(props?: SelectStoreProps): SelectStore;
|
|
@@ -46,6 +46,10 @@ export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue>
|
|
|
46
46
|
* @default false
|
|
47
47
|
*/
|
|
48
48
|
setValueOnMove: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The select label element.
|
|
51
|
+
*/
|
|
52
|
+
labelElement: HTMLElement | null;
|
|
49
53
|
/**
|
|
50
54
|
* The select button element.
|
|
51
55
|
*
|
|
@@ -54,9 +58,9 @@ export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue>
|
|
|
54
58
|
*/
|
|
55
59
|
selectElement: HTMLElement | null;
|
|
56
60
|
/**
|
|
57
|
-
* The select
|
|
61
|
+
* The select list element.
|
|
58
62
|
*/
|
|
59
|
-
|
|
63
|
+
listElement: HTMLElement | null;
|
|
60
64
|
}
|
|
61
65
|
export interface SelectStoreFunctions<T extends SelectStoreValue = SelectStoreValue> extends Pick<SelectStoreOptions<T>, "combobox">, CompositeStoreFunctions<SelectStoreItem>, PopoverStoreFunctions {
|
|
62
66
|
/**
|
|
@@ -68,14 +72,18 @@ export interface SelectStoreFunctions<T extends SelectStoreValue = SelectStoreVa
|
|
|
68
72
|
* store.setValue((value) => value === "Apple" ? "Banana" : "Apple"));
|
|
69
73
|
*/
|
|
70
74
|
setValue: SetState<SelectStoreState<T>["value"]>;
|
|
75
|
+
/**
|
|
76
|
+
* Sets the `labelElement` state.
|
|
77
|
+
*/
|
|
78
|
+
setLabelElement: SetState<SelectStoreState<T>["labelElement"]>;
|
|
71
79
|
/**
|
|
72
80
|
* Sets the `selectElement` state.
|
|
73
81
|
*/
|
|
74
82
|
setSelectElement: SetState<SelectStoreState<T>["selectElement"]>;
|
|
75
83
|
/**
|
|
76
|
-
* Sets the `
|
|
84
|
+
* Sets the `listElement` state.
|
|
77
85
|
*/
|
|
78
|
-
|
|
86
|
+
setListElement: SetState<SelectStoreState<T>["listElement"]>;
|
|
79
87
|
}
|
|
80
88
|
export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValue> extends StoreOptions<SelectStoreState<T>, "virtualFocus" | "activeId" | "orientation" | "placement" | "value" | "setValueOnMove">, CompositeStoreOptions<SelectStoreItem>, PopoverStoreOptions {
|
|
81
89
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/PBSSD2DM.js";
|
|
5
|
+
import "../__chunks/EQPTKGFA.js";
|
|
6
6
|
import {
|
|
7
7
|
toArray
|
|
8
8
|
} from "../__chunks/7PRQYBBV.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
defaultValue
|
|
25
25
|
} from "../__chunks/22HHDS5F.js";
|
|
26
|
-
import "../__chunks/
|
|
26
|
+
import "../__chunks/I2NJJ3XW.js";
|
|
27
27
|
import {
|
|
28
28
|
__objRest,
|
|
29
29
|
__spreadProps,
|
|
@@ -98,8 +98,9 @@ function createSelectStore(_a = {}) {
|
|
|
98
98
|
syncState.setValueOnMove,
|
|
99
99
|
false
|
|
100
100
|
),
|
|
101
|
+
labelElement: defaultValue(syncState.labelElement, null),
|
|
101
102
|
selectElement: defaultValue(syncState.selectElement, null),
|
|
102
|
-
|
|
103
|
+
listElement: defaultValue(syncState.listElement, null)
|
|
103
104
|
});
|
|
104
105
|
const select = createStore(initialState, composite, popover, store);
|
|
105
106
|
setup(
|
|
@@ -117,6 +118,14 @@ function createSelectStore(_a = {}) {
|
|
|
117
118
|
select.setState("value", item.value);
|
|
118
119
|
})
|
|
119
120
|
);
|
|
121
|
+
setup(
|
|
122
|
+
select,
|
|
123
|
+
() => sync(select, ["mounted"], (state) => {
|
|
124
|
+
if (state.mounted)
|
|
125
|
+
return;
|
|
126
|
+
select.setState("activeId", initialState.activeId);
|
|
127
|
+
})
|
|
128
|
+
);
|
|
120
129
|
setup(
|
|
121
130
|
select,
|
|
122
131
|
() => sync(select, ["mounted", "items", "value"], (state) => {
|
|
@@ -157,8 +166,9 @@ function createSelectStore(_a = {}) {
|
|
|
157
166
|
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, composite), popover), select), {
|
|
158
167
|
combobox,
|
|
159
168
|
setValue: (value) => select.setState("value", value),
|
|
169
|
+
setLabelElement: (element) => select.setState("labelElement", element),
|
|
160
170
|
setSelectElement: (element) => select.setState("selectElement", element),
|
|
161
|
-
|
|
171
|
+
setListElement: (element) => select.setState("listElement", element)
|
|
162
172
|
});
|
|
163
173
|
}
|
|
164
174
|
export {
|
package/esm/tab/tab-store.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.
|
|
2
|
-
import type { ComboboxStore } from "../combobox/combobox-store.
|
|
3
|
-
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
1
|
+
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.ts";
|
|
2
|
+
import type { ComboboxStore } from "../combobox/combobox-store.ts";
|
|
3
|
+
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.ts";
|
|
4
|
+
import type { SelectStore } from "../select/select-store.ts";
|
|
5
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
6
|
+
import type { SetState } from "../utils/types.ts";
|
|
6
7
|
export declare function createTabStore({ composite: parentComposite, combobox, ...props }?: TabStoreProps): TabStore;
|
|
7
8
|
export interface TabStoreItem extends CompositeStoreItem {
|
|
8
9
|
dimmed?: boolean;
|
|
@@ -85,7 +86,7 @@ export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientatio
|
|
|
85
86
|
* [Select](https://ariakit.org/components/select). The stores will share the
|
|
86
87
|
* same state.
|
|
87
88
|
*/
|
|
88
|
-
composite?: CompositeStore | null;
|
|
89
|
+
composite?: CompositeStore | SelectStore | null;
|
|
89
90
|
/**
|
|
90
91
|
* A reference to a [combobox
|
|
91
92
|
* store](https://ariakit.org/reference/use-combobox-store). This is used when
|
package/esm/tab/tab-store.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
4
|
+
} from "../__chunks/PBSSD2DM.js";
|
|
5
5
|
import {
|
|
6
6
|
createCollectionStore
|
|
7
|
-
} from "../__chunks/
|
|
7
|
+
} from "../__chunks/EQPTKGFA.js";
|
|
8
8
|
import "../__chunks/7PRQYBBV.js";
|
|
9
9
|
import {
|
|
10
10
|
batch,
|
|
@@ -15,9 +15,10 @@ import {
|
|
|
15
15
|
sync
|
|
16
16
|
} from "../__chunks/R676XYVY.js";
|
|
17
17
|
import {
|
|
18
|
+
chain,
|
|
18
19
|
defaultValue
|
|
19
20
|
} from "../__chunks/22HHDS5F.js";
|
|
20
|
-
import "../__chunks/
|
|
21
|
+
import "../__chunks/I2NJJ3XW.js";
|
|
21
22
|
import {
|
|
22
23
|
__objRest,
|
|
23
24
|
__spreadProps,
|
|
@@ -38,6 +39,8 @@ function createTabStore(_a = {}) {
|
|
|
38
39
|
"renderedItems",
|
|
39
40
|
"moves",
|
|
40
41
|
"orientation",
|
|
42
|
+
"virtualFocus",
|
|
43
|
+
"includesBaseElement",
|
|
41
44
|
"baseElement",
|
|
42
45
|
"focusLoop",
|
|
43
46
|
"focusShift",
|
|
@@ -50,6 +53,16 @@ function createTabStore(_a = {}) {
|
|
|
50
53
|
);
|
|
51
54
|
const syncState = store == null ? void 0 : store.getState();
|
|
52
55
|
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
|
|
56
|
+
store,
|
|
57
|
+
// We need to explicitly set the default value of `includesBaseElement` to
|
|
58
|
+
// `false` since we don't want the composite store to default it to `true`
|
|
59
|
+
// when the activeId state is null, which could be the case when rendering
|
|
60
|
+
// combobox with tab.
|
|
61
|
+
includesBaseElement: defaultValue(
|
|
62
|
+
props.includesBaseElement,
|
|
63
|
+
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
64
|
+
false
|
|
65
|
+
),
|
|
53
66
|
orientation: defaultValue(
|
|
54
67
|
props.orientation,
|
|
55
68
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -62,8 +75,7 @@ function createTabStore(_a = {}) {
|
|
|
62
75
|
selectedId: defaultValue(
|
|
63
76
|
props.selectedId,
|
|
64
77
|
syncState == null ? void 0 : syncState.selectedId,
|
|
65
|
-
props.defaultSelectedId
|
|
66
|
-
void 0
|
|
78
|
+
props.defaultSelectedId
|
|
67
79
|
),
|
|
68
80
|
selectOnMove: defaultValue(
|
|
69
81
|
props.selectOnMove,
|
|
@@ -92,11 +104,11 @@ function createTabStore(_a = {}) {
|
|
|
92
104
|
);
|
|
93
105
|
setup(
|
|
94
106
|
tab,
|
|
95
|
-
() => batch(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
107
|
+
() => batch(tab, ["selectedId"], (state, prev) => {
|
|
108
|
+
if (parentComposite && state.selectedId === prev.selectedId)
|
|
109
|
+
return;
|
|
110
|
+
tab.setState("activeId", state.selectedId);
|
|
111
|
+
})
|
|
100
112
|
);
|
|
101
113
|
setup(
|
|
102
114
|
tab,
|
|
@@ -137,6 +149,27 @@ function createTabStore(_a = {}) {
|
|
|
137
149
|
});
|
|
138
150
|
})
|
|
139
151
|
);
|
|
152
|
+
let selectedIdFromSelectedValue = null;
|
|
153
|
+
setup(tab, () => {
|
|
154
|
+
const backupSelectedId = () => {
|
|
155
|
+
selectedIdFromSelectedValue = tab.getState().selectedId;
|
|
156
|
+
};
|
|
157
|
+
const restoreSelectedId = () => {
|
|
158
|
+
tab.setState("selectedId", selectedIdFromSelectedValue);
|
|
159
|
+
};
|
|
160
|
+
if (parentComposite && "setSelectElement" in parentComposite) {
|
|
161
|
+
return chain(
|
|
162
|
+
sync(parentComposite, ["value"], backupSelectedId),
|
|
163
|
+
sync(parentComposite, ["open"], restoreSelectedId)
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
if (!combobox)
|
|
167
|
+
return;
|
|
168
|
+
return chain(
|
|
169
|
+
sync(combobox, ["selectedValue"], backupSelectedId),
|
|
170
|
+
sync(combobox, ["open"], restoreSelectedId)
|
|
171
|
+
);
|
|
172
|
+
});
|
|
140
173
|
return __spreadProps(__spreadValues(__spreadValues({}, composite), tab), {
|
|
141
174
|
panels,
|
|
142
175
|
setSelectedId: (id) => tab.setState("selectedId", id),
|
package/esm/tag/tag-store.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.
|
|
2
|
-
import type { Store, StoreOptions, StoreProps } from "../utils/store.
|
|
3
|
-
import type { SetState } from "../utils/types.
|
|
1
|
+
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.ts";
|
|
2
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
3
|
+
import type { SetState } from "../utils/types.ts";
|
|
4
4
|
/**
|
|
5
5
|
* Creates a tag store.
|
|
6
6
|
*/
|
package/esm/tag/tag-store.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/PBSSD2DM.js";
|
|
5
|
+
import "../__chunks/EQPTKGFA.js";
|
|
6
6
|
import "../__chunks/7PRQYBBV.js";
|
|
7
7
|
import {
|
|
8
8
|
UndoManager
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
applyState,
|
|
17
17
|
defaultValue
|
|
18
18
|
} from "../__chunks/22HHDS5F.js";
|
|
19
|
-
import "../__chunks/
|
|
19
|
+
import "../__chunks/I2NJJ3XW.js";
|
|
20
20
|
import {
|
|
21
21
|
__spreadProps,
|
|
22
22
|
__spreadValues
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.
|
|
2
|
-
import type { Store, StoreOptions, StoreProps } from "../utils/store.
|
|
1
|
+
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.ts";
|
|
2
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a toolbar store.
|
|
5
5
|
*/
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/PBSSD2DM.js";
|
|
5
|
+
import "../__chunks/EQPTKGFA.js";
|
|
6
6
|
import "../__chunks/7PRQYBBV.js";
|
|
7
7
|
import "../__chunks/R676XYVY.js";
|
|
8
8
|
import {
|
|
9
9
|
defaultValue
|
|
10
10
|
} from "../__chunks/22HHDS5F.js";
|
|
11
|
-
import "../__chunks/
|
|
11
|
+
import "../__chunks/I2NJJ3XW.js";
|
|
12
12
|
import {
|
|
13
13
|
__spreadProps,
|
|
14
14
|
__spreadValues
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.
|
|
2
|
-
import type { Store, StoreOptions, StoreProps } from "../utils/store.
|
|
1
|
+
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.ts";
|
|
2
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a tooltip store.
|
|
5
5
|
*/
|
package/esm/utils/dom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AriaHasPopup, AriaRole } from "./types.
|
|
1
|
+
import type { AriaHasPopup, AriaRole } from "./types.ts";
|
|
2
2
|
/**
|
|
3
3
|
* It's `true` if it is running in a browser environment or `false` if it is not
|
|
4
4
|
* (SSR).
|
|
@@ -45,26 +45,10 @@ export declare function isButton(element: {
|
|
|
45
45
|
tagName: string;
|
|
46
46
|
type?: string;
|
|
47
47
|
}): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Ponyfill for `Element.prototype.matches`
|
|
50
|
-
*
|
|
51
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
52
|
-
*/
|
|
53
|
-
export declare function matches(element: Element, selectors: string): boolean;
|
|
54
48
|
/**
|
|
55
49
|
* Checks if the element is visible or not.
|
|
56
50
|
*/
|
|
57
51
|
export declare function isVisible(element: Element): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Ponyfill for `Element.prototype.closest`
|
|
60
|
-
* @example
|
|
61
|
-
* closest(document.getElementById("id"), "div");
|
|
62
|
-
* // same as
|
|
63
|
-
* document.getElementById("id").closest("div");
|
|
64
|
-
*/
|
|
65
|
-
export declare function closest<K extends keyof HTMLElementTagNameMap>(element: Element, selectors: K): HTMLElementTagNameMap[K];
|
|
66
|
-
export declare function closest<K extends keyof SVGElementTagNameMap>(element: Element, selectors: K): SVGElementTagNameMap[K];
|
|
67
|
-
export declare function closest<T extends Element = Element>(element: Element, selectors: string): T | null;
|
|
68
52
|
/**
|
|
69
53
|
* Check whether the given element is a text field, where text field is defined
|
|
70
54
|
* by the ability to select within the input.
|
package/esm/utils/dom.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
canUseDOM,
|
|
4
|
-
closest,
|
|
5
4
|
contains,
|
|
6
5
|
getActiveElement,
|
|
7
6
|
getDocument,
|
|
@@ -17,14 +16,12 @@ import {
|
|
|
17
16
|
isTextField,
|
|
18
17
|
isTextbox,
|
|
19
18
|
isVisible,
|
|
20
|
-
matches,
|
|
21
19
|
scrollIntoViewIfNeeded,
|
|
22
20
|
setSelectionRange
|
|
23
|
-
} from "../__chunks/
|
|
21
|
+
} from "../__chunks/I2NJJ3XW.js";
|
|
24
22
|
import "../__chunks/4R3V3JGP.js";
|
|
25
23
|
export {
|
|
26
24
|
canUseDOM,
|
|
27
|
-
closest,
|
|
28
25
|
contains,
|
|
29
26
|
getActiveElement,
|
|
30
27
|
getDocument,
|
|
@@ -40,7 +37,6 @@ export {
|
|
|
40
37
|
isTextField,
|
|
41
38
|
isTextbox,
|
|
42
39
|
isVisible,
|
|
43
|
-
matches,
|
|
44
40
|
scrollIntoViewIfNeeded,
|
|
45
41
|
setSelectionRange
|
|
46
42
|
};
|
package/esm/utils/events.d.ts
CHANGED
|
@@ -71,6 +71,6 @@ export declare function getInputType(event: Event | {
|
|
|
71
71
|
/**
|
|
72
72
|
* Runs a callback on the next animation frame, but before a certain event.
|
|
73
73
|
*/
|
|
74
|
-
export declare function queueBeforeEvent(element: Element, type: string, callback: () => void):
|
|
74
|
+
export declare function queueBeforeEvent(element: Element, type: string, callback: () => void, timeout?: number): () => void;
|
|
75
75
|
export declare function addGlobalEventListener<K extends keyof DocumentEventMap>(type: K, listener: (event: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions, scope?: Window): () => void;
|
|
76
76
|
export declare function addGlobalEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions, scope?: Window): () => void;
|
package/esm/utils/events.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
isApple
|
|
4
|
-
} from "../__chunks/
|
|
4
|
+
} from "../__chunks/CLSHHUGK.js";
|
|
5
5
|
import {
|
|
6
6
|
contains
|
|
7
|
-
} from "../__chunks/
|
|
7
|
+
} from "../__chunks/I2NJJ3XW.js";
|
|
8
8
|
import {
|
|
9
9
|
__spreadProps,
|
|
10
10
|
__spreadValues
|
|
@@ -93,20 +93,25 @@ function getInputType(event) {
|
|
|
93
93
|
return;
|
|
94
94
|
return nativeEvent.inputType;
|
|
95
95
|
}
|
|
96
|
-
function queueBeforeEvent(element, type, callback) {
|
|
97
|
-
const
|
|
98
|
-
|
|
96
|
+
function queueBeforeEvent(element, type, callback, timeout) {
|
|
97
|
+
const createTimer = (callback2) => {
|
|
98
|
+
if (timeout) {
|
|
99
|
+
const timerId2 = setTimeout(callback2, timeout);
|
|
100
|
+
return () => clearTimeout(timerId2);
|
|
101
|
+
}
|
|
102
|
+
const timerId = requestAnimationFrame(callback2);
|
|
103
|
+
return () => cancelAnimationFrame(timerId);
|
|
104
|
+
};
|
|
105
|
+
const cancelTimer = createTimer(() => {
|
|
106
|
+
element.removeEventListener(type, callSync, true);
|
|
99
107
|
callback();
|
|
100
108
|
});
|
|
101
|
-
const
|
|
102
|
-
|
|
109
|
+
const callSync = () => {
|
|
110
|
+
cancelTimer();
|
|
103
111
|
callback();
|
|
104
112
|
};
|
|
105
|
-
element.addEventListener(type,
|
|
106
|
-
|
|
107
|
-
capture: true
|
|
108
|
-
});
|
|
109
|
-
return raf;
|
|
113
|
+
element.addEventListener(type, callSync, { once: true, capture: true });
|
|
114
|
+
return cancelTimer;
|
|
110
115
|
}
|
|
111
116
|
function addGlobalEventListener(type, listener, options, scope = window) {
|
|
112
117
|
const children = [];
|
package/esm/utils/focus.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* isFocusable(document.querySelector("input[hidden]")); // false
|
|
7
7
|
* isFocusable(document.querySelector("input:disabled")); // false
|
|
8
8
|
*/
|
|
9
|
-
export declare function isFocusable(element: Element):
|
|
9
|
+
export declare function isFocusable(element: Element): boolean;
|
|
10
10
|
/**
|
|
11
11
|
* Checks whether `element` is tabbable or not.
|
|
12
12
|
* @example
|
package/esm/utils/focus.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
closest,
|
|
4
3
|
contains,
|
|
5
4
|
getActiveElement,
|
|
6
5
|
isFrame,
|
|
7
|
-
isVisible
|
|
8
|
-
|
|
9
|
-
} from "../__chunks/IUORCTET.js";
|
|
6
|
+
isVisible
|
|
7
|
+
} from "../__chunks/I2NJJ3XW.js";
|
|
10
8
|
import {
|
|
11
9
|
__spreadValues
|
|
12
10
|
} from "../__chunks/4R3V3JGP.js";
|
|
@@ -18,11 +16,11 @@ function hasNegativeTabIndex(element) {
|
|
|
18
16
|
return tabIndex < 0;
|
|
19
17
|
}
|
|
20
18
|
function isFocusable(element) {
|
|
21
|
-
if (!matches(
|
|
19
|
+
if (!element.matches(selector))
|
|
22
20
|
return false;
|
|
23
21
|
if (!isVisible(element))
|
|
24
22
|
return false;
|
|
25
|
-
if (closest(
|
|
23
|
+
if (element.closest("[inert]"))
|
|
26
24
|
return false;
|
|
27
25
|
return true;
|
|
28
26
|
}
|
|
@@ -164,7 +162,7 @@ function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
|
|
|
164
162
|
}
|
|
165
163
|
function getClosestFocusable(element) {
|
|
166
164
|
while (element && !isFocusable(element)) {
|
|
167
|
-
element = closest(
|
|
165
|
+
element = element.closest(selector);
|
|
168
166
|
}
|
|
169
167
|
return element || null;
|
|
170
168
|
}
|
package/esm/utils/misc.d.ts
CHANGED
package/esm/utils/platform.js
CHANGED