@brycks/core-front 0.10.0 → 0.12.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.
Files changed (46) hide show
  1. package/dist/components/data/VirtualList/VirtualList.js +1 -1
  2. package/dist/components/data.cjs +1 -1
  3. package/dist/components/data.js +26 -26
  4. package/dist/components/feedback/Toast/ToastContext.js +3 -3
  5. package/dist/components/feedback.cjs +1 -1
  6. package/dist/components/feedback.js +21 -21
  7. package/dist/components/form/DropZone/DropZone.cjs.map +1 -1
  8. package/dist/components/form/DropZone/DropZone.js.map +1 -1
  9. package/dist/components/form/FileInput/FileInput.cjs.map +1 -1
  10. package/dist/components/form/FileInput/FileInput.js.map +1 -1
  11. package/dist/components/form/FileUpload/FileUpload.cjs +2 -0
  12. package/dist/components/form/FileUpload/FileUpload.cjs.map +1 -0
  13. package/dist/components/form/FileUpload/FileUpload.js +223 -0
  14. package/dist/components/form/FileUpload/FileUpload.js.map +1 -0
  15. package/dist/components/form/FileUpload/fileUpload.utils.cjs +2 -0
  16. package/dist/components/form/FileUpload/fileUpload.utils.cjs.map +1 -0
  17. package/dist/components/form/FileUpload/fileUpload.utils.js +43 -0
  18. package/dist/components/form/FileUpload/fileUpload.utils.js.map +1 -0
  19. package/dist/components/form/FormGroup/FormGroup.cjs +1 -1
  20. package/dist/components/form/FormGroup/FormGroup.js +1 -1
  21. package/dist/components/form/Slider/Slider.cjs +1 -1
  22. package/dist/components/form/Slider/Slider.js +2 -2
  23. package/dist/components/form/TagInput/TagInput.cjs +1 -1
  24. package/dist/components/form/TagInput/TagInput.js +8 -8
  25. package/dist/components/form.cjs +1 -1
  26. package/dist/components/form.js +51 -45
  27. package/dist/components/form.js.map +1 -1
  28. package/dist/components/layout.cjs +1 -1
  29. package/dist/components/layout.js +30 -30
  30. package/dist/components/navigation/ContextMenu/ContextMenu.cjs +1 -1
  31. package/dist/components/navigation/ContextMenu/ContextMenu.js +5 -5
  32. package/dist/components/navigation/Stepper/Stepper.js +4 -4
  33. package/dist/components/navigation/Tabs/Tabs.js +4 -4
  34. package/dist/components/navigation.cjs +1 -1
  35. package/dist/components/navigation.js +22 -22
  36. package/dist/components/typography/Text/Text.cjs +1 -1
  37. package/dist/components/typography/Text/Text.js +1 -1
  38. package/dist/components/utility.cjs +1 -1
  39. package/dist/components/utility.js +28 -28
  40. package/dist/form.d.ts +117 -0
  41. package/dist/index.cjs +1 -1
  42. package/dist/index.d.ts +94 -1
  43. package/dist/index.js +279 -275
  44. package/dist/index.js.map +1 -1
  45. package/dist/styles.css +1 -1
  46. package/package.json +115 -115
