@caspeco/casper-ui-library 4.0.0 → 4.1.0
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/combobox/combobox-button.d.ts +1 -1
- package/dist/components/combobox/combobox-button.d.ts.map +1 -1
- package/dist/components/combobox/combobox-button.js +85 -69
- package/dist/components/combobox/combobox-item.d.ts +2 -1
- package/dist/components/combobox/combobox-item.d.ts.map +1 -1
- package/dist/components/combobox/combobox-item.js +10 -10
- package/dist/components/combobox/combobox-menu.js +68 -69
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/combobox.js +120 -123
- package/dist/components/combobox/types.d.ts +2 -0
- package/dist/components/combobox/types.d.ts.map +1 -1
- package/dist/components/date-picker/base-date-picker.js +175 -176
- package/dist/components/date-picker/date-picker-header.js +10 -10
- package/dist/components/date-picker/helper.js +9 -9
- package/dist/components/image-upload/image-cropper.js +112 -113
- package/dist/components/image-upload/image-upload-dropzone.js +35 -36
- package/dist/components/menu/menu-group.js +44 -45
- package/dist/components/segmented-control/segmented-control.js +29 -29
- package/dist/components/table/table-cell.js +25 -26
- package/dist/components/table/table-header-dropdown.js +60 -60
- package/dist/components/table/table-header-row.js +19 -20
- package/dist/components/table/table-toolbar.js +63 -64
- package/dist/components/table/use-controllable-state.js +7 -7
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +1 -1
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +41 -41
- package/dist/node_modules/date-fns/addDays.js +7 -7
- package/dist/node_modules/date-fns/addMonths.js +13 -13
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +11 -11
- package/dist/node_modules/date-fns/endOfDay.js +6 -6
- package/dist/node_modules/date-fns/endOfMonth.js +6 -6
- package/dist/node_modules/date-fns/format.js +46 -47
- package/dist/node_modules/date-fns/getDayOfYear.js +8 -8
- package/dist/node_modules/date-fns/getISOWeek.js +9 -9
- package/dist/node_modules/date-fns/getISOWeekYear.js +10 -10
- package/dist/node_modules/date-fns/getWeek.js +9 -9
- package/dist/node_modules/date-fns/getWeekYear.js +13 -14
- package/dist/node_modules/date-fns/isSameDay.js +9 -9
- package/dist/node_modules/date-fns/isSameMonth.js +9 -9
- package/dist/node_modules/date-fns/isSameWeek.js +8 -8
- package/dist/node_modules/date-fns/isSameYear.js +9 -9
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +12 -12
- package/dist/node_modules/date-fns/locale/da/_lib/formatDistance.js +4 -4
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +3 -3
- package/dist/node_modules/date-fns/locale/es/_lib/formatDistance.js +4 -4
- package/dist/node_modules/date-fns/locale/et/_lib/formatDistance.js +6 -6
- package/dist/node_modules/date-fns/locale/fi/_lib/formatDistance.js +17 -17
- package/dist/node_modules/date-fns/locale/lt/_lib/formatDistance.js +47 -47
- package/dist/node_modules/date-fns/locale/lv/_lib/formatDistance.js +11 -11
- package/dist/node_modules/date-fns/locale/nb/_lib/formatDistance.js +3 -3
- package/dist/node_modules/date-fns/locale/nl/_lib/formatDistance.js +4 -4
- package/dist/node_modules/date-fns/locale/sv/_lib/formatDistance.js +5 -5
- package/dist/node_modules/date-fns/startOfDay.js +6 -6
- package/dist/node_modules/date-fns/startOfMonth.js +6 -6
- package/dist/node_modules/date-fns/startOfWeek.js +7 -8
- package/dist/node_modules/date-fns/startOfWeekYear.js +9 -10
- package/dist/node_modules/date-fns/startOfYear.js +5 -5
- package/dist/theme/theme-config/components/modal-theme.js +13 -15
- package/dist/theme/theme-config/components/select-theme.js +15 -19
- package/package.json +3 -3
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { adjustCrop as
|
|
4
|
-
function
|
|
5
|
-
src:
|
|
6
|
-
crop:
|
|
7
|
-
onCropCallback:
|
|
8
|
-
setPreviewImage:
|
|
9
|
-
aspectRatio:
|
|
1
|
+
import { jsx as O } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as R, useState as q, useEffect as j } from "react";
|
|
3
|
+
import { adjustCrop as X, ScalingDirection as b, getAspectRatioValue as y, calculateHandlePositions as E, getCursorStyle as J, isPointInsideRect as _, getOppositeCorner as K } from "./image-cropper.helper.js";
|
|
4
|
+
function $({
|
|
5
|
+
src: W,
|
|
6
|
+
crop: z,
|
|
7
|
+
onCropCallback: B,
|
|
8
|
+
setPreviewImage: Y,
|
|
9
|
+
aspectRatio: F
|
|
10
10
|
}) {
|
|
11
|
-
const
|
|
11
|
+
const S = R(null), m = R(null), v = R(null), C = R(null), s = R({ left: 0, top: 0, width: 0, height: 0 }), a = R({
|
|
12
12
|
left: 0,
|
|
13
13
|
top: 0
|
|
14
|
-
}), [
|
|
15
|
-
if (
|
|
14
|
+
}), [P, V] = q("crosshair"), T = 10, k = (e) => {
|
|
15
|
+
if (m.current && v.current) {
|
|
16
16
|
const t = {
|
|
17
17
|
width: v.current.width,
|
|
18
18
|
height: v.current.height
|
|
19
|
-
}, o =
|
|
20
|
-
|
|
19
|
+
}, o = X(s.current, m.current, t, e);
|
|
20
|
+
B(o);
|
|
21
21
|
}
|
|
22
|
-
},
|
|
23
|
-
e.fillStyle = "rgba(0, 0, 0, 0.5)", e.fillRect(0, 0, t.width, t.height), e.save(), e.beginPath(), e.rect(o.left, o.top, o.width, o.height), e.clip(),
|
|
24
|
-
const i =
|
|
25
|
-
e.strokeStyle =
|
|
26
|
-
const
|
|
27
|
-
switch (
|
|
22
|
+
}, A = (e, t, o, w) => {
|
|
23
|
+
e.fillStyle = "rgba(0, 0, 0, 0.5)", e.fillRect(0, 0, t.width, t.height), e.save(), e.beginPath(), e.rect(o.left, o.top, o.width, o.height), e.clip(), m.current && e.drawImage(m.current, 0, 0, t.width, t.height), e.restore(), e.strokeStyle = "rgba(255, 255, 255, 0.88)", e.lineWidth = 1, e.strokeRect(o.left, o.top, o.width, o.height), w !== "new-selection" && E(o, T).forEach(({ x: g, y: d, corner: M }) => {
|
|
24
|
+
const i = T / 2, p = 3, c = (n, r = 0) => {
|
|
25
|
+
e.strokeStyle = n, e.lineWidth = p + r, e.beginPath();
|
|
26
|
+
const l = Math.min(o.width / 2, 16), h = Math.min(o.height / 2, 16);
|
|
27
|
+
switch (M) {
|
|
28
28
|
case "bottom-left":
|
|
29
|
-
e.moveTo(
|
|
29
|
+
e.moveTo(g + i, d - h + i), e.lineTo(g + i, d + i), e.lineTo(g + l + i, d + i);
|
|
30
30
|
break;
|
|
31
31
|
case "bottom-right":
|
|
32
|
-
e.moveTo(
|
|
32
|
+
e.moveTo(g + i, d - h + i), e.lineTo(g + i, d + i), e.lineTo(g - l + i, d + i);
|
|
33
33
|
break;
|
|
34
34
|
case "top-left":
|
|
35
|
-
e.moveTo(
|
|
35
|
+
e.moveTo(g + i, d + h + i), e.lineTo(g + i, d + i), e.lineTo(g + l + i, d + i);
|
|
36
36
|
break;
|
|
37
37
|
case "top-right":
|
|
38
|
-
e.moveTo(
|
|
38
|
+
e.moveTo(g + i, d + h + i), e.lineTo(g + i, d + i), e.lineTo(g - l + i, d + i);
|
|
39
39
|
break;
|
|
40
40
|
}
|
|
41
41
|
e.stroke();
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
c("#000", 1), c("#FFF");
|
|
44
44
|
});
|
|
45
|
-
},
|
|
46
|
-
if (
|
|
45
|
+
}, D = () => {
|
|
46
|
+
if (S.current && m.current && v.current) {
|
|
47
47
|
const e = document.createElement("canvas");
|
|
48
|
-
e.width =
|
|
48
|
+
e.width = m.current.width, e.height = m.current.height;
|
|
49
49
|
const t = e.getContext("2d"), o = {
|
|
50
50
|
width: v.current.width,
|
|
51
51
|
height: v.current.height
|
|
52
|
-
}, w =
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
}, w = X(
|
|
53
|
+
s.current,
|
|
54
|
+
m.current,
|
|
55
55
|
o,
|
|
56
|
-
|
|
56
|
+
b.ToFullSize
|
|
57
57
|
);
|
|
58
58
|
if (t)
|
|
59
59
|
return t.drawImage(
|
|
60
|
-
|
|
60
|
+
m.current,
|
|
61
61
|
// Reference to the original image
|
|
62
62
|
w.left,
|
|
63
63
|
w.top,
|
|
@@ -71,126 +71,125 @@ function ee({
|
|
|
71
71
|
}
|
|
72
72
|
return null;
|
|
73
73
|
};
|
|
74
|
-
|
|
75
|
-
const e =
|
|
74
|
+
j(() => {
|
|
75
|
+
const e = S.current, t = e?.getContext("2d");
|
|
76
76
|
if (!e || !t) return;
|
|
77
77
|
const o = new Image();
|
|
78
|
-
o.src =
|
|
79
|
-
const { width:
|
|
80
|
-
e.width = p, e.height =
|
|
78
|
+
o.src = W, o.onload = () => {
|
|
79
|
+
const { width: d } = o, { height: M } = o, i = Math.min(528 / d, 418 / M), p = d * i, c = M * i;
|
|
80
|
+
e.width = p, e.height = c, t.drawImage(o, 0, 0, e.width, e.height), m.current = o, m.current && t.drawImage(m.current, 0, 0, e.width, e.height), v.current = {
|
|
81
81
|
width: p,
|
|
82
|
-
height:
|
|
82
|
+
height: c
|
|
83
83
|
};
|
|
84
|
-
let
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
let n, r, l;
|
|
85
|
+
if (z)
|
|
86
|
+
l = X(
|
|
87
|
+
z,
|
|
88
|
+
m.current,
|
|
89
89
|
v.current,
|
|
90
|
-
|
|
90
|
+
b.ToDisplayedSize
|
|
91
91
|
);
|
|
92
92
|
else {
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
width:
|
|
96
|
-
height:
|
|
97
|
-
left: (p -
|
|
98
|
-
top: (
|
|
93
|
+
const h = y(F);
|
|
94
|
+
h ? p / c < h ? (n = p, r = n / h) : (r = c, n = r * h) : (n = p, r = c), l = {
|
|
95
|
+
width: n,
|
|
96
|
+
height: r,
|
|
97
|
+
left: (p - n) / 2,
|
|
98
|
+
top: (c - r) / 2
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
s.current = l, A(t, e, l, C.current), k(b.ToFullSize), Y(D() || "");
|
|
102
102
|
};
|
|
103
|
-
}, [
|
|
104
|
-
const
|
|
105
|
-
const e =
|
|
106
|
-
!t || !e || (t.clearRect(0, 0, e.width, e.height),
|
|
107
|
-
},
|
|
108
|
-
const t =
|
|
103
|
+
}, [W]);
|
|
104
|
+
const L = () => {
|
|
105
|
+
const e = S.current, t = e?.getContext("2d");
|
|
106
|
+
!t || !e || (t.clearRect(0, 0, e.width, e.height), m.current && t.drawImage(m.current, 0, 0, e.width, e.height), A(t, e, s.current, null));
|
|
107
|
+
}, G = (e) => {
|
|
108
|
+
const t = J(
|
|
109
109
|
e,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
S,
|
|
111
|
+
s.current,
|
|
112
|
+
T,
|
|
113
|
+
E(s.current, T)
|
|
114
114
|
);
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
const t = R.current, o = t == null ? void 0 : t.getContext("2d");
|
|
115
|
+
V(t);
|
|
116
|
+
}, I = (e) => {
|
|
117
|
+
const t = S.current, o = t?.getContext("2d");
|
|
119
118
|
if (!t || !o) return;
|
|
120
|
-
const w = t.getBoundingClientRect(),
|
|
121
|
-
let
|
|
122
|
-
|
|
123
|
-
let p = { ...
|
|
124
|
-
if (
|
|
125
|
-
if (!
|
|
126
|
-
const c =
|
|
127
|
-
let n = 0, r = 0,
|
|
128
|
-
|
|
129
|
-
left:
|
|
130
|
-
top:
|
|
119
|
+
const w = t.getBoundingClientRect(), g = e.clientX - w.left, d = e.clientY - w.top;
|
|
120
|
+
let M = 0, i = 0;
|
|
121
|
+
a.current && (M = g - a.current.left, i = d - a.current.top);
|
|
122
|
+
let p = { ...s.current };
|
|
123
|
+
if (C.current === "new-selection" || C.current === "resize") {
|
|
124
|
+
if (!a.current) return;
|
|
125
|
+
const c = y(F);
|
|
126
|
+
let n = 0, r = 0, l = M, h = i, u = a.current.left, f = a.current.top;
|
|
127
|
+
l >= 0 && h >= 0 ? (n = Math.min(t.width - u, l), r = n / c, r > h && (r = Math.min(t.height - f, h), n = r * c), u + n >= t.width && (n = t.width - u, r = n / c), f + r >= t.height && (r = t.height - f, n = r * c)) : l >= 0 && h < 0 ? (h = -h, n = Math.min(t.width - u, l), r = n / c, r > h && (r = h, n = r * c), f = a.current.top - r, f <= 0 && (r += f, f = 0, n = r * c)) : l < 0 && h >= 0 ? (u = Math.max(0, u + l), l = -l, n = l, r = n / c, r > h && (r = Math.min(t.height - f, h), n = r * c), u = a.current.left - n, u <= 0 && (n += u, u = 0, r = n / c), f + r >= t.height && (r = t.height - f, n = r * c, u = a.current.left - n)) : l < 0 && h < 0 && (u = Math.max(0, u + l), f = Math.max(0, f + h), l = -l, h = -h, n = l, r = n / c, r > h && (r = h, n = r * c), u = a.current.left - n, f = a.current.top - r, u <= 0 && (n += u, u = 0, r = n / c), f <= 0 && (r += f, f = 0, n = r * c), u + n > t.width && (n = t.width - u, r = n / c), f + r > t.height && (r = t.height - f, n = r * c), u = a.current.left - n, f = a.current.top - r), p = {
|
|
128
|
+
left: u,
|
|
129
|
+
top: f,
|
|
131
130
|
width: n,
|
|
132
131
|
height: r
|
|
133
132
|
};
|
|
134
|
-
} else if (
|
|
135
|
-
if (!
|
|
136
|
-
let c = Math.min(Math.max(
|
|
137
|
-
c = Math.max(0, Math.min(c, t.width -
|
|
138
|
-
left: (
|
|
139
|
-
top: (
|
|
140
|
-
}, p = { ...
|
|
133
|
+
} else if (C.current === "move") {
|
|
134
|
+
if (!a.current) return;
|
|
135
|
+
let c = Math.min(Math.max(s.current.left + M, 0), t.width - s.current.width), n = Math.min(Math.max(s.current.top + i, 0), t.height - s.current.height);
|
|
136
|
+
c = Math.max(0, Math.min(c, t.width - s.current.width)), n = Math.max(0, Math.min(n, t.height - s.current.height)), a.current = {
|
|
137
|
+
left: (a.current?.left || 0) + c - s.current.left,
|
|
138
|
+
top: (a.current?.top || 0) + n - s.current.top
|
|
139
|
+
}, p = { ...s.current, left: c, top: n };
|
|
141
140
|
}
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
window.removeEventListener("mouseup",
|
|
141
|
+
s.current = p, L();
|
|
142
|
+
}, H = () => {
|
|
143
|
+
window.removeEventListener("mouseup", H), window.removeEventListener("mousemove", I), document.body.style.userSelect = "", C.current = null, L(), k(b.ToFullSize), Y(D() || "");
|
|
145
144
|
};
|
|
146
|
-
function
|
|
147
|
-
const t =
|
|
145
|
+
function U(e) {
|
|
146
|
+
const t = S.current;
|
|
148
147
|
if (!t) return;
|
|
149
148
|
document.body.style.userSelect = "none";
|
|
150
|
-
const o = t.getBoundingClientRect(), w =
|
|
151
|
-
(i) =>
|
|
149
|
+
const o = t.getBoundingClientRect(), w = E(s.current, T).find(
|
|
150
|
+
(i) => _(
|
|
152
151
|
e.clientX - o.left,
|
|
153
152
|
e.clientY - o.top,
|
|
154
153
|
i.x,
|
|
155
154
|
i.y,
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
T,
|
|
156
|
+
T
|
|
158
157
|
)
|
|
159
|
-
),
|
|
158
|
+
), g = e.clientX - o.left, d = e.clientY - o.top, M = _(
|
|
160
159
|
e.clientX - o.left,
|
|
161
160
|
e.clientY - o.top,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
s.current.left,
|
|
162
|
+
s.current.top,
|
|
163
|
+
s.current.width,
|
|
164
|
+
s.current.height
|
|
166
165
|
);
|
|
167
166
|
if (w) {
|
|
168
|
-
const i =
|
|
169
|
-
|
|
170
|
-
} else
|
|
167
|
+
const i = K(s.current, w.corner);
|
|
168
|
+
C.current = "resize", a.current = { left: i.x, top: i.y };
|
|
169
|
+
} else M ? (a.current = {
|
|
171
170
|
left: e.clientX - o.left,
|
|
172
171
|
top: e.clientY - o.top
|
|
173
|
-
},
|
|
174
|
-
left:
|
|
175
|
-
top:
|
|
172
|
+
}, C.current = "move") : (a.current = { left: g, top: d }, C.current = "new-selection", s.current = {
|
|
173
|
+
left: g,
|
|
174
|
+
top: d,
|
|
176
175
|
width: 0,
|
|
177
176
|
height: 0
|
|
178
177
|
});
|
|
179
|
-
window.addEventListener("mouseup",
|
|
178
|
+
window.addEventListener("mouseup", H), window.addEventListener("mousemove", I);
|
|
180
179
|
}
|
|
181
|
-
return
|
|
182
|
-
window.removeEventListener("mouseup",
|
|
183
|
-
}, []), /* @__PURE__ */
|
|
180
|
+
return j(() => () => {
|
|
181
|
+
window.removeEventListener("mouseup", H), window.removeEventListener("mousemove", I);
|
|
182
|
+
}, []), /* @__PURE__ */ O(
|
|
184
183
|
"canvas",
|
|
185
184
|
{
|
|
186
|
-
ref:
|
|
187
|
-
onMouseDown:
|
|
188
|
-
onMouseMove:
|
|
185
|
+
ref: S,
|
|
186
|
+
onMouseDown: U,
|
|
187
|
+
onMouseMove: G,
|
|
189
188
|
draggable: !1,
|
|
190
|
-
style: { cursor:
|
|
189
|
+
style: { cursor: P, margin: "0 auto" }
|
|
191
190
|
}
|
|
192
191
|
);
|
|
193
192
|
}
|
|
194
193
|
export {
|
|
195
|
-
|
|
194
|
+
$ as ImageCropper
|
|
196
195
|
};
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import { jsxs as l, Fragment as
|
|
2
|
-
import { Box as
|
|
3
|
-
import
|
|
4
|
-
import { sanitizeFilename as
|
|
5
|
-
import { ImageIconLarge as
|
|
1
|
+
import { jsxs as l, Fragment as E, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Box as u, Text as g, Input as U } from "@chakra-ui/react";
|
|
3
|
+
import k, { useState as f } from "react";
|
|
4
|
+
import { sanitizeFilename as B } from "./image-upload-helper.js";
|
|
5
|
+
import { ImageIconLarge as L } from "./image-upload-icons.js";
|
|
6
6
|
import { translations as o } from "./translations.js";
|
|
7
|
-
import { Alert as
|
|
8
|
-
import { ThemeRadiusVariable as
|
|
9
|
-
function
|
|
10
|
-
const [
|
|
11
|
-
function
|
|
7
|
+
import { Alert as h } from "../alert/alert.js";
|
|
8
|
+
import { ThemeRadiusVariable as V, ThemeColorVariable as d, ThemeSpaceVariable as x } from "../../theme/theme-types.js";
|
|
9
|
+
function Q({ locale: i, setFileItem: D, setHasImageChanged: b }) {
|
|
10
|
+
const [F, s] = f(!1), [T, c] = f(!1), [y, m] = f(!1), a = k.createRef();
|
|
11
|
+
function R(e, t) {
|
|
12
12
|
const r = new FileReader();
|
|
13
13
|
r.onload = t, r.readAsDataURL(e);
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const z = ["image/jpeg", "image/png", "image/webp", "image/gif", "image/svg+xml"], p = (e) => {
|
|
16
16
|
const t = e.target;
|
|
17
17
|
if (!t || !t.files) return;
|
|
18
18
|
const r = t.files[0];
|
|
19
|
-
if (!
|
|
19
|
+
if (!z.includes(r.type)) {
|
|
20
20
|
m(!0);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
m(!1), r.size > 3145728 ? c(!0) : (c(!1),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
b(E), F(!0);
|
|
23
|
+
m(!1), r.size > 3145728 ? c(!0) : (c(!1), R(r, (M) => {
|
|
24
|
+
const S = M.target?.result, j = { fileName: B(r.name), data: S };
|
|
25
|
+
D(j), b(!0);
|
|
27
26
|
}));
|
|
28
|
-
},
|
|
27
|
+
}, C = () => {
|
|
29
28
|
a.current && a.current.click();
|
|
30
|
-
},
|
|
29
|
+
}, I = (e) => {
|
|
31
30
|
e.preventDefault(), e.dataTransfer.items && e.dataTransfer.items.length > 0 && s(!0);
|
|
32
|
-
},
|
|
31
|
+
}, w = () => {
|
|
33
32
|
s(!1);
|
|
34
|
-
},
|
|
33
|
+
}, A = (e) => {
|
|
35
34
|
if (e.preventDefault(), !!a.current && e.dataTransfer.files && e.dataTransfer.files.length > 0) {
|
|
36
35
|
const t = new DataTransfer();
|
|
37
36
|
Array.from(e.dataTransfer.files).forEach((r) => {
|
|
@@ -41,42 +40,42 @@ function X({ locale: i, setFileItem: b, setHasImageChanged: F }) {
|
|
|
41
40
|
}), e.dataTransfer.clearData(), s(!1);
|
|
42
41
|
}
|
|
43
42
|
};
|
|
44
|
-
return /* @__PURE__ */ l(
|
|
43
|
+
return /* @__PURE__ */ l(E, { children: [
|
|
45
44
|
/* @__PURE__ */ l(
|
|
46
|
-
|
|
45
|
+
u,
|
|
47
46
|
{
|
|
48
47
|
p: "108px",
|
|
49
48
|
bg: d.BackgroundDisabled,
|
|
50
49
|
borderWidth: "1px",
|
|
51
|
-
borderColor:
|
|
50
|
+
borderColor: F ? d.OnSurfaceBorder : "transparent",
|
|
52
51
|
transition: "150ms ease",
|
|
53
|
-
borderRadius:
|
|
52
|
+
borderRadius: V.Medium,
|
|
54
53
|
display: "flex",
|
|
55
54
|
alignItems: "center",
|
|
56
55
|
justifyContent: "center",
|
|
57
56
|
flexDir: "column",
|
|
58
|
-
onDragOver:
|
|
59
|
-
onDragLeave:
|
|
60
|
-
onDrop:
|
|
61
|
-
onClick:
|
|
57
|
+
onDragOver: I,
|
|
58
|
+
onDragLeave: w,
|
|
59
|
+
onDrop: A,
|
|
60
|
+
onClick: C,
|
|
62
61
|
cursor: "pointer",
|
|
63
62
|
children: [
|
|
64
|
-
/* @__PURE__ */ n(
|
|
65
|
-
/* @__PURE__ */ n(
|
|
66
|
-
/* @__PURE__ */ l(
|
|
63
|
+
/* @__PURE__ */ n(L, {}),
|
|
64
|
+
/* @__PURE__ */ n(g, { children: o[i].pullAndDrop }),
|
|
65
|
+
/* @__PURE__ */ l(g, { children: [
|
|
67
66
|
"eller",
|
|
68
67
|
" ",
|
|
69
|
-
/* @__PURE__ */ n(
|
|
68
|
+
/* @__PURE__ */ n(u, { as: "span", color: d.Accent, textDecoration: "underline", children: o[i].upload }),
|
|
70
69
|
"."
|
|
71
70
|
] }),
|
|
72
|
-
/* @__PURE__ */ n(
|
|
71
|
+
/* @__PURE__ */ n(U, { type: "file", ref: a, display: "none", onChange: p })
|
|
73
72
|
]
|
|
74
73
|
}
|
|
75
74
|
),
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
y && /* @__PURE__ */ n(h, { mt: x.Medium, type: "error", children: o[i].unsupportedFormat }),
|
|
76
|
+
T && /* @__PURE__ */ n(h, { mt: x.Medium, type: "error", children: o[i].sizeExceeded })
|
|
78
77
|
] });
|
|
79
78
|
}
|
|
80
79
|
export {
|
|
81
|
-
|
|
80
|
+
Q as default
|
|
82
81
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsxs as p, Fragment as
|
|
2
|
-
import { HStack as
|
|
3
|
-
import
|
|
4
|
-
import { setMenuItemElementType as
|
|
5
|
-
import { IconButton as
|
|
6
|
-
import { Icons as
|
|
7
|
-
import { Flex as
|
|
8
|
-
import { Icon as
|
|
1
|
+
import { jsxs as p, Fragment as j, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { HStack as z, MenuItem as E, Box as h } from "@chakra-ui/react";
|
|
3
|
+
import F, { useRef as w } from "react";
|
|
4
|
+
import { setMenuItemElementType as H } from "./helper.js";
|
|
5
|
+
import { IconButton as N } from "../icon-button/icon-button.js";
|
|
6
|
+
import { Icons as S } from "../icon/types.js";
|
|
7
|
+
import { Flex as K } from "../flex/flex.js";
|
|
8
|
+
import { Icon as I } from "../icon/icon.js";
|
|
9
9
|
import { ThemeColorVariable as g, ThemeSpaceVariable as a } from "../../theme/theme-types.js";
|
|
10
|
-
const
|
|
10
|
+
const Y = ({
|
|
11
11
|
text: i,
|
|
12
|
-
children:
|
|
13
|
-
onClick:
|
|
14
|
-
as:
|
|
15
|
-
isDisabled:
|
|
16
|
-
itemType:
|
|
12
|
+
children: $,
|
|
13
|
+
onClick: C,
|
|
14
|
+
as: v,
|
|
15
|
+
isDisabled: L = !1,
|
|
16
|
+
itemType: M = "button",
|
|
17
17
|
leftIcon: d,
|
|
18
18
|
rightIcon: f,
|
|
19
|
-
rightElement:
|
|
20
|
-
...
|
|
19
|
+
rightElement: k,
|
|
20
|
+
...y
|
|
21
21
|
}) => {
|
|
22
|
-
const [n,
|
|
23
|
-
|
|
24
|
-
},
|
|
22
|
+
const [n, T] = F.useState(!1), r = w(null), o = w(null), B = () => {
|
|
23
|
+
T(!n);
|
|
24
|
+
}, _ = v ?? H(M), R = d ? /* @__PURE__ */ e(I, { icon: d, w: "24px", h: "24px" }) : void 0, s = (t) => ({
|
|
25
25
|
content: '""',
|
|
26
26
|
position: "absolute",
|
|
27
27
|
top: 0,
|
|
@@ -30,7 +30,7 @@ const re = ({
|
|
|
30
30
|
height: "100%",
|
|
31
31
|
backgroundColor: g.OnSurfaceBorder,
|
|
32
32
|
zIndex: 1
|
|
33
|
-
}), u = 64, x = 36, c = 22, m = 28, b = 20,
|
|
33
|
+
}), u = 64, x = 36, c = 22, m = 28, b = 20, A = {
|
|
34
34
|
".menu-item": {
|
|
35
35
|
paddingLeft: `${u}px`
|
|
36
36
|
},
|
|
@@ -57,24 +57,23 @@ const re = ({
|
|
|
57
57
|
"::before": s(`${m + 2 * b}px`)
|
|
58
58
|
}
|
|
59
59
|
// ...Add more selectors as needed to support more levels
|
|
60
|
-
},
|
|
61
|
-
var h, w, S, I;
|
|
60
|
+
}, P = "24px", V = (t) => {
|
|
62
61
|
switch (t.stopPropagation(), t.key) {
|
|
63
62
|
case "ArrowLeft": {
|
|
64
|
-
const l =
|
|
65
|
-
r.current = l,
|
|
63
|
+
const l = o.current?.previousSibling;
|
|
64
|
+
r.current = l, r.current?.focus();
|
|
66
65
|
break;
|
|
67
66
|
}
|
|
68
67
|
case "ArrowRight": {
|
|
69
|
-
const l =
|
|
70
|
-
o.current = l,
|
|
68
|
+
const l = r.current?.nextSibling;
|
|
69
|
+
o.current = l, o.current?.focus();
|
|
71
70
|
break;
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
};
|
|
75
|
-
return /* @__PURE__ */ p(
|
|
74
|
+
return /* @__PURE__ */ p(j, { children: [
|
|
76
75
|
/* @__PURE__ */ p(
|
|
77
|
-
|
|
76
|
+
z,
|
|
78
77
|
{
|
|
79
78
|
w: "100%",
|
|
80
79
|
pl: a.Medium,
|
|
@@ -87,38 +86,38 @@ const re = ({
|
|
|
87
86
|
transitionTimingFunction: "ease-in"
|
|
88
87
|
},
|
|
89
88
|
role: "group",
|
|
90
|
-
onKeyUp:
|
|
89
|
+
onKeyUp: V,
|
|
91
90
|
children: [
|
|
92
91
|
/* @__PURE__ */ e(
|
|
93
|
-
|
|
92
|
+
N,
|
|
94
93
|
{
|
|
95
94
|
ref: r,
|
|
96
|
-
onClick:
|
|
95
|
+
onClick: B,
|
|
97
96
|
variant: "ghost",
|
|
98
97
|
tabIndex: 0,
|
|
99
|
-
icon: n ?
|
|
98
|
+
icon: n ? S.TreeViewCollapse : S.TreeViewExpand,
|
|
100
99
|
"aria-label": n ? `Collapse ${i}` : `Expand ${i}`,
|
|
101
100
|
size: "sm"
|
|
102
101
|
}
|
|
103
102
|
),
|
|
104
103
|
/* @__PURE__ */ e(
|
|
105
|
-
|
|
104
|
+
E,
|
|
106
105
|
{
|
|
107
106
|
pl: 0,
|
|
108
107
|
_groupHover: { bg: "unset" },
|
|
109
|
-
as:
|
|
110
|
-
isDisabled:
|
|
111
|
-
onClick:
|
|
108
|
+
as: _,
|
|
109
|
+
isDisabled: L,
|
|
110
|
+
onClick: C,
|
|
112
111
|
minWidth: "unset",
|
|
113
|
-
w: `calc(100% - ${
|
|
114
|
-
icon:
|
|
112
|
+
w: `calc(100% - ${P} - ${a.XSmall})`,
|
|
113
|
+
icon: R,
|
|
115
114
|
ref: o,
|
|
116
|
-
...
|
|
117
|
-
children: /* @__PURE__ */ p(
|
|
115
|
+
...y,
|
|
116
|
+
children: /* @__PURE__ */ p(K, { justifyContent: "space-between", alignItems: "center", gap: a.Small, w: "100%", children: [
|
|
118
117
|
i,
|
|
119
|
-
/* @__PURE__ */ p(
|
|
120
|
-
|
|
121
|
-
f && /* @__PURE__ */ e(
|
|
118
|
+
/* @__PURE__ */ p(h, { children: [
|
|
119
|
+
k,
|
|
120
|
+
f && /* @__PURE__ */ e(I, { icon: f, color: g.OnSurfaceBorder, w: "20px", h: "20px" })
|
|
122
121
|
] })
|
|
123
122
|
] })
|
|
124
123
|
}
|
|
@@ -126,9 +125,9 @@ const re = ({
|
|
|
126
125
|
]
|
|
127
126
|
}
|
|
128
127
|
),
|
|
129
|
-
/* @__PURE__ */ e(
|
|
128
|
+
/* @__PURE__ */ e(h, { className: "menugroup-wrapper", __css: A, children: n && $ })
|
|
130
129
|
] });
|
|
131
130
|
};
|
|
132
131
|
export {
|
|
133
|
-
|
|
132
|
+
Y as MenuGroup
|
|
134
133
|
};
|