@serendie/ui 0.1.16 → 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 +7 -7
- 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 +4 -4
- 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/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 +1 -1
- package/dist/index.js +89 -89
- 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,18 +1,19 @@
|
|
|
1
1
|
import { createAnatomy as p } from "../../anatomy/dist/index.js";
|
|
2
|
-
import { createScope as m,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
2
|
+
import { createScope as m, dataAttr as c, visuallyHiddenStyle as E, queryAll as h, nextTick as b } from "../../dom-query/dist/index.js";
|
|
3
|
+
import { trackFocusVisible as y, isFocusVisible as T } from "../../focus-visible/dist/index.js";
|
|
4
|
+
import { createMachine as V, guards as R } from "../../core/dist/index.js";
|
|
5
|
+
import { trackElementRect as C } from "../../element-rect/dist/index.js";
|
|
6
|
+
import { dispatchInputCheckedEvent as S, trackFormControl as k } from "../../form-utils/dist/index.js";
|
|
7
|
+
import { compact as A, isString as F, isEqual as D } from "../../utils/dist/index.js";
|
|
8
|
+
import { createProps as I } from "../../types/dist/index.js";
|
|
9
|
+
var _ = p("radio-group").parts(
|
|
9
10
|
"root",
|
|
10
11
|
"label",
|
|
11
12
|
"item",
|
|
12
13
|
"itemText",
|
|
13
14
|
"itemControl",
|
|
14
15
|
"indicator"
|
|
15
|
-
), v =
|
|
16
|
+
), v = _.build(), n = m({
|
|
16
17
|
getRootId: (e) => {
|
|
17
18
|
var i;
|
|
18
19
|
return ((i = e.ids) == null ? void 0 : i.root) ?? `radio-group:${e.id}`;
|
|
@@ -41,24 +42,24 @@ var D = p("radio-group").parts(
|
|
|
41
42
|
var i;
|
|
42
43
|
return ((i = e.ids) == null ? void 0 : i.indicator) ?? `radio-group:${e.id}:indicator`;
|
|
43
44
|
},
|
|
44
|
-
getRootEl: (e) =>
|
|
45
|
-
getItemHiddenInputEl: (e, i) =>
|
|
46
|
-
getIndicatorEl: (e) =>
|
|
45
|
+
getRootEl: (e) => n.getById(e, n.getRootId(e)),
|
|
46
|
+
getItemHiddenInputEl: (e, i) => n.getById(e, n.getItemHiddenInputId(e, i)),
|
|
47
|
+
getIndicatorEl: (e) => n.getById(e, n.getIndicatorId(e)),
|
|
47
48
|
getFirstEnabledInputEl: (e) => {
|
|
48
49
|
var i;
|
|
49
|
-
return (i =
|
|
50
|
+
return (i = n.getRootEl(e)) == null ? void 0 : i.querySelector("input:not(:disabled)");
|
|
50
51
|
},
|
|
51
52
|
getFirstEnabledAndCheckedInputEl: (e) => {
|
|
52
53
|
var i;
|
|
53
|
-
return (i =
|
|
54
|
+
return (i = n.getRootEl(e)) == null ? void 0 : i.querySelector("input:not(:disabled):checked");
|
|
54
55
|
},
|
|
55
56
|
getInputEls: (e) => {
|
|
56
|
-
const t = `input[type=radio][data-ownedby='${CSS.escape(
|
|
57
|
-
return
|
|
57
|
+
const t = `input[type=radio][data-ownedby='${CSS.escape(n.getRootId(e))}']:not([disabled])`;
|
|
58
|
+
return h(n.getRootEl(e), t);
|
|
58
59
|
},
|
|
59
60
|
getActiveRadioEl: (e) => {
|
|
60
61
|
if (e.value)
|
|
61
|
-
return
|
|
62
|
+
return n.getById(e, n.getItemId(e, e.value));
|
|
62
63
|
},
|
|
63
64
|
getOffsetRect: (e) => ({
|
|
64
65
|
left: (e == null ? void 0 : e.offsetLeft) ?? 0,
|
|
@@ -67,9 +68,9 @@ var D = p("radio-group").parts(
|
|
|
67
68
|
height: (e == null ? void 0 : e.offsetHeight) ?? 0
|
|
68
69
|
}),
|
|
69
70
|
getRectById: (e, i) => {
|
|
70
|
-
const t =
|
|
71
|
+
const t = n.getById(e, n.getItemId(e, i));
|
|
71
72
|
if (t)
|
|
72
|
-
return
|
|
73
|
+
return n.resolveRect(n.getOffsetRect(t));
|
|
73
74
|
},
|
|
74
75
|
resolveRect: (e) => ({
|
|
75
76
|
width: `${e.width}px`,
|
|
@@ -78,24 +79,25 @@ var D = p("radio-group").parts(
|
|
|
78
79
|
top: `${e.top}px`
|
|
79
80
|
})
|
|
80
81
|
});
|
|
81
|
-
function
|
|
82
|
-
const a = e.context.isDisabled,
|
|
83
|
-
function u(
|
|
82
|
+
function M(e, i, t) {
|
|
83
|
+
const a = e.context.isDisabled, l = e.context.readOnly;
|
|
84
|
+
function u(o) {
|
|
84
85
|
return {
|
|
85
|
-
invalid: !!
|
|
86
|
-
disabled: !!
|
|
87
|
-
checked: e.context.value ===
|
|
88
|
-
focused: e.context.focusedValue ===
|
|
89
|
-
hovered: e.context.hoveredValue ===
|
|
90
|
-
active: e.context.activeValue ===
|
|
86
|
+
invalid: !!o.invalid,
|
|
87
|
+
disabled: !!o.disabled || a,
|
|
88
|
+
checked: e.context.value === o.value,
|
|
89
|
+
focused: e.context.focusedValue === o.value,
|
|
90
|
+
hovered: e.context.hoveredValue === o.value,
|
|
91
|
+
active: e.context.activeValue === o.value
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
|
-
function s(
|
|
94
|
-
const r = u(
|
|
94
|
+
function s(o) {
|
|
95
|
+
const r = u(o);
|
|
95
96
|
return {
|
|
96
97
|
"data-focus": c(r.focused),
|
|
98
|
+
"data-focus-visible": c(r.focused && e.context.focusVisible),
|
|
97
99
|
"data-disabled": c(r.disabled),
|
|
98
|
-
"data-readonly": c(
|
|
100
|
+
"data-readonly": c(l),
|
|
99
101
|
"data-state": r.checked ? "checked" : "unchecked",
|
|
100
102
|
"data-hover": c(r.hovered),
|
|
101
103
|
"data-invalid": c(r.invalid),
|
|
@@ -103,20 +105,20 @@ function B(e, i, t) {
|
|
|
103
105
|
"data-ssr": c(e.context.ssr)
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
|
|
108
|
+
const f = () => {
|
|
109
|
+
const o = n.getFirstEnabledAndCheckedInputEl(e.context);
|
|
110
|
+
if (o) {
|
|
111
|
+
o.focus();
|
|
110
112
|
return;
|
|
111
113
|
}
|
|
112
|
-
const r =
|
|
114
|
+
const r = n.getFirstEnabledInputEl(e.context);
|
|
113
115
|
r == null || r.focus();
|
|
114
116
|
};
|
|
115
117
|
return {
|
|
116
|
-
focus:
|
|
118
|
+
focus: f,
|
|
117
119
|
value: e.context.value,
|
|
118
|
-
setValue(
|
|
119
|
-
i({ type: "SET_VALUE", value:
|
|
120
|
+
setValue(o) {
|
|
121
|
+
i({ type: "SET_VALUE", value: o, isTrusted: !1 });
|
|
120
122
|
},
|
|
121
123
|
clearValue() {
|
|
122
124
|
i({ type: "SET_VALUE", value: null, isTrusted: !1 });
|
|
@@ -125,8 +127,8 @@ function B(e, i, t) {
|
|
|
125
127
|
return t.element({
|
|
126
128
|
...v.root.attrs,
|
|
127
129
|
role: "radiogroup",
|
|
128
|
-
id:
|
|
129
|
-
"aria-labelledby":
|
|
130
|
+
id: n.getRootId(e.context),
|
|
131
|
+
"aria-labelledby": n.getLabelId(e.context),
|
|
130
132
|
"data-orientation": e.context.orientation,
|
|
131
133
|
"data-disabled": c(a),
|
|
132
134
|
"aria-orientation": e.context.orientation,
|
|
@@ -142,89 +144,90 @@ function B(e, i, t) {
|
|
|
142
144
|
dir: e.context.dir,
|
|
143
145
|
"data-orientation": e.context.orientation,
|
|
144
146
|
"data-disabled": c(a),
|
|
145
|
-
id:
|
|
146
|
-
onClick:
|
|
147
|
+
id: n.getLabelId(e.context),
|
|
148
|
+
onClick: f
|
|
147
149
|
});
|
|
148
150
|
},
|
|
149
151
|
getItemState: u,
|
|
150
|
-
getItemProps(
|
|
151
|
-
const r = u(
|
|
152
|
+
getItemProps(o) {
|
|
153
|
+
const r = u(o);
|
|
152
154
|
return t.label({
|
|
153
155
|
...v.item.attrs,
|
|
154
156
|
dir: e.context.dir,
|
|
155
|
-
id:
|
|
156
|
-
htmlFor:
|
|
157
|
-
...s(
|
|
157
|
+
id: n.getItemId(e.context, o.value),
|
|
158
|
+
htmlFor: n.getItemHiddenInputId(e.context, o.value),
|
|
159
|
+
...s(o),
|
|
158
160
|
onPointerMove() {
|
|
159
|
-
r.disabled || r.hovered || i({ type: "SET_HOVERED", value:
|
|
161
|
+
r.disabled || r.hovered || i({ type: "SET_HOVERED", value: o.value, hovered: !0 });
|
|
160
162
|
},
|
|
161
163
|
onPointerLeave() {
|
|
162
164
|
r.disabled || i({ type: "SET_HOVERED", value: null });
|
|
163
165
|
},
|
|
164
|
-
onPointerDown(
|
|
165
|
-
r.disabled || (r.focused &&
|
|
166
|
+
onPointerDown(d) {
|
|
167
|
+
r.disabled || (r.focused && d.pointerType === "mouse" && d.preventDefault(), i({ type: "SET_ACTIVE", value: o.value, active: !0 }));
|
|
166
168
|
},
|
|
167
169
|
onPointerUp() {
|
|
168
170
|
r.disabled || i({ type: "SET_ACTIVE", value: null });
|
|
169
171
|
}
|
|
170
172
|
});
|
|
171
173
|
},
|
|
172
|
-
getItemTextProps(
|
|
174
|
+
getItemTextProps(o) {
|
|
173
175
|
return t.element({
|
|
174
176
|
...v.itemText.attrs,
|
|
175
177
|
dir: e.context.dir,
|
|
176
|
-
id:
|
|
177
|
-
...s(
|
|
178
|
+
id: n.getItemLabelId(e.context, o.value),
|
|
179
|
+
...s(o)
|
|
178
180
|
});
|
|
179
181
|
},
|
|
180
|
-
getItemControlProps(
|
|
181
|
-
const r = u(
|
|
182
|
+
getItemControlProps(o) {
|
|
183
|
+
const r = u(o);
|
|
182
184
|
return t.element({
|
|
183
185
|
...v.itemControl.attrs,
|
|
184
186
|
dir: e.context.dir,
|
|
185
|
-
id:
|
|
187
|
+
id: n.getItemControlId(e.context, o.value),
|
|
186
188
|
"data-active": c(r.active),
|
|
187
189
|
"aria-hidden": !0,
|
|
188
|
-
...s(
|
|
190
|
+
...s(o)
|
|
189
191
|
});
|
|
190
192
|
},
|
|
191
|
-
getItemHiddenInputProps(
|
|
192
|
-
const r = u(
|
|
193
|
+
getItemHiddenInputProps(o) {
|
|
194
|
+
const r = u(o);
|
|
193
195
|
return t.input({
|
|
194
|
-
"data-ownedby":
|
|
195
|
-
id:
|
|
196
|
+
"data-ownedby": n.getRootId(e.context),
|
|
197
|
+
id: n.getItemHiddenInputId(e.context, o.value),
|
|
196
198
|
type: "radio",
|
|
197
199
|
name: e.context.name || e.context.id,
|
|
198
200
|
form: e.context.form,
|
|
199
|
-
value:
|
|
200
|
-
onClick(
|
|
201
|
-
if (
|
|
202
|
-
|
|
201
|
+
value: o.value,
|
|
202
|
+
onClick(d) {
|
|
203
|
+
if (l) {
|
|
204
|
+
d.preventDefault();
|
|
203
205
|
return;
|
|
204
206
|
}
|
|
205
|
-
|
|
207
|
+
d.currentTarget.checked && i({ type: "SET_VALUE", value: o.value, isTrusted: !0 });
|
|
206
208
|
},
|
|
207
209
|
onBlur() {
|
|
208
|
-
i({ type: "SET_FOCUSED", value: null });
|
|
210
|
+
i({ type: "SET_FOCUSED", value: null, focused: !1, focusVisible: !1 });
|
|
209
211
|
},
|
|
210
212
|
onFocus() {
|
|
211
|
-
|
|
213
|
+
const d = T();
|
|
214
|
+
i({ type: "SET_FOCUSED", value: o.value, focused: !0, focusVisible: d });
|
|
212
215
|
},
|
|
213
|
-
onKeyDown(
|
|
214
|
-
|
|
216
|
+
onKeyDown(d) {
|
|
217
|
+
d.defaultPrevented || d.key === " " && i({ type: "SET_ACTIVE", value: o.value, active: !0 });
|
|
215
218
|
},
|
|
216
|
-
onKeyUp(
|
|
217
|
-
|
|
219
|
+
onKeyUp(d) {
|
|
220
|
+
d.defaultPrevented || d.key === " " && i({ type: "SET_ACTIVE", value: null });
|
|
218
221
|
},
|
|
219
222
|
disabled: r.disabled,
|
|
220
223
|
defaultChecked: r.checked,
|
|
221
|
-
style:
|
|
224
|
+
style: E
|
|
222
225
|
});
|
|
223
226
|
},
|
|
224
227
|
getIndicatorProps() {
|
|
225
|
-
var
|
|
228
|
+
var o, r, d, g;
|
|
226
229
|
return t.element({
|
|
227
|
-
id:
|
|
230
|
+
id: n.getIndicatorId(e.context),
|
|
228
231
|
...v.indicator.attrs,
|
|
229
232
|
dir: e.context.dir,
|
|
230
233
|
hidden: e.context.value == null,
|
|
@@ -232,10 +235,10 @@ function B(e, i, t) {
|
|
|
232
235
|
"data-orientation": e.context.orientation,
|
|
233
236
|
style: {
|
|
234
237
|
"--transition-property": "left, top, width, height",
|
|
235
|
-
"--left": (
|
|
238
|
+
"--left": (o = e.context.indicatorRect) == null ? void 0 : o.left,
|
|
236
239
|
"--top": (r = e.context.indicatorRect) == null ? void 0 : r.top,
|
|
237
|
-
"--width": (
|
|
238
|
-
"--height": (
|
|
240
|
+
"--width": (d = e.context.indicatorRect) == null ? void 0 : d.width,
|
|
241
|
+
"--height": (g = e.context.indicatorRect) == null ? void 0 : g.height,
|
|
239
242
|
position: "absolute",
|
|
240
243
|
willChange: "var(--transition-property)",
|
|
241
244
|
transitionProperty: "var(--transition-property)",
|
|
@@ -247,10 +250,10 @@ function B(e, i, t) {
|
|
|
247
250
|
}
|
|
248
251
|
};
|
|
249
252
|
}
|
|
250
|
-
var { not:
|
|
251
|
-
function
|
|
252
|
-
const i =
|
|
253
|
-
return
|
|
253
|
+
var { not: $ } = R;
|
|
254
|
+
function N(e) {
|
|
255
|
+
const i = A(e);
|
|
256
|
+
return V(
|
|
254
257
|
{
|
|
255
258
|
id: "radio",
|
|
256
259
|
initial: "idle",
|
|
@@ -265,6 +268,7 @@ function q(e) {
|
|
|
265
268
|
indicatorRect: {},
|
|
266
269
|
canIndicatorTransition: !1,
|
|
267
270
|
fieldsetDisabled: !1,
|
|
271
|
+
focusVisible: !1,
|
|
268
272
|
ssr: !0
|
|
269
273
|
},
|
|
270
274
|
computed: {
|
|
@@ -272,14 +276,14 @@ function q(e) {
|
|
|
272
276
|
},
|
|
273
277
|
entry: ["syncIndicatorRect", "syncSsr"],
|
|
274
278
|
exit: ["cleanupObserver"],
|
|
275
|
-
activities: ["trackFormControlState"],
|
|
279
|
+
activities: ["trackFormControlState", "trackFocusVisible"],
|
|
276
280
|
watch: {
|
|
277
281
|
value: ["setIndicatorTransition", "syncIndicatorRect", "syncInputElements"]
|
|
278
282
|
},
|
|
279
283
|
on: {
|
|
280
284
|
SET_VALUE: [
|
|
281
285
|
{
|
|
282
|
-
guard:
|
|
286
|
+
guard: $("isTrusted"),
|
|
283
287
|
actions: ["setValue", "dispatchChangeEvent"]
|
|
284
288
|
},
|
|
285
289
|
{
|
|
@@ -305,20 +309,23 @@ function q(e) {
|
|
|
305
309
|
isTrusted: (t, a) => !!a.isTrusted
|
|
306
310
|
},
|
|
307
311
|
activities: {
|
|
308
|
-
trackFormControlState(t, a, { send:
|
|
309
|
-
return
|
|
312
|
+
trackFormControlState(t, a, { send: l, initialContext: u }) {
|
|
313
|
+
return k(n.getRootEl(t), {
|
|
310
314
|
onFieldsetDisabledChange(s) {
|
|
311
315
|
t.fieldsetDisabled = s;
|
|
312
316
|
},
|
|
313
317
|
onFormReset() {
|
|
314
|
-
|
|
318
|
+
l({ type: "SET_VALUE", value: u.value });
|
|
315
319
|
}
|
|
316
320
|
});
|
|
321
|
+
},
|
|
322
|
+
trackFocusVisible(t) {
|
|
323
|
+
return y({ root: n.getRootNode(t) });
|
|
317
324
|
}
|
|
318
325
|
},
|
|
319
326
|
actions: {
|
|
320
327
|
setValue(t, a) {
|
|
321
|
-
|
|
328
|
+
w.value(t, a.value);
|
|
322
329
|
},
|
|
323
330
|
setHovered(t, a) {
|
|
324
331
|
t.hoveredValue = a.value;
|
|
@@ -327,15 +334,15 @@ function q(e) {
|
|
|
327
334
|
t.activeValue = a.value;
|
|
328
335
|
},
|
|
329
336
|
setFocused(t, a) {
|
|
330
|
-
t.focusedValue = a.value;
|
|
337
|
+
t.focusedValue = a.value, t.focusVisible = a.focusVisible;
|
|
331
338
|
},
|
|
332
339
|
syncInputElements(t) {
|
|
333
|
-
|
|
334
|
-
|
|
340
|
+
n.getInputEls(t).forEach((l) => {
|
|
341
|
+
l.checked = l.value === t.value;
|
|
335
342
|
});
|
|
336
343
|
},
|
|
337
344
|
setIndicatorTransition(t) {
|
|
338
|
-
t.canIndicatorTransition =
|
|
345
|
+
t.canIndicatorTransition = F(t.value);
|
|
339
346
|
},
|
|
340
347
|
cleanupObserver(t) {
|
|
341
348
|
var a;
|
|
@@ -346,44 +353,44 @@ function q(e) {
|
|
|
346
353
|
},
|
|
347
354
|
syncIndicatorRect(t) {
|
|
348
355
|
var u;
|
|
349
|
-
if ((u = t.indicatorCleanup) == null || u.call(t), !
|
|
350
|
-
const a = t.value,
|
|
351
|
-
if (a == null || !
|
|
356
|
+
if ((u = t.indicatorCleanup) == null || u.call(t), !n.getIndicatorEl(t)) return;
|
|
357
|
+
const a = t.value, l = n.getActiveRadioEl(t);
|
|
358
|
+
if (a == null || !l) {
|
|
352
359
|
t.indicatorRect = {};
|
|
353
360
|
return;
|
|
354
361
|
}
|
|
355
|
-
t.indicatorCleanup =
|
|
362
|
+
t.indicatorCleanup = C(l, {
|
|
356
363
|
getRect(s) {
|
|
357
|
-
return
|
|
364
|
+
return n.getOffsetRect(s);
|
|
358
365
|
},
|
|
359
366
|
onChange(s) {
|
|
360
|
-
t.indicatorRect =
|
|
367
|
+
t.indicatorRect = n.resolveRect(s), b(() => {
|
|
361
368
|
t.canIndicatorTransition = !1;
|
|
362
369
|
});
|
|
363
370
|
}
|
|
364
371
|
});
|
|
365
372
|
},
|
|
366
373
|
dispatchChangeEvent(t) {
|
|
367
|
-
|
|
368
|
-
const u =
|
|
369
|
-
u !==
|
|
374
|
+
n.getInputEls(t).forEach((l) => {
|
|
375
|
+
const u = l.value === t.value;
|
|
376
|
+
u !== l.checked && S(l, { checked: u });
|
|
370
377
|
});
|
|
371
378
|
}
|
|
372
379
|
}
|
|
373
380
|
}
|
|
374
381
|
);
|
|
375
382
|
}
|
|
376
|
-
var
|
|
383
|
+
var P = {
|
|
377
384
|
change: (e) => {
|
|
378
385
|
var i;
|
|
379
386
|
e.value != null && ((i = e.onValueChange) == null || i.call(e, { value: e.value }));
|
|
380
387
|
}
|
|
381
|
-
},
|
|
388
|
+
}, w = {
|
|
382
389
|
value: (e, i) => {
|
|
383
|
-
|
|
390
|
+
D(e.value, i) || (e.value = i, P.change(e));
|
|
384
391
|
}
|
|
385
392
|
};
|
|
386
|
-
|
|
393
|
+
I()([
|
|
387
394
|
"dir",
|
|
388
395
|
"disabled",
|
|
389
396
|
"form",
|
|
@@ -396,9 +403,9 @@ f()([
|
|
|
396
403
|
"readOnly",
|
|
397
404
|
"value"
|
|
398
405
|
]);
|
|
399
|
-
|
|
406
|
+
I()(["value", "disabled", "invalid"]);
|
|
400
407
|
export {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
408
|
+
_ as anatomy,
|
|
409
|
+
M as connect,
|
|
410
|
+
N as machine
|
|
404
411
|
};
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import { createNormalizer as C } from "../../types/dist/index.js";
|
|
2
|
-
import
|
|
2
|
+
import O, { useRef as f, useLayoutEffect as A, useEffect as i, useSyncExternalStore as _, useCallback as j, useMemo as S } from "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
|
-
import {
|
|
5
|
+
import { subscribe as M, snapshot as g, makeGlobal as w } from "../../store/dist/index.js";
|
|
6
6
|
import { isChanged as R, createProxy as W } from "../../../proxy-compare/dist/index.js";
|
|
7
|
-
var
|
|
7
|
+
var Y = C((t) => t), E = (t) => (t == null ? void 0 : t.constructor.name) === "Array", z = (t, e) => {
|
|
8
8
|
if (t.length !== e.length) return !1;
|
|
9
9
|
for (let r = 0; r < t.length; r++)
|
|
10
|
-
if (!
|
|
10
|
+
if (!p(t[r], e[r])) return !1;
|
|
11
11
|
return !0;
|
|
12
|
-
},
|
|
12
|
+
}, p = (t, e) => {
|
|
13
13
|
if (Object.is(t, e)) return !0;
|
|
14
14
|
if (t == null && e != null || t != null && e == null) return !1;
|
|
15
15
|
if (typeof (t == null ? void 0 : t.isEqual) == "function" && typeof (e == null ? void 0 : e.isEqual) == "function")
|
|
16
16
|
return t.isEqual(e);
|
|
17
17
|
if (typeof t == "function" && typeof e == "function")
|
|
18
18
|
return t.toString() === e.toString();
|
|
19
|
-
if (
|
|
19
|
+
if (E(t) && E(e))
|
|
20
20
|
return z(Array.from(t), Array.from(e));
|
|
21
21
|
if (typeof t != "object" || typeof e != "object") return !1;
|
|
22
22
|
const r = Object.keys(e ?? /* @__PURE__ */ Object.create(null)), o = r.length;
|
|
23
23
|
for (let n = 0; n < o; n++)
|
|
24
24
|
if (!Reflect.has(t, r[n])) return !1;
|
|
25
25
|
for (let n = 0; n < o; n++) {
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
26
|
+
const c = r[n];
|
|
27
|
+
if (!p(t[c], e[c])) return !1;
|
|
28
28
|
}
|
|
29
29
|
return !0;
|
|
30
|
-
}, K = () => process.env.NODE_ENV !== "production";
|
|
30
|
+
}, K = () => process.env.NODE_ENV !== "production", L = Function.prototype.toString;
|
|
31
|
+
L.call(Object);
|
|
31
32
|
function k(t) {
|
|
32
|
-
if (!
|
|
33
|
+
if (!N(t) || t === void 0)
|
|
33
34
|
return t;
|
|
34
35
|
const e = Reflect.ownKeys(t).filter((o) => typeof o == "string"), r = {};
|
|
35
36
|
for (const o of e) {
|
|
@@ -38,8 +39,8 @@ function k(t) {
|
|
|
38
39
|
}
|
|
39
40
|
return r;
|
|
40
41
|
}
|
|
41
|
-
var
|
|
42
|
-
function
|
|
42
|
+
var N = (t) => t && typeof t == "object" && t.constructor === Object;
|
|
43
|
+
function P(t, e) {
|
|
43
44
|
const r = f(!1), o = f(!1);
|
|
44
45
|
i(() => {
|
|
45
46
|
if (r.current && o.current)
|
|
@@ -49,65 +50,65 @@ function N(t, e) {
|
|
|
49
50
|
r.current = !1;
|
|
50
51
|
}), []);
|
|
51
52
|
}
|
|
52
|
-
var { use: x } =
|
|
53
|
+
var { use: x } = O, D = w("__zag__targetCache", () => /* @__PURE__ */ new WeakMap());
|
|
53
54
|
function q(t, e) {
|
|
54
|
-
const { actions: r, context: o, sync: n } = e ?? {},
|
|
55
|
-
|
|
55
|
+
const { actions: r, context: o, sync: n } = e ?? {}, c = f(), s = f(), y = _(
|
|
56
|
+
j((u) => M(t.state, u, n), [n]),
|
|
56
57
|
() => {
|
|
57
|
-
const u =
|
|
58
|
+
const u = g(t.state, x);
|
|
58
59
|
try {
|
|
59
|
-
if (
|
|
60
|
-
return
|
|
60
|
+
if (c.current && s.current && !R(c.current, u, s.current, /* @__PURE__ */ new WeakMap()))
|
|
61
|
+
return c.current;
|
|
61
62
|
} catch {
|
|
62
63
|
}
|
|
63
64
|
return u;
|
|
64
65
|
},
|
|
65
|
-
() =>
|
|
66
|
+
() => g(t.state, x)
|
|
66
67
|
);
|
|
67
68
|
t.setOptions({ actions: r });
|
|
68
|
-
const l =
|
|
69
|
-
|
|
70
|
-
const u = Object.entries(l),
|
|
69
|
+
const l = S(() => k(o ?? {}), [o]);
|
|
70
|
+
P(() => {
|
|
71
|
+
const u = Object.entries(l), h = t.contextSnapshot ?? {};
|
|
71
72
|
u.map(([a, m]) => ({
|
|
72
73
|
key: a,
|
|
73
74
|
curr: m,
|
|
74
|
-
prev:
|
|
75
|
-
equal:
|
|
75
|
+
prev: h[a],
|
|
76
|
+
equal: p(h[a], m)
|
|
76
77
|
})).every(({ equal: a }) => a) || t.setContext(l);
|
|
77
78
|
}, [l]);
|
|
78
|
-
const
|
|
79
|
+
const d = /* @__PURE__ */ new WeakMap();
|
|
79
80
|
i(() => {
|
|
80
|
-
|
|
81
|
+
c.current = y, s.current = d;
|
|
81
82
|
});
|
|
82
|
-
const v =
|
|
83
|
-
return W(
|
|
83
|
+
const v = S(() => /* @__PURE__ */ new WeakMap(), []);
|
|
84
|
+
return W(y, d, v, D);
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
+
function Z(t) {
|
|
86
87
|
return [q(t), t.send];
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
+
function I(t) {
|
|
89
90
|
const e = f();
|
|
90
91
|
return e.current || (e.current = { v: t() }), e.current.v;
|
|
91
92
|
}
|
|
92
|
-
var
|
|
93
|
+
var F = typeof document < "u" ? A : i;
|
|
93
94
|
function G(t, e) {
|
|
94
|
-
const { state: r, context: o } = e ?? {}, n =
|
|
95
|
-
const
|
|
96
|
-
return o &&
|
|
97
|
-
}),
|
|
98
|
-
return
|
|
99
|
-
const
|
|
100
|
-
return n.start(
|
|
101
|
-
K() && (
|
|
95
|
+
const { state: r, context: o } = e ?? {}, n = I(() => {
|
|
96
|
+
const s = typeof t == "function" ? t() : t;
|
|
97
|
+
return o && s.setContext(o), s._created(), s;
|
|
98
|
+
}), c = f();
|
|
99
|
+
return F(() => {
|
|
100
|
+
const s = r ?? c.current;
|
|
101
|
+
return n.start(s), () => {
|
|
102
|
+
K() && (c.current = n.getHydrationState()), n.stop();
|
|
102
103
|
};
|
|
103
104
|
}, []), n;
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function $(t, e) {
|
|
106
107
|
const r = G(t, e);
|
|
107
108
|
return [q(r, e), r.send, r];
|
|
108
109
|
}
|
|
109
110
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
Y as normalizeProps,
|
|
112
|
+
Z as useActor,
|
|
113
|
+
$ as useMachine
|
|
113
114
|
};
|