@vkzstudio/muza-ui 1.0.6 → 1.0.8
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/Chip/Chip.d.ts +43 -0
- package/dist/components/Chip/Chip.d.ts.map +1 -0
- package/dist/components/Chip/Chip.js +98 -0
- package/dist/components/Chip/Chip.stories.d.ts +9 -0
- package/dist/components/Chip/Chip.stories.d.ts.map +1 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/Chip/index.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.d.ts +23 -0
- package/dist/components/DataTable/DataTable.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.js +101 -0
- package/dist/components/DataTable/DataTable.stories.d.ts +14 -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/Reorderable/Reorderable.d.ts +100 -0
- package/dist/components/Reorderable/Reorderable.d.ts.map +1 -0
- package/dist/components/Reorderable/Reorderable.js +197 -0
- package/dist/components/Reorderable/Reorderable.stories.d.ts +14 -0
- package/dist/components/Reorderable/Reorderable.stories.d.ts.map +1 -0
- package/dist/components/Reorderable/index.d.ts +2 -0
- package/dist/components/Reorderable/index.d.ts.map +1 -0
- package/dist/components/ReorderableTable/ReorderableTable.d.ts +40 -0
- package/dist/components/ReorderableTable/ReorderableTable.d.ts.map +1 -0
- package/dist/components/ReorderableTable/ReorderableTable.js +175 -0
- package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts +18 -0
- package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts.map +1 -0
- package/dist/components/ReorderableTable/index.d.ts +2 -0
- package/dist/components/ReorderableTable/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 +6 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.js +217 -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/node_modules/framer-motion/dist/es/components/Reorder/Group.js +38 -0
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/Item.js +29 -0
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/utils/check-reorder.js +17 -0
- package/dist/node_modules/framer-motion/dist/es/context/ReorderContext.js +5 -0
- package/dist/node_modules/motion-utils/dist/es/array.js +15 -6
- 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 +56 -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 +56 -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 +56 -0
- package/dist/translations/types.d.ts +126 -0
- package/dist/translations/types.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as r, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cva as f } from "class-variance-authority";
|
|
4
|
+
import { typographyVariants as h, Typography as y } from "../Typography/Typography.js";
|
|
5
|
+
import { cn as i } from "../../utils/cn.js";
|
|
6
|
+
const u = f(
|
|
7
|
+
"h-comp-table-h border-y border-stroke-base-secondary px-2xl transition-colors",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-surface-base-primary",
|
|
12
|
+
white: "bg-surface-base-secondary"
|
|
13
|
+
},
|
|
14
|
+
position: {
|
|
15
|
+
first: "rounded-l-xl border-l",
|
|
16
|
+
middle: "",
|
|
17
|
+
last: "rounded-r-xl border-r"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
variant: "default",
|
|
22
|
+
position: "middle"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
), C = ({
|
|
26
|
+
data: n,
|
|
27
|
+
columns: s,
|
|
28
|
+
showHeader: o = !0,
|
|
29
|
+
className: p,
|
|
30
|
+
variant: m = "default",
|
|
31
|
+
disabled: d = !1,
|
|
32
|
+
...c
|
|
33
|
+
}) => /* @__PURE__ */ r("div", { className: "w-full overflow-x-auto overflow-y-hidden", children: /* @__PURE__ */ b(
|
|
34
|
+
"table",
|
|
35
|
+
{
|
|
36
|
+
className: i(
|
|
37
|
+
"-my-md w-full border-separate border-spacing-y-md",
|
|
38
|
+
p
|
|
39
|
+
),
|
|
40
|
+
...c,
|
|
41
|
+
children: [
|
|
42
|
+
o && /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { children: s.map((a, t) => /* @__PURE__ */ r(
|
|
43
|
+
"th",
|
|
44
|
+
{
|
|
45
|
+
className: i(
|
|
46
|
+
h({
|
|
47
|
+
size: "sm",
|
|
48
|
+
uppercase: !0,
|
|
49
|
+
variant: "body",
|
|
50
|
+
weight: "medium"
|
|
51
|
+
}),
|
|
52
|
+
"px-comp-table-p text-left text-text-dark-secondary",
|
|
53
|
+
{
|
|
54
|
+
"text-text-dark-disabled": d
|
|
55
|
+
},
|
|
56
|
+
a.className
|
|
57
|
+
),
|
|
58
|
+
children: a.title
|
|
59
|
+
},
|
|
60
|
+
t
|
|
61
|
+
)) }) }),
|
|
62
|
+
/* @__PURE__ */ r("tbody", { children: n.map((a, t) => /* @__PURE__ */ r("tr", { className: "group", children: s.map((e, l) => /* @__PURE__ */ r(
|
|
63
|
+
"td",
|
|
64
|
+
{
|
|
65
|
+
className: i(
|
|
66
|
+
u({
|
|
67
|
+
variant: m,
|
|
68
|
+
position: l === 0 ? "first" : l === s.length - 1 ? "last" : "middle"
|
|
69
|
+
}),
|
|
70
|
+
e.className
|
|
71
|
+
),
|
|
72
|
+
children: e.render ? e.render(
|
|
73
|
+
a[e.dataKey],
|
|
74
|
+
a,
|
|
75
|
+
t,
|
|
76
|
+
d
|
|
77
|
+
) : /* @__PURE__ */ r(
|
|
78
|
+
y,
|
|
79
|
+
{
|
|
80
|
+
variant: "body",
|
|
81
|
+
size: "base",
|
|
82
|
+
weight: "medium",
|
|
83
|
+
component: "span",
|
|
84
|
+
className: i({
|
|
85
|
+
"line-clamp-1": e.lineClamp === !0 || e.lineClamp === 1,
|
|
86
|
+
"line-clamp-2": e.lineClamp === 2,
|
|
87
|
+
"text-text-dark-disabled": d
|
|
88
|
+
}),
|
|
89
|
+
children: a[e.dataKey]
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
},
|
|
93
|
+
l
|
|
94
|
+
)) }, t)) })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
) });
|
|
98
|
+
export {
|
|
99
|
+
C as DataTable,
|
|
100
|
+
u as dataTableCellVariants
|
|
101
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: Meta;
|
|
3
|
+
export default meta;
|
|
4
|
+
type Story = StoryObj;
|
|
5
|
+
export declare const Default: Story;
|
|
6
|
+
export declare const SimpleTable: Story;
|
|
7
|
+
export declare const WithCustomContent: Story;
|
|
8
|
+
export declare const HiddenHeader: Story;
|
|
9
|
+
export declare const WithEditableFields: Story;
|
|
10
|
+
export declare const WhiteVariant: Story;
|
|
11
|
+
export declare const Disabled: Story;
|
|
12
|
+
export declare const WhiteVariantDisabled: Story;
|
|
13
|
+
export declare const AllVariants: Story;
|
|
14
|
+
//# sourceMappingURL=DataTable.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTable.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAO3D,QAAA,MAAM,IAAI,EAAE,IA2DX,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAA;AAsFrB,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAA;AAaD,eAAO,MAAM,WAAW,EAAE,KAazB,CAAA;AA0CD,eAAO,MAAM,iBAAiB,EAAE,KAa/B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAc1B,CAAA;AASD,eAAO,MAAM,kBAAkB,EAAE,KAmIhC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAc1B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAYtB,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,KAYlC,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAqEzB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAKzD,QAAA,MAAM,MAAM,iDAAuB,CAAA;AACnC,QAAA,MAAM,WAAW,iIAAwB,CAAA;AACzC,QAAA,MAAM,iBAAiB,yIAA8B,CAAA;AACrD,QAAA,MAAM,aAAa,kIAA0B,CAAA;AAC7C,QAAA,MAAM,YAAY,uDAAyB,CAAA;AAC3C,QAAA,MAAM,WAAW,gIAAwB,CAAA;AAEzC,QAAA,MAAM,aAAa,4LAYjB,CAAA;AAiDF,QAAA,MAAM,aAAa;WAGR,OAAO,GAAG,QAAQ,GAAG,OAAO;qBAClB,MAAM;kDAEN,CAAA;AAGrB,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,iBAAiB,GAClB,CAAA"}
|
|
@@ -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"}
|