@caspeco/casper-ui-library 10.0.1 → 10.0.3

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.
@@ -1,111 +1,113 @@
1
- import { jsx as p, jsxs as B, Fragment as v } from "react/jsx-runtime";
2
- import { c as ee } from "../../_virtual/compiler-runtime.js";
3
- import { Text as O, Box as W, Input as te } from "@chakra-ui/react";
4
- import re, { useState as L } from "react";
5
- import { sanitizeFilename as le } from "./image-upload-helper.js";
6
- import { ImageIconLarge as ae } from "./image-upload-icons.js";
7
- import { translations as I } from "./translations.js";
8
- import { Alert as N } from "../alert/alert.js";
9
- import { ThemeColorVariable as M, ThemeRadiusVariable as ne, ThemeSpaceVariable as $ } from "../../theme/theme-types.js";
10
- function he(q) {
11
- const e = ee.c(34), {
12
- locale: l,
13
- setFileItem: R,
14
- setHasImageChanged: A
15
- } = q, [G, C] = L(!1), [z, V] = L(!1), [w, H] = L(!1);
16
- let u;
17
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = re.createRef(), e[0] = u) : u = e[0];
18
- const n = u;
19
- let g;
20
- e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = function(r, a) {
21
- const T = new FileReader();
22
- T.onload = a, T.readAsDataURL(r);
23
- }, e[1] = g) : g = e[1];
24
- const J = g;
1
+ import { jsx as u, jsxs as M, Fragment as te } from "react/jsx-runtime";
2
+ import { c as re } from "../../_virtual/compiler-runtime.js";
3
+ import { Text as N, Box as $, Input as le } from "@chakra-ui/react";
4
+ import ae, { useState as V } from "react";
5
+ import { sanitizeFilename as oe } from "./image-upload-helper.js";
6
+ import { ImageIconLarge as ne } from "./image-upload-icons.js";
7
+ import { translations as g } from "./translations.js";
8
+ import { Alert as q } from "../alert/alert.js";
9
+ import { ThemeColorVariable as H, ThemeRadiusVariable as ie, ThemeSpaceVariable as G } from "../../theme/theme-types.js";
10
+ function _e(J) {
11
+ const e = re.c(37), {
12
+ locale: r,
13
+ setFileItem: A,
14
+ setHasImageChanged: C
15
+ } = J, [K, z] = V(!1), [w, O] = V(!1), [E, W] = V(!1);
25
16
  let h;
26
- e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = ["image/jpeg", "image/png", "image/webp", "image/gif", "image/svg+xml"], e[2] = h) : h = e[2];
27
- const K = h;
17
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = ae.createRef(), e[0] = h) : h = e[0];
18
+ const o = h;
28
19
  let b;
29
- e[3] !== R || e[4] !== A ? (b = (t) => {
20
+ e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = function(l, a) {
21
+ const R = new FileReader();
22
+ R.onload = a, R.readAsDataURL(l);
23
+ }, e[1] = b) : b = e[1];
24
+ const P = b;
25
+ let _;
26
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = ["image/jpeg", "image/png", "image/webp", "image/gif", "image/svg+xml"], e[2] = _) : _ = e[2];
27
+ const Q = _;
28
+ let D;
29
+ e[3] !== A || e[4] !== C ? (D = (t) => {
30
30
  const {
31
- target: r
31
+ target: l
32
32
  } = t;
33
- if (!r || !r.files || !r.files[0])
33
+ if (!l || !l.files || !l.files[0])
34
34
  return;
35
- const a = r.files[0];
36
- if (!K.includes(a.type)) {
37
- H(!0);
35
+ const a = l.files[0];
36
+ if (!Q.includes(a.type)) {
37
+ W(!0);
38
38
  return;
39
39
  }
40
- H(!1), a.size > 3145728 ? V(!0) : (V(!1), J(a, (T) => {
41
- const Y = T.target?.result, Z = {
42
- fileName: le(a.name),
43
- data: Y
40
+ W(!1), a.size > 3145728 ? O(!0) : (O(!1), P(a, (R) => {
41
+ const v = R.target?.result, ee = {
42
+ fileName: oe(a.name),
43
+ data: v
44
44
  };
45
- R(Z), A(!0);
45
+ A(ee), C(!0);
46
46
  }));
47
- }, e[3] = R, e[4] = A, e[5] = b) : b = e[5];
48
- const o = b;
49
- let _;
50
- e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = () => {
51
- n.current && n.current.click();
52
- }, e[6] = _) : _ = e[6];
53
- const P = _;
54
- let D;
55
- e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = (t) => {
56
- t.preventDefault(), t.dataTransfer.items && t.dataTransfer.items.length > 0 && C(!0);
57
- }, e[7] = D) : D = e[7];
58
- const Q = D;
47
+ }, e[3] = A, e[4] = C, e[5] = D) : D = e[5];
48
+ const n = D;
59
49
  let x;
60
- e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = () => {
61
- C(!1);
62
- }, e[8] = x) : x = e[8];
50
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = () => {
51
+ o.current && o.current.click();
52
+ }, e[6] = x) : x = e[6];
63
53
  const X = x;
64
54
  let y;