@@ -0,0 +1,223 @@
1
+ import { jsx as r, jsxs as a, Fragment as R } from "react/jsx-runtime";
2
+ import { forwardRef as J, useRef as K, useState as z, useCallback as s } from "react";
3
+ import { cx as Q } from "../../../utils/styles.js";
4
+ import { selectFiles as X, formatBytes as A } from "./fileUpload.utils.js";
5
+ const Y = {
6
+ trigger: "Choose file",
7
+ placeholder: "No file selected",
8
+ prompt: "Click to browse or drag a file here",
9
+ dropPrompt: "Drop to upload",
10
+ remove: "Remove file",
11
+ invalidType: (c) => `${c}: unsupported file type.`,
12
+ tooLarge: (c, l) => `${c}: exceeds ${l}.`
13
+ };
14
+ function B() {
15
+ return /* @__PURE__ */ a("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
16
+ /* @__PURE__ */ r(
17
+ "path",
18
+ {
19
+ d: "M12 15V4m0 0L8 8m4-4l4 4",
20
+ stroke: "currentColor",
21
+ strokeWidth: "1.6",
22
+ strokeLinecap: "round",
23
+ strokeLinejoin: "round"
24
+ }
25
+ ),
26
+ /* @__PURE__ */ r(
27
+ "path",
28
+ {
29
+ d: "M4 15v2.5A2.5 2.5 0 006.5 20h11a2.5 2.5 0 002.5-2.5V15",
30
+ stroke: "currentColor",
31
+ strokeWidth: "1.6",
32
+ strokeLinecap: "round"
33
+ }
34
+ )
35
+ ] });
36
+ }
37
+ function Z() {
38
+ return /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
39
+ /* @__PURE__ */ r(
40
+ "path",
41
+ {
42
+ d: "M9 1.5H4.5A1.5 1.5 0 003 3v10A1.5 1.5 0 004.5 14.5h7A1.5 1.5 0 0013 13V5.5L9 1.5z",
43
+ stroke: "currentColor",
44
+ strokeWidth: "1.3",
45
+ strokeLinejoin: "round"
46
+ }
47
+ ),
48
+ /* @__PURE__ */ r("path", { d: "M9 1.5v4h4", stroke: "currentColor", strokeWidth: "1.3", strokeLinejoin: "round" })
49
+ ] });
50
+ }
51
+ function S() {
52
+ return /* @__PURE__ */ r("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M4 4l6 6M10 4l-6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) });
53
+ }
54
+ const ee = J(
55
+ function({
56
+ files: l,
57
+ onFilesChange: d,
58
+ variant: b = "dropzone",
59
+ size: O = "md",
60
+ accept: m,
61
+ multiple: k = !1,
62
+ maxFiles: N,
63
+ maxSize: p,
64
+ hint: u,
65
+ error: v,
66
+ isInvalid: W = !1,
67
+ disabled: o = !1,
68
+ icon: U,
69
+ onReject: L,
70
+ labels: P,
71
+ id: T,
72
+ className: V,
73
+ testId: F
74
+ }, h) {
75
+ const D = K(null), [_, y] = z(!1), [C, $] = z([]), t = { ...Y, ...P }, g = W || !!v || C.length > 0, f = s(
76
+ (e) => {
77
+ if (!e || e.length === 0) return;
78
+ const { accepted: n, rejected: i } = X(Array.from(e), {
79
+ accept: m,
80
+ maxSize: p,
81
+ multiple: k,
82
+ maxFiles: N,
83
+ current: l
84
+ });
85
+ $(i), i.length > 0 && L?.(i), (n.length > 0 || i.length === 0) && d(n);
86
+ },
87
+ [m, l, N, p, k, d, L]
88
+ ), E = s(
89
+ (e) => {
90
+ f(e.target.files), e.target.value = "";
91
+ },
92
+ [f]
93
+ ), j = s(() => {
94
+ o || D.current?.click();
95
+ }, [o]), H = s(
96
+ (e) => {
97
+ $([]), d(l.filter((n, i) => i !== e));
98
+ },
99
+ [l, d]
100
+ ), w = s(
101
+ (e) => {
102
+ e.preventDefault(), o || y(!0);
103
+ },
104
+ [o]
105
+ ), x = s((e) => {
106
+ e.preventDefault(), y(!1);
107
+ }, []), M = s(
108
+ (e) => {
109
+ e.preventDefault(), y(!1), o || f(e.dataTransfer.files);
110
+ },
111
+ [o, f]
112
+ ), q = p === void 0 ? "" : A(p), G = C.map(
113
+ ({ file: e, reason: n }) => n === "type" ? t.invalidType(e.name) : t.tooLarge(e.name, q)
114
+ ), I = l.length > 0 ? /* @__PURE__ */ r("ul", { className: "brycks-file-upload__files", children: l.map((e, n) => /* @__PURE__ */ a("li", { className: "brycks-file-upload__file", children: [
115
+ /* @__PURE__ */ r("span", { className: "brycks-file-upload__file-icon", children: /* @__PURE__ */ r(Z, {}) }),
116
+ /* @__PURE__ */ a("span", { className: "brycks-file-upload__file-text", children: [
117
+ /* @__PURE__ */ r("span", { className: "brycks-file-upload__file-name", title: e.name, children: e.name }),
118
+ /* @__PURE__ */ r("span", { className: "brycks-file-upload__file-size", children: A(e.size) })
119
+ ] }),
120
+ /* @__PURE__ */ r(
121
+ "button",
122
+ {
123
+ type: "button",
124
+ className: "brycks-file-upload__remove",
125
+ onClick: () => H(n),
126
+ disabled: o,
127
+ "aria-label": `${t.remove}: ${e.name}`,
128
+ children: /* @__PURE__ */ r(S, {})
129
+ }
130
+ )
131
+ ] }, `${e.name}-${e.size}-${n}`)) }) : null;
132
+ return /* @__PURE__ */ a(
133
+ "div",
134
+ {
135
+ className: Q(
136
+ "brycks-file-upload",
137
+ `brycks-file-upload--${b}`,
138
+ `brycks-file-upload--${O}`,
139
+ V
140
+ ),
141
+ children: [
142
+ b === "dropzone" ? /* @__PURE__ */ a(R, { children: [
143
+ /* @__PURE__ */ a(
144
+ "button",
145
+ {
146
+ type: "button",
147
+ className: "brycks-file-upload__dropzone",
148
+ onClick: j,
149
+ onDragOver: w,
150
+ onDragLeave: x,
151
+ onDrop: M,
152
+ disabled: o,
153
+ "aria-disabled": o,
154
+ "aria-invalid": g || void 0,
155
+ "data-drag-over": _,
156
+ "data-invalid": g,
157
+ children: [
158
+ /* @__PURE__ */ r("span", { className: "brycks-file-upload__icon", children: U ?? /* @__PURE__ */ r(B, {}) }),
159
+ /* @__PURE__ */ r("span", { className: "brycks-file-upload__prompt", children: _ ? t.dropPrompt : t.prompt }),
160
+ u ? /* @__PURE__ */ r("span", { className: "brycks-file-upload__hint", children: u }) : null
161
+ ]
162
+ }
163
+ ),
164
+ I
165
+ ] }) : /* @__PURE__ */ a(R, { children: [
166
+ /* @__PURE__ */ a(
167
+ "div",
168
+ {
169
+ className: "brycks-file-upload__compact",
170
+ onDragOver: w,
171
+ onDragLeave: x,
172
+ onDrop: M,
173
+ children: [
174
+ /* @__PURE__ */ a(
175
+ "button",
176
+ {
177
+ type: "button",
178
+ className: "brycks-file-upload__trigger",
179
+ onClick: j,
180
+ disabled: o,
181
+ "aria-invalid": g || void 0,
182
+ "data-drag-over": _,
183
+ children: [
184
+ /* @__PURE__ */ r(B, {}),
185
+ t.trigger
186
+ ]
187
+ }
188
+ ),
189
+ I ?? /* @__PURE__ */ r("span", { className: "brycks-file-upload__placeholder", children: t.placeholder })
190
+ ]
191
+ }
192
+ ),
193
+ u ? /* @__PURE__ */ r("span", { className: "brycks-file-upload__hint", children: u }) : null
194
+ ] }),
195
+ G.map((e) => /* @__PURE__ */ r("span", { className: "brycks-file-upload__error", role: "alert", children: e }, e)),
196
+ v ? /* @__PURE__ */ r("span", { className: "brycks-file-upload__error", role: "alert", children: v }) : null,
197
+ /* @__PURE__ */ r(
198
+ "input",
199
+ {
200
+ ref: (e) => {
201
+ D.current = e, typeof h == "function" ? h(e) : h && (h.current = e);
202
+ },
203
+ id: T,
204
+ type: "file",
205
+ accept: m,
206
+ multiple: k,
207
+ disabled: o,
208
+ onChange: E,
209
+ style: { display: "none" },
210
+ tabIndex: -1,
211
+ "data-testid": F
212
+ }
213
+ )
214
+ ]
215
+ }
216
+ );
217
+ }
218
+ );
219
+ ee.displayName = "FileUpload";
220
+ export {
221
+ ee as FileUpload
222
+ };
223
+ //# sourceMappingURL=FileUpload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileUpload.js","sources":["../../../../src/components/form/FileUpload/FileUpload.tsx"],"sourcesContent":["/**\n * FileUpload Component\n *\n * Themed replacement for the native file input, whose entire box — including\n * the \"no file chosen\" text — reacts to clicks and cannot be styled.\n *\n * Two layouts, one visual language:\n * - `dropzone`: a dashed target that also accepts drag-and-drop.\n * - `compact`: a single row where **only the button** opens the file picker.\n *\n * Selected files are always listed with name, size and a remove button, and\n * files refused by `accept`/`maxSize` produce a visible message instead of\n * disappearing silently.\n *\n * Accessibility: the visible control is a real `<button>`, so focus, Enter and\n * Space come from the platform. The native input is hidden and only proxied.\n *\n * @example\n * ```tsx\n * <FileUpload\n * variant=\"compact\"\n * accept=\".pfx,.p12\"\n * files={pfx ? [pfx] : []}\n * onFilesChange={(files) => setPfx(files[0] ?? null)}\n * />\n * ```\n */\n\nimport {\n forwardRef,\n useCallback,\n useRef,\n useState,\n type ChangeEvent,\n type DragEvent,\n} from 'react'\nimport { cx } from '../../../utils/styles'\nimport { formatBytes, selectFiles, type FileRejection } from './fileUpload.utils'\nimport type { FileUploadLabels, FileUploadProps } from './FileUpload.types'\n\nconst defaultLabels: Required<FileUploadLabels> = {\n trigger: 'Choose file',\n placeholder: 'No file selected',\n prompt: 'Click to browse or drag a file here',\n dropPrompt: 'Drop to upload',\n remove: 'Remove file',\n invalidType: (fileName) => `${fileName}: unsupported file type.`,\n tooLarge: (fileName, maxSizeLabel) => `${fileName}: exceeds ${maxSizeLabel}.`,\n}\n\nfunction UploadIcon() {\n return (\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M12 15V4m0 0L8 8m4-4l4 4\"\n stroke=\"currentColor\"\n strokeWidth=\"1.6\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M4 15v2.5A2.5 2.5 0 006.5 20h11a2.5 2.5 0 002.5-2.5V15\"\n stroke=\"currentColor\"\n strokeWidth=\"1.6\"\n strokeLinecap=\"round\"\n />\n </svg>\n )\n}\n\nfunction FileIcon() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M9 1.5H4.5A1.5 1.5 0 003 3v10A1.5 1.5 0 004.5 14.5h7A1.5 1.5 0 0013 13V5.5L9 1.5z\"\n stroke=\"currentColor\"\n strokeWidth=\"1.3\"\n strokeLinejoin=\"round\"\n />\n <path d=\"M9 1.5v4h4\" stroke=\"currentColor\" strokeWidth=\"1.3\" strokeLinejoin=\"round\" />\n </svg>\n )\n}\n\nfunction RemoveIcon() {\n return (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M4 4l6 6M10 4l-6 6\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n )\n}\n\nexport const FileUpload = forwardRef<HTMLInputElement, FileUploadProps>(\n function FileUpload(\n {\n files,\n onFilesChange,\n variant = 'dropzone',\n size = 'md',\n accept,\n multiple = false,\n maxFiles,\n maxSize,\n hint,\n error,\n isInvalid = false,\n disabled = false,\n icon,\n onReject,\n labels,\n id,\n className,\n testId,\n },\n ref\n ) {\n const inputRef = useRef<HTMLInputElement>(null)\n const [isDragOver, setIsDragOver] = useState(false)\n const [rejections, setRejections] = useState<FileRejection[]>([])\n\n const text = { ...defaultLabels, ...labels }\n const hasError = isInvalid || Boolean(error) || rejections.length > 0\n\n const handleIncoming = useCallback(\n (incoming: FileList | null) => {\n if (!incoming || incoming.length === 0) return\n\n const { accepted, rejected } = selectFiles(Array.from(incoming), {\n accept,\n maxSize,\n multiple,\n maxFiles,\n current: files,\n })\n\n setRejections(rejected)\n if (rejected.length > 0) onReject?.(rejected)\n if (accepted.length > 0 || rejected.length === 0) onFilesChange(accepted)\n },\n [accept, files, maxFiles, maxSize, multiple, onFilesChange, onReject]\n )\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n handleIncoming(event.target.files)\n // Reset so picking the same file twice still fires a change event.\n event.target.value = ''\n },\n [handleIncoming]\n )\n\n const openPicker = useCallback(() => {\n if (!disabled) inputRef.current?.click()\n }, [disabled])\n\n const handleRemove = useCallback(\n (index: number) => {\n setRejections([])\n onFilesChange(files.filter((_, i) => i !== index))\n },\n [files, onFilesChange]\n )\n\n const handleDragOver = useCallback(\n (event: DragEvent<HTMLElement>) => {\n event.preventDefault()\n if (!disabled) setIsDragOver(true)\n },\n [disabled]\n )\n\n const handleDragLeave = useCallback((event: DragEvent<HTMLElement>) => {\n event.preventDefault()\n setIsDragOver(false)\n }, [])\n\n const handleDrop = useCallback(\n (event: DragEvent<HTMLElement>) => {\n event.preventDefault()\n setIsDragOver(false)\n if (!disabled) handleIncoming(event.dataTransfer.files)\n },\n [disabled, handleIncoming]\n )\n\n const maxSizeLabel = maxSize === undefined ? '' : formatBytes(maxSize)\n const rejectionMessages = rejections.map(({ file, reason }) =>\n reason === 'type'\n ? text.invalidType(file.name)\n : text.tooLarge(file.name, maxSizeLabel)\n )\n\n const fileList =\n files.length > 0 ? (\n <ul className=\"brycks-file-upload__files\">\n {files.map((file, index) => (\n <li key={`${file.name}-${file.size}-${index}`} className=\"brycks-file-upload__file\">\n <span className=\"brycks-file-upload__file-icon\">\n <FileIcon />\n </span>\n <span className=\"brycks-file-upload__file-text\">\n <span className=\"brycks-file-upload__file-name\" title={file.name}>\n {file.name}\n </span>\n <span className=\"brycks-file-upload__file-size\">{formatBytes(file.size)}</span>\n </span>\n <button\n type=\"button\"\n className=\"brycks-file-upload__remove\"\n onClick={() => handleRemove(index)}\n disabled={disabled}\n aria-label={`${text.remove}: ${file.name}`}\n >\n <RemoveIcon />\n </button>\n </li>\n ))}\n </ul>\n ) : null\n\n return (\n <div\n className={cx(\n 'brycks-file-upload',\n `brycks-file-upload--${variant}`,\n `brycks-file-upload--${size}`,\n className\n )}\n >\n {variant === 'dropzone' ? (\n <>\n <button\n type=\"button\"\n className=\"brycks-file-upload__dropzone\"\n onClick={openPicker}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n disabled={disabled}\n aria-disabled={disabled}\n aria-invalid={hasError || undefined}\n data-drag-over={isDragOver}\n data-invalid={hasError}\n >\n <span className=\"brycks-file-upload__icon\">{icon ?? <UploadIcon />}</span>\n <span className=\"brycks-file-upload__prompt\">\n {isDragOver ? text.dropPrompt : text.prompt}\n </span>\n {hint ? <span className=\"brycks-file-upload__hint\">{hint}</span> : null}\n </button>\n {fileList}\n </>\n ) : (\n <>\n <div\n className=\"brycks-file-upload__compact\"\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n >\n <button\n type=\"button\"\n className=\"brycks-file-upload__trigger\"\n onClick={openPicker}\n disabled={disabled}\n aria-invalid={hasError || undefined}\n data-drag-over={isDragOver}\n >\n <UploadIcon />\n {text.trigger}\n </button>\n {fileList ?? (\n <span className=\"brycks-file-upload__placeholder\">{text.placeholder}</span>\n )}\n </div>\n {hint ? <span className=\"brycks-file-upload__hint\">{hint}</span> : null}\n </>\n )}\n\n {rejectionMessages.map((message) => (\n <span key={message} className=\"brycks-file-upload__error\" role=\"alert\">\n {message}\n </span>\n ))}\n {error ? (\n <span className=\"brycks-file-upload__error\" role=\"alert\">\n {error}\n </span>\n ) : null}\n\n <input\n ref={(node) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n }}\n id={id}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={handleChange}\n style={{ display: 'none' }}\n tabIndex={-1}\n data-testid={testId}\n />\n </div>\n )\n }\n)\n\nFileUpload.displayName = 'FileUpload'\n"],"names":["defaultLabels","fileName","maxSizeLabel","UploadIcon","jsxs","jsx","FileIcon","RemoveIcon","FileUpload","forwardRef","files","onFilesChange","variant","size","accept","multiple","maxFiles","maxSize","hint","error","isInvalid","disabled","icon","onReject","labels","id","className","testId","ref","inputRef","useRef","isDragOver","setIsDragOver","useState","rejections","setRejections","text","hasError","handleIncoming","useCallback","incoming","accepted","rejected","selectFiles","handleChange","event","openPicker","handleRemove","index","_","handleDragOver","handleDragLeave","handleDrop","formatBytes","rejectionMessages","file","reason","fileList","cx","Fragment","message","node"],"mappings":";;;;AAwCA,MAAMA,IAA4C;AAAA,EAChD,SAAS;AAAA,EACT,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,aAAa,CAACC,MAAa,GAAGA,CAAQ;AAAA,EACtC,UAAU,CAACA,GAAUC,MAAiB,GAAGD,CAAQ,aAAaC,CAAY;AAC5E;AAEA,SAASC,IAAa;AACpB,SACE,gBAAAC,EAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACtE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,GAAE;AAAA,QACF,QAAO;AAAA,QACP,aAAY;AAAA,QACZ,eAAc;AAAA,QACd,gBAAe;AAAA,MAAA;AAAA,IAAA;AAAA,IAEjB,gBAAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,GAAE;AAAA,QACF,QAAO;AAAA,QACP,aAAY;AAAA,QACZ,eAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAChB,GACF;AAEJ;AAEA,SAASC,IAAW;AAClB,SACE,gBAAAF,EAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACtE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAAC;AAAA,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AU,mCAAmC,YAAK,YAAA,CAAY;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,YAGvEa,IAAO,gBAAAb,EAAC,QAAA,EAAK,WAAU,4BAA4B,aAAK,IAAU;AAAA,UAAA,GACrE;AAAA,UAGDiD,EAAkB,IAAI,CAACM,MACtB,gBAAAvD,EAAC,QAAA,EAAmB,WAAU,6BAA4B,MAAK,SAC5D,UAAAuD,EAAA,GADQA,CAEX,CACD;AAAA,UACAzC,sBACE,QAAA,EAAK,WAAU,6BAA4B,MAAK,SAC9C,aACH,IACE;AAAA,UAEJ,gBAAAd;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK,CAACwD,MAAS;AACb,gBAAAhC,EAAS,UAAUgC,GACf,OAAOjC,KAAQ,aAAYA,EAAIiC,CAAI,IAC9BjC,QAAS,UAAUiC;AAAA,cAC9B;AAAA,cACA,IAAApC;AAAA,cACA,MAAK;AAAA,cACL,QAAAX;AAAA,cACA,UAAAC;AAAA,cACA,UAAAM;AAAA,cACA,UAAUuB;AAAA,cACV,OAAO,EAAE,SAAS,OAAA;AAAA,cAClB,UAAU;AAAA,cACV,eAAajB;AAAA,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAnB,GAAW,cAAc;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=["B","KB","MB","GB"];function h(t){if(!Number.isFinite(t)||t<=0)return"0 B";const n=Math.min(Math.floor(Math.log(t)/Math.log(1024)),l.length-1),o=t/1024**n,s=n===0||o>=100?0:1;return`${o.toFixed(s)} ${l[n]}`}function f(t,n){if(!n)return!0;const o=n.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean);if(o.length===0)return!0;const s=t.type.toLowerCase(),c=t.name.toLowerCase();return o.some(e=>e.startsWith(".")?c.endsWith(e):e.endsWith("/*")?s.startsWith(e.slice(0,-1)):s===e)}function d(t,{accept:n,maxSize:o,multiple:s=!1,current:c=[],maxFiles:e}){const u=[],i=[];for(const r of t){if(!f(r,n)){i.push({file:r,reason:"type"});continue}if(o!==void 0&&r.size>o){i.push({file:r,reason:"size"});continue}u.push(r)}if(!s)return{accepted:u.slice(0,1),rejected:i};const a=[...c,...u];return{accepted:e===void 0?a:a.slice(0,e),rejected:i}}exports.formatBytes=h;exports.matchesAccept=f;exports.selectFiles=d;
2
+ //# sourceMappingURL=fileUpload.utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileUpload.utils.cjs","sources":["../../../../src/components/form/FileUpload/fileUpload.utils.ts"],"sourcesContent":["/**\n * FileUpload — pure helpers\n *\n * Framework-free selection logic so it can be reasoned about and tested\n * without rendering anything.\n */\n\nconst BYTE_UNITS = ['B', 'KB', 'MB', 'GB'] as const\n\n/** Human-readable file size, e.g. `1.4 MB`. */\nexport function formatBytes(bytes: number): string {\n if (!Number.isFinite(bytes) || bytes <= 0) return '0 B'\n\n const exponent = Math.min(\n Math.floor(Math.log(bytes) / Math.log(1024)),\n BYTE_UNITS.length - 1\n )\n const value = bytes / 1024 ** exponent\n const decimals = exponent === 0 || value >= 100 ? 0 : 1\n\n return `${value.toFixed(decimals)} ${BYTE_UNITS[exponent]}`\n}\n\n/**\n * Whether a file satisfies an `accept` string, using the same rules browsers\n * apply: bare extensions (`.pfx`), exact MIME types (`application/pdf`) and\n * wildcard MIME groups (`image/*`).\n */\nexport function matchesAccept(file: File, accept?: string): boolean {\n if (!accept) return true\n\n const patterns = accept\n .split(',')\n .map((pattern) => pattern.trim().toLowerCase())\n .filter(Boolean)\n\n if (patterns.length === 0) return true\n\n const type = file.type.toLowerCase()\n const name = file.name.toLowerCase()\n\n return patterns.some((pattern) => {\n if (pattern.startsWith('.')) return name.endsWith(pattern)\n if (pattern.endsWith('/*')) return type.startsWith(pattern.slice(0, -1))\n return type === pattern\n })\n}\n\n/** Why a file was refused. */\nexport type FileRejectionReason = 'type' | 'size'\n\nexport interface FileRejection {\n file: File\n reason: FileRejectionReason\n}\n\nexport interface FileSelectionResult {\n accepted: File[]\n rejected: FileRejection[]\n}\n\nexport interface FileSelectionRules {\n accept?: string\n maxSize?: number\n multiple?: boolean\n /** Files already selected — used to enforce `maxFiles` and to append. */\n current?: File[]\n maxFiles?: number\n}\n\n/**\n * Split incoming files into accepted and rejected, applying `accept`,\n * `maxSize`, `multiple` and `maxFiles`.\n *\n * Rejections are returned rather than dropped so the UI can explain what\n * happened instead of silently ignoring the file.\n */\nexport function selectFiles(\n incoming: File[],\n { accept, maxSize, multiple = false, current = [], maxFiles }: FileSelectionRules\n): FileSelectionResult {\n const accepted: File[] = []\n const rejected: FileRejection[] = []\n\n for (const file of incoming) {\n if (!matchesAccept(file, accept)) {\n rejected.push({ file, reason: 'type' })\n continue\n }\n if (maxSize !== undefined && file.size > maxSize) {\n rejected.push({ file, reason: 'size' })\n continue\n }\n accepted.push(file)\n }\n\n if (!multiple) {\n return { accepted: accepted.slice(0, 1), rejected }\n }\n\n const merged = [...current, ...accepted]\n return {\n accepted: maxFiles === undefined ? merged : merged.slice(0, maxFiles),\n rejected,\n }\n}\n"],"names":["BYTE_UNITS","formatBytes","bytes","exponent","value","decimals","matchesAccept","file","accept","patterns","pattern","type","name","selectFiles","incoming","maxSize","multiple","current","maxFiles","accepted","rejected","merged"],"mappings":"gFAOA,MAAMA,EAAa,CAAC,IAAK,KAAM,KAAM,IAAI,EAGlC,SAASC,EAAYC,EAAuB,CACjD,GAAI,CAAC,OAAO,SAASA,CAAK,GAAKA,GAAS,EAAG,MAAO,MAElD,MAAMC,EAAW,KAAK,IACpB,KAAK,MAAM,KAAK,IAAID,CAAK,EAAI,KAAK,IAAI,IAAI,CAAC,EAC3CF,EAAW,OAAS,CAAA,EAEhBI,EAAQF,EAAQ,MAAQC,EACxBE,EAAWF,IAAa,GAAKC,GAAS,IAAM,EAAI,EAEtD,MAAO,GAAGA,EAAM,QAAQC,CAAQ,CAAC,IAAIL,EAAWG,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ite(t) || t <= 0) return "0 B";
4
+ const n = Math.min(
5
+ Math.floor(Math.log(t) / Math.log(1024)),
6
+ f.length - 1
7
+ ), o = t / 1024 ** n, s = n === 0 || o >= 100 ? 0 : 1;
8
+ return `${o.toFixed(s)} ${f[n]}`;
9
+ }
10
+ function l(t, n) {
11
+ if (!n) return !0;
12
+ const o = n.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean);
13
+ if (o.length === 0) return !0;
14
+ const s = t.type.toLowerCase(), c = t.name.toLowerCase();
15
+ return o.some((e) => e.startsWith(".") ? c.endsWith(e) : e.endsWith("/*") ? s.startsWith(e.slice(0, -1)) : s === e);
16
+ }
17
+ function d(t, { accept: n, maxSize: o, multiple: s = !1, current: c = [], maxFiles: e }) {
18
+ const u = [], i = [];
19
+ for (const r of t) {
20
+ if (!l(r, n)) {
21
+ i.push({ file: r, reason: "type" });
22
+ continue;
23
+ }
24
+ if (o !== void 0 && r.size > o) {
25
+ i.push({ file: r, reason: "size" });
26
+ continue;
27
+ }
28
+ u.push(r);
29
+ }
30
+ if (!s)
31
+ return { accepted: u.slice(0, 1), rejected: i };
32
+ const a = [...c, ...u];
33
+ return {
34
+ accepted: e === void 0 ? a : a.slice(0, e),
35
+ rejected: i
36
+ };
37
+ }
38
+ export {
39
+ h as formatBytes,
40
+ l as matchesAccept,
41
+ d as selectFiles
42
+ };
43
+ //# sourceMappingURL=fileUpload.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileUpload.utils.js","sources":["../../../../src/components/form/FileUpload/fileUpload.utils.ts"],"sourcesContent":["/**\n * FileUpload — pure helpers\n *\n * Framework-free selection logic so it can be reasoned about and tested\n * without rendering anything.\n */\n\nconst BYTE_UNITS = ['B', 'KB', 'MB', 'GB'] as const\n\n/** Human-readable file size, e.g. `1.4 MB`. */\nexport function formatBytes(bytes: number): string {\n if (!Number.isFinite(bytes) || bytes <= 0) return '0 B'\n\n const exponent = Math.min(\n Math.floor(Math.log(bytes) / Math.log(1024)),\n BYTE_UNITS.length - 1\n )\n const value = bytes / 1024 ** exponent\n const decimals = exponent === 0 || value >= 100 ? 0 : 1\n\n return `${value.toFixed(decimals)} ${BYTE_UNITS[exponent]}`\n}\n\n/**\n * Whether a file satisfies an `accept` string, using the same rules browsers\n * apply: bare extensions (`.pfx`), exact MIME types (`application/pdf`) and\n * wildcard MIME groups (`image/*`).\n */\nexport function matchesAccept(file: File, accept?: string): boolean {\n if (!accept) return true\n\n const patterns = accept\n .split(',')\n .map((pattern) => pattern.trim().toLowerCase())\n .filter(Boolean)\n\n if (patterns.length === 0) return true\n\n const type = file.type.toLowerCase()\n const name = file.name.toLowerCase()\n\n return patterns.some((pattern) => {\n if (pattern.startsWith('.')) return name.endsWith(pattern)\n if (pattern.endsWith('/*')) return type.startsWith(pattern.slice(0, -1))\n return type === pattern\n })\n}\n\n/** Why a file was refused. */\nexport type FileRejectionReason = 'type' | 'size'\n\nexport interface FileRejection {\n file: File\n reason: FileRejectionReason\n}\n\nexport interface FileSelectionResult {\n accepted: File[]\n rejected: FileRejection[]\n}\n\nexport interface FileSelectionRules {\n accept?: string\n maxSize?: number\n multiple?: boolean\n /** Files already selected — used to enforce `maxFiles` and to append. */\n current?: File[]\n maxFiles?: number\n}\n\n/**\n * Split incoming files into accepted and rejected, applying `accept`,\n * `maxSize`, `multiple` and `maxFiles`.\n *\n * Rejections are returned rather than dropped so the UI can explain what\n * happened instead of silently ignoring the file.\n */\nexport function selectFiles(\n incoming: File[],\n { accept, maxSize, multiple = false, current = [], maxFiles }: FileSelectionRules\n): FileSelectionResult {\n const accepted: File[] = []\n const rejected: FileRejection[] = []\n\n for (const file of incoming) {\n if (!matchesAccept(file, accept)) {\n rejected.push({ file, reason: 'type' })\n continue\n }\n if (maxSize !== undefined && file.size > maxSize) {\n rejected.push({ file, reason: 'size' })\n continue\n }\n accepted.push(file)\n }\n\n if (!multiple) {\n return { accepted: accepted.slice(0, 1), rejected }\n }\n\n const merged = [...current, ...accepted]\n return {\n accepted: maxFiles === undefined ? merged : merged.slice(0, maxFiles),\n rejected,\n }\n}\n"],"names":["BYTE_UNITS","formatBytes","bytes","exponent","value","decimals","matchesAccept","file","accept","patterns","pattern","type","name","selectFiles","incoming","maxSize","multiple","current","maxFiles","accepted","rejected","merged"],"mappings":"AAOA,MAAMA,IAAa,CAAC,KAAK,MAAM,MAAM,IAAI;AAGlC,SAASC,EAAYC,GAAuB;AACjD,MAAI,CAAC,OAAO,SAASA,CAAK,KAAKA,KAAS,EAAG,QAAO;AAElD,QAAMC,IAAW,KAAK;AAAA,IACpB,KAAK,MAAM,KAAK,IAAID,CAAK,IAAI,KAAK,IAAI,IAAI,CAAC;AAAA,IAC3CF,EAAW,SAAS;AAAA,EAAA,GAEhBI,IAAQF,IAAQ,QAAQC,GACxBE,IAAWF,MAAa,KAAKC,KAAS,MAAM,IAAI;AAEtD,SAAO,GAAGA,EAAM,QAAQC,CAAQ,CAAC,IAAIL,EAAWG,CAAQ,CAAC;AAC3D;AAOO,SAASG,EAAcC,GAAYC,GAA0B;AAClE,MAAI,CAACA,EAAQ,QAAO;AAEpB,QAAMC,IAAWD,EACd,MAAM,GAAG,EACT,IAAI,CAACE,MAAYA,EAAQ,OAAO,YAAA,CAAa,EAC7C,OAAO,OAAO;AAEjB,MAAID,EAAS,WAAW,EAAG,QAAO;AAElC,QAAME,IAAOJ,EAAK,KAAK,YAAA,GACjBK,IAAOL,EAAK,KAAK,YAAA;AAEvB,SAAOE,EAAS,KAAK,CAACC,MAChBA,EAAQ,WAAW,GAAG,IAAUE,EAAK,SAASF,CAAO,IACrDA,EAAQ,SAAS,IAAI,IAAUC,EAAK,WAAWD,EAAQ,MAAM,GAAG,EAAE,CAAC,IAChEC,MAASD,CACjB;AACH;AA+BO,SAASG,EACdC,GACA,EAAE,QAAAN,GAAQ,SAAAO,GAAS,UAAAC,IAAW,IAAO,SAAAC,IAAU,IAAI,UAAAC,KAC9B;AACrB,QAAMC,IAAmB,CAAA,GACnBC,IAA4B,CAAA;AAElC,aAAWb,KAAQO,GAAU;AAC3B,QAAI,CAACR,EAAcC,GAAMC,CAAM,GAAG;AAChC,MAAAY,EAAS,KAAK,EAAE,MAAAb,GAAM,QAAQ,QAAQ;AACtC;AAAA,IACF;AACA,QAAIQ,MAAY,UAAaR,EAAK,OAAOQ,GAAS;AAChD,MAAAK,EAAS,KAAK,EAAE,MAAAb,GAAM,QAAQ,QAAQ;AACtC;AAAA,IACF;AACA,IAAAY,EAAS,KAAKZ,CAAI;AAAA,EACpB;AAEA,MAAI,CAACS;AACH,WAAO,EAAE,UAAUG,EAAS,MAAM,GAAG,CAAC,GAAG,UAAAC,EAAA;AAG3C,QAAMC,IAAS,CAAC,GAAGJ,GAAS,GAAGE,CAAQ;AACvC,SAAO;AAAA,IACL,UAAUD,MAAa,SAAYG,IAASA,EAAO,MAAM,GAAGH,CAAQ;AAAA,IACpE,UAAAE;AAAA,EAAA;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),v=require("../../../utils/styles.cjs"),G=require("../FormLabel/FormLabel.cjs"),s=require("../../../design-system/tokens/spacing.cjs"),N={none:0,xs:s.spacing[.5],sm:s.spacing[1],md:s.spacing[1.5]},i=a.forwardRef(function({label:o,fieldId:l,labelSize:m="md",required:u,disabled:c,description:p,error:r,helperText:t,gap:d="sm",children:g,className:y,style:f,testId:b,...x},h){const k=a.useId(),F=l||k,S={display:"flex",flexDirection:"column",gap:N[d],...f},n={fontSize:"0.75rem",lineHeight:1.4,marginTop:s.spacing[.5]},j={...n,color:"var(--brycks-error-default)"},q={...n,color:"var(--brycks-foreground-muted)"};return e.jsxs("div",{ref:h,className:v.cx("brycks-form-group",!!r&&"brycks-form-group--error",!!c&&"brycks-form-group--disabled",y),style:S,"data-testid":b,...x,children:[o&&e.jsx(G.FormLabel,{htmlFor:F,size:m,required:u,disabled:c,description:p,children:o}),g,r&&e.jsx("span",{className:"brycks-form-group__error",style:j,role:"alert",children:r}),!r&&t&&e.jsx("span",{className:"brycks-form-group__helper",style:q,children:t})]})});i.displayName="FormGroup";exports.FormGroup=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),v=require("../../../utils/styles.cjs"),s=require("../../../design-system/tokens/spacing.cjs"),G=require("../FormLabel/FormLabel.cjs"),N={none:0,xs:s.spacing[.5],sm:s.spacing[1],md:s.spacing[1.5]},i=a.forwardRef(function({label:o,fieldId:l,labelSize:m="md",required:u,disabled:c,description:p,error:r,helperText:t,gap:d="sm",children:g,className:y,style:f,testId:b,...x},h){const k=a.useId(),F=l||k,S={display:"flex",flexDirection:"column",gap:N[d],...f},n={fontSize:"0.75rem",lineHeight:1.4,marginTop:s.spacing[.5]},j={...n,color:"var(--brycks-error-default)"},q={...n,color:"var(--brycks-foreground-muted)"};return e.jsxs("div",{ref:h,className:v.cx("brycks-form-group",!!r&&"brycks-form-group--error",!!c&&"brycks-form-group--disabled",y),style:S,"data-testid":b,...x,children:[o&&e.jsx(G.FormLabel,{htmlFor:F,size:m,required:u,disabled:c,description:p,children:o}),g,r&&e.jsx("span",{className:"brycks-form-group__error",style:j,role:"alert",children:r}),!r&&t&&e.jsx("span",{className:"brycks-form-group__helper",style:q,children:t})]})});i.displayName="FormGroup";exports.FormGroup=i;
2
2
  //# sourceMappingURL=FormGroup.cjs.map
