@vkzstudio/muza-ui 1.0.31 → 1.0.33
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/ButtonArrow/ButtonArrow.d.ts +20 -0
- package/dist/components/ButtonArrow/ButtonArrow.d.ts.map +1 -0
- package/dist/components/ButtonArrow/ButtonArrow.js +63 -0
- package/dist/components/ButtonArrow/ButtonArrow.stories.d.ts +37 -0
- package/dist/components/ButtonArrow/ButtonArrow.stories.d.ts.map +1 -0
- package/dist/components/ButtonArrow/index.d.ts +2 -0
- package/dist/components/ButtonArrow/index.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.js +1 -1
- package/dist/components/ExpandableTable/ExpandableTable.d.ts +17 -1
- package/dist/components/ExpandableTable/ExpandableTable.d.ts.map +1 -1
- package/dist/components/ExpandableTable/ExpandableTable.js +273 -192
- package/dist/components/ExpandableTable/ExpandableTable.stories.d.ts +3 -1
- package/dist/components/ExpandableTable/ExpandableTable.stories.d.ts.map +1 -1
- package/dist/components/ExpandableTable/Table.d.ts +3 -7
- package/dist/components/ExpandableTable/Table.d.ts.map +1 -1
- package/dist/components/ExpandableTable/Table.js +52 -59
- package/dist/components/FileUpload/FileItem.d.ts +5 -2
- package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
- package/dist/components/FileUpload/FileItem.js +91 -69
- package/dist/components/FileUpload/FileUpload.d.ts +12 -2
- package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/components/FileUpload/FileUpload.js +94 -91
- package/dist/components/FileUpload/FileUpload.stories.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.stories.d.ts.map +1 -1
- package/dist/components/Flex/Flex.d.ts +1 -1
- package/dist/components/Flex/Flex.d.ts.map +1 -1
- package/dist/components/Flex/Flex.js +47 -44
- package/dist/components/Input/Input.d.ts +2 -2
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.js +47 -46
- package/dist/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +61 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.js +213 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +12 -0
- package/dist/components/Pagination/Pagination.stories.d.ts.map +1 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Pagination/index.d.ts.map +1 -0
- package/dist/components/ReorderableTable/ReorderableTable.js +13 -13
- package/dist/components/Searchbar/Searchbar.d.ts +1 -1
- package/dist/components/Searchbar/Searchbar.d.ts.map +1 -1
- package/dist/components/Searchbar/Searchbar.stories.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/components/Select/utils.d.ts +1 -1
- package/dist/components/Select/utils.d.ts.map +1 -1
- package/dist/components/Select/utils.js +5 -4
- package/dist/components/Typography/Typography.d.ts.map +1 -1
- package/dist/components/Typography/Typography.js +1 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.js +223 -218
- package/dist/muza-ui.css +1 -1
- package/dist/styles/animations.css +0 -20
- package/dist/styles/token-colors.css +1 -0
- package/dist/styles/token-sizes.css +30 -6
- package/dist/translations/locales/cs.d.ts.map +1 -1
- package/dist/translations/locales/cs.js +10 -0
- package/dist/translations/locales/en.d.ts.map +1 -1
- package/dist/translations/locales/en.js +10 -0
- package/dist/translations/locales/sk.d.ts.map +1 -1
- package/dist/translations/locales/sk.js +10 -0
- package/dist/translations/types.d.ts +22 -0
- package/dist/translations/types.d.ts.map +1 -1
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +8 -1
- package/package.json +1 -1
|
@@ -1,22 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as t } from "react";
|
|
3
|
-
import { cva as
|
|
3
|
+
import { cva as s } from "class-variance-authority";
|
|
4
4
|
import { cn as d } from "../../utils/cn.js";
|
|
5
|
-
import { typographyVariants as
|
|
6
|
-
const
|
|
5
|
+
import { typographyVariants as c } from "../Typography/Typography.js";
|
|
6
|
+
const p = t(({ className: o, ...r }, e) => /* @__PURE__ */ a(
|
|
7
7
|
"table",
|
|
8
8
|
{
|
|
9
9
|
ref: e,
|
|
10
|
-
className: d("w-full border-separate border-spacing-0",
|
|
10
|
+
className: d("w-full border-separate border-spacing-0", o),
|
|
11
11
|
...r
|
|
12
12
|
}
|
|
13
13
|
));
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
p.displayName = "Table";
|
|
15
|
+
const u = t(({ className: o, ...r }, e) => /* @__PURE__ */ a(
|
|
16
|
+
"thead",
|
|
17
|
+
{
|
|
18
|
+
ref: e,
|
|
19
|
+
className: d('after:table-row after:h-md after:content-[""]', o),
|
|
20
|
+
...r
|
|
21
|
+
}
|
|
22
|
+
));
|
|
23
|
+
u.displayName = "TableHeader";
|
|
24
|
+
const i = t(({ className: o, ...r }, e) => /* @__PURE__ */ a(
|
|
25
|
+
"tbody",
|
|
26
|
+
{
|
|
27
|
+
ref: e,
|
|
28
|
+
className: d('after:table-row after:h-md after:content-[""]', o),
|
|
29
|
+
...r
|
|
30
|
+
}
|
|
31
|
+
));
|
|
32
|
+
i.displayName = "TableRowGroup";
|
|
33
|
+
const f = s("", {
|
|
20
34
|
variants: {
|
|
21
35
|
expandablePosition: {
|
|
22
36
|
none: "",
|
|
@@ -27,56 +41,35 @@ const h = c("", {
|
|
|
27
41
|
defaultVariants: {
|
|
28
42
|
expandablePosition: "none"
|
|
29
43
|
}
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"tr",
|
|
41
|
-
{
|
|
42
|
-
ref: b,
|
|
43
|
-
className: d(h({ expandablePosition: l }), a),
|
|
44
|
-
...s
|
|
45
|
-
}
|
|
46
|
-
),
|
|
47
|
-
/* @__PURE__ */ o("tr", { className: d("h-md bg-transparent", { hidden: r }), children: /* @__PURE__ */ o("td", { colSpan: e }) }),
|
|
48
|
-
/* @__PURE__ */ o(
|
|
49
|
-
"tr",
|
|
50
|
-
{
|
|
51
|
-
className: d("bg-surface-base-secondary", {
|
|
52
|
-
collapse: !n
|
|
53
|
-
}),
|
|
54
|
-
children: /* @__PURE__ */ o("td", { colSpan: e, className: "h-0 px-comp-table-p", children: /* @__PURE__ */ o("div", { className: "border-t-1 border-stroke-base-secondary" }) })
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
] })
|
|
58
|
-
);
|
|
59
|
-
x.displayName = "TableRow";
|
|
60
|
-
const N = t(({ className: a, ...r }, e) => /* @__PURE__ */ o(
|
|
44
|
+
}), y = t(({ className: o, expandablePosition: r, ...e }, l) => /* @__PURE__ */ a(
|
|
45
|
+
"tr",
|
|
46
|
+
{
|
|
47
|
+
ref: l,
|
|
48
|
+
className: d(f({ expandablePosition: r }), o),
|
|
49
|
+
...e
|
|
50
|
+
}
|
|
51
|
+
));
|
|
52
|
+
y.displayName = "TableRow";
|
|
53
|
+
const N = t(({ className: o, ...r }, e) => /* @__PURE__ */ a(
|
|
61
54
|
"th",
|
|
62
55
|
{
|
|
63
56
|
ref: e,
|
|
64
57
|
className: d(
|
|
65
|
-
|
|
58
|
+
c({
|
|
66
59
|
size: "sm",
|
|
67
60
|
uppercase: !0,
|
|
68
61
|
variant: "body",
|
|
69
62
|
weight: "medium"
|
|
70
63
|
}),
|
|
71
64
|
"px-comp-table-p text-left text-text-dark-secondary",
|
|
72
|
-
|
|
65
|
+
o
|
|
73
66
|
),
|
|
74
67
|
...r
|
|
75
68
|
}
|
|
76
69
|
));
|
|
77
70
|
N.displayName = "TableHead";
|
|
78
|
-
const T =
|
|
79
|
-
"h-comp-table-h border-y-1 border-stroke-base-secondary bg-surface-base-secondary transition-colors",
|
|
71
|
+
const T = s(
|
|
72
|
+
"h-comp-table-h-def border-y-1 border-stroke-base-secondary bg-surface-base-secondary transition-colors",
|
|
80
73
|
{
|
|
81
74
|
variants: {
|
|
82
75
|
padding: {
|
|
@@ -94,33 +87,33 @@ const T = c(
|
|
|
94
87
|
expandablePosition: "none"
|
|
95
88
|
}
|
|
96
89
|
}
|
|
97
|
-
),
|
|
98
|
-
({ className:
|
|
90
|
+
), _ = t(
|
|
91
|
+
({ className: o, padding: r, expandablePosition: e, isFirst: l, isLast: n, ...b }, m) => /* @__PURE__ */ a(
|
|
99
92
|
"td",
|
|
100
93
|
{
|
|
101
|
-
ref:
|
|
94
|
+
ref: m,
|
|
102
95
|
className: d(
|
|
103
96
|
T({ padding: r, expandablePosition: e }),
|
|
104
97
|
{
|
|
105
|
-
"rounded-l-xl border-l-1": l && e === "none",
|
|
98
|
+
"rounded-l-xl border-l-1 [transition:border-radius_50ms_ease-out_0ms,color_150ms,background-color_150ms,border-color_150ms]": l && e === "none",
|
|
106
99
|
"rounded-tl-xl rounded-bl-none border-l-1": l && e === "top",
|
|
107
100
|
"rounded-tl-none rounded-bl-xl border-l-1": l && e === "bottom",
|
|
108
|
-
"rounded-r-xl border-r-1": n && e === "none",
|
|
101
|
+
"rounded-r-xl border-r-1 [transition:border-radius_50ms_ease-out_0ms,color_150ms,background-color_150ms,border-color_150ms]": n && e === "none",
|
|
109
102
|
"rounded-tr-xl rounded-br-none border-r-1": n && e === "top",
|
|
110
103
|
"rounded-tr-none rounded-br-xl border-r-1": n && e === "bottom"
|
|
111
104
|
},
|
|
112
|
-
|
|
105
|
+
o
|
|
113
106
|
),
|
|
114
|
-
...
|
|
107
|
+
...b
|
|
115
108
|
}
|
|
116
109
|
)
|
|
117
110
|
);
|
|
118
|
-
|
|
111
|
+
_.displayName = "TableCell";
|
|
119
112
|
export {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
g as TableCell,
|
|
113
|
+
p as Table,
|
|
114
|
+
_ as TableCell,
|
|
123
115
|
N as TableHead,
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
u as TableHeader,
|
|
117
|
+
y as TableRow,
|
|
118
|
+
i as TableRowGroup
|
|
126
119
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
interface FileItemBaseProps {
|
|
2
3
|
uploaded?: boolean;
|
|
3
4
|
progress?: number;
|
|
4
5
|
size?: 'sm' | 'base' | 'lg';
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
readOnly?: boolean;
|
|
7
|
-
note?:
|
|
8
|
-
error?:
|
|
8
|
+
note?: React.ReactNode;
|
|
9
|
+
error?: React.ReactNode;
|
|
10
|
+
/** Secondary text displayed below the file name (e.g., file size). */
|
|
11
|
+
secondaryText?: React.ReactNode;
|
|
9
12
|
onDelete: () => void;
|
|
10
13
|
onError?: (error: string, file?: File) => void;
|
|
11
14
|
}
|
|
@@ -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":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA8C9B,UAAU,iBAAiB;IACzB,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,KAAK,CAAC,SAAS,CAAA;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,sEAAsE;IACtE,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC/B,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;CAC/C;AAED,UAAU,iBAAkB,SAAQ,iBAAiB;IACnD,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,IAAI,CAAA;CACX;AAED,UAAU,gBAAiB,SAAQ,iBAAiB;IAClD,MAAM,EAAE,KAAK,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,KAAK,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,CAAA;AA0EzD,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,4CAmO5C,CAAA"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { cva as
|
|
4
|
-
import { useMuzaTranslations as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { jsxs as f, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import { cva as O } from "class-variance-authority";
|
|
4
|
+
import { useMuzaTranslations as _ } from "../../translations/TranslationContext.js";
|
|
5
|
+
import { Flex as U } from "../Flex/Flex.js";
|
|
6
|
+
import { cn as a } from "../../utils/cn.js";
|
|
7
|
+
import { GalleryOutline as B, FileTextBold as M, CloseCircleBold as j, DownloadMinimalisticBold as I, TrashBinTrashBold as R } from "@solar-icons/react-perf";
|
|
8
|
+
import { Typography as u } from "../Typography/Typography.js";
|
|
9
|
+
const D = (e, l, i) => {
|
|
9
10
|
let n = null, o = null;
|
|
10
11
|
try {
|
|
11
12
|
n = URL.createObjectURL(e), o = document.createElement("a"), o.href = n, o.download = e.name, o.style.display = "none", document.body.appendChild(o), o.click();
|
|
12
13
|
} catch (d) {
|
|
13
14
|
const c = d instanceof Error ? d.message : i ?? "Download failed";
|
|
14
|
-
console.error("Download failed:", d),
|
|
15
|
+
console.error("Download failed:", d), l == null || l(c, e);
|
|
15
16
|
} finally {
|
|
16
17
|
o && document.body.contains(o) && document.body.removeChild(o), n && URL.revokeObjectURL(n);
|
|
17
18
|
}
|
|
18
|
-
},
|
|
19
|
+
}, S = O(
|
|
19
20
|
[
|
|
20
21
|
"flex flex-1 items-center gap-sm rounded-full border transition-colors",
|
|
21
22
|
"relative pr-comp-input-p-hor pl-comp-input-p-hor",
|
|
@@ -60,13 +61,13 @@ const j = (e, a, i) => {
|
|
|
60
61
|
size: "base"
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
), h =
|
|
64
|
+
), h = a([
|
|
64
65
|
"relative h-fit w-fit border-none rounded-full focus-visible-default",
|
|
65
66
|
"before:absolute before:inset-[-3px]",
|
|
66
67
|
"bg-none cursor-pointer disabled:cursor-not-allowed",
|
|
67
68
|
"text-comp-file-upload-icon-def-secondary",
|
|
68
69
|
"disabled:text-comp-file-upload-icon-def-disabled"
|
|
69
|
-
]),
|
|
70
|
+
]), A = /\.(jpe?g|png|gif|webp|svg|bmp|ico|avif|tiff?)$/i, z = /\.(pdf|docx?|txt|rtf|odt|xlsx?|csv|pptx?|md|tex)$/i, E = [
|
|
70
71
|
"application/pdf",
|
|
71
72
|
"application/msword",
|
|
72
73
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
@@ -79,49 +80,50 @@ const j = (e, a, i) => {
|
|
|
79
80
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
80
81
|
"application/vnd.ms-powerpoint",
|
|
81
82
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
82
|
-
],
|
|
83
|
+
], P = (e) => {
|
|
83
84
|
const {
|
|
84
|
-
uploaded:
|
|
85
|
+
uploaded: l,
|
|
85
86
|
progress: i,
|
|
86
87
|
size: n,
|
|
87
88
|
disabled: o,
|
|
88
89
|
readOnly: d = !1,
|
|
89
90
|
note: c,
|
|
90
91
|
error: s,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
secondaryText: g,
|
|
93
|
+
onDelete: y,
|
|
94
|
+
onError: L
|
|
95
|
+
} = e, m = _(), [v, w] = p.useState(!1), N = e.source === "file" ? e.file.name : e.name, b = e.source === "url" ? (e.type ?? "").startsWith("image/") || A.test(e.name) : e.file.type.startsWith("image/"), T = e.source === "url" ? E.includes(e.type ?? "") || z.test(e.name) : E.includes(e.file.type) || z.test(e.file.name), r = e.source === "file" ? e.file : e.url, C = p.useMemo(() => o ? "disabled" : s ? "error" : typeof i == "number" && i > 0 ? "loading" : "default", [o, s, i]), x = p.useMemo(() => {
|
|
96
|
+
if (b)
|
|
95
97
|
return typeof r == "string" ? r : URL.createObjectURL(r);
|
|
96
|
-
}, [
|
|
97
|
-
return
|
|
98
|
-
/* @__PURE__ */
|
|
98
|
+
}, [b, r]);
|
|
99
|
+
return p.useEffect(() => w(!1), [r]), /* @__PURE__ */ f(U, { gap: "sm", direction: "column", component: "li", children: [
|
|
100
|
+
/* @__PURE__ */ f(
|
|
99
101
|
"div",
|
|
100
102
|
{
|
|
101
|
-
className:
|
|
102
|
-
|
|
103
|
-
variant:
|
|
103
|
+
className: a(
|
|
104
|
+
S({
|
|
105
|
+
variant: C,
|
|
104
106
|
size: n
|
|
105
107
|
})
|
|
106
108
|
),
|
|
107
109
|
children: [
|
|
108
|
-
|
|
110
|
+
x && !v && /* @__PURE__ */ t(
|
|
109
111
|
"img",
|
|
110
112
|
{
|
|
111
|
-
src:
|
|
112
|
-
alt:
|
|
113
|
+
src: x,
|
|
114
|
+
alt: N,
|
|
113
115
|
width: 24,
|
|
114
116
|
height: 24,
|
|
115
|
-
onError: () =>
|
|
116
|
-
className:
|
|
117
|
+
onError: () => w(!0),
|
|
118
|
+
className: a("size-icon-medium shrink-0 rounded-xs object-cover", {
|
|
117
119
|
"opacity-50 saturate-0": o
|
|
118
120
|
})
|
|
119
121
|
}
|
|
120
122
|
),
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
x && v && /* @__PURE__ */ t(
|
|
124
|
+
B,
|
|
123
125
|
{
|
|
124
|
-
className:
|
|
126
|
+
className: a(
|
|
125
127
|
"size-icon-medium shrink-0 text-comp-file-upload-icon-def-secondary",
|
|
126
128
|
{
|
|
127
129
|
"opacity-50": o
|
|
@@ -129,10 +131,10 @@ const j = (e, a, i) => {
|
|
|
129
131
|
)
|
|
130
132
|
}
|
|
131
133
|
),
|
|
132
|
-
!
|
|
133
|
-
|
|
134
|
+
!b && T && /* @__PURE__ */ t(
|
|
135
|
+
M,
|
|
134
136
|
{
|
|
135
|
-
className:
|
|
137
|
+
className: a(
|
|
136
138
|
"size-icon-medium shrink-0 text-comp-file-upload-icon-def-secondary",
|
|
137
139
|
{
|
|
138
140
|
"opacity-50": o
|
|
@@ -140,57 +142,72 @@ const j = (e, a, i) => {
|
|
|
140
142
|
)
|
|
141
143
|
}
|
|
142
144
|
),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
145
|
+
/* @__PURE__ */ f(U, { direction: "column", className: "min-w-0 flex-1 justify-center", children: [
|
|
146
|
+
/* @__PURE__ */ t(
|
|
147
|
+
u,
|
|
148
|
+
{
|
|
149
|
+
className: "w-full truncate",
|
|
150
|
+
component: "span",
|
|
151
|
+
size: "sm",
|
|
152
|
+
variant: "body",
|
|
153
|
+
weight: "medium",
|
|
154
|
+
fixY: !0,
|
|
155
|
+
children: N
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
g && /* @__PURE__ */ t(
|
|
159
|
+
u,
|
|
160
|
+
{
|
|
161
|
+
className: "w-full truncate text-comp-file-upload-text-dark-secondary",
|
|
162
|
+
component: "span",
|
|
163
|
+
variant: "body",
|
|
164
|
+
size: "caption",
|
|
165
|
+
weight: "regular",
|
|
166
|
+
children: g
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] }),
|
|
170
|
+
!l && /* @__PURE__ */ t(
|
|
154
171
|
"button",
|
|
155
172
|
{
|
|
156
173
|
disabled: o,
|
|
157
|
-
onClick:
|
|
174
|
+
onClick: y,
|
|
158
175
|
"aria-label": m.fileUpload.deleteButtonAriaLabel,
|
|
159
|
-
className:
|
|
176
|
+
className: a(
|
|
160
177
|
h,
|
|
161
178
|
"text-comp-file-upload-icon-def-secondary",
|
|
162
179
|
"hover:text-comp-file-upload-icon-def-hover",
|
|
163
180
|
"focus-visible:text-comp-file-upload-icon-def-focused",
|
|
164
181
|
"disabled:text-comp-file-upload-icon-def-disabled"
|
|
165
182
|
),
|
|
166
|
-
children: /* @__PURE__ */ t(
|
|
183
|
+
children: /* @__PURE__ */ t(j, { className: "size-icon-medium" })
|
|
167
184
|
}
|
|
168
185
|
),
|
|
169
|
-
|
|
186
|
+
l && /* @__PURE__ */ f("div", { className: "flex gap-xl", children: [
|
|
170
187
|
/* @__PURE__ */ t(
|
|
171
188
|
"button",
|
|
172
189
|
{
|
|
173
190
|
disabled: o,
|
|
174
191
|
onClick: () => e.source === "url" ? (() => {
|
|
175
192
|
try {
|
|
176
|
-
const
|
|
193
|
+
const k = new URL(
|
|
177
194
|
e.url,
|
|
178
195
|
window.location.origin
|
|
179
196
|
);
|
|
180
|
-
["http:", "https:", "blob:"].includes(
|
|
181
|
-
|
|
197
|
+
["http:", "https:", "blob:"].includes(k.protocol) && window.open(
|
|
198
|
+
k.href,
|
|
182
199
|
"_blank",
|
|
183
200
|
"noopener,noreferrer"
|
|
184
201
|
);
|
|
185
202
|
} catch {
|
|
186
203
|
}
|
|
187
|
-
})() :
|
|
204
|
+
})() : D(
|
|
188
205
|
e.file,
|
|
189
|
-
|
|
206
|
+
L,
|
|
190
207
|
m.fileUpload.downloadError
|
|
191
208
|
),
|
|
192
209
|
"aria-label": m.fileUpload.downloadButtonAriaLabel,
|
|
193
|
-
className:
|
|
210
|
+
className: a(
|
|
194
211
|
h,
|
|
195
212
|
"text-comp-file-upload-icon-brand-def",
|
|
196
213
|
"hover:text-comp-file-upload-icon-brand-hover",
|
|
@@ -204,9 +221,9 @@ const j = (e, a, i) => {
|
|
|
204
221
|
"button",
|
|
205
222
|
{
|
|
206
223
|
disabled: o,
|
|
207
|
-
onClick:
|
|
224
|
+
onClick: y,
|
|
208
225
|
"aria-label": m.fileUpload.deleteButtonAriaLabel,
|
|
209
|
-
className:
|
|
226
|
+
className: a(
|
|
210
227
|
h,
|
|
211
228
|
"text-comp-file-upload-icon-error-def",
|
|
212
229
|
"hover:text-comp-file-upload-icon-error-hover",
|
|
@@ -220,37 +237,42 @@ const j = (e, a, i) => {
|
|
|
220
237
|
typeof i == "number" && i !== 0 && /* @__PURE__ */ t(
|
|
221
238
|
"div",
|
|
222
239
|
{
|
|
223
|
-
style: {
|
|
224
|
-
|
|
240
|
+
style: {
|
|
241
|
+
width: `${i}%`
|
|
242
|
+
},
|
|
243
|
+
className: a(
|
|
244
|
+
"absolute bottom-0 left-0 min-h-[3px] bg-comp-file-upload-icon-brand-def [transition:width_300ms_ease-out,opacity_100ms_ease-out_200ms]",
|
|
245
|
+
{ "opacity-0": i === 100 }
|
|
246
|
+
)
|
|
225
247
|
}
|
|
226
248
|
)
|
|
227
249
|
]
|
|
228
250
|
}
|
|
229
251
|
),
|
|
230
|
-
|
|
231
|
-
|
|
252
|
+
s && /* @__PURE__ */ t(
|
|
253
|
+
u,
|
|
232
254
|
{
|
|
233
255
|
size: "sm",
|
|
234
256
|
component: "span",
|
|
235
257
|
variant: "body",
|
|
236
258
|
weight: "regular",
|
|
237
|
-
className: "text-comp-input-text-
|
|
238
|
-
children:
|
|
259
|
+
className: "text-comp-input-text-error",
|
|
260
|
+
children: s
|
|
239
261
|
}
|
|
240
262
|
),
|
|
241
|
-
|
|
242
|
-
|
|
263
|
+
c && /* @__PURE__ */ t(
|
|
264
|
+
u,
|
|
243
265
|
{
|
|
244
266
|
size: "sm",
|
|
245
267
|
component: "span",
|
|
246
268
|
variant: "body",
|
|
247
269
|
weight: "regular",
|
|
248
|
-
className: "text-comp-input-text-
|
|
249
|
-
children:
|
|
270
|
+
className: "text-comp-input-text-secondary",
|
|
271
|
+
children: c
|
|
250
272
|
}
|
|
251
273
|
)
|
|
252
274
|
] });
|
|
253
275
|
};
|
|
254
276
|
export {
|
|
255
|
-
|
|
277
|
+
P as FileItem
|
|
256
278
|
};
|
|
@@ -19,6 +19,8 @@ export interface PreselectedUrl {
|
|
|
19
19
|
type?: string;
|
|
20
20
|
/** File size in bytes (for display). */
|
|
21
21
|
size?: number;
|
|
22
|
+
/** Secondary text displayed below the file name (e.g., formatted file size). */
|
|
23
|
+
secondaryText?: React.ReactNode;
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* Props for the FileUpload component.
|
|
@@ -88,7 +90,7 @@ export interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElemen
|
|
|
88
90
|
* const errors = new Map<File, string>([[file, 'Upload failed']])
|
|
89
91
|
* <FileUpload itemErrors={errors} />
|
|
90
92
|
*/
|
|
91
|
-
itemErrors?: Map<File,
|
|
93
|
+
itemErrors?: Map<File, React.ReactNode>;
|
|
92
94
|
/**
|
|
93
95
|
* Per-file hint messages keyed by File reference.
|
|
94
96
|
*
|
|
@@ -96,7 +98,15 @@ export interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElemen
|
|
|
96
98
|
* const hints = new Map<File, string>([[file, 'Will be optimized']])
|
|
97
99
|
* <FileUpload itemHints={hints} />
|
|
98
100
|
*/
|
|
99
|
-
itemHints?: Map<File,
|
|
101
|
+
itemHints?: Map<File, React.ReactNode>;
|
|
102
|
+
/**
|
|
103
|
+
* Per-file secondary text keyed by File reference (e.g., formatted file size).
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* const texts = new Map<File, React.ReactNode>([[file, '7 MB']])
|
|
107
|
+
* <FileUpload itemSecondaryTexts={texts} />
|
|
108
|
+
*/
|
|
109
|
+
itemSecondaryTexts?: Map<File, React.ReactNode>;
|
|
100
110
|
/** Fires when an error occurs. Receives the error message and the optional file that caused it. */
|
|
101
111
|
onError?: (error: string, file?: File) => void;
|
|
102
112
|
/** Fires when a file is deleted. Receives the deleted file and its index. */
|
|
@@ -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;AASlE,QAAA,MAAM,kBAAkB;;;;8EAoCvB,CAAA;AAgBD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,0GAA0G;IAC1G,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,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,EAA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