@vkzstudio/muza-ui 1.0.6 → 1.0.7

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 (81) hide show
  1. package/dist/components/Button/buttonVariants.d.ts +1 -1
  2. package/dist/components/Calendar/Calendar.d.ts +2 -2
  3. package/dist/components/Calendar/Calendar.d.ts.map +1 -1
  4. package/dist/components/Calendar/Calendar.js +158 -150
  5. package/dist/components/DataTable/DataTable.d.ts +17 -0
  6. package/dist/components/DataTable/DataTable.d.ts.map +1 -0
  7. package/dist/components/DataTable/DataTable.js +73 -0
  8. package/dist/components/DataTable/DataTable.stories.d.ts +10 -0
  9. package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -0
  10. package/dist/components/DataTable/index.d.ts +2 -0
  11. package/dist/components/DataTable/index.d.ts.map +1 -0
  12. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  13. package/dist/components/Dialog/Dialog.js +28 -26
  14. package/dist/components/ExpandableTable/Table.d.ts +1 -1
  15. package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
  16. package/dist/components/FileUpload/FileItem.js +81 -77
  17. package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
  18. package/dist/components/FileUpload/FileUpload.js +98 -94
  19. package/dist/components/Flex/Flex.d.ts +1 -1
  20. package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  21. package/dist/components/MultiSelect/MultiSelect.js +51 -50
  22. package/dist/components/MuzaUIProvider/MuzaUIProvider.d.ts +19 -0
  23. package/dist/components/MuzaUIProvider/MuzaUIProvider.d.ts.map +1 -0
  24. package/dist/components/MuzaUIProvider/MuzaUIProvider.js +19 -0
  25. package/dist/components/MuzaUIProvider/MuzaUIProvider.stories.d.ts +10 -0
  26. package/dist/components/MuzaUIProvider/MuzaUIProvider.stories.d.ts.map +1 -0
  27. package/dist/components/MuzaUIProvider/index.d.ts +2 -0
  28. package/dist/components/MuzaUIProvider/index.d.ts.map +1 -0
  29. package/dist/components/Searchbar/Searchbar.d.ts +1 -1
  30. package/dist/components/Searchbar/Searchbar.d.ts.map +1 -1
  31. package/dist/components/Searchbar/Searchbar.js +50 -49
  32. package/dist/components/Select/Select.d.ts.map +1 -1
  33. package/dist/components/Select/Select.js +43 -42
  34. package/dist/components/Stepper/Stepper.d.ts +1 -1
  35. package/dist/components/Stepper/Stepper.d.ts.map +1 -1
  36. package/dist/components/Stepper/Stepper.js +43 -42
  37. package/dist/components/SwipeButton/SwipeButton.d.ts +1 -1
  38. package/dist/components/SwipeButton/SwipeButton.d.ts.map +1 -1
  39. package/dist/components/SwipeButton/SwipeButton.js +85 -84
  40. package/dist/components/SwipeButton/SwipeButton.stories.d.ts +1 -1
  41. package/dist/components/Typography/Typography.d.ts +1 -1
  42. package/dist/components/index.d.ts +3 -0
  43. package/dist/components/index.d.ts.map +1 -1
  44. package/dist/index.js +204 -189
  45. package/dist/muza-ui.css +1 -1
  46. package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
  47. package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
  48. package/dist/node_modules/date-fns/constants.js +4 -0
  49. package/dist/node_modules/date-fns/constructFrom.js +8 -0
  50. package/dist/node_modules/date-fns/isSameWeek.js +14 -0
  51. package/dist/node_modules/date-fns/locale/cs/_lib/formatDistance.js +275 -0
  52. package/dist/node_modules/date-fns/locale/cs/_lib/formatLong.js +33 -0
  53. package/dist/node_modules/date-fns/locale/cs/_lib/formatRelative.js +25 -0
  54. package/dist/node_modules/date-fns/locale/cs/_lib/localize.js +167 -0
  55. package/dist/node_modules/date-fns/locale/cs/_lib/match.js +109 -0
  56. package/dist/node_modules/date-fns/locale/cs.js +21 -0
  57. package/dist/node_modules/date-fns/locale/sk/_lib/formatDistance.js +158 -0
  58. package/dist/node_modules/date-fns/locale/sk/_lib/formatLong.js +33 -0
  59. package/dist/node_modules/date-fns/locale/sk/_lib/formatRelative.js +60 -0
  60. package/dist/node_modules/date-fns/locale/sk/_lib/localize.js +175 -0
  61. package/dist/node_modules/date-fns/locale/sk/_lib/match.js +111 -0
  62. package/dist/node_modules/date-fns/locale/sk.js +21 -0
  63. package/dist/node_modules/date-fns/startOfWeek.js +11 -0
  64. package/dist/node_modules/date-fns/toDate.js +8 -0
  65. package/dist/translations/TranslationContext.d.ts +61 -0
  66. package/dist/translations/TranslationContext.d.ts.map +1 -0
  67. package/dist/translations/TranslationContext.js +74 -0
  68. package/dist/translations/index.d.ts +6 -0
  69. package/dist/translations/index.d.ts.map +1 -0
  70. package/dist/translations/locales/cs.d.ts +3 -0
  71. package/dist/translations/locales/cs.d.ts.map +1 -0
  72. package/dist/translations/locales/cs.js +52 -0
  73. package/dist/translations/locales/en.d.ts +3 -0
  74. package/dist/translations/locales/en.d.ts.map +1 -0
  75. package/dist/translations/locales/en.js +52 -0
  76. package/dist/translations/locales/sk.d.ts +3 -0
  77. package/dist/translations/locales/sk.d.ts.map +1 -0
  78. package/dist/translations/locales/sk.js +52 -0
  79. package/dist/translations/types.d.ts +118 -0
  80. package/dist/translations/types.d.ts.map +1 -0
  81. package/package.json +1 -1