65
- e[9] !== o ? (y = (t) => {
66
- if (t.preventDefault(), !!n.current && t.dataTransfer.files && t.dataTransfer.files.length > 0) {
67
- const r = new DataTransfer();
55
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = (t) => {
56
+ t.preventDefault(), t.dataTransfer.items && t.dataTransfer.items.length > 0 && z(!0);
57
+ }, e[7] = y) : y = e[7];
58
+ const Y = y;
59
+ let F;
60
+ e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (F = () => {
61
+ z(!1);
62
+ }, e[8] = F) : F = e[8];
63
+ const Z = F;
64
+ let S;
65
+ e[9] !== n ? (S = (t) => {
66
+ if (t.preventDefault(), !!o.current && t.dataTransfer.files && t.dataTransfer.files.length > 0) {
67
+ const l = new DataTransfer();
68
68
  Array.from(t.dataTransfer.files).forEach((a) => {
69
- r.items.add(a);
70
- }), n.current.files = r.files, o({
71
- target: n.current
72
- }), t.dataTransfer.clearData(), C(!1);
69
+ l.items.add(a);
70
+ }), o.current.files = l.files, n({
71
+ target: o.current
72
+ }), t.dataTransfer.clearData(), z(!1);
73
73
  }
74
- }, e[9] = o, e[10] = y) : y = e[10];
75
- const E = y, U = G ? M.OnSurfaceBorder : "transparent";
76
- let F;
77
- e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (F = /* @__PURE__ */ p(ae, {}), e[11] = F) : F = e[11];
78
- const j = I[l];
74
+ }, e[9] = n, e[10] = S) : S = e[10];
75
+ const U = S, j = K ? H.OnSurfaceBorder : "transparent";
76
+ let T;
77
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ u(ne, {}), e[11] = T) : T = e[11];
78
+ const k = g[r];
79
79
  let i;
80
- e[12] !== j.pullAndDrop ? (i = /* @__PURE__ */ p(O, { children: j.pullAndDrop }), e[12] = j.pullAndDrop, e[13] = i) : i = e[13];
81
- const k = I[l];
80
+ e[12] !== k.pullAndDrop ? (i = /* @__PURE__ */ u(N, { children: k.pullAndDrop }), e[12] = k.pullAndDrop, e[13] = i) : i = e[13];
81
+ const B = g[r], L = g[r];
82
82
  let s;
83
- e[14] !== k.upload ? (s = /* @__PURE__ */ B(O, { children: [
84
- "eller",
83
+ e[14] !== L.upload ? (s = /* @__PURE__ */ u($, { as: "span", color: H.Accent, textDecoration: "underline", children: L.upload }), e[14] = L.upload, e[15] = s) : s = e[15];
84
+ let c;
85
+ e[16] !== B.or || e[17] !== s ? (c = /* @__PURE__ */ M(N, { children: [
86
+ B.or,
85
87
  " ",
86
- /* @__PURE__ */ p(W, { as: "span", color: M.Accent, textDecoration: "underline", children: k.upload }),
88
+ s,
87
89
  "."
88
- ] }), e[14] = k.upload, e[15] = s) : s = e[15];
89
- let c;
90
- e[16] !== o ? (c = /* @__PURE__ */ p(te, { type: "file", ref: n, display: "none", onChange: o }), e[16] = o, e[17] = c) : c = e[17];
90
+ ] }), e[16] = B.or, e[17] = s, e[18] = c) : c = e[18];
91
91
  let f;
92
- e[18] !== E || e[19] !== i || e[20] !== s || e[21] !== c || e[22] !== U ? (f = /* @__PURE__ */ B(W, { p: "108px", bg: M.BackgroundDisabled, borderWidth: "1px", borderColor: U, transition: "150ms ease", borderRadius: ne.Medium, display: "flex", alignItems: "center", justifyContent: "center", flexDir: "column", onDragOver: Q, onDragLeave: X, onDrop: E, onClick: P, cursor: "pointer", children: [
93
- F,
94
- i,
95
- s,
96
- c
97
- ] }), e[18] = E, e[19] = i, e[20] = s, e[21] = c, e[22] = U, e[23] = f) : f = e[23];
92
+ e[19] !== n ? (f = /* @__PURE__ */ u(le, { type: "file", ref: o, display: "none", onChange: n }), e[19] = n, e[20] = f) : f = e[20];
98
93
  let m;
99
- e[24] !== l || e[25] !== w ? (m = w && /* @__PURE__ */ p(N, { mt: $.Medium, type: "error", children: I[l].unsupportedFormat }), e[24] = l, e[25] = w, e[26] = m) : m = e[26];
94
+ e[21] !== U || e[22] !== i || e[23] !== c || e[24] !== f || e[25] !== j ? (m = /* @__PURE__ */ M($, { p: "108px", bg: H.BackgroundDisabled, borderWidth: "1px", borderColor: j, transition: "150ms ease", borderRadius: ie.Medium, display: "flex", alignItems: "center", justifyContent: "center", flexDir: "column", onDragOver: Y, onDragLeave: Z, onDrop: U, onClick: X, cursor: "pointer", children: [
95
+ T,
96
+ i,
97
+ c,
98
+ f
99
+ ] }), e[21] = U, e[22] = i, e[23] = c, e[24] = f, e[25] = j, e[26] = m) : m = e[26];
100
100
  let d;
