@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.
- package/dist/components/Button/buttonVariants.d.ts +1 -1
- package/dist/components/Calendar/Calendar.d.ts +2 -2
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +158 -150
- package/dist/components/DataTable/DataTable.d.ts +17 -0
- package/dist/components/DataTable/DataTable.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.js +73 -0
- package/dist/components/DataTable/DataTable.stories.d.ts +10 -0
- package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -0
- package/dist/components/DataTable/index.d.ts +2 -0
- package/dist/components/DataTable/index.d.ts.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +28 -26
- package/dist/components/ExpandableTable/Table.d.ts +1 -1
- package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
- package/dist/components/FileUpload/FileItem.js +81 -77
- package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/components/FileUpload/FileUpload.js +98 -94
- package/dist/components/Flex/Flex.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +51 -50
- package/dist/components/MuzaUIProvider/MuzaUIProvider.d.ts +19 -0
- package/dist/components/MuzaUIProvider/MuzaUIProvider.d.ts.map +1 -0
- package/dist/components/MuzaUIProvider/MuzaUIProvider.js +19 -0
- package/dist/components/MuzaUIProvider/MuzaUIProvider.stories.d.ts +10 -0
- package/dist/components/MuzaUIProvider/MuzaUIProvider.stories.d.ts.map +1 -0
- package/dist/components/MuzaUIProvider/index.d.ts +2 -0
- package/dist/components/MuzaUIProvider/index.d.ts.map +1 -0
- package/dist/components/Searchbar/Searchbar.d.ts +1 -1
- package/dist/components/Searchbar/Searchbar.d.ts.map +1 -1
- package/dist/components/Searchbar/Searchbar.js +50 -49
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +43 -42
- package/dist/components/Stepper/Stepper.d.ts +1 -1
- package/dist/components/Stepper/Stepper.d.ts.map +1 -1
- package/dist/components/Stepper/Stepper.js +43 -42
- package/dist/components/SwipeButton/SwipeButton.d.ts +1 -1
- package/dist/components/SwipeButton/SwipeButton.d.ts.map +1 -1
- package/dist/components/SwipeButton/SwipeButton.js +85 -84
- package/dist/components/SwipeButton/SwipeButton.stories.d.ts +1 -1
- package/dist/components/Typography/Typography.d.ts +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.js +204 -189
- package/dist/muza-ui.css +1 -1
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
- package/dist/node_modules/date-fns/constants.js +4 -0
- package/dist/node_modules/date-fns/constructFrom.js +8 -0
- package/dist/node_modules/date-fns/isSameWeek.js +14 -0
- package/dist/node_modules/date-fns/locale/cs/_lib/formatDistance.js +275 -0
- package/dist/node_modules/date-fns/locale/cs/_lib/formatLong.js +33 -0
- package/dist/node_modules/date-fns/locale/cs/_lib/formatRelative.js +25 -0
- package/dist/node_modules/date-fns/locale/cs/_lib/localize.js +167 -0
- package/dist/node_modules/date-fns/locale/cs/_lib/match.js +109 -0
- package/dist/node_modules/date-fns/locale/cs.js +21 -0
- package/dist/node_modules/date-fns/locale/sk/_lib/formatDistance.js +158 -0
- package/dist/node_modules/date-fns/locale/sk/_lib/formatLong.js +33 -0
- package/dist/node_modules/date-fns/locale/sk/_lib/formatRelative.js +60 -0
- package/dist/node_modules/date-fns/locale/sk/_lib/localize.js +175 -0
- package/dist/node_modules/date-fns/locale/sk/_lib/match.js +111 -0
- package/dist/node_modules/date-fns/locale/sk.js +21 -0
- package/dist/node_modules/date-fns/startOfWeek.js +11 -0
- package/dist/node_modules/date-fns/toDate.js +8 -0
- package/dist/translations/TranslationContext.d.ts +61 -0
- package/dist/translations/TranslationContext.d.ts.map +1 -0
- package/dist/translations/TranslationContext.js +74 -0
- package/dist/translations/index.d.ts +6 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/locales/cs.d.ts +3 -0
- package/dist/translations/locales/cs.d.ts.map +1 -0
- package/dist/translations/locales/cs.js +52 -0
- package/dist/translations/locales/en.d.ts +3 -0
- package/dist/translations/locales/en.d.ts.map +1 -0
- package/dist/translations/locales/en.js +52 -0
- package/dist/translations/locales/sk.d.ts +3 -0
- package/dist/translations/locales/sk.d.ts.map +1 -0
- package/dist/translations/locales/sk.js +52 -0
- package/dist/translations/types.d.ts +118 -0
- package/dist/translations/types.d.ts.map +1 -0
- 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 {
|
|
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
|
|
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
|
-
...
|
|
15
|
+
...l
|
|
15
16
|
}
|
|
16
17
|
));
|
|
17
18
|
d.displayName = a.Overlay.displayName;
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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:
|
|
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
|
-
|
|
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":
|
|
47
|
+
"aria-label": s,
|
|
46
48
|
children: [
|
|
47
|
-
/* @__PURE__ */ e(
|
|
48
|
-
/* @__PURE__ */ e("span", { className: "sr-only", children:
|
|
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
|
-
|
|
56
|
+
) }) });
|
|
57
|
+
}, b = n(D);
|
|
58
|
+
b.displayName = a.Content.displayName;
|
|
57
59
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
h as Dialog,
|
|
61
|
+
L as DialogClose,
|
|
62
|
+
b as DialogContent,
|
|
63
|
+
z as DialogDescription,
|
|
62
64
|
d as DialogOverlay,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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?: "
|
|
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":"
|
|
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
|
|
2
|
-
import * as
|
|
3
|
-
import { cva as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
const
|
|
13
|
-
console.error("Download failed:",
|
|
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
|
-
|
|
16
|
+
e && document.body.contains(e) && document.body.removeChild(e), r && URL.revokeObjectURL(r);
|
|
16
17
|
}
|
|
17
|
-
},
|
|
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
|
-
),
|
|
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
|
-
]),
|
|
69
|
-
file:
|
|
70
|
-
uploaded:
|
|
69
|
+
]), D = ({
|
|
70
|
+
file: a,
|
|
71
|
+
uploaded: l,
|
|
71
72
|
progress: t,
|
|
72
|
-
size:
|
|
73
|
-
disabled:
|
|
74
|
-
readOnly:
|
|
75
|
-
note:
|
|
76
|
-
error:
|
|
77
|
-
onDelete:
|
|
78
|
-
onError:
|
|
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 [
|
|
81
|
-
if (
|
|
82
|
-
return URL.createObjectURL(
|
|
83
|
-
}, [
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
/* @__PURE__ */
|
|
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:
|
|
91
|
-
|
|
92
|
-
variant:
|
|
93
|
-
size:
|
|
91
|
+
className: i(
|
|
92
|
+
C({
|
|
93
|
+
variant: y,
|
|
94
|
+
size: r
|
|
94
95
|
})
|
|
95
96
|
),
|
|
96
97
|
children: [
|
|
97
|
-
|
|
98
|
+
p && !x && /* @__PURE__ */ o(
|
|
98
99
|
"img",
|
|
99
100
|
{
|
|
100
|
-
src:
|
|
101
|
-
alt:
|
|
101
|
+
src: p,
|
|
102
|
+
alt: a.name,
|
|
102
103
|
width: 24,
|
|
103
104
|
height: 24,
|
|
104
|
-
onError: () =>
|
|
105
|
-
className:
|
|
106
|
-
"opacity-50 saturate-0":
|
|
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
|
-
|
|
111
|
-
|
|
111
|
+
p && x && /* @__PURE__ */ o(
|
|
112
|
+
N,
|
|
112
113
|
{
|
|
113
|
-
className:
|
|
114
|
+
className: i(
|
|
114
115
|
"text-icon-dark-secondary size-icon-medium shrink-0",
|
|
115
116
|
{
|
|
116
|
-
"opacity-50":
|
|
117
|
+
"opacity-50": e
|
|
117
118
|
}
|
|
118
119
|
)
|
|
119
120
|
}
|
|
120
121
|
),
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
|
|
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:
|
|
129
|
+
children: a.name
|
|
129
130
|
}
|
|
130
131
|
),
|
|
131
|
-
!
|
|
132
|
+
!l && /* @__PURE__ */ o(
|
|
132
133
|
"button",
|
|
133
134
|
{
|
|
134
|
-
disabled:
|
|
135
|
-
onClick:
|
|
136
|
-
|
|
137
|
-
|
|
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__ */
|
|
145
|
+
children: /* @__PURE__ */ o(z, { className: "size-icon-medium" })
|
|
144
146
|
}
|
|
145
147
|
),
|
|
146
|
-
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
+
l && /* @__PURE__ */ u("div", { className: "flex gap-xl", children: [
|
|
149
|
+
/* @__PURE__ */ o(
|
|
148
150
|
"button",
|
|
149
151
|
{
|
|
150
|
-
disabled:
|
|
151
|
-
onClick: () =>
|
|
152
|
-
|
|
153
|
-
|
|
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__ */
|
|
162
|
+
children: /* @__PURE__ */ o(L, { className: "size-icon-medium" })
|
|
160
163
|
}
|
|
161
164
|
),
|
|
162
|
-
!
|
|
165
|
+
!d && /* @__PURE__ */ o(
|
|
163
166
|
"button",
|
|
164
167
|
{
|
|
165
|
-
disabled:
|
|
166
|
-
onClick:
|
|
167
|
-
|
|
168
|
-
|
|
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__ */
|
|
178
|
+
children: /* @__PURE__ */ o(U, { className: "size-icon-medium" })
|
|
175
179
|
}
|
|
176
180
|
)
|
|
177
181
|
] }),
|
|
178
|
-
typeof t == "number" && t !== 0 && /* @__PURE__ */
|
|
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
|
-
|
|
189
|
-
|
|
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:
|
|
200
|
+
children: n
|
|
197
201
|
}
|
|
198
202
|
),
|
|
199
|
-
|
|
200
|
-
|
|
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:
|
|
211
|
+
children: c
|
|
208
212
|
}
|
|
209
213
|
)
|
|
210
214
|
] });
|
|
211
215
|
};
|
|
212
216
|
export {
|
|
213
|
-
|
|
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;AACjE,OAAO,EAAE,KAAK,eAAe,EAAe,MAAM,gBAAgB,CAAA;
|
|
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;AACjE,OAAO,EAAE,KAAK,eAAe,EAAe,MAAM,gBAAgB,CAAA;AAQlE,QAAA,MAAM,kBAAkB;;;;8EAoCvB,CAAA;AAgBD,MAAM,WAAW,eACf,SAAQ,IAAI,CACR,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,QAAQ,GAAG,SAAS,GAAG,UAAU,CAClC,EACD,IAAI,CAAC,YAAY,CAAC,OAAO,kBAAkB,CAAC,EAAE,cAAc,CAAC;IAC/D,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;IACxC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;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
|
|
1
|
+
import { jsxs as n, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import * as y from "react";
|
|
3
|
-
import { cva as
|
|
4
|
-
import { useDropzone as
|
|
5
|
-
import { FileItem as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
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
|
-
),
|
|
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
|
-
),
|
|
59
|
+
), oe = y.forwardRef(
|
|
59
60
|
({
|
|
60
|
-
className:
|
|
61
|
-
onDrop:
|
|
61
|
+
className: S,
|
|
62
|
+
onDrop: g,
|
|
62
63
|
accept: f,
|
|
63
|
-
multiple:
|
|
64
|
+
multiple: U = !0,
|
|
64
65
|
maxSize: b,
|
|
65
|
-
maxSizeErrorMessage:
|
|
66
|
-
size:
|
|
66
|
+
maxSizeErrorMessage: T,
|
|
67
|
+
size: V = "base",
|
|
67
68
|
disabled: p = !1,
|
|
68
|
-
readOnly:
|
|
69
|
-
dropzoneOptions:
|
|
70
|
-
label:
|
|
71
|
-
title:
|
|
72
|
-
subtitle:
|
|
73
|
-
preselectedFiles:
|
|
74
|
-
fileStatus:
|
|
75
|
-
itemErrors:
|
|
76
|
-
itemHints:
|
|
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:
|
|
80
|
+
onDelete: M,
|
|
80
81
|
onChange: c,
|
|
81
|
-
...
|
|
82
|
-
},
|
|
83
|
-
const [
|
|
84
|
-
|
|
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 (
|
|
87
|
-
(
|
|
90
|
+
if ($(!1), a.length > 0 && a.some(
|
|
91
|
+
(r) => r.errors.some((l) => l.code === "file-too-large")
|
|
88
92
|
)) {
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
o == null || o(
|
|
93
|
+
$(!0);
|
|
94
|
+
const r = R || I;
|
|
95
|
+
o == null || o(r, a[0].file);
|
|
92
96
|
return;
|
|
93
97
|
}
|
|
94
|
-
|
|
95
|
-
const
|
|
98
|
+
F((e) => {
|
|
99
|
+
const r = new Set(
|
|
96
100
|
e.map((s) => `${s.name}-${s.size}-${s.lastModified}`)
|
|
97
|
-
),
|
|
98
|
-
(s) => !
|
|
99
|
-
),
|
|
100
|
-
return c == null || c(
|
|
101
|
-
}),
|
|
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
|
|
104
|
-
o == null || o(
|
|
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:
|
|
112
|
+
multiple: U,
|
|
109
113
|
maxSize: b,
|
|
110
114
|
disabled: p,
|
|
111
|
-
...
|
|
112
|
-
}),
|
|
113
|
-
return /* @__PURE__ */
|
|
114
|
-
!
|
|
115
|
-
|
|
116
|
-
|
|
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:
|
|
127
|
+
children: m
|
|
124
128
|
}
|
|
125
|
-
) :
|
|
126
|
-
/* @__PURE__ */
|
|
129
|
+
) : m),
|
|
130
|
+
/* @__PURE__ */ n(
|
|
127
131
|
"div",
|
|
128
132
|
{
|
|
129
|
-
ref:
|
|
133
|
+
ref: L,
|
|
130
134
|
tabIndex: p ? void 0 : 0,
|
|
131
|
-
className:
|
|
132
|
-
|
|
133
|
-
error:
|
|
135
|
+
className: A(
|
|
136
|
+
ee({
|
|
137
|
+
error: G || N,
|
|
134
138
|
disabled: p,
|
|
135
|
-
className:
|
|
136
|
-
isDragActive:
|
|
139
|
+
className: S,
|
|
140
|
+
isDragActive: X
|
|
137
141
|
})
|
|
138
142
|
),
|
|
139
|
-
...
|
|
140
|
-
...
|
|
143
|
+
...Q(),
|
|
144
|
+
...J,
|
|
141
145
|
children: [
|
|
142
|
-
/* @__PURE__ */ i("input", { ...
|
|
143
|
-
/* @__PURE__ */ i(
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
/* @__PURE__ */ i(
|
|
146
|
-
|
|
147
|
-
|
|
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:
|
|
153
|
-
|
|
156
|
+
className: A(
|
|
157
|
+
te({
|
|
154
158
|
disabled: p,
|
|
155
|
-
className:
|
|
159
|
+
className: S
|
|
156
160
|
})
|
|
157
161
|
),
|
|
158
|
-
children:
|
|
162
|
+
children: k
|
|
159
163
|
}
|
|
160
164
|
)
|
|
161
165
|
] })
|
|
162
166
|
]
|
|
163
167
|
}
|
|
164
168
|
),
|
|
165
|
-
|
|
166
|
-
|
|
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:
|
|
177
|
+
children: R
|
|
174
178
|
}
|
|
175
179
|
)
|
|
176
180
|
] }),
|
|
177
|
-
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-md", children:
|
|
178
|
-
const e =
|
|
179
|
-
return
|
|
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,
|
|
181
185
|
{
|
|
182
186
|
file: t,
|
|
183
|
-
uploaded:
|
|
187
|
+
uploaded: r,
|
|
184
188
|
progress: e == null ? void 0 : e.progress,
|
|
185
189
|
disabled: p,
|
|
186
|
-
readOnly:
|
|
187
|
-
error:
|
|
188
|
-
note:
|
|
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:
|
|
194
|
+
size: V,
|
|
191
195
|
onDelete: () => {
|
|
192
196
|
try {
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
return c == null || c(
|
|
196
|
-
}),
|
|
197
|
-
} catch (
|
|
198
|
-
const
|
|
199
|
-
o == null || o(
|
|
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
|
-
|
|
213
|
+
oe.displayName = "FileUpload";
|
|
210
214
|
export {
|
|
211
|
-
|
|
215
|
+
oe as FileUpload
|
|
212
216
|
};
|