@ariakit/core 0.4.5 → 0.4.7
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 +12 -0
- package/cjs/__chunks/{QD2A4YF6.cjs → 3COGJMN3.cjs} +11 -11
- package/cjs/__chunks/{MHZQJPY3.cjs → 5BQ2XS3R.cjs} +4 -4
- package/cjs/__chunks/{2D5LEVE7.cjs → D7M2PCAQ.cjs} +6 -6
- package/cjs/__chunks/{LTLFSC4X.cjs → DIYYVJDK.cjs} +2 -2
- package/cjs/__chunks/{AETQC2AR.cjs → LAYUSNGM.cjs} +11 -11
- package/cjs/__chunks/{KL74MAHB.cjs → LBFF2BBK.cjs} +6 -6
- package/cjs/__chunks/{B4LYZ4EM.cjs → M2NNCFIJ.cjs} +13 -11
- package/cjs/__chunks/{5JEQEZFR.cjs → MB5TLEVH.cjs} +7 -7
- package/cjs/__chunks/{IMYW2UAC.cjs → Q2WCPTYS.cjs} +4 -22
- package/cjs/__chunks/{UEZLSKZ4.cjs → XVL5HZ27.cjs} +4 -4
- package/cjs/checkbox/checkbox-store.cjs +3 -3
- package/cjs/checkbox/checkbox-store.d.cts +2 -2
- package/cjs/checkbox/checkbox-store.d.ts +2 -2
- package/cjs/collection/collection-store.cjs +4 -4
- package/cjs/collection/collection-store.d.cts +2 -2
- package/cjs/collection/collection-store.d.ts +2 -2
- package/cjs/combobox/combobox-store.cjs +35 -26
- package/cjs/combobox/combobox-store.d.cts +7 -5
- package/cjs/combobox/combobox-store.d.ts +7 -5
- package/cjs/composite/composite-overflow-store.cjs +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 +5 -5
- package/cjs/composite/composite-store.d.cts +8 -4
- package/cjs/composite/composite-store.d.ts +8 -4
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/dialog/dialog-store.d.cts +2 -2
- package/cjs/dialog/dialog-store.d.ts +2 -2
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/disclosure/disclosure-store.d.cts +2 -2
- package/cjs/disclosure/disclosure-store.d.ts +2 -2
- package/cjs/form/form-store.cjs +8 -8
- 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.cjs +6 -6
- 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 +6 -6
- 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 +19 -19
- package/cjs/menu/menu-store.d.cts +6 -6
- package/cjs/menu/menu-store.d.ts +6 -6
- package/cjs/menubar/menubar-store.cjs +6 -6
- package/cjs/menubar/menubar-store.d.cts +2 -2
- package/cjs/menubar/menubar-store.d.ts +2 -2
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/popover/popover-store.d.cts +3 -3
- package/cjs/popover/popover-store.d.ts +3 -3
- package/cjs/radio/radio-store.cjs +6 -6
- package/cjs/radio/radio-store.d.cts +3 -3
- package/cjs/radio/radio-store.d.ts +3 -3
- package/cjs/select/select-store.cjs +31 -21
- package/cjs/select/select-store.d.cts +19 -9
- package/cjs/select/select-store.d.ts +19 -9
- package/cjs/tab/tab-store.cjs +58 -25
- package/cjs/tab/tab-store.d.cts +17 -10
- package/cjs/tab/tab-store.d.ts +17 -10
- package/cjs/tag/tag-store.cjs +8 -8
- package/cjs/tag/tag-store.d.cts +3 -3
- package/cjs/tag/tag-store.d.ts +3 -3
- package/cjs/toolbar/toolbar-store.cjs +5 -5
- package/cjs/toolbar/toolbar-store.d.cts +2 -2
- package/cjs/toolbar/toolbar-store.d.ts +2 -2
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- 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 +23 -16
- package/cjs/utils/events.d.cts +1 -1
- package/cjs/utils/events.d.ts +1 -1
- package/cjs/utils/focus.cjs +20 -18
- 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.cjs +2 -2
- 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/{BRS7GKWU.js → E4HA32QI.js} +2 -2
- package/esm/__chunks/{IUORCTET.js → I2NJJ3XW.js} +3 -21
- package/esm/__chunks/{ABMC67JW.js → I2WJ7JBQ.js} +2 -2
- package/esm/__chunks/{WCKXDMU7.js → KDSZSVV5.js} +1 -1
- package/esm/__chunks/{R676XYVY.js → KLPDXTDE.js} +13 -11
- package/esm/__chunks/{5RJNXXU2.js → NWACXGIN.js} +1 -1
- package/esm/__chunks/{K7A7LTR3.js → RCLYDUHE.js} +2 -2
- package/esm/__chunks/{MFZZDIHG.js → SAZZJI72.js} +2 -2
- package/esm/__chunks/{YVUNPQHS.js → VH2P7HEP.js} +2 -2
- package/esm/checkbox/checkbox-store.d.ts +2 -2
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.d.ts +2 -2
- package/esm/collection/collection-store.js +3 -3
- package/esm/combobox/combobox-store.d.ts +7 -5
- package/esm/combobox/combobox-store.js +20 -11
- package/esm/composite/composite-overflow-store.d.ts +2 -2
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-store.d.ts +8 -4
- package/esm/composite/composite-store.js +4 -4
- package/esm/dialog/dialog-store.d.ts +2 -2
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/disclosure/disclosure-store.d.ts +2 -2
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.d.ts +4 -4
- package/esm/form/form-store.js +3 -3
- package/esm/form/types.d.ts +3 -3
- package/esm/hovercard/hovercard-store.d.ts +3 -3
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.d.ts +2 -2
- package/esm/menu/menu-bar-store.js +5 -5
- package/esm/menu/menu-store.d.ts +6 -6
- package/esm/menu/menu-store.js +8 -8
- package/esm/menubar/menubar-store.d.ts +2 -2
- package/esm/menubar/menubar-store.js +5 -5
- package/esm/popover/popover-store.d.ts +3 -3
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.d.ts +3 -3
- package/esm/radio/radio-store.js +4 -4
- package/esm/select/select-store.d.ts +19 -9
- package/esm/select/select-store.js +19 -9
- package/esm/tab/tab-store.d.ts +17 -10
- package/esm/tab/tab-store.js +44 -11
- package/esm/tag/tag-store.d.ts +3 -3
- package/esm/tag/tag-store.js +4 -4
- package/esm/toolbar/toolbar-store.d.ts +2 -2
- package/esm/toolbar/toolbar-store.js +4 -4
- package/esm/tooltip/tooltip-store.d.ts +2 -2
- package/esm/tooltip/tooltip-store.js +5 -5
- 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 +20 -13
- package/esm/utils/focus.d.ts +1 -1
- package/esm/utils/focus.js +12 -10
- package/esm/utils/misc.d.ts +1 -1
- package/esm/utils/platform.js +2 -2
- package/esm/utils/store.d.ts +3 -3
- package/esm/utils/store.js +1 -1
- package/package.json +2 -2
- package/.eslintignore +0 -6
package/cjs/tab/tab-store.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _LBFF2BBKcjs = require('../__chunks/LBFF2BBK.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _3COGJMN3cjs = require('../__chunks/3COGJMN3.cjs');
|
|
8
8
|
require('../__chunks/ULSPM3Y3.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -13,11 +13,12 @@ require('../__chunks/ULSPM3Y3.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _M2NNCFIJcjs = require('../__chunks/M2NNCFIJ.cjs');
|
|
17
|
+
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
|
|
20
|
-
require('../__chunks/
|
|
21
|
+
require('../__chunks/Q2WCPTYS.cjs');
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
|
|
@@ -38,18 +39,30 @@ 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",
|
|
44
47
|
"focusWrap"
|
|
45
48
|
];
|
|
46
|
-
const store =
|
|
49
|
+
const store = _M2NNCFIJcjs.mergeStore.call(void 0,
|
|
47
50
|
props.store,
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
_M2NNCFIJcjs.omit.call(void 0, parentComposite, independentKeys),
|
|
52
|
+
_M2NNCFIJcjs.omit.call(void 0, combobox, independentKeys)
|
|
50
53
|
);
|
|
51
54
|
const syncState = store == null ? void 0 : store.getState();
|
|
52
|
-
const composite =
|
|
55
|
+
const composite = _LBFF2BBKcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, 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: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
62
|
+
props.includesBaseElement,
|
|
63
|
+
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
64
|
+
false
|
|
65
|
+
),
|
|
53
66
|
orientation: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
54
67
|
props.orientation,
|
|
55
68
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -57,13 +70,12 @@ function createTabStore(_a = {}) {
|
|
|
57
70
|
),
|
|
58
71
|
focusLoop: _EEDWPDM2cjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
59
72
|
}));
|
|
60
|
-
const panels =
|
|
73
|
+
const panels = _3COGJMN3cjs.createCollectionStore.call(void 0, );
|
|
61
74
|
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
|
|
62
75
|
selectedId: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
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: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
69
81
|
props.selectOnMove,
|
|
@@ -71,10 +83,10 @@ function createTabStore(_a = {}) {
|
|
|
71
83
|
true
|
|
72
84
|
)
|
|
73
85
|
});
|
|
74
|
-
const tab =
|
|
75
|
-
|
|
86
|
+
const tab = _M2NNCFIJcjs.createStore.call(void 0, initialState, composite, store);
|
|
87
|
+
_M2NNCFIJcjs.setup.call(void 0,
|
|
76
88
|
tab,
|
|
77
|
-
() =>
|
|
89
|
+
() => _M2NNCFIJcjs.sync.call(void 0, tab, ["moves"], () => {
|
|
78
90
|
const { activeId, selectOnMove } = tab.getState();
|
|
79
91
|
if (!selectOnMove)
|
|
80
92
|
return;
|
|
@@ -90,17 +102,17 @@ function createTabStore(_a = {}) {
|
|
|
90
102
|
tab.setState("selectedId", tabItem.id);
|
|
91
103
|
})
|
|
92
104
|
);
|
|
93
|
-
|
|
105
|
+
_M2NNCFIJcjs.setup.call(void 0,
|
|
94
106
|
tab,
|
|
95
|
-
() =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
107
|
+
() => _M2NNCFIJcjs.batch.call(void 0, tab, ["selectedId"], (state, prev) => {
|
|
108
|
+
if (parentComposite && state.selectedId === prev.selectedId)
|
|
109
|
+
return;
|
|
110
|
+
tab.setState("activeId", state.selectedId);
|
|
111
|
+
})
|
|
100
112
|
);
|
|
101
|
-
|
|
113
|
+
_M2NNCFIJcjs.setup.call(void 0,
|
|
102
114
|
tab,
|
|
103
|
-
() =>
|
|
115
|
+
() => _M2NNCFIJcjs.sync.call(void 0, tab, ["selectedId", "renderedItems"], (state) => {
|
|
104
116
|
if (state.selectedId !== void 0)
|
|
105
117
|
return;
|
|
106
118
|
const { activeId, renderedItems } = tab.getState();
|
|
@@ -115,13 +127,13 @@ function createTabStore(_a = {}) {
|
|
|
115
127
|
}
|
|
116
128
|
})
|
|
117
129
|
);
|
|
118
|
-
|
|
130
|
+
_M2NNCFIJcjs.setup.call(void 0,
|
|
119
131
|
tab,
|
|
120
|
-
() =>
|
|
132
|
+
() => _M2NNCFIJcjs.sync.call(void 0, tab, ["renderedItems"], (state) => {
|
|
121
133
|
const tabs = state.renderedItems;
|
|
122
134
|
if (!tabs.length)
|
|
123
135
|
return;
|
|
124
|
-
return
|
|
136
|
+
return _M2NNCFIJcjs.sync.call(void 0, panels, ["renderedItems"], (state2) => {
|
|
125
137
|
const items = state2.renderedItems;
|
|
126
138
|
const hasOrphanPanels = items.some((panel) => !panel.tabId);
|
|
127
139
|
if (!hasOrphanPanels)
|
|
@@ -137,6 +149,27 @@ function createTabStore(_a = {}) {
|
|
|
137
149
|
});
|
|
138
150
|
})
|
|
139
151
|
);
|
|
152
|
+
let selectedIdFromSelectedValue = null;
|
|
153
|
+
_M2NNCFIJcjs.setup.call(void 0, 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 _EEDWPDM2cjs.chain.call(void 0,
|
|
162
|
+
_M2NNCFIJcjs.sync.call(void 0, parentComposite, ["value"], backupSelectedId),
|
|
163
|
+
_M2NNCFIJcjs.sync.call(void 0, parentComposite, ["open"], restoreSelectedId)
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
if (!combobox)
|
|
167
|
+
return;
|
|
168
|
+
return _EEDWPDM2cjs.chain.call(void 0,
|
|
169
|
+
_M2NNCFIJcjs.sync.call(void 0, combobox, ["selectedValue"], backupSelectedId),
|
|
170
|
+
_M2NNCFIJcjs.sync.call(void 0, combobox, ["open"], restoreSelectedId)
|
|
171
|
+
);
|
|
172
|
+
});
|
|
140
173
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), tab), {
|
|
141
174
|
panels,
|
|
142
175
|
setSelectedId: (id) => tab.setState("selectedId", id),
|
package/cjs/tab/tab-store.d.cts
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;
|
|
@@ -21,16 +22,20 @@ export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
|
|
|
21
22
|
*
|
|
22
23
|
* Live examples:
|
|
23
24
|
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
24
|
-
* - [Combobox with
|
|
25
|
+
* - [Combobox with Tabs](https://ariakit.org/examples/combobox-tabs)
|
|
26
|
+
* - [Select with Combobox and
|
|
27
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
25
28
|
*/
|
|
26
29
|
selectedId: TabStoreState["activeId"];
|
|
27
30
|
/**
|
|
28
31
|
* Determines if the tab should be selected when it receives focus. If set to
|
|
29
|
-
* `false`, the tab will only be selected upon clicking, not when
|
|
30
|
-
*
|
|
32
|
+
* `false`, the tab will only be selected upon clicking, not when using arrow
|
|
33
|
+
* keys to shift focus.
|
|
31
34
|
*
|
|
32
35
|
* Live examples:
|
|
33
36
|
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
37
|
+
* - [Select with Combobox and
|
|
38
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
34
39
|
* @default true
|
|
35
40
|
*/
|
|
36
41
|
selectOnMove?: boolean;
|
|
@@ -85,7 +90,7 @@ export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientatio
|
|
|
85
90
|
* [Select](https://ariakit.org/components/select). The stores will share the
|
|
86
91
|
* same state.
|
|
87
92
|
*/
|
|
88
|
-
composite?: CompositeStore | null;
|
|
93
|
+
composite?: CompositeStore | SelectStore | null;
|
|
89
94
|
/**
|
|
90
95
|
* A reference to a [combobox
|
|
91
96
|
* store](https://ariakit.org/reference/use-combobox-store). This is used when
|
|
@@ -98,8 +103,10 @@ export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientatio
|
|
|
98
103
|
* will be automatically set to the first enabled tab.
|
|
99
104
|
*
|
|
100
105
|
* Live examples:
|
|
101
|
-
* - [Combobox with
|
|
106
|
+
* - [Combobox with Tabs](https://ariakit.org/examples/combobox-tabs)
|
|
102
107
|
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
108
|
+
* - [Select with Combobox and
|
|
109
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
103
110
|
*/
|
|
104
111
|
defaultSelectedId?: TabStoreState["selectedId"];
|
|
105
112
|
}
|
package/cjs/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;
|
|
@@ -21,16 +22,20 @@ export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
|
|
|
21
22
|
*
|
|
22
23
|
* Live examples:
|
|
23
24
|
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
24
|
-
* - [Combobox with
|
|
25
|
+
* - [Combobox with Tabs](https://ariakit.org/examples/combobox-tabs)
|
|
26
|
+
* - [Select with Combobox and
|
|
27
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
25
28
|
*/
|
|
26
29
|
selectedId: TabStoreState["activeId"];
|
|
27
30
|
/**
|
|
28
31
|
* Determines if the tab should be selected when it receives focus. If set to
|
|
29
|
-
* `false`, the tab will only be selected upon clicking, not when
|
|
30
|
-
*
|
|
32
|
+
* `false`, the tab will only be selected upon clicking, not when using arrow
|
|
33
|
+
* keys to shift focus.
|
|
31
34
|
*
|
|
32
35
|
* Live examples:
|
|
33
36
|
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
37
|
+
* - [Select with Combobox and
|
|
38
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
34
39
|
* @default true
|
|
35
40
|
*/
|
|
36
41
|
selectOnMove?: boolean;
|
|
@@ -85,7 +90,7 @@ export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientatio
|
|
|
85
90
|
* [Select](https://ariakit.org/components/select). The stores will share the
|
|
86
91
|
* same state.
|
|
87
92
|
*/
|
|
88
|
-
composite?: CompositeStore | null;
|
|
93
|
+
composite?: CompositeStore | SelectStore | null;
|
|
89
94
|
/**
|
|
90
95
|
* A reference to a [combobox
|
|
91
96
|
* store](https://ariakit.org/reference/use-combobox-store). This is used when
|
|
@@ -98,8 +103,10 @@ export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientatio
|
|
|
98
103
|
* will be automatically set to the first enabled tab.
|
|
99
104
|
*
|
|
100
105
|
* Live examples:
|
|
101
|
-
* - [Combobox with
|
|
106
|
+
* - [Combobox with Tabs](https://ariakit.org/examples/combobox-tabs)
|
|
102
107
|
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
108
|
+
* - [Select with Combobox and
|
|
109
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
103
110
|
*/
|
|
104
111
|
defaultSelectedId?: TabStoreState["selectedId"];
|
|
105
112
|
}
|
package/cjs/tag/tag-store.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
4
|
+
var _LBFF2BBKcjs = require('../__chunks/LBFF2BBK.cjs');
|
|
5
|
+
require('../__chunks/3COGJMN3.cjs');
|
|
6
6
|
require('../__chunks/ULSPM3Y3.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
@@ -11,12 +11,12 @@ var _LPDHSEHUcjs = require('../__chunks/LPDHSEHU.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _M2NNCFIJcjs = require('../__chunks/M2NNCFIJ.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
|
|
19
|
-
require('../__chunks/
|
|
19
|
+
require('../__chunks/Q2WCPTYS.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
26
26
|
function createTagStore(props = {}) {
|
|
27
27
|
var _a;
|
|
28
28
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
29
|
-
const composite =
|
|
29
|
+
const composite = _LBFF2BBKcjs.createCompositeStore.call(void 0, props);
|
|
30
30
|
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
|
|
31
31
|
inputElement: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.inputElement, null),
|
|
32
32
|
labelElement: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.labelElement, null),
|
|
@@ -38,10 +38,10 @@ function createTagStore(props = {}) {
|
|
|
38
38
|
[]
|
|
39
39
|
)
|
|
40
40
|
});
|
|
41
|
-
const tag =
|
|
42
|
-
|
|
41
|
+
const tag = _M2NNCFIJcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
42
|
+
_M2NNCFIJcjs.setup.call(void 0,
|
|
43
43
|
tag,
|
|
44
|
-
() =>
|
|
44
|
+
() => _M2NNCFIJcjs.sync.call(void 0, tag, ["inputElement", "activeId"], (state) => {
|
|
45
45
|
if (!state.inputElement)
|
|
46
46
|
return;
|
|
47
47
|
if (state.activeId !== void 0)
|
package/cjs/tag/tag-store.d.cts
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/cjs/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
|
*/
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
4
|
+
var _LBFF2BBKcjs = require('../__chunks/LBFF2BBK.cjs');
|
|
5
|
+
require('../__chunks/3COGJMN3.cjs');
|
|
6
6
|
require('../__chunks/ULSPM3Y3.cjs');
|
|
7
|
-
require('../__chunks/
|
|
7
|
+
require('../__chunks/M2NNCFIJ.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
|
|
11
|
-
require('../__chunks/
|
|
11
|
+
require('../__chunks/Q2WCPTYS.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
18
18
|
function createToolbarStore(props = {}) {
|
|
19
19
|
var _a;
|
|
20
20
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
21
|
-
return
|
|
21
|
+
return _LBFF2BBKcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
22
22
|
orientation: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
23
23
|
props.orientation,
|
|
24
24
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -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,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,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
4
|
+
var _XVL5HZ27cjs = require('../__chunks/XVL5HZ27.cjs');
|
|
5
|
+
require('../__chunks/MB5TLEVH.cjs');
|
|
6
|
+
require('../__chunks/DIYYVJDK.cjs');
|
|
7
|
+
require('../__chunks/LAYUSNGM.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _M2NNCFIJcjs = require('../__chunks/M2NNCFIJ.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
|
|
@@ -29,7 +29,7 @@ function createTooltipStore(props = {}) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
32
|
-
const hovercard =
|
|
32
|
+
const hovercard = _XVL5HZ27cjs.createHovercardStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
33
33
|
placement: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
34
34
|
props.placement,
|
|
35
35
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -41,7 +41,7 @@ function createTooltipStore(props = {}) {
|
|
|
41
41
|
type: _EEDWPDM2cjs.defaultValue.call(void 0, props.type, syncState == null ? void 0 : syncState.type, "description"),
|
|
42
42
|
skipTimeout: _EEDWPDM2cjs.defaultValue.call(void 0, props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
|
|
43
43
|
});
|
|
44
|
-
const tooltip =
|
|
44
|
+
const tooltip = _M2NNCFIJcjs.createStore.call(void 0, initialState, hovercard, props.store);
|
|
45
45
|
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, hovercard), tooltip);
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -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
|
*/
|
|
@@ -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/cjs/utils/dom.cjs
CHANGED
|
@@ -18,9 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _IMYW2UACcjs = require('../__chunks/IMYW2UAC.cjs');
|
|
21
|
+
var _Q2WCPTYScjs = require('../__chunks/Q2WCPTYS.cjs');
|
|
24
22
|
require('../__chunks/AV6KTKLE.cjs');
|
|
25
23
|
|
|
26
24
|
|
|
@@ -41,6 +39,4 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
41
39
|
|
|
42
40
|
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
exports.canUseDOM = _IMYW2UACcjs.canUseDOM; exports.closest = _IMYW2UACcjs.closest; exports.contains = _IMYW2UACcjs.contains; exports.getActiveElement = _IMYW2UACcjs.getActiveElement; exports.getDocument = _IMYW2UACcjs.getDocument; exports.getPopupItemRole = _IMYW2UACcjs.getPopupItemRole; exports.getPopupRole = _IMYW2UACcjs.getPopupRole; exports.getScrollingElement = _IMYW2UACcjs.getScrollingElement; exports.getTextboxSelection = _IMYW2UACcjs.getTextboxSelection; exports.getTextboxValue = _IMYW2UACcjs.getTextboxValue; exports.getWindow = _IMYW2UACcjs.getWindow; exports.isButton = _IMYW2UACcjs.isButton; exports.isFrame = _IMYW2UACcjs.isFrame; exports.isPartiallyHidden = _IMYW2UACcjs.isPartiallyHidden; exports.isTextField = _IMYW2UACcjs.isTextField; exports.isTextbox = _IMYW2UACcjs.isTextbox; exports.isVisible = _IMYW2UACcjs.isVisible; exports.matches = _IMYW2UACcjs.matches; exports.scrollIntoViewIfNeeded = _IMYW2UACcjs.scrollIntoViewIfNeeded; exports.setSelectionRange = _IMYW2UACcjs.setSelectionRange;
|
|
42
|
+
exports.canUseDOM = _Q2WCPTYScjs.canUseDOM; exports.contains = _Q2WCPTYScjs.contains; exports.getActiveElement = _Q2WCPTYScjs.getActiveElement; exports.getDocument = _Q2WCPTYScjs.getDocument; exports.getPopupItemRole = _Q2WCPTYScjs.getPopupItemRole; exports.getPopupRole = _Q2WCPTYScjs.getPopupRole; exports.getScrollingElement = _Q2WCPTYScjs.getScrollingElement; exports.getTextboxSelection = _Q2WCPTYScjs.getTextboxSelection; exports.getTextboxValue = _Q2WCPTYScjs.getTextboxValue; exports.getWindow = _Q2WCPTYScjs.getWindow; exports.isButton = _Q2WCPTYScjs.isButton; exports.isFrame = _Q2WCPTYScjs.isFrame; exports.isPartiallyHidden = _Q2WCPTYScjs.isPartiallyHidden; exports.isTextField = _Q2WCPTYScjs.isTextField; exports.isTextbox = _Q2WCPTYScjs.isTextbox; exports.isVisible = _Q2WCPTYScjs.isVisible; exports.scrollIntoViewIfNeeded = _Q2WCPTYScjs.scrollIntoViewIfNeeded; exports.setSelectionRange = _Q2WCPTYScjs.setSelectionRange;
|
package/cjs/utils/dom.d.cts
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/cjs/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/cjs/utils/events.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _D7M2PCAQcjs = require('../__chunks/D7M2PCAQ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _Q2WCPTYScjs = require('../__chunks/Q2WCPTYS.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
13
13
|
// src/utils/events.ts
|
|
14
14
|
function isPortalEvent(event) {
|
|
15
15
|
return Boolean(
|
|
16
|
-
event.currentTarget && !
|
|
16
|
+
event.currentTarget && !_Q2WCPTYScjs.contains.call(void 0, event.currentTarget, event.target)
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
function isSelfTarget(event) {
|
|
@@ -23,7 +23,7 @@ function isOpeningInNewTab(event) {
|
|
|
23
23
|
const element = event.currentTarget;
|
|
24
24
|
if (!element)
|
|
25
25
|
return false;
|
|
26
|
-
const isAppleDevice =
|
|
26
|
+
const isAppleDevice = _D7M2PCAQcjs.isApple.call(void 0, );
|
|
27
27
|
if (isAppleDevice && !event.metaKey)
|
|
28
28
|
return false;
|
|
29
29
|
if (!isAppleDevice && !event.ctrlKey)
|
|
@@ -81,7 +81,7 @@ function fireClickEvent(element, eventInit) {
|
|
|
81
81
|
function isFocusEventOutside(event, container) {
|
|
82
82
|
const containerElement = container || event.currentTarget;
|
|
83
83
|
const relatedTarget = event.relatedTarget;
|
|
84
|
-
return !relatedTarget || !
|
|
84
|
+
return !relatedTarget || !_Q2WCPTYScjs.contains.call(void 0, containerElement, relatedTarget);
|
|
85
85
|
}
|
|
86
86
|
function getInputType(event) {
|
|
87
87
|
const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event;
|
|
@@ -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 = [];
|
|
@@ -122,7 +127,9 @@ function addGlobalEventListener(type, listener, options, scope = window) {
|
|
|
122
127
|
scope.document.removeEventListener(type, listener, options);
|
|
123
128
|
} catch (e) {
|
|
124
129
|
}
|
|
125
|
-
|
|
130
|
+
for (const remove of children) {
|
|
131
|
+
remove();
|
|
132
|
+
}
|
|
126
133
|
};
|
|
127
134
|
return removeEventListener;
|
|
128
135
|
}
|
package/cjs/utils/events.d.cts
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/cjs/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;
|