101
- e[27] !== l || e[28] !== z ? (d = z && /* @__PURE__ */ p(N, { mt: $.Medium, type: "error", children: I[l].sizeExceeded }), e[27] = l, e[28] = z, e[29] = d) : d = e[29];
102
- let S;
103
- return e[30] !== f || e[31] !== m || e[32] !== d ? (S = /* @__PURE__ */ B(v, { children: [
104
- f,
101
+ e[27] !== r || e[28] !== E ? (d = E && /* @__PURE__ */ u(q, { mt: G.Medium, type: "error", children: g[r].unsupportedFormat }), e[27] = r, e[28] = E, e[29] = d) : d = e[29];
102
+ let p;
103
+ e[30] !== r || e[31] !== w ? (p = w && /* @__PURE__ */ u(q, { mt: G.Medium, type: "error", children: g[r].sizeExceeded }), e[30] = r, e[31] = w, e[32] = p) : p = e[32];
104
+ let I;
105
+ return e[33] !== m || e[34] !== d || e[35] !== p ? (I = /* @__PURE__ */ M(te, { children: [
105
106
  m,
106
- d
107
- ] }), e[30] = f, e[31] = m, e[32] = d, e[33] = S) : S = e[33], S;
107
+ d,
108
+ p
109
+ ] }), e[33] = m, e[34] = d, e[35] = p, e[36] = I) : I = e[36], I;
108
110
  }
109
111
  export {
110
- he as default
112
+ _e as default
111
113
  };
@@ -1,4 +1,4 @@
1
- import { jsx as l, jsxs as b, Fragment as q } from "react/jsx-runtime";
1
+ import { jsx as l, jsxs as C, Fragment as q } from "react/jsx-runtime";
2
2
  import { c as J } from "../../_virtual/compiler-runtime.js";
3
3
  import { ButtonGroup as K } from "@chakra-ui/react";
4
4
  import { useState as E, useEffect as Q } from "react";
@@ -6,7 +6,7 @@ import { ImageCropper as Y } from "./image-cropper.js";
6
6
  import Z from "./image-upload-dropzone.js";
7
7
  import { loadImageFileItem as W } from "./image-upload-helper.js";
8
8
  import { RemoveIcon as ee } from "./image-upload-icons.js";
9
- import { translations as D } from "./translations.js";
9
+ import { translations as F } from "./translations.js";
10
10
  import { Text as te } from "../text/text.js";
11
11
  import { ModalHeader as oe } from "../modal/modal-header.js";
12
12
  import { ModalBody as re } from "../modal/modal-body.js";
@@ -15,49 +15,49 @@ import { ModalFooter as ae } from "../modal/modal-footer.js";
15
15
  import { ModalCloseButton as le } from "../modal/modal-close-button.js";
16
16
  import { Modal as ie } from "../modal/modal.js";
17
17
  import { ThemeFontSizeVariable as me, ThemeFontVariable as ne, ThemeColorVariable as X, ThemeSpaceVariable as i } from "../../theme/theme-types.js";
18
- function Te(A) {
18
+ function Fe(A) {
19
19
  const e = J.c(48), {
20
20
  title: T,
21
21
  src: o,
22
- savedCrop: F,
23
- isOpen: B,
24
- aspectRatio: k,
25
- crop: m,
26
- locale: n,
27
- onClose: w,
28
- handleSaveImage: z,
22
+ savedCrop: B,
23
+ isOpen: k,
24
+ aspectRatio: w,
25
+ crop: n,
26
+ locale: m,
27
+ onClose: z,
28
+ handleSaveImage: H,
29
29
  setPreviewImage: r,
30
30
  setCrop: a
31
- } = A, [H, G] = E(!1);
32
- let C;
33
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (C = {
31
+ } = A, [O, G] = E(!1);
32
+ let b;
33
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = {
34
34
  data: "",
35
35
  fileName: ""
36
- }, e[0] = C) : C = e[0];
37
- const [t, u] = E(C);
36
+ }, e[0] = b) : b = e[0];
37
+ const [t, u] = E(b);
38
38
  let I, S;
39
39
  e[1] !== o ? (I = () => {
40
40
  if (!o)
41
41
  return;
42
- const j = new AbortController();
43
- return W(o, j.signal).then((U) => {
44
- j.signal.aborted || u(U);
42
+ const D = new AbortController();
43
+ return W(o, D.signal).then((U) => {
44
+ D.signal.aborted || u(U);
45
45
  }).catch(console.error), () => {
46
- j.abort();
46
+ D.abort();
47
47
  };
48
48
  }, S = [o], e[1] = o, e[2] = I, e[3] = S) : (I = e[2], S = e[3]), Q(I, S);
49
49
  let v;
50
- e[4] !== m || e[5] !== t || e[6] !== z || e[7] !== H ? (v = () => {
51
- z(t, m, H);
52
- }, e[4] = m, e[5] = t, e[6] = z, e[7] = H, e[8] = v) : v = e[8];
53
- const O = v, R = (!t.data || !t.fileName) && !o, P = (!t.data || !t.fileName) && o;
50
+ e[4] !== n || e[5] !== t || e[6] !== H || e[7] !== O ? (v = () => {
51
+ H(t, n, O);
52
+ }, e[4] = n, e[5] = t, e[6] = H, e[7] = O, e[8] = v) : v = e[8];
53
+ const R = v, V = (!t.data || !t.fileName) && !o, P = (!t.data || !t.fileName) && o;
54
54
  let y;
55
- e[9] !== w || e[10] !== F || e[11] !== a || e[12] !== r || e[13] !== o ? (y = () => {
55
+ e[9] !== z || e[10] !== B || e[11] !== a || e[12] !== r || e[13] !== o ? (y = () => {
56
56
  u({
57
57
  data: "",
58
58
  fileName: ""
59
- }), r(""), o && (W(o).then(u).catch(console.error), r(o)), a(F || null), w();
60
- }, e[9] = w, e[10] = F, e[11] = a, e[12] = r, e[13] = o, e[14] = y) : y = e[14];
59
+ }), r(""), o && (W(o).then(u).catch(console.error), r(o)), a(B || null), z();
60
+ }, e[9] = z, e[10] = B, e[11] = a, e[12] = r, e[13] = o, e[14] = y) : y = e[14];
61
61
  const s = y;
