@vkzstudio/muza-ui 1.0.17 → 1.0.19

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 (54) hide show
  1. package/dist/components/Button/buttonVariants.js +1 -1
  2. package/dist/components/Checkbox/Checkbox.d.ts +4 -0
  3. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
  4. package/dist/components/Checkbox/Checkbox.js +36 -29
  5. package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -0
  6. package/dist/components/Checkbox/Checkbox.stories.d.ts.map +1 -1
  7. package/dist/components/DatePicker/DatePicker.d.ts +2 -0
  8. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  9. package/dist/components/DatePicker/DatePicker.js +33 -31
  10. package/dist/components/FileUpload/FileItem.d.ts +13 -3
  11. package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
  12. package/dist/components/FileUpload/FileItem.js +94 -80
  13. package/dist/components/FileUpload/FileUpload.d.ts +24 -2
  14. package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
  15. package/dist/components/FileUpload/FileUpload.js +174 -148
  16. package/dist/components/FileUpload/FileUpload.stories.d.ts +5 -0
  17. package/dist/components/FileUpload/FileUpload.stories.d.ts.map +1 -1
  18. package/dist/components/FileUpload/index.d.ts +1 -1
  19. package/dist/components/FileUpload/index.d.ts.map +1 -1
  20. package/dist/components/Flex/Flex.d.ts +3 -1
  21. package/dist/components/Flex/Flex.d.ts.map +1 -1
  22. package/dist/components/Flex/Flex.js +33 -31
  23. package/dist/components/FormField/FormField.d.ts +30 -0
  24. package/dist/components/FormField/FormField.d.ts.map +1 -0
  25. package/dist/components/FormField/FormField.js +56 -0
  26. package/dist/components/FormField/InputHint.d.ts +13 -0
  27. package/dist/components/FormField/InputHint.d.ts.map +1 -0
  28. package/dist/components/FormField/InputHint.js +26 -0
  29. package/dist/components/FormField/InputLabel.d.ts +20 -0
  30. package/dist/components/FormField/InputLabel.d.ts.map +1 -0
  31. package/dist/components/FormField/InputLabel.js +27 -0
  32. package/dist/components/FormField/index.d.ts +4 -0
  33. package/dist/components/FormField/index.d.ts.map +1 -0
  34. package/dist/components/Input/Input.d.ts.map +1 -1
  35. package/dist/components/Input/Input.js +79 -94
  36. package/dist/components/MultiSelect/MultiSelect.d.ts +2 -0
  37. package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  38. package/dist/components/MultiSelect/MultiSelect.js +125 -131
  39. package/dist/components/Radio/Radio.js +1 -1
  40. package/dist/components/Select/Select.d.ts +2 -0
  41. package/dist/components/Select/Select.d.ts.map +1 -1
  42. package/dist/components/Select/Select.js +126 -131
  43. package/dist/components/TextEditor/TextEditor.d.ts +4 -0
  44. package/dist/components/TextEditor/TextEditor.d.ts.map +1 -1
  45. package/dist/components/TextEditor/TextEditor.js +113 -135
  46. package/dist/components/Textarea/Textarea.d.ts +4 -0
  47. package/dist/components/Textarea/Textarea.d.ts.map +1 -1
  48. package/dist/components/Textarea/Textarea.js +52 -61
  49. package/dist/components/Textarea/Textarea.stories.d.ts +1 -0
  50. package/dist/components/Textarea/Textarea.stories.d.ts.map +1 -1
  51. package/dist/components/TimePicker/TimePicker.d.ts +2 -0
  52. package/dist/components/TimePicker/TimePicker.d.ts.map +1 -1
  53. package/dist/muza-ui.css +1 -1
  54. package/package.json +1 -1
