@caspeco/casper-ui-library 4.0.0 → 4.0.1

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