@@ -1,8 +1,8 @@
1
1
  import { jsxs as N, jsx as e } from "react/jsx-runtime";
2
2
  import { forwardRef as _, useId as v } from "react";
3
3
  import { cx as G } from "../../../utils/styles.js";
4
- import { FormLabel as j } from "../FormLabel/FormLabel.js";
5
4
  import { spacing as o } from "../../../design-system/tokens/spacing.js";
5
+ import { FormLabel as j } from "../FormLabel/FormLabel.js";
6
6
  const z = {
7
7
  none: 0,
8
8
  xs: o[0.5],
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("react"),J=require("../../../utils/styles.cjs"),m=require("../../../design-system/tokens/typography.cjs"),c=require("../../../design-system/tokens/motion.cjs"),l=require("../../../design-system/tokens/spacing.cjs"),z=require("../../../design-system/primitives/sizing.cjs"),Q={sm:{track:l.spacing[1],thumb:l.spacing[3.5],fontSize:m.fontSizes.sm},md:{track:z.componentGap.sm,thumb:l.spacing[4]+l.spacing[.5],fontSize:m.fontSizes.base},lg:{track:l.spacing[2],thumb:l.spacing[5]+l.spacing[.5],fontSize:m.fontSizes.md}},R=i.forwardRef(function({size:k="md",min:a=0,max:u=100,step:f=1,value:b,defaultValue:C=a,onChange:S,showValue:w=!1,formatValue:x=v=>String(v),label:p,disabled:d=!1,className:q,style:E,testId:M,...I},g){const[v,O]=i.useState(C),[y,h]=i.useState(!1),[A,D]=i.useState(!1),$=i.useRef(null),s=b??v,t=Q[k],j=(s-a)/(u-a)*100,r=i.useCallback(e=>{const n=Math.max(a,Math.min(u,e));b===void 0&&O(n),S?.(n)},[b,a,u,S]);i.useEffect(()=>{const e=$.current;if(!e)return;const n=V=>{const B=V.target;r(parseFloat(B.value))};return e.addEventListener("input",n),()=>e.removeEventListener("input",n)},[r]);const L=i.useCallback(e=>{const n=e.shiftKey?f*10:f;switch(e.key){case"ArrowRight":case"ArrowUp":e.preventDefault(),r(s+n);break;case"ArrowLeft":case"ArrowDown":e.preventDefault(),r(s-n);break;case"Home":e.preventDefault(),r(a);break;case"End":e.preventDefault(),r(u);break;case"PageUp":e.preventDefault(),r(s+n*10);break;case"PageDown":e.preventDefault(),r(s-n*10);break}},[s,f,a,u,r]),H={display:"flex",flexDirection:"column",gap:l.spacing[2],opacity:d?.5:1,...E},K={display:"flex",alignItems:"center",justifyContent:"space-between",gap:z.componentGap.xl},N={fontSize:t.fontSize,fontWeight:500,color:"var(--brycks-foreground-default)"},P={fontSize:t.fontSize,fontWeight:500,color:"var(--brycks-foreground-muted)",fontVariantNumeric:"tabular-nums"},T={position:"relative",display:"flex",alignItems:"center",height:t.thumb,cursor:d?"not-allowed":"pointer"},U={position:"absolute",width:"100%",height:t.track,borderRadius:t.track/2,backgroundColor:"var(--brycks-background-muted)"},G={position:"absolute",left:0,height:t.track,width:`${j}%`,borderRadius:t.track/2,backgroundColor:d?"var(--brycks-foreground-muted)":"var(--brycks-primary-default)",transition:y?"none":`width ${c.durations.fast}ms ${c.easings.easeOut}`},W={position:"absolute",left:`calc(${j}% - ${t.thumb/2}px)`,width:t.thumb,height:t.thumb,borderRadius:"50%",backgroundColor:"white",border:`2px solid ${d?"var(--brycks-foreground-muted)":"var(--brycks-primary-default)"}`,boxShadow:y||A?"var(--brycks-shadow-md)":"var(--brycks-shadow-sm)",transform:y?"scale(1.1)":"scale(1)",transition:y?`transform ${c.durations.fast}ms ${c.easings.easeOut}, box-shadow ${c.durations.fast}ms ${c.easings.easeOut}`:`all ${c.durations.fast}ms ${c.easings.easeOut}`,pointerEvents:"none"},F={position:"absolute",width:"100%",height:t.thumb,margin:0,padding:0,opacity:0,cursor:d?"not-allowed":"pointer"};return o.jsxs("div",{className:J.cx("brycks-slider",`brycks-slider--${k}`,q),style:H,children:[(p||w)&&o.jsxs("div",{style:K,children:[p&&o.jsx("span",{style:N,children:p}),w&&o.jsx("span",{style:P,children:x(s)})]}),o.jsxs("div",{style:T,onMouseEnter:()=>D(!0),onMouseLeave:()=>D(!1),children:[o.jsx("div",{style:U}),o.jsx("div",{style:G}),o.jsx("div",{style:W}),o.jsx("input",{ref:e=>{$.current=e,typeof g=="function"?g(e):g&&(g.current=e)},type:"range",role:"slider","aria-valuemin":a,"aria-valuemax":u,"aria-valuenow":s,"aria-valuetext":x(s),"aria-label":p,min:a,max:u,step:f,value:s,disabled:d,style:F,onKeyDown:L,onMouseDown:()=>h(!0),onMouseUp:()=>h(!1),onTouchStart:()=>h(!0),onTouchEnd:()=>h(!1),"data-testid":M,...I})]})]})});R.displayName="Slider";exports.Slider=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("react"),J=require("../../../utils/styles.cjs"),l=require("../../../design-system/tokens/spacing.cjs"),z=require("../../../design-system/primitives/sizing.cjs"),m=require("../../../design-system/tokens/typography.cjs"),c=require("../../../design-system/tokens/motion.cjs"),Q={sm:{track:l.spacing[1],thumb:l.spacing[3.5],fontSize:m.fontSizes.sm},md:{track:z.componentGap.sm,thumb:l.spacing[4]+l.spacing[.5],fontSize:m.fontSizes.base},lg:{track:l.spacing[2],thumb:l.spacing[5]+l.spacing[.5],fontSize:m.fontSizes.md}},R=i.forwardRef(function({size:k="md",min:a=0,max:u=100,step:f=1,value:b,defaultValue:C=a,onChange:S,showValue:w=!1,formatValue:x=v=>String(v),label:p,disabled:d=!1,className:q,style:E,testId:M,...I},g){const[v,O]=i.useState(C),[y,h]=i.useState(!1),[A,D]=i.useState(!1),$=i.useRef(null),s=b??v,t=Q[k],j=(s-a)/(u-a)*100,r=i.useCallback(e=>{const n=Math.max(a,Math.min(u,e));b===void 0&&O(n),S?.(n)},[b,a,u,S]);i.useEffect(()=>{const e=$.current;if(!e)return;const n=V=>{const B=V.target;r(parseFloat(B.value))};return e.addEventListener("input",n),()=>e.removeEventListener("input",n)},[r]);const L=i.useCallback(e=>{const n=e.shiftKey?f*10:f;switch(e.key){case"ArrowRight":case"ArrowUp":e.preventDefault(),r(s+n);break;case"ArrowLeft":case"ArrowDown":e.preventDefault(),r(s-n);break;case"Home":e.preventDefault(),r(a);break;case"End":e.preventDefault(),r(u);break;case"PageUp":e.preventDefault(),r(s+n*10);break;case"PageDown":e.preventDefault(),r(s-n*10);break}},[s,f,a,u,r]),H={display:"flex",flexDirection:"column",gap:l.spacing[2],opacity:d?.5:1,...E},K={display:"flex",alignItems:"center",justifyContent:"space-between",gap:z.componentGap.xl},N={fontSize:t.fontSize,fontWeight:500,color:"var(--brycks-foreground-default)"},P={fontSize:t.fontSize,fontWeight:500,color:"var(--brycks-foreground-muted)",fontVariantNumeric:"tabular-nums"},T={position:"relative",display:"flex",alignItems:"center",height:t.thumb,cursor:d?"not-allowed":"pointer"},U={position:"absolute",width:"100%",height:t.track,borderRadius:t.track/2,backgroundColor:"var(--brycks-background-muted)"},G={position:"absolute",left:0,height:t.track,width:`${j}%`,borderRadius:t.track/2,backgroundColor:d?"var(--brycks-foreground-muted)":"var(--brycks-primary-default)",transition:y?"none":`width ${c.durations.fast}ms ${c.easings.easeOut}`},W={position:"absolute",left:`calc(${j}% - ${t.thumb/2}px)`,width:t.thumb,height:t.thumb,borderRadius:"50%",backgroundColor:"white",border:`2px solid ${d?"var(--brycks-foreground-muted)":"var(--brycks-primary-default)"}`,boxShadow:y||A?"var(--brycks-shadow-md)":"var(--brycks-shadow-sm)",transform:y?"scale(1.1)":"scale(1)",transition:y?`transform ${c.durations.fast}ms ${c.easings.easeOut}, box-shadow ${c.durations.fast}ms ${c.easings.easeOut}`:`all ${c.durations.fast}ms ${c.easings.easeOut}`,pointerEvents:"none"},F={position:"absolute",width:"100%",height:t.thumb,margin:0,padding:0,opacity:0,cursor:d?"not-allowed":"pointer"};return o.jsxs("div",{className:J.cx("brycks-slider",`brycks-slider--${k}`,q),style:H,children:[(p||w)&&o.jsxs("div",{style:K,children:[p&&o.jsx("span",{style:N,children:p}),w&&o.jsx("span",{style:P,children:x(s)})]}),o.jsxs("div",{style:T,onMouseEnter:()=>D(!0),onMouseLeave:()=>D(!1),children:[o.jsx("div",{style:U}),o.jsx("div",{style:G}),o.jsx("div",{style:W}),o.jsx("input",{ref:e=>{$.current=e,typeof g=="function"?g(e):g&&(g.current=e)},type:"range",role:"slider","aria-valuemin":a,"aria-valuemax":u,"aria-valuenow":s,"aria-valuetext":x(s),"aria-label":p,min:a,max:u,step:f,value:s,disabled:d,style:F,onKeyDown:L,onMouseDown:()=>h(!0),onMouseUp:()=>h(!1),onTouchStart:()=>h(!0),onTouchEnd:()=>h(!1),"data-testid":M,...I})]})]})});R.displayName="Slider";exports.Slider=R;
2
2
  //# sourceMappingURL=Slider.cjs.map
@@ -1,10 +1,10 @@
1
1
  import { jsxs as v, jsx as c } from "react/jsx-runtime";
2
2
  import { forwardRef as X, useState as k, useRef as Y, useCallback as E, useEffect as Z } from "react";
3
3
  import { cx as _ } from "../../../utils/styles.js";
4
- import { fontSizes as w } from "../../../design-system/tokens/typography.js";
5
- import { durations as m, easings as y } from "../../../design-system/tokens/motion.js";
6
4
  import { spacing as s } from "../../../design-system/tokens/spacing.js";
7
5
  import { componentGap as I } from "../../../design-system/primitives/sizing.js";
6
+ import { fontSizes as w } from "../../../design-system/tokens/typography.js";
7
+ import { durations as m, easings as y } from "../../../design-system/tokens/motion.js";
8
8
  const ee = {
9
9
  sm: { track: s[1], thumb: s[3.5], fontSize: w.sm },
10
10
  md: { track: I.sm, thumb: s[4] + s[0.5], fontSize: w.base },
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),de=require("../../../utils/styles.cjs"),g=require("../../../design-system/primitives/sizing.cjs"),b=require("../../../design-system/tokens/motion.cjs"),n=require("../../../design-system/tokens/spacing.cjs"),j=require("../../../design-system/tokens/typography.cjs"),ge={sm:{height:g.componentHeights.sm,fontSize:j.fontSizes.base-1,tagHeight:n.spacing[5],padding:g.componentPaddingX.xs,gap:n.spacing[1]},md:{height:g.componentHeights.md,fontSize:j.fontSizes.base,tagHeight:n.spacing[6],padding:g.componentPaddingX.sm,gap:n.spacing[1.5]},lg:{height:g.componentHeights.lg,fontSize:j.fontSizes.md,tagHeight:n.spacing[7],padding:g.componentPaddingX.sm,gap:n.spacing[2]}};function pe(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M3 3l6 6M9 3l-6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}const N=o.forwardRef(function({value:w,defaultValue:G=[],onChange:T,placeholder:U="Add tags...",size:L="md",maxTags:C,allowDuplicates:M=!1,delimiters:q=["Enter",","],disabled:y=!1,isInvalid:D=!1,readOnly:P=!1,validateTag:E,transformTag:A=m=>m.trim(),suggestions:V,renderTag:B,maxTagsMessage:W=m=>`Maximum ${m} tags allowed`,duplicateMessage:F="Tag already exists","aria-label":Y="Tag input",className:J,testId:Q},z){const[m,Z]=o.useState(G),[p,k]=o.useState(""),[O,X]=o.useState(!1),[$,v]=o.useState(null),[f,c]=o.useState(!1),[S,h]=o.useState(-1),H=o.useRef(null),K=o.useRef(null),r=w!==void 0?w:m,i=ge[L],x=!y&&!P,u=V?.filter(e=>e.label.toLowerCase().includes(p.toLowerCase())&&!r.some(t=>t.id===e.id))||[],d=o.useCallback(e=>{w===void 0&&Z(e),T?.(e)},[w,T]),I=o.useCallback(e=>{const t=A(e);if(!t)return!1;if(C&&r.length>=C)return v(W(C)),!1;if(!M&&r.some(l=>l.label.toLowerCase()===t.toLowerCase()))return v(F),!1;if(E){const l=E(t);if(l!==!0)return v(typeof l=="string"?l:"Invalid tag"),!1}const s={id:`tag-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,label:t};return d([...r,s]),k(""),v(null),!0},[r,C,M,E,A,d,W,F]),R=o.useCallback(e=>{x&&d(r.filter(t=>t.id!==e))},[x,r,d]),_=o.useCallback(e=>{const t=e.target.value;if(t.includes(",")){const s=t.split(",");s.forEach((l,ue)=>{ue<s.length-1&&l.trim()&&I(l)}),k(s[s.length-1])}else k(t);v(null),c(!0),h(-1)},[I]),ee=o.useCallback(e=>{if(x){if(f&&u.length>0){if(e.key==="ArrowDown"){e.preventDefault(),h(t=>Math.min(t+1,u.length-1));return}if(e.key==="ArrowUp"){e.preventDefault(),h(t=>Math.max(t-1,0));return}if((e.key==="Enter"||e.key==="Tab")&&S>=0){e.preventDefault();const t=u[S];t&&(d([...r,t]),k(""),c(!1),h(-1));return}}if(q.includes(e.key)&&p){e.preventDefault(),I(p),c(!1);return}if(e.key==="Backspace"&&!p&&r.length>0){R(r[r.length-1].id);return}e.key==="Escape"&&(c(!1),h(-1))}},[x,f,u,S,q,p,r,I,R,d]);o.useEffect(()=>{if(!f)return;const e=t=>{K.current?.contains(t.target)||c(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[f]);const te={position:"relative",width:"100%"},ne={display:"flex",flexWrap:"wrap",alignItems:"center",gap:i.gap,minHeight:i.height,padding:`${n.spacing[1]}px ${i.padding}px`,backgroundColor:y?"var(--brycks-background-muted)":"var(--brycks-background-default)",border:`1px solid ${D||$?"var(--brycks-error-default)":O?"var(--brycks-primary-default)":"var(--brycks-border-default)"}`,borderRadius:"var(--brycks-radius-md)",transition:`all ${b.durations.fast}ms ${b.easings.easeOut}`,cursor:y?"not-allowed":"text",boxShadow:O?"var(--brycks-focus-ring)":void 0},re=e=>({display:"inline-flex",alignItems:"center",gap:n.spacing[1],height:i.tagHeight,padding:`0 ${n.spacing[2]}px`,fontSize:i.fontSize-1,fontWeight:500,color:e.color?"white":"var(--brycks-foreground-default)",backgroundColor:e.color||"var(--brycks-background-muted)",borderRadius:"var(--brycks-radius-full)",whiteSpace:"nowrap"}),oe={display:"flex",alignItems:"center",justifyContent:"center",width:n.spacing[4],height:n.spacing[4],marginLeft:n.spacing[.5],marginRight:-n.spacing[1],color:"inherit",opacity:.7,cursor:"pointer",borderRadius:"var(--brycks-radius-full)",transition:`all ${b.durations.fast}ms ${b.easings.easeOut}`},se={flex:1,minWidth:100,height:i.tagHeight,padding:0,fontSize:i.fontSize,color:"var(--brycks-foreground-default)",backgroundColor:"transparent",border:"none",outline:"none"},ae={position:"absolute",top:"100%",left:0,right:0,marginTop:n.spacing[1],maxHeight:200,overflowY:"auto",backgroundColor:"var(--brycks-background-elevated)",border:"1px solid var(--brycks-border-default)",borderRadius:"var(--brycks-radius-lg)",boxShadow:"var(--brycks-shadow-lg)",zIndex:"var(--brycks-z-dropdown)",padding:n.spacing[1]},ie=e=>({display:"flex",alignItems:"center",gap:g.componentGap.md,padding:`${n.spacing[2]}px ${n.spacing[3]}px`,fontSize:i.fontSize,color:"var(--brycks-foreground-default)",backgroundColor:e?"var(--brycks-background-muted)":"transparent",borderRadius:"var(--brycks-radius-md)",cursor:"pointer",transition:`background-color ${b.durations.fast}ms ${b.easings.easeOut}`}),le={marginTop:n.spacing[1],fontSize:j.fontSizes.sm,color:"var(--brycks-error-default)"},ce=(e,t)=>a.jsxs("span",{style:re(e),children:[e.label,x&&a.jsx("button",{type:"button","aria-label":`Remove ${e.label}`,style:oe,onClick:s=>{s.stopPropagation(),t()},onMouseEnter:s=>{s.currentTarget.style.opacity="1",s.currentTarget.style.backgroundColor="rgba(0,0,0,0.1)"},onMouseLeave:s=>{s.currentTarget.style.opacity="0.7",s.currentTarget.style.backgroundColor="transparent"},children:a.jsx(pe,{})})]},e.id);return a.jsxs("div",{ref:K,className:de.cx("brycks-tag-input",`brycks-tag-input--${L}`,J),style:te,"data-testid":Q,children:[a.jsxs("div",{style:ne,onClick:()=>!y&&H.current?.focus(),children:[r.map(e=>B?B(e,()=>R(e.id)):ce(e,()=>R(e.id))),a.jsx("input",{ref:e=>{H.current=e,typeof z=="function"?z(e):z&&(z.current=e)},type:"text",role:"combobox","aria-label":Y,"aria-expanded":f&&u.length>0,"aria-autocomplete":"list","aria-invalid":D||!!$,value:p,placeholder:r.length===0?U:"",disabled:y,readOnly:P,style:se,onChange:_,onKeyDown:ee,onFocus:()=>{X(!0),c(!0)},onBlur:()=>X(!1)})]}),f&&u.length>0&&a.jsx("ul",{role:"listbox",style:ae,children:u.map((e,t)=>a.jsx("li",{role:"option","aria-selected":t===S,style:ie(t===S),onClick:()=>{d([...r,e]),k(""),c(!1),H.current?.focus()},onMouseEnter:()=>h(t),children:e.label},e.id))}),$&&a.jsx("div",{style:le,children:$})]})});N.displayName="TagInput";exports.TagInput=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),de=require("../../../utils/styles.cjs"),b=require("../../../design-system/tokens/motion.cjs"),n=require("../../../design-system/tokens/spacing.cjs"),g=require("../../../design-system/primitives/sizing.cjs"),j=require("../../../design-system/tokens/typography.cjs"),ge={sm:{height:g.componentHeights.sm,fontSize:j.fontSizes.base-1,tagHeight:n.spacing[5],padding:g.componentPaddingX.xs,gap:n.spacing[1]},md:{height:g.componentHeights.md,fontSize:j.fontSizes.base,tagHeight:n.spacing[6],padding:g.componentPaddingX.sm,gap:n.spacing[1.5]},lg:{height:g.componentHeights.lg,fontSize:j.fontSizes.md,tagHeight:n.spacing[7],padding:g.componentPaddingX.sm,gap:n.spacing[2]}};function pe(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M3 3l6 6M9 3l-6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}const N=o.forwardRef(function({value:w,defaultValue:G=[],onChange:T,placeholder:U="Add tags...",size:L="md",maxTags:C,allowDuplicates:M=!1,delimiters:q=["Enter",","],disabled:y=!1,isInvalid:D=!1,readOnly:P=!1,validateTag:E,transformTag:A=m=>m.trim(),suggestions:V,renderTag:B,maxTagsMessage:W=m=>`Maximum ${m} tags allowed`,duplicateMessage:F="Tag already exists","aria-label":Y="Tag input",className:J,testId:Q},z){const[m,Z]=o.useState(G),[p,k]=o.useState(""),[O,X]=o.useState(!1),[$,v]=o.useState(null),[f,c]=o.useState(!1),[S,h]=o.useState(-1),H=o.useRef(null),K=o.useRef(null),r=w!==void 0?w:m,i=ge[L],x=!y&&!P,u=V?.filter(e=>e.label.toLowerCase().includes(p.toLowerCase())&&!r.some(t=>t.id===e.id))||[],d=o.useCallback(e=>{w===void 0&&Z(e),T?.(e)},[w,T]),I=o.useCallback(e=>{const t=A(e);if(!t)return!1;if(C&&r.length>=C)return v(W(C)),!1;if(!M&&r.some(l=>l.label.toLowerCase()===t.toLowerCase()))return v(F),!1;if(E){const l=E(t);if(l!==!0)return v(typeof l=="string"?l:"Invalid tag"),!1}const s={id:`tag-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,label:t};return d([...r,s]),k(""),v(null),!0},[r,C,M,E,A,d,W,F]),R=o.useCallback(e=>{x&&d(r.filter(t=>t.id!==e))},[x,r,d]),_=o.useCallback(e=>{const t=e.target.value;if(t.includes(",")){const s=t.split(",");s.forEach((l,ue)=>{ue<s.length-1&&l.trim()&&I(l)}),k(s[s.length-1])}else k(t);v(null),c(!0),h(-1)},[I]),ee=o.useCallback(e=>{if(x){if(f&&u.length>0){if(e.key==="ArrowDown"){e.preventDefault(),h(t=>Math.min(t+1,u.length-1));return}if(e.key==="ArrowUp"){e.preventDefault(),h(t=>Math.max(t-1,0));return}if((e.key==="Enter"||e.key==="Tab")&&S>=0){e.preventDefault();const t=u[S];t&&(d([...r,t]),k(""),c(!1),h(-1));return}}if(q.includes(e.key)&&p){e.preventDefault(),I(p),c(!1);return}if(e.key==="Backspace"&&!p&&r.length>0){R(r[r.length-1].id);return}e.key==="Escape"&&(c(!1),h(-1))}},[x,f,u,S,q,p,r,I,R,d]);o.useEffect(()=>{if(!f)return;const e=t=>{K.current?.contains(t.target)||c(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[f]);const te={position:"relative",width:"100%"},ne={display:"flex",flexWrap:"wrap",alignItems:"center",gap:i.gap,minHeight:i.height,padding:`${n.spacing[1]}px ${i.padding}px`,backgroundColor:y?"var(--brycks-background-muted)":"var(--brycks-background-default)",border:`1px solid ${D||$?"var(--brycks-error-default)":O?"var(--brycks-primary-default)":"var(--brycks-border-default)"}`,borderRadius:"var(--brycks-radius-md)",transition:`all ${b.durations.fast}ms ${b.easings.easeOut}`,cursor:y?"not-allowed":"text",boxShadow:O?"var(--brycks-focus-ring)":void 0},re=e=>({display:"inline-flex",alignItems:"center",gap:n.spacing[1],height:i.tagHeight,padding:`0 ${n.spacing[2]}px`,fontSize:i.fontSize-1,fontWeight:500,color:e.color?"white":"var(--brycks-foreground-default)",backgroundColor:e.color||"var(--brycks-background-muted)",borderRadius:"var(--brycks-radius-full)",whiteSpace:"nowrap"}),oe={display:"flex",alignItems:"center",justifyContent:"center",width:n.spacing[4],height:n.spacing[4],marginLeft:n.spacing[.5],marginRight:-n.spacing[1],color:"inherit",opacity:.7,cursor:"pointer",borderRadius:"var(--brycks-radius-full)",transition:`all ${b.durations.fast}ms ${b.easings.easeOut}`},se={flex:1,minWidth:100,height:i.tagHeight,padding:0,fontSize:i.fontSize,color:"var(--brycks-foreground-default)",backgroundColor:"transparent",border:"none",outline:"none"},ae={position:"absolute",top:"100%",left:0,right:0,marginTop:n.spacing[1],maxHeight:200,overflowY:"auto",backgroundColor:"var(--brycks-background-elevated)",border:"1px solid var(--brycks-border-default)",borderRadius:"var(--brycks-radius-lg)",boxShadow:"var(--brycks-shadow-lg)",zIndex:"var(--brycks-z-dropdown)",padding:n.spacing[1]},ie=e=>({display:"flex",alignItems:"center",gap:g.componentGap.md,padding:`${n.spacing[2]}px ${n.spacing[3]}px`,fontSize:i.fontSize,color:"var(--brycks-foreground-default)",backgroundColor:e?"var(--brycks-background-muted)":"transparent",borderRadius:"var(--brycks-radius-md)",cursor:"pointer",transition:`background-color ${b.durations.fast}ms ${b.easings.easeOut}`}),le={marginTop:n.spacing[1],fontSize:j.fontSizes.sm,color:"var(--brycks-error-default)"},ce=(e,t)=>a.jsxs("span",{style:re(e),children:[e.label,x&&a.jsx("button",{type:"button","aria-label":`Remove ${e.label}`,style:oe,onClick:s=>{s.stopPropagation(),t()},onMouseEnter:s=>{s.currentTarget.style.opacity="1",s.currentTarget.style.backgroundColor="rgba(0,0,0,0.1)"},onMouseLeave:s=>{s.currentTarget.style.opacity="0.7",s.currentTarget.style.backgroundColor="transparent"},children:a.jsx(pe,{})})]},e.id);return a.jsxs("div",{ref:K,className:de.cx("brycks-tag-input",`brycks-tag-input--${L}`,J),style:te,"data-testid":Q,children:[a.jsxs("div",{style:ne,onClick:()=>!y&&H.current?.focus(),children:[r.map(e=>B?B(e,()=>R(e.id)):ce(e,()=>R(e.id))),a.jsx("input",{ref:e=>{H.current=e,typeof z=="function"?z(e):z&&(z.current=e)},type:"text",role:"combobox","aria-label":Y,"aria-expanded":f&&u.length>0,"aria-autocomplete":"list","aria-invalid":D||!!$,value:p,placeholder:r.length===0?U:"",disabled:y,readOnly:P,style:se,onChange:_,onKeyDown:ee,onFocus:()=>{X(!0),c(!0)},onBlur:()=>X(!1)})]}),f&&u.length>0&&a.jsx("ul",{role:"listbox",style:ae,children:u.map((e,t)=>a.jsx("li",{role:"option","aria-selected":t===S,style:ie(t===S),onClick:()=>{d([...r,e]),k(""),c(!1),H.current?.focus()},onMouseEnter:()=>h(t),children:e.label},e.id))}),$&&a.jsx("div",{style:le,children:$})]})});N.displayName="TagInput";exports.TagInput=N;
2
2
  //# sourceMappingURL=TagInput.cjs.map
@@ -1,14 +1,14 @@
1
1
  import { jsxs as H, jsx as s } from "react/jsx-runtime";
2
2
  import { forwardRef as he, useState as p, useRef as q, useCallback as w, useEffect as me } from "react";
3
3
  import { cx as ye } from "../../../utils/styles.js";
4
- import { componentPaddingX as T, componentHeights as D, componentGap as be } from "../../../design-system/primitives/sizing.js";
5
- import { durations as M, easings as A } from "../../../design-system/tokens/motion.js";
4
+ import { durations as T, easings as D } from "../../../design-system/tokens/motion.js";
6
5
  import { spacing as r } from "../../../design-system/tokens/spacing.js";
6
+ import { componentPaddingX as M, componentHeights as A, componentGap as be } from "../../../design-system/primitives/sizing.js";
7
7
  import { fontSizes as R } from "../../../design-system/tokens/typography.js";
8
8
  const ke = {
9
- sm: { height: D.sm, fontSize: R.base - 1, tagHeight: r[5], padding: T.xs, gap: r[1] },
10
- md: { height: D.md, fontSize: R.base, tagHeight: r[6], padding: T.sm, gap: r[1.5] },
11
- lg: { height: D.lg, fontSize: R.md, tagHeight: r[7], padding: T.sm, gap: r[2] }
9
+ sm: { height: A.sm, fontSize: R.base - 1, tagHeight: r[5], padding: M.xs, gap: r[1] },
10
+ md: { height: A.md, fontSize: R.base, tagHeight: r[6], padding: M.sm, gap: r[1.5] },
11
+ lg: { height: A.lg, fontSize: R.md, tagHeight: r[7], padding: M.sm, gap: r[2] }
12
12
  };
13
13
  function ve() {
14
14
  return /* @__PURE__ */ s("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ s("path", { d: "M3 3l6 6M9 3l-6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) });
@@ -129,7 +129,7 @@ const we = he(function({
129
129
  backgroundColor: h ? "var(--brycks-background-muted)" : "var(--brycks-background-default)",
130
130
  border: `1px solid ${K || $ ? "var(--brycks-error-default)" : V ? "var(--brycks-primary-default)" : "var(--brycks-border-default)"}`,
131
131
  borderRadius: "var(--brycks-radius-md)",
132
- transition: `all ${M.fast}ms ${A.easeOut}`,
132
+ transition: `all ${T.fast}ms ${D.easeOut}`,
133
133
  cursor: h ? "not-allowed" : "text",
134
134
  boxShadow: V ? "var(--brycks-focus-ring)" : void 0
135
135
  }, se = (e) => ({
@@ -156,7 +156,7 @@ const we = he(function({
156
156
  opacity: 0.7,
157
157
  cursor: "pointer",
158
158
  borderRadius: "var(--brycks-radius-full)",
159
- transition: `all ${M.fast}ms ${A.easeOut}`
159
+ transition: `all ${T.fast}ms ${D.easeOut}`
160
160
  }, ce = {
161
161
  flex: 1,
162
162
  minWidth: 100,
@@ -191,7 +191,7 @@ const we = he(function({
191
191
  backgroundColor: e ? "var(--brycks-background-muted)" : "transparent",
192
192
  borderRadius: "var(--brycks-radius-md)",
193
193
  cursor: "pointer",
194
- transition: `background-color ${M.fast}ms ${A.easeOut}`
194
+ transition: `background-color ${T.fast}ms ${D.easeOut}`
195
195
  }), fe = {
196
196
  marginTop: r[1],
197
197
  fontSize: R.sm,
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./form/Input/Input.cjs"),t=require("./form/TextField/TextField.cjs"),i=require("./form/Select/Select.cjs"),o=require("./form/Checkbox/Checkbox.cjs"),u=require("./form/Switch/Switch.cjs"),c=require("./form/Textarea/Textarea.cjs"),e=require("./form/Radio/Radio.cjs"),n=require("./form/Slider/Slider.cjs"),a=require("./form/DateInput/DateInput.cjs"),l=require("./form/FileInput/FileInput.cjs"),s=require("./form/FormField/FormField.cjs"),F=require("./form/FieldError/FieldError.cjs"),q=require("./form/Form/Form.cjs"),p=require("./form/FormLabel/FormLabel.cjs"),d=require("./form/FormGroup/FormGroup.cjs"),m=require("./form/Combobox/Combobox.cjs"),S=require("./form/Rating/Rating.cjs"),I=require("./form/TagInput/TagInput.cjs"),b=require("./form/MultiSelect/MultiSelect.cjs"),T=require("./form/TimePicker/TimePicker.cjs"),x=require("./form/DateRangePicker/DateRangePicker.cjs"),g=require("./form/SearchInput/SearchInput.cjs");exports.Input=r.Input;exports.TextField=t.TextField;exports.Select=i.Select;exports.Checkbox=o.Checkbox;exports.Switch=u.Switch;exports.Textarea=c.Textarea;exports.Radio=e.Radio;exports.RadioGroup=e.RadioGroup;exports.Slider=n.Slider;exports.DateInput=a.DateInput;exports.FileInput=l.FileInput;exports.FormField=s.FormField;exports.FieldError=F.FieldError;exports.Form=q.Form;exports.FormLabel=p.FormLabel;exports.FormGroup=d.FormGroup;exports.Combobox=m.Combobox;exports.Rating=S.Rating;exports.TagInput=I.TagInput;exports.MultiSelect=b.MultiSelect;exports.TimePicker=T.TimePicker;exports.DateRangePicker=x.DateRangePicker;exports.SearchInput=g.SearchInput;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./form/Checkbox/Checkbox.cjs"),i=require("./form/Combobox/Combobox.cjs"),o=require("./form/DateInput/DateInput.cjs"),c=require("./form/DateRangePicker/DateRangePicker.cjs"),u=require("./form/FieldError/FieldError.cjs"),n=require("./form/FileInput/FileInput.cjs"),l=require("./form/FileUpload/FileUpload.cjs"),a=require("./form/Form/Form.cjs"),s=require("./form/FormField/FormField.cjs"),F=require("./form/FormGroup/FormGroup.cjs"),p=require("./form/FormLabel/FormLabel.cjs"),q=require("./form/Input/Input.cjs"),d=require("./form/MultiSelect/MultiSelect.cjs"),r=require("./form/Radio/Radio.cjs"),m=require("./form/Rating/Rating.cjs"),S=require("./form/SearchInput/SearchInput.cjs"),I=require("./form/Select/Select.cjs"),b=require("./form/Slider/Slider.cjs"),T=require("./form/Switch/Switch.cjs"),x=require("./form/TagInput/TagInput.cjs"),g=require("./form/TextField/TextField.cjs"),h=require("./form/Textarea/Textarea.cjs"),R=require("./form/TimePicker/TimePicker.cjs"),e=require("./form/FileUpload/fileUpload.utils.cjs");exports.Checkbox=t.Checkbox;exports.Combobox=i.Combobox;exports.DateInput=o.DateInput;exports.DateRangePicker=c.DateRangePicker;exports.FieldError=u.FieldError;exports.FileInput=n.FileInput;exports.FileUpload=l.FileUpload;exports.Form=a.Form;exports.FormField=s.FormField;exports.FormGroup=F.FormGroup;exports.FormLabel=p.FormLabel;exports.Input=q.Input;exports.MultiSelect=d.MultiSelect;exports.Radio=r.Radio;exports.RadioGroup=r.RadioGroup;exports.Rating=m.Rating;exports.SearchInput=S.SearchInput;exports.Select=I.Select;exports.Slider=b.Slider;exports.Switch=T.Switch;exports.TagInput=x.TagInput;exports.TextField=g.TextField;exports.Textarea=h.Textarea;exports.TimePicker=R.TimePicker;exports.formatBytes=e.formatBytes;exports.matchesAccept=e.matchesAccept;exports.selectFiles=e.selectFiles;
2
2
  //# sourceMappingURL=form.cjs.map
@@ -1,48 +1,54 @@
1
- import { Input as e } from "./form/Input/Input.js";
2
- import { TextField as p } from "./form/TextField/TextField.js";
3
- import { Select as x } from "./form/Select/Select.js";
4
- import { Checkbox as i } from "./form/Checkbox/Checkbox.js";
5
- import { Switch as l } from "./form/Switch/Switch.js";
6
- import { Textarea as F } from "./form/Textarea/Textarea.js";
7
- import { Radio as n, RadioGroup as d } from "./form/Radio/Radio.js";
8
- import { Slider as S } from "./form/Slider/Slider.js";
9
- import { DateInput as R } from "./form/DateInput/DateInput.js";
10
- import { FileInput as g } from "./form/FileInput/FileInput.js";
11
- import { FormField as k } from "./form/FormField/FormField.js";
12
- import { FieldError as D } from "./form/FieldError/FieldError.js";
13
- import { Form as P } from "./form/Form/Form.js";
14
- import { FormLabel as E } from "./form/FormLabel/FormLabel.js";
15
- import { FormGroup as M } from "./form/FormGroup/FormGroup.js";
16
- import { Combobox as q } from "./form/Combobox/Combobox.js";
17
- import { Rating as v } from "./form/Rating/Rating.js";
18
- import { TagInput as z } from "./form/TagInput/TagInput.js";
19
- import { MultiSelect as B } from "./form/MultiSelect/MultiSelect.js";
20
- import { TimePicker as J } from "./form/TimePicker/TimePicker.js";
21
- import { DateRangePicker as N } from "./form/DateRangePicker/DateRangePicker.js";
22
- import { SearchInput as Q } from "./form/SearchInput/SearchInput.js";
1
+ import { Checkbox as e } from "./form/Checkbox/Checkbox.js";
2
+ import { Combobox as p } from "./form/Combobox/Combobox.js";
3
+ import { DateInput as x } from "./form/DateInput/DateInput.js";
4
+ import { DateRangePicker as i } from "./form/DateRangePicker/DateRangePicker.js";
5
+ import { FieldError as l } from "./form/FieldError/FieldError.js";
6
+ import { FileInput as F } from "./form/FileInput/FileInput.js";
7
+ import { FileUpload as d } from "./form/FileUpload/FileUpload.js";
8
+ import { Form as I } from "./form/Form/Form.js";
9
+ import { FormField as b } from "./form/FormField/FormField.js";
10
+ import { FormGroup as s } from "./form/FormGroup/FormGroup.js";
11
+ import { FormLabel as T } from "./form/FormLabel/FormLabel.js";
12
+ import { Input as k } from "./form/Input/Input.js";
13
+ import { MultiSelect as D } from "./form/MultiSelect/MultiSelect.js";
14
+ import { Radio as P, RadioGroup as w } from "./form/Radio/Radio.js";
15
+ import { Rating as A } from "./form/Rating/Rating.js";
16
+ import { SearchInput as E } from "./form/SearchInput/SearchInput.js";
17
+ import { Select as M } from "./form/Select/Select.js";
18
+ import { Slider as j } from "./form/Slider/Slider.js";
19
+ import { Switch as v } from "./form/Switch/Switch.js";
20
+ import { TagInput as H } from "./form/TagInput/TagInput.js";
21
+ import { TextField as K } from "./form/TextField/TextField.js";
22
+ import { Textarea as O } from "./form/Textarea/Textarea.js";
23
+ import { TimePicker as V } from "./form/TimePicker/TimePicker.js";
24
+ import { formatBytes as X, matchesAccept as Y, selectFiles as Z } from "./form/FileUpload/fileUpload.utils.js";
23
25
  export {
24
- i as Checkbox,
25
- q as Combobox,
26
- R as DateInput,
27
- N as DateRangePicker,
28
- D as FieldError,
29
- g as FileInput,
30
- P as Form,
31
- k as FormField,
32
- M as FormGroup,
33
- E as FormLabel,
34
- e as Input,
35
- B as MultiSelect,
36
- n as Radio,
37
- d as RadioGroup,
38
- v as Rating,
39
- Q as SearchInput,
40
- x as Select,
41
- S as Slider,
42
- l as Switch,
43
- z as TagInput,
44
- p as TextField,
45
- F as Textarea,
46
- J as TimePicker
26
+ e as Checkbox,
27
+ p as Combobox,
28
+ x as DateInput,
29
+ i as DateRangePicker,
30
+ l as FieldError,
31
+ F as FileInput,
32
+ d as FileUpload,
33
+ I as Form,
34
+ b as FormField,
35
+ s as FormGroup,
36
+ T as FormLabel,
37
+ k as Input,
38
+ D as MultiSelect,
39
+ P as Radio,
40
+ w as RadioGroup,
41
+ A as Rating,
42
+ E as SearchInput,
43
+ M as Select,
44
+ j as Slider,
45
+ v as Switch,
46
+ H as TagInput,
47
+ K as TextField,
48
+ O as Textarea,
49
+ V as TimePicker,
50
+ X as formatBytes,
51
+ Y as matchesAccept,
52
+ Z as selectFiles
47
53
  };
48
54
  //# sourceMappingURL=form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"form.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}