@ariakit/core 0.3.10 → 0.4.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 +60 -0
- package/cjs/__chunks/{Y6PHIDP6.cjs → 5JEQEZFR.cjs} +12 -12
- package/cjs/__chunks/{YIUPKKEK.cjs → 7DU6YMLQ.cjs} +6 -6
- package/cjs/__chunks/{MWNFQD55.cjs → AETQC2AR.cjs} +17 -16
- package/cjs/__chunks/{5CBCKBZ2.cjs → B4LYZ4EM.cjs} +12 -12
- package/cjs/__chunks/{3UT5FE6K.cjs → EEDWPDM2.cjs} +14 -1
- package/cjs/__chunks/{YLMJBIQM.cjs → FFZYCAXA.cjs} +24 -15
- package/cjs/__chunks/{MFSCSSBJ.cjs → LTLFSC4X.cjs} +2 -2
- package/cjs/__chunks/{CWDUO5EV.cjs → SU2BSHGB.cjs} +7 -7
- package/cjs/__chunks/{HMO4CKUP.cjs → UEZLSKZ4.cjs} +10 -10
- package/cjs/__chunks/{5F4DVUNS.cjs → UKR6TQI3.cjs} +1 -2
- package/cjs/__chunks/{ZXCB7MXN.cjs → Y7KNI5NS.cjs} +17 -17
- package/cjs/checkbox/checkbox-store.cjs +5 -5
- package/cjs/collection/collection-store.cjs +5 -5
- package/cjs/combobox/combobox-store.cjs +35 -35
- package/cjs/composite/composite-overflow-store.cjs +6 -6
- package/cjs/composite/composite-store.cjs +6 -6
- package/cjs/dialog/dialog-store.cjs +5 -5
- package/cjs/disclosure/disclosure-store.cjs +4 -4
- package/cjs/disclosure/disclosure-store.d.cts +6 -2
- package/cjs/disclosure/disclosure-store.d.ts +6 -2
- package/cjs/form/form-store.cjs +24 -24
- package/cjs/form/form-store.d.cts +1 -1
- package/cjs/form/form-store.d.ts +1 -1
- package/cjs/hovercard/hovercard-store.cjs +7 -7
- package/cjs/hovercard/hovercard-store.d.cts +14 -7
- package/cjs/hovercard/hovercard-store.d.ts +14 -7
- package/cjs/menu/menu-bar-store.cjs +7 -7
- package/cjs/menu/menu-store.cjs +27 -27
- package/cjs/menu/menu-store.d.cts +16 -7
- package/cjs/menu/menu-store.d.ts +16 -7
- package/cjs/menubar/menubar-store.cjs +7 -7
- package/cjs/popover/popover-store.cjs +6 -6
- package/cjs/popover/popover-store.d.cts +31 -6
- package/cjs/popover/popover-store.d.ts +31 -6
- package/cjs/radio/radio-store.cjs +9 -9
- package/cjs/radio/radio-store.d.cts +2 -1
- package/cjs/radio/radio-store.d.ts +2 -1
- package/cjs/select/select-store.cjs +29 -29
- package/cjs/select/select-store.d.cts +2 -1
- package/cjs/select/select-store.d.ts +2 -1
- package/cjs/tab/tab-store.cjs +21 -21
- package/cjs/tab/tab-store.d.cts +5 -11
- package/cjs/tab/tab-store.d.ts +5 -11
- package/cjs/toolbar/toolbar-store.cjs +8 -8
- package/cjs/toolbar/toolbar-store.d.cts +2 -6
- package/cjs/toolbar/toolbar-store.d.ts +2 -6
- package/cjs/tooltip/tooltip-store.cjs +21 -12
- package/cjs/tooltip/tooltip-store.d.cts +6 -4
- package/cjs/tooltip/tooltip-store.d.ts +6 -4
- package/cjs/utils/dom.cjs +2 -2
- package/cjs/utils/events.cjs +5 -5
- package/cjs/utils/focus.cjs +13 -13
- package/cjs/utils/misc.cjs +4 -2
- package/cjs/utils/misc.d.cts +4 -0
- package/cjs/utils/misc.d.ts +4 -0
- package/cjs/utils/platform.cjs +3 -3
- package/cjs/utils/store.cjs +3 -3
- package/esm/__chunks/{I2VQ3XGR.js → 22HHDS5F.js} +13 -0
- package/esm/__chunks/{VEUNYQYR.js → 2H5K47H4.js} +3 -3
- package/esm/__chunks/{25MEC56I.js → 5RJNXXU2.js} +1 -1
- package/esm/__chunks/{QJ5CUA32.js → BRS7GKWU.js} +3 -3
- package/esm/__chunks/{AKMSZ36N.js → MFZZDIHG.js} +3 -3
- package/esm/__chunks/{UUFF4PQ6.js → PXYVPXSS.js} +3 -3
- package/esm/__chunks/{K6ELJFXN.js → R676XYVY.js} +1 -1
- package/esm/__chunks/{DLOEKDPY.js → RRSZHCH6.js} +1 -2
- package/esm/__chunks/{MYUKSFP5.js → URUD7X4C.js} +14 -5
- package/esm/__chunks/{MHPO2BXA.js → VDNATJW2.js} +1 -1
- package/esm/__chunks/{L5RYKTVQ.js → WCKXDMU7.js} +3 -2
- package/esm/checkbox/checkbox-store.js +2 -2
- package/esm/collection/collection-store.js +4 -4
- package/esm/combobox/combobox-store.js +9 -9
- package/esm/composite/composite-overflow-store.js +5 -5
- package/esm/composite/composite-store.js +5 -5
- package/esm/dialog/dialog-store.js +4 -4
- package/esm/disclosure/disclosure-store.d.ts +6 -2
- package/esm/disclosure/disclosure-store.js +3 -3
- package/esm/form/form-store.d.ts +1 -1
- package/esm/form/form-store.js +4 -4
- package/esm/hovercard/hovercard-store.d.ts +14 -7
- package/esm/hovercard/hovercard-store.js +6 -6
- package/esm/menu/menu-bar-store.js +6 -6
- package/esm/menu/menu-store.d.ts +16 -7
- package/esm/menu/menu-store.js +9 -9
- package/esm/menubar/menubar-store.js +6 -6
- package/esm/popover/popover-store.d.ts +31 -6
- package/esm/popover/popover-store.js +5 -5
- package/esm/radio/radio-store.d.ts +2 -1
- package/esm/radio/radio-store.js +5 -5
- package/esm/select/select-store.d.ts +2 -1
- package/esm/select/select-store.js +8 -8
- package/esm/tab/tab-store.d.ts +5 -11
- package/esm/tab/tab-store.js +5 -5
- package/esm/toolbar/toolbar-store.d.ts +2 -6
- package/esm/toolbar/toolbar-store.js +5 -5
- package/esm/tooltip/tooltip-store.d.ts +6 -4
- package/esm/tooltip/tooltip-store.js +15 -6
- package/esm/utils/dom.js +1 -1
- package/esm/utils/events.js +2 -2
- package/esm/utils/focus.js +1 -1
- package/esm/utils/misc.d.ts +4 -0
- package/esm/utils/misc.js +3 -1
- package/esm/utils/platform.js +2 -2
- package/esm/utils/store.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Improved animation support
|
|
6
|
+
|
|
7
|
+
This version enhances support for CSS animations and transitions on Ariakit components that use [Disclosure](https://ariakit.org/component/disclosure). This includes [Dialog](https://ariakit.org/components/dialog), [Popover](https://ariakit.org/components/popover), [Combobox](https://ariakit.org/components/combobox), [Select](https://ariakit.org/components/select), [Hovercard](https://ariakit.org/components/hovercard), [Menu](https://ariakit.org/components/menu), and [Tooltip](https://ariakit.org/components/tooltip).
|
|
8
|
+
|
|
9
|
+
These components now support _enter_ and _leave_ transitions and animations right out of the box, eliminating the need to provide an explicit `animated` prop. If an enter animation is detected, the component will automatically wait for a leave animation to complete before unmounting or hiding itself.
|
|
10
|
+
|
|
11
|
+
Use the [`[data-enter]`](https://ariakit.org/guide/styling#data-enter) selector for CSS transitions. For CSS animations, use the newly introduced [`[data-open]`](https://ariakit.org/guide/styling#data-open) selector. The [`[data-leave]`](https://ariakit.org/guide/styling#data-leave) selector can be used for both transitions and animations.
|
|
12
|
+
|
|
13
|
+
### Composite widgets with `grid` role
|
|
14
|
+
|
|
15
|
+
**BREAKING** if you're manually setting the `role="grid"` prop on a composite widget.
|
|
16
|
+
|
|
17
|
+
Ariakit automatically assigns the `role` prop to all composite items to align with the container `role`. For example, if [`SelectPopover`](https://ariakit.org/reference/select-popover) has its role set to `listbox` (which is the default value), its owned [`SelectItem`](https://ariakit.org/reference/select-item) elements will automatically get their role set to `option`.
|
|
18
|
+
|
|
19
|
+
In previous versions, this was also valid for composite widgets with a `grid` role, where the composite item element would automatically be given `role="gridcell"`. This is no longer the case, and you're now required to manually pass `role="gridcell"` to the composite item element if you're rendering a container with `role="grid"`.
|
|
20
|
+
|
|
21
|
+
Before:
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<SelectPopover role="grid">
|
|
25
|
+
<SelectRow> {/* Automatically gets role="row" */}
|
|
26
|
+
<SelectItem> {/* Automatically gets role="gridcell" */}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
After:
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
<SelectPopover role="grid">
|
|
33
|
+
<SelectRow> {/* Still gets role="row" */}
|
|
34
|
+
<SelectItem role="gridcell">
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This change is due to the possibility of rendering a composite item element with a different role as a child of a static `div` with `role="gridcell"`, which is a valid and frequently used practice when using the `grid` role. As a result, you no longer have to manually adjust the `role` prop on the composite item:
|
|
38
|
+
|
|
39
|
+
```jsx
|
|
40
|
+
<SelectPopover role="grid">
|
|
41
|
+
<SelectRow>
|
|
42
|
+
<div role="gridcell">
|
|
43
|
+
<SelectItem render={<button />}>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Previously, you had to explicitly pass `role="button"` to the [`SelectItem`](https://ariakit.org/reference/select-item) component above, otherwise it would automatically receive `role="gridcell"`, leading to an invalid accessibility tree.
|
|
47
|
+
|
|
48
|
+
### Other updates
|
|
49
|
+
|
|
50
|
+
- Added `removeUndefinedValues` utility function.
|
|
51
|
+
- Added new [`disclosure`](https://ariakit.org/reference/use-disclosure-store#disclosure-1) property to disclosure stores.
|
|
52
|
+
|
|
53
|
+
## 0.3.11
|
|
54
|
+
|
|
55
|
+
### Improved performance of large collections
|
|
56
|
+
|
|
57
|
+
Components like [`MenuItem`](https://ariakit.org/reference/menu-item), [`ComboboxItem`](https://ariakit.org/reference/combobox-item), and [`SelectItem`](https://ariakit.org/reference/select-item) should now offer improved performance when rendering large collections.
|
|
58
|
+
|
|
59
|
+
### Other updates
|
|
60
|
+
|
|
61
|
+
- Improved JSDocs.
|
|
62
|
+
|
|
3
63
|
## 0.3.10
|
|
4
64
|
|
|
5
65
|
- Fixed [`CompositeItem`](https://ariakit.org/reference/composite-item) triggering blur on focus.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _LTLFSC4Xcjs = require('./LTLFSC4X.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _B4LYZ4EMcjs = require('./B4LYZ4EM.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -24,9 +24,9 @@ function createPopoverStore(_a = {}) {
|
|
|
24
24
|
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
25
25
|
"popover"
|
|
26
26
|
]);
|
|
27
|
-
const store =
|
|
27
|
+
const store = _B4LYZ4EMcjs.mergeStore.call(void 0,
|
|
28
28
|
props.store,
|
|
29
|
-
|
|
29
|
+
_B4LYZ4EMcjs.omit.call(void 0, otherPopover, [
|
|
30
30
|
"arrowElement",
|
|
31
31
|
"anchorElement",
|
|
32
32
|
"contentElement",
|
|
@@ -34,10 +34,10 @@ function createPopoverStore(_a = {}) {
|
|
|
34
34
|
"disclosureElement"
|
|
35
35
|
])
|
|
36
36
|
);
|
|
37
|
-
|
|
37
|
+
_B4LYZ4EMcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
38
38
|
const syncState = store == null ? void 0 : store.getState();
|
|
39
|
-
const dialog =
|
|
40
|
-
const placement =
|
|
39
|
+
const dialog = _LTLFSC4Xcjs.createDialogStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), { store }));
|
|
40
|
+
const placement = _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
41
41
|
props.placement,
|
|
42
42
|
syncState == null ? void 0 : syncState.placement,
|
|
43
43
|
"bottom"
|
|
@@ -45,12 +45,12 @@ function createPopoverStore(_a = {}) {
|
|
|
45
45
|
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog.getState()), {
|
|
46
46
|
placement,
|
|
47
47
|
currentPlacement: placement,
|
|
48
|
-
anchorElement:
|
|
49
|
-
popoverElement:
|
|
50
|
-
arrowElement:
|
|
48
|
+
anchorElement: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
|
|
49
|
+
popoverElement: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
|
|
50
|
+
arrowElement: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
|
|
51
51
|
rendered: Symbol("rendered")
|
|
52
52
|
});
|
|
53
|
-
const popover =
|
|
53
|
+
const popover = _B4LYZ4EMcjs.createStore.call(void 0, initialState, dialog, store);
|
|
54
54
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog), popover), {
|
|
55
55
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
56
56
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _UKR6TQI3cjs = require('./UKR6TQI3.cjs');
|
|
5
5
|
|
|
6
6
|
// src/utils/platform.ts
|
|
7
7
|
function isTouchDevice() {
|
|
8
|
-
return
|
|
8
|
+
return _UKR6TQI3cjs.canUseDOM && !!navigator.maxTouchPoints;
|
|
9
9
|
}
|
|
10
10
|
function isApple() {
|
|
11
|
-
if (!
|
|
11
|
+
if (!_UKR6TQI3cjs.canUseDOM)
|
|
12
12
|
return false;
|
|
13
13
|
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
|
|
14
14
|
}
|
|
15
15
|
function isSafari() {
|
|
16
|
-
return
|
|
16
|
+
return _UKR6TQI3cjs.canUseDOM && isApple() && /apple/i.test(navigator.vendor);
|
|
17
17
|
}
|
|
18
18
|
function isFirefox() {
|
|
19
|
-
return
|
|
19
|
+
return _UKR6TQI3cjs.canUseDOM && /firefox\//i.test(navigator.userAgent);
|
|
20
20
|
}
|
|
21
21
|
function isMac() {
|
|
22
|
-
return
|
|
22
|
+
return _UKR6TQI3cjs.canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _B4LYZ4EMcjs = require('./B4LYZ4EM.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -18,51 +18,52 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
18
18
|
|
|
19
19
|
// src/disclosure/disclosure-store.ts
|
|
20
20
|
function createDisclosureStore(props = {}) {
|
|
21
|
-
const store =
|
|
21
|
+
const store = _B4LYZ4EMcjs.mergeStore.call(void 0,
|
|
22
22
|
props.store,
|
|
23
|
-
|
|
23
|
+
_B4LYZ4EMcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
|
|
24
24
|
);
|
|
25
|
-
|
|
25
|
+
_B4LYZ4EMcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
26
26
|
const syncState = store == null ? void 0 : store.getState();
|
|
27
|
-
const open =
|
|
27
|
+
const open = _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
28
28
|
props.open,
|
|
29
29
|
syncState == null ? void 0 : syncState.open,
|
|
30
30
|
props.defaultOpen,
|
|
31
31
|
false
|
|
32
32
|
);
|
|
33
|
-
const animated =
|
|
33
|
+
const animated = _EEDWPDM2cjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
|
|
34
34
|
const initialState = {
|
|
35
35
|
open,
|
|
36
36
|
animated,
|
|
37
37
|
animating: !!animated && open,
|
|
38
38
|
mounted: open,
|
|
39
|
-
contentElement:
|
|
40
|
-
disclosureElement:
|
|
39
|
+
contentElement: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
40
|
+
disclosureElement: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
41
41
|
};
|
|
42
|
-
const disclosure =
|
|
43
|
-
|
|
42
|
+
const disclosure = _B4LYZ4EMcjs.createStore.call(void 0, initialState, store);
|
|
43
|
+
_B4LYZ4EMcjs.setup.call(void 0,
|
|
44
44
|
disclosure,
|
|
45
|
-
() =>
|
|
45
|
+
() => _B4LYZ4EMcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
|
|
46
46
|
if (state.animated)
|
|
47
47
|
return;
|
|
48
48
|
disclosure.setState("animating", false);
|
|
49
49
|
})
|
|
50
50
|
);
|
|
51
|
-
|
|
51
|
+
_B4LYZ4EMcjs.setup.call(void 0,
|
|
52
52
|
disclosure,
|
|
53
|
-
() =>
|
|
53
|
+
() => _B4LYZ4EMcjs.subscribe.call(void 0, disclosure, ["open"], () => {
|
|
54
54
|
if (!disclosure.getState().animated)
|
|
55
55
|
return;
|
|
56
56
|
disclosure.setState("animating", true);
|
|
57
57
|
})
|
|
58
58
|
);
|
|
59
|
-
|
|
59
|
+
_B4LYZ4EMcjs.setup.call(void 0,
|
|
60
60
|
disclosure,
|
|
61
|
-
() =>
|
|
61
|
+
() => _B4LYZ4EMcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
|
|
62
62
|
disclosure.setState("mounted", state.open || state.animating);
|
|
63
63
|
})
|
|
64
64
|
);
|
|
65
65
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, disclosure), {
|
|
66
|
+
disclosure: props.disclosure,
|
|
66
67
|
setOpen: (value) => disclosure.setState("open", value),
|
|
67
68
|
show: () => disclosure.setState("open", true),
|
|
68
69
|
hide: () => disclosure.setState("open", false),
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -17,14 +17,14 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
17
17
|
// src/utils/store.ts
|
|
18
18
|
function getInternal(store, key) {
|
|
19
19
|
const internals = store.__unstableInternals;
|
|
20
|
-
|
|
20
|
+
_EEDWPDM2cjs.invariant.call(void 0, internals, "Invalid store");
|
|
21
21
|
return internals[key];
|
|
22
22
|
}
|
|
23
23
|
function createStore(initialState, ...stores) {
|
|
24
24
|
let state = initialState;
|
|
25
25
|
let prevStateBatch = state;
|
|
26
26
|
let lastUpdate = Symbol();
|
|
27
|
-
let destroy =
|
|
27
|
+
let destroy = _EEDWPDM2cjs.noop;
|
|
28
28
|
const instances = /* @__PURE__ */ new Set();
|
|
29
29
|
const updatedKeys = /* @__PURE__ */ new Set();
|
|
30
30
|
const setups = /* @__PURE__ */ new Set();
|
|
@@ -48,14 +48,14 @@ function createStore(initialState, ...stores) {
|
|
|
48
48
|
};
|
|
49
49
|
if (initialized)
|
|
50
50
|
return maybeDestroy;
|
|
51
|
-
const desyncs =
|
|
52
|
-
(key) =>
|
|
51
|
+
const desyncs = _EEDWPDM2cjs.getKeys.call(void 0, state).map(
|
|
52
|
+
(key) => _EEDWPDM2cjs.chain.call(void 0,
|
|
53
53
|
...stores.map((store) => {
|
|
54
54
|
var _a;
|
|
55
55
|
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
|
|
56
56
|
if (!storeState)
|
|
57
57
|
return;
|
|
58
|
-
if (!
|
|
58
|
+
if (!_EEDWPDM2cjs.hasOwnProperty.call(void 0, storeState, key))
|
|
59
59
|
return;
|
|
60
60
|
return sync(store, [key], (state2) => {
|
|
61
61
|
setState(
|
|
@@ -72,7 +72,7 @@ function createStore(initialState, ...stores) {
|
|
|
72
72
|
const teardowns = [];
|
|
73
73
|
setups.forEach((setup2) => teardowns.push(setup2()));
|
|
74
74
|
const cleanups = stores.map(init);
|
|
75
|
-
destroy =
|
|
75
|
+
destroy = _EEDWPDM2cjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups);
|
|
76
76
|
return maybeDestroy;
|
|
77
77
|
};
|
|
78
78
|
const sub = (keys, listener, set = listeners) => {
|
|
@@ -95,13 +95,13 @@ function createStore(initialState, ...stores) {
|
|
|
95
95
|
disposables.set(listener, listener(state, prevStateBatch));
|
|
96
96
|
return sub(keys, listener, batchListeners);
|
|
97
97
|
};
|
|
98
|
-
const storePick = (keys) => createStore(
|
|
99
|
-
const storeOmit = (keys) => createStore(
|
|
98
|
+
const storePick = (keys) => createStore(_EEDWPDM2cjs.pick.call(void 0, state, keys), finalStore);
|
|
99
|
+
const storeOmit = (keys) => createStore(_EEDWPDM2cjs.omit.call(void 0, state, keys), finalStore);
|
|
100
100
|
const getState = () => state;
|
|
101
101
|
const setState = (key, value, fromStores = false) => {
|
|
102
|
-
if (!
|
|
102
|
+
if (!_EEDWPDM2cjs.hasOwnProperty.call(void 0, state, key))
|
|
103
103
|
return;
|
|
104
|
-
const nextValue =
|
|
104
|
+
const nextValue = _EEDWPDM2cjs.applyState.call(void 0, value, state[key]);
|
|
105
105
|
if (nextValue === state[key])
|
|
106
106
|
return;
|
|
107
107
|
if (!fromStores) {
|
|
@@ -213,7 +213,7 @@ function throwOnConflictingProps(props, store) {
|
|
|
213
213
|
return;
|
|
214
214
|
const storeState = store.getState();
|
|
215
215
|
const conflictingProps = defaultKeys.filter(
|
|
216
|
-
(key) =>
|
|
216
|
+
(key) => _EEDWPDM2cjs.hasOwnProperty.call(void 0, storeState, key)
|
|
217
217
|
);
|
|
218
218
|
if (!conflictingProps.length)
|
|
219
219
|
return;
|
|
@@ -63,6 +63,9 @@ function isInteger(arg) {
|
|
|
63
63
|
return String(Math.floor(Number(arg))) === arg;
|
|
64
64
|
}
|
|
65
65
|
function hasOwnProperty(object, prop) {
|
|
66
|
+
if (typeof Object.hasOwn === "function") {
|
|
67
|
+
return Object.hasOwn(object, prop);
|
|
68
|
+
}
|
|
66
69
|
return Object.prototype.hasOwnProperty.call(object, prop);
|
|
67
70
|
}
|
|
68
71
|
function chain(...fns) {
|
|
@@ -130,6 +133,15 @@ function isFalsyBooleanCallback(booleanOrCallback, ...args) {
|
|
|
130
133
|
function disabledFromProps(props) {
|
|
131
134
|
return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
|
|
132
135
|
}
|
|
136
|
+
function removeUndefinedValues(obj) {
|
|
137
|
+
const result = {};
|
|
138
|
+
for (const key in obj) {
|
|
139
|
+
if (obj[key] !== void 0) {
|
|
140
|
+
result[key] = obj[key];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
133
145
|
function defaultValue(...values) {
|
|
134
146
|
for (const value of values) {
|
|
135
147
|
if (value !== void 0)
|
|
@@ -159,4 +171,5 @@ function defaultValue(...values) {
|
|
|
159
171
|
|
|
160
172
|
|
|
161
173
|
|
|
162
|
-
|
|
174
|
+
|
|
175
|
+
exports.noop = noop; exports.shallowEqual = shallowEqual; exports.applyState = applyState; exports.isObject = isObject; exports.isEmpty = isEmpty; exports.isInteger = isInteger; exports.hasOwnProperty = hasOwnProperty; exports.chain = chain; exports.cx = cx; exports.normalizeString = normalizeString; exports.omit = omit; exports.pick = pick; exports.identity = identity; exports.beforePaint = beforePaint; exports.afterPaint = afterPaint; exports.invariant = invariant; exports.getKeys = getKeys; exports.isFalsyBooleanCallback = isFalsyBooleanCallback; exports.disabledFromProps = disabledFromProps; exports.removeUndefinedValues = removeUndefinedValues; exports.defaultValue = defaultValue;
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _B4LYZ4EMcjs = require('./B4LYZ4EM.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _UKR6TQI3cjs = require('./UKR6TQI3.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -62,16 +62,16 @@ function getCommonParent(items) {
|
|
|
62
62
|
}
|
|
63
63
|
parentElement = parentElement.parentElement;
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return _UKR6TQI3cjs.getDocument.call(void 0, parentElement).body;
|
|
66
66
|
}
|
|
67
67
|
function getPrivateStore(store) {
|
|
68
68
|
return store == null ? void 0 : store.__unstablePrivateStore;
|
|
69
69
|
}
|
|
70
70
|
function createCollectionStore(props = {}) {
|
|
71
71
|
var _a;
|
|
72
|
-
|
|
72
|
+
_B4LYZ4EMcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
73
73
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
74
|
-
const items =
|
|
74
|
+
const items = _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
75
75
|
props.items,
|
|
76
76
|
syncState == null ? void 0 : syncState.items,
|
|
77
77
|
props.defaultItems,
|
|
@@ -80,22 +80,27 @@ function createCollectionStore(props = {}) {
|
|
|
80
80
|
const itemsMap = new Map(items.map((item) => [item.id, item]));
|
|
81
81
|
const initialState = {
|
|
82
82
|
items,
|
|
83
|
-
renderedItems:
|
|
83
|
+
renderedItems: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
|
|
84
84
|
};
|
|
85
85
|
const syncPrivateStore = getPrivateStore(props.store);
|
|
86
|
-
const privateStore =
|
|
87
|
-
{ renderedItems: initialState.renderedItems },
|
|
86
|
+
const privateStore = _B4LYZ4EMcjs.createStore.call(void 0,
|
|
87
|
+
{ items, renderedItems: initialState.renderedItems },
|
|
88
88
|
syncPrivateStore
|
|
89
89
|
);
|
|
90
|
-
const collection =
|
|
90
|
+
const collection = _B4LYZ4EMcjs.createStore.call(void 0, initialState, props.store);
|
|
91
91
|
const sortItems = (renderedItems) => {
|
|
92
92
|
const sortedItems = sortBasedOnDOMPosition(renderedItems);
|
|
93
93
|
privateStore.setState("renderedItems", sortedItems);
|
|
94
94
|
collection.setState("renderedItems", sortedItems);
|
|
95
95
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return
|
|
96
|
+
_B4LYZ4EMcjs.setup.call(void 0, collection, () => _B4LYZ4EMcjs.init.call(void 0, privateStore));
|
|
97
|
+
_B4LYZ4EMcjs.setup.call(void 0, privateStore, () => {
|
|
98
|
+
return _B4LYZ4EMcjs.batch.call(void 0, privateStore, ["items"], (state) => {
|
|
99
|
+
collection.setState("items", state.items);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
_B4LYZ4EMcjs.setup.call(void 0, privateStore, () => {
|
|
103
|
+
return _B4LYZ4EMcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
|
|
99
104
|
let firstRun = true;
|
|
100
105
|
let raf = requestAnimationFrame(() => {
|
|
101
106
|
const { renderedItems } = collection.getState();
|
|
@@ -162,10 +167,14 @@ function createCollectionStore(props = {}) {
|
|
|
162
167
|
};
|
|
163
168
|
return unmergeItem;
|
|
164
169
|
};
|
|
165
|
-
const registerItem = (item) => mergeItem(
|
|
170
|
+
const registerItem = (item) => mergeItem(
|
|
171
|
+
item,
|
|
172
|
+
(getItems) => privateStore.setState("items", getItems),
|
|
173
|
+
true
|
|
174
|
+
);
|
|
166
175
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection), {
|
|
167
176
|
registerItem,
|
|
168
|
-
renderItem: (item) =>
|
|
177
|
+
renderItem: (item) => _EEDWPDM2cjs.chain.call(void 0,
|
|
169
178
|
registerItem(item),
|
|
170
179
|
mergeItem(
|
|
171
180
|
item,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _AETQC2ARcjs = require('./AETQC2AR.cjs');
|
|
5
5
|
|
|
6
6
|
// src/dialog/dialog-store.ts
|
|
7
7
|
function createDialogStore(props = {}) {
|
|
8
|
-
return
|
|
8
|
+
return _AETQC2ARcjs.createDisclosureStore.call(void 0, props);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _Y7KNI5NScjs = require('./Y7KNI5NS.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _B4LYZ4EMcjs = require('./B4LYZ4EM.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -17,16 +17,16 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
17
17
|
function createMenubarStore(props = {}) {
|
|
18
18
|
var _a;
|
|
19
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
-
const composite =
|
|
21
|
-
orientation:
|
|
20
|
+
const composite = _Y7KNI5NScjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
|
+
orientation: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
22
22
|
props.orientation,
|
|
23
23
|
syncState == null ? void 0 : syncState.orientation,
|
|
24
24
|
"horizontal"
|
|
25
25
|
),
|
|
26
|
-
focusLoop:
|
|
26
|
+
focusLoop: _EEDWPDM2cjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
27
27
|
}));
|
|
28
28
|
const initialState = _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState());
|
|
29
|
-
const menubar =
|
|
29
|
+
const menubar = _B4LYZ4EMcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
30
30
|
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), menubar);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _5JEQEZFRcjs = require('./5JEQEZFR.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _B4LYZ4EMcjs = require('./B4LYZ4EM.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -17,21 +17,21 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
17
17
|
function createHovercardStore(props = {}) {
|
|
18
18
|
var _a;
|
|
19
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
-
const popover =
|
|
21
|
-
placement:
|
|
20
|
+
const popover = _5JEQEZFRcjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
|
+
placement: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
22
22
|
props.placement,
|
|
23
23
|
syncState == null ? void 0 : syncState.placement,
|
|
24
24
|
"bottom"
|
|
25
25
|
)
|
|
26
26
|
}));
|
|
27
|
-
const timeout =
|
|
27
|
+
const timeout = _EEDWPDM2cjs.defaultValue.call(void 0, props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
|
|
28
28
|
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover.getState()), {
|
|
29
29
|
timeout,
|
|
30
|
-
showTimeout:
|
|
31
|
-
hideTimeout:
|
|
32
|
-
autoFocusOnShow:
|
|
30
|
+
showTimeout: _EEDWPDM2cjs.defaultValue.call(void 0, props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
|
|
31
|
+
hideTimeout: _EEDWPDM2cjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
|
|
32
|
+
autoFocusOnShow: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
33
33
|
});
|
|
34
|
-
const hovercard =
|
|
34
|
+
const hovercard = _B4LYZ4EMcjs.createStore.call(void 0, initialState, popover, props.store);
|
|
35
35
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
|
|
36
36
|
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
|
|
37
37
|
});
|
|
@@ -102,8 +102,7 @@ function getPopupItemRole(element, fallback) {
|
|
|
102
102
|
const itemRoleByPopupRole = {
|
|
103
103
|
menu: "menuitem",
|
|
104
104
|
listbox: "option",
|
|
105
|
-
tree: "treeitem"
|
|
106
|
-
grid: "gridcell"
|
|
105
|
+
tree: "treeitem"
|
|
107
106
|
};
|
|
108
107
|
const popupRole = getPopupRole(element);
|
|
109
108
|
if (!popupRole)
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _FFZYCAXAcjs = require('./FFZYCAXA.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _B4LYZ4EMcjs = require('./B4LYZ4EM.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -124,40 +124,40 @@ function verticalizeItems(items) {
|
|
|
124
124
|
function createCompositeStore(props = {}) {
|
|
125
125
|
var _a;
|
|
126
126
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
127
|
-
const collection =
|
|
128
|
-
const activeId =
|
|
127
|
+
const collection = _FFZYCAXAcjs.createCollectionStore.call(void 0, props);
|
|
128
|
+
const activeId = _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
129
129
|
props.activeId,
|
|
130
130
|
syncState == null ? void 0 : syncState.activeId,
|
|
131
131
|
props.defaultActiveId
|
|
132
132
|
);
|
|
133
133
|
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection.getState()), {
|
|
134
134
|
activeId,
|
|
135
|
-
baseElement:
|
|
136
|
-
includesBaseElement:
|
|
135
|
+
baseElement: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
|
|
136
|
+
includesBaseElement: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
137
137
|
props.includesBaseElement,
|
|
138
138
|
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
139
139
|
activeId === null
|
|
140
140
|
),
|
|
141
|
-
moves:
|
|
142
|
-
orientation:
|
|
141
|
+
moves: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
|
|
142
|
+
orientation: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
143
143
|
props.orientation,
|
|
144
144
|
syncState == null ? void 0 : syncState.orientation,
|
|
145
145
|
"both"
|
|
146
146
|
),
|
|
147
|
-
rtl:
|
|
148
|
-
virtualFocus:
|
|
147
|
+
rtl: _EEDWPDM2cjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
|
|
148
|
+
virtualFocus: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
149
149
|
props.virtualFocus,
|
|
150
150
|
syncState == null ? void 0 : syncState.virtualFocus,
|
|
151
151
|
false
|
|
152
152
|
),
|
|
153
|
-
focusLoop:
|
|
154
|
-
focusWrap:
|
|
155
|
-
focusShift:
|
|
153
|
+
focusLoop: _EEDWPDM2cjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
|
|
154
|
+
focusWrap: _EEDWPDM2cjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
155
|
+
focusShift: _EEDWPDM2cjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
156
156
|
});
|
|
157
|
-
const composite =
|
|
158
|
-
|
|
157
|
+
const composite = _B4LYZ4EMcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
158
|
+
_B4LYZ4EMcjs.setup.call(void 0,
|
|
159
159
|
composite,
|
|
160
|
-
() =>
|
|
160
|
+
() => _B4LYZ4EMcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
|
|
161
161
|
composite.setState("activeId", (activeId2) => {
|
|
162
162
|
var _a2;
|
|
163
163
|
if (activeId2 !== void 0)
|