@serendie/ui 0.1.15 → 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/LICENSE +21 -0
- package/README.md +51 -9
- package/dist/components/{Accordion.d.ts → Accordion/Accordion.d.ts} +2 -2
- package/dist/components/{Accordion.js → Accordion/Accordion.js} +10 -10
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/AccordionGroup.js +4 -4
- package/dist/components/Avatar.js +4 -4
- package/dist/components/Badge.js +4 -4
- package/dist/components/Banner.js +4 -4
- package/dist/components/BottomNavigation.js +3 -3
- package/dist/components/BottomNavigationItem.js +4 -4
- package/dist/components/Button.js +10 -9
- package/dist/components/CheckBox.js +4 -4
- package/dist/components/ChoiceBox.js +10 -10
- package/dist/components/DashboardWidget.js +4 -4
- package/dist/components/Divider.js +4 -4
- package/dist/components/Drawer.js +4 -4
- package/dist/components/DropdownMenu.js +7 -6
- package/dist/components/IconButton.js +4 -4
- package/dist/components/ListItem.js +4 -4
- package/dist/components/ModalDialog.js +4 -4
- package/dist/components/NotificationBadge.js +4 -4
- package/dist/components/PasswordField.js +44 -0
- package/dist/components/ProgressIndicator.js +4 -4
- package/dist/components/RadioButton.js +4 -4
- package/dist/components/Search.js +6 -6
- package/dist/components/Select.js +4 -4
- package/dist/components/Switch.js +4 -4
- package/dist/components/TabItem.js +4 -4
- package/dist/components/Tabs.js +4 -4
- package/dist/components/TextArea.js +4 -4
- package/dist/components/TextField.js +4 -4
- package/dist/components/Toast.js +3 -3
- package/dist/components/TopAppBar.js +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +81 -79
- package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-content.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-indicator.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-trigger.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-root.js +2 -3
- package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-fallback.js +6 -7
- package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-image.js +5 -6
- package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-root.js +2 -3
- package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-control.js +5 -6
- package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-hidden-input.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-label.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-root.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-content.js +8 -9
- package/dist/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-root.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-content.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-control.js +5 -6
- package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-input.js +6 -7
- package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item-group.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item-text.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-positioner.js +5 -6
- package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-root.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-trigger.js +5 -6
- package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-backdrop.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-close-trigger.js +5 -6
- package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-content.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-description.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-positioner.js +5 -6
- package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-root.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-title.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-content.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item-group.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item.js +2 -3
- package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-positioner.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +2 -3
- package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-trigger.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-hidden-input.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-text.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-root.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/select/select-content.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/select/select-control.js +6 -7
- package/dist/node_modules/@ark-ui/react/dist/components/select/select-item.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/select/select-label.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/select/select-positioner.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/select/select-root.js +7 -7
- package/dist/node_modules/@ark-ui/react/dist/components/select/select-trigger.js +5 -6
- package/dist/node_modules/@ark-ui/react/dist/components/select/select-value-text.js +5 -6
- package/dist/node_modules/@ark-ui/react/dist/components/select/use-select.js +35 -31
- package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-control.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-label.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-root.js +8 -9
- package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-thumb.js +4 -5
- package/dist/node_modules/@ark-ui/react/dist/components/tabs/tab-list.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/tabs/tab-trigger.js +3 -4
- package/dist/node_modules/@ark-ui/react/dist/components/tabs/tabs-root.js +10 -10
- package/dist/node_modules/@ark-ui/react/dist/components/toast/toast-root.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/toast/toast-title.js +0 -1
- package/dist/node_modules/@ark-ui/react/dist/components/toast/toaster.js +4 -4
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +361 -303
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +229 -216
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +19 -19
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +39 -38
- package/dist/node_modules/@serendie/design-token/dist/panda-tokens.js +823 -20
- package/dist/node_modules/@serendie/design-token/dist/tokens.js +346 -25
- package/dist/node_modules/@zag-js/accordion/dist/index.js +12 -12
- package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +13 -62
- package/dist/node_modules/@zag-js/avatar/dist/index.js +12 -10
- package/dist/node_modules/@zag-js/checkbox/dist/index.js +99 -92
- package/dist/node_modules/@zag-js/collapsible/dist/index.js +5 -5
- package/dist/node_modules/@zag-js/collection/dist/index.js +21 -21
- package/dist/node_modules/@zag-js/combobox/dist/index.js +30 -31
- package/dist/node_modules/@zag-js/core/dist/index.js +285 -320
- package/dist/node_modules/@zag-js/dialog/dist/index.js +56 -62
- package/dist/node_modules/@zag-js/dismissable/dist/index.js +3 -3
- package/dist/node_modules/@zag-js/dom-event/dist/index.js +88 -115
- package/dist/node_modules/@zag-js/dom-query/dist/index.js +2 -2
- package/dist/node_modules/@zag-js/focus-visible/dist/index.js +73 -0
- package/dist/node_modules/@zag-js/interact-outside/dist/index.js +33 -33
- package/dist/node_modules/@zag-js/menu/dist/index.js +81 -77
- package/dist/node_modules/@zag-js/popper/dist/index.js +86 -79
- package/dist/node_modules/@zag-js/radio-group/dist/index.js +116 -109
- package/dist/node_modules/@zag-js/react/dist/index.js +44 -43
- package/dist/node_modules/@zag-js/select/dist/index.js +203 -231
- package/dist/node_modules/@zag-js/store/dist/index.js +110 -110
- package/dist/node_modules/@zag-js/switch/dist/index.js +62 -55
- package/dist/node_modules/@zag-js/tabs/dist/index.js +64 -61
- package/dist/node_modules/@zag-js/toast/dist/index.js +174 -173
- package/dist/node_modules/@zag-js/utils/dist/index.js +93 -71
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
- package/dist/node_modules/focus-trap/dist/focus-trap.esm.js +217 -219
- package/dist/preset.d.ts +807 -4
- package/dist/{ui/styled-system → styled-system}/css/css.js +5 -6
- package/dist/{ui/styled-system → styled-system}/css/cva.js +4 -4
- package/dist/{ui/styled-system → styled-system}/css/sva.js +3 -3
- package/dist/styled-system/jsx/is-valid-prop.js +6 -0
- package/dist/styles.css +1 -1
- package/dist/tokens/getToken.d.ts +324 -3
- package/dist/tokens/index.d.ts +806 -3
- package/package.json +31 -5
- package/styled-system/css/css.js +1 -1
- package/styled-system/jsx/is-valid-prop.js +1 -1
- package/styled-system/themes/theme-asagi.json +1 -1
- package/styled-system/themes/theme-kurikawa.json +1 -1
- package/styled-system/themes/theme-sumire.json +1 -1
- package/styled-system/themes/theme-tsutsuji.json +1 -1
- package/styled-system/tokens/index.js +1238 -54
- package/styled-system/tokens/tokens.d.ts +3 -3
- package/styled-system/types/conditions.d.ts +2 -2
- package/styled-system/types/prop-type.d.ts +1 -1
- package/dist/ui/styled-system/jsx/is-valid-prop.js +0 -6
- /package/dist/{ui/styled-system → styled-system}/css/conditions.js +0 -0
- /package/dist/{ui/styled-system → styled-system}/css/cx.js +0 -0
- /package/dist/{ui/styled-system → styled-system}/helpers.js +0 -0
- /package/dist/{ui/styled-system → styled-system}/jsx/box.js +0 -0
- /package/dist/{ui/styled-system → styled-system}/jsx/factory-helper.js +0 -0
- /package/dist/{ui/styled-system → styled-system}/jsx/factory.js +0 -0
- /package/dist/{ui/styled-system → styled-system}/patterns/box.js +0 -0
|
@@ -1,68 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return NodeFilter.FILTER_REJECT;
|
|
13
|
-
for (let N of a)
|
|
14
|
-
if (i.contains(N))
|
|
15
|
-
return NodeFilter.FILTER_SKIP;
|
|
16
|
-
return NodeFilter.FILTER_ACCEPT;
|
|
17
|
-
}, t = l.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: n }), v = n(e);
|
|
18
|
-
if (v === NodeFilter.FILTER_ACCEPT && m(e), v !== NodeFilter.FILTER_REJECT) {
|
|
19
|
-
let i = t.nextNode();
|
|
20
|
-
for (; i != null; )
|
|
21
|
-
m(i), i = t.nextNode();
|
|
22
|
-
}
|
|
23
|
-
}, m = (e) => {
|
|
24
|
-
let n = f.get(e) ?? 0;
|
|
25
|
-
e.getAttribute("aria-hidden") === "true" && n === 0 || (n === 0 && e.setAttribute("aria-hidden", "true"), c.add(e), f.set(e, n + 1));
|
|
26
|
-
};
|
|
27
|
-
o.length && o[o.length - 1].disconnect(), g(p);
|
|
28
|
-
const h = new r.MutationObserver((e) => {
|
|
29
|
-
for (let n of e)
|
|
30
|
-
if (!(n.type !== "childList" || n.addedNodes.length === 0) && ![...a, ...c].some((t) => t.contains(n.target))) {
|
|
31
|
-
for (let t of n.removedNodes)
|
|
32
|
-
t instanceof r.Element && (a.delete(t), c.delete(t));
|
|
33
|
-
for (let t of n.addedNodes)
|
|
34
|
-
(t instanceof r.HTMLElement || t instanceof r.SVGElement) && (t.dataset.liveAnnouncer === "true" || t.dataset.zagTopLayer === "true") ? a.add(t) : t instanceof r.Element && g(t);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
h.observe(p, { childList: !0, subtree: !0 });
|
|
38
|
-
let b = {
|
|
39
|
-
observe() {
|
|
40
|
-
h.observe(p, { childList: !0, subtree: !0 });
|
|
41
|
-
},
|
|
42
|
-
disconnect() {
|
|
43
|
-
h.disconnect();
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
return o.push(b), () => {
|
|
47
|
-
h.disconnect();
|
|
48
|
-
for (let e of c) {
|
|
49
|
-
let n = f.get(e);
|
|
50
|
-
n === 1 ? (e.removeAttribute("aria-hidden"), f.delete(e)) : f.set(e, n - 1);
|
|
51
|
-
}
|
|
52
|
-
b === o[o.length - 1] ? (o.pop(), o.length && o[o.length - 1].observe()) : o.splice(o.indexOf(b), 1);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function F(d, u = {}) {
|
|
56
|
-
const { defer: E } = u, s = E ? w : (r) => r(), l = [];
|
|
57
|
-
return l.push(
|
|
58
|
-
s(() => {
|
|
59
|
-
const r = typeof d == "function" ? d() : d;
|
|
60
|
-
l.push(T(r, u));
|
|
1
|
+
import { hideOthers as s } from "../../../aria-hidden/dist/es2015/index.js";
|
|
2
|
+
var i = (t) => {
|
|
3
|
+
const o = requestAnimationFrame(() => t());
|
|
4
|
+
return () => cancelAnimationFrame(o);
|
|
5
|
+
};
|
|
6
|
+
function m(t, o = {}) {
|
|
7
|
+
const { defer: n = !0 } = o, a = n ? i : (e) => e(), r = [];
|
|
8
|
+
return r.push(
|
|
9
|
+
a(() => {
|
|
10
|
+
const c = (typeof t == "function" ? t() : t).filter(Boolean);
|
|
11
|
+
r.push(s(c));
|
|
61
12
|
})
|
|
62
13
|
), () => {
|
|
63
|
-
|
|
14
|
+
r.forEach((e) => e == null ? void 0 : e());
|
|
64
15
|
};
|
|
65
16
|
}
|
|
66
17
|
export {
|
|
67
|
-
|
|
18
|
+
m as ariaHidden
|
|
68
19
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createAnatomy as g } from "../../anatomy/dist/index.js";
|
|
2
|
-
import { createScope as l,
|
|
2
|
+
import { createScope as l, observeChildren as m, observeAttributes as v } from "../../dom-query/dist/index.js";
|
|
3
3
|
import { createMachine as I } from "../../core/dist/index.js";
|
|
4
4
|
import { compact as p } from "../../utils/dist/index.js";
|
|
5
|
-
import { createProps as
|
|
6
|
-
var
|
|
5
|
+
import { createProps as E } from "../../types/dist/index.js";
|
|
6
|
+
var R = g("avatar").parts("root", "image", "fallback"), c = R.build(), o = l({
|
|
7
7
|
getRootId: (t) => {
|
|
8
8
|
var a;
|
|
9
9
|
return ((a = t.ids) == null ? void 0 : a.root) ?? `avatar:${t.id}`;
|
|
@@ -19,7 +19,7 @@ var E = g("avatar").parts("root", "image", "fallback"), c = E.build(), o = l({
|
|
|
19
19
|
getRootEl: (t) => o.getById(t, o.getRootId(t)),
|
|
20
20
|
getImageEl: (t) => o.getById(t, o.getImageId(t))
|
|
21
21
|
});
|
|
22
|
-
function
|
|
22
|
+
function S(t, a, e) {
|
|
23
23
|
const r = t.matches("loaded");
|
|
24
24
|
return {
|
|
25
25
|
loaded: r,
|
|
@@ -120,7 +120,7 @@ function G(t) {
|
|
|
120
120
|
activities: {
|
|
121
121
|
trackSrcChange(e, r, { send: n }) {
|
|
122
122
|
const i = o.getImageEl(e);
|
|
123
|
-
return
|
|
123
|
+
return v(i, {
|
|
124
124
|
attributes: ["src", "srcset"],
|
|
125
125
|
callback() {
|
|
126
126
|
n({ type: "SRC.CHANGE" });
|
|
@@ -129,9 +129,11 @@ function G(t) {
|
|
|
129
129
|
},
|
|
130
130
|
trackImageRemoval(e, r, { send: n }) {
|
|
131
131
|
const i = o.getRootEl(e);
|
|
132
|
-
return
|
|
132
|
+
return m(i, {
|
|
133
133
|
callback(d) {
|
|
134
|
-
Array.from(d[0].removedNodes).find(
|
|
134
|
+
Array.from(d[0].removedNodes).find(
|
|
135
|
+
(s) => s.nodeType === Node.ELEMENT_NODE && s.matches("[data-scope=avatar][data-part=image]")
|
|
136
|
+
) && n({ type: "IMG.UNMOUNT" });
|
|
135
137
|
}
|
|
136
138
|
});
|
|
137
139
|
}
|
|
@@ -159,9 +161,9 @@ function G(t) {
|
|
|
159
161
|
function k(t) {
|
|
160
162
|
return t.complete && t.naturalWidth !== 0 && t.naturalHeight !== 0;
|
|
161
163
|
}
|
|
162
|
-
|
|
164
|
+
E()(["dir", "id", "ids", "onStatusChange", "getRootNode"]);
|
|
163
165
|
export {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
R as anatomy,
|
|
167
|
+
S as connect,
|
|
166
168
|
G as machine
|
|
167
169
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { createAnatomy as
|
|
2
|
-
import { createScope as m, dataAttr as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { createAnatomy as b } from "../../anatomy/dist/index.js";
|
|
2
|
+
import { createScope as m, dataAttr as c, visuallyHiddenStyle as v } from "../../dom-query/dist/index.js";
|
|
3
|
+
import { trackFocusVisible as I, isFocusVisible as T } from "../../focus-visible/dist/index.js";
|
|
4
|
+
import { createMachine as y, guards as H } from "../../core/dist/index.js";
|
|
5
|
+
import { trackPress as x } from "../../dom-event/dist/index.js";
|
|
6
|
+
import { dispatchInputCheckedEvent as D, setElementChecked as P, trackFormControl as S } from "../../form-utils/dist/index.js";
|
|
7
|
+
import { compact as F, isEqual as V } from "../../utils/dist/index.js";
|
|
8
|
+
import { createProps as N } from "../../types/dist/index.js";
|
|
9
|
+
var O = b("checkbox").parts("root", "label", "control", "indicator"), l = O.build(), n = m({
|
|
9
10
|
getRootId: (e) => {
|
|
10
11
|
var d;
|
|
11
12
|
return ((d = e.ids) == null ? void 0 : d.root) ?? `checkbox:${e.id}`;
|
|
@@ -22,103 +23,111 @@ var O = E("checkbox").parts("root", "label", "control", "indicator"), u = O.buil
|
|
|
22
23
|
var d;
|
|
23
24
|
return ((d = e.ids) == null ? void 0 : d.hiddenInput) ?? `checkbox:${e.id}:input`;
|
|
24
25
|
},
|
|
25
|
-
getRootEl: (e) =>
|
|
26
|
-
getHiddenInputEl: (e) =>
|
|
26
|
+
getRootEl: (e) => n.getById(e, n.getRootId(e)),
|
|
27
|
+
getHiddenInputEl: (e) => n.getById(e, n.getHiddenInputId(e))
|
|
27
28
|
});
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
-
"data-active":
|
|
31
|
-
"data-focus":
|
|
32
|
-
"data-
|
|
33
|
-
"data-
|
|
34
|
-
"data-
|
|
35
|
-
"data-
|
|
36
|
-
"data-
|
|
29
|
+
function M(e, d, t) {
|
|
30
|
+
const o = e.context.isDisabled, r = e.context.readOnly, a = !o && e.context.focused, u = !o && e.context.focusVisible, h = e.context.isChecked, k = e.context.isIndeterminate, s = {
|
|
31
|
+
"data-active": c(e.context.active),
|
|
32
|
+
"data-focus": c(a),
|
|
33
|
+
"data-focus-visible": c(u),
|
|
34
|
+
"data-readonly": c(r),
|
|
35
|
+
"data-hover": c(e.context.hovered),
|
|
36
|
+
"data-disabled": c(o),
|
|
37
|
+
"data-state": k ? "indeterminate" : e.context.checked ? "checked" : "unchecked",
|
|
38
|
+
"data-invalid": c(e.context.invalid)
|
|
37
39
|
};
|
|
38
40
|
return {
|
|
39
|
-
checked:
|
|
40
|
-
disabled:
|
|
41
|
-
indeterminate:
|
|
42
|
-
focused:
|
|
41
|
+
checked: h,
|
|
42
|
+
disabled: o,
|
|
43
|
+
indeterminate: k,
|
|
44
|
+
focused: a,
|
|
43
45
|
checkedState: e.context.checked,
|
|
44
|
-
setChecked(
|
|
45
|
-
d({ type: "CHECKED.SET", checked:
|
|
46
|
+
setChecked(i) {
|
|
47
|
+
d({ type: "CHECKED.SET", checked: i, isTrusted: !1 });
|
|
46
48
|
},
|
|
47
49
|
toggleChecked() {
|
|
48
|
-
d({ type: "CHECKED.TOGGLE", checked:
|
|
50
|
+
d({ type: "CHECKED.TOGGLE", checked: h, isTrusted: !1 });
|
|
49
51
|
},
|
|
50
52
|
getRootProps() {
|
|
51
53
|
return t.label({
|
|
52
|
-
...
|
|
53
|
-
...
|
|
54
|
+
...l.root.attrs,
|
|
55
|
+
...s,
|
|
54
56
|
dir: e.context.dir,
|
|
55
|
-
id:
|
|
56
|
-
htmlFor:
|
|
57
|
+
id: n.getRootId(e.context),
|
|
58
|
+
htmlFor: n.getHiddenInputId(e.context),
|
|
57
59
|
onPointerMove() {
|
|
58
|
-
|
|
60
|
+
o || d({ type: "CONTEXT.SET", context: { hovered: !0 } });
|
|
59
61
|
},
|
|
60
62
|
onPointerLeave() {
|
|
61
|
-
|
|
63
|
+
o || d({ type: "CONTEXT.SET", context: { hovered: !1 } });
|
|
62
64
|
},
|
|
63
|
-
onClick(
|
|
64
|
-
|
|
65
|
+
onClick(i) {
|
|
66
|
+
i.target === n.getHiddenInputEl(e.context) && i.stopPropagation();
|
|
65
67
|
}
|
|
66
68
|
});
|
|
67
69
|
},
|
|
68
70
|
getLabelProps() {
|
|
69
71
|
return t.element({
|
|
70
|
-
...
|
|
71
|
-
...
|
|
72
|
+
...l.label.attrs,
|
|
73
|
+
...s,
|
|
72
74
|
dir: e.context.dir,
|
|
73
|
-
id:
|
|
75
|
+
id: n.getLabelId(e.context)
|
|
74
76
|
});
|
|
75
77
|
},
|
|
76
78
|
getControlProps() {
|
|
77
79
|
return t.element({
|
|
78
|
-
...
|
|
79
|
-
...
|
|
80
|
+
...l.control.attrs,
|
|
81
|
+
...s,
|
|
80
82
|
dir: e.context.dir,
|
|
81
|
-
id:
|
|
83
|
+
id: n.getControlId(e.context),
|
|
82
84
|
"aria-hidden": !0
|
|
83
85
|
});
|
|
84
86
|
},
|
|
85
87
|
getIndicatorProps() {
|
|
86
88
|
return t.element({
|
|
87
|
-
...
|
|
88
|
-
...
|
|
89
|
+
...l.indicator.attrs,
|
|
90
|
+
...s,
|
|
89
91
|
dir: e.context.dir,
|
|
90
|
-
hidden: !
|
|
92
|
+
hidden: !k && !e.context.checked
|
|
91
93
|
});
|
|
92
94
|
},
|
|
93
95
|
getHiddenInputProps() {
|
|
94
96
|
return t.input({
|
|
95
|
-
id:
|
|
97
|
+
id: n.getHiddenInputId(e.context),
|
|
96
98
|
type: "checkbox",
|
|
97
99
|
required: e.context.required,
|
|
98
|
-
defaultChecked:
|
|
99
|
-
disabled:
|
|
100
|
-
"aria-labelledby":
|
|
100
|
+
defaultChecked: h,
|
|
101
|
+
disabled: o,
|
|
102
|
+
"aria-labelledby": n.getLabelId(e.context),
|
|
101
103
|
"aria-invalid": e.context.invalid,
|
|
102
104
|
name: e.context.name,
|
|
103
105
|
form: e.context.form,
|
|
104
106
|
value: e.context.value,
|
|
105
|
-
style:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
style: v,
|
|
108
|
+
onFocus() {
|
|
109
|
+
const i = T();
|
|
110
|
+
d({ type: "CONTEXT.SET", context: { focused: !0, focusVisible: i } });
|
|
111
|
+
},
|
|
112
|
+
onBlur() {
|
|
113
|
+
d({ type: "CONTEXT.SET", context: { focused: !1, focusVisible: !1 } });
|
|
114
|
+
},
|
|
115
|
+
onClick(i) {
|
|
116
|
+
if (r) {
|
|
117
|
+
i.preventDefault();
|
|
109
118
|
return;
|
|
110
119
|
}
|
|
111
|
-
const
|
|
112
|
-
d({ type: "CHECKED.SET", checked:
|
|
120
|
+
const E = i.currentTarget.checked;
|
|
121
|
+
d({ type: "CHECKED.SET", checked: E, isTrusted: !0 });
|
|
113
122
|
}
|
|
114
123
|
});
|
|
115
124
|
}
|
|
116
125
|
};
|
|
117
126
|
}
|
|
118
|
-
var { not: p } =
|
|
119
|
-
function
|
|
120
|
-
const d =
|
|
121
|
-
return
|
|
127
|
+
var { not: p } = H;
|
|
128
|
+
function _(e) {
|
|
129
|
+
const d = F(e);
|
|
130
|
+
return y(
|
|
122
131
|
{
|
|
123
132
|
id: "checkbox",
|
|
124
133
|
initial: "ready",
|
|
@@ -127,7 +136,8 @@ function B(e) {
|
|
|
127
136
|
value: "on",
|
|
128
137
|
disabled: !1,
|
|
129
138
|
...d,
|
|
130
|
-
fieldsetDisabled: !1
|
|
139
|
+
fieldsetDisabled: !1,
|
|
140
|
+
focusVisible: !1
|
|
131
141
|
},
|
|
132
142
|
watch: {
|
|
133
143
|
disabled: "removeFocusIfNeeded",
|
|
@@ -158,7 +168,7 @@ function B(e) {
|
|
|
158
168
|
}
|
|
159
169
|
},
|
|
160
170
|
computed: {
|
|
161
|
-
isIndeterminate: (t) =>
|
|
171
|
+
isIndeterminate: (t) => f(t.checked),
|
|
162
172
|
isChecked: (t) => g(t.checked),
|
|
163
173
|
isDisabled: (t) => !!t.disabled || t.fieldsetDisabled
|
|
164
174
|
},
|
|
@@ -168,15 +178,15 @@ function B(e) {
|
|
|
168
178
|
},
|
|
169
179
|
{
|
|
170
180
|
guards: {
|
|
171
|
-
isTrusted: (t,
|
|
181
|
+
isTrusted: (t, o) => !!o.isTrusted
|
|
172
182
|
},
|
|
173
183
|
activities: {
|
|
174
184
|
trackPressEvent(t) {
|
|
175
185
|
if (!t.isDisabled)
|
|
176
|
-
return
|
|
177
|
-
pointerNode:
|
|
178
|
-
keyboardNode:
|
|
179
|
-
isValidKey: (
|
|
186
|
+
return x({
|
|
187
|
+
pointerNode: n.getRootEl(t),
|
|
188
|
+
keyboardNode: n.getHiddenInputEl(t),
|
|
189
|
+
isValidKey: (o) => o.key === " ",
|
|
180
190
|
onPress: () => t.active = !1,
|
|
181
191
|
onPressStart: () => t.active = !0,
|
|
182
192
|
onPressEnd: () => t.active = !1
|
|
@@ -184,65 +194,62 @@ function B(e) {
|
|
|
184
194
|
},
|
|
185
195
|
trackFocusVisible(t) {
|
|
186
196
|
if (!t.isDisabled)
|
|
187
|
-
return
|
|
188
|
-
onFocus: () => t.focused = !0,
|
|
189
|
-
onBlur: () => t.focused = !1
|
|
190
|
-
});
|
|
197
|
+
return I({ root: n.getRootNode(t) });
|
|
191
198
|
},
|
|
192
|
-
trackFormControlState(t,
|
|
193
|
-
return
|
|
194
|
-
onFieldsetDisabledChange(
|
|
195
|
-
t.fieldsetDisabled =
|
|
199
|
+
trackFormControlState(t, o, { send: r, initialContext: a }) {
|
|
200
|
+
return S(n.getHiddenInputEl(t), {
|
|
201
|
+
onFieldsetDisabledChange(u) {
|
|
202
|
+
t.fieldsetDisabled = u;
|
|
196
203
|
},
|
|
197
204
|
onFormReset() {
|
|
198
|
-
|
|
205
|
+
r({ type: "CHECKED.SET", checked: !!a.checked });
|
|
199
206
|
}
|
|
200
207
|
});
|
|
201
208
|
}
|
|
202
209
|
},
|
|
203
210
|
actions: {
|
|
204
|
-
setContext(t,
|
|
205
|
-
Object.assign(t,
|
|
211
|
+
setContext(t, o) {
|
|
212
|
+
Object.assign(t, o.context);
|
|
206
213
|
},
|
|
207
214
|
syncInputElement(t) {
|
|
208
|
-
const
|
|
209
|
-
|
|
215
|
+
const o = n.getHiddenInputEl(t);
|
|
216
|
+
o && (P(o, t.isChecked), o.indeterminate = t.isIndeterminate);
|
|
210
217
|
},
|
|
211
218
|
removeFocusIfNeeded(t) {
|
|
212
|
-
t.disabled && t.focused && (t.focused = !1);
|
|
219
|
+
t.disabled && t.focused && (t.focused = !1, t.focusVisible = !1);
|
|
213
220
|
},
|
|
214
|
-
setChecked(t,
|
|
215
|
-
|
|
221
|
+
setChecked(t, o) {
|
|
222
|
+
C.checked(t, o.checked);
|
|
216
223
|
},
|
|
217
224
|
toggleChecked(t) {
|
|
218
|
-
const
|
|
219
|
-
|
|
225
|
+
const o = f(t.checked) ? !0 : !t.checked;
|
|
226
|
+
C.checked(t, o);
|
|
220
227
|
},
|
|
221
228
|
dispatchChangeEvent(t) {
|
|
222
|
-
const
|
|
223
|
-
|
|
229
|
+
const o = n.getHiddenInputEl(t);
|
|
230
|
+
D(o, { checked: g(t.checked) });
|
|
224
231
|
}
|
|
225
232
|
}
|
|
226
233
|
}
|
|
227
234
|
);
|
|
228
235
|
}
|
|
229
|
-
function
|
|
236
|
+
function f(e) {
|
|
230
237
|
return e === "indeterminate";
|
|
231
238
|
}
|
|
232
239
|
function g(e) {
|
|
233
|
-
return
|
|
240
|
+
return f(e) ? !1 : !!e;
|
|
234
241
|
}
|
|
235
|
-
var
|
|
242
|
+
var R = {
|
|
236
243
|
change: (e) => {
|
|
237
244
|
var d;
|
|
238
245
|
(d = e.onCheckedChange) == null || d.call(e, { checked: e.checked });
|
|
239
246
|
}
|
|
240
|
-
},
|
|
247
|
+
}, C = {
|
|
241
248
|
checked: (e, d) => {
|
|
242
|
-
|
|
249
|
+
V(e.checked, d) || (e.checked = d, R.change(e));
|
|
243
250
|
}
|
|
244
251
|
};
|
|
245
|
-
|
|
252
|
+
N()([
|
|
246
253
|
"checked",
|
|
247
254
|
"dir",
|
|
248
255
|
"disabled",
|
|
@@ -259,6 +266,6 @@ F()([
|
|
|
259
266
|
]);
|
|
260
267
|
export {
|
|
261
268
|
O as anatomy,
|
|
262
|
-
|
|
263
|
-
|
|
269
|
+
M as connect,
|
|
270
|
+
_ as machine
|
|
264
271
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createAnatomy as E } from "../../anatomy/dist/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { raf as c, createScope as N, getComputedStyle as f, dataAttr as O } from "../../dom-query/dist/index.js";
|
|
3
3
|
import { createMachine as h } from "../../core/dist/index.js";
|
|
4
4
|
import { compact as v } from "../../utils/dist/index.js";
|
|
5
5
|
import { createProps as y } from "../../types/dist/index.js";
|
|
@@ -43,7 +43,7 @@ function T(n, r, e) {
|
|
|
43
43
|
...g.content.attrs,
|
|
44
44
|
"data-state": d ? void 0 : i ? "open" : "closed",
|
|
45
45
|
id: l.getContentId(n.context),
|
|
46
|
-
"data-disabled":
|
|
46
|
+
"data-disabled": O(a),
|
|
47
47
|
hidden: !o,
|
|
48
48
|
style: {
|
|
49
49
|
"--height": t != null ? `${t}px` : void 0,
|
|
@@ -58,7 +58,7 @@ function T(n, r, e) {
|
|
|
58
58
|
dir: n.context.dir,
|
|
59
59
|
type: "button",
|
|
60
60
|
"data-state": i ? "open" : "closed",
|
|
61
|
-
"data-disabled":
|
|
61
|
+
"data-disabled": O(a),
|
|
62
62
|
"aria-controls": l.getContentId(n.context),
|
|
63
63
|
"aria-expanded": o || !1,
|
|
64
64
|
onClick(p) {
|
|
@@ -160,7 +160,7 @@ function P(n) {
|
|
|
160
160
|
activities: {
|
|
161
161
|
trackAnimationEvents(e, o, { send: i }) {
|
|
162
162
|
let t;
|
|
163
|
-
const s =
|
|
163
|
+
const s = c(() => {
|
|
164
164
|
const a = l.getContentEl(e);
|
|
165
165
|
if (!a) return;
|
|
166
166
|
const d = f(a).animationName;
|
|
@@ -190,7 +190,7 @@ function P(n) {
|
|
|
190
190
|
},
|
|
191
191
|
computeSize(e, o) {
|
|
192
192
|
var i;
|
|
193
|
-
(i = e._rafCleanup) == null || i.call(e), e._rafCleanup =
|
|
193
|
+
(i = e._rafCleanup) == null || i.call(e), e._rafCleanup = c(() => {
|
|
194
194
|
const t = l.getContentEl(e);
|
|
195
195
|
if (!t) return;
|
|
196
196
|
if (e.stylesRef || (e.stylesRef = I({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { isEqual as c, isObject as
|
|
2
|
-
var y = Object.defineProperty,
|
|
1
|
+
import { isEqual as c, isObject as u, hasProp as h } from "../../utils/dist/index.js";
|
|
2
|
+
var y = Object.defineProperty, I = (t, e, i) => e in t ? y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, p = (t, e, i) => I(t, e + "", i), a = {
|
|
3
3
|
itemToValue(t) {
|
|
4
|
-
return typeof t == "string" ? t :
|
|
4
|
+
return typeof t == "string" ? t : u(t) && h(t, "value") ? t.value : "";
|
|
5
5
|
},
|
|
6
6
|
itemToString(t) {
|
|
7
|
-
return typeof t == "string" ? t :
|
|
7
|
+
return typeof t == "string" ? t : u(t) && h(t, "label") ? t.label : a.itemToValue(t);
|
|
8
8
|
},
|
|
9
9
|
isItemDisabled(t) {
|
|
10
|
-
return
|
|
10
|
+
return u(t) && h(t, "disabled") ? !!t.disabled : !1;
|
|
11
11
|
}
|
|
12
12
|
}, T = class {
|
|
13
13
|
constructor(t) {
|
|
14
|
-
this.options = t,
|
|
14
|
+
this.options = t, p(this, "items"), this.items = [...t.items];
|
|
15
15
|
}
|
|
16
16
|
isEqual(t) {
|
|
17
17
|
return c(this.items, t.items);
|
|
@@ -63,21 +63,21 @@ var y = Object.defineProperty, p = (t, e, i) => e in t ? y(t, e, { enumerable: !
|
|
|
63
63
|
*/
|
|
64
64
|
getItemValue(t) {
|
|
65
65
|
var e, i;
|
|
66
|
-
return t == null ? null : ((i = (e = this.options).itemToValue) == null ? void 0 : i.call(e, t)) ??
|
|
66
|
+
return t == null ? null : ((i = (e = this.options).itemToValue) == null ? void 0 : i.call(e, t)) ?? a.itemToValue(t);
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Whether an item is disabled
|
|
70
70
|
*/
|
|
71
71
|
getItemDisabled(t) {
|
|
72
72
|
var e, i;
|
|
73
|
-
return t == null ? !1 : ((i = (e = this.options).isItemDisabled) == null ? void 0 : i.call(e, t)) ??
|
|
73
|
+
return t == null ? !1 : ((i = (e = this.options).isItemDisabled) == null ? void 0 : i.call(e, t)) ?? a.isItemDisabled(t);
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Convert an item to a string
|
|
77
77
|
*/
|
|
78
78
|
stringifyItem(t) {
|
|
79
79
|
var e, i;
|
|
80
|
-
return t == null ? null : ((i = (e = this.options).itemToString) == null ? void 0 : i.call(e, t)) ??
|
|
80
|
+
return t == null ? null : ((i = (e = this.options).itemToString) == null ? void 0 : i.call(e, t)) ?? a.itemToString(t);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Convert a value to a string
|
|
@@ -134,20 +134,20 @@ var y = Object.defineProperty, p = (t, e, i) => e in t ? y(t, e, { enumerable: !
|
|
|
134
134
|
/**
|
|
135
135
|
* Returns the next value in the collection
|
|
136
136
|
*/
|
|
137
|
-
getNextValue(t) {
|
|
138
|
-
let
|
|
139
|
-
if (
|
|
140
|
-
for (e
|
|
141
|
-
return this.getItemValue(this.at(
|
|
137
|
+
getNextValue(t, e = 1, i = !1) {
|
|
138
|
+
let s = this.indexOf(t);
|
|
139
|
+
if (s === -1) return null;
|
|
140
|
+
for (s = i ? Math.min(s + e, this.size - 1) : s + e; s <= this.size && this.getItemDisabled(this.at(s)); ) s++;
|
|
141
|
+
return this.getItemValue(this.at(s));
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* Returns the previous value in the collection
|
|
145
145
|
*/
|
|
146
|
-
getPreviousValue(t) {
|
|
147
|
-
let
|
|
148
|
-
if (
|
|
149
|
-
for (e
|
|
150
|
-
return this.getItemValue(this.at(
|
|
146
|
+
getPreviousValue(t, e = 1, i = !1) {
|
|
147
|
+
let s = this.indexOf(t);
|
|
148
|
+
if (s === -1) return null;
|
|
149
|
+
for (s = i ? Math.max(s - e, 0) : s - e; s >= 0 && this.getItemDisabled(this.at(s)); ) s--;
|
|
150
|
+
return this.getItemValue(this.at(s));
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* Get the index of an item based on its key
|
|
@@ -190,7 +190,7 @@ var y = Object.defineProperty, p = (t, e, i) => e in t ? y(t, e, { enumerable: !
|
|
|
190
190
|
const [i] = this.items.splice(t, 1);
|
|
191
191
|
this.items.splice(e, 0, i);
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
json() {
|
|
194
194
|
return {
|
|
195
195
|
size: this.size,
|
|
196
196
|
first: this.firstValue,
|
|
@@ -199,5 +199,5 @@ var y = Object.defineProperty, p = (t, e, i) => e in t ? y(t, e, { enumerable: !
|
|
|
199
199
|
}
|
|
200
200
|
}, V = (t, e) => !!(t != null && t.toLowerCase().startsWith(e.toLowerCase())), x = (t, e) => t.map((i, s) => t[(Math.max(e, 0) + s) % t.length]);
|
|
201
201
|
export {
|
|
202
|
-
T as
|
|
202
|
+
T as ListCollection
|
|
203
203
|
};
|