@ariakit/core 0.1.4 → 0.2.0
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 +66 -0
- package/cjs/__chunks/{QYB6XH64.cjs → 27ZAGOYG.cjs} +17 -13
- package/cjs/__chunks/6455U47T.cjs +37 -0
- package/cjs/__chunks/{ZPOXPO2L.cjs → 6SPJEESB.cjs} +33 -21
- package/cjs/__chunks/CNODBYSG.cjs +58 -0
- package/cjs/__chunks/{2YFRPUZP.cjs → DBHIHK7C.cjs} +6 -6
- package/cjs/__chunks/{W5IHD6VG.cjs → EUJ6NNA6.cjs} +56 -43
- package/cjs/__chunks/{4DQ3OTE7.cjs → FXEBKN6G.cjs} +22 -17
- package/cjs/__chunks/{ZJEEK57E.cjs → HEFJPUYD.cjs} +2 -2
- package/cjs/__chunks/{QNEPGQLL.cjs → M6ZA7XUP.cjs} +6 -2
- package/cjs/__chunks/RD3S4VKY.cjs +60 -0
- package/cjs/__chunks/{OFNGELMA.cjs → ZNW4LSWU.cjs} +8 -6
- package/cjs/checkbox/checkbox-store.cjs +14 -10
- package/cjs/collection/collection-store.cjs +6 -5
- package/cjs/combobox/combobox-store.cjs +49 -48
- package/cjs/composite/composite-overflow-store.cjs +7 -6
- package/cjs/composite/composite-store.cjs +7 -6
- package/cjs/dialog/dialog-store.cjs +6 -5
- package/cjs/disclosure/disclosure-store.cjs +5 -4
- package/cjs/disclosure/disclosure-store.d.ts +8 -0
- package/cjs/form/form-store.cjs +38 -35
- package/cjs/hovercard/hovercard-store.cjs +8 -7
- package/cjs/hovercard/hovercard-store.d.ts +3 -2
- package/cjs/index.cjs +3 -1
- package/cjs/menu/menu-bar-store.cjs +17 -13
- package/cjs/menu/menu-store.cjs +41 -43
- package/cjs/popover/popover-store.cjs +7 -6
- package/cjs/popover/popover-store.d.ts +8 -89
- package/cjs/radio/radio-store.cjs +25 -24
- package/cjs/select/select-store.cjs +42 -42
- package/cjs/tab/tab-store.cjs +29 -28
- package/cjs/tab/tab-store.d.ts +9 -0
- package/cjs/toolbar/toolbar-store.cjs +17 -13
- package/cjs/tooltip/tooltip-store.cjs +31 -79
- package/cjs/tooltip/tooltip-store.d.ts +20 -15
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/cjs/utils/array.cjs +1 -0
- package/cjs/utils/dom.cjs +3 -2
- package/cjs/utils/events.cjs +14 -9
- package/cjs/utils/focus.cjs +24 -14
- package/cjs/utils/misc.cjs +3 -2
- package/cjs/utils/platform.cjs +4 -3
- package/cjs/utils/store.cjs +4 -3
- package/esm/__chunks/3BAGFTL5.js +58 -0
- package/esm/__chunks/4BKCJXBM.js +37 -0
- package/esm/__chunks/{NA5BK7DD.js → BOKMNDR7.js} +22 -10
- package/esm/__chunks/{WFGVC6LE.js → EWHSN7GO.js} +17 -12
- package/esm/__chunks/{4T5RHRE5.js → MNNKHNLW.js} +1 -1
- package/esm/__chunks/{UVCATTRC.js → N6JW4ITM.js} +7 -5
- package/esm/__chunks/{RMD7SNCC.js → NWU4GBZ6.js} +5 -1
- package/esm/__chunks/{X7MJ3FB5.js → R6VHFWTV.js} +49 -36
- package/esm/__chunks/{DXA3K2FY.js → TFBCK4JB.js} +1 -1
- package/esm/__chunks/Z5IDQSMV.js +60 -0
- package/esm/__chunks/{IOAGNCXX.js → ZV2GEGPL.js} +14 -10
- package/esm/checkbox/checkbox-store.js +11 -7
- package/esm/collection/collection-store.js +5 -4
- package/esm/combobox/combobox-store.js +34 -33
- package/esm/composite/composite-overflow-store.js +6 -5
- package/esm/composite/composite-store.js +6 -5
- package/esm/dialog/dialog-store.js +5 -4
- package/esm/disclosure/disclosure-store.d.ts +8 -0
- package/esm/disclosure/disclosure-store.js +4 -3
- package/esm/form/form-store.js +24 -21
- package/esm/hovercard/hovercard-store.d.ts +3 -2
- package/esm/hovercard/hovercard-store.js +7 -6
- package/esm/index.js +2 -0
- package/esm/menu/menu-bar-store.js +15 -11
- package/esm/menu/menu-store.js +31 -33
- package/esm/popover/popover-store.d.ts +8 -89
- package/esm/popover/popover-store.js +6 -5
- package/esm/radio/radio-store.js +22 -21
- package/esm/select/select-store.js +29 -29
- package/esm/tab/tab-store.d.ts +9 -0
- package/esm/tab/tab-store.js +23 -22
- package/esm/toolbar/toolbar-store.js +15 -11
- package/esm/tooltip/tooltip-store.d.ts +20 -15
- package/esm/tooltip/tooltip-store.js +32 -80
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/esm/utils/array.js +1 -0
- package/esm/utils/dom.js +2 -1
- package/esm/utils/events.js +10 -5
- package/esm/utils/focus.js +14 -4
- package/esm/utils/misc.js +2 -1
- package/esm/utils/platform.js +3 -2
- package/esm/utils/store.js +3 -2
- package/package.json +1 -1
- package/cjs/__chunks/DQHU5K4Q.cjs +0 -57
- package/cjs/__chunks/HLVPXX7H.cjs +0 -1491
- package/esm/__chunks/6HMPWUDT.js +0 -57
- package/esm/__chunks/6PEWNRTN.js +0 -1491
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
3
|
+
var _RD3S4VKYcjs = require('../__chunks/RD3S4VKY.cjs');
|
|
4
|
+
require('../__chunks/HEFJPUYD.cjs');
|
|
5
|
+
require('../__chunks/27ZAGOYG.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../__chunks/
|
|
8
|
+
var _EUJ6NNA6cjs = require('../__chunks/EUJ6NNA6.cjs');
|
|
9
|
+
require('../__chunks/FXEBKN6G.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _6SPJEESBcjs = require('../__chunks/6SPJEESB.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
require('../__chunks/
|
|
16
|
+
var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
|
|
17
|
+
require('../__chunks/ZNW4LSWU.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
var _GDZQUFNPcjs = require('../__chunks/GDZQUFNP.cjs');
|
|
21
21
|
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
|
|
26
|
+
|
|
22
27
|
// src/select/select-store.ts
|
|
23
|
-
function createSelectStore({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} =
|
|
27
|
-
|
|
28
|
+
function createSelectStore(_a = {}) {
|
|
29
|
+
var _b = _a, {
|
|
30
|
+
combobox
|
|
31
|
+
} = _b, props = _6455U47Tcjs.__objRest.call(void 0, _b, [
|
|
32
|
+
"combobox"
|
|
33
|
+
]);
|
|
34
|
+
const store = _6SPJEESBcjs.mergeStore.call(void 0,
|
|
28
35
|
props.store,
|
|
29
|
-
|
|
36
|
+
combobox == null ? void 0 : combobox.omit(
|
|
30
37
|
"value",
|
|
31
38
|
"items",
|
|
32
39
|
"renderedItems",
|
|
@@ -36,62 +43,58 @@ function createSelectStore({
|
|
|
36
43
|
"contentElement",
|
|
37
44
|
"popoverElement",
|
|
38
45
|
"disclosureElement"
|
|
39
|
-
)
|
|
46
|
+
)
|
|
40
47
|
);
|
|
41
48
|
const syncState = store.getState();
|
|
42
|
-
const composite =
|
|
43
|
-
...props,
|
|
49
|
+
const composite = _EUJ6NNA6cjs.createCompositeStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
44
50
|
store,
|
|
45
|
-
virtualFocus:
|
|
51
|
+
virtualFocus: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
46
52
|
props.virtualFocus,
|
|
47
53
|
syncState.virtualFocus,
|
|
48
54
|
true
|
|
49
55
|
),
|
|
50
|
-
includesBaseElement:
|
|
56
|
+
includesBaseElement: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
51
57
|
props.includesBaseElement,
|
|
52
58
|
syncState.includesBaseElement,
|
|
53
59
|
false
|
|
54
60
|
),
|
|
55
|
-
activeId:
|
|
61
|
+
activeId: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
56
62
|
props.activeId,
|
|
57
63
|
syncState.activeId,
|
|
58
64
|
props.defaultActiveId,
|
|
59
65
|
null
|
|
60
66
|
),
|
|
61
|
-
orientation:
|
|
67
|
+
orientation: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
62
68
|
props.orientation,
|
|
63
69
|
syncState.orientation,
|
|
64
70
|
"vertical"
|
|
65
71
|
)
|
|
66
|
-
});
|
|
67
|
-
const popover =
|
|
68
|
-
...props,
|
|
72
|
+
}));
|
|
73
|
+
const popover = _RD3S4VKYcjs.createPopoverStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
69
74
|
store,
|
|
70
|
-
placement:
|
|
75
|
+
placement: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
71
76
|
props.placement,
|
|
72
77
|
syncState.placement,
|
|
73
78
|
"bottom-start"
|
|
74
79
|
)
|
|
75
|
-
});
|
|
80
|
+
}));
|
|
76
81
|
const initialValue = new String("");
|
|
77
|
-
const initialState = {
|
|
78
|
-
|
|
79
|
-
...popover.getState(),
|
|
80
|
-
value: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
82
|
+
const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite.getState()), popover.getState()), {
|
|
83
|
+
value: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
81
84
|
props.value,
|
|
82
85
|
syncState.value,
|
|
83
86
|
props.defaultValue,
|
|
84
87
|
initialValue
|
|
85
88
|
),
|
|
86
|
-
setValueOnMove:
|
|
89
|
+
setValueOnMove: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
87
90
|
props.setValueOnMove,
|
|
88
91
|
syncState.setValueOnMove,
|
|
89
92
|
false
|
|
90
93
|
),
|
|
91
|
-
selectElement:
|
|
92
|
-
labelElement:
|
|
93
|
-
};
|
|
94
|
-
const select =
|
|
94
|
+
selectElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState.selectElement, null),
|
|
95
|
+
labelElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState.labelElement, null)
|
|
96
|
+
});
|
|
97
|
+
const select = _6SPJEESBcjs.createStore.call(void 0, initialState, composite, popover, store);
|
|
95
98
|
select.setup(
|
|
96
99
|
() => select.sync(
|
|
97
100
|
(state) => {
|
|
@@ -102,7 +105,7 @@ function createSelectStore({
|
|
|
102
105
|
const item = state.items.find(
|
|
103
106
|
(item2) => !item2.disabled && item2.value != null
|
|
104
107
|
);
|
|
105
|
-
if (
|
|
108
|
+
if ((item == null ? void 0 : item.value) == null)
|
|
106
109
|
return;
|
|
107
110
|
select.setState("value", item.value);
|
|
108
111
|
},
|
|
@@ -150,14 +153,11 @@ function createSelectStore({
|
|
|
150
153
|
["setValueOnMove", "moves"]
|
|
151
154
|
)
|
|
152
155
|
);
|
|
153
|
-
return {
|
|
154
|
-
...composite,
|
|
155
|
-
...popover,
|
|
156
|
-
...select,
|
|
156
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite), popover), select), {
|
|
157
157
|
setValue: (value) => select.setState("value", value),
|
|
158
158
|
setSelectElement: (element) => select.setState("selectElement", element),
|
|
159
159
|
setLabelElement: (element) => select.setState("labelElement", element)
|
|
160
|
-
};
|
|
160
|
+
});
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
|
package/cjs/tab/tab-store.cjs
CHANGED
|
@@ -1,46 +1,49 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _EUJ6NNA6cjs = require('../__chunks/EUJ6NNA6.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _FXEBKN6Gcjs = require('../__chunks/FXEBKN6G.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _6SPJEESBcjs = require('../__chunks/6SPJEESB.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
require('../__chunks/
|
|
12
|
+
var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
|
|
13
|
+
require('../__chunks/ZNW4LSWU.cjs');
|
|
14
14
|
require('../__chunks/GDZQUFNP.cjs');
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
|
|
19
|
+
|
|
16
20
|
// src/tab/tab-store.ts
|
|
17
21
|
function createTabStore(props = {}) {
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
orientation:
|
|
22
|
+
var _a;
|
|
23
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
24
|
+
const composite = _EUJ6NNA6cjs.createCompositeStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
25
|
+
orientation: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
22
26
|
props.orientation,
|
|
23
|
-
|
|
27
|
+
syncState == null ? void 0 : syncState.orientation,
|
|
24
28
|
"horizontal"
|
|
25
29
|
),
|
|
26
|
-
focusLoop:
|
|
27
|
-
});
|
|
28
|
-
const panels =
|
|
29
|
-
const initialState = {
|
|
30
|
-
|
|
31
|
-
selectedId: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
30
|
+
focusLoop: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
31
|
+
}));
|
|
32
|
+
const panels = _FXEBKN6Gcjs.createCollectionStore.call(void 0, );
|
|
33
|
+
const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite.getState()), {
|
|
34
|
+
selectedId: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
32
35
|
props.selectedId,
|
|
33
|
-
|
|
36
|
+
syncState == null ? void 0 : syncState.selectedId,
|
|
34
37
|
props.defaultSelectedId,
|
|
35
38
|
void 0
|
|
36
39
|
),
|
|
37
|
-
selectOnMove:
|
|
40
|
+
selectOnMove: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
38
41
|
props.selectOnMove,
|
|
39
|
-
|
|
42
|
+
syncState == null ? void 0 : syncState.selectOnMove,
|
|
40
43
|
true
|
|
41
44
|
)
|
|
42
|
-
};
|
|
43
|
-
const tab =
|
|
45
|
+
});
|
|
46
|
+
const tab = _6SPJEESBcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
44
47
|
tab.setup(
|
|
45
48
|
() => tab.sync(() => {
|
|
46
49
|
const { activeId, selectOnMove } = tab.getState();
|
|
@@ -77,7 +80,7 @@ function createTabStore(props = {}) {
|
|
|
77
80
|
const tabItem2 = renderedItems.find(
|
|
78
81
|
(item) => !item.disabled && !item.dimmed
|
|
79
82
|
);
|
|
80
|
-
tab.setState("selectedId",
|
|
83
|
+
tab.setState("selectedId", tabItem2 == null ? void 0 : tabItem2.id);
|
|
81
84
|
}
|
|
82
85
|
},
|
|
83
86
|
["selectedId", "renderedItems"]
|
|
@@ -101,7 +104,7 @@ function createTabStore(props = {}) {
|
|
|
101
104
|
const tabItem = tabs[i];
|
|
102
105
|
if (!tabItem)
|
|
103
106
|
return;
|
|
104
|
-
panels.renderItem({
|
|
107
|
+
panels.renderItem(_6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, panel), { tabId: tabItem.id }));
|
|
105
108
|
});
|
|
106
109
|
},
|
|
107
110
|
["renderedItems"]
|
|
@@ -110,16 +113,14 @@ function createTabStore(props = {}) {
|
|
|
110
113
|
["renderedItems"]
|
|
111
114
|
)
|
|
112
115
|
);
|
|
113
|
-
return {
|
|
114
|
-
...composite,
|
|
115
|
-
...tab,
|
|
116
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite), tab), {
|
|
116
117
|
panels,
|
|
117
118
|
setSelectedId: (id) => tab.setState("selectedId", id),
|
|
118
119
|
select: (id) => {
|
|
119
120
|
tab.setState("selectedId", id);
|
|
120
121
|
composite.move(id);
|
|
121
122
|
}
|
|
122
|
-
};
|
|
123
|
+
});
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
|
package/cjs/tab/tab-store.d.ts
CHANGED
|
@@ -23,11 +23,17 @@ export interface TabStoreState extends CompositeStoreState<Item> {
|
|
|
23
23
|
/**
|
|
24
24
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
25
25
|
* will be automatically set to the first enabled tab.
|
|
26
|
+
*
|
|
27
|
+
* Live examples:
|
|
28
|
+
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
26
29
|
*/
|
|
27
30
|
selectedId: TabStoreState["activeId"];
|
|
28
31
|
/**
|
|
29
32
|
* Whether the tab should be selected when it receives focus. If it's set to
|
|
30
33
|
* `false`, the tab will be selected only when it's clicked.
|
|
34
|
+
*
|
|
35
|
+
* Live examples:
|
|
36
|
+
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
31
37
|
* @default true
|
|
32
38
|
*/
|
|
33
39
|
selectOnMove?: boolean;
|
|
@@ -36,6 +42,9 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<Item> {
|
|
|
36
42
|
/**
|
|
37
43
|
* Sets the `selectedId` state without moving focus. If you want to move focus,
|
|
38
44
|
* use the `select` function instead.
|
|
45
|
+
*
|
|
46
|
+
* Live examples:
|
|
47
|
+
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
39
48
|
* @example
|
|
40
49
|
* // Selects the tab with id "tab-1"
|
|
41
50
|
* store.setSelectedId("tab-1");
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
3
|
+
var _EUJ6NNA6cjs = require('../__chunks/EUJ6NNA6.cjs');
|
|
4
|
+
require('../__chunks/FXEBKN6G.cjs');
|
|
5
|
+
require('../__chunks/6SPJEESB.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../__chunks/
|
|
8
|
+
var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
|
|
9
|
+
require('../__chunks/ZNW4LSWU.cjs');
|
|
10
10
|
require('../__chunks/GDZQUFNP.cjs');
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
|
|
15
|
+
|
|
12
16
|
// src/toolbar/toolbar-store.ts
|
|
13
17
|
function createToolbarStore(props = {}) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
orientation:
|
|
18
|
+
var _a;
|
|
19
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
+
return _EUJ6NNA6cjs.createCompositeStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
|
+
orientation: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
18
22
|
props.orientation,
|
|
19
|
-
|
|
23
|
+
syncState == null ? void 0 : syncState.orientation,
|
|
20
24
|
"horizontal"
|
|
21
25
|
),
|
|
22
|
-
focusLoop:
|
|
23
|
-
});
|
|
26
|
+
focusLoop: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
27
|
+
}));
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
|
|
@@ -1,97 +1,49 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _CNODBYSGcjs = require('../__chunks/CNODBYSG.cjs');
|
|
4
|
+
require('../__chunks/RD3S4VKY.cjs');
|
|
5
|
+
require('../__chunks/HEFJPUYD.cjs');
|
|
6
|
+
require('../__chunks/27ZAGOYG.cjs');
|
|
5
7
|
|
|
6
8
|
|
|
7
|
-
var
|
|
9
|
+
var _6SPJEESBcjs = require('../__chunks/6SPJEESB.cjs');
|
|
8
10
|
|
|
9
11
|
|
|
10
|
-
var
|
|
12
|
+
var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
|
|
11
13
|
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
|
|
16
|
+
var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
|
|
14
17
|
|
|
15
18
|
// src/tooltip/tooltip-store.ts
|
|
16
|
-
var tooltips = _ZPOXPO2Lcjs.createStore.call(void 0, { activeRef: null });
|
|
17
|
-
function afterTimeout(timeoutMs, cb) {
|
|
18
|
-
const timeoutId = setTimeout(cb, timeoutMs);
|
|
19
|
-
return () => clearTimeout(timeoutId);
|
|
20
|
-
}
|
|
21
19
|
function createTooltipStore(props = {}) {
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
...props,
|
|
27
|
-
open,
|
|
28
|
-
placement: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
20
|
+
var _a;
|
|
21
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
22
|
+
const hovercard = _CNODBYSGcjs.createHovercardStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
23
|
+
placement: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
29
24
|
props.placement,
|
|
30
|
-
|
|
25
|
+
syncState == null ? void 0 : syncState.placement,
|
|
31
26
|
"top"
|
|
32
27
|
),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
const ref = Symbol();
|
|
46
|
-
tooltip.setup(
|
|
47
|
-
() => disclosure.sync(
|
|
48
|
-
(state, prev) => {
|
|
49
|
-
const { timeout } = tooltip.getState();
|
|
50
|
-
const { activeRef } = tooltips.getState();
|
|
51
|
-
if (state.open) {
|
|
52
|
-
if (!timeout || activeRef) {
|
|
53
|
-
tooltips.setState("activeRef", ref);
|
|
54
|
-
tooltip.setState("open", true);
|
|
55
|
-
return;
|
|
56
|
-
} else {
|
|
57
|
-
tooltips.setState("activeRef", null);
|
|
58
|
-
return afterTimeout(timeout, () => {
|
|
59
|
-
tooltips.setState("activeRef", ref);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
} else if (state.open !== prev.open) {
|
|
63
|
-
tooltip.setState("open", false);
|
|
64
|
-
return afterTimeout(timeout, () => {
|
|
65
|
-
tooltips.setState(
|
|
66
|
-
"activeRef",
|
|
67
|
-
(activeRef2) => activeRef2 === ref ? null : activeRef2
|
|
68
|
-
);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return;
|
|
72
|
-
},
|
|
73
|
-
["open"]
|
|
74
|
-
)
|
|
75
|
-
);
|
|
76
|
-
tooltip.setup(
|
|
77
|
-
() => tooltips.sync(
|
|
78
|
-
(state) => {
|
|
79
|
-
tooltip.setState("open", state.activeRef === ref);
|
|
80
|
-
},
|
|
81
|
-
["activeRef"]
|
|
28
|
+
showTimeout: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
29
|
+
props.showTimeout,
|
|
30
|
+
syncState == null ? void 0 : syncState.showTimeout,
|
|
31
|
+
props.timeout,
|
|
32
|
+
500
|
|
33
|
+
),
|
|
34
|
+
hideTimeout: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
35
|
+
props.hideTimeout,
|
|
36
|
+
syncState == null ? void 0 : syncState.hideTimeout,
|
|
37
|
+
props.timeout,
|
|
38
|
+
0
|
|
82
39
|
)
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
(activeRef) => activeRef === ref ? null : activeRef
|
|
88
|
-
);
|
|
40
|
+
}));
|
|
41
|
+
const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, hovercard.getState()), {
|
|
42
|
+
type: _M6ZA7XUPcjs.defaultValue.call(void 0, props.type, syncState == null ? void 0 : syncState.type, "description"),
|
|
43
|
+
skipTimeout: _M6ZA7XUPcjs.defaultValue.call(void 0, props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
|
|
89
44
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
...disclosure,
|
|
93
|
-
...tooltip
|
|
94
|
-
};
|
|
45
|
+
const tooltip = _6SPJEESBcjs.createStore.call(void 0, initialState, hovercard, props.store);
|
|
46
|
+
return _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, hovercard), tooltip);
|
|
95
47
|
}
|
|
96
48
|
|
|
97
49
|
|
|
@@ -1,28 +1,33 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.js";
|
|
2
2
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a tooltip store.
|
|
5
5
|
*/
|
|
6
6
|
export declare function createTooltipStore(props?: TooltipStoreProps): TooltipStore;
|
|
7
|
-
export interface TooltipStoreState extends
|
|
7
|
+
export interface TooltipStoreState extends HovercardStoreState {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Determines whether the tooltip is being used as a label or a description
|
|
10
|
+
* for the anchor element.
|
|
11
|
+
* @default "description"
|
|
10
12
|
*/
|
|
11
|
-
|
|
13
|
+
type: "label" | "description";
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
15
|
+
* The amount of time after a tooltip is hidden while all tooltips on the
|
|
16
|
+
* page can be shown immediately, without waiting for the show timeout.
|
|
17
|
+
* @default 300
|
|
14
18
|
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
skipTimeout: number;
|
|
20
|
+
/** @default "top" */
|
|
21
|
+
placement: HovercardStoreState["placement"];
|
|
22
|
+
/** @default 0 */
|
|
23
|
+
timeout: HovercardStoreState["timeout"];
|
|
24
|
+
/** @default 500 */
|
|
25
|
+
showTimeout: HovercardStoreState["showTimeout"];
|
|
26
|
+
/** @default 0 */
|
|
27
|
+
hideTimeout: HovercardStoreState["hideTimeout"];
|
|
23
28
|
}
|
|
24
|
-
export type TooltipStoreFunctions =
|
|
25
|
-
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "
|
|
29
|
+
export type TooltipStoreFunctions = HovercardStoreFunctions;
|
|
30
|
+
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout">, HovercardStoreOptions {
|
|
26
31
|
}
|
|
27
32
|
export type TooltipStoreProps = TooltipStoreOptions & StoreProps<TooltipStoreState>;
|
|
28
33
|
export type TooltipStore = TooltipStoreFunctions & Store<TooltipStoreState>;
|