@@ -1,9 +1,10 @@
1
1
  import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
2
  import { forwardRef as n } from "react";
3
3
  import * as a from "@radix-ui/react-dialog";
4
- import { XClose as p } from "../Icons/CustomIcons.js";
4
+ import { useMuzaTranslations as u } from "../../translations/TranslationContext.js";
5
+ import { XClose as f } from "../Icons/CustomIcons.js";
5
6
  import { cn as r } from "../../utils/cn.js";
6
- const v = a.Root, w = a.Title, N = a.Description, C = a.Trigger, g = a.Portal, b = a.Close, d = n(({ className: t, ...s }, o) => /* @__PURE__ */ e(
7
+ const h = a.Root, T = a.Title, z = a.Description, A = a.Trigger, y = a.Portal, L = a.Close, d = n(({ className: t, ...l }, o) => /* @__PURE__ */ e(
7
8
  a.Overlay,
8
9
  {
9
10
  ref: o,
@@ -11,21 +12,22 @@ const v = a.Root, w = a.Title, N = a.Description, C = a.Trigger, g = a.Portal, b
11
12
  "px- fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-surface-base-overlay px-layout-p-standard py-comp-dialog-p-hor-overlay data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
12
13
  t
13
14
  ),
14
- ...s
15
+ ...l
15
16
  }
16
17
  ));
17
18
  d.displayName = a.Overlay.displayName;
18
- const f = n(
19
- ({
20
- className: t,
21
- children: s,
22
- size: o = "medium",
23
- closeAriaLabel: l = "Close",
24
- ...m
25
- }, c) => /* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(d, { children: /* @__PURE__ */ i(
19
+ const D = ({
20
+ className: t,
21
+ children: l,
22
+ size: o = "medium",
23
+ closeAriaLabel: c,
24
+ ...m
25
+ }, p) => {
26
+ const g = u(), s = c ?? g.dialog.closeAriaLabel;
27
+ return /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(d, { children: /* @__PURE__ */ i(
26
28
  a.Content,
27
29
  {
28
- ref: c,
30
+ ref: p,
29
31
  className: r(
30
32
  "relative w-full rounded-2xl bg-surface-base-secondary p-comp-dialog-p pt-5xl 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",
31
33
  {
@@ -37,30 +39,30 @@ const f = n(
37
39
  ),
38
40
  ...m,
39
41
  children: [
40
- s,
42
+ l,
41
43
  /* @__PURE__ */ i(
42
44
  a.Close,
43
45
  {
44
46
  className: "absolute top-4 right-4 cursor-pointer transition-opacity focus-visible:focus-default disabled:pointer-events-none",
45
- "aria-label": l,
47
+ "aria-label": s,
46
48
  children: [
47
- /* @__PURE__ */ e(p, { className: "size-icon-small" }),
48
- /* @__PURE__ */ e("span", { className: "sr-only", children: l })
49
+ /* @__PURE__ */ e(f, { className: "size-icon-small" }),
50
+ /* @__PURE__ */ e("span", { className: "sr-only", children: s })
49
51
  ]
50
52
  }
51
53
  )
52
54
  ]
53
55
  }
54
- ) }) })
55
- );
56
- f.displayName = a.Content.displayName;
56
+ ) }) });
57
+ }, b = n(D);
58
+ b.displayName = a.Content.displayName;
57
59
  export {
58
- v as Dialog,
59
- b as DialogClose,
60
- f as DialogContent,
61
- N as DialogDescription,
60
+ h as Dialog,
61
+ L as DialogClose,
62
+ b as DialogContent,
63
+ z as DialogDescription,
62
64
  d as DialogOverlay,
63
- g as DialogPortal,
64
- w as DialogTitle,
65
- C as DialogTrigger
65
+ y as DialogPortal,
66
+ T as DialogTitle,
67
+ A as DialogTrigger
66
68
  };
