@vkzstudio/muza-ui 1.0.21 → 1.0.22

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.
@@ -25,19 +25,19 @@ const Q = o.Root, U = o.Title, Z = o.Description, A = ({
25
25
  children: s,
26
26
  title: c,
27
27
  hideCloseButton: n = !1,
28
- closeAriaLabel: u,
29
- ...f
28
+ closeAriaLabel: f,
29
+ ...u
30
30
  }, h) => {
31
- const y = T(), x = u ?? y.dialog.closeAriaLabel;
31
+ const y = T(), x = f ?? y.dialog.closeAriaLabel;
32
32
  return /* @__PURE__ */ a(
33
33
  "div",
34
34
  {
35
35
  ref: h,
36
36
  className: i(
37
- "py-comp-dialog-p-hor -mx-comp-dialog-p -mt-comp-dialog-p border-b border-stroke-base-primary px-comp-dialog-p",
37
+ "-mx-comp-dialog-p -mt-comp-dialog-p border-b border-stroke-base-primary px-comp-dialog-p py-comp-dialog-p-hor-def",
38
38
  l
39
39
  ),
40
- ...f,
40
+ ...u,
41
41
  children: /* @__PURE__ */ g("div", { className: "flex items-center gap-4xl", children: [
42
42
  /* @__PURE__ */ g("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
43
43
  t && /* @__PURE__ */ a("span", { className: "text-surface-brand-primary [&>svg]:size-icon-medium", children: t }),
@@ -105,8 +105,8 @@ const X = b(
105
105
  size: s = "medium",
106
106
  closeAriaLabel: c,
107
107
  ...n
108
- }, u) => {
109
- const f = T(), h = c ?? f.dialog.closeAriaLabel, [y, x] = O(!1), d = E(null), v = S.toArray(t), w = v.find(
108
+ }, f) => {
109
+ const u = T(), h = c ?? u.dialog.closeAriaLabel, [y, x] = O(!1), d = E(null), v = S.toArray(t), w = v.find(
110
110
  (e) => {
111
111
  var r;
112
112
  return C(e) && ((r = e.type) == null ? void 0 : r.displayName) === "DialogHeader";
@@ -131,7 +131,7 @@ const X = b(
131
131
  return /* @__PURE__ */ a(W, { children: /* @__PURE__ */ a(L, { children: /* @__PURE__ */ a(
132
132
  o.Content,
133
133
  {
134
- ref: u,
134
+ ref: f,
135
135
  className: i(
136
136
  "relative flex w-full flex-col rounded-2xl bg-surface-base-secondary p-comp-dialog-p duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
137
137
  {
@@ -34,7 +34,7 @@ const E = (e, a, t) => {
34
34
  "border-comp-file-upload-stroke-def-def",
35
35
  "bg-comp-input-fill-def leading-[140%]",
36
36
  "text-comp-file-upload-text-dark-secondary",
37
- "font-regular"
37
+ "font-medium"
38
38
  ],
39
39
  error: [
40
40
  "border-comp-file-upload-stroke-error-def",
@@ -42,6 +42,10 @@ export interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElemen
42
42
  maxSize?: number;
43
43
  /** Custom error message when a file exceeds `maxSize`. Defaults to a translated message with the size in MB. */
44
44
  maxSizeErrorMessage?: string;
45
+ /** Maximum number of files allowed. When reached, the dropzone is hidden. */
46
+ maxFiles?: number;
47
+ /** Custom error message when file count exceeds `maxFiles`. Defaults to a translated message. */
48
+ maxFilesErrorMessage?: string;
45
49
  /** Controls the visual size of file items in the list. @default 'base' */
46
50
  size?: 'sm' | 'base' | 'lg';
47
51
  /** Prevents interaction and applies disabled styling. @default false */
@@ -65,7 +69,7 @@ export interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElemen
65
69
  * Props managed by the component (`onDrop`, `accept`, `multiple`, `maxSize`, `disabled`) are excluded.
66
70
  * @see DropzoneOptions
67
71
  */
68
- dropzoneOptions?: Omit<DropzoneOptions, 'onDrop' | 'accept' | 'multiple' | 'maxSize' | 'disabled'>;
72
+ dropzoneOptions?: Omit<DropzoneOptions, 'onDrop' | 'accept' | 'multiple' | 'maxSize' | 'maxFiles' | 'disabled'>;
69
73
  /** Files displayed in the list on mount. @default [] */
70
74
  preselectedFiles?: File[];
71
75
  /**
@@ -1 +1 @@
1
- {"version":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EAA6E;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;IAC3D,6EAA6E;IAC7E,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,gHAAgH;IAChH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,QAAA,MAAM,UAAU,wFAsRf,CAAA;AAGD,OAAO,EAAE,UAAU,EAAE,CAAA"}
@@ -1,15 +1,15 @@
1
- import { jsxs as f, jsx as a, Fragment as re } from "react/jsx-runtime";
2
- import * as y from "react";
3
- import { cva as G } from "class-variance-authority";
4
- import { useDropzone as le } from "react-dropzone";
5
- import { FileItem as K } from "./FileItem.js";
6
- import { useMuzaTranslations as se } from "../../translations/TranslationContext.js";
7
- import { Flex as _ } from "../Flex/Flex.js";
8
- import { FormField as ie } from "../FormField/FormField.js";
9
- import { cn as B } from "../../utils/cn.js";
10
- import { CloudUploadOutline as ae } from "@solar-icons/react-perf";
11
- import { Typography as k } from "../Typography/Typography.js";
12
- const de = G(
1
+ import { jsxs as n, jsx as a, Fragment as pe } from "react/jsx-runtime";
2
+ import * as v from "react";
3
+ import { cva as Y } from "class-variance-authority";
4
+ import { useDropzone as ue } from "react-dropzone";
5
+ import { FileItem as Q } from "./FileItem.js";
6
+ import { useMuzaTranslations as fe } from "../../translations/TranslationContext.js";
7
+ import { Flex as W } from "../Flex/Flex.js";
8
+ import { FormField as ne } from "../FormField/FormField.js";
9
+ import { cn as X } from "../../utils/cn.js";
10
+ import { CloudUploadOutline as me } from "@solar-icons/react-perf";
11
+ import { Typography as M } from "../Typography/Typography.js";
12
+ const ge = Y(
13
13
  [
14
14
  "group relative cursor-pointer rounded-xl border-1 border-dashed transition-colors",
15
15
  "p-4xl pt-3xl pr-4xl pb-3xl",
@@ -45,7 +45,7 @@ const de = G(
45
45
  }
46
46
  }
47
47
  }
48
- ), pe = G(
48
+ ), xe = Y(
49
49
  [
50
50
  "text-center transition-colors",
51
51
  "text-comp-file-upload-text-dark-secondary"
@@ -57,119 +57,139 @@ const de = G(
57
57
  }
58
58
  }
59
59
  }
60
- ), ce = y.forwardRef(
60
+ ), he = v.forwardRef(
61
61
  ({
62
- className: $,
63
- onDrop: x,
64
- accept: u,
65
- multiple: w = !0,
66
- maxSize: g,
67
- maxSizeErrorMessage: J,
68
- size: N = "base",
62
+ className: U,
63
+ onDrop: z,
64
+ accept: m,
65
+ multiple: A = !0,
66
+ maxSize: y,
67
+ maxSizeErrorMessage: Z,
68
+ maxFiles: i,
69
+ maxFilesErrorMessage: q,
70
+ size: P = "base",
69
71
  disabled: p = !1,
70
- readOnly: m = !1,
71
- dropzoneOptions: L,
72
- label: I,
73
- title: Q,
74
- subtitle: R,
75
- preselectedFiles: W = [],
76
- fileStatus: X = [],
77
- itemErrors: b,
78
- itemHints: h,
79
- error: Y,
80
- required: v,
81
- disableRequiredAsterisk: Z,
72
+ readOnly: g = !1,
73
+ dropzoneOptions: O,
74
+ label: V,
75
+ title: H,
76
+ subtitle: K,
77
+ preselectedFiles: D = [],
78
+ fileStatus: C = [],
79
+ itemErrors: S,
80
+ itemHints: F,
81
+ error: E,
82
+ required: k,
83
+ disableRequiredAsterisk: ee,
82
84
  onError: t,
83
- onDelete: z,
84
- onChange: c,
85
- preselectedUrls: M = [],
86
- onDeleteUrl: F,
87
- labelExtra: q,
88
- infoTooltip: O,
89
- ...H
90
- }, D) => {
91
- const n = se(), [S, U] = y.useState(W), [j, A] = y.useState(!1), E = Q ?? n.fileUpload.title, P = g ? n.fileUpload.maxSizeError.replace(
85
+ onDelete: w,
86
+ onChange: u,
87
+ preselectedUrls: x = [],
88
+ onDeleteUrl: $,
89
+ labelExtra: te,
90
+ infoTooltip: oe,
91
+ ...le
92
+ }, se) => {
93
+ const f = fe(), [h, _] = v.useState(D), [j, N] = v.useState(!1), [B, b] = v.useState(!1), T = h.length + x.length, re = H ?? f.fileUpload.title, I = i != null ? f.fileUpload.maxFilesError.replace("{count}", String(i)) : "", R = q ?? I, G = y ? f.fileUpload.maxSizeError.replace(
92
94
  "{size}",
93
- (g / (1024 * 1024)).toFixed(0)
94
- ) : "", T = J ?? P, { getRootProps: C, getInputProps: ee, isDragActive: oe } = le({
95
- onDrop: (e, l) => {
95
+ (y / (1024 * 1024)).toFixed(0)
96
+ ) : "", J = Z ?? G, { getRootProps: ae, getInputProps: ie, isDragActive: de } = ue({
97
+ onDrop: (e, s) => {
96
98
  try {
97
- if (A(!1), l.length > 0 && l.some(
98
- (r) => r.errors.some((s) => s.code === "file-too-large")
99
- )) {
100
- A(!0);
101
- const r = T || P;
102
- t == null || t(r, l[0].file);
99
+ if (N(!1), b(!1), s.length > 0) {
100
+ const o = s.some(
101
+ (l) => l.errors.some((r) => r.code === "file-too-large")
102
+ );
103
+ if (s.some(
104
+ (l) => l.errors.some((r) => r.code === "too-many-files")
105
+ )) {
106
+ b(!0);
107
+ const l = R || I;
108
+ t == null || t(l, s[0].file);
109
+ return;
110
+ }
111
+ if (o) {
112
+ N(!0);
113
+ const l = J || G;
114
+ t == null || t(l, s[0].file);
115
+ return;
116
+ }
117
+ }
118
+ if (i != null && T + e.length > i) {
119
+ b(!0);
120
+ const o = R || I;
121
+ t == null || t(o);
103
122
  return;
104
123
  }
105
- U((o) => {
106
- const r = new Set(
107
- o.map((i) => `${i.name}-${i.size}-${i.lastModified}`)
108
- ), s = e.filter(
109
- (i) => !r.has(`${i.name}-${i.size}-${i.lastModified}`)
110
- ), d = [...o, ...s];
111
- return c == null || c(d), d;
112
- }), x == null || x(e);
124
+ _((o) => {
125
+ const c = new Set(
126
+ o.map((d) => `${d.name}-${d.size}-${d.lastModified}`)
127
+ ), l = e.filter(
128
+ (d) => !c.has(`${d.name}-${d.size}-${d.lastModified}`)
129
+ ), r = [...o, ...l];
130
+ return u == null || u(r), r;
131
+ }), z == null || z(e);
113
132
  } catch (o) {
114
- const r = o instanceof Error ? o.message : n.fileUpload.processingError;
115
- t == null || t(r);
133
+ const c = o instanceof Error ? o.message : f.fileUpload.processingError;
134
+ t == null || t(c);
116
135
  }
117
136
  },
118
- accept: typeof u == "string" ? { [u]: [] } : u ? Object.fromEntries(u.map((e) => [e, []])) : void 0,
119
- multiple: w,
120
- maxSize: g,
137
+ accept: typeof m == "string" ? { [m]: [] } : m ? Object.fromEntries(m.map((e) => [e, []])) : void 0,
138
+ multiple: A,
139
+ maxSize: y,
140
+ maxFiles: i != null ? i - T : void 0,
121
141
  disabled: p,
122
- ...L
123
- }), V = m || !w && (S.length > 0 || M.length > 0);
124
- return /* @__PURE__ */ f(_, { direction: "column", gap: "lg", children: [
125
- (!V || I) && /* @__PURE__ */ a(
126
- ie,
142
+ ...O
143
+ }), L = g || !A && (h.length > 0 || x.length > 0) || i != null && T >= i;
144
+ return /* @__PURE__ */ n(W, { direction: "column", gap: "lg", children: [
145
+ (!L || V) && /* @__PURE__ */ a(
146
+ ne,
127
147
  {
128
- label: I,
129
- required: v,
130
- disableRequiredAsterisk: Z,
131
- labelExtra: q,
132
- infoTooltip: O,
133
- children: !V && /* @__PURE__ */ f(re, { children: [
134
- /* @__PURE__ */ f(
148
+ label: V,
149
+ required: k,
150
+ disableRequiredAsterisk: ee,
151
+ labelExtra: te,
152
+ infoTooltip: oe,
153
+ children: !L && /* @__PURE__ */ n(pe, { children: [
154
+ /* @__PURE__ */ n(
135
155
  "div",
136
156
  {
137
- ref: D,
157
+ ref: se,
138
158
  tabIndex: p ? void 0 : 0,
139
- className: B(
140
- de({
141
- error: Y || j,
159
+ className: X(
160
+ ge({
161
+ error: E || j || B,
142
162
  disabled: p,
143
- className: $,
144
- isDragActive: oe
163
+ className: U,
164
+ isDragActive: de
145
165
  })
146
166
  ),
147
- ...C(),
148
- ...H,
167
+ ...ae(),
168
+ ...le,
149
169
  children: [
150
170
  /* @__PURE__ */ a(
151
171
  "input",
152
172
  {
153
- ...ee({ required: v }),
154
- "aria-required": v
173
+ ...ie({ required: k }),
174
+ "aria-required": k
155
175
  }
156
176
  ),
157
- /* @__PURE__ */ a(ae, { className: "inline size-comp-file-upload-ico-size" }),
158
- /* @__PURE__ */ f("div", { children: [
159
- /* @__PURE__ */ a(k, { size: "base", component: "p", weight: "medium", children: E }),
160
- R && /* @__PURE__ */ a(
161
- k,
177
+ /* @__PURE__ */ a(me, { className: "inline size-comp-file-upload-ico-size" }),
178
+ /* @__PURE__ */ n("div", { children: [
179
+ /* @__PURE__ */ a(M, { size: "base", component: "p", weight: "medium", children: re }),
180
+ K && /* @__PURE__ */ a(
181
+ M,
162
182
  {
163
183
  size: "sm",
164
184
  component: "p",
165
185
  weight: "regular",
166
- className: B(
167
- pe({
186
+ className: X(
187
+ xe({
168
188
  disabled: p,
169
- className: $
189
+ className: U
170
190
  })
171
191
  ),
172
- children: R
192
+ children: K
173
193
  }
174
194
  )
175
195
  ] })
@@ -177,22 +197,33 @@ const de = G(
177
197
  }
178
198
  ),
179
199
  j && /* @__PURE__ */ a(
180
- k,
200
+ M,
201
+ {
202
+ size: "sm",
203
+ variant: "body",
204
+ component: "p",
205
+ weight: "regular",
206
+ className: "text-comp-file-upload-text-error-def",
207
+ children: J
208
+ }
209
+ ),
210
+ B && /* @__PURE__ */ a(
211
+ M,
181
212
  {
182
213
  size: "sm",
183
214
  variant: "body",
184
215
  component: "p",
185
216
  weight: "regular",
186
217
  className: "text-comp-file-upload-text-error-def",
187
- children: T
218
+ children: R
188
219
  }
189
220
  )
190
221
  ] })
191
222
  }
192
223
  ),
193
- (M.length > 0 || S.length > 0) && /* @__PURE__ */ f(_, { component: "ul", direction: "column", gap: "md", children: [
194
- M.map((e, l) => /* @__PURE__ */ a(
195
- K,
224
+ (x.length > 0 || h.length > 0) && /* @__PURE__ */ n(W, { component: "ul", direction: "column", gap: "md", children: [
225
+ x.map((e, s) => /* @__PURE__ */ a(
226
+ Q,
196
227
  {
197
228
  source: "url",
198
229
  url: e.url,
@@ -200,36 +231,36 @@ const de = G(
200
231
  type: e.type,
201
232
  uploaded: !0,
202
233
  disabled: p,
203
- readOnly: m,
204
- size: N,
205
- onDelete: () => F == null ? void 0 : F(e, l)
234
+ readOnly: g,
235
+ size: P,
236
+ onDelete: () => $ == null ? void 0 : $(e, s)
206
237
  },
207
238
  `url-${e.url}`
208
239
  )),
209
- S.map((e, l) => {
210
- const o = X[l], r = o == null ? void 0 : o.uploaded;
211
- return m && !r ? null : /* @__PURE__ */ a(
212
- K,
240
+ h.map((e, s) => {
241
+ const o = C[s], c = o == null ? void 0 : o.uploaded;
242
+ return g && !c ? null : /* @__PURE__ */ a(
243
+ Q,
213
244
  {
214
245
  source: "file",
215
246
  file: e,
216
- uploaded: r,
247
+ uploaded: c,
217
248
  progress: o == null ? void 0 : o.progress,
218
249
  disabled: p,
219
- readOnly: m,
220
- error: b == null ? void 0 : b.get(e),
221
- note: h == null ? void 0 : h.get(e),
250
+ readOnly: g,
251
+ error: S == null ? void 0 : S.get(e),
252
+ note: F == null ? void 0 : F.get(e),
222
253
  onError: t,
223
- size: N,
254
+ size: P,
224
255
  onDelete: () => {
225
256
  try {
226
- U((s) => {
227
- const d = s.filter((i, te) => te !== l);
228
- return c == null || c(d), d;
229
- }), z == null || z(e, l);
230
- } catch (s) {
231
- const d = s instanceof Error ? s.message : n.fileUpload.deleteError;
232
- t == null || t(d, e);
257
+ b(!1), N(!1), _((l) => {
258
+ const r = l.filter((d, ce) => ce !== s);
259
+ return u == null || u(r), r;
260
+ }), w == null || w(e, s);
261
+ } catch (l) {
262
+ const r = l instanceof Error ? l.message : f.fileUpload.deleteError;
263
+ t == null || t(r, e);
233
264
  }
234
265
  }
235
266
  },
@@ -240,7 +271,7 @@ const de = G(
240
271
  ] });
241
272
  }
242
273
  );
243
- ce.displayName = "FileUpload";
274
+ he.displayName = "FileUpload";
244
275
  export {
245
- ce as FileUpload
276
+ he as FileUpload
246
277
  };
@@ -17,6 +17,8 @@ export declare const Disabled: Story;
17
17
  export declare const WithErrorsAndHints: Story;
18
18
  export declare const ReadOnly: Story;
19
19
  export declare const UploadSimulation: Story;
20
+ export declare const WithMaxFiles: Story;
21
+ export declare const WithMaxFilesAndPreselected: Story;
20
22
  export declare const PreselectedUrls: Story;
21
23
  export declare const MixedFilesAndUrls: Story;
22
24
  export declare const SingleFileWithUrl: Story;
@@ -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,EAAuB,MAAM,cAAc,CAAA;AAE9D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAoLjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,OAAO,EAAE,KAiBrB,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;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