@@ -6,6 +6,20 @@ declare const fileUploadVariants: (props?: ({
6
6
  isDragActive?: boolean | null | undefined;
7
7
  disabled?: boolean | null | undefined;
8
8
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
9
+ /**
10
+ * Represents a remote file that is already uploaded and accessible via URL.
11
+ * Used to display previously-uploaded files without re-fetching them as `File` objects.
12
+ */
13
+ export interface PreselectedUrl {
14
+ /** Direct URL to the file. */
15
+ url: string;
16
+ /** Display name for the file. */
17
+ name: string;
18
+ /** MIME type — if starts with `"image/"`, shows thumbnail. Falls back to extension sniffing from name. */
19
+ type?: string;
20
+ /** File size in bytes (for display). */
21
+ size?: number;
22
+ }
9
23
  /**
10
24
  * Props for the FileUpload component.
11
25
  * Extends standard div attributes except `onDrop`, `onError`, and `onChange`
@@ -36,12 +50,16 @@ export interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElemen
36
50
  readOnly?: boolean;
37
51
  /** Title text displayed inside the dropzone area. Defaults to a translated string. */
38
52
  title?: string;
39
- /** Label displayed above the upload area. Renders as a `<label>` when passed as a string. */
40
- label?: React.ReactNode;
53
+ /** Label displayed above the upload area. */
54
+ label?: string;
41
55
  /** Subtitle text displayed below the title inside the dropzone. */
42
56
  subtitle?: string;
43
57
  /** Applies error border and text styling to the dropzone. */
44
58
  error?: boolean;
59
+ /** Marks the field as required and displays a red asterisk next to the label. @default false */
60
+ required?: boolean;
61
+ /** Hides the required asterisk even when `required` is true. @default false */
62
+ disableRequiredAsterisk?: boolean;
45
63
  /**
46
64
  * Additional options passed to react-dropzone.
47
65
  * Props managed by the component (`onDrop`, `accept`, `multiple`, `maxSize`, `disabled`) are excluded.
@@ -81,6 +99,10 @@ export interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElemen
81
99
  onDelete?: (file: File, index: number) => void;
82
100
  /** Fires when the file list changes. Receives the updated array of all files. */
83
101
  onChange?: (files: File[]) => void;
102
+ /** Already-uploaded files to display via URL, without needing `File` objects. @default [] */
103
+ preselectedUrls?: PreselectedUrl[];
104
+ /** Fires when a URL-backed item is deleted. Receives the item and its index in the `preselectedUrls` array. */
105
+ onDeleteUrl?: (item: PreselectedUrl, index: number) => void;
84
106
  }
85
107
  declare const FileUpload: React.ForwardRefExoticComponent<FileUploadProps & React.RefAttributes<HTMLDivElement>>;
86
108
  export { FileUpload };
@@ -1 +1 @@
1
- {"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileUpload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA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QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACvD;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC9B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC7B,mGAAmG;IACnG,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;IAC9C,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;IAClC,6FAA6F;IAC7F,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;IAClC,+GAA+G;IAC/G,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5D;AAED,QAAA,MAAM,UAAU,wFAgOf,CAAA;AAGD,OAAO,EAAE,UAAU,EAAE,CAAA"}
@@ -1,14 +1,15 @@
1
- import { jsxs as n, jsx as i } from "react/jsx-runtime";
2
- import * as y from "react";
3
- import { cva as P } from "class-variance-authority";
4
- import { useDropzone as D } from "react-dropzone";
5
- import { FileItem as H } from "./FileItem.js";
6
- import { useMuzaTranslations as E } from "../../translations/TranslationContext.js";
7
- import { Flex as j } from "../Flex/Flex.js";
8
- import { Typography as x } from "../Typography/Typography.js";
9
- import { cn as A } from "../../utils/cn.js";
10
- import { CloudUploadOutline as C } from "@solar-icons/react-perf";
11
- const ee = P(
1
+ import { jsxs as f, jsx as a, Fragment as ee } from "react/jsx-runtime";
2
+ import * as F from "react";
3
+ import { cva as B } from "class-variance-authority";
4
+ import { useDropzone as oe } from "react-dropzone";
5
+ import { FileItem as K } from "./FileItem.js";
6
+ import { useMuzaTranslations as te } from "../../translations/TranslationContext.js";
7
+ import { Flex as re } from "../Flex/Flex.js";
8
+ import { FormField as le } from "../FormField/FormField.js";
9
+ import { cn as _ } from "../../utils/cn.js";
10
+ import { CloudUploadOutline as se } from "@solar-icons/react-perf";
11
+ import { Typography as S } from "../Typography/Typography.js";
12
+ const ie = B(
12
13
  [
13
14
  "group relative cursor-pointer rounded-xl border-1 border-dashed transition-colors",
14
15
  "p-4xl pt-3xl pr-4xl pb-3xl",
@@ -44,7 +45,7 @@ const ee = P(
44
45
  }
45
46
  }
46
47
  }
47
- ), te = P(
48
+ ), ae = B(
48
49
  [
49
50
  "text-center transition-colors",
50
51
  "text-comp-file-upload-text-dark-secondary"
@@ -56,161 +57,186 @@ const ee = P(
56
57
  }
57
58
  }
58
59
  }
59
- ), oe = y.forwardRef(
60
+ ), de = F.forwardRef(
60
61
  ({
61
- className: S,
62
- onDrop: g,
63
- accept: f,
64
- multiple: U = !0,
65
- maxSize: b,
66
- maxSizeErrorMessage: T,
67
- size: V = "base",
62
+ className: y,
63
+ onDrop: x,
64
+ accept: u,
65
+ multiple: k = !0,
66
+ maxSize: g,
67
+ maxSizeErrorMessage: G,
68
+ size: $ = "base",
68
69
  disabled: p = !1,
69
- readOnly: h = !1,
70
- dropzoneOptions: K,
71
- label: m,
72
- title: _,
73
- subtitle: k,
74
- preselectedFiles: q = [],
75
- fileStatus: B = [],
76
- itemErrors: v,
77
- itemHints: z,
78
- error: G,
79
- onError: o,
80
- onDelete: M,
70
+ readOnly: m = !1,
71
+ dropzoneOptions: J,
72
+ label: w,
73
+ title: L,
74
+ subtitle: N,
75
+ preselectedFiles: Q = [],
76
+ fileStatus: W = [],
77
+ itemErrors: b,
78
+ itemHints: h,
79
+ error: X,
80
+ required: v,
81
+ disableRequiredAsterisk: Y,
82
+ onError: t,
83
+ onDelete: z,
81
84
  onChange: c,
82
- ...J
83
- }, L) => {
84
- const u = E(), [w, F] = y.useState(q), [N, $] = y.useState(!1), O = _ ?? u.fileUpload.title, I = b ? u.fileUpload.maxSizeError.replace(
85
+ preselectedUrls: U = [],
86
+ onDeleteUrl: M,
87
+ ...Z
88
+ }, q) => {
89
+ const n = te(), [I, R] = F.useState(Q), [j, A] = F.useState(!1), O = L ?? n.fileUpload.title, P = g ? n.fileUpload.maxSizeError.replace(
85
90
  "{size}",
86
- (b / (1024 * 1024)).toFixed(0)
87
- ) : "", R = T ?? I, { getRootProps: Q, getInputProps: W, isDragActive: X } = D({
88
- onDrop: (t, a) => {
91
+ (g / (1024 * 1024)).toFixed(0)
92
+ ) : "", T = G ?? P, { getRootProps: H, getInputProps: D, isDragActive: E } = oe({
93
+ onDrop: (e, l) => {
89
94
  try {
90
- if ($(!1), a.length > 0 && a.some(
91
- (r) => r.errors.some((l) => l.code === "file-too-large")
95
+ if (A(!1), l.length > 0 && l.some(
96
+ (r) => r.errors.some((s) => s.code === "file-too-large")
92
97
  )) {
93
- $(!0);
94
- const r = R || I;
95
- o == null || o(r, a[0].file);
98
+ A(!0);
99
+ const r = T || P;
100
+ t == null || t(r, l[0].file);
96
101
  return;
97
102
  }
98
- F((e) => {
103
+ R((o) => {
99
104
  const r = new Set(
100
- e.map((s) => `${s.name}-${s.size}-${s.lastModified}`)
101
- ), l = t.filter(
102
- (s) => !r.has(`${s.name}-${s.size}-${s.lastModified}`)
103
- ), d = [...e, ...l];
105
+ o.map((i) => `${i.name}-${i.size}-${i.lastModified}`)
106
+ ), s = e.filter(
107
+ (i) => !r.has(`${i.name}-${i.size}-${i.lastModified}`)
108
+ ), d = [...o, ...s];
104
109
  return c == null || c(d), d;
105
- }), g == null || g(t);
106
- } catch (e) {
107
- const r = e instanceof Error ? e.message : u.fileUpload.processingError;
108
- o == null || o(r);
110
+ }), x == null || x(e);
111
+ } catch (o) {
112
+ const r = o instanceof Error ? o.message : n.fileUpload.processingError;
113
+ t == null || t(r);
109
114
  }
110
115
  },
111
- accept: typeof f == "string" ? { [f]: [] } : f ? Object.fromEntries(f.map((t) => [t, []])) : void 0,
112
- multiple: U,
113
- maxSize: b,
116
+ accept: typeof u == "string" ? { [u]: [] } : u ? Object.fromEntries(u.map((e) => [e, []])) : void 0,
117
+ multiple: k,
118
+ maxSize: g,
114
119
  disabled: p,
115
- ...K
116
- }), Y = h || !U && w.length > 0;
117
- return /* @__PURE__ */ n(j, { direction: "column", gap: "lg", children: [
118
- !Y && /* @__PURE__ */ n(j, { direction: "column", gap: "sm", children: [
119
- m && (typeof m == "string" ? /* @__PURE__ */ i(
120
- x,
121
- {
122
- size: "sm",
123
- component: "label",
124
- weight: "regular",
125
- variant: "body",
126
- className: "caret-comp-input-text-primary",
127
- children: m
128
- }
129
- ) : m),
130
- /* @__PURE__ */ n(
131
- "div",
132
- {
133
- ref: L,
134
- tabIndex: p ? void 0 : 0,
135
- className: A(
136
- ee({
137
- error: G || N,
138
- disabled: p,
139
- className: S,
140
- isDragActive: X
141
- })
120
+ ...J
121
+ }), V = m || !k && (I.length > 0 || U.length > 0);
122
+ return /* @__PURE__ */ f(re, { direction: "column", gap: "lg", children: [
123
+ (!V || w) && /* @__PURE__ */ a(
124
+ le,
125
+ {
126
+ label: w,
127
+ required: v,
128
+ disableRequiredAsterisk: Y,
129
+ children: !V && /* @__PURE__ */ f(ee, { children: [
130
+ /* @__PURE__ */ f(
131
+ "div",
132
+ {
133
+ ref: q,
134
+ tabIndex: p ? void 0 : 0,
135
+ className: _(
136
+ ie({
137
+ error: X || j,
138
+ disabled: p,
139
+ className: y,
140
+ isDragActive: E
141
+ })
142
+ ),
143
+ ...H(),
144
+ ...Z,
145
+ children: [
146
+ /* @__PURE__ */ a(
147
+ "input",
148
+ {
149
+ ...D({ required: v }),
150
+ "aria-required": v
151
+ }
152
+ ),
153
+ /* @__PURE__ */ a(se, { className: "inline size-comp-file-upload-ico-size" }),
154
+ /* @__PURE__ */ f("div", { children: [
155
+ /* @__PURE__ */ a(S, { size: "base", component: "p", weight: "medium", children: O }),
156
+ N && /* @__PURE__ */ a(
157
+ S,
158
+ {
159
+ size: "sm",
160
+ component: "p",
161
+ weight: "regular",
162
+ className: _(
163
+ ae({
164
+ disabled: p,
165
+ className: y
166
+ })
167
+ ),
168
+ children: N
169
+ }
170
+ )
171
+ ] })
172
+ ]
173
+ }
142
174
  ),
143
- ...Q(),
144
- ...J,
145
- children: [
146
- /* @__PURE__ */ i("input", { ...W() }),
147
- /* @__PURE__ */ i(C, { className: "inline size-comp-file-upload-ico-size" }),
148
- /* @__PURE__ */ n("div", { children: [
149
- /* @__PURE__ */ i(x, { size: "base", component: "p", weight: "medium", children: O }),
150
- k && /* @__PURE__ */ i(
151
- x,
152
- {
153
- size: "sm",
154
- component: "p",
155
- weight: "regular",
156
- className: A(
157
- te({
158
- disabled: p,
159
- className: S
160
- })
161
- ),
162
- children: k
163
- }
164
- )
165
- ] })
166
- ]
167
- }
168
- ),
169
- N && /* @__PURE__ */ i(
170
- x,
171
- {
172
- size: "sm",
173
- variant: "body",
174
- component: "p",
175
- weight: "regular",
176
- className: "text-comp-file-upload-text-error-def",
177
- children: R
178
- }
179
- )
180
- ] }),
181
- /* @__PURE__ */ i("ul", { className: "flex flex-col gap-md", children: w.map((t, a) => {
182
- const e = B[a], r = e == null ? void 0 : e.uploaded;
183
- return h && !r ? null : /* @__PURE__ */ i(
184
- H,
175
+ j && /* @__PURE__ */ a(
176
+ S,
177
+ {
178
+ size: "sm",
179
+ variant: "body",
180
+ component: "p",
181
+ weight: "regular",
182
+ className: "text-comp-file-upload-text-error-def",
183
+ children: T
184
+ }
185
+ )
186
+ ] })
187
+ }
188
+ ),
189
+ /* @__PURE__ */ f("ul", { className: "flex flex-col gap-md", children: [
190
+ U.map((e, l) => /* @__PURE__ */ a(
191
+ K,
185
192
  {
186
- file: t,
187
- uploaded: r,
188
- progress: e == null ? void 0 : e.progress,
193
+ source: "url",
194
+ url: e.url,
195
+ name: e.name,
196
+ type: e.type,
197
+ uploaded: !0,
189
198
  disabled: p,
190
- readOnly: h,
191
- error: v == null ? void 0 : v.get(t),
192
- note: z == null ? void 0 : z.get(t),
193
- onError: o,
194
- size: V,
195
- onDelete: () => {
196
- try {
197
- F((l) => {
198
- const d = l.filter((s, Z) => Z !== a);
199
- return c == null || c(d), d;
200
- }), M == null || M(t, a);
201
- } catch (l) {
202
- const d = l instanceof Error ? l.message : u.fileUpload.deleteError;
203
- o == null || o(d, t);
204
- }
205
- }
199
+ readOnly: m,
200
+ size: $,
201
+ onDelete: () => M == null ? void 0 : M(e, l)
206
202
  },
207
- t.name
208
- );
209
- }) })
203
+ `url-${e.url}`
204
+ )),
205
+ I.map((e, l) => {
206
+ const o = W[l], r = o == null ? void 0 : o.uploaded;
207
+ return m && !r ? null : /* @__PURE__ */ a(
208
+ K,
209
+ {
210
+ source: "file",
211
+ file: e,
212
+ uploaded: r,
213
+ progress: o == null ? void 0 : o.progress,
214
+ disabled: p,
215
+ readOnly: m,
216
+ error: b == null ? void 0 : b.get(e),
217
+ note: h == null ? void 0 : h.get(e),
218
+ onError: t,
219
+ size: $,
220
+ onDelete: () => {
221
+ try {
222
+ R((s) => {
223
+ const d = s.filter((i, C) => C !== l);
224
+ return c == null || c(d), d;
225
+ }), z == null || z(e, l);
226
+ } catch (s) {
227
+ const d = s instanceof Error ? s.message : n.fileUpload.deleteError;
228
+ t == null || t(d, e);
229
+ }
230
+ }
231
+ },
232
+ e.name
233
+ );
234
+ })
235
+ ] })
210
236
  ] });
211
237
  }
212
238
  );
213
- oe.displayName = "FileUpload";
239
+ de.displayName = "FileUpload";
214
240
  export {
215
- oe as FileUpload
241
+ de as FileUpload
216
242
  };
@@ -4,15 +4,20 @@ declare const meta: Meta<typeof FileUpload>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
+ export declare const Required: Story;
7
8
  export declare const Error: Story;
8
9
  export declare const ErrorWithUploadedFiles: Story;
9
10
  export declare const UploadInProgress: Story;
10
11
  export declare const UploadedFiles: Story;
11
12
  export declare const SingleFile: Story;
13
+ export declare const SingleFileWithLabel: Story;
12
14
  export declare const ImagesOnly: Story;
13
15
  export declare const WithSizeLimit: Story;
14
16
  export declare const Disabled: Story;
15
17
  export declare const WithErrorsAndHints: Story;
16
18
  export declare const ReadOnly: Story;
17
19
  export declare const UploadSimulation: Story;
20
+ export declare const PreselectedUrls: Story;
21
+ export declare const MixedFilesAndUrls: Story;
22
+ export declare const SingleFileWithUrl: Story;
18
23
  //# sourceMappingURL=FileUpload.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileUpload.stories.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileUpload.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAsJjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,OAAO,EAAE,KAerB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAmBnB,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,KAoBpC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAsB9B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAkB3B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAiBxB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAexB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAiB3B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAmBtB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KA0ChC,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAoBtB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KA0F9B,CAAA"}
1
+ {"version":3,"file":"FileUpload.stories.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileUpload.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAA;AAE9D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CA8KjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,OAAO,EAAE,KAerB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAgBtB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAmBnB,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,KAoBpC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAsB9B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAkB3B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAiBxB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAqBjC,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAexB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAiB3B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAmBtB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KA0ChC,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAoBtB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KA0F9B,CAAA;AAmBD,eAAO,MAAM,eAAe,EAAE,KA0B7B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAoC/B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAsB/B,CAAA"}
@@ -1,2 +1,2 @@
1
- export { FileUpload, type FileUploadProps } from './FileUpload';
1
+ export { FileUpload, type FileUploadProps, type PreselectedUrl, } from './FileUpload';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAA"}
@@ -37,6 +37,8 @@ export interface FlexProps extends Omit<VariantProps<typeof flexVariants>, 'gap'
37
37
  component?: HTMLElementTag;
38
38
  /** Additional CSS classes for custom styling. */
39
39
  className?: string;
40
+ /** Inline styles for escape-hatch customizations not covered by tokens. */
41
+ style?: React.CSSProperties;
40
42
  /** Sets the main axis direction for flex items. @default 'row' */
41
43
  direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
42
44
  /** Controls whether flex items wrap to multiple lines. @default 'nowrap' */
@@ -79,6 +81,6 @@ export interface FlexProps extends Omit<VariantProps<typeof flexVariants>, 'gap'
79
81
  */
80
82
  margin?: SpacingProps['margin'];
81
83
  }
82
- declare const Flex: ({ children, className, direction, wrap, justify, align, flex, gap, padding, margin, component, ...props }: FlexProps) => import("react/jsx-runtime").JSX.Element;
84
+ declare const Flex: ({ children, className, style, direction, wrap, justify, align, flex, gap, padding, margin, component, ...props }: FlexProps) => import("react/jsx-runtime").JSX.Element;
83
85
  export { Flex, flexVariants };
84
86
  //# sourceMappingURL=Flex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Flex.d.ts","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EACL,KAAK,YAAY,EAGlB,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,CAAC,aAAa,CAAA;IAC3B,kEAAkE;IAClE,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,aAAa,GAAG,gBAAgB,CAAA;IAC/D,4EAA4E;IAC5E,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,cAAc,CAAA;IACzC,yDAAyD;IACzD,OAAO,CAAC,EACJ,OAAO,GACP,KAAK,GACL,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,CAAA;IACb,4DAA4D;IAC5D,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAA;IAC3D,0CAA0C;IAC1C,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;IACtC;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;IACzB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAA;IACjC;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAA;CAChC;AAED,QAAA,MAAM,IAAI,GAAI,kHAcX,SAAS,4CAwBX,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA"}
@@ -1,9 +1,9 @@
1
- import { jsx as x } from "react/jsx-runtime";
1
+ import { jsx as w } from "react/jsx-runtime";
2
2
  import "react";
3
- import { cva as w } from "class-variance-authority";
4
- import { getSpacingVariants as v, spacingVariantDefinitions as d } from "../../utils/spacing.js";
5
- import { cn as y } from "../../utils/cn.js";
6
- const j = w(
3
+ import { cva as v } from "class-variance-authority";
4
+ import { getSpacingVariants as d, spacingVariantDefinitions as y } from "../../utils/spacing.js";
5
+ import { cn as j } from "../../utils/cn.js";
6
+ const g = v(
7
7
  // Base classes
8
8
  "flex",
9
9
  {
@@ -41,7 +41,7 @@ const j = w(
41
41
  initial: "flex-initial",
42
42
  none: "flex-none"
43
43
  },
44
- ...d
44
+ ...y
45
45
  },
46
46
  defaultVariants: {
47
47
  direction: "row",
@@ -50,41 +50,43 @@ const j = w(
50
50
  align: "stretch"
51
51
  }
52
52
  }
53
- ), D = ({
53
+ ), F = ({
54
54
  children: e,
55
55
  className: t,
56
- direction: r,
57
- wrap: n,
58
- justify: i,
59
- align: s,
60
- flex: a,
61
- gap: o,
62
- padding: f,
63
- margin: l,
64
- component: c = "div",
65
- ...p
56
+ style: r,
57
+ direction: n,
58
+ wrap: i,
59
+ justify: s,
60
+ align: a,
61
+ flex: o,
62
+ gap: f,
63
+ padding: l,
64
+ margin: c,
65
+ component: p = "div",
66
+ ...m
66
67
  }) => {
67
- const m = c ?? "div", u = v({ gap: o, padding: f, margin: l });
68
- return /* @__PURE__ */ x(
69
- m,
68
+ const u = p ?? "div", x = d({ gap: f, padding: l, margin: c });
69
+ return /* @__PURE__ */ w(
70
+ u,
70
71
  {
71
- className: y(
72
- j({
73
- direction: r,
74
- wrap: n,
75
- justify: i,
76
- align: s,
77
- flex: a,
78
- ...u
72
+ className: j(
73
+ g({
74
+ direction: n,
75
+ wrap: i,
76
+ justify: s,
77
+ align: a,
78
+ flex: o,
79
+ ...x
79
80
  }),
80
81
  t
81
82
  ),
82
- ...p,
83
+ style: r,
84
+ ...m,
83
85
  children: e
84
86
  }
85
87
  );
86
88
  };
87
89
  export {
88
- D as Flex,
89
- j as flexVariants
90
+ F as Flex,
91
+ g as flexVariants
90
92
  };
@@ -0,0 +1,30 @@
1
+ import { ReactNode } from 'react';
2
+ export interface FormFieldProps {
3
+ /** The form control element (input, textarea, select trigger, etc.). */
4
+ children: ReactNode;
5
+ /** Label text displayed above the control. */
6
+ label?: string;
7
+ /** Helper or error text displayed below the control. */
8
+ hint?: string;
9
+ /** Renders the hint in an error color when true. */
10
+ error?: boolean;
11
+ /** Displays a red asterisk in the label when true. */
12
+ required?: boolean;
13
+ /**
14
+ * Hides the required asterisk (*) even when `required` is true.
15
+ * @default false
16
+ */
17
+ disableRequiredAsterisk?: boolean;
18
+ /** Associates the label with a form element by ID. */
19
+ htmlFor?: string;
20
+ /** ID for the label element (used with `aria-labelledby`). */
21
+ labelId?: string;
22
+ /** ID for the hint element (used with `aria-describedby`). */
23
+ hintId?: string;
24
+ /** Extra content rendered inline next to the label (e.g. a tooltip icon). */
25
+ labelExtra?: ReactNode;
26
+ /** Additional CSS classes for the outer wrapper. */
27
+ className?: string;
28
+ }
29
+ export declare const FormField: import('react').ForwardRefExoticComponent<FormFieldProps & import('react').RefAttributes<HTMLDivElement>>;
30
+ //# sourceMappingURL=FormField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAKlD,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,QAAQ,EAAE,SAAS,CAAA;IACnB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oDAAoD;IACpD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,6EAA6E;IAC7E,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,SAAS,2GAoDrB,CAAA"}