@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.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +96 -0
  3. package/dist/components/form-array/form-array-section.d.ts +60 -0
  4. package/dist/components/form-array/index.d.ts +2 -0
  5. package/dist/components/form-wizard/form-wizard-actions.d.ts +11 -0
  6. package/dist/components/form-wizard/form-wizard-progress.d.ts +7 -0
  7. package/dist/components/form-wizard/form-wizard.d.ts +40 -0
  8. package/dist/components/form-wizard/index.d.ts +8 -0
  9. package/dist/components/form-wizard/step-indicator.d.ts +10 -0
  10. package/dist/components/state/error-state.d.ts +10 -0
  11. package/dist/components/state/index.d.ts +2 -0
  12. package/dist/components/state/loading-state.d.ts +8 -0
  13. package/dist/components/ui/async-boundary.d.ts +63 -0
  14. package/dist/components/ui/box.d.ts +41 -0
  15. package/dist/components/ui/button.d.ts +35 -0
  16. package/dist/components/ui/checkbox.d.ts +48 -0
  17. package/dist/components/ui/collapsible.d.ts +59 -0
  18. package/dist/components/ui/example-card.d.ts +57 -0
  19. package/dist/components/ui/form-field.d.ts +72 -0
  20. package/dist/components/ui/input-mask.d.ts +52 -0
  21. package/dist/components/ui/input-password.d.ts +51 -0
  22. package/dist/components/ui/input.d.ts +54 -0
  23. package/dist/components/ui/radio-group.d.ts +60 -0
  24. package/dist/components/ui/section.d.ts +52 -0
  25. package/dist/components/ui/select.d.ts +316 -0
  26. package/dist/components/ui/textarea.d.ts +53 -0
  27. package/dist/form-array-section-CItAR061.js +92 -0
  28. package/dist/form-array.d.ts +2 -0
  29. package/dist/form-array.js +4 -0
  30. package/dist/form-wizard-C-yRYqTI.js +118 -0
  31. package/dist/form-wizard.d.ts +2 -0
  32. package/dist/form-wizard.js +7 -0
  33. package/dist/index.d.ts +37 -0
  34. package/dist/index.js +170 -0
  35. package/dist/lib/utils.d.ts +29 -0
  36. package/dist/loading-state-4VeOE6iN.js +38 -0
  37. package/dist/state.d.ts +2 -0
  38. package/dist/state.js +5 -0
  39. package/dist/ui/async-boundary.d.ts +2 -0
  40. package/dist/ui/async-boundary.js +12 -0
  41. package/dist/ui/box.d.ts +2 -0
  42. package/dist/ui/box.js +7 -0
  43. package/dist/ui/button.d.ts +2 -0
  44. package/dist/ui/button.js +78 -0
  45. package/dist/ui/checkbox.d.ts +2 -0
  46. package/dist/ui/checkbox.js +35 -0
  47. package/dist/ui/collapsible.d.ts +2 -0
  48. package/dist/ui/collapsible.js +31 -0
  49. package/dist/ui/form-field.d.ts +2 -0
  50. package/dist/ui/form-field.js +217 -0
  51. package/dist/ui/input-mask.d.ts +2 -0
  52. package/dist/ui/input-mask.js +36 -0
  53. package/dist/ui/input-password.d.ts +2 -0
  54. package/dist/ui/input-password.js +72 -0
  55. package/dist/ui/input.d.ts +2 -0
  56. package/dist/ui/input.js +48 -0
  57. package/dist/ui/radio-group.d.ts +2 -0
  58. package/dist/ui/radio-group.js +53 -0
  59. package/dist/ui/section.d.ts +2 -0
  60. package/dist/ui/section.js +16 -0
  61. package/dist/ui/select.d.ts +2 -0
  62. package/dist/ui/select.js +241 -0
  63. package/dist/ui/textarea.d.ts +2 -0
  64. package/dist/ui/textarea.js +38 -0
  65. package/dist/utils-DtaLkIY8.js +2776 -0
  66. package/llms.txt +3652 -0
  67. package/package.json +161 -0
