@utk09/finra-ui 0.0.3 → 0.0.4
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 +4 -1
- package/dist/unstyled/FileDropZone/FileDropZone.d.ts +14 -0
- package/dist/unstyled/FormField/FormField.d.ts +14 -0
- package/dist/unstyled/PillInput/PillInput.d.ts +16 -0
- package/dist/unstyled.d.ts +6 -0
- package/dist/unstyled.js +224 -22
- package/dist/unstyled.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,10 +70,13 @@ import {
|
|
|
70
70
|
SwitchBase,
|
|
71
71
|
RadioButtonBase,
|
|
72
72
|
SliderBase,
|
|
73
|
+
FormFieldBase,
|
|
74
|
+
PillInputBase,
|
|
75
|
+
FileDropZoneBase,
|
|
73
76
|
} from "@utk09/finra-ui/unstyled";
|
|
74
77
|
```
|
|
75
78
|
|
|
76
|
-
Available: `ButtonBase`, `IconButtonBase`, `InputBase`, `TextareaBase`, `NumberInputBase`, `CheckboxBase`, `SwitchBase`, `RadioButtonBase`, `SliderBase`.
|
|
79
|
+
Available: `ButtonBase`, `IconButtonBase`, `InputBase`, `TextareaBase`, `NumberInputBase`, `CheckboxBase`, `SwitchBase`, `RadioButtonBase`, `SliderBase`, `FormFieldBase`, `PillInputBase`, `FileDropZoneBase`.
|
|
77
80
|
|
|
78
81
|
## Features
|
|
79
82
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface FileDropZoneBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
3
|
+
/** Called with selected files. */
|
|
4
|
+
onChange?: (files: File[]) => void;
|
|
5
|
+
/** Accepted file types (e.g. ".pdf,.csv" or "image/*"). */
|
|
6
|
+
accept?: string;
|
|
7
|
+
/** Allow multiple file selection. */
|
|
8
|
+
multiple?: boolean;
|
|
9
|
+
/** Disable the component. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Custom content inside the drop zone. */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const FileDropZoneBase: import('react').ForwardRefExoticComponent<FileDropZoneBaseProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export type ValidationStatus = "error" | "warning" | "success";
|
|
3
|
+
export interface FormFieldBaseProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
label: string;
|
|
5
|
+
helperText?: string;
|
|
6
|
+
errorMessage?: string;
|
|
7
|
+
validationStatus?: ValidationStatus;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Explicit id for the input element. Auto-generated if omitted. */
|
|
11
|
+
htmlFor?: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const FormFieldBase: import('react').ForwardRefExoticComponent<FormFieldBaseProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface PillInputBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
3
|
+
/** Current list of pills (controlled). */
|
|
4
|
+
values?: string[];
|
|
5
|
+
/** Called when the pill list changes. */
|
|
6
|
+
onChange?: (values: string[]) => void;
|
|
7
|
+
/** Placeholder shown when no pills and input is empty. */
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
/** Disable the entire component. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Maximum number of pills allowed. */
|
|
12
|
+
maxPills?: number;
|
|
13
|
+
/** Characters that trigger pill creation (default: Enter). */
|
|
14
|
+
delimiters?: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare const PillInputBase: import('react').ForwardRefExoticComponent<PillInputBaseProps & import('react').RefAttributes<HTMLInputElement>>;
|
package/dist/unstyled.d.ts
CHANGED
|
@@ -16,3 +16,9 @@ export { RadioButtonBase } from './unstyled/RadioButton/RadioButton';
|
|
|
16
16
|
export type { RadioButtonBaseProps } from './unstyled/RadioButton/RadioButton';
|
|
17
17
|
export { SliderBase } from './unstyled/Slider/Slider';
|
|
18
18
|
export type { SliderBaseProps } from './unstyled/Slider/Slider';
|
|
19
|
+
export { FormFieldBase } from './unstyled/FormField/FormField';
|
|
20
|
+
export type { FormFieldBaseProps } from './unstyled/FormField/FormField';
|
|
21
|
+
export { PillInputBase } from './unstyled/PillInput/PillInput';
|
|
22
|
+
export type { PillInputBaseProps } from './unstyled/PillInput/PillInput';
|
|
23
|
+
export { FileDropZoneBase } from './unstyled/FileDropZone/FileDropZone';
|
|
24
|
+
export type { FileDropZoneBaseProps } from './unstyled/FileDropZone/FileDropZone';
|
package/dist/unstyled.js
CHANGED
|
@@ -1,28 +1,230 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import { B as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
const
|
|
6
|
-
({ asChild: a = !1, ...
|
|
1
|
+
import { b as w } from "./Slider-BXQjDfhb.js";
|
|
2
|
+
import { B as L, C as M, I as Q, R as U, a as W, S as X } from "./Slider-BXQjDfhb.js";
|
|
3
|
+
import { jsx as p, jsxs as k } from "react/jsx-runtime";
|
|
4
|
+
import { forwardRef as C, useId as E, Children as K, isValidElement as j, cloneElement as O, useState as b, useRef as R, useCallback as i } from "react";
|
|
5
|
+
const S = C(
|
|
6
|
+
({ asChild: a = !1, ...o }, e) => /* @__PURE__ */ p(a ? w : "input", { ref: e, ...o })
|
|
7
7
|
);
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
({ asChild: a = !1, ...
|
|
8
|
+
S.displayName = "InputBase";
|
|
9
|
+
const V = C(
|
|
10
|
+
({ asChild: a = !1, ...o }, e) => /* @__PURE__ */ p(a ? w : "textarea", { ref: e, ...o })
|
|
11
11
|
);
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
({ asChild: a = !1, ...
|
|
12
|
+
V.displayName = "TextareaBase";
|
|
13
|
+
const $ = C(
|
|
14
|
+
({ asChild: a = !1, ...o }, e) => /* @__PURE__ */ p(a ? w : "input", { ref: e, inputMode: "decimal", ...o })
|
|
15
15
|
);
|
|
16
|
-
|
|
16
|
+
$.displayName = "NumberInputBase";
|
|
17
|
+
const P = C(
|
|
18
|
+
({
|
|
19
|
+
label: a,
|
|
20
|
+
helperText: o,
|
|
21
|
+
errorMessage: e,
|
|
22
|
+
validationStatus: n,
|
|
23
|
+
required: d,
|
|
24
|
+
disabled: D,
|
|
25
|
+
htmlFor: m,
|
|
26
|
+
children: g,
|
|
27
|
+
...h
|
|
28
|
+
}, y) => {
|
|
29
|
+
const s = E(), c = m ?? s, u = `${c}-helper`, l = `${c}-error`, f = n === "error" && e, v = [f ? l : void 0, o ? u : void 0].filter(Boolean).join(" ") || void 0, B = K.map(g, (t) => j(t) ? O(t, {
|
|
30
|
+
id: c,
|
|
31
|
+
"aria-describedby": v,
|
|
32
|
+
"aria-invalid": n === "error" ? !0 : void 0,
|
|
33
|
+
disabled: D || void 0
|
|
34
|
+
}) : t);
|
|
35
|
+
return /* @__PURE__ */ k("div", { ref: y, ...h, children: [
|
|
36
|
+
/* @__PURE__ */ k("label", { htmlFor: c, children: [
|
|
37
|
+
a,
|
|
38
|
+
d ? " *" : null
|
|
39
|
+
] }),
|
|
40
|
+
B,
|
|
41
|
+
f ? /* @__PURE__ */ p("p", { id: l, role: "alert", children: e }) : null,
|
|
42
|
+
o ? /* @__PURE__ */ p("p", { id: u, children: o }) : null
|
|
43
|
+
] });
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
P.displayName = "FormFieldBase";
|
|
47
|
+
function Z(...a) {
|
|
48
|
+
return (o) => {
|
|
49
|
+
for (const e of a)
|
|
50
|
+
typeof e == "function" ? e(o) : e && typeof e == "object" && (e.current = o);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const A = C(
|
|
54
|
+
({
|
|
55
|
+
values: a,
|
|
56
|
+
onChange: o,
|
|
57
|
+
placeholder: e,
|
|
58
|
+
disabled: n,
|
|
59
|
+
maxPills: d,
|
|
60
|
+
delimiters: D = [],
|
|
61
|
+
...m
|
|
62
|
+
}, g) => {
|
|
63
|
+
const [h, y] = b([]), [s, c] = b(""), u = R(null), l = a ?? h, f = i(
|
|
64
|
+
(r) => {
|
|
65
|
+
a || y(r), o?.(r);
|
|
66
|
+
},
|
|
67
|
+
[a, o]
|
|
68
|
+
), v = i(
|
|
69
|
+
(r) => {
|
|
70
|
+
const I = r.trim();
|
|
71
|
+
I && (l.includes(I) || d != null && l.length >= d || (f([...l, I]), c("")));
|
|
72
|
+
},
|
|
73
|
+
[l, d, f]
|
|
74
|
+
), B = i(
|
|
75
|
+
(r) => {
|
|
76
|
+
f(l.filter((I, N) => N !== r)), u.current?.focus();
|
|
77
|
+
},
|
|
78
|
+
[l, f]
|
|
79
|
+
), t = i(
|
|
80
|
+
(r) => {
|
|
81
|
+
if (r.key === "Enter") {
|
|
82
|
+
r.preventDefault(), v(s);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (r.key === "Backspace" && s === "" && l.length > 0) {
|
|
86
|
+
B(l.length - 1);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
D.includes(r.key) && (r.preventDefault(), v(s));
|
|
90
|
+
},
|
|
91
|
+
[s, l, D, v, B]
|
|
92
|
+
), x = i(() => {
|
|
93
|
+
n || u.current?.focus();
|
|
94
|
+
}, [n]), F = i(
|
|
95
|
+
(r) => {
|
|
96
|
+
!n && (r.key === "Enter" || r.key === " ") && u.current?.focus();
|
|
97
|
+
},
|
|
98
|
+
[n]
|
|
99
|
+
);
|
|
100
|
+
return /* @__PURE__ */ k(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
role: "toolbar",
|
|
104
|
+
onClick: x,
|
|
105
|
+
onKeyDown: F,
|
|
106
|
+
...m,
|
|
107
|
+
children: [
|
|
108
|
+
l.map((r) => /* @__PURE__ */ k("span", { children: [
|
|
109
|
+
r,
|
|
110
|
+
n ? null : /* @__PURE__ */ p(
|
|
111
|
+
"button",
|
|
112
|
+
{
|
|
113
|
+
type: "button",
|
|
114
|
+
onClick: (I) => {
|
|
115
|
+
I.stopPropagation(), B(l.indexOf(r));
|
|
116
|
+
},
|
|
117
|
+
"aria-label": `Remove ${r}`,
|
|
118
|
+
tabIndex: -1,
|
|
119
|
+
children: "×"
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] }, r)),
|
|
123
|
+
/* @__PURE__ */ p(
|
|
124
|
+
"input",
|
|
125
|
+
{
|
|
126
|
+
ref: Z(g, u),
|
|
127
|
+
type: "text",
|
|
128
|
+
value: s,
|
|
129
|
+
onChange: (r) => c(r.target.value),
|
|
130
|
+
onKeyDown: t,
|
|
131
|
+
placeholder: l.length === 0 ? e : void 0,
|
|
132
|
+
disabled: n,
|
|
133
|
+
"aria-label": m["aria-label"],
|
|
134
|
+
"aria-labelledby": m["aria-labelledby"]
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
A.displayName = "PillInputBase";
|
|
143
|
+
function T(...a) {
|
|
144
|
+
return (o) => {
|
|
145
|
+
for (const e of a)
|
|
146
|
+
typeof e == "function" ? e(o) : e && typeof e == "object" && (e.current = o);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const _ = C(
|
|
150
|
+
({ onChange: a, accept: o, multiple: e, disabled: n, children: d, ...D }, m) => {
|
|
151
|
+
const [g, h] = b(!1), y = R(null), s = i(
|
|
152
|
+
(t) => {
|
|
153
|
+
!t || t.length === 0 || a?.(Array.from(t));
|
|
154
|
+
},
|
|
155
|
+
[a]
|
|
156
|
+
), c = i(
|
|
157
|
+
(t) => {
|
|
158
|
+
t.preventDefault(), n || h(!0);
|
|
159
|
+
},
|
|
160
|
+
[n]
|
|
161
|
+
), u = i((t) => {
|
|
162
|
+
t.preventDefault(), h(!1);
|
|
163
|
+
}, []), l = i(
|
|
164
|
+
(t) => {
|
|
165
|
+
t.preventDefault(), h(!1), n || s(t.dataTransfer.files);
|
|
166
|
+
},
|
|
167
|
+
[n, s]
|
|
168
|
+
), f = i(
|
|
169
|
+
(t) => {
|
|
170
|
+
s(t.target.files), t.target.value = "";
|
|
171
|
+
},
|
|
172
|
+
[s]
|
|
173
|
+
), v = i(() => {
|
|
174
|
+
n || y.current?.click();
|
|
175
|
+
}, [n]), B = i(
|
|
176
|
+
(t) => {
|
|
177
|
+
!n && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), y.current?.click());
|
|
178
|
+
},
|
|
179
|
+
[n]
|
|
180
|
+
);
|
|
181
|
+
return /* @__PURE__ */ k(
|
|
182
|
+
"div",
|
|
183
|
+
{
|
|
184
|
+
role: "button",
|
|
185
|
+
tabIndex: n ? -1 : 0,
|
|
186
|
+
"aria-disabled": n || void 0,
|
|
187
|
+
"data-drag-over": g || void 0,
|
|
188
|
+
onClick: v,
|
|
189
|
+
onKeyDown: B,
|
|
190
|
+
onDragOver: c,
|
|
191
|
+
onDragLeave: u,
|
|
192
|
+
onDrop: l,
|
|
193
|
+
...D,
|
|
194
|
+
children: [
|
|
195
|
+
/* @__PURE__ */ p(
|
|
196
|
+
"input",
|
|
197
|
+
{
|
|
198
|
+
ref: T(m, y),
|
|
199
|
+
type: "file",
|
|
200
|
+
style: { display: "none" },
|
|
201
|
+
accept: o,
|
|
202
|
+
multiple: e,
|
|
203
|
+
disabled: n,
|
|
204
|
+
onChange: f,
|
|
205
|
+
tabIndex: -1,
|
|
206
|
+
"aria-hidden": "true"
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
d ?? /* @__PURE__ */ p("span", { children: "Drop files here or click to browse" })
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
_.displayName = "FileDropZoneBase";
|
|
17
216
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
217
|
+
L as ButtonBase,
|
|
218
|
+
M as CheckboxBase,
|
|
219
|
+
_ as FileDropZoneBase,
|
|
220
|
+
P as FormFieldBase,
|
|
221
|
+
Q as IconButtonBase,
|
|
222
|
+
S as InputBase,
|
|
223
|
+
$ as NumberInputBase,
|
|
224
|
+
A as PillInputBase,
|
|
225
|
+
U as RadioButtonBase,
|
|
226
|
+
W as SliderBase,
|
|
227
|
+
X as SwitchBase,
|
|
228
|
+
V as TextareaBase
|
|
27
229
|
};
|
|
28
230
|
//# sourceMappingURL=unstyled.js.map
|
package/dist/unstyled.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unstyled.js","sources":["../src/unstyled/Input/Input.tsx","../src/unstyled/Textarea/Textarea.tsx","../src/unstyled/NumberInput/NumberInput.tsx"],"sourcesContent":["import { forwardRef, type InputHTMLAttributes } from \"react\";\nimport { Slot } from \"../Slot\";\n\nexport interface InputBaseProps extends InputHTMLAttributes<HTMLInputElement> {\n asChild?: boolean;\n}\n\nexport const InputBase = forwardRef<HTMLInputElement, InputBaseProps>(\n ({ asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"input\";\n\n return <Comp ref={ref} {...props} />;\n },\n);\n\nInputBase.displayName = \"InputBase\";\n","import { forwardRef, type TextareaHTMLAttributes } from \"react\";\nimport { Slot } from \"../Slot\";\n\nexport interface TextareaBaseProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n asChild?: boolean;\n}\n\nexport const TextareaBase = forwardRef<HTMLTextAreaElement, TextareaBaseProps>(\n ({ asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"textarea\";\n\n return <Comp ref={ref} {...props} />;\n },\n);\n\nTextareaBase.displayName = \"TextareaBase\";\n","import { forwardRef, type InputHTMLAttributes } from \"react\";\nimport { Slot } from \"../Slot\";\n\nexport interface NumberInputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\"> {\n asChild?: boolean;\n}\n\nexport const NumberInputBase = forwardRef<HTMLInputElement, NumberInputBaseProps>(\n ({ asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"input\";\n\n return <Comp ref={ref} inputMode=\"decimal\" {...props} />;\n },\n);\n\nNumberInputBase.displayName = \"NumberInputBase\";\n"],"names":["InputBase","forwardRef","asChild","props","ref","jsx","Slot","TextareaBase","NumberInputBase"],"mappings":";;;;AAOO,MAAMA,IAAYC;AAAA,EACvB,CAAC,EAAE,SAAAC,IAAU,IAAO,GAAGC,EAAA,GAASC,MAGvB,gBAAAC,EAFMH,IAAUI,IAAO,SAEtB,EAAK,KAAAF,GAAW,GAAGD,EAAA,CAAO;AAEtC;AAEAH,EAAU,cAAc;ACRjB,MAAMO,IAAeN;AAAA,EAC1B,CAAC,EAAE,SAAAC,IAAU,IAAO,GAAGC,EAAA,GAASC,MAGvB,gBAAAC,EAFMH,IAAUI,IAAO,YAEtB,EAAK,KAAAF,GAAW,GAAGD,EAAA,CAAO;AAEtC;AAEAI,EAAa,cAAc;ACRpB,MAAMC,IAAkBP;AAAA,EAC7B,CAAC,EAAE,SAAAC,IAAU,IAAO,GAAGC,EAAA,GAASC,wBACjBF,IAAUI,IAAO,SAEtB,EAAK,KAAAF,GAAU,WAAU,WAAW,GAAGD,GAAO;AAE1D;AAEAK,EAAgB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"unstyled.js","sources":["../src/unstyled/Input/Input.tsx","../src/unstyled/Textarea/Textarea.tsx","../src/unstyled/NumberInput/NumberInput.tsx","../src/unstyled/FormField/FormField.tsx","../src/unstyled/PillInput/PillInput.tsx","../src/unstyled/FileDropZone/FileDropZone.tsx"],"sourcesContent":["import { forwardRef, type InputHTMLAttributes } from \"react\";\nimport { Slot } from \"../Slot\";\n\nexport interface InputBaseProps extends InputHTMLAttributes<HTMLInputElement> {\n asChild?: boolean;\n}\n\nexport const InputBase = forwardRef<HTMLInputElement, InputBaseProps>(\n ({ asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"input\";\n\n return <Comp ref={ref} {...props} />;\n },\n);\n\nInputBase.displayName = \"InputBase\";\n","import { forwardRef, type TextareaHTMLAttributes } from \"react\";\nimport { Slot } from \"../Slot\";\n\nexport interface TextareaBaseProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n asChild?: boolean;\n}\n\nexport const TextareaBase = forwardRef<HTMLTextAreaElement, TextareaBaseProps>(\n ({ asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"textarea\";\n\n return <Comp ref={ref} {...props} />;\n },\n);\n\nTextareaBase.displayName = \"TextareaBase\";\n","import { forwardRef, type InputHTMLAttributes } from \"react\";\nimport { Slot } from \"../Slot\";\n\nexport interface NumberInputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\"> {\n asChild?: boolean;\n}\n\nexport const NumberInputBase = forwardRef<HTMLInputElement, NumberInputBaseProps>(\n ({ asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"input\";\n\n return <Comp ref={ref} inputMode=\"decimal\" {...props} />;\n },\n);\n\nNumberInputBase.displayName = \"NumberInputBase\";\n","import {\n forwardRef,\n useId,\n Children,\n isValidElement,\n cloneElement,\n type ReactNode,\n type HTMLAttributes,\n} from \"react\";\n\nexport type ValidationStatus = \"error\" | \"warning\" | \"success\";\n\nexport interface FormFieldBaseProps extends HTMLAttributes<HTMLDivElement> {\n label: string;\n helperText?: string;\n errorMessage?: string;\n validationStatus?: ValidationStatus;\n required?: boolean;\n disabled?: boolean;\n /** Explicit id for the input element. Auto-generated if omitted. */\n htmlFor?: string;\n children: ReactNode;\n}\n\nexport const FormFieldBase = forwardRef<HTMLDivElement, FormFieldBaseProps>(\n (\n {\n label,\n helperText,\n errorMessage,\n validationStatus,\n required,\n disabled,\n htmlFor,\n children,\n ...props\n },\n ref,\n ) => {\n const autoId = useId();\n const fieldId = htmlFor ?? autoId;\n const helperId = `${fieldId}-helper`;\n const errorId = `${fieldId}-error`;\n\n const showError = validationStatus === \"error\" && errorMessage;\n\n const describedBy =\n [showError ? errorId : undefined, helperText ? helperId : undefined]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n const enhancedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n return cloneElement(child as React.ReactElement<Record<string, unknown>>, {\n id: fieldId,\n \"aria-describedby\": describedBy,\n \"aria-invalid\": validationStatus === \"error\" ? true : undefined,\n disabled: disabled || undefined,\n });\n });\n\n return (\n <div ref={ref} {...props}>\n <label htmlFor={fieldId}>\n {label}\n {required ? \" *\" : null}\n </label>\n\n {enhancedChildren}\n\n {showError ? (\n <p id={errorId} role=\"alert\">\n {errorMessage}\n </p>\n ) : null}\n\n {helperText ? <p id={helperId}>{helperText}</p> : null}\n </div>\n );\n },\n);\n\nFormFieldBase.displayName = \"FormFieldBase\";\n","import {\n forwardRef,\n useState,\n useRef,\n useCallback,\n type KeyboardEvent,\n type HTMLAttributes,\n type Ref,\n} from \"react\";\n\nfunction mergeRefs<T>(...refs: (Ref<T> | undefined)[]): (value: T | null) => void {\n return (value: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref && typeof ref === \"object\") {\n (ref as React.RefObject<T | null>).current = value;\n }\n }\n };\n}\n\nexport interface PillInputBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Current list of pills (controlled). */\n values?: string[];\n /** Called when the pill list changes. */\n onChange?: (values: string[]) => void;\n /** Placeholder shown when no pills and input is empty. */\n placeholder?: string;\n /** Disable the entire component. */\n disabled?: boolean;\n /** Maximum number of pills allowed. */\n maxPills?: number;\n /** Characters that trigger pill creation (default: Enter). */\n delimiters?: string[];\n}\n\nexport const PillInputBase = forwardRef<HTMLInputElement, PillInputBaseProps>(\n (\n {\n values: controlledValues,\n onChange,\n placeholder,\n disabled,\n maxPills,\n delimiters = [],\n ...props\n },\n forwardedRef,\n ) => {\n const [internalValues, setInternalValues] = useState<string[]>([]);\n const [inputValue, setInputValue] = useState(\"\");\n const internalRef = useRef<HTMLInputElement>(null);\n\n const values = controlledValues ?? internalValues;\n\n const updateValues = useCallback(\n (next: string[]) => {\n if (!controlledValues) {\n setInternalValues(next);\n }\n onChange?.(next);\n },\n [controlledValues, onChange],\n );\n\n const addPill = useCallback(\n (text: string) => {\n const trimmed = text.trim();\n if (!trimmed) return;\n if (values.includes(trimmed)) return;\n if (maxPills != null && values.length >= maxPills) return;\n updateValues([...values, trimmed]);\n setInputValue(\"\");\n },\n [values, maxPills, updateValues],\n );\n\n const removePill = useCallback(\n (index: number) => {\n updateValues(values.filter((_, i) => i !== index));\n internalRef.current?.focus();\n },\n [values, updateValues],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n addPill(inputValue);\n return;\n }\n if (e.key === \"Backspace\" && inputValue === \"\" && values.length > 0) {\n removePill(values.length - 1);\n return;\n }\n if (delimiters.includes(e.key)) {\n e.preventDefault();\n addPill(inputValue);\n }\n },\n [inputValue, values, delimiters, addPill, removePill],\n );\n\n const handleContainerClick = useCallback(() => {\n if (!disabled) {\n internalRef.current?.focus();\n }\n }, [disabled]);\n\n const handleContainerKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!disabled && (e.key === \"Enter\" || e.key === \" \")) {\n internalRef.current?.focus();\n }\n },\n [disabled],\n );\n\n return (\n <div\n role=\"toolbar\"\n onClick={handleContainerClick}\n onKeyDown={handleContainerKeyDown}\n {...props}>\n {values.map((pill) => (\n <span key={pill}>\n {pill}\n {!disabled ? (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n removePill(values.indexOf(pill));\n }}\n aria-label={`Remove ${pill}`}\n tabIndex={-1}>\n ×\n </button>\n ) : null}\n </span>\n ))}\n <input\n ref={mergeRefs(forwardedRef, internalRef)}\n type=\"text\"\n value={inputValue}\n onChange={(e) => setInputValue(e.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={values.length === 0 ? placeholder : undefined}\n disabled={disabled}\n aria-label={props[\"aria-label\"]}\n aria-labelledby={props[\"aria-labelledby\"]}\n />\n </div>\n );\n },\n);\n\nPillInputBase.displayName = \"PillInputBase\";\n","import {\n forwardRef,\n useState,\n useRef,\n useCallback,\n type DragEvent,\n type ChangeEvent,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nfunction mergeRefs<T>(...refs: (Ref<T> | undefined)[]): (value: T | null) => void {\n return (value: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref && typeof ref === \"object\") {\n (ref as React.RefObject<T | null>).current = value;\n }\n }\n };\n}\n\nexport interface FileDropZoneBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Called with selected files. */\n onChange?: (files: File[]) => void;\n /** Accepted file types (e.g. \".pdf,.csv\" or \"image/*\"). */\n accept?: string;\n /** Allow multiple file selection. */\n multiple?: boolean;\n /** Disable the component. */\n disabled?: boolean;\n /** Custom content inside the drop zone. */\n children?: ReactNode;\n}\n\nexport const FileDropZoneBase = forwardRef<HTMLInputElement, FileDropZoneBaseProps>(\n ({ onChange, accept, multiple, disabled, children, ...props }, forwardedRef) => {\n const [isDragOver, setIsDragOver] = useState(false);\n const internalRef = useRef<HTMLInputElement>(null);\n\n const handleFiles = useCallback(\n (fileList: FileList | null) => {\n if (!fileList || fileList.length === 0) return;\n onChange?.(Array.from(fileList));\n },\n [onChange],\n );\n\n const handleDragOver = useCallback(\n (e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n if (!disabled) {\n setIsDragOver(true);\n }\n },\n [disabled],\n );\n\n const handleDragLeave = useCallback((e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n setIsDragOver(false);\n }, []);\n\n const handleDrop = useCallback(\n (e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n setIsDragOver(false);\n if (!disabled) {\n handleFiles(e.dataTransfer.files);\n }\n },\n [disabled, handleFiles],\n );\n\n const handleInputChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n handleFiles(e.target.files);\n // Reset so the same file can be selected again\n e.target.value = \"\";\n },\n [handleFiles],\n );\n\n const handleClick = useCallback(() => {\n if (!disabled) {\n internalRef.current?.click();\n }\n }, [disabled]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!disabled && (e.key === \"Enter\" || e.key === \" \")) {\n e.preventDefault();\n internalRef.current?.click();\n }\n },\n [disabled],\n );\n\n return (\n <div\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n data-drag-over={isDragOver || undefined}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n {...props}>\n <input\n ref={mergeRefs(forwardedRef, internalRef)}\n type=\"file\"\n style={{ display: \"none\" }}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={handleInputChange}\n tabIndex={-1}\n aria-hidden=\"true\"\n />\n {children ?? <span>Drop files here or click to browse</span>}\n </div>\n );\n },\n);\n\nFileDropZoneBase.displayName = \"FileDropZoneBase\";\n"],"names":["InputBase","forwardRef","asChild","props","ref","jsx","Slot","TextareaBase","NumberInputBase","FormFieldBase","label","helperText","errorMessage","validationStatus","required","disabled","htmlFor","children","autoId","useId","fieldId","helperId","errorId","showError","describedBy","enhancedChildren","Children","child","isValidElement","cloneElement","jsxs","mergeRefs","refs","value","PillInputBase","controlledValues","onChange","placeholder","maxPills","delimiters","forwardedRef","internalValues","setInternalValues","useState","inputValue","setInputValue","internalRef","useRef","values","updateValues","useCallback","next","addPill","text","trimmed","removePill","index","_","i","handleKeyDown","e","handleContainerClick","handleContainerKeyDown","pill","FileDropZoneBase","accept","multiple","isDragOver","setIsDragOver","handleFiles","fileList","handleDragOver","handleDragLeave","handleDrop","handleInputChange","handleClick"],"mappings":";;;;AAOO,MAAMA,IAAYC;AAAA,EACvB,CAAC,EAAE,SAAAC,IAAU,IAAO,GAAGC,EAAA,GAASC,MAGvB,gBAAAC,EAFMH,IAAUI,IAAO,SAEtB,EAAK,KAAAF,GAAW,GAAGD,EAAA,CAAO;AAEtC;AAEAH,EAAU,cAAc;ACRjB,MAAMO,IAAeN;AAAA,EAC1B,CAAC,EAAE,SAAAC,IAAU,IAAO,GAAGC,EAAA,GAASC,MAGvB,gBAAAC,EAFMH,IAAUI,IAAO,YAEtB,EAAK,KAAAF,GAAW,GAAGD,EAAA,CAAO;AAEtC;AAEAI,EAAa,cAAc;ACRpB,MAAMC,IAAkBP;AAAA,EAC7B,CAAC,EAAE,SAAAC,IAAU,IAAO,GAAGC,EAAA,GAASC,wBACjBF,IAAUI,IAAO,SAEtB,EAAK,KAAAF,GAAU,WAAU,WAAW,GAAGD,GAAO;AAE1D;AAEAK,EAAgB,cAAc;ACSvB,MAAMC,IAAgBR;AAAA,EAC3B,CACE;AAAA,IACE,OAAAS;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGd;AAAA,EAAA,GAELC,MACG;AACH,UAAMc,IAASC,EAAA,GACTC,IAAUJ,KAAWE,GACrBG,IAAW,GAAGD,CAAO,WACrBE,IAAU,GAAGF,CAAO,UAEpBG,IAAYV,MAAqB,WAAWD,GAE5CY,IACJ,CAACD,IAAYD,IAAU,QAAWX,IAAaU,IAAW,MAAS,EAChE,OAAO,OAAO,EACd,KAAK,GAAG,KAAK,QAEZI,IAAmBC,EAAS,IAAIT,GAAU,CAAC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