@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **BREAKING**: Moved props from the `usePopoverStore` hook to the `Popover` component: `fixed`, `gutter`, `shift`, `flip`, `slide`, `overlap`, `sameWidth`, `fitViewport`, `arrowPadding`, `overflowPadding`, `getAnchorRect`, `renderCallback` (renamed to `updatePosition`). ([#2279](https://github.com/ariakit/ariakit/pull/2279))
|
|
8
|
+
|
|
9
|
+
The exception is the `placement` prop that should still be passed to the store.
|
|
10
|
+
|
|
11
|
+
**Before**:
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
const popover = usePopoverStore({
|
|
15
|
+
placement: "bottom",
|
|
16
|
+
fixed: true,
|
|
17
|
+
gutter: 8,
|
|
18
|
+
shift: 8,
|
|
19
|
+
flip: true,
|
|
20
|
+
slide: true,
|
|
21
|
+
overlap: true,
|
|
22
|
+
sameWidth: true,
|
|
23
|
+
fitViewport: true,
|
|
24
|
+
arrowPadding: 8,
|
|
25
|
+
overflowPadding: 8,
|
|
26
|
+
getAnchorRect: (anchor) => anchor?.getBoundingClientRect(),
|
|
27
|
+
renderCallback: (props) => props.defaultRenderCallback(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
<Popover store={popover} />;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**After**:
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
const popover = usePopoverStore({ placement: "bottom" });
|
|
37
|
+
|
|
38
|
+
<Popover
|
|
39
|
+
store={popover}
|
|
40
|
+
fixed
|
|
41
|
+
gutter={8}
|
|
42
|
+
shift={8}
|
|
43
|
+
flip
|
|
44
|
+
slide
|
|
45
|
+
overlap
|
|
46
|
+
sameWidth
|
|
47
|
+
fitViewport
|
|
48
|
+
arrowPadding={8}
|
|
49
|
+
overflowPadding={8}
|
|
50
|
+
getAnchorRect={(anchor) => anchor?.getBoundingClientRect()}
|
|
51
|
+
updatePosition={(props) => props.updatePosition()}
|
|
52
|
+
/>;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This change affects all the hooks and components that use `usePopoverStore` and `Popover` underneath: `useComboboxStore`, `ComboboxPopover`, `useHovercardStore`, `Hovercard`, `useMenuStore`, `Menu`, `useSelectStore`, `SelectPopover`, `useTooltipStore`, `Tooltip`.
|
|
56
|
+
|
|
57
|
+
With this change, the underlying `@floating-ui/dom` dependency has been also moved to the `Popover` component, which means it can be lazy loaded. See the [Lazy Popover](https://ariakit.org/examples/popover-lazy) example.
|
|
58
|
+
|
|
59
|
+
## 0.1.5
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated `isFocusable` function to return `false` when the element is `inert` or is a descendant of an `inert` element. ([#2339](https://github.com/ariakit/ariakit/pull/2339))
|
|
64
|
+
|
|
65
|
+
- Fixed build target. ([#2355](https://github.com/ariakit/ariakit/pull/2355))
|
|
66
|
+
|
|
67
|
+
- Updated JSDocs.
|
|
68
|
+
|
|
3
69
|
## 0.1.4
|
|
4
70
|
|
|
5
71
|
### Patch Changes
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _6SPJEESBcjs = require('./6SPJEESB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _6455U47Tcjs = require('./6455U47T.cjs');
|
|
7
11
|
|
|
8
12
|
// src/disclosure/disclosure-store.ts
|
|
9
13
|
function createDisclosureStore(props = {}) {
|
|
10
|
-
|
|
11
|
-
const
|
|
14
|
+
var _a;
|
|
15
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
16
|
+
const open = _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
12
17
|
props.open,
|
|
13
|
-
|
|
18
|
+
syncState == null ? void 0 : syncState.open,
|
|
14
19
|
props.defaultOpen,
|
|
15
20
|
false
|
|
16
21
|
);
|
|
17
|
-
const animated =
|
|
22
|
+
const animated = _M6ZA7XUPcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
|
|
18
23
|
const initialState = {
|
|
19
24
|
open,
|
|
20
25
|
animated,
|
|
21
26
|
animating: !!animated && open,
|
|
22
27
|
mounted: open,
|
|
23
|
-
contentElement:
|
|
24
|
-
disclosureElement:
|
|
28
|
+
contentElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
29
|
+
disclosureElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
25
30
|
};
|
|
26
|
-
const disclosure =
|
|
31
|
+
const disclosure = _6SPJEESBcjs.createStore.call(void 0, initialState, props.store);
|
|
27
32
|
disclosure.setup(
|
|
28
33
|
() => disclosure.sync(
|
|
29
34
|
(state) => {
|
|
@@ -54,8 +59,7 @@ function createDisclosureStore(props = {}) {
|
|
|
54
59
|
["open", "animating"]
|
|
55
60
|
)
|
|
56
61
|
);
|
|
57
|
-
return {
|
|
58
|
-
...disclosure,
|
|
62
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, disclosure), {
|
|
59
63
|
setOpen: (value) => disclosure.setState("open", value),
|
|
60
64
|
show: () => disclosure.setState("open", true),
|
|
61
65
|
hide: () => disclosure.setState("open", false),
|
|
@@ -63,7 +67,7 @@ function createDisclosureStore(props = {}) {
|
|
|
63
67
|
stopAnimation: () => disclosure.setState("animating", false),
|
|
64
68
|
setContentElement: (value) => disclosure.setState("contentElement", value),
|
|
65
69
|
setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
|
|
66
|
-
};
|
|
70
|
+
});
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__objRest = __objRest;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _6455U47Tcjs = require('./6455U47T.cjs');
|
|
10
14
|
|
|
11
15
|
// src/utils/store.ts
|
|
12
16
|
function createStore(initialState, ...stores) {
|
|
@@ -27,26 +31,30 @@ function createStore(initialState, ...stores) {
|
|
|
27
31
|
};
|
|
28
32
|
const init = () => {
|
|
29
33
|
if (initialized)
|
|
30
|
-
return
|
|
34
|
+
return _M6ZA7XUPcjs.noop;
|
|
31
35
|
if (!stores.length)
|
|
32
|
-
return
|
|
36
|
+
return _M6ZA7XUPcjs.noop;
|
|
33
37
|
initialized = true;
|
|
34
|
-
const desyncs =
|
|
35
|
-
(key) =>
|
|
38
|
+
const desyncs = _M6ZA7XUPcjs.getKeys.call(void 0, state).map(
|
|
39
|
+
(key) => _M6ZA7XUPcjs.chain.call(void 0,
|
|
36
40
|
...stores.map((store) => {
|
|
37
|
-
|
|
41
|
+
var _a, _b;
|
|
42
|
+
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
|
|
38
43
|
if (!storeState)
|
|
39
44
|
return;
|
|
40
|
-
if (!
|
|
45
|
+
if (!_M6ZA7XUPcjs.hasOwnProperty.call(void 0, storeState, key))
|
|
41
46
|
return;
|
|
42
|
-
return
|
|
47
|
+
return (_b = store == null ? void 0 : store.sync) == null ? void 0 : _b.call(store, (state2) => setState(key, state2[key]), [key]);
|
|
43
48
|
})
|
|
44
49
|
)
|
|
45
50
|
);
|
|
46
51
|
const teardowns = [];
|
|
47
52
|
setups.forEach((setup2) => teardowns.push(setup2()));
|
|
48
|
-
const cleanups = stores.map((store) =>
|
|
49
|
-
|
|
53
|
+
const cleanups = stores.map((store) => {
|
|
54
|
+
var _a;
|
|
55
|
+
return (_a = store == null ? void 0 : store.init) == null ? void 0 : _a.call(store);
|
|
56
|
+
});
|
|
57
|
+
return _M6ZA7XUPcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups, () => {
|
|
50
58
|
initialized = false;
|
|
51
59
|
});
|
|
52
60
|
};
|
|
@@ -55,7 +63,8 @@ function createStore(initialState, ...stores) {
|
|
|
55
63
|
set.add(listener);
|
|
56
64
|
listenerKeys.set(listener, keys);
|
|
57
65
|
return () => {
|
|
58
|
-
|
|
66
|
+
var _a;
|
|
67
|
+
(_a = disposables.get(listener)) == null ? void 0 : _a();
|
|
59
68
|
disposables.delete(listener);
|
|
60
69
|
listenerKeys.delete(listener);
|
|
61
70
|
set.delete(listener);
|
|
@@ -74,25 +83,27 @@ function createStore(initialState, ...stores) {
|
|
|
74
83
|
};
|
|
75
84
|
const getState = () => state;
|
|
76
85
|
const setState = (key, value) => {
|
|
77
|
-
if (!
|
|
86
|
+
if (!_M6ZA7XUPcjs.hasOwnProperty.call(void 0, state, key))
|
|
78
87
|
return;
|
|
79
|
-
const nextValue =
|
|
88
|
+
const nextValue = _M6ZA7XUPcjs.applyState.call(void 0, value, state[key]);
|
|
80
89
|
if (nextValue === state[key])
|
|
81
90
|
return;
|
|
82
91
|
stores.forEach((store) => {
|
|
83
|
-
|
|
92
|
+
var _a;
|
|
93
|
+
(_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
|
|
84
94
|
});
|
|
85
95
|
const prevState = state;
|
|
86
|
-
state = {
|
|
96
|
+
state = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, state), { [key]: nextValue });
|
|
87
97
|
const thisUpdate = Symbol();
|
|
88
98
|
lastUpdate = thisUpdate;
|
|
89
99
|
updating = true;
|
|
90
100
|
updatedKeys.add(key);
|
|
91
101
|
const run = (listener, prev, uKeys) => {
|
|
102
|
+
var _a;
|
|
92
103
|
const keys = listenerKeys.get(listener);
|
|
93
104
|
const updated = (k) => uKeys ? uKeys.has(k) : k === key;
|
|
94
105
|
if (!keys || keys.some(updated)) {
|
|
95
|
-
|
|
106
|
+
(_a = disposables.get(listener)) == null ? void 0 : _a();
|
|
96
107
|
disposables.set(listener, listener(state, prev));
|
|
97
108
|
}
|
|
98
109
|
};
|
|
@@ -111,8 +122,8 @@ function createStore(initialState, ...stores) {
|
|
|
111
122
|
});
|
|
112
123
|
});
|
|
113
124
|
};
|
|
114
|
-
const pick2 = (...keys) => createStore(
|
|
115
|
-
const omit2 = (...keys) => createStore(
|
|
125
|
+
const pick2 = (...keys) => createStore(_M6ZA7XUPcjs.pick.call(void 0, state, keys), finalStore);
|
|
126
|
+
const omit2 = (...keys) => createStore(_M6ZA7XUPcjs.omit.call(void 0, state, keys), finalStore);
|
|
116
127
|
const finalStore = {
|
|
117
128
|
setup,
|
|
118
129
|
init,
|
|
@@ -128,10 +139,11 @@ function createStore(initialState, ...stores) {
|
|
|
128
139
|
}
|
|
129
140
|
function mergeStore(...stores) {
|
|
130
141
|
const initialState = stores.reduce((state, store2) => {
|
|
131
|
-
|
|
142
|
+
var _a;
|
|
143
|
+
const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
|
|
132
144
|
if (!nextState)
|
|
133
145
|
return state;
|
|
134
|
-
return {
|
|
146
|
+
return _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, state), nextState);
|
|
135
147
|
}, {});
|
|
136
148
|
const store = createStore(initialState, ...stores);
|
|
137
149
|
return store;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _RD3S4VKYcjs = require('./RD3S4VKY.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _6SPJEESBcjs = require('./6SPJEESB.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _6455U47Tcjs = require('./6455U47T.cjs');
|
|
14
|
+
|
|
15
|
+
// src/hovercard/hovercard-store.ts
|
|
16
|
+
function createHovercardStore(props = {}) {
|
|
17
|
+
var _a;
|
|
18
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
19
|
+
const timeout = _M6ZA7XUPcjs.defaultValue.call(void 0, props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
|
|
20
|
+
const popover = _RD3S4VKYcjs.createPopoverStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
|
+
placement: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
22
|
+
props.placement,
|
|
23
|
+
syncState == null ? void 0 : syncState.placement,
|
|
24
|
+
"bottom"
|
|
25
|
+
)
|
|
26
|
+
}));
|
|
27
|
+
const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, popover.getState()), {
|
|
28
|
+
timeout,
|
|
29
|
+
showTimeout: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
30
|
+
props.showTimeout,
|
|
31
|
+
syncState == null ? void 0 : syncState.showTimeout,
|
|
32
|
+
timeout
|
|
33
|
+
),
|
|
34
|
+
hideTimeout: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
35
|
+
props.hideTimeout,
|
|
36
|
+
syncState == null ? void 0 : syncState.hideTimeout,
|
|
37
|
+
timeout
|
|
38
|
+
),
|
|
39
|
+
autoFocusOnShow: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
40
|
+
});
|
|
41
|
+
const hovercard = _6SPJEESBcjs.createStore.call(void 0, initialState, popover, props.store);
|
|
42
|
+
hovercard.setup(
|
|
43
|
+
() => hovercard.sync(
|
|
44
|
+
(state) => {
|
|
45
|
+
hovercard.setState("showTimeout", (value) => value != null ? value : state.timeout);
|
|
46
|
+
hovercard.setState("hideTimeout", (value) => value != null ? value : state.timeout);
|
|
47
|
+
},
|
|
48
|
+
["timeout"]
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
|
|
52
|
+
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
exports.createHovercardStore = createHovercardStore;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _ZNW4LSWUcjs = require('./ZNW4LSWU.cjs');
|
|
4
4
|
|
|
5
5
|
// src/utils/platform.ts
|
|
6
6
|
function isTouchDevice() {
|
|
7
|
-
return
|
|
7
|
+
return _ZNW4LSWUcjs.canUseDOM && !!navigator.maxTouchPoints;
|
|
8
8
|
}
|
|
9
9
|
function isApple() {
|
|
10
|
-
if (!
|
|
10
|
+
if (!_ZNW4LSWUcjs.canUseDOM)
|
|
11
11
|
return false;
|
|
12
12
|
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
|
|
13
13
|
}
|
|
14
14
|
function isSafari() {
|
|
15
|
-
return
|
|
15
|
+
return _ZNW4LSWUcjs.canUseDOM && isApple() && /apple/i.test(navigator.vendor);
|
|
16
16
|
}
|
|
17
17
|
function isFirefox() {
|
|
18
|
-
return
|
|
18
|
+
return _ZNW4LSWUcjs.canUseDOM && /firefox\//i.test(navigator.userAgent);
|
|
19
19
|
}
|
|
20
20
|
function isMac() {
|
|
21
|
-
return
|
|
21
|
+
return _ZNW4LSWUcjs.canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _FXEBKN6Gcjs = require('./FXEBKN6G.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _6SPJEESBcjs = require('./6SPJEESB.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _GDZQUFNPcjs = require('./GDZQUFNP.cjs');
|
|
14
14
|
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _6455U47Tcjs = require('./6455U47T.cjs');
|
|
18
|
+
|
|
15
19
|
// src/composite/composite-store.ts
|
|
16
20
|
var NULL_ITEM = { id: null };
|
|
17
21
|
function findFirstEnabledItem(items, excludeId) {
|
|
@@ -51,7 +55,10 @@ function flipItems(items, activeId, shouldInsertNullItem = false) {
|
|
|
51
55
|
function groupItemsByRows(items) {
|
|
52
56
|
const rows = [];
|
|
53
57
|
for (const item of items) {
|
|
54
|
-
const row = rows.find((currentRow) =>
|
|
58
|
+
const row = rows.find((currentRow) => {
|
|
59
|
+
var _a;
|
|
60
|
+
return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
|
|
61
|
+
});
|
|
55
62
|
if (row) {
|
|
56
63
|
row.push(item);
|
|
57
64
|
} else {
|
|
@@ -84,7 +91,7 @@ function normalizeRows(rows, activeId, focusShift) {
|
|
|
84
91
|
if (!item || focusShift && item.disabled) {
|
|
85
92
|
const isFirst = i === 0;
|
|
86
93
|
const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1];
|
|
87
|
-
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(
|
|
94
|
+
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
|
|
88
95
|
}
|
|
89
96
|
}
|
|
90
97
|
}
|
|
@@ -98,77 +105,78 @@ function verticalizeItems(items) {
|
|
|
98
105
|
for (const row of rows) {
|
|
99
106
|
const item = row[i];
|
|
100
107
|
if (item) {
|
|
101
|
-
verticalized.push({
|
|
102
|
-
...item,
|
|
108
|
+
verticalized.push(_6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, item), {
|
|
103
109
|
// If there's no rowId, it means that it's not a grid composite, but
|
|
104
110
|
// a single row instead. So, instead of verticalizing it, that is,
|
|
105
111
|
// assigning a different rowId based on the column index, we keep it
|
|
106
112
|
// undefined so they will be part of the same row. This is useful
|
|
107
113
|
// when using up/down on one-dimensional composites.
|
|
108
114
|
rowId: item.rowId ? `${i}` : void 0
|
|
109
|
-
});
|
|
115
|
+
}));
|
|
110
116
|
}
|
|
111
117
|
}
|
|
112
118
|
}
|
|
113
119
|
return verticalized;
|
|
114
120
|
}
|
|
115
121
|
function createCompositeStore(props = {}) {
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
const
|
|
122
|
+
var _a;
|
|
123
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
124
|
+
const collection = _FXEBKN6Gcjs.createCollectionStore.call(void 0, props);
|
|
125
|
+
const activeId = _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
119
126
|
props.activeId,
|
|
120
|
-
|
|
127
|
+
syncState == null ? void 0 : syncState.activeId,
|
|
121
128
|
props.defaultActiveId
|
|
122
129
|
);
|
|
123
|
-
const initialState = {
|
|
124
|
-
...collection.getState(),
|
|
130
|
+
const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection.getState()), {
|
|
125
131
|
activeId,
|
|
126
|
-
baseElement:
|
|
127
|
-
includesBaseElement:
|
|
132
|
+
baseElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
|
|
133
|
+
includesBaseElement: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
128
134
|
props.includesBaseElement,
|
|
129
|
-
|
|
135
|
+
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
130
136
|
activeId === null
|
|
131
137
|
),
|
|
132
|
-
moves:
|
|
133
|
-
orientation:
|
|
138
|
+
moves: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
|
|
139
|
+
orientation: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
134
140
|
props.orientation,
|
|
135
|
-
|
|
141
|
+
syncState == null ? void 0 : syncState.orientation,
|
|
136
142
|
"both"
|
|
137
143
|
),
|
|
138
|
-
rtl:
|
|
139
|
-
virtualFocus:
|
|
144
|
+
rtl: _M6ZA7XUPcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
|
|
145
|
+
virtualFocus: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
140
146
|
props.virtualFocus,
|
|
141
|
-
|
|
147
|
+
syncState == null ? void 0 : syncState.virtualFocus,
|
|
142
148
|
false
|
|
143
149
|
),
|
|
144
|
-
focusLoop:
|
|
145
|
-
focusWrap:
|
|
146
|
-
focusShift:
|
|
147
|
-
};
|
|
148
|
-
const composite =
|
|
150
|
+
focusLoop: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
|
|
151
|
+
focusWrap: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
152
|
+
focusShift: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
153
|
+
});
|
|
154
|
+
const composite = _6SPJEESBcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
149
155
|
composite.setup(
|
|
150
156
|
() => composite.sync(
|
|
151
157
|
(state) => {
|
|
152
158
|
composite.setState("activeId", (activeId2) => {
|
|
159
|
+
var _a2;
|
|
153
160
|
if (activeId2 !== void 0)
|
|
154
161
|
return activeId2;
|
|
155
|
-
return
|
|
162
|
+
return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
|
|
156
163
|
});
|
|
157
164
|
},
|
|
158
165
|
["renderedItems", "activeId"]
|
|
159
166
|
)
|
|
160
167
|
);
|
|
161
168
|
const getNextId = (items, orientation, hasNullItem, skip) => {
|
|
169
|
+
var _a2, _b;
|
|
162
170
|
const { activeId: activeId2, rtl, focusLoop, focusWrap, includesBaseElement } = composite.getState();
|
|
163
171
|
const isHorizontal = orientation !== "vertical";
|
|
164
172
|
const isRTL = rtl && isHorizontal;
|
|
165
173
|
const allItems = isRTL ? _GDZQUFNPcjs.reverseArray.call(void 0, items) : items;
|
|
166
174
|
if (activeId2 == null) {
|
|
167
|
-
return
|
|
175
|
+
return (_a2 = findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
|
|
168
176
|
}
|
|
169
177
|
const activeItem = allItems.find((item) => item.id === activeId2);
|
|
170
178
|
if (!activeItem) {
|
|
171
|
-
return
|
|
179
|
+
return (_b = findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
|
|
172
180
|
}
|
|
173
181
|
const isGrid = !!activeItem.rowId;
|
|
174
182
|
const activeIndex = allItems.indexOf(activeItem);
|
|
@@ -178,7 +186,7 @@ function createCompositeStore(props = {}) {
|
|
|
178
186
|
const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
|
|
179
187
|
const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
|
|
180
188
|
nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
|
|
181
|
-
return
|
|
189
|
+
return nextItem2 == null ? void 0 : nextItem2.id;
|
|
182
190
|
}
|
|
183
191
|
const oppositeOrientation = getOppositeOrientation(
|
|
184
192
|
// If it's a grid and orientation is not set, it's a next/previous call,
|
|
@@ -193,7 +201,7 @@ function createCompositeStore(props = {}) {
|
|
|
193
201
|
const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId);
|
|
194
202
|
const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
|
|
195
203
|
const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
|
|
196
|
-
return
|
|
204
|
+
return nextItem2 == null ? void 0 : nextItem2.id;
|
|
197
205
|
}
|
|
198
206
|
if (canWrap) {
|
|
199
207
|
const nextItem2 = findFirstEnabledItem(
|
|
@@ -206,18 +214,16 @@ function createCompositeStore(props = {}) {
|
|
|
206
214
|
hasNullItem ? nextItemsInRow : nextItems,
|
|
207
215
|
activeId2
|
|
208
216
|
);
|
|
209
|
-
const nextId = hasNullItem ?
|
|
217
|
+
const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
|
|
210
218
|
return nextId;
|
|
211
219
|
}
|
|
212
220
|
const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2);
|
|
213
221
|
if (!nextItem && hasNullItem) {
|
|
214
222
|
return null;
|
|
215
223
|
}
|
|
216
|
-
return
|
|
224
|
+
return nextItem == null ? void 0 : nextItem.id;
|
|
217
225
|
};
|
|
218
|
-
return {
|
|
219
|
-
...collection,
|
|
220
|
-
...composite,
|
|
226
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection), composite), {
|
|
221
227
|
setBaseElement: (element) => composite.setState("baseElement", element),
|
|
222
228
|
setActiveId: (id) => composite.setState("activeId", id),
|
|
223
229
|
move: (id) => {
|
|
@@ -226,15 +232,22 @@ function createCompositeStore(props = {}) {
|
|
|
226
232
|
composite.setState("activeId", id);
|
|
227
233
|
composite.setState("moves", (moves) => moves + 1);
|
|
228
234
|
},
|
|
229
|
-
first: () =>
|
|
230
|
-
|
|
235
|
+
first: () => {
|
|
236
|
+
var _a2;
|
|
237
|
+
return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
|
|
238
|
+
},
|
|
239
|
+
last: () => {
|
|
240
|
+
var _a2;
|
|
241
|
+
return (_a2 = findFirstEnabledItem(_GDZQUFNPcjs.reverseArray.call(void 0, composite.getState().renderedItems))) == null ? void 0 : _a2.id;
|
|
242
|
+
},
|
|
231
243
|
next: (skip) => {
|
|
232
244
|
const { renderedItems, orientation } = composite.getState();
|
|
233
245
|
return getNextId(renderedItems, orientation, false, skip);
|
|
234
246
|
},
|
|
235
247
|
previous: (skip) => {
|
|
248
|
+
var _a2;
|
|
236
249
|
const { renderedItems, orientation, includesBaseElement } = composite.getState();
|
|
237
|
-
const isGrid = !!
|
|
250
|
+
const isGrid = !!((_a2 = findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
|
|
238
251
|
const hasNullItem = !isGrid && includesBaseElement;
|
|
239
252
|
return getNextId(
|
|
240
253
|
_GDZQUFNPcjs.reverseArray.call(void 0, renderedItems),
|
|
@@ -278,7 +291,7 @@ function createCompositeStore(props = {}) {
|
|
|
278
291
|
const hasNullItem = includesBaseElement;
|
|
279
292
|
return getNextId(verticalItems, "vertical", hasNullItem, skip);
|
|
280
293
|
}
|
|
281
|
-
};
|
|
294
|
+
});
|
|
282
295
|
}
|
|
283
296
|
|
|
284
297
|
|