62
62
  let x;
63
63
  e[15] !== a || e[16] !== r ? (x = () => {
@@ -66,42 +66,42 @@ function Te(A) {
66
66
  fileName: ""
67
67
  }), r(""), a(null);
68
68
  }, e[15] = a, e[16] = r, e[17] = x) : x = e[17];
69
- const V = x;
69
+ const _ = x;
70
70
  let c;
71
71
  e[18] !== T ? (c = /* @__PURE__ */ l(te, { color: X.OnSurfaceHeader, fontFamily: ne.SubHeader, fontWeight: "medium", fontSize: me.XLarge, children: T }), e[18] = T, e[19] = c) : c = e[19];
72
72
  let M;
73
73
  e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ l(le, {}), e[20] = M) : M = e[20];
74
74
  let f;
75
- e[21] !== c ? (f = /* @__PURE__ */ b(oe, { display: "flex", alignItems: "center", justifyContent: "space-between", p: i.Medium, children: [
75
+ e[21] !== c ? (f = /* @__PURE__ */ C(oe, { display: "flex", alignItems: "center", justifyContent: "space-between", p: i.Medium, children: [
76
76
  c,
77
77
  M
78
78
  ] }), e[21] = c, e[22] = f) : f = e[22];
79
79
  let d;
80
- e[23] !== k || e[24] !== m || e[25] !== t.data || e[26] !== t.fileName || e[27] !== V || e[28] !== n || e[29] !== a || e[30] !== r ? (d = /* @__PURE__ */ l(re, { display: "flex", flexDirection: "column", p: `${i.Large} ${i.Medium}`, children: t.data && t.fileName ? /* @__PURE__ */ b(q, { children: [
81
- /* @__PURE__ */ l(Y, { src: t.data, crop: m, onCropCallback: a, aspectRatio: k, setPreviewImage: r }),
82
- /* @__PURE__ */ l(K, { gap: i.Small, mt: i.Large, flexWrap: "wrap", children: /* @__PURE__ */ b(L, { variant: "ghost", onClick: V, gap: i.XSmall, children: [
80
+ e[23] !== w || e[24] !== n || e[25] !== t.data || e[26] !== t.fileName || e[27] !== _ || e[28] !== m || e[29] !== a || e[30] !== r ? (d = /* @__PURE__ */ l(re, { display: "flex", flexDirection: "column", p: `${i.Large} ${i.Medium}`, children: t.data && t.fileName ? /* @__PURE__ */ C(q, { children: [
81
+ /* @__PURE__ */ l(Y, { src: t.data, crop: n, onCropCallback: a, aspectRatio: w, setPreviewImage: r }),
82
+ /* @__PURE__ */ l(K, { gap: i.Small, mt: i.Large, flexWrap: "wrap", children: /* @__PURE__ */ C(L, { variant: "ghost", onClick: _, gap: i.XSmall, children: [
83
83
  /* @__PURE__ */ l(ee, {}),
84
- "Ta bort bild"
84
+ F[m].remove
85
85
  ] }) })
86
- ] }) : /* @__PURE__ */ l(Z, { locale: n, setFileItem: u, setHasImageChanged: G }) }), e[23] = k, e[24] = m, e[25] = t.data, e[26] = t.fileName, e[27] = V, e[28] = n, e[29] = a, e[30] = r, e[31] = d) : d = e[31];
87
- const _ = D[n];
86
+ ] }) : /* @__PURE__ */ l(Z, { locale: m, setFileItem: u, setHasImageChanged: G }) }), e[23] = w, e[24] = n, e[25] = t.data, e[26] = t.fileName, e[27] = _, e[28] = m, e[29] = a, e[30] = r, e[31] = d) : d = e[31];
87
+ const $ = F[m];
88
88
  let p;
89
- e[32] !== s || e[33] !== _.secondary ? (p = /* @__PURE__ */ l(L, { variant: "ghost", onClick: s, children: _.secondary }), e[32] = s, e[33] = _.secondary, e[34] = p) : p = e[34];
90
- const $ = P ? D[n].remove : D[n].primary;
89
+ e[32] !== s || e[33] !== $.secondary ? (p = /* @__PURE__ */ l(L, { variant: "ghost", onClick: s, children: $.secondary }), e[32] = s, e[33] = $.secondary, e[34] = p) : p = e[34];
90
+ const j = P ? F[m].remove : F[m].primary;
91
91
  let h;
92
- e[35] !== R || e[36] !== O || e[37] !== $ ? (h = /* @__PURE__ */ l(L, { variant: "primary", onClick: O, isDisabled: R, children: $ }), e[35] = R, e[36] = O, e[37] = $, e[38] = h) : h = e[38];
92
+ e[35] !== V || e[36] !== R || e[37] !== j ? (h = /* @__PURE__ */ l(L, { variant: "primary", onClick: R, isDisabled: V, children: j }), e[35] = V, e[36] = R, e[37] = j, e[38] = h) : h = e[38];
93
93
  let g;
94
- e[39] !== p || e[40] !== h ? (g = /* @__PURE__ */ b(ae, { p: i.Medium, gap: i.Medium, borderTop: `1px solid ${X.OnSurfaceBorder}`, children: [
94
+ e[39] !== p || e[40] !== h ? (g = /* @__PURE__ */ C(ae, { p: i.Medium, gap: i.Medium, borderTop: `1px solid ${X.OnSurfaceBorder}`, children: [
95
95
  p,
96
96
  h
97
97
  ] }), e[39] = p, e[40] = h, e[41] = g) : g = e[41];
98
98
  let N;
99
- return e[42] !== s || e[43] !== B || e[44] !== d || e[45] !== g || e[46] !== f ? (N = /* @__PURE__ */ b(ie, { isOpen: B, onClose: s, size: "md", children: [
99
+ return e[42] !== s || e[43] !== k || e[44] !== d || e[45] !== g || e[46] !== f ? (N = /* @__PURE__ */ C(ie, { isOpen: k, onClose: s, size: "md", children: [
100
100
  f,
101
101
  d,
102
102
  g
103
- ] }), e[42] = s, e[43] = B, e[44] = d, e[45] = g, e[46] = f, e[47] = N) : N = e[47], N;
103
+ ] }), e[42] = s, e[43] = k, e[44] = d, e[45] = g, e[46] = f, e[47] = N) : N = e[47], N;
104
104
  }
105
105
  export {
106
- Te as ImageUploadModal
106
+ Fe as ImageUploadModal
107
107
  };
@@ -5,6 +5,7 @@ export declare const translations: {
5
5
  secondary: string;
6
6
  remove: string;
7
7
  pullAndDrop: string;
8
+ or: string;
8
9
  upload: string;
9
10
  unsupportedFormat: string;
10
11
  sizeExceeded: string;
@@ -14,6 +15,7 @@ export declare const translations: {
14
15
  secondary: string;
15
16
  remove: string;
16
17
  pullAndDrop: string;
18
+ or: string;
17
19
  upload: string;
18
20
  unsupportedFormat: string;
19
21
  sizeExceeded: string;
@@ -23,6 +25,7 @@ export declare const translations: {
23
25
  secondary: string;
24
26
  remove: string;
25
27
  pullAndDrop: string;
28
+ or: string;
26
29
  upload: string;
27
30
  unsupportedFormat: string;
28
31
  sizeExceeded: string;
@@ -32,6 +35,7 @@ export declare const translations: {
32
35
  secondary: string;
33
36
  remove: string;
34
37
  pullAndDrop: string;
38
+ or: string;
35
39
  upload: string;
36
40
  unsupportedFormat: string;
37
41
  sizeExceeded: string;
@@ -41,6 +45,7 @@ export declare const translations: {
41
45
  secondary: string;
42
46
  remove: string;
43
47
  pullAndDrop: string;
48
+ or: string;
44
49
  upload: string;
45
50
  unsupportedFormat: string;
46
51
  sizeExceeded: string;
@@ -50,6 +55,7 @@ export declare const translations: {
50
55
  secondary: string;
51
56
  remove: string;
52
57
  pullAndDrop: string;
58
+ or: string;
53
59
  upload: string;
54
60
  unsupportedFormat: string;
55
61
  sizeExceeded: string;
@@ -59,6 +65,7 @@ export declare const translations: {
59
65
  secondary: string;
60
66
  remove: string;
61
67
  pullAndDrop: string;
68
+ or: string;
62
69
  upload: string;
63
70
  unsupportedFormat: string;
64
71
  sizeExceeded: string;
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../lib/components/image-upload/translations.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAa1F,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDxB,CAAC"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../lib/components/image-upload/translations.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAc1F,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DxB,CAAC"}
@@ -3,6 +3,7 @@ const e = {
3
3
  secondary: "Cancel",
4
4
  remove: "Remove image",
5
5
  pullAndDrop: "Drag and drop the image here",
6
+ or: "or",
6
7
  upload: "Upload a file",
7
8
  unsupportedFormat: "Unsupported file format. Please upload a JPG, PNG, WebP, GIF, or SVG.",
8
9
  sizeExceeded: "The image size exceeds 3MB. Please choose a smaller file or reduce the size of the current image."
@@ -12,6 +13,7 @@ const e = {
12
13
  secondary: "Avbryt",
13
14
  remove: "Ta bort bild",
14
15
  pullAndDrop: "Dra och släpp bilden här",
16
+ or: "eller",
15
17
  upload: "ladda upp en fil",
16
18
  unsupportedFormat: "Otillåtet filformat. Vänligen ladda upp JPG, PNG, WebP, GIF, eller SVG.",
17
19
  sizeExceeded: "Storleken på bilden du försöker ladda upp överskrider 3MB. Vänligen välj en mindre fil eller minska storleken på den nuvarande bilden."
@@ -23,6 +25,7 @@ const e = {
23
25
  secondary: "Avbryt",
24
26
  remove: "Fjern bilde",
25
27
  pullAndDrop: "Dra og slipp bildet her",
28
+ or: "eller",
26
29
  upload: "Last opp en fil",
27
30
  unsupportedFormat: "Ugyldig filformat. Vennligst last opp en JPG, PNG, WebP, GIF eller SVG.",
28
31
  sizeExceeded: "Bildet du prøver å laste opp overstiger 3MB. Vennligst velg en mindre fil eller reduser størrelsen på det nåværende bildet."
@@ -32,6 +35,7 @@ const e = {
32
35
  secondary: "Annuller",
33
36
  remove: "Fjern billede",
34
37
  pullAndDrop: "Træk og slip billedet her",
38
+ or: "eller",
35
39
  upload: "Upload en fil",
36
40
  unsupportedFormat: "Ugyldigt filformat. Upload venligst en JPG, PNG, WebP, GIF eller SVG.",
37
41
  sizeExceeded: "Billedets størrelse overstiger 3MB. Vælg venligst en mindre fil eller reducer størrelsen på det nuværende billede."
@@ -41,6 +45,7 @@ const e = {
41
45
  secondary: "Annuler",
42
46
  remove: "Supprimer l'image",
43
47
  pullAndDrop: "Glissez-déposez l'image ici",
48
+ or: "ou",
44
49
  upload: "Télécharger un fichier",
45
50
  unsupportedFormat: "Format de fichier non pris en charge. Veuillez télécharger un JPG, PNG, WebP, GIF ou SVG.",
46
51
  sizeExceeded: "La taille de l'image dépasse 3 Mo. Veuillez choisir un fichier plus petit ou réduire la taille de l'image actuelle."
@@ -50,6 +55,7 @@ const e = {
50
55
  secondary: "Annuleren",
51
56
  remove: "Afbeelding verwijderen",
52
57
  pullAndDrop: "Sleep de afbeelding hierheen",
58
+ or: "of",
53
59
  upload: "Een bestand uploaden",
54
60
  unsupportedFormat: "Ongeldig bestandsformaat. Upload een JPG, PNG, WebP, GIF of SVG.",
55
61
  sizeExceeded: "De afbeelding die je probeert te uploaden is groter dan 3 MB. Kies een kleiner bestand of verklein de huidige afbeelding."
@@ -1 +1 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../lib/components/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,IAAI,YAAY,EAItB,MAAM,kBAAkB,CAAC;AAI1B,KAAK,qBAAqB,GAAG;IAC5B;2EACuE;IACvE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IAG1C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,KAAK,sBAAsB,GAAG,IAAI,CACjC,YAAY,CAAC,SAAS,EACtB,UAAU,GAAG,IAAI,GAAG,gBAAgB,GAAG,WAAW,CAClD,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,qBAAqB,GAAG,sBAAsB,CAAC;AAExE,wBAAgB,KAAK,CAAC,EACrB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,kBAAyB,EACzB,IAAW,EACX,cAAyB,EACzB,UAAiB,EACjB,GAAG,KAAK,EACR,EAAE,UAAU,+BAoCZ"}
1
+ {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../lib/components/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,IAAI,YAAY,EAItB,MAAM,kBAAkB,CAAC;AAI1B,KAAK,qBAAqB,GAAG;IAC5B;2EACuE;IACvE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IAG1C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,KAAK,sBAAsB,GAAG,IAAI,CACjC,YAAY,CAAC,SAAS,EACtB,UAAU,GAAG,IAAI,GAAG,gBAAgB,GAAG,WAAW,CAClD,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,qBAAqB,GAAG,sBAAsB,CAAC;AAExE,wBAAgB,KAAK,CAAC,EACrB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,kBAAyB,EACzB,IAAW,EACX,cAAyB,EACzB,UAAiB,EACjB,GAAG,KAAK,EACR,EAAE,UAAU,+BAuCZ"}
@@ -1,12 +1,12 @@
1
- import { jsx as O, jsxs as _ } from "react/jsx-runtime";
2
- import { c as D } from "../../_virtual/compiler-runtime.js";
3
- import { useBreakpointValue as I, Dialog as b, Portal as V } from "@chakra-ui/react";
4
- import { useState as $ } from "react";
5
- import { ModalBodyContext as q } from "./modal-body-context.js";
6
- function L(y) {
7
- const e = D.c(40);
1
+ import { jsx as O, jsxs as D } from "react/jsx-runtime";
2
+ import { c as I } from "../../_virtual/compiler-runtime.js";
3
+ import { useBreakpointValue as V, Dialog as y, Portal as $ } from "@chakra-ui/react";
4
+ import { useState as q } from "react";
5
+ import { ModalBodyContext as w } from "./modal-body-context.js";
6
+ function N(g) {
7
+ const e = I.c(41);
8
8
  let t, o, l, n, s, i, r, u, h, C, v;
9
- e[0] !== y ? ({
9
+ e[0] !== g ? ({
10
10
  children: t,
11
11
  isOpen: n,
12
12
  onClose: s,
@@ -18,39 +18,41 @@ function L(y) {
18
18
  scrollBehavior: C,
19
19
  isCentered: v,
20
20
  ...r
21
- } = y, e[0] = y, e[1] = t, e[2] = o, e[3] = l, e[4] = n, e[5] = s, e[6] = i, e[7] = r, e[8] = u, e[9] = h, e[10] = C, e[11] = v) : (t = e[1], o = e[2], l = e[3], n = e[4], s = e[5], i = e[6], r = e[7], u = e[8], h = e[9], C = e[10], v = e[11]);
22
- const g = u === void 0 ? !0 : u, P = h === void 0 ? "sm" : h, k = C === void 0 ? "inside" : C, z = v === void 0 ? !0 : v, [F, M] = $(null);
23
- let x;
21
+ } = g, e[0] = g, e[1] = t, e[2] = o, e[3] = l, e[4] = n, e[5] = s, e[6] = i, e[7] = r, e[8] = u, e[9] = h, e[10] = C, e[11] = v) : (t = e[1], o = e[2], l = e[3], n = e[4], s = e[5], i = e[6], r = e[7], u = e[8], h = e[9], C = e[10], v = e[11]);
22
+ const P = u === void 0 ? !0 : u, k = h === void 0 ? "sm" : h, F = C === void 0 ? "inside" : C, M = v === void 0 ? !0 : v, [S, R] = q(null);
23
+ let x, B;
24
24
  e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = {
25
25
  base: "bottomSheet",
26
26
  md: void 0
27
- }, e[12] = x) : x = e[12];
28
- const c = I(x);
29
- let B;
30
- e[13] !== s ? (B = function(R) {
31
- R.open || s?.();
32
- }, e[13] = s, e[14] = B) : B = e[14];
33
- const S = B;
27
+ }, B = {
28
+ ssr: !1
29
+ }, e[12] = x, e[13] = B) : (x = e[12], B = e[13]);
30
+ const c = V(x, B);
31
+ let E;
32
+ e[14] !== s ? (E = function(_) {
33
+ _.open || s?.();
34
+ }, e[14] = s, e[15] = E) : E = e[15];
35
+ const j = E;
34
36
  let a;
35
- e[15] !== F ? (a = {
36
- bodyElement: F,
37
- setBodyElement: M
38
- }, e[15] = F, e[16] = a) : a = e[16];
39
- const j = z ? "center" : void 0;
37
+ e[16] !== S ? (a = {
38
+ bodyElement: S,
39
+ setBodyElement: R
40
+ }, e[16] = S, e[17] = a) : a = e[17];
41
+ const z = M ? "center" : void 0;
40
42
  let d;
41
- e[17] !== c ? (d = /* @__PURE__ */ O(b.Backdrop, { "data-variant": c }), e[17] = c, e[18] = d) : d = e[18];
43
+ e[18] !== c ? (d = /* @__PURE__ */ O(y.Backdrop, { "data-variant": c }), e[18] = c, e[19] = d) : d = e[19];
42
44
  let m;
43
- e[19] !== t ? (m = /* @__PURE__ */ O(b.Positioner, { children: /* @__PURE__ */ O(b.Content, { children: t }) }), e[19] = t, e[20] = m) : m = e[20];
45
+ e[20] !== t ? (m = /* @__PURE__ */ O(y.Positioner, { children: /* @__PURE__ */ O(y.Content, { children: t }) }), e[20] = t, e[21] = m) : m = e[21];
44
46
  let p;
45
- e[21] !== m || e[22] !== d ? (p = /* @__PURE__ */ _(V, { children: [
47
+ e[22] !== d || e[23] !== m ? (p = /* @__PURE__ */ D($, { children: [
46
48
  d,
47
49
  m
48
- ] }), e[21] = m, e[22] = d, e[23] = p) : p = e[23];
50
+ ] }), e[22] = d, e[23] = m, e[24] = p) : p = e[24];
49
51
  let f;
50
- e[24] !== o || e[25] !== l || e[26] !== S || e[27] !== n || e[28] !== i || e[29] !== r || e[30] !== g || e[31] !== k || e[32] !== P || e[33] !== p || e[34] !== j || e[35] !== c ? (f = /* @__PURE__ */ O(b.Root, { variant: c, scrollBehavior: k, motionPreset: "slide-in-bottom", size: P, placement: j, closeOnInteractOutside: l, closeOnEscape: o, open: n, onOpenChange: S, restoreFocus: g, onExitComplete: i, ...r, children: p }), e[24] = o, e[25] = l, e[26] = S, e[27] = n, e[28] = i, e[29] = r, e[30] = g, e[31] = k, e[32] = P, e[33] = p, e[34] = j, e[35] = c, e[36] = f) : f = e[36];
51
- let E;
52
- return e[37] !== f || e[38] !== a ? (E = /* @__PURE__ */ O(q.Provider, { value: a, children: f }), e[37] = f, e[38] = a, e[39] = E) : E = e[39], E;
52
+ e[25] !== o || e[26] !== l || e[27] !== j || e[28] !== n || e[29] !== i || e[30] !== r || e[31] !== P || e[32] !== F || e[33] !== k || e[34] !== p || e[35] !== z || e[36] !== c ? (f = /* @__PURE__ */ O(y.Root, { variant: c, scrollBehavior: F, motionPreset: "slide-in-bottom", size: k, placement: z, closeOnInteractOutside: l, closeOnEscape: o, open: n, onOpenChange: j, restoreFocus: P, onExitComplete: i, ...r, children: p }), e[25] = o, e[26] = l, e[27] = j, e[28] = n, e[29] = i, e[30] = r, e[31] = P, e[32] = F, e[33] = k, e[34] = p, e[35] = z, e[36] = c, e[37] = f) : f = e[37];
53
+ let b;
54
+ return e[38] !== f || e[39] !== a ? (b = /* @__PURE__ */ O(w.Provider, { value: a, children: f }), e[38] = f, e[39] = a, e[40] = b) : b = e[40], b;
53
55
  }
54
56
  export {
55
- L as Modal
57
+ N as Modal
56
58
  };
@@ -23,9 +23,9 @@ function $({
23
23
  i.current.enabled = x, i.current.mode = h;
24
24
  const S = (e) => {
25
25
  const t = i.current;
26
- if (!t.enabled) return;
26
+ if (!t.enabled || !t.container) return;
27
27
  const n = e.getTotalSize();
28
- if (t.container && n !== t.lastSize) {
28
+ if (n !== t.lastSize) {
29
29
  t.lastSize = n;
30
30
  const d = e.options.horizontal ? "width" : "height";
31
31
  t.container.style[d] = `${n}px`;
@@ -1,12 +1,12 @@
1
1
  import { createLazyMeasurementsView as F } from "./lazy-measurements.js";
2
2
  import { memo as M, notUndefined as w, approxEqual as R, debounce as D } from "./utils.js";
3
- let I;
3
+ let z;
4
4
  const y = () => {
5
- if (I !== void 0) return I;
6
- if (typeof navigator > "u") return I = !1;
7
- if (/iP(hone|od|ad)/.test(navigator.userAgent)) return I = !0;
5
+ if (z !== void 0) return z;
6
+ if (typeof navigator > "u") return z = !1;
7
+ if (/iP(hone|od|ad)/.test(navigator.userAgent)) return z = !0;
8
8
  const r = navigator.maxTouchPoints;
9
- return I = navigator.platform === "MacIntel" && r !== void 0 && r > 0;
9
+ return z = navigator.platform === "MacIntel" && r !== void 0 && r > 0;
10
10
  }, C = (r) => {
11
11
  const { offsetWidth: a, offsetHeight: t } = r;
12
12
  return { width: a, height: t };
@@ -366,8 +366,8 @@ class U {
366
366
  p = g[f * 2] + g[f * 2 + 1] + c;
367
367
  }
368
368
  for (let f = m; f < t; f++) {
369
- const b = i(f), _ = d.get(b), z = typeof _ == "number" ? _ : this.options.estimateSize(f);
370
- g[f * 2] = p, g[f * 2 + 1] = z, p += z + c;
369
+ const b = i(f), _ = d.get(b), I = typeof _ == "number" ? _ : this.options.estimateSize(f);
370
+ g[f * 2] = p, g[f * 2 + 1] = I, p += I + c;
371
371
  }
372
372
  const E = F(t, g, i);
373
373
  return this.measurementsCache = E, E;
@@ -391,12 +391,12 @@ class U {
391
391
  const O = this.options.lanes === 1 ? h[c - 1] : this.getFurthestMeasurement(h, c);
392
392
  E = O ? O.end + this.options.gap : e + s, p = O ? O.lane : c % this.options.lanes, this.options.lanes > 1 && f && this.laneAssignments.set(c, p);
393
393
  }
394
- const b = d.get(v), _ = typeof b == "number" ? b : this.options.estimateSize(c), z = E + _;
394
+ const b = d.get(v), _ = typeof b == "number" ? b : this.options.estimateSize(c), I = E + _;
395
395
  h[c] = {
396
396
  index: c,
397
397
  start: E,
398
398
  size: _,
399
- end: z,
399
+ end: I,
400
400
  key: v,
401
401
  lane: p
402
402
  }, S[p] = c;
@@ -508,13 +508,13 @@ class U {
508
508
  m,
509
509
  this
510
510
  ) : (
511
- // Default: adjust scrollTop only when the resize is an above-
512
- // viewport item AND we're not actively scrolling backward.
513
- // Adjusting during backward scroll fights the user's scroll
514
- // direction and produces the "items jump while scrolling up"
515
- // jank reported across many issues. Users who want the old
516
- // behavior can pass shouldAdjustScrollPositionOnItemSizeChange.
517
- o < this.getScrollOffset() + this.scrollAdjustments && this.scrollDirection !== "backward"
511
+ // Default: adjust when the resize is an above-viewport item.
512
+ // First measurement (!has(key)): always adjust the item
513
+ // has never been sized, so the estimate→actual delta must
514
+ // be compensated regardless of scroll direction.
515
+ // Re-measurement (has(key)): skip during backward scroll
516
+ // to avoid the "items jump while scrolling up" cascade.
517
+ o < this.getScrollOffset() + this.scrollAdjustments && (!this.itemSizeCache.has(l) || this.scrollDirection !== "backward")
518
518
  ));
519
519
  (this.pendingMin === null || t < this.pendingMin) && (this.pendingMin = t), this.itemSizeCache.set(l, e), this.itemSizeCacheVersion++, h ? this.applyScrollAdjustment(this.getTotalSize() - S) : c && this.applyScrollAdjustment(m), this.notify(!1);
520
520
  }