@reformer/ui-kit 8.0.0 → 9.0.0-beta.2
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/README.md +58 -70
- package/dist/components/state/error-state.d.ts +1 -2
- package/dist/components/state/index.d.ts +2 -0
- package/dist/components/state/loading-state.d.ts +1 -2
- package/dist/components/state/state-a11y.test.d.ts +1 -0
- package/dist/components/ui/checkbox.d.ts +1 -1
- package/dist/components/ui/checkbox.test.d.ts +1 -0
- package/dist/components/ui/input-mask.d.ts +1 -1
- package/dist/components/ui/input-number-buffer.d.ts +69 -0
- package/dist/components/ui/input-number-buffer.test.d.ts +1 -0
- package/dist/components/ui/input-password.d.ts +1 -1
- package/dist/components/ui/input.d.ts +30 -18
- package/dist/components/ui/radio-group.d.ts +6 -0
- package/dist/components/ui/radio-group.test.d.ts +1 -0
- package/dist/components/ui/select.d.ts +9 -4
- package/dist/components/ui/select.test.d.ts +1 -0
- package/dist/components/ui/textarea.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/loading-state-BOBeK9tp.js +49 -0
- package/dist/package-exports.test.d.ts +1 -0
- package/dist/state.js +1 -1
- package/dist/ui/checkbox.js +42 -21
- package/dist/ui/form-field.js +175 -150
- package/dist/ui/input.js +74 -45
- package/dist/ui/radio-group.js +67 -47
- package/dist/ui/select.js +207 -179
- package/llms.txt +59 -37
- package/package.json +8 -10
- package/dist/loading-state-4VeOE6iN.js +0 -38
package/dist/ui/form-field.js
CHANGED
|
@@ -1,34 +1,44 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as d, jsxs as w, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import * as L from "react";
|
|
3
|
+
import { useContext as x, createContext as R, forwardRef as F, Children as T, isValidElement as V, cloneElement as W, useId as M, useMemo as k } from "react";
|
|
4
4
|
import { useFormControl as O } from "@reformer/core";
|
|
5
|
-
import { Checkbox as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import { Checkbox as z } from "./checkbox.js";
|
|
6
|
+
const G = (e) => e.message || e.code, H = R(G);
|
|
7
|
+
function j() {
|
|
8
|
+
return x(H);
|
|
9
|
+
}
|
|
10
|
+
function J(...e) {
|
|
11
|
+
return (l) => {
|
|
12
|
+
for (const o of e)
|
|
13
|
+
typeof o == "function" ? o(l) : o != null && (o.current = l);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function K(e, l) {
|
|
17
|
+
const o = { ...e };
|
|
18
|
+
for (const r of Object.keys(l)) {
|
|
19
|
+
const t = e[r], n = l[r];
|
|
20
|
+
r.startsWith("on") && typeof t == "function" && typeof n == "function" ? o[r] = (...i) => {
|
|
21
|
+
n(...i), t(...i);
|
|
22
|
+
} : r === "className" && typeof t == "string" && typeof n == "string" ? o[r] = [n, t].filter(Boolean).join(" ") : r === "style" && typeof t == "object" && typeof n == "object" ? o[r] = { ...n, ...t } : r === "disabled" ? o[r] = !!t || !!n : n !== void 0 && (o[r] = n);
|
|
13
23
|
}
|
|
14
|
-
return
|
|
24
|
+
return o;
|
|
15
25
|
}
|
|
16
|
-
const
|
|
17
|
-
({ children: e, ...
|
|
18
|
-
const r =
|
|
19
|
-
if (!
|
|
26
|
+
const I = F(
|
|
27
|
+
({ children: e, ...l }, o) => {
|
|
28
|
+
const r = T.only(e);
|
|
29
|
+
if (!V(r))
|
|
20
30
|
return null;
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
...
|
|
24
|
-
ref:
|
|
31
|
+
const t = r.props, n = K(l, t), i = r.ref, s = J(o, i);
|
|
32
|
+
return W(r, {
|
|
33
|
+
...n,
|
|
34
|
+
ref: s
|
|
25
35
|
});
|
|
26
36
|
}
|
|
27
37
|
);
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
function
|
|
31
|
-
const e =
|
|
38
|
+
I.displayName = "Slot";
|
|
39
|
+
const q = R(null);
|
|
40
|
+
function v() {
|
|
41
|
+
const e = x(q);
|
|
32
42
|
if (!e)
|
|
33
43
|
throw new Error(
|
|
34
44
|
"FormField.* components must be used within <FormField.Root>. Wrap your field with <FormField.Root control={control}>."
|
|
@@ -37,183 +47,198 @@ function F() {
|
|
|
37
47
|
}
|
|
38
48
|
function N({
|
|
39
49
|
control: e,
|
|
40
|
-
children:
|
|
41
|
-
id:
|
|
50
|
+
children: l,
|
|
51
|
+
id: o,
|
|
42
52
|
hasDescription: r = !1
|
|
43
53
|
}) {
|
|
44
|
-
const
|
|
54
|
+
const t = M(), n = o ?? t, i = k(
|
|
45
55
|
() => ({
|
|
46
|
-
controlId: `control-${
|
|
47
|
-
labelId: `label-${
|
|
48
|
-
descriptionId: `desc-${
|
|
49
|
-
errorId: `error-${
|
|
56
|
+
controlId: `control-${n}`,
|
|
57
|
+
labelId: `label-${n}`,
|
|
58
|
+
descriptionId: `desc-${n}`,
|
|
59
|
+
errorId: `error-${n}`
|
|
50
60
|
}),
|
|
51
|
-
[
|
|
52
|
-
), s = O(e),
|
|
61
|
+
[n]
|
|
62
|
+
), s = O(e), a = j(), p = k(() => {
|
|
53
63
|
const {
|
|
54
|
-
value:
|
|
55
|
-
errors:
|
|
56
|
-
pending:
|
|
57
|
-
disabled:
|
|
64
|
+
value: u,
|
|
65
|
+
errors: m,
|
|
66
|
+
pending: c,
|
|
67
|
+
disabled: b,
|
|
58
68
|
valid: y,
|
|
59
|
-
invalid:
|
|
60
|
-
touched:
|
|
61
|
-
shouldShowError:
|
|
62
|
-
componentProps:
|
|
69
|
+
invalid: g,
|
|
70
|
+
touched: E,
|
|
71
|
+
shouldShowError: C,
|
|
72
|
+
componentProps: f
|
|
63
73
|
} = s;
|
|
64
74
|
return {
|
|
65
|
-
value:
|
|
66
|
-
errors:
|
|
67
|
-
pending:
|
|
68
|
-
disabled:
|
|
75
|
+
value: u,
|
|
76
|
+
errors: m,
|
|
77
|
+
pending: c,
|
|
78
|
+
disabled: b,
|
|
69
79
|
valid: y,
|
|
70
|
-
invalid:
|
|
71
|
-
touched:
|
|
72
|
-
shouldShowError:
|
|
73
|
-
error:
|
|
74
|
-
label:
|
|
75
|
-
required: !!
|
|
76
|
-
componentProps:
|
|
80
|
+
invalid: g,
|
|
81
|
+
touched: E,
|
|
82
|
+
shouldShowError: C,
|
|
83
|
+
error: C && m[0] ? a(m[0]) : void 0,
|
|
84
|
+
label: f.label,
|
|
85
|
+
required: !!f.required,
|
|
86
|
+
componentProps: f,
|
|
77
87
|
control: e,
|
|
78
|
-
ids:
|
|
88
|
+
ids: i,
|
|
79
89
|
hasDescription: r
|
|
80
90
|
};
|
|
81
|
-
}, [s, e,
|
|
82
|
-
return /* @__PURE__ */
|
|
91
|
+
}, [s, e, i, r, a]);
|
|
92
|
+
return /* @__PURE__ */ d(q.Provider, { value: p, children: l });
|
|
83
93
|
}
|
|
84
94
|
N.displayName = "FormField.Root";
|
|
85
|
-
const
|
|
86
|
-
({ asChild: e = !1, children:
|
|
87
|
-
const { label:
|
|
88
|
-
return !
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
const D = F(
|
|
96
|
+
({ asChild: e = !1, children: l, forceRender: o = !1, ...r }, t) => {
|
|
97
|
+
const { label: n, required: i, ids: s } = v(), a = l ?? n;
|
|
98
|
+
return !a && !o ? null : /* @__PURE__ */ w(e ? I : "label", { ref: t, id: s.labelId, htmlFor: e ? void 0 : s.controlId, ...r, children: [
|
|
99
|
+
a,
|
|
100
|
+
i && /* @__PURE__ */ d("span", { "aria-hidden": "true", children: " *" })
|
|
91
101
|
] });
|
|
92
102
|
}
|
|
93
103
|
);
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
({ asChild: e = !1, children:
|
|
104
|
+
D.displayName = "FormField.Label";
|
|
105
|
+
const S = F(
|
|
106
|
+
({ asChild: e = !1, children: l, ...o }, r) => {
|
|
97
107
|
const {
|
|
98
|
-
control:
|
|
99
|
-
value:
|
|
100
|
-
disabled:
|
|
108
|
+
control: t,
|
|
109
|
+
value: n,
|
|
110
|
+
disabled: i,
|
|
101
111
|
shouldShowError: s,
|
|
102
|
-
errors:
|
|
103
|
-
required:
|
|
104
|
-
ids:
|
|
112
|
+
errors: a,
|
|
113
|
+
required: p,
|
|
114
|
+
ids: u,
|
|
105
115
|
hasDescription: m,
|
|
106
|
-
componentProps:
|
|
107
|
-
} =
|
|
108
|
-
m ?
|
|
109
|
-
s &&
|
|
110
|
-
].filter(Boolean).join(" ") || void 0,
|
|
111
|
-
id:
|
|
112
|
-
"aria-labelledby":
|
|
116
|
+
componentProps: c
|
|
117
|
+
} = v(), b = [
|
|
118
|
+
m ? u.descriptionId : null,
|
|
119
|
+
s && a.length > 0 ? u.errorId : null
|
|
120
|
+
].filter(Boolean).join(" ") || void 0, y = {
|
|
121
|
+
id: u.controlId,
|
|
122
|
+
"aria-labelledby": u.labelId,
|
|
113
123
|
"aria-invalid": s ? !0 : void 0,
|
|
114
|
-
"aria-describedby":
|
|
115
|
-
"aria-errormessage": s &&
|
|
116
|
-
"aria-required":
|
|
124
|
+
"aria-describedby": b,
|
|
125
|
+
"aria-errormessage": s && a.length > 0 ? u.errorId : void 0,
|
|
126
|
+
"aria-required": p ? !0 : void 0
|
|
117
127
|
};
|
|
118
|
-
if (
|
|
119
|
-
return /* @__PURE__ */
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
128
|
+
if (l || e)
|
|
129
|
+
return /* @__PURE__ */ d(
|
|
130
|
+
I,
|
|
131
|
+
{
|
|
132
|
+
ref: r,
|
|
133
|
+
...y,
|
|
134
|
+
...o,
|
|
135
|
+
value: n,
|
|
136
|
+
disabled: i,
|
|
137
|
+
onChange: (f) => t.setValue(f),
|
|
138
|
+
onBlur: () => t.markAsTouched(),
|
|
139
|
+
children: l
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
const g = t.component, { testId: E, ...C } = c ?? {};
|
|
143
|
+
return /* @__PURE__ */ d(
|
|
144
|
+
g,
|
|
123
145
|
{
|
|
124
146
|
ref: r,
|
|
125
|
-
...
|
|
126
|
-
...
|
|
127
|
-
...
|
|
128
|
-
value:
|
|
129
|
-
disabled:
|
|
130
|
-
onChange: (
|
|
131
|
-
onBlur: () =>
|
|
147
|
+
...C,
|
|
148
|
+
...y,
|
|
149
|
+
...o,
|
|
150
|
+
value: n,
|
|
151
|
+
disabled: i,
|
|
152
|
+
onChange: (f) => t.setValue(f),
|
|
153
|
+
onBlur: () => t.markAsTouched()
|
|
132
154
|
}
|
|
133
155
|
);
|
|
134
156
|
}
|
|
135
157
|
);
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
({ asChild: e = !1, multi:
|
|
139
|
-
const { shouldShowError:
|
|
140
|
-
if (!
|
|
141
|
-
const
|
|
142
|
-
return
|
|
143
|
-
|
|
158
|
+
S.displayName = "FormField.Control";
|
|
159
|
+
const B = F(
|
|
160
|
+
({ asChild: e = !1, multi: l = !1, render: o, children: r, ...t }, n) => {
|
|
161
|
+
const { shouldShowError: i, errors: s, ids: a } = v(), p = j();
|
|
162
|
+
if (!i || s.length === 0) return null;
|
|
163
|
+
const u = e ? I : "p";
|
|
164
|
+
return o ? /* @__PURE__ */ d($, { children: s.map((m, c) => /* @__PURE__ */ d(
|
|
165
|
+
u,
|
|
144
166
|
{
|
|
145
|
-
|
|
167
|
+
ref: c === 0 ? n : void 0,
|
|
168
|
+
id: c === 0 ? a.errorId : void 0,
|
|
146
169
|
role: "alert",
|
|
147
|
-
...
|
|
148
|
-
children:
|
|
149
|
-
},
|
|
150
|
-
a.code ?? m
|
|
151
|
-
)) }) : n ? /* @__PURE__ */ i(w, { children: s.map((a, m) => /* @__PURE__ */ i(
|
|
152
|
-
h,
|
|
153
|
-
{
|
|
154
|
-
id: m === 0 ? c.errorId : void 0,
|
|
155
|
-
role: "alert",
|
|
156
|
-
...o,
|
|
157
|
-
children: a.message
|
|
170
|
+
...t,
|
|
171
|
+
children: o(m, c)
|
|
158
172
|
},
|
|
159
|
-
|
|
160
|
-
)) }) : /* @__PURE__ */
|
|
173
|
+
m.code ?? c
|
|
174
|
+
)) }) : l ? /* @__PURE__ */ d($, { children: s.map((m, c) => {
|
|
175
|
+
const b = p(m);
|
|
176
|
+
return /* @__PURE__ */ d(
|
|
177
|
+
u,
|
|
178
|
+
{
|
|
179
|
+
ref: c === 0 ? n : void 0,
|
|
180
|
+
id: c === 0 ? a.errorId : void 0,
|
|
181
|
+
role: "alert",
|
|
182
|
+
...t,
|
|
183
|
+
children: e ? /* @__PURE__ */ d("span", { children: b }) : b
|
|
184
|
+
},
|
|
185
|
+
m.code ?? c
|
|
186
|
+
);
|
|
187
|
+
}) }) : /* @__PURE__ */ d(u, { ref: n, id: a.errorId, role: "alert", ...t, children: r ?? p(s[0]) });
|
|
161
188
|
}
|
|
162
189
|
);
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
({ asChild: e = !1, children:
|
|
166
|
-
const { ids:
|
|
167
|
-
return /* @__PURE__ */
|
|
190
|
+
B.displayName = "FormField.Error";
|
|
191
|
+
const A = F(
|
|
192
|
+
({ asChild: e = !1, children: l, ...o }, r) => {
|
|
193
|
+
const { ids: t } = v();
|
|
194
|
+
return /* @__PURE__ */ d(e ? I : "p", { ref: r, id: t.descriptionId, ...o, children: l });
|
|
168
195
|
}
|
|
169
196
|
);
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
E(G);
|
|
179
|
-
function H({
|
|
197
|
+
A.displayName = "FormField.Description";
|
|
198
|
+
const h = N;
|
|
199
|
+
h.Root = N;
|
|
200
|
+
h.Label = D;
|
|
201
|
+
h.Control = S;
|
|
202
|
+
h.Error = B;
|
|
203
|
+
h.Description = A;
|
|
204
|
+
function P({
|
|
180
205
|
className: e,
|
|
181
|
-
testIdProp:
|
|
182
|
-
isCheckbox:
|
|
206
|
+
testIdProp: l,
|
|
207
|
+
isCheckbox: o,
|
|
183
208
|
customChildren: r
|
|
184
209
|
}) {
|
|
185
|
-
const { componentProps:
|
|
186
|
-
return /* @__PURE__ */
|
|
187
|
-
!
|
|
188
|
-
|
|
210
|
+
const { componentProps: t, pending: n } = v(), i = l ?? t?.testId ?? "unknown";
|
|
211
|
+
return /* @__PURE__ */ w("div", { className: e, "data-testid": `field-${i}`, children: [
|
|
212
|
+
!o && /* @__PURE__ */ d(
|
|
213
|
+
h.Label,
|
|
189
214
|
{
|
|
190
215
|
className: "block mb-1 text-sm font-medium",
|
|
191
|
-
"data-testid": `label-${
|
|
216
|
+
"data-testid": `label-${i}`
|
|
192
217
|
}
|
|
193
218
|
),
|
|
194
|
-
r ? /* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
|
|
219
|
+
r ? /* @__PURE__ */ d(h.Control, { asChild: !0, children: r }) : /* @__PURE__ */ d(h.Control, { "data-testid": `input-${i}` }),
|
|
220
|
+
/* @__PURE__ */ d(
|
|
221
|
+
h.Error,
|
|
197
222
|
{
|
|
198
223
|
className: "text-destructive text-sm mt-1 block",
|
|
199
|
-
"data-testid": `error-${
|
|
224
|
+
"data-testid": `error-${i}`
|
|
200
225
|
}
|
|
201
226
|
),
|
|
202
|
-
|
|
227
|
+
n && /* @__PURE__ */ d("span", { role: "status", "aria-live": "polite", className: "text-gray-500 text-sm mt-1 block", children: "Проверка..." })
|
|
203
228
|
] });
|
|
204
229
|
}
|
|
205
|
-
const
|
|
206
|
-
const
|
|
207
|
-
return /* @__PURE__ */
|
|
208
|
-
|
|
230
|
+
const Q = ({ control: e, className: l, testId: o, children: r }) => {
|
|
231
|
+
const t = e.component === z;
|
|
232
|
+
return /* @__PURE__ */ d(h.Root, { control: e, children: /* @__PURE__ */ d(
|
|
233
|
+
P,
|
|
209
234
|
{
|
|
210
|
-
className:
|
|
211
|
-
testIdProp:
|
|
212
|
-
isCheckbox:
|
|
235
|
+
className: l,
|
|
236
|
+
testIdProp: o,
|
|
237
|
+
isCheckbox: t,
|
|
213
238
|
customChildren: r
|
|
214
239
|
}
|
|
215
240
|
) });
|
|
216
|
-
},
|
|
241
|
+
}, _ = L.memo(Q, (e, l) => e.control === l.control && e.className === l.className && e.testId === l.testId && e.children === l.children);
|
|
217
242
|
export {
|
|
218
|
-
|
|
243
|
+
_ as FormField
|
|
219
244
|
};
|
package/dist/ui/input.js
CHANGED
|
@@ -1,48 +1,77 @@
|
|
|
1
1
|
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { c as
|
|
4
|
-
|
|
5
|
-
(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { c as y } from "../utils-DtaLkIY8.js";
|
|
4
|
+
function o(e) {
|
|
5
|
+
if (e === "") return { kind: "empty" };
|
|
6
|
+
const n = Number(e);
|
|
7
|
+
return Number.isNaN(n) ? { kind: "partial" } : { kind: "number", value: n };
|
|
8
|
+
}
|
|
9
|
+
function h(e, n) {
|
|
10
|
+
const t = o(e);
|
|
11
|
+
if (t.kind === "empty") return { emit: !0, value: null };
|
|
12
|
+
if (t.kind === "partial") return { emit: !1 };
|
|
13
|
+
let i = t.value;
|
|
14
|
+
return n !== void 0 && n >= 0 && i < 0 && (i = 0), { emit: !0, value: i };
|
|
15
|
+
}
|
|
16
|
+
function x(e, n) {
|
|
17
|
+
if (e !== null)
|
|
18
|
+
if (e === "") {
|
|
19
|
+
if (n == null) return "";
|
|
20
|
+
} else {
|
|
21
|
+
const t = o(e);
|
|
22
|
+
if (t.kind === "partial" || t.kind === "number" && typeof n == "number" && !Number.isNaN(n) && t.value === n)
|
|
23
|
+
return e;
|
|
24
|
+
}
|
|
25
|
+
return n == null || typeof n == "number" && Number.isNaN(n) ? "" : n.toString();
|
|
26
|
+
}
|
|
27
|
+
const k = a.forwardRef((e, n) => {
|
|
28
|
+
const t = e.type ?? "text", [i, s] = a.useState(null), d = (r) => {
|
|
29
|
+
const u = r.target.value;
|
|
30
|
+
if (e.type === "number") {
|
|
31
|
+
s(u);
|
|
32
|
+
const p = e.min !== void 0 ? Number(e.min) : void 0, l = h(u, p);
|
|
33
|
+
l.emit && e.onChange?.(l.value);
|
|
34
|
+
} else
|
|
35
|
+
e.onChange?.(u || null);
|
|
36
|
+
}, m = a.useMemo(() => {
|
|
37
|
+
if (e.type === "number")
|
|
38
|
+
return x(i, e.value);
|
|
39
|
+
const r = e.value;
|
|
40
|
+
return r == null ? "" : String(r);
|
|
41
|
+
}, [e.value, e.type, i]), {
|
|
42
|
+
className: c,
|
|
43
|
+
onBlur: b,
|
|
44
|
+
placeholder: f,
|
|
45
|
+
disabled: v,
|
|
46
|
+
value: C,
|
|
47
|
+
onChange: I,
|
|
48
|
+
type: R,
|
|
49
|
+
...N
|
|
50
|
+
} = e;
|
|
51
|
+
return /* @__PURE__ */ g(
|
|
52
|
+
"input",
|
|
53
|
+
{
|
|
54
|
+
ref: n,
|
|
55
|
+
type: t,
|
|
56
|
+
value: m,
|
|
57
|
+
disabled: v,
|
|
58
|
+
placeholder: f,
|
|
59
|
+
"data-slot": "input",
|
|
60
|
+
className: y(
|
|
61
|
+
"h-9 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs transition-colors",
|
|
62
|
+
"placeholder:text-muted-foreground",
|
|
63
|
+
"focus-visible:outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
64
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
65
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
66
|
+
c
|
|
67
|
+
),
|
|
68
|
+
onChange: d,
|
|
69
|
+
onBlur: b,
|
|
70
|
+
...N
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
k.displayName = "Input";
|
|
46
75
|
export {
|
|
47
|
-
|
|
76
|
+
k as Input
|
|
48
77
|
};
|
package/dist/ui/radio-group.js
CHANGED
|
@@ -1,53 +1,73 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { c as
|
|
4
|
-
const
|
|
5
|
-
({
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as r, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { c as s } from "../utils-DtaLkIY8.js";
|
|
4
|
+
const y = i.forwardRef(
|
|
5
|
+
({
|
|
6
|
+
className: d,
|
|
7
|
+
value: c,
|
|
8
|
+
onChange: t,
|
|
9
|
+
onBlur: n,
|
|
10
|
+
options: u,
|
|
11
|
+
disabled: m,
|
|
12
|
+
name: p,
|
|
13
|
+
id: l,
|
|
14
|
+
"data-testid": a,
|
|
15
|
+
...g
|
|
16
|
+
}, f) => {
|
|
17
|
+
const v = i.useId(), h = p ?? l ?? a ?? v, x = (e) => {
|
|
18
|
+
t?.(e.target.value);
|
|
8
19
|
};
|
|
9
|
-
return
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
20
|
+
return (
|
|
21
|
+
// role="radiogroup" + прокинутые aria-* (aria-labelledby/aria-invalid/
|
|
22
|
+
// aria-describedby из FormField) делают контейнер настоящей группой для AT:
|
|
23
|
+
// метка ассоциируется, состояние невалидности экспонируется, навигация
|
|
24
|
+
// стрелками работает как по группе.
|
|
25
|
+
/* @__PURE__ */ r(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
ref: f,
|
|
29
|
+
role: "radiogroup",
|
|
30
|
+
id: l,
|
|
31
|
+
className: s("flex flex-col gap-2", d),
|
|
32
|
+
"data-testid": a,
|
|
33
|
+
...g,
|
|
34
|
+
children: u.map((e) => {
|
|
35
|
+
const o = a ? `${a}-${e.value}` : `radio-${e.value}`;
|
|
36
|
+
return /* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
|
|
37
|
+
/* @__PURE__ */ r(
|
|
38
|
+
"input",
|
|
39
|
+
{
|
|
40
|
+
type: "radio",
|
|
41
|
+
id: o,
|
|
42
|
+
name: h,
|
|
43
|
+
value: e.value,
|
|
44
|
+
checked: c === e.value,
|
|
45
|
+
disabled: m,
|
|
46
|
+
className: s(
|
|
47
|
+
"h-4 w-4 border-gray-300 text-primary focus:ring-2 focus:ring-primary",
|
|
48
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
49
|
+
),
|
|
50
|
+
onChange: x,
|
|
51
|
+
onBlur: n,
|
|
52
|
+
"data-testid": a ? `${a}-${e.value}` : void 0
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ r(
|
|
56
|
+
"label",
|
|
57
|
+
{
|
|
58
|
+
htmlFor: o,
|
|
59
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",
|
|
60
|
+
children: e.label
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }, e.value);
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
)
|
|
47
67
|
);
|
|
48
68
|
}
|
|
49
69
|
);
|
|
50
|
-
|
|
70
|
+
y.displayName = "RadioGroup";
|
|
51
71
|
export {
|
|
52
|
-
|
|
72
|
+
y as RadioGroup
|
|
53
73
|
};
|