@vkzstudio/muza-ui 1.0.44 → 1.0.45
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/DataTable/DataTable.d.ts +14 -5
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +39 -39
- package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +38 -7
- package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +165 -163
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +3 -17
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/components/ExpandableTable/ExpandableTable.d.ts +30 -11
- package/dist/components/ExpandableTable/ExpandableTable.d.ts.map +1 -1
- package/dist/components/ExpandableTable/ExpandableTable.js +100 -111
- package/dist/components/ExpandableTable/ExpandableTable.stories.d.ts +3 -1
- package/dist/components/ExpandableTable/ExpandableTable.stories.d.ts.map +1 -1
- package/dist/components/FileUpload/FileItem.d.ts +6 -0
- package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
- package/dist/components/FileUpload/FileItem.js +38 -41
- package/dist/components/FileUpload/FileUpload.d.ts +32 -0
- package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/components/FileUpload/FileUpload.js +87 -83
- 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/Icons/CustomBadges.d.ts +14 -0
- package/dist/components/Icons/CustomBadges.d.ts.map +1 -0
- package/dist/components/Icons/CustomBadges.js +334 -0
- package/dist/components/Icons/CustomIcons.d.ts +24 -0
- package/dist/components/Icons/CustomIcons.d.ts.map +1 -1
- package/dist/components/Icons/CustomIcons.js +88 -42
- package/dist/components/Icons/CustomLogos.d.ts +29 -0
- package/dist/components/Icons/CustomLogos.d.ts.map +1 -0
- package/dist/components/Icons/CustomLogos.js +593 -0
- package/dist/components/Icons/LogosAndBadges.stories.d.ts +7 -0
- package/dist/components/Icons/LogosAndBadges.stories.d.ts.map +1 -0
- package/dist/components/Icons/index.d.ts +2 -0
- package/dist/components/Icons/index.d.ts.map +1 -1
- package/dist/components/LanguageSwitcher/LanguageSwitcher.d.ts +24 -1
- package/dist/components/LanguageSwitcher/LanguageSwitcher.d.ts.map +1 -1
- package/dist/components/LanguageSwitcher/LanguageSwitcher.js +71 -52
- package/dist/components/LanguageSwitcher/LanguageSwitcher.stories.d.ts +2 -0
- package/dist/components/LanguageSwitcher/LanguageSwitcher.stories.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +18 -17
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.d.ts +266 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.d.ts.map +1 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.examples.d.ts +39 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.examples.d.ts.map +1 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.js +134 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.stories.d.ts +14 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.stories.d.ts.map +1 -0
- package/dist/components/ResponsiveLayoutTable/index.d.ts +2 -0
- package/dist/components/ResponsiveLayoutTable/index.d.ts.map +1 -0
- package/dist/components/Select/Select.d.ts +20 -7
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +123 -92
- package/dist/components/Select/Select.stories.d.ts +1 -0
- package/dist/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/components/Select/utils.d.ts +1 -0
- package/dist/components/Select/utils.d.ts.map +1 -1
- package/dist/components/Select/utils.js +5 -2
- package/dist/components/Toggle/Toggle.js +1 -1
- package/dist/components/ToggleCheckButton/ToggleCheckButton.d.ts +69 -0
- package/dist/components/ToggleCheckButton/ToggleCheckButton.d.ts.map +1 -0
- package/dist/components/ToggleCheckButton/ToggleCheckButton.js +64 -0
- package/dist/components/ToggleCheckButton/ToggleCheckButton.stories.d.ts +8 -0
- package/dist/components/ToggleCheckButton/ToggleCheckButton.stories.d.ts.map +1 -0
- package/dist/components/ToggleCheckButton/index.d.ts +2 -0
- package/dist/components/ToggleCheckButton/index.d.ts.map +1 -0
- package/dist/components/WebCheckoutNav/WebCheckoutNav.examples.d.ts +19 -0
- package/dist/components/WebCheckoutNav/WebCheckoutNav.examples.d.ts.map +1 -0
- package/dist/components/WebCheckoutNav/WebCheckoutNav.stories.d.ts +8 -0
- package/dist/components/WebCheckoutNav/WebCheckoutNav.stories.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/hooks/use-is-breakpoint.d.ts +11 -0
- package/dist/hooks/use-is-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-is-breakpoint.js +24 -13
- package/dist/index.js +236 -215
- package/dist/muza-ui.css +1 -1
- package/dist/styles/token-colors.css +64 -3
- package/dist/styles/token-sizes.css +86 -54
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +16 -5
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as m, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cva as
|
|
4
|
-
import {
|
|
5
|
-
import { Table as
|
|
6
|
-
import { cn as
|
|
1
|
+
import { jsxs as m, jsx as t, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { useState as F, useRef as _, useEffect as O, useCallback as W, useMemo as K, Fragment as q } from "react";
|
|
3
|
+
import { cva as J } from "class-variance-authority";
|
|
4
|
+
import { useBreakpoints as Q } from "../../hooks/use-is-breakpoint.js";
|
|
5
|
+
import { Table as U, TableHeader as X, TableRow as B, TableHead as Y, TableRowGroup as Z, TableCell as M } from "./Table.js";
|
|
6
|
+
import { cn as l } from "../../utils/cn.js";
|
|
7
7
|
import { Typography as g } from "../Typography/Typography.js";
|
|
8
|
-
import { AltArrowDownOutline as
|
|
9
|
-
import { Flex as
|
|
10
|
-
const
|
|
8
|
+
import { AltArrowDownOutline as w } from "@solar-icons/react-perf";
|
|
9
|
+
import { Flex as $ } from "../Flex/Flex.js";
|
|
10
|
+
const j = J("", {
|
|
11
11
|
variants: {
|
|
12
12
|
responsive: {
|
|
13
13
|
xs: "",
|
|
@@ -28,26 +28,26 @@ const G = D("", {
|
|
|
28
28
|
"3xl": "3xl:hidden"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
}),
|
|
32
|
-
data:
|
|
33
|
-
columns:
|
|
34
|
-
expandableRowSections:
|
|
31
|
+
}), z = (s) => typeof s == "string" && (s === "xs" || s === "sm" || s === "md" || s === "lg" || s === "xl" || s === "2xl" || s === "3xl"), E = (s, o) => s === void 0 || s === "xs" ? !0 : typeof s == "boolean" ? s : o[s], se = ({
|
|
32
|
+
data: s,
|
|
33
|
+
columns: o,
|
|
34
|
+
expandableRowSections: n,
|
|
35
35
|
classNames: p
|
|
36
36
|
}) => {
|
|
37
|
-
const [v,
|
|
37
|
+
const [v, H] = F(/* @__PURE__ */ new Set()), [L, u] = F(/* @__PURE__ */ new Set()), f = _(
|
|
38
38
|
/* @__PURE__ */ new Map()
|
|
39
39
|
);
|
|
40
|
-
|
|
40
|
+
O(() => {
|
|
41
41
|
const e = f.current;
|
|
42
42
|
return () => {
|
|
43
43
|
e.forEach((i) => clearTimeout(i)), e.clear();
|
|
44
44
|
};
|
|
45
45
|
}, []);
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
|
|
46
|
+
const C = W((e) => {
|
|
47
|
+
H((i) => {
|
|
48
|
+
const a = new Set(i);
|
|
49
|
+
if (a.has(e)) {
|
|
50
|
+
a.delete(e), u((c) => {
|
|
51
51
|
const r = new Set(c);
|
|
52
52
|
return r.add(e), r;
|
|
53
53
|
});
|
|
@@ -55,53 +55,42 @@ const G = D("", {
|
|
|
55
55
|
d && clearTimeout(d), f.current.set(
|
|
56
56
|
e,
|
|
57
57
|
setTimeout(() => {
|
|
58
|
-
|
|
58
|
+
u((c) => {
|
|
59
59
|
const r = new Set(c);
|
|
60
60
|
return r.delete(e), r;
|
|
61
61
|
}), f.current.delete(e);
|
|
62
62
|
}, 150)
|
|
63
63
|
);
|
|
64
64
|
} else {
|
|
65
|
-
|
|
65
|
+
a.add(e);
|
|
66
66
|
const d = f.current.get(e);
|
|
67
|
-
d && (clearTimeout(d), f.current.delete(e),
|
|
67
|
+
d && (clearTimeout(d), f.current.delete(e), u((c) => {
|
|
68
68
|
const r = new Set(c);
|
|
69
69
|
return r.delete(e), r;
|
|
70
70
|
}));
|
|
71
71
|
}
|
|
72
|
-
return
|
|
72
|
+
return a;
|
|
73
73
|
});
|
|
74
|
-
}, []),
|
|
75
|
-
() => (
|
|
76
|
-
xs
|
|
77
|
-
sm: N,
|
|
78
|
-
md: V,
|
|
79
|
-
lg: F,
|
|
80
|
-
xl: K,
|
|
81
|
-
"2xl": L,
|
|
82
|
-
"3xl": $
|
|
83
|
-
}),
|
|
84
|
-
[N, V, F, K, L, $]
|
|
85
|
-
), j = E(
|
|
86
|
-
() => a.some(
|
|
87
|
-
(e) => e.responsive !== void 0 && e.responsive !== "xs" && e.moveToExpandable !== !1 && !C(e.responsive, u)
|
|
74
|
+
}, []), x = Q(), N = K(
|
|
75
|
+
() => o.some(
|
|
76
|
+
(e) => e.responsive !== void 0 && e.responsive !== "xs" && e.moveToExpandable !== !1 && !E(e.responsive, x)
|
|
88
77
|
),
|
|
89
|
-
[
|
|
90
|
-
), { firstVisibleIndex:
|
|
78
|
+
[o, x]
|
|
79
|
+
), { firstVisibleIndex: P, lastVisibleIndex: A } = K(() => {
|
|
91
80
|
let e = -1, i = -1;
|
|
92
|
-
return
|
|
93
|
-
|
|
81
|
+
return o.forEach((a, d) => {
|
|
82
|
+
E(a.responsive, x) && (e === -1 && (e = d), i = d);
|
|
94
83
|
}), { firstVisibleIndex: e, lastVisibleIndex: i };
|
|
95
|
-
}, [
|
|
96
|
-
return /* @__PURE__ */ m(
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
const
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
-
|
|
84
|
+
}, [o, x]), y = !n && N, V = !!n || y;
|
|
85
|
+
return /* @__PURE__ */ m(U, { children: [
|
|
86
|
+
/* @__PURE__ */ t(X, { children: /* @__PURE__ */ t(B, { className: "[&>th]:border-0 [&>th]:bg-transparent", children: o.map((e, i) => {
|
|
87
|
+
const a = z(e.responsive) ? e.responsive : void 0, d = e.responsive === !1;
|
|
88
|
+
return /* @__PURE__ */ t(
|
|
89
|
+
Y,
|
|
101
90
|
{
|
|
102
|
-
className:
|
|
91
|
+
className: l(
|
|
103
92
|
e.className,
|
|
104
|
-
|
|
93
|
+
j({ responsive: a }),
|
|
105
94
|
d && "hidden"
|
|
106
95
|
),
|
|
107
96
|
children: e.title
|
|
@@ -109,45 +98,45 @@ const G = D("", {
|
|
|
109
98
|
i
|
|
110
99
|
);
|
|
111
100
|
}) }) }),
|
|
112
|
-
|
|
101
|
+
s.map((e) => {
|
|
113
102
|
var c;
|
|
114
|
-
const
|
|
103
|
+
const i = e.id, a = v.has(i) || y, d = L.has(i);
|
|
115
104
|
return /* @__PURE__ */ m(
|
|
116
|
-
|
|
105
|
+
Z,
|
|
117
106
|
{
|
|
118
|
-
className:
|
|
119
|
-
"group hover:[&_td]:border-stroke-brand-hover":
|
|
107
|
+
className: l({
|
|
108
|
+
"group hover:[&_td]:border-stroke-brand-hover": n
|
|
120
109
|
}),
|
|
121
110
|
children: [
|
|
122
111
|
/* @__PURE__ */ m(
|
|
123
|
-
|
|
112
|
+
B,
|
|
124
113
|
{
|
|
125
|
-
expandablePosition:
|
|
126
|
-
className:
|
|
127
|
-
"cursor-pointer":
|
|
114
|
+
expandablePosition: n && (v.has(i) || d) || y ? "top" : "none",
|
|
115
|
+
className: l("focus-visible-default", {
|
|
116
|
+
"cursor-pointer": n
|
|
128
117
|
}),
|
|
129
|
-
onClick:
|
|
130
|
-
onKeyDown:
|
|
131
|
-
(r.key === "Enter" || r.key === " ") && (r.preventDefault(),
|
|
118
|
+
onClick: n ? () => C(i) : void 0,
|
|
119
|
+
onKeyDown: n ? (r) => {
|
|
120
|
+
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), C(i));
|
|
132
121
|
} : void 0,
|
|
133
|
-
tabIndex:
|
|
134
|
-
role:
|
|
135
|
-
"aria-expanded":
|
|
122
|
+
tabIndex: n ? 0 : void 0,
|
|
123
|
+
role: n ? "button" : void 0,
|
|
124
|
+
"aria-expanded": n ? v.has(i) : void 0,
|
|
136
125
|
children: [
|
|
137
|
-
|
|
138
|
-
const T =
|
|
139
|
-
return /* @__PURE__ */
|
|
140
|
-
|
|
126
|
+
o.map((r, h) => {
|
|
127
|
+
const T = z(r.responsive) ? r.responsive : void 0, b = r.responsive === !1;
|
|
128
|
+
return /* @__PURE__ */ t(
|
|
129
|
+
M,
|
|
141
130
|
{
|
|
142
|
-
isFirst: h ===
|
|
143
|
-
isLast: h ===
|
|
144
|
-
expandablePosition: (
|
|
145
|
-
className:
|
|
131
|
+
isFirst: h === P,
|
|
132
|
+
isLast: h === A && !n,
|
|
133
|
+
expandablePosition: (a || d) && V ? "top" : "none",
|
|
134
|
+
className: l(
|
|
146
135
|
r.className,
|
|
147
|
-
|
|
136
|
+
j({ responsive: T }),
|
|
148
137
|
b && "hidden"
|
|
149
138
|
),
|
|
150
|
-
children: r.render ? r.render(e[r.dataKey], e) : /* @__PURE__ */
|
|
139
|
+
children: r.render ? r.render(e[r.dataKey], e) : /* @__PURE__ */ t(
|
|
151
140
|
g,
|
|
152
141
|
{
|
|
153
142
|
variant: "body",
|
|
@@ -161,17 +150,17 @@ const G = D("", {
|
|
|
161
150
|
h
|
|
162
151
|
);
|
|
163
152
|
}),
|
|
164
|
-
|
|
165
|
-
|
|
153
|
+
n && /* @__PURE__ */ t(
|
|
154
|
+
M,
|
|
166
155
|
{
|
|
167
156
|
className: "w-[68px]",
|
|
168
157
|
isFirst: !1,
|
|
169
158
|
isLast: !0,
|
|
170
159
|
expandablePosition: v.has(i) || d ? "top" : "none",
|
|
171
|
-
children: /* @__PURE__ */
|
|
172
|
-
|
|
160
|
+
children: /* @__PURE__ */ t(
|
|
161
|
+
w,
|
|
173
162
|
{
|
|
174
|
-
className:
|
|
163
|
+
className: l(
|
|
175
164
|
"text-text-brand-def transition-transform duration-300",
|
|
176
165
|
{
|
|
177
166
|
"rotate-180": v.has(i)
|
|
@@ -184,51 +173,51 @@ const G = D("", {
|
|
|
184
173
|
]
|
|
185
174
|
}
|
|
186
175
|
),
|
|
187
|
-
|
|
176
|
+
V && /* @__PURE__ */ t("tr", { "aria-hidden": !a, children: /* @__PURE__ */ t(
|
|
188
177
|
"td",
|
|
189
178
|
{
|
|
190
|
-
colSpan:
|
|
179
|
+
colSpan: o.length + (n ? 1 : 0),
|
|
191
180
|
className: "border-0 p-0",
|
|
192
|
-
children: /* @__PURE__ */
|
|
181
|
+
children: /* @__PURE__ */ t(
|
|
193
182
|
"div",
|
|
194
183
|
{
|
|
195
|
-
className:
|
|
184
|
+
className: l(
|
|
196
185
|
"grid transition-[grid-template-rows] duration-300 ease-in-out",
|
|
197
|
-
|
|
186
|
+
a ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
198
187
|
),
|
|
199
|
-
children: /* @__PURE__ */
|
|
188
|
+
children: /* @__PURE__ */ t("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ m(
|
|
200
189
|
"div",
|
|
201
190
|
{
|
|
202
|
-
className:
|
|
191
|
+
className: l(
|
|
203
192
|
"rounded-b-xl border-x-1 border-b-1 border-stroke-base-secondary bg-surface-base-secondary transition-colors group-hover:border-stroke-brand-hover"
|
|
204
193
|
),
|
|
205
194
|
children: [
|
|
206
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ t("div", { className: "mx-comp-table-p border-t-1 border-stroke-base-secondary" }),
|
|
207
196
|
/* @__PURE__ */ m(
|
|
208
197
|
"div",
|
|
209
198
|
{
|
|
210
|
-
className:
|
|
199
|
+
className: l(
|
|
211
200
|
"grid grid-cols-1 gap-2xl px-comp-table-p py-2xl md:grid-cols-[auto_1fr]",
|
|
212
201
|
p == null ? void 0 : p.expandedContentGrid
|
|
213
202
|
),
|
|
214
203
|
children: [
|
|
215
|
-
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
|
|
204
|
+
N && /* @__PURE__ */ m(G, { children: [
|
|
205
|
+
/* @__PURE__ */ t(
|
|
206
|
+
$,
|
|
218
207
|
{
|
|
219
208
|
gap: "md",
|
|
220
209
|
direction: "column",
|
|
221
210
|
className: "col-span-full",
|
|
222
|
-
children:
|
|
223
|
-
(r) => r.moveToExpandable !== !1 && r.responsive !== void 0 && r.responsive !== "xs" && !
|
|
211
|
+
children: o.filter(
|
|
212
|
+
(r) => r.moveToExpandable !== !1 && r.responsive !== void 0 && r.responsive !== "xs" && !E(r.responsive, x)
|
|
224
213
|
).map((r, h) => /* @__PURE__ */ m(
|
|
225
|
-
|
|
214
|
+
$,
|
|
226
215
|
{
|
|
227
216
|
align: "center",
|
|
228
217
|
justify: "between",
|
|
229
218
|
direction: "row",
|
|
230
219
|
children: [
|
|
231
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ t(
|
|
232
221
|
g,
|
|
233
222
|
{
|
|
234
223
|
variant: "body",
|
|
@@ -239,7 +228,7 @@ const G = D("", {
|
|
|
239
228
|
r.render ? r.render(
|
|
240
229
|
e[r.dataKey],
|
|
241
230
|
e
|
|
242
|
-
) : /* @__PURE__ */
|
|
231
|
+
) : /* @__PURE__ */ t(
|
|
243
232
|
g,
|
|
244
233
|
{
|
|
245
234
|
variant: "body",
|
|
@@ -255,21 +244,21 @@ const G = D("", {
|
|
|
255
244
|
))
|
|
256
245
|
}
|
|
257
246
|
),
|
|
258
|
-
|
|
247
|
+
n && /* @__PURE__ */ t("hr", { className: "col-span-full text-stroke-base-secondary md:col-span-2" })
|
|
259
248
|
] }),
|
|
260
|
-
(c = typeof
|
|
261
|
-
if (!
|
|
262
|
-
const T = typeof
|
|
263
|
-
return /* @__PURE__ */ m(
|
|
249
|
+
(c = typeof n == "function" ? n(e) : n) == null ? void 0 : c.map((r, h) => {
|
|
250
|
+
if (!n) return null;
|
|
251
|
+
const T = typeof n == "function" ? n(e).length : n.length;
|
|
252
|
+
return /* @__PURE__ */ m(q, { children: [
|
|
264
253
|
/* @__PURE__ */ m(
|
|
265
254
|
"div",
|
|
266
255
|
{
|
|
267
|
-
className:
|
|
256
|
+
className: l(
|
|
268
257
|
"col-span-full grid grid-cols-1 gap-y-xl md:col-span-2 md:grid-cols-subgrid",
|
|
269
258
|
p == null ? void 0 : p.sectionTitle
|
|
270
259
|
),
|
|
271
260
|
children: [
|
|
272
|
-
r.title && /* @__PURE__ */
|
|
261
|
+
r.title && /* @__PURE__ */ t(
|
|
273
262
|
g,
|
|
274
263
|
{
|
|
275
264
|
variant: "body",
|
|
@@ -281,16 +270,16 @@ const G = D("", {
|
|
|
281
270
|
children: r.title
|
|
282
271
|
}
|
|
283
272
|
),
|
|
284
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ t(
|
|
285
274
|
"div",
|
|
286
275
|
{
|
|
287
|
-
className:
|
|
276
|
+
className: l(
|
|
288
277
|
"col-span-full grid grid-cols-1 gap-x-3xl md:col-span-2 md:grid-cols-subgrid md:gap-y-md",
|
|
289
278
|
p == null ? void 0 : p.cellsWrap
|
|
290
279
|
),
|
|
291
280
|
children: r.cells.flatMap(
|
|
292
281
|
(b, k) => [
|
|
293
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ t(
|
|
294
283
|
g,
|
|
295
284
|
{
|
|
296
285
|
component: "span",
|
|
@@ -300,7 +289,7 @@ const G = D("", {
|
|
|
300
289
|
},
|
|
301
290
|
`${k}-label`
|
|
302
291
|
),
|
|
303
|
-
b.render ? /* @__PURE__ */
|
|
292
|
+
b.render ? /* @__PURE__ */ t(
|
|
304
293
|
"div",
|
|
305
294
|
{
|
|
306
295
|
className: "mb-md block last-of-type:mb-0 md:mb-0",
|
|
@@ -310,7 +299,7 @@ const G = D("", {
|
|
|
310
299
|
)
|
|
311
300
|
},
|
|
312
301
|
`${k}-value`
|
|
313
|
-
) : /* @__PURE__ */
|
|
302
|
+
) : /* @__PURE__ */ t(
|
|
314
303
|
g,
|
|
315
304
|
{
|
|
316
305
|
variant: "body",
|
|
@@ -328,7 +317,7 @@ const G = D("", {
|
|
|
328
317
|
]
|
|
329
318
|
}
|
|
330
319
|
),
|
|
331
|
-
h < T - 1 && /* @__PURE__ */
|
|
320
|
+
h < T - 1 && /* @__PURE__ */ t("hr", { className: "col-span-full text-stroke-base-secondary md:col-span-2" })
|
|
332
321
|
] }, h);
|
|
333
322
|
})
|
|
334
323
|
]
|
|
@@ -349,5 +338,5 @@ const G = D("", {
|
|
|
349
338
|
] });
|
|
350
339
|
};
|
|
351
340
|
export {
|
|
352
|
-
|
|
341
|
+
se as ExpandableTable
|
|
353
342
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react-vite';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: <T
|
|
4
|
+
component: <T extends {
|
|
5
|
+
id: string | number;
|
|
6
|
+
}>({ data, columns, expandableRowSections, classNames, }: import('./ExpandableTable').ExpandableTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
parameters: {
|
|
6
8
|
layout: string;
|
|
7
9
|
docs: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ExpandableTable/ExpandableTable.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAO3D,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"ExpandableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ExpandableTable/ExpandableTable.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAO3D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC8B,CAAA;AAExC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAmNlC,eAAO,MAAM,MAAM,EAAE,KAsBpB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAkB/B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAwJjC,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAuBvB,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,KAyH1C,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KA0DhC,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAoExB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KA6EjC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KA2E/B,CAAA"}
|
|
@@ -22,6 +22,12 @@ interface FileItemBaseProps {
|
|
|
22
22
|
secondaryText?: React.ReactNode;
|
|
23
23
|
/** Fires when the delete button is clicked. */
|
|
24
24
|
onDelete: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* When provided, replaces the default download behavior. Use when the consumer
|
|
27
|
+
* needs to mint a fresh URL (e.g., short-lived authed URL fetched by UUID) or
|
|
28
|
+
* pull the authoritative copy from a server instead of using the local blob.
|
|
29
|
+
*/
|
|
30
|
+
onDownload?: () => void;
|
|
25
31
|
/** Fires when an internal error occurs (e.g., download failure). */
|
|
26
32
|
onError?: (error: string, file?: File) => void;
|
|
27
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA8C9B;;;GAGG;AACH,UAAU,iBAAiB;IACzB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,oEAAoE;IACpE,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,iEAAiE;IACjE,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,sEAAsE;IACtE,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC/B,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,oEAAoE;IACpE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;CAC/C;AAED,qEAAqE;AACrE,UAAU,iBAAkB,SAAQ,iBAAiB;IACnD,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,IAAI,CAAA;CACX;AAED,oFAAoF;AACpF,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,wGAAwG;AACxG,KAAK,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,CAAA;AAsEzD,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,
|
|
1
|
+
{"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA8C9B;;;GAGG;AACH,UAAU,iBAAiB;IACzB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,oEAAoE;IACpE,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,iEAAiE;IACjE,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,sEAAsE;IACtE,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC/B,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,oEAAoE;IACpE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;CAC/C;AAED,qEAAqE;AACrE,UAAU,iBAAkB,SAAQ,iBAAiB;IACnD,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,IAAI,CAAA;CACX;AAED,oFAAoF;AACpF,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,wGAAwG;AACxG,KAAK,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,CAAA;AAsEzD,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,4CAiO5C,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as f, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import * as p from "react";
|
|
3
|
-
import { cva as
|
|
4
|
-
import { useMuzaTranslations as
|
|
5
|
-
import { Flex as
|
|
3
|
+
import { cva as _ } from "class-variance-authority";
|
|
4
|
+
import { useMuzaTranslations as B } from "../../translations/TranslationContext.js";
|
|
5
|
+
import { Flex as z } from "../Flex/Flex.js";
|
|
6
6
|
import { cn as a } from "../../utils/cn.js";
|
|
7
|
-
import { GalleryOutline as
|
|
7
|
+
import { GalleryOutline as M, FileTextBold as j, CloseCircleBold as D, DownloadMinimalisticBold as I, TrashBinTrashBold as R } from "@solar-icons/react-perf";
|
|
8
8
|
import { Typography as u } from "../Typography/Typography.js";
|
|
9
|
-
const
|
|
9
|
+
const S = (e, l, i) => {
|
|
10
10
|
let n = null, o = null;
|
|
11
11
|
try {
|
|
12
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();
|
|
@@ -16,7 +16,7 @@ const D = (e, l, i) => {
|
|
|
16
16
|
} finally {
|
|
17
17
|
o && document.body.contains(o) && document.body.removeChild(o), n && URL.revokeObjectURL(n);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
19
|
+
}, A = _(
|
|
20
20
|
[
|
|
21
21
|
"flex flex-1 items-center gap-sm rounded-full border transition-colors",
|
|
22
22
|
"relative pr-comp-input-p-hor pl-comp-input-p-hor",
|
|
@@ -63,7 +63,7 @@ const D = (e, l, i) => {
|
|
|
63
63
|
"bg-none cursor-pointer disabled:cursor-not-allowed",
|
|
64
64
|
"text-comp-file-upload-icon-def-secondary",
|
|
65
65
|
"disabled:text-comp-file-upload-icon-def-disabled"
|
|
66
|
-
]),
|
|
66
|
+
]), F = /\.(jpe?g|png|gif|webp|svg|bmp|ico|avif|tiff?)$/i, E = /\.(pdf|docx?|txt|rtf|odt|xlsx?|csv|pptx?|md|tex)$/i, L = [
|
|
67
67
|
"application/pdf",
|
|
68
68
|
"application/msword",
|
|
69
69
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
@@ -76,7 +76,7 @@ const D = (e, l, i) => {
|
|
|
76
76
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
77
77
|
"application/vnd.ms-powerpoint",
|
|
78
78
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
79
|
-
],
|
|
79
|
+
], q = (e) => {
|
|
80
80
|
const {
|
|
81
81
|
uploaded: l,
|
|
82
82
|
progress: i,
|
|
@@ -87,37 +87,38 @@ const D = (e, l, i) => {
|
|
|
87
87
|
error: s,
|
|
88
88
|
secondaryText: y,
|
|
89
89
|
onDelete: g,
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
onDownload: v,
|
|
91
|
+
onError: T
|
|
92
|
+
} = e, m = B(), [w, N] = p.useState(!1), k = e.source === "file" ? e.file.name : e.name, b = e.source === "url" ? (e.type ?? "").startsWith("image/") || F.test(e.name) : e.file.type.startsWith("image/"), C = e.source === "url" ? L.includes(e.type ?? "") || E.test(e.name) : L.includes(e.file.type) || E.test(e.file.name), d = e.source === "file" ? e.file : e.url, O = p.useMemo(() => o ? "disabled" : s ? "error" : typeof i == "number" && i > 0 && i < 100 ? "loading" : "default", [o, s, i]), x = p.useMemo(() => {
|
|
92
93
|
if (b)
|
|
93
94
|
return typeof d == "string" ? d : URL.createObjectURL(d);
|
|
94
95
|
}, [b, d]);
|
|
95
|
-
return p.useEffect(() =>
|
|
96
|
+
return p.useEffect(() => N(!1), [d]), /* @__PURE__ */ f(z, { gap: "sm", direction: "column", component: "li", children: [
|
|
96
97
|
/* @__PURE__ */ f(
|
|
97
98
|
"div",
|
|
98
99
|
{
|
|
99
100
|
className: a(
|
|
100
|
-
|
|
101
|
-
variant:
|
|
101
|
+
A({
|
|
102
|
+
variant: O,
|
|
102
103
|
size: n
|
|
103
104
|
})
|
|
104
105
|
),
|
|
105
106
|
children: [
|
|
106
|
-
x && !
|
|
107
|
+
x && !w && /* @__PURE__ */ t(
|
|
107
108
|
"img",
|
|
108
109
|
{
|
|
109
110
|
src: x,
|
|
110
|
-
alt:
|
|
111
|
+
alt: k,
|
|
111
112
|
width: 24,
|
|
112
113
|
height: 24,
|
|
113
|
-
onError: () =>
|
|
114
|
+
onError: () => N(!0),
|
|
114
115
|
className: a("size-icon-medium shrink-0 rounded-xs object-cover", {
|
|
115
116
|
"opacity-50 saturate-0": o
|
|
116
117
|
})
|
|
117
118
|
}
|
|
118
119
|
),
|
|
119
|
-
x &&
|
|
120
|
-
|
|
120
|
+
x && w && /* @__PURE__ */ t(
|
|
121
|
+
M,
|
|
121
122
|
{
|
|
122
123
|
className: a(
|
|
123
124
|
"size-icon-medium shrink-0 text-comp-file-upload-icon-def-secondary",
|
|
@@ -127,8 +128,8 @@ const D = (e, l, i) => {
|
|
|
127
128
|
)
|
|
128
129
|
}
|
|
129
130
|
),
|
|
130
|
-
!b &&
|
|
131
|
-
|
|
131
|
+
!b && C && /* @__PURE__ */ t(
|
|
132
|
+
j,
|
|
132
133
|
{
|
|
133
134
|
className: a(
|
|
134
135
|
"size-icon-medium shrink-0 text-comp-file-upload-icon-def-secondary",
|
|
@@ -138,7 +139,7 @@ const D = (e, l, i) => {
|
|
|
138
139
|
)
|
|
139
140
|
}
|
|
140
141
|
),
|
|
141
|
-
/* @__PURE__ */ f(
|
|
142
|
+
/* @__PURE__ */ f(z, { direction: "column", className: "min-w-0 flex-1 justify-center", children: [
|
|
142
143
|
/* @__PURE__ */ t(
|
|
143
144
|
u,
|
|
144
145
|
{
|
|
@@ -148,7 +149,7 @@ const D = (e, l, i) => {
|
|
|
148
149
|
variant: "body",
|
|
149
150
|
weight: "medium",
|
|
150
151
|
fixY: !0,
|
|
151
|
-
children:
|
|
152
|
+
children: k
|
|
152
153
|
}
|
|
153
154
|
),
|
|
154
155
|
y && /* @__PURE__ */ t(
|
|
@@ -177,7 +178,7 @@ const D = (e, l, i) => {
|
|
|
177
178
|
"focus-visible:text-comp-file-upload-icon-def-focused",
|
|
178
179
|
"disabled:text-comp-file-upload-icon-def-disabled"
|
|
179
180
|
),
|
|
180
|
-
children: /* @__PURE__ */ t(
|
|
181
|
+
children: /* @__PURE__ */ t(D, { className: "size-icon-medium" })
|
|
181
182
|
}
|
|
182
183
|
),
|
|
183
184
|
l && /* @__PURE__ */ f("div", { className: "flex gap-xl", children: [
|
|
@@ -186,24 +187,20 @@ const D = (e, l, i) => {
|
|
|
186
187
|
{
|
|
187
188
|
type: "button",
|
|
188
189
|
disabled: o,
|
|
189
|
-
onClick: () =>
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
window.location.origin
|
|
194
|
-
);
|
|
195
|
-
["http:", "https:", "blob:"].includes(k.protocol) && window.open(
|
|
196
|
-
k.href,
|
|
197
|
-
"_blank",
|
|
198
|
-
"noopener,noreferrer"
|
|
199
|
-
);
|
|
200
|
-
} catch {
|
|
190
|
+
onClick: () => {
|
|
191
|
+
if (v) {
|
|
192
|
+
v();
|
|
193
|
+
return;
|
|
201
194
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
195
|
+
if (e.source === "url")
|
|
196
|
+
try {
|
|
197
|
+
const U = new URL(e.url, window.location.origin);
|
|
198
|
+
["http:", "https:", "blob:"].includes(U.protocol) && window.open(U.href, "_blank", "noopener,noreferrer");
|
|
199
|
+
} catch {
|
|
200
|
+
}
|
|
201
|
+
else
|
|
202
|
+
S(e.file, T, m.fileUpload.downloadError);
|
|
203
|
+
},
|
|
207
204
|
"aria-label": m.fileUpload.downloadButtonAriaLabel,
|
|
208
205
|
className: a(
|
|
209
206
|
h,
|
|
@@ -273,5 +270,5 @@ const D = (e, l, i) => {
|
|
|
273
270
|
] });
|
|
274
271
|
};
|
|
275
272
|
export {
|
|
276
|
-
|
|
273
|
+
q as FileItem
|
|
277
274
|
};
|
|
@@ -180,6 +180,38 @@ export interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElemen
|
|
|
180
180
|
preselectedUrls?: PreselectedUrl[];
|
|
181
181
|
/** Fires when a URL-backed item is removed. Receives the item and its index in `preselectedUrls`. @see PreselectedUrl */
|
|
182
182
|
onDeleteUrl?: (item: PreselectedUrl, index: number) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Fires when the download button is clicked on a URL-backed item. When provided,
|
|
185
|
+
* replaces the default `window.open` behavior — use this when the URL needs to be
|
|
186
|
+
* minted on demand (e.g., short-lived authed URLs fetched by UUID).
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* <FileUpload
|
|
190
|
+
* preselectedUrls={items}
|
|
191
|
+
* onDownloadUrl={async (_item, index) => {
|
|
192
|
+
* const fresh = await fetchAuthedUrl(items[index].uuid)
|
|
193
|
+
* window.open(fresh, '_blank', 'noopener,noreferrer')
|
|
194
|
+
* }}
|
|
195
|
+
* />
|
|
196
|
+
*
|
|
197
|
+
* @see PreselectedUrl
|
|
198
|
+
*/
|
|
199
|
+
onDownloadUrl?: (item: PreselectedUrl, index: number) => void;
|
|
200
|
+
/**
|
|
201
|
+
* Fires when the download button is clicked on an uploaded `File` item. When provided,
|
|
202
|
+
* replaces the default blob-download behavior — use this when the authoritative copy
|
|
203
|
+
* lives on a server and should be fetched rather than streamed from the local `File`.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* <FileUpload
|
|
207
|
+
* preselectedFiles={files}
|
|
208
|
+
* onDownloadFile={async (file) => {
|
|
209
|
+
* const fresh = await fetchAuthedUrl(file.name)
|
|
210
|
+
* window.open(fresh, '_blank', 'noopener,noreferrer')
|
|
211
|
+
* }}
|
|
212
|
+
* />
|
|
213
|
+
*/
|
|
214
|
+
onDownloadFile?: (file: File, index: number) => void;
|
|
183
215
|
/** Extra content rendered inline next to the label (e.g. a tooltip icon). Takes precedence over `infoTooltip`. */
|
|
184
216
|
labelExtra?: React.ReactNode;
|
|
185
217
|
/** Tooltip content shown in an info icon next to the label. Ignored when `labelExtra` is provided. */
|