@reformer/ui-kit 1.0.0-beta.1
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 +96 -0
- package/dist/components/form-array/form-array-section.d.ts +60 -0
- package/dist/components/form-array/index.d.ts +2 -0
- package/dist/components/form-wizard/form-wizard-actions.d.ts +11 -0
- package/dist/components/form-wizard/form-wizard-progress.d.ts +7 -0
- package/dist/components/form-wizard/form-wizard.d.ts +40 -0
- package/dist/components/form-wizard/index.d.ts +8 -0
- package/dist/components/form-wizard/step-indicator.d.ts +10 -0
- package/dist/components/state/error-state.d.ts +10 -0
- package/dist/components/state/index.d.ts +2 -0
- package/dist/components/state/loading-state.d.ts +8 -0
- package/dist/components/ui/async-boundary.d.ts +63 -0
- package/dist/components/ui/box.d.ts +41 -0
- package/dist/components/ui/button.d.ts +35 -0
- package/dist/components/ui/checkbox.d.ts +48 -0
- package/dist/components/ui/collapsible.d.ts +59 -0
- package/dist/components/ui/example-card.d.ts +57 -0
- package/dist/components/ui/form-field.d.ts +72 -0
- package/dist/components/ui/input-mask.d.ts +52 -0
- package/dist/components/ui/input-password.d.ts +51 -0
- package/dist/components/ui/input.d.ts +54 -0
- package/dist/components/ui/radio-group.d.ts +60 -0
- package/dist/components/ui/section.d.ts +52 -0
- package/dist/components/ui/select.d.ts +316 -0
- package/dist/components/ui/textarea.d.ts +53 -0
- package/dist/form-array-section-CItAR061.js +92 -0
- package/dist/form-array.d.ts +2 -0
- package/dist/form-array.js +4 -0
- package/dist/form-wizard-C-yRYqTI.js +118 -0
- package/dist/form-wizard.d.ts +2 -0
- package/dist/form-wizard.js +7 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +170 -0
- package/dist/lib/utils.d.ts +29 -0
- package/dist/loading-state-4VeOE6iN.js +38 -0
- package/dist/state.d.ts +2 -0
- package/dist/state.js +5 -0
- package/dist/ui/async-boundary.d.ts +2 -0
- package/dist/ui/async-boundary.js +12 -0
- package/dist/ui/box.d.ts +2 -0
- package/dist/ui/box.js +7 -0
- package/dist/ui/button.d.ts +2 -0
- package/dist/ui/button.js +78 -0
- package/dist/ui/checkbox.d.ts +2 -0
- package/dist/ui/checkbox.js +35 -0
- package/dist/ui/collapsible.d.ts +2 -0
- package/dist/ui/collapsible.js +31 -0
- package/dist/ui/form-field.d.ts +2 -0
- package/dist/ui/form-field.js +217 -0
- package/dist/ui/input-mask.d.ts +2 -0
- package/dist/ui/input-mask.js +36 -0
- package/dist/ui/input-password.d.ts +2 -0
- package/dist/ui/input-password.js +72 -0
- package/dist/ui/input.d.ts +2 -0
- package/dist/ui/input.js +48 -0
- package/dist/ui/radio-group.d.ts +2 -0
- package/dist/ui/radio-group.js +53 -0
- package/dist/ui/section.d.ts +2 -0
- package/dist/ui/section.js +16 -0
- package/dist/ui/select.d.ts +2 -0
- package/dist/ui/select.js +241 -0
- package/dist/ui/textarea.d.ts +2 -0
- package/dist/ui/textarea.js +38 -0
- package/dist/utils-DtaLkIY8.js +2776 -0
- package/llms.txt +3652 -0
- package/package.json +161 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { Slot as k } from "@radix-ui/react-slot";
|
|
3
|
+
import { a as V, c as p } from "../utils-DtaLkIY8.js";
|
|
4
|
+
const g = (n) => typeof n == "boolean" ? `${n}` : n === 0 ? "0" : n, m = V, z = (n, i) => (e) => {
|
|
5
|
+
var o;
|
|
6
|
+
if (i?.variants == null) return m(n, e?.class, e?.className);
|
|
7
|
+
const { variants: l, defaultVariants: r } = i, b = Object.keys(l).map((t) => {
|
|
8
|
+
const a = e?.[t], d = r?.[t];
|
|
9
|
+
if (a === null) return null;
|
|
10
|
+
const s = g(a) || g(d);
|
|
11
|
+
return l[t][s];
|
|
12
|
+
}), c = e && Object.entries(e).reduce((t, a) => {
|
|
13
|
+
let [d, s] = a;
|
|
14
|
+
return s === void 0 || (t[d] = s), t;
|
|
15
|
+
}, {}), f = i == null || (o = i.compoundVariants) === null || o === void 0 ? void 0 : o.reduce((t, a) => {
|
|
16
|
+
let { class: d, className: s, ...h } = a;
|
|
17
|
+
return Object.entries(h).every((x) => {
|
|
18
|
+
let [v, u] = x;
|
|
19
|
+
return Array.isArray(u) ? u.includes({
|
|
20
|
+
...r,
|
|
21
|
+
...c
|
|
22
|
+
}[v]) : {
|
|
23
|
+
...r,
|
|
24
|
+
...c
|
|
25
|
+
}[v] === u;
|
|
26
|
+
}) ? [
|
|
27
|
+
...t,
|
|
28
|
+
d,
|
|
29
|
+
s
|
|
30
|
+
] : t;
|
|
31
|
+
}, []);
|
|
32
|
+
return m(n, b, f, e?.class, e?.className);
|
|
33
|
+
}, C = z(
|
|
34
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
variant: {
|
|
38
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
39
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
40
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
41
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
42
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
43
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
47
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
48
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
49
|
+
icon: "size-9",
|
|
50
|
+
"icon-sm": "size-8",
|
|
51
|
+
"icon-lg": "size-10"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
defaultVariants: {
|
|
55
|
+
variant: "default",
|
|
56
|
+
size: "default"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
function w({
|
|
61
|
+
className: n,
|
|
62
|
+
variant: i,
|
|
63
|
+
size: e,
|
|
64
|
+
asChild: o = !1,
|
|
65
|
+
...l
|
|
66
|
+
}) {
|
|
67
|
+
return /* @__PURE__ */ y(
|
|
68
|
+
o ? k : "button",
|
|
69
|
+
{
|
|
70
|
+
"data-slot": "button",
|
|
71
|
+
className: p(C({ variant: i, size: e, className: n })),
|
|
72
|
+
...l
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
w as Button
|
|
78
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsxs as p, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import { c as f } from "../utils-DtaLkIY8.js";
|
|
4
|
+
const x = h.forwardRef(
|
|
5
|
+
({ className: r, value: o, onChange: t, onBlur: d, label: e, disabled: s, "data-testid": c, ...i }, n) => {
|
|
6
|
+
const l = (m) => {
|
|
7
|
+
t?.(m.target.checked);
|
|
8
|
+
};
|
|
9
|
+
return /* @__PURE__ */ p("div", { className: "flex items-center gap-2", children: [
|
|
10
|
+
/* @__PURE__ */ a(
|
|
11
|
+
"input",
|
|
12
|
+
{
|
|
13
|
+
ref: n,
|
|
14
|
+
type: "checkbox",
|
|
15
|
+
checked: o || !1,
|
|
16
|
+
disabled: s,
|
|
17
|
+
className: f(
|
|
18
|
+
"h-4 w-4 rounded border-gray-300 text-primary focus:ring-2 focus:ring-primary",
|
|
19
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
20
|
+
r
|
|
21
|
+
),
|
|
22
|
+
onChange: l,
|
|
23
|
+
onBlur: d,
|
|
24
|
+
"data-testid": c,
|
|
25
|
+
...i
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
e && /* @__PURE__ */ a("label", { className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: e })
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
x.displayName = "Checkbox";
|
|
33
|
+
export {
|
|
34
|
+
x as Checkbox
|
|
35
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsxs as t, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p } from "react";
|
|
3
|
+
function m({
|
|
4
|
+
title: i,
|
|
5
|
+
defaultOpen: r = !0,
|
|
6
|
+
className: s,
|
|
7
|
+
titleClassName: a,
|
|
8
|
+
contentClassName: o,
|
|
9
|
+
children: d
|
|
10
|
+
}) {
|
|
11
|
+
const [e, l] = p(r);
|
|
12
|
+
return /* @__PURE__ */ t("div", { className: s, children: [
|
|
13
|
+
/* @__PURE__ */ t(
|
|
14
|
+
"button",
|
|
15
|
+
{
|
|
16
|
+
type: "button",
|
|
17
|
+
className: a,
|
|
18
|
+
onClick: () => l(!e),
|
|
19
|
+
"aria-expanded": e,
|
|
20
|
+
children: [
|
|
21
|
+
i,
|
|
22
|
+
/* @__PURE__ */ n("span", { "aria-hidden": "true", children: e ? " ▼" : " ▶" })
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
e && /* @__PURE__ */ n("div", { className: o, children: d })
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
m as Collapsible
|
|
31
|
+
};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { jsx as d, jsxs as E, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import * as D from "react";
|
|
3
|
+
import { forwardRef as f, Children as S, isValidElement as B, cloneElement as L, useId as A, useMemo as x, createContext as V, useContext as W } from "react";
|
|
4
|
+
import { useFormControl as M } from "@reformer/core";
|
|
5
|
+
import { Checkbox as O } from "./checkbox.js";
|
|
6
|
+
function T(r, n) {
|
|
7
|
+
const l = { ...r };
|
|
8
|
+
for (const e of Object.keys(n)) {
|
|
9
|
+
const o = r[e], t = n[e];
|
|
10
|
+
e.startsWith("on") && typeof o == "function" && typeof t == "function" ? l[e] = (...i) => {
|
|
11
|
+
t(...i), o(...i);
|
|
12
|
+
} : e === "className" && typeof o == "string" && typeof t == "string" ? l[e] = [t, o].filter(Boolean).join(" ") : e === "style" && typeof o == "object" && typeof t == "object" ? l[e] = { ...t, ...o } : e === "disabled" ? l[e] = !!o || !!t : t !== void 0 && (l[e] = t);
|
|
13
|
+
}
|
|
14
|
+
return l;
|
|
15
|
+
}
|
|
16
|
+
const p = f(
|
|
17
|
+
({ children: r, ...n }, l) => {
|
|
18
|
+
const e = S.only(r);
|
|
19
|
+
if (!B(e))
|
|
20
|
+
return null;
|
|
21
|
+
const o = e.props, t = T(n, o), i = e.ref;
|
|
22
|
+
return L(e, {
|
|
23
|
+
...t,
|
|
24
|
+
ref: l || i
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
p.displayName = "Slot";
|
|
29
|
+
const k = V(null);
|
|
30
|
+
function b() {
|
|
31
|
+
const r = W(k);
|
|
32
|
+
if (!r)
|
|
33
|
+
throw new Error(
|
|
34
|
+
"FormField.* components must be used within <FormField.Root>. Wrap your field with <FormField.Root control={control}>."
|
|
35
|
+
);
|
|
36
|
+
return r;
|
|
37
|
+
}
|
|
38
|
+
function N({
|
|
39
|
+
control: r,
|
|
40
|
+
children: n,
|
|
41
|
+
id: l,
|
|
42
|
+
hasDescription: e = !1
|
|
43
|
+
}) {
|
|
44
|
+
const o = A(), t = l ?? o, i = x(
|
|
45
|
+
() => ({
|
|
46
|
+
controlId: `control-${t}`,
|
|
47
|
+
labelId: `label-${t}`,
|
|
48
|
+
descriptionId: `desc-${t}`,
|
|
49
|
+
errorId: `error-${t}`
|
|
50
|
+
}),
|
|
51
|
+
[t]
|
|
52
|
+
), s = M(r), c = x(() => {
|
|
53
|
+
const {
|
|
54
|
+
value: h,
|
|
55
|
+
errors: a,
|
|
56
|
+
pending: m,
|
|
57
|
+
disabled: y,
|
|
58
|
+
valid: v,
|
|
59
|
+
invalid: F,
|
|
60
|
+
touched: C,
|
|
61
|
+
shouldShowError: I,
|
|
62
|
+
componentProps: g
|
|
63
|
+
} = s;
|
|
64
|
+
return {
|
|
65
|
+
value: h,
|
|
66
|
+
errors: a,
|
|
67
|
+
pending: m,
|
|
68
|
+
disabled: y,
|
|
69
|
+
valid: v,
|
|
70
|
+
invalid: F,
|
|
71
|
+
touched: C,
|
|
72
|
+
shouldShowError: I,
|
|
73
|
+
error: I ? a[0]?.message : void 0,
|
|
74
|
+
label: g.label,
|
|
75
|
+
required: !!g.required,
|
|
76
|
+
componentProps: g,
|
|
77
|
+
control: r,
|
|
78
|
+
ids: i,
|
|
79
|
+
hasDescription: e
|
|
80
|
+
};
|
|
81
|
+
}, [s, r, i, e]);
|
|
82
|
+
return /* @__PURE__ */ d(k.Provider, { value: c, children: n });
|
|
83
|
+
}
|
|
84
|
+
N.displayName = "FormField.Root";
|
|
85
|
+
const R = f(
|
|
86
|
+
({ asChild: r = !1, children: n, forceRender: l = !1, ...e }, o) => {
|
|
87
|
+
const { label: t, required: i, ids: s } = b(), c = n ?? t;
|
|
88
|
+
return !c && !l ? null : /* @__PURE__ */ E(r ? p : "label", { ref: o, id: s.labelId, htmlFor: r ? void 0 : s.controlId, ...e, children: [
|
|
89
|
+
c,
|
|
90
|
+
i && /* @__PURE__ */ d("span", { "aria-hidden": "true", children: " *" })
|
|
91
|
+
] });
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
R.displayName = "FormField.Label";
|
|
95
|
+
const $ = f(
|
|
96
|
+
({ asChild: r = !1, children: n, ...l }, e) => {
|
|
97
|
+
const {
|
|
98
|
+
control: o,
|
|
99
|
+
value: t,
|
|
100
|
+
disabled: i,
|
|
101
|
+
shouldShowError: s,
|
|
102
|
+
errors: c,
|
|
103
|
+
required: h,
|
|
104
|
+
ids: a,
|
|
105
|
+
hasDescription: m,
|
|
106
|
+
componentProps: y
|
|
107
|
+
} = b(), v = [
|
|
108
|
+
m ? a.descriptionId : null,
|
|
109
|
+
s && c.length > 0 ? a.errorId : null
|
|
110
|
+
].filter(Boolean).join(" ") || void 0, F = {
|
|
111
|
+
id: a.controlId,
|
|
112
|
+
"aria-labelledby": a.labelId,
|
|
113
|
+
"aria-invalid": s ? !0 : void 0,
|
|
114
|
+
"aria-describedby": v,
|
|
115
|
+
"aria-errormessage": s && c.length > 0 ? a.errorId : void 0,
|
|
116
|
+
"aria-required": h ? !0 : void 0
|
|
117
|
+
};
|
|
118
|
+
if (n || r)
|
|
119
|
+
return /* @__PURE__ */ d(p, { ref: e, ...F, ...l, children: n });
|
|
120
|
+
const C = o.component;
|
|
121
|
+
return /* @__PURE__ */ d(
|
|
122
|
+
C,
|
|
123
|
+
{
|
|
124
|
+
ref: e,
|
|
125
|
+
...y,
|
|
126
|
+
...F,
|
|
127
|
+
...l,
|
|
128
|
+
value: t,
|
|
129
|
+
disabled: i,
|
|
130
|
+
onChange: (I) => o.setValue(I),
|
|
131
|
+
onBlur: () => o.markAsTouched()
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
$.displayName = "FormField.Control";
|
|
137
|
+
const j = f(
|
|
138
|
+
({ asChild: r = !1, multi: n = !1, render: l, children: e, ...o }, t) => {
|
|
139
|
+
const { shouldShowError: i, errors: s, ids: c } = b();
|
|
140
|
+
if (!i || s.length === 0) return null;
|
|
141
|
+
const h = r ? p : "p";
|
|
142
|
+
return l ? /* @__PURE__ */ d(w, { children: s.map((a, m) => /* @__PURE__ */ d(
|
|
143
|
+
h,
|
|
144
|
+
{
|
|
145
|
+
id: m === 0 ? c.errorId : void 0,
|
|
146
|
+
role: "alert",
|
|
147
|
+
...o,
|
|
148
|
+
children: l(a, m)
|
|
149
|
+
},
|
|
150
|
+
a.code ?? m
|
|
151
|
+
)) }) : n ? /* @__PURE__ */ d(w, { children: s.map((a, m) => /* @__PURE__ */ d(
|
|
152
|
+
h,
|
|
153
|
+
{
|
|
154
|
+
id: m === 0 ? c.errorId : void 0,
|
|
155
|
+
role: "alert",
|
|
156
|
+
...o,
|
|
157
|
+
children: a.message
|
|
158
|
+
},
|
|
159
|
+
a.code ?? m
|
|
160
|
+
)) }) : /* @__PURE__ */ d(h, { ref: t, id: c.errorId, role: "alert", ...o, children: e ?? s[0].message });
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
j.displayName = "FormField.Error";
|
|
164
|
+
const q = f(
|
|
165
|
+
({ asChild: r = !1, children: n, ...l }, e) => {
|
|
166
|
+
const { ids: o } = b();
|
|
167
|
+
return /* @__PURE__ */ d(r ? p : "p", { ref: e, id: o.descriptionId, ...l, children: n });
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
q.displayName = "FormField.Description";
|
|
171
|
+
const u = N;
|
|
172
|
+
u.Root = N;
|
|
173
|
+
u.Label = R;
|
|
174
|
+
u.Control = $;
|
|
175
|
+
u.Error = j;
|
|
176
|
+
u.Description = q;
|
|
177
|
+
function z({
|
|
178
|
+
className: r,
|
|
179
|
+
testIdProp: n,
|
|
180
|
+
isCheckbox: l,
|
|
181
|
+
customChildren: e
|
|
182
|
+
}) {
|
|
183
|
+
const { componentProps: o, pending: t } = b(), i = n ?? o?.testId ?? "unknown";
|
|
184
|
+
return /* @__PURE__ */ E("div", { className: r, "data-testid": `field-${i}`, children: [
|
|
185
|
+
!l && /* @__PURE__ */ d(
|
|
186
|
+
u.Label,
|
|
187
|
+
{
|
|
188
|
+
className: "block mb-1 text-sm font-medium",
|
|
189
|
+
"data-testid": `label-${i}`
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
e ? /* @__PURE__ */ d(u.Control, { asChild: !0, children: e }) : /* @__PURE__ */ d(u.Control, { "data-testid": `input-${i}` }),
|
|
193
|
+
/* @__PURE__ */ d(
|
|
194
|
+
u.Error,
|
|
195
|
+
{
|
|
196
|
+
className: "text-destructive text-sm mt-1 block",
|
|
197
|
+
"data-testid": `error-${i}`
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
t && /* @__PURE__ */ d("span", { className: "text-gray-500 text-sm mt-1 block", children: "Проверка..." })
|
|
201
|
+
] });
|
|
202
|
+
}
|
|
203
|
+
const G = ({ control: r, className: n, testId: l, children: e }) => {
|
|
204
|
+
const o = r.component === O;
|
|
205
|
+
return /* @__PURE__ */ d(u.Root, { control: r, children: /* @__PURE__ */ d(
|
|
206
|
+
z,
|
|
207
|
+
{
|
|
208
|
+
className: n,
|
|
209
|
+
testIdProp: l,
|
|
210
|
+
isCheckbox: o,
|
|
211
|
+
customChildren: e
|
|
212
|
+
}
|
|
213
|
+
) });
|
|
214
|
+
}, Q = D.memo(G, (r, n) => r.control === n.control && r.className === n.className && r.testId === n.testId && r.children === n.children);
|
|
215
|
+
export {
|
|
216
|
+
Q as FormField
|
|
217
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { c as b } from "../utils-DtaLkIY8.js";
|
|
4
|
+
const g = r.forwardRef(
|
|
5
|
+
({ className: t, value: e, onChange: n, onBlur: o, mask: i, placeholder: s, disabled: a, ...l }, d) => {
|
|
6
|
+
const u = (p) => {
|
|
7
|
+
const f = p.target.value;
|
|
8
|
+
n?.(f || null);
|
|
9
|
+
}, c = r.useMemo(() => e == null ? "" : String(e), [e]);
|
|
10
|
+
return /* @__PURE__ */ m(
|
|
11
|
+
"input",
|
|
12
|
+
{
|
|
13
|
+
ref: d,
|
|
14
|
+
type: "text",
|
|
15
|
+
value: c,
|
|
16
|
+
disabled: a,
|
|
17
|
+
placeholder: s || i,
|
|
18
|
+
className: b(
|
|
19
|
+
"h-9 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs transition-colors",
|
|
20
|
+
"placeholder:text-muted-foreground",
|
|
21
|
+
"focus-visible:outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
22
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
23
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
24
|
+
t
|
|
25
|
+
),
|
|
26
|
+
onChange: u,
|
|
27
|
+
onBlur: o,
|
|
28
|
+
...l
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
g.displayName = "InputMask";
|
|
34
|
+
export {
|
|
35
|
+
g as InputMask
|
|
36
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsxs as b, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { EyeOffIcon as f, EyeIcon as y } from "lucide-react";
|
|
4
|
+
import { c as v } from "../utils-DtaLkIY8.js";
|
|
5
|
+
const x = a.forwardRef(
|
|
6
|
+
({
|
|
7
|
+
className: n,
|
|
8
|
+
value: r,
|
|
9
|
+
onChange: d,
|
|
10
|
+
onBlur: l,
|
|
11
|
+
placeholder: u = "Password",
|
|
12
|
+
disabled: o,
|
|
13
|
+
showToggle: s = !0,
|
|
14
|
+
...p
|
|
15
|
+
}, c) => {
|
|
16
|
+
const [t, h] = a.useState(!1), m = (w) => {
|
|
17
|
+
d?.(w.target.value || null);
|
|
18
|
+
}, g = () => {
|
|
19
|
+
h(!t);
|
|
20
|
+
}, i = !!r;
|
|
21
|
+
return /* @__PURE__ */ b("div", { style: { position: "relative", width: "100%" }, children: [
|
|
22
|
+
/* @__PURE__ */ e(
|
|
23
|
+
"input",
|
|
24
|
+
{
|
|
25
|
+
ref: c,
|
|
26
|
+
type: t ? "text" : "password",
|
|
27
|
+
value: r || "",
|
|
28
|
+
disabled: o,
|
|
29
|
+
placeholder: u,
|
|
30
|
+
"data-slot": "input",
|
|
31
|
+
className: v(
|
|
32
|
+
"h-9 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs transition-colors",
|
|
33
|
+
"placeholder:text-muted-foreground",
|
|
34
|
+
"focus-visible:outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
35
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
36
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
37
|
+
s && i && "pr-10",
|
|
38
|
+
n
|
|
39
|
+
),
|
|
40
|
+
onChange: m,
|
|
41
|
+
onBlur: l,
|
|
42
|
+
...p
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
s && i && /* @__PURE__ */ e(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
className: "text-gray-500 hover:text-gray-700 transition-colors cursor-pointer focus:outline-none",
|
|
50
|
+
onClick: g,
|
|
51
|
+
disabled: o,
|
|
52
|
+
"aria-label": t ? "Hide password" : "Show password",
|
|
53
|
+
style: {
|
|
54
|
+
position: "absolute",
|
|
55
|
+
right: "0.75rem",
|
|
56
|
+
top: "50%",
|
|
57
|
+
transform: "translateY(-50%)",
|
|
58
|
+
background: "transparent",
|
|
59
|
+
border: "none",
|
|
60
|
+
padding: 0,
|
|
61
|
+
lineHeight: 0
|
|
62
|
+
},
|
|
63
|
+
children: t ? /* @__PURE__ */ e(f, { style: { width: "1rem", height: "1rem" } }) : /* @__PURE__ */ e(y, { style: { width: "1rem", height: "1rem" } })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
x.displayName = "InputPassword";
|
|
70
|
+
export {
|
|
71
|
+
x as InputPassword
|
|
72
|
+
};
|
package/dist/ui/input.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import * as u from "react";
|
|
3
|
+
import { c as v } from "../utils-DtaLkIY8.js";
|
|
4
|
+
const x = u.forwardRef(
|
|
5
|
+
({ className: l, value: i, onChange: r, onBlur: a, type: e = "text", placeholder: d, disabled: m, ...n }, c) => {
|
|
6
|
+
const f = (p) => {
|
|
7
|
+
const t = p.target.value;
|
|
8
|
+
if (e === "number")
|
|
9
|
+
if (t === "")
|
|
10
|
+
r?.(null);
|
|
11
|
+
else {
|
|
12
|
+
const o = Number(t);
|
|
13
|
+
if (!isNaN(o)) {
|
|
14
|
+
const s = n.min !== void 0 ? Number(n.min) : void 0;
|
|
15
|
+
s !== void 0 && s >= 0 && o < 0 ? r?.(0) : r?.(o);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else
|
|
19
|
+
r?.(t || null);
|
|
20
|
+
}, b = u.useMemo(() => i == null ? "" : e === "number" && typeof i == "number" ? isNaN(i) ? "" : i.toString() : String(i), [i, e]);
|
|
21
|
+
return /* @__PURE__ */ g(
|
|
22
|
+
"input",
|
|
23
|
+
{
|
|
24
|
+
ref: c,
|
|
25
|
+
type: e,
|
|
26
|
+
value: b,
|
|
27
|
+
disabled: m,
|
|
28
|
+
placeholder: d,
|
|
29
|
+
"data-slot": "input",
|
|
30
|
+
className: v(
|
|
31
|
+
"h-9 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs transition-colors",
|
|
32
|
+
"placeholder:text-muted-foreground",
|
|
33
|
+
"focus-visible:outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
34
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
35
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
36
|
+
l
|
|
37
|
+
),
|
|
38
|
+
onChange: f,
|
|
39
|
+
onBlur: a,
|
|
40
|
+
...n
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
x.displayName = "Input";
|
|
46
|
+
export {
|
|
47
|
+
x as Input
|
|
48
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as r, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import * as v from "react";
|
|
3
|
+
import { c as i } from "../utils-DtaLkIY8.js";
|
|
4
|
+
const g = v.forwardRef(
|
|
5
|
+
({ className: d, value: s, onChange: o, onBlur: c, options: t, disabled: u, "data-testid": a, ...m }, n) => {
|
|
6
|
+
const p = (e) => {
|
|
7
|
+
o?.(e.target.value);
|
|
8
|
+
};
|
|
9
|
+
return /* @__PURE__ */ r(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
ref: n,
|
|
13
|
+
className: i("flex flex-col gap-2", d),
|
|
14
|
+
"data-testid": a,
|
|
15
|
+
...m,
|
|
16
|
+
children: t.map((e) => {
|
|
17
|
+
const l = a ? `${a}-${e.value}` : `radio-${e.value}`;
|
|
18
|
+
return /* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
|
|
19
|
+
/* @__PURE__ */ r(
|
|
20
|
+
"input",
|
|
21
|
+
{
|
|
22
|
+
type: "radio",
|
|
23
|
+
id: l,
|
|
24
|
+
value: e.value,
|
|
25
|
+
checked: s === e.value,
|
|
26
|
+
disabled: u,
|
|
27
|
+
className: i(
|
|
28
|
+
"h-4 w-4 border-gray-300 text-primary focus:ring-2 focus:ring-primary",
|
|
29
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
30
|
+
),
|
|
31
|
+
onChange: p,
|
|
32
|
+
onBlur: c,
|
|
33
|
+
"data-testid": a ? `${a}-${e.value}` : void 0
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ r(
|
|
37
|
+
"label",
|
|
38
|
+
{
|
|
39
|
+
htmlFor: l,
|
|
40
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",
|
|
41
|
+
children: e.label
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] }, e.value);
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
g.displayName = "RadioGroup";
|
|
51
|
+
export {
|
|
52
|
+
g as RadioGroup
|
|
53
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
function h({
|
|
3
|
+
title: e,
|
|
4
|
+
titleAs: n = "h3",
|
|
5
|
+
className: r,
|
|
6
|
+
titleClassName: s,
|
|
7
|
+
children: c
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ i("section", { className: r, children: [
|
|
10
|
+
e && /* @__PURE__ */ o(n, { className: s, children: e }),
|
|
11
|
+
c
|
|
12
|
+
] });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
h as Section
|
|
16
|
+
};
|