@@ -0,0 +1,241 @@
1
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import * as s from "@radix-ui/react-select";
4
+ import { XIcon as V, ChevronDownIcon as S, CheckIcon as O, ChevronUpIcon as R } from "lucide-react";
5
+ import { c as o } from "../utils-DtaLkIY8.js";
6
+ const D = m.forwardRef(
7
+ ({
8
+ className: t,
9
+ value: a,
10
+ onChange: r,
11
+ onBlur: c,
12
+ resource: u,
13
+ options: g,
14
+ placeholder: N,
15
+ disabled: h,
16
+ clearable: z = !1,
17
+ "data-testid": C,
18
+ "aria-invalid": I,
19
+ ...k
20
+ }, _) => {
21
+ const [b, v] = m.useState([]), [p, x] = m.useState(!1);
22
+ m.useEffect(() => {
23
+ u && (x(!0), u.load({}).then((l) => {
24
+ v(
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ l.items.map((n) => ({
27
+ id: n.id,
28
+ label: n.label,
29
+ value: String(n.value),
30
+ group: n.group
31
+ }))
32
+ );
33
+ }).catch(() => v([])).finally(() => x(!1)));
34
+ }, [u]);
35
+ const y = m.useMemo(() => g ? g.map((l) => ({
36
+ id: l.value,
37
+ label: l.label,
38
+ value: String(l.value),
39
+ group: l.group
40
+ })) : b, [g, b]), j = (l) => {
41
+ r?.(l);
42
+ }, B = (l) => {
43
+ l || c?.();
44
+ }, L = (l) => {
45
+ l.stopPropagation(), r?.(null);
46
+ }, w = z && a && !h && !p;
47
+ return /* @__PURE__ */ d("div", { className: "relative w-full", children: [
48
+ /* @__PURE__ */ d(
49
+ s.Root,
50
+ {
51
+ "data-slot": "select",
52
+ value: a || "",
53
+ onValueChange: j,
54
+ onOpenChange: B,
55
+ disabled: h || p,
56
+ ...k,
57
+ children: [
58
+ /* @__PURE__ */ e(
59
+ U,
60
+ {
61
+ ref: _,
62
+ className: o(t, w && "pr-8"),
63
+ disabled: p,
64
+ "data-testid": C,
65
+ "aria-invalid": I,
66
+ children: /* @__PURE__ */ e(
67
+ T,
68
+ {
69
+ placeholder: p ? "Loading..." : N || "Select an option..."
70
+ }
71
+ )
72
+ }
73
+ ),
74
+ /* @__PURE__ */ e(G, { children: p ? /* @__PURE__ */ e("div", { className: "px-2 py-1.5 text-sm text-muted-foreground", children: "Loading..." }) : y.length === 0 ? /* @__PURE__ */ e("div", { className: "px-2 py-1.5 text-sm text-muted-foreground", children: "No options available" }) : (() => {
75
+ const l = y.reduce(
76
+ (n, f) => {
77
+ const i = f.group || "default";
78
+ return n[i] || (n[i] = []), n[i].push(f), n;
79
+ },
80
+ {}
81
+ );
82
+ return Object.entries(l).map(([n, f]) => /* @__PURE__ */ d(P, { children: [
83
+ n !== "default" && /* @__PURE__ */ e(E, { children: n }),
84
+ f.map((i) => /* @__PURE__ */ e(M, { value: i.value, children: i.label }, i.id))
85
+ ] }, n));
86
+ })() })
87
+ ]
88
+ }
89
+ ),
90
+ w && /* @__PURE__ */ e(
91
+ "button",
92
+ {
93
+ type: "button",
94
+ className: "absolute right-8 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors bg-transparent border-none p-0 cursor-pointer focus:outline-none z-10",
95
+ onClick: L,
96
+ "aria-label": "Clear selection",
97
+ tabIndex: -1,
98
+ children: /* @__PURE__ */ e(V, { className: "size-4" })
99
+ }
100
+ )
101
+ ] });
102
+ }
103
+ );
104
+ D.displayName = "Select";
105
+ function P({ ...t }) {
106
+ return /* @__PURE__ */ e(s.Group, { "data-slot": "select-group", ...t });
107
+ }
108
+ function T({ ...t }) {
109
+ return /* @__PURE__ */ e(s.Value, { "data-slot": "select-value", ...t });
110
+ }
111
+ function U({
112
+ className: t,
113
+ size: a = "default",
114
+ children: r,
115
+ "aria-label": c,
116
+ ...u
117
+ }) {
118
+ return /* @__PURE__ */ d(
119
+ s.Trigger,
120
+ {
121
+ "data-slot": "select-trigger",
122
+ "data-size": a,
123
+ "aria-label": c || "Select an option",
124
+ className: o(
125
+ "h-9 w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-xs transition-colors",
126
+ "!bg-white !text-black",
127
+ "placeholder:text-muted-foreground data-[placeholder]:text-gray-500",
128
+ "focus-visible:outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
129
+ "disabled:cursor-not-allowed disabled:opacity-50",
130
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20",
131
+ "flex items-center justify-between gap-2",
132
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg]:text-gray-500",
133
+ t
134
+ ),
135
+ style: { backgroundColor: "white", color: "black" },
136
+ ...u,
137
+ children: [
138
+ r,
139
+ /* @__PURE__ */ e(s.Icon, { asChild: !0, children: /* @__PURE__ */ e(S, { className: "size-4 opacity-50" }) })
140
+ ]
141
+ }
142
+ );
143
+ }
144
+ function G({
145
+ className: t,
146
+ children: a,
147
+ position: r = "popper",
148
+ ...c
149
+ }) {
150
+ return /* @__PURE__ */ e(s.Portal, { children: /* @__PURE__ */ d(
151
+ s.Content,
152
+ {
153
+ "data-slot": "select-content",
154
+ className: o(
155
+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-white text-black shadow-md",
156
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
157
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
158
+ r === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
159
+ t
160
+ ),
161
+ style: r === "popper" ? { width: "var(--radix-select-trigger-width)" } : void 0,
162
+ position: r,
163
+ ...c,
164
+ children: [
165
+ /* @__PURE__ */ e(X, {}),
166
+ /* @__PURE__ */ e(s.Viewport, { className: o("p-1", r === "popper" && "w-full"), children: a }),
167
+ /* @__PURE__ */ e(q, {})
168
+ ]
169
+ }
170
+ ) });
171
+ }
172
+ function E({ className: t, ...a }) {
173
+ return /* @__PURE__ */ e(
174
+ s.Label,
175
+ {
176
+ "data-slot": "select-label",
177
+ className: o("text-muted-foreground px-2 py-1.5 text-xs", t),
178
+ ...a
179
+ }
180
+ );
181
+ }
182
+ function M({
183
+ className: t,
184
+ children: a,
185
+ ...r
186
+ }) {
187
+ return /* @__PURE__ */ d(
188
+ s.Item,
189
+ {
190
+ "data-slot": "select-item",
191
+ className: o(
192
+ "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-3 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
193
+ t
194
+ ),
195
+ ...r,
196
+ children: [
197
+ /* @__PURE__ */ e("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ e(s.ItemIndicator, { children: /* @__PURE__ */ e(O, { className: "size-4" }) }) }),
198
+ /* @__PURE__ */ e(s.ItemText, { children: a })
199
+ ]
200
+ }
201
+ );
202
+ }
203
+ function X({
204
+ className: t,
205
+ ...a
206
+ }) {
207
+ return /* @__PURE__ */ e(
208
+ s.ScrollUpButton,
209
+ {
210
+ "data-slot": "select-scroll-up-button",
211
+ className: o("flex cursor-default items-center justify-center py-1", t),
212
+ ...a,
213
+ children: /* @__PURE__ */ e(R, { className: "size-4" })
214
+ }
215
+ );
216
+ }
217
+ function q({
218
+ className: t,
219
+ ...a
220
+ }) {
221
+ return /* @__PURE__ */ e(
222
+ s.ScrollDownButton,
223
+ {
224
+ "data-slot": "select-scroll-down-button",
225
+ className: o("flex cursor-default items-center justify-center py-1", t),
226
+ ...a,
227
+ children: /* @__PURE__ */ e(S, { className: "size-4" })
228
+ }
229
+ );
230
+ }
231
+ export {
232
+ D as Select,
233
+ G as SelectContent,
234
+ P as SelectGroup,
235
+ M as SelectItem,
236
+ E as SelectLabel,
237
+ q as SelectScrollDownButton,
238
+ X as SelectScrollUpButton,
239
+ U as SelectTrigger,
240
+ T as SelectValue
241
+ };
@@ -0,0 +1,2 @@
1
+ export * from '../components/ui/textarea'
2
+ export {}
@@ -0,0 +1,38 @@
1
+ import { jsx as x } 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: a, onBlur: o, placeholder: i, disabled: n, rows: s = 3, maxLength: d, ...l }, u) => {
6
+ const c = (m) => {
7
+ const p = m.target.value;
8
+ a?.(p || null);
9
+ }, f = r.useMemo(() => e == null ? "" : String(e), [e]);
10
+ return /* @__PURE__ */ x(
11
+ "textarea",
12
+ {
13
+ ref: u,
14
+ value: f,
15
+ disabled: n,
16
+ placeholder: i,
17
+ rows: s,
18
+ maxLength: d,
19
+ className: b(
20
+ "w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs transition-colors",
21
+ "placeholder:text-muted-foreground",
22
+ "focus-visible:outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
23
+ "disabled:cursor-not-allowed disabled:opacity-50",
24
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20",
25
+ "resize-y",
26
+ t
27
+ ),
28
+ onChange: c,
29
+ onBlur: o,
30
+ ...l
31
+ }
32
+ );
33
+ }
34
+ );
35
+ g.displayName = "Textarea";
36
+ export {
37
+ g as Textarea
38
+ };