@@ -11,7 +11,7 @@ declare const TableRow: import('react').ForwardRefExoticComponent<import('react'
11
11
  } & import('react').RefAttributes<HTMLTableRowElement>>;
12
12
  declare const TableHead: import('react').ForwardRefExoticComponent<import('react').ThHTMLAttributes<HTMLTableCellElement> & import('react').RefAttributes<HTMLTableCellElement>>;
13
13
  declare const TableCell: import('react').ForwardRefExoticComponent<import('react').TdHTMLAttributes<HTMLTableCellElement> & VariantProps<(props?: ({
14
- padding?: "none" | "default" | null | undefined;
14
+ padding?: "default" | "none" | null | undefined;
15
15
  expandablePosition?: "none" | "bottom" | "top" | null | undefined;
16
16
  } & import('class-variance-authority/types').ClassProp) | undefined) => string> & {
17
17
  isFirst?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileItem.tsx"],"names":[],"mappings":"AAwCA,UAAU,aAAa;IACrB,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;CAC/C;AAyDD,eAAO,MAAM,QAAQ,GAAI,yFAWtB,aAAa,4CA6If,CAAA"}
1
+ {"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileItem.tsx"],"names":[],"mappings":"AA4CA,UAAU,aAAa;IACrB,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;CAC/C;AAyDD,eAAO,MAAM,QAAQ,GAAI,yFAWtB,aAAa,4CAmJf,CAAA"}
@@ -1,20 +1,21 @@
1
- import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import * as n from "react";
3
- import { cva as y } from "class-variance-authority";
4
- import { Typography as p } from "../Typography/Typography.js";
5
- import { cn as l } from "../../utils/cn.js";
6
- import { GalleryOutline as k, CloseCircleBold as N, DownloadMinimalisticBold as w, TrashBinTrashBold as z } from "@solar-icons/react-perf";
7
- const C = (o, r) => {
8
- let t = null, i = null;
1
+ import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { cva as k } from "class-variance-authority";
4
+ import { useMuzaTranslations as w } from "../../translations/TranslationContext.js";
5
+ import { Typography as f } from "../Typography/Typography.js";
6
+ import { cn as i } from "../../utils/cn.js";
7
+ import { GalleryOutline as N, CloseCircleBold as z, DownloadMinimalisticBold as L, TrashBinTrashBold as U } from "@solar-icons/react-perf";
8
+ const B = (a, l, t) => {
9
+ let r = null, e = null;
9
10
  try {
10
- t = URL.createObjectURL(o), i = document.createElement("a"), i.href = t, i.download = o.name, i.style.display = "none", document.body.appendChild(i), i.click();
11
- } catch (a) {
12
- const c = a instanceof Error ? a.message : "Download failed";
13
- console.error("Download failed:", a), r == null || r(c, o);
11
+ r = URL.createObjectURL(a), e = document.createElement("a"), e.href = r, e.download = a.name, e.style.display = "none", document.body.appendChild(e), e.click();
12
+ } catch (d) {
13
+ const n = d instanceof Error ? d.message : t ?? "Download failed";
14
+ console.error("Download failed:", d), l == null || l(n, a);
14
15
  } finally {
15
- i && document.body.contains(i) && document.body.removeChild(i), t && URL.revokeObjectURL(t);
16
+ e && document.body.contains(e) && document.body.removeChild(e), r && URL.revokeObjectURL(r);
16
17
  }
17
- }, L = y(
18
+ }, C = k(
18
19
  [
19
20
  "flex flex-1 items-center gap-sm rounded-full border transition-colors",
20
21
  "relative pr-comp-input-p-hor pl-comp-input-p-hor",
@@ -59,123 +60,126 @@ const C = (o, r) => {
59
60
  size: "base"
60
61
  }
61
62
  }
62
- ), u = l([
63
+ ), b = i([
63
64
  "relative h-fit w-fit border-none rounded-full focus-visible-default",
64
65
  "before:absolute before:inset-[-3px]",
65
66
  "bg-none cursor-pointer disabled:cursor-not-allowed",
66
67
  "text-comp-file-upload-icon-def-secondary",
67
68
  "disabled:text-comp-file-upload-icon-def-disabled"
68
- ]), T = ({
69
- file: o,
70
- uploaded: r,
69
+ ]), D = ({
70
+ file: a,
71
+ uploaded: l,
71
72
  progress: t,
72
- size: i,
73
- disabled: a,
74
- readOnly: c = !1,
75
- note: f,
76
- error: d,
77
- onDelete: b,
78
- onError: g
73
+ size: r,
74
+ disabled: e,
75
+ readOnly: d = !1,
76
+ note: n,
77
+ error: c,
78
+ onDelete: h,
79
+ onError: v
79
80
  }) => {
80
- const [h, x] = n.useState(!1), v = n.useMemo(() => a ? "disabled" : d ? "error" : typeof t == "number" && t > 0 ? "loading" : "default", [a, d, t]), s = n.useMemo(() => {
81
- if (o.type.startsWith("image/"))
82
- return URL.createObjectURL(o);
83
- }, [o]);
84
- return n.useEffect(() => {
85
- x(!1);
86
- }, [o]), /* @__PURE__ */ m("li", { className: "flex flex-col gap-sm", children: [
87
- /* @__PURE__ */ m(
81
+ const s = w(), [x, g] = m.useState(!1), y = m.useMemo(() => e ? "disabled" : c ? "error" : typeof t == "number" && t > 0 ? "loading" : "default", [e, c, t]), p = m.useMemo(() => {
82
+ if (a.type.startsWith("image/"))
83
+ return URL.createObjectURL(a);
84
+ }, [a]);
85
+ return m.useEffect(() => {
86
+ g(!1);
87
+ }, [a]), /* @__PURE__ */ u("li", { className: "flex flex-col gap-sm", children: [
88
+ /* @__PURE__ */ u(
88
89
  "div",
89
90
  {
90
- className: l(
91
- L({
92
- variant: v,
93
- size: i
91
+ className: i(
92
+ C({
93
+ variant: y,
94
+ size: r
94
95
  })
95
96
  ),
96
97
  children: [
97
- s && !h && /* @__PURE__ */ e(
98
+ p && !x && /* @__PURE__ */ o(
98
99
  "img",
99
100
  {
100
- src: s,
101
- alt: o.name,
101
+ src: p,
102
+ alt: a.name,
102
103
  width: 24,
103
104
  height: 24,
104
- onError: () => x(!0),
105
- className: l("size-icon-medium shrink-0 rounded-xs object-cover", {
106
- "opacity-50 saturate-0": a
105
+ onError: () => g(!0),
106
+ className: i("size-icon-medium shrink-0 rounded-xs object-cover", {
107
+ "opacity-50 saturate-0": e
107
108
  })
108
109
  }
109
110
  ),
110
- s && h && /* @__PURE__ */ e(
111
- k,
111
+ p && x && /* @__PURE__ */ o(
112
+ N,
112
113
  {
113
- className: l(
114
+ className: i(
114
115
  "text-icon-dark-secondary size-icon-medium shrink-0",
115
116
  {
116
- "opacity-50": a
117
+ "opacity-50": e
117
118
  }
118
119
  )
119
120
  }
120
121
  ),
121
- /* @__PURE__ */ e(
122
- p,
122
+ /* @__PURE__ */ o(
123
+ f,
123
124
  {
124
125
  className: "flex-grow truncate",
125
126
  component: "span",
126
127
  size: "sm",
127
128
  fixY: !0,
128
- children: o.name
129
+ children: a.name
129
130
  }
130
131
  ),
131
- !r && /* @__PURE__ */ e(
132
+ !l && /* @__PURE__ */ o(
132
133
  "button",
133
134
  {
134
- disabled: a,
135
- onClick: b,
136
- className: l(
137
- u,
135
+ disabled: e,
136
+ onClick: h,
137
+ "aria-label": s.fileUpload.deleteButtonAriaLabel,
138
+ className: i(
139
+ b,
138
140
  "text-comp-file-upload-icon-def-secondary",
139
141
  "hover:text-comp-file-upload-icon-def-hover",
140
142
  "focus-visible:text-comp-file-upload-icon-def-focused",
141
143
  "disabled:text-comp-file-upload-icon-def-disabled"
142
144
  ),
143
- children: /* @__PURE__ */ e(N, { className: "size-icon-medium" })
145
+ children: /* @__PURE__ */ o(z, { className: "size-icon-medium" })
144
146
  }
145
147
  ),
146
- r && /* @__PURE__ */ m("div", { className: "flex gap-xl", children: [
147
- /* @__PURE__ */ e(
148
+ l && /* @__PURE__ */ u("div", { className: "flex gap-xl", children: [
149
+ /* @__PURE__ */ o(
148
150
  "button",
149
151
  {
150
- disabled: a,
151
- onClick: () => C(o, g),
152
- className: l(
153
- u,
152
+ disabled: e,
153
+ onClick: () => B(a, v, s.fileUpload.downloadError),
154
+ "aria-label": s.fileUpload.downloadButtonAriaLabel,
155
+ className: i(
156
+ b,
154
157
  "text-comp-file-upload-icon-brand-def",
155
158
  "hover:text-comp-file-upload-icon-brand-hover",
156
159
  "focus-visible:text-comp-file-upload-icon-brand-focused",
157
160
  "disabled:text-comp-file-upload-icon-brand-disabled"
158
161
  ),
159
- children: /* @__PURE__ */ e(w, { className: "size-icon-medium" })
162
+ children: /* @__PURE__ */ o(L, { className: "size-icon-medium" })
160
163
  }
161
164
  ),
162
- !c && /* @__PURE__ */ e(
165
+ !d && /* @__PURE__ */ o(
163
166
  "button",
164
167
  {
165
- disabled: a,
166
- onClick: b,
167
- className: l(
168
- u,
168
+ disabled: e,
169
+ onClick: h,
170
+ "aria-label": s.fileUpload.deleteButtonAriaLabel,
171
+ className: i(
172
+ b,
169
173
  "text-comp-file-upload-icon-error-def",
170
174
  "hover:text-comp-file-upload-icon-error-hover",
171
175
  "focus-visible:text-comp-file-upload-icon-error-focused",
172
176
  "disabled:text-comp-file-upload-icon-error-disabled"
173
177
  ),
174
- children: /* @__PURE__ */ e(z, { className: "size-icon-medium" })
178
+ children: /* @__PURE__ */ o(U, { className: "size-icon-medium" })
175
179
  }
176
180
  )
177
181
  ] }),
178
- typeof t == "number" && t !== 0 && /* @__PURE__ */ e(
182
+ typeof t == "number" && t !== 0 && /* @__PURE__ */ o(
179
183
  "div",
180
184
  {
181
185
  style: { width: `${t}%` },
@@ -185,30 +189,30 @@ const C = (o, r) => {
185
189
  ]
186
190
  }
187
191
  ),
188
- f && /* @__PURE__ */ e(
189
- p,
192
+ n && /* @__PURE__ */ o(
193
+ f,
190
194
  {
191
195
  size: "sm",
192
196
  component: "span",
193
197
  variant: "body",
194
198
  weight: "regular",
195
199
  className: "text-comp-input-text-secondary",
196
- children: f
200
+ children: n
197
201
  }
198
202
  ),
199
- d && /* @__PURE__ */ e(
200
- p,
203
+ c && /* @__PURE__ */ o(
204
+ f,
201
205
  {
202
206
  size: "sm",
203
207
  component: "span",
204
208
  variant: "body",
205
209
  weight: "regular",
206
210
  className: "text-comp-input-text-error",
207
- children: d
211
+ children: c
208
212
  }
209
213
  )
210
214
  ] });
211
215
  };
212
216
  export {
213
- T as FileItem
217
+ D as FileItem
214
218
  };
@@ -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,0BAA0B,CAAA;A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AAA;IACd,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,eAAe,CAAC,EAAE,IAAI,CACpB,eAAe,EACf,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAC1D,CAAA;IACD,gBAAgB,CAAC,EAAE,IAAI,EAAE,CAAA;IACzB,UAAU,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACvD,UAAU,CAAC,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC9B,SAAS,CAAC,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC7B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;IAC9C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;CACnC;AAED,QAAA,MAAM,UAAU,wFA+Mf,CAAA;AAGD,OAAO,EAAE,UAAU,EAAE,CAAA"}
@@ -1,13 +1,14 @@
1
- import { jsxs as m, jsx as i } from "react/jsx-runtime";
1
+ import { jsxs as n, jsx as i } from "react/jsx-runtime";
2
2
  import * as y from "react";
3
- import { cva as A } from "class-variance-authority";
4
- import { useDropzone as X } from "react-dropzone";
5
- import { FileItem as Y } from "./FileItem.js";
6
- import { Flex as I } from "../Flex/Flex.js";
7
- import { Typography as n } from "../Typography/Typography.js";
8
- import { cn as R } from "../../utils/cn.js";
9
- import { CloudUploadOutline as Z } from "@solar-icons/react-perf";
10
- const D = A(
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(
11
12
  [
12
13
  "group relative cursor-pointer rounded-xl border-1 border-dashed transition-colors",
13
14
  "p-4xl pt-3xl pr-4xl pb-3xl",
@@ -43,7 +44,7 @@ const D = A(
43
44
  }
44
45
  }
45
46
  }
46
- ), H = A(
47
+ ), te = P(
47
48
  [
48
49
  "text-center transition-colors",
49
50
  "text-comp-file-upload-text-dark-secondary"
@@ -55,148 +56,151 @@ const D = A(
55
56
  }
56
57
  }
57
58
  }
58
- ), C = y.forwardRef(
59
+ ), oe = y.forwardRef(
59
60
  ({
60
- className: M,
61
- onDrop: x,
61
+ className: S,
62
+ onDrop: g,
62
63
  accept: f,
63
- multiple: k = !0,
64
+ multiple: U = !0,
64
65
  maxSize: b,
65
- maxSizeErrorMessage: F,
66
- size: P = "base",
66
+ maxSizeErrorMessage: T,
67
+ size: V = "base",
67
68
  disabled: p = !1,
68
- readOnly: g = !1,
69
- dropzoneOptions: V,
70
- label: u,
71
- title: B = "Nahraj soubor nebo obrázek",
72
- subtitle: w,
73
- preselectedFiles: K = [],
74
- fileStatus: T = [],
75
- itemErrors: h,
76
- itemHints: v,
77
- error: _,
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,
78
79
  onError: o,
79
- onDelete: z,
80
+ onDelete: M,
80
81
  onChange: c,
81
- ...q
82
- }, G) => {
83
- const [N, $] = y.useState(K), [S, U] = y.useState(!1), j = b ? `Max file size: ${(b / (1024 * 1024)).toFixed(0)}MB` : "", { getRootProps: J, getInputProps: L, isDragActive: O } = X({
84
- onDrop: (t, d) => {
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
+ "{size}",
86
+ (b / (1024 * 1024)).toFixed(0)
87
+ ) : "", R = T ?? I, { getRootProps: Q, getInputProps: W, isDragActive: X } = D({
88
+ onDrop: (t, a) => {
85
89
  try {
86
- if (U(!1), d.length > 0 && d.some(
87
- (l) => l.errors.some((r) => r.code === "file-too-large")
90
+ if ($(!1), a.length > 0 && a.some(
91
+ (r) => r.errors.some((l) => l.code === "file-too-large")
88
92
  )) {
89
- U(!0);
90
- const l = F || j;
91
- o == null || o(l, d[0].file);
93
+ $(!0);
94
+ const r = R || I;
95
+ o == null || o(r, a[0].file);
92
96
  return;
93
97
  }
94
- $((e) => {
95
- const l = new Set(
98
+ F((e) => {
99
+ const r = new Set(
96
100
  e.map((s) => `${s.name}-${s.size}-${s.lastModified}`)
97
- ), r = t.filter(
98
- (s) => !l.has(`${s.name}-${s.size}-${s.lastModified}`)
99
- ), a = [...e, ...r];
100
- return c == null || c(a), a;
101
- }), x == null || x(t);
101
+ ), l = t.filter(
102
+ (s) => !r.has(`${s.name}-${s.size}-${s.lastModified}`)
103
+ ), d = [...e, ...l];
104
+ return c == null || c(d), d;
105
+ }), g == null || g(t);
102
106
  } catch (e) {
103
- const l = e instanceof Error ? e.message : "Failed to process files";
104
- o == null || o(l);
107
+ const r = e instanceof Error ? e.message : u.fileUpload.processingError;
108
+ o == null || o(r);
105
109
  }
106
110
  },
107
111
  accept: typeof f == "string" ? { [f]: [] } : f ? Object.fromEntries(f.map((t) => [t, []])) : void 0,
108
- multiple: k,
112
+ multiple: U,
109
113
  maxSize: b,
110
114
  disabled: p,
111
- ...V
112
- }), Q = g || !k && N.length > 0;
113
- return /* @__PURE__ */ m(I, { direction: "column", gap: "lg", children: [
114
- !Q && /* @__PURE__ */ m(I, { direction: "column", gap: "sm", children: [
115
- u && (typeof u == "string" ? /* @__PURE__ */ i(
116
- n,
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,
117
121
  {
118
122
  size: "sm",
119
123
  component: "label",
120
124
  weight: "regular",
121
125
  variant: "body",
122
126
  className: "caret-comp-input-text-primary",
123
- children: u
127
+ children: m
124
128
  }
125
- ) : u),
126
- /* @__PURE__ */ m(
129
+ ) : m),
130
+ /* @__PURE__ */ n(
127
131
  "div",
128
132
  {
129
- ref: G,
133
+ ref: L,
130
134
  tabIndex: p ? void 0 : 0,
131
- className: R(
132
- D({
133
- error: _ || S,
135
+ className: A(
136
+ ee({
137
+ error: G || N,
134
138
  disabled: p,
135
- className: M,
136
- isDragActive: O
139
+ className: S,
140
+ isDragActive: X
137
141
  })
138
142
  ),
139
- ...J(),
140
- ...q,
143
+ ...Q(),
144
+ ...J,
141
145
  children: [
142
- /* @__PURE__ */ i("input", { ...L() }),
143
- /* @__PURE__ */ i(Z, { className: "inline size-comp-file-upload-ico-size" }),
144
- /* @__PURE__ */ m("div", { children: [
145
- /* @__PURE__ */ i(n, { size: "base", component: "p", weight: "medium", children: B }),
146
- w && /* @__PURE__ */ i(
147
- n,
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,
148
152
  {
149
153
  size: "sm",
150
154
  component: "p",
151
155
  weight: "regular",
152
- className: R(
153
- H({
156
+ className: A(
157
+ te({
154
158
  disabled: p,
155
- className: M
159
+ className: S
156
160
  })
157
161
  ),
158
- children: w
162
+ children: k
159
163
  }
160
164
  )
161
165
  ] })
162
166
  ]
163
167
  }
164
168
  ),
165
- S && /* @__PURE__ */ i(
166
- n,
169
+ N && /* @__PURE__ */ i(
170
+ x,
167
171
  {
168
172
  size: "sm",
169
173
  variant: "body",
170
174
  component: "p",
171
175
  weight: "regular",
172
176
  className: "text-comp-file-upload-text-error-def",
173
- children: F || j
177
+ children: R
174
178
  }
175
179
  )
176
180
  ] }),
177
- /* @__PURE__ */ i("ul", { className: "flex flex-col gap-md", children: N.map((t, d) => {
178
- const e = T[d], l = e == null ? void 0 : e.uploaded;
179
- return g && !l ? null : /* @__PURE__ */ i(
180
- Y,
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,
181
185
  {
182
186
  file: t,
183
- uploaded: l,
187
+ uploaded: r,
184
188
  progress: e == null ? void 0 : e.progress,
185
189
  disabled: p,
186
- readOnly: g,
187
- error: h == null ? void 0 : h.get(t),
188
- note: v == null ? void 0 : v.get(t),
190
+ readOnly: h,
191
+ error: v == null ? void 0 : v.get(t),
192
+ note: z == null ? void 0 : z.get(t),
189
193
  onError: o,
190
- size: P,
194
+ size: V,
191
195
  onDelete: () => {
192
196
  try {
193
- $((r) => {
194
- const a = r.filter((s, W) => W !== d);
195
- return c == null || c(a), a;
196
- }), z == null || z(t, d);
197
- } catch (r) {
198
- const a = r instanceof Error ? r.message : "Failed to delete file";
199
- o == null || o(a, t);
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);
200
204
  }
201
205
  }
202
206
  },
@@ -206,7 +210,7 @@ const D = A(
206
210
  ] });
207
211
  }
208
212
  );
209
- C.displayName = "FileUpload";
213
+ oe.displayName = "FileUpload";
210
214
  export {
211
- C as FileUpload
215
+ oe as FileUpload
212
216
  };