@solibo/solibo-ui 1.0.15 → 1.0.16

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 (120) hide show
  1. package/dist/assets/index.css +1 -1
  2. package/dist/assets/index10.css +1 -1
  3. package/dist/assets/index12.css +1 -1
  4. package/dist/assets/index13.css +1 -1
  5. package/dist/assets/index14.css +1 -1
  6. package/dist/assets/index15.css +1 -1
  7. package/dist/assets/index18.css +1 -1
  8. package/dist/assets/index23.css +1 -1
  9. package/dist/assets/index24.css +1 -1
  10. package/dist/assets/index25.css +1 -1
  11. package/dist/assets/index26.css +1 -1
  12. package/dist/assets/index27.css +1 -1
  13. package/dist/assets/index29.css +1 -1
  14. package/dist/assets/index3.css +1 -1
  15. package/dist/assets/index30.css +1 -1
  16. package/dist/assets/index31.css +1 -1
  17. package/dist/assets/index33.css +1 -1
  18. package/dist/assets/index34.css +1 -1
  19. package/dist/assets/index35.css +1 -1
  20. package/dist/assets/index36.css +1 -1
  21. package/dist/assets/index37.css +1 -1
  22. package/dist/assets/index39.css +1 -1
  23. package/dist/assets/index4.css +1 -1
  24. package/dist/assets/index43.css +1 -1
  25. package/dist/assets/index44.css +1 -1
  26. package/dist/assets/index45.css +1 -1
  27. package/dist/assets/index47.css +1 -1
  28. package/dist/assets/index48.css +1 -1
  29. package/dist/assets/index49.css +1 -1
  30. package/dist/assets/index6.css +1 -1
  31. package/dist/assets/index8.css +1 -1
  32. package/dist/assets/index9.css +1 -1
  33. package/dist/assets/menu-popover.css +1 -1
  34. package/dist/components/app-link/index.cjs +1 -1
  35. package/dist/components/app-link/index.js +8 -8
  36. package/dist/components/aside/index.cjs +1 -1
  37. package/dist/components/aside/index.js +11 -11
  38. package/dist/components/avatar/index.cjs +1 -1
  39. package/dist/components/avatar/index.cjs.map +1 -1
  40. package/dist/components/avatar/index.js +58 -58
  41. package/dist/components/badge/index.cjs +1 -1
  42. package/dist/components/badge/index.js +27 -27
  43. package/dist/components/banner/index.cjs +1 -1
  44. package/dist/components/banner/index.js +14 -14
  45. package/dist/components/button/index.cjs +1 -1
  46. package/dist/components/button/index.js +18 -18
  47. package/dist/components/card/index.cjs +1 -1
  48. package/dist/components/card/index.js +46 -46
  49. package/dist/components/checkbox/index.cjs +1 -1
  50. package/dist/components/checkbox/index.js +7 -7
  51. package/dist/components/collapsible/index.cjs +1 -1
  52. package/dist/components/collapsible/index.cjs.map +1 -1
  53. package/dist/components/collapsible/index.js +18 -37
  54. package/dist/components/collapsible/index.js.map +1 -1
  55. package/dist/components/controls/index.cjs +1 -1
  56. package/dist/components/controls/index.cjs.map +1 -1
  57. package/dist/components/controls/index.js +110 -90
  58. package/dist/components/controls/index.js.map +1 -1
  59. package/dist/components/croppable/index.cjs +1 -1
  60. package/dist/components/croppable/index.js +181 -181
  61. package/dist/components/dialog/index.cjs +1 -1
  62. package/dist/components/dialog/index.js +31 -31
  63. package/dist/components/dropdown/index.cjs +1 -1
  64. package/dist/components/dropdown/index.js +80 -80
  65. package/dist/components/editor/index.cjs +16 -16
  66. package/dist/components/editor/index.cjs.map +1 -1
  67. package/dist/components/editor/index.js +196 -196
  68. package/dist/components/file/index.cjs +1 -1
  69. package/dist/components/file/index.js +24 -24
  70. package/dist/components/header/index.cjs +1 -1
  71. package/dist/components/header/index.cjs.map +1 -1
  72. package/dist/components/header/index.js +14 -14
  73. package/dist/components/icon/index.cjs +1 -1
  74. package/dist/components/icon/index.js +20 -20
  75. package/dist/components/input/index.cjs +1 -1
  76. package/dist/components/input/index.js +1 -1
  77. package/dist/components/list/index.cjs +1 -1
  78. package/dist/components/list/index.js +24 -24
  79. package/dist/components/loading/index.cjs +1 -1
  80. package/dist/components/loading/index.js +11 -11
  81. package/dist/components/menu/index.cjs +1 -1
  82. package/dist/components/menu/index.js +1 -1
  83. package/dist/components/message/index.cjs +1 -1
  84. package/dist/components/message/index.cjs.map +1 -1
  85. package/dist/components/message/index.js +26 -26
  86. package/dist/components/messages/index.cjs +1 -1
  87. package/dist/components/messages/index.js +20 -20
  88. package/dist/components/nav/index.cjs +1 -1
  89. package/dist/components/nav/index.js +12 -12
  90. package/dist/components/popover/index.cjs +1 -1
  91. package/dist/components/popover/index.js +38 -38
  92. package/dist/components/portal/index.cjs +1 -1
  93. package/dist/components/portal/index.js +7 -7
  94. package/dist/components/search/index.cjs +1 -1
  95. package/dist/components/search/index.cjs.map +1 -1
  96. package/dist/components/search/index.js +36 -36
  97. package/dist/components/sortable/index.cjs +1 -1
  98. package/dist/components/sortable/index.js +74 -74
  99. package/dist/components/textarea/index.cjs +1 -1
  100. package/dist/components/textarea/index.js +15 -15
  101. package/dist/components/toasts/index.cjs +1 -1
  102. package/dist/components/toasts/index.js +4 -4
  103. package/dist/components/toggle/index.cjs +1 -1
  104. package/dist/components/toggle/index.js +6 -6
  105. package/dist/components/tooltip/index.cjs +1 -1
  106. package/dist/components/tooltip/index.js +1 -1
  107. package/dist/{index-DE2nzqL5.js → index-BIV5OwVJ.js} +23 -23
  108. package/dist/{index-DE2nzqL5.js.map → index-BIV5OwVJ.js.map} +1 -1
  109. package/dist/index-CQNlYa2P.cjs +2 -0
  110. package/dist/{index-DF8JisYI.cjs.map → index-CQNlYa2P.cjs.map} +1 -1
  111. package/dist/index.cjs +1 -1
  112. package/dist/index.d.ts +3 -1
  113. package/dist/index.js +1 -1
  114. package/dist/{menu-popover-jTTxzTGZ.cjs → menu-popover-D1ALaiV5.cjs} +2 -2
  115. package/dist/{menu-popover-jTTxzTGZ.cjs.map → menu-popover-D1ALaiV5.cjs.map} +1 -1
  116. package/dist/{menu-popover-SiOOwab-.js → menu-popover-DQHDIw-8.js} +12 -12
  117. package/dist/{menu-popover-SiOOwab-.js.map → menu-popover-DQHDIw-8.js.map} +1 -1
  118. package/dist/tokens.json +1 -1
  119. package/package.json +1 -1
  120. package/dist/index-DF8JisYI.cjs +0 -2
@@ -1,46 +1,46 @@
1
1
  import { jsxs as J, jsx as w } from "react/jsx-runtime";
2
- import { t as nt } from "../../classix-DG18itHa.js";
3
- import { useRef as x, useState as Z, useEffect as U } from "react";
2
+ import { t as ot } from "../../classix-DG18itHa.js";
3
+ import { useRef as x, useState as S, useEffect as E } from "react";
4
4
  import { Button as wt } from "../button/index.js";
5
5
  import { Figure as xt } from "../figure/index.js";
6
6
  import { Icon as yt } from "../icon/index.js";
7
- import '../../assets/index35.css';const P = 10, j = 0.1, Yt = 0.92, h = (u, p, _) => Math.min(_, Math.max(p, u)), Xt = (u) => new Promise((p, _) => {
8
- const d = URL.createObjectURL(u), i = new globalThis.Image();
9
- i.onload = () => {
10
- URL.revokeObjectURL(d), p(i);
11
- }, i.onerror = () => {
12
- URL.revokeObjectURL(d), _(new Error("croppable-image-load-failed"));
13
- }, i.src = d;
14
- }), At = async ({
7
+ import '../../assets/index35.css';const I = 10, Z = 0.1, Pt = 0.92, d = (u, p, _) => Math.min(_, Math.max(p, u)), Yt = (u) => new Promise((p, _) => {
8
+ const h = URL.createObjectURL(u), s = new globalThis.Image();
9
+ s.onload = () => {
10
+ URL.revokeObjectURL(h), p(s);
11
+ }, s.onerror = () => {
12
+ URL.revokeObjectURL(h), _(new Error("croppable-image-load-failed"));
13
+ }, s.src = h;
14
+ }), Xt = async ({
15
15
  file: u,
16
16
  fill: p,
17
17
  transform: _,
18
- viewport: d
18
+ viewport: h
19
19
  }) => {
20
- const i = await Xt(u), Y = d.width / i.naturalWidth, R = d.height / i.naturalHeight, y = Math.max(Y, R), k = i.naturalWidth * y, L = i.naturalHeight * y, C = p === "width" ? Math.max(j, Y / y) : p === "height" ? Math.max(j, R / y) : j, T = h(_.zoom, C, P), g = y * T, b = k * T, F = L * T, m = (d.width - b) / 2 + _.offset.x, v = (d.height - F) / 2 + _.offset.y, X = h(-m / g, 0, i.naturalWidth), E = h(-v / g, 0, i.naturalHeight), O = h(d.width / g, 1, Math.max(1, i.naturalWidth - X)), c = h(d.height / g, 1, Math.max(1, i.naturalHeight - E)), z = document.createElement("canvas"), a = z.getContext("2d");
20
+ const s = await Yt(u), P = h.width / s.naturalWidth, R = h.height / s.naturalHeight, y = Math.max(P, R), j = s.naturalWidth * y, L = s.naturalHeight * y, C = p === "width" ? Math.max(Z, P / y) : p === "height" ? Math.max(Z, R / y) : Z, T = d(_.zoom, C, I), g = y * T, b = j * T, $ = L * T, m = (h.width - b) / 2 + _.offset.x, k = (h.height - $) / 2 + _.offset.y, Y = d(-m / g, 0, s.naturalWidth), v = d(-k / g, 0, s.naturalHeight), U = d(h.width / g, 1, Math.max(1, s.naturalWidth - Y)), c = d(h.height / g, 1, Math.max(1, s.naturalHeight - v)), z = document.createElement("canvas"), a = z.getContext("2d");
21
21
  if (!a)
22
22
  throw new Error("croppable-image-context-missing");
23
- z.width = Math.max(1, Math.round(O)), z.height = Math.max(1, Math.round(c)), a.drawImage(i, X, E, O, c, 0, 0, z.width, z.height);
24
- const A = u.type.startsWith("image/") ? u.type : "image/jpeg", D = await new Promise((G) => {
25
- z.toBlob(G, A, Yt);
23
+ z.width = Math.max(1, Math.round(U)), z.height = Math.max(1, Math.round(c)), a.drawImage(s, Y, v, U, c, 0, 0, z.width, z.height);
24
+ const X = u.type.startsWith("image/") ? u.type : "image/jpeg", A = await new Promise((F) => {
25
+ z.toBlob(F, X, Pt);
26
26
  });
27
- if (!D)
27
+ if (!A)
28
28
  throw new Error("croppable-image-export-failed");
29
- return new globalThis.File([D], u.name, {
29
+ return new globalThis.File([A], u.name, {
30
30
  lastModified: Date.now(),
31
- type: D.type || A
31
+ type: A.type || X
32
32
  });
33
- }, Dt = "_croppable_1rdsr_1", Wt = "_empty_1rdsr_14", Ht = "_media_1rdsr_22", St = "_overlay_1rdsr_33", Zt = "_viewport_1rdsr_41", jt = "_draggable_1rdsr_53", kt = "_dragging_1rdsr_57", Bt = "_inner_1rdsr_61", Nt = "_standalone_1rdsr_77", M = {
34
- croppable: Dt,
35
- empty: Wt,
36
- media: Ht,
37
- overlay: St,
38
- viewport: Zt,
39
- draggable: jt,
40
- dragging: kt,
41
- inner: Bt,
42
- standalone: Nt
43
- }, $t = 192, $ = {
33
+ }, At = "_croppable_1kqo4_1", Dt = "_empty_1kqo4_14", Wt = "_media_1kqo4_22", Ht = "_overlay_1kqo4_33", St = "_viewport_1kqo4_41", Zt = "_draggable_1kqo4_53", jt = "_dragging_1kqo4_57", qt = "_inner_1kqo4_61", Bt = "_standalone_1kqo4_77", M = {
34
+ croppable: At,
35
+ empty: Dt,
36
+ media: Wt,
37
+ overlay: Ht,
38
+ viewport: St,
39
+ draggable: Zt,
40
+ dragging: jt,
41
+ inner: qt,
42
+ standalone: Bt
43
+ }, Nt = 192, N = {
44
44
  offset: {
45
45
  x: 0,
46
46
  y: 0
@@ -50,126 +50,126 @@ import '../../assets/index35.css';const P = 10, j = 0.1, Yt = 0.92, h = (u, p, _
50
50
  children: u,
51
51
  fill: p = "none",
52
52
  height: _,
53
- image: d,
54
- label: i,
55
- onCroppableChange: Y,
53
+ image: h,
54
+ label: s,
55
+ onCroppableChange: P,
56
56
  onFileChange: R,
57
57
  onImageChange: y,
58
- onTransformChange: k,
58
+ onTransformChange: j,
59
59
  transform: L,
60
60
  standalone: C
61
61
  }) => {
62
- const T = x(null), g = x(null), b = x(null), F = x(null), m = x(y), v = x(null), X = x(null), E = x(null), O = x(/* @__PURE__ */ new Map()), c = x($), z = x(null), [a, A] = Z(null), [D, G] = Z(null), [ot, tt] = Z(!1), [zt, ct] = Z($), [q, st] = Z(null), [f, Mt] = Z({
62
+ const T = x(null), g = x(null), b = x(null), $ = x(null), m = x(y), k = x(null), Y = x(null), v = x(null), U = x(/* @__PURE__ */ new Map()), c = x(N), z = x(null), [a, X] = S(null), [A, F] = S(null), [rt, tt] = S(!1), [zt, ct] = S(N), [G, it] = S(null), [f, Mt] = S({
63
63
  width: 0,
64
64
  height: 0
65
- }), B = (() => {
66
- const t = f.width, r = f.height;
67
- if (!t || !r) return {
65
+ }), q = (() => {
66
+ const t = f.width, n = f.height;
67
+ if (!t || !n) return {
68
68
  width: 0,
69
69
  height: 0,
70
- minZoom: j
70
+ minZoom: Z
71
71
  };
72
72
  if (!a) return {
73
73
  width: t,
74
- height: r,
75
- minZoom: j
74
+ height: n,
75
+ minZoom: Z
76
76
  };
77
- const n = t / a.width, e = r / a.height, o = Math.max(n, e), s = p === "width" ? n / o : p === "height" ? e / o : 0;
77
+ const o = t / a.width, e = n / a.height, r = Math.max(o, e), i = p === "width" ? o / r : p === "height" ? e / r : 0;
78
78
  return {
79
- width: a.width * o,
80
- height: a.height * o,
81
- minZoom: Math.max(j, s)
79
+ width: a.width * r,
80
+ height: a.height * r,
81
+ minZoom: Math.max(Z, i)
82
82
  };
83
- })(), W = B.minZoom, N = L ?? zt, H = h(N.zoom, W, P), K = D ?? d ?? null, it = !u && !!d && !D && !q, Q = !it, at = u ?? (K ? /* @__PURE__ */ w("img", { alt: "", draggable: !1, onLoad: (t) => {
84
- const r = t.currentTarget;
85
- r.naturalWidth && r.naturalHeight && A({
86
- width: r.naturalWidth,
87
- height: r.naturalHeight
83
+ })(), D = q.minZoom, B = L ?? zt, W = d(B.zoom, D, I), K = A ?? h ?? null, st = !u && !!h && !A && !G, Q = !st, at = u ?? (K ? /* @__PURE__ */ w("img", { alt: "", draggable: !1, onLoad: (t) => {
84
+ const n = t.currentTarget;
85
+ n.naturalWidth && n.naturalHeight && X({
86
+ width: n.naturalWidth,
87
+ height: n.naturalHeight
88
88
  });
89
- }, src: K }) : null), S = at == null, et = (t, r) => {
89
+ }, src: K }) : null), H = at == null, et = (t, n) => {
90
90
  const {
91
- maxX: n,
91
+ maxX: o,
92
92
  maxY: e
93
- } = ut(r);
93
+ } = ut(n);
94
94
  return {
95
- x: h(t.x, -n, n),
96
- y: h(t.y, -e, e)
95
+ x: d(t.x, -o, o),
96
+ y: d(t.y, -e, e)
97
97
  };
98
- }, lt = (t, r) => {
99
- const n = z.current;
100
- if (!n) return null;
101
- const e = n.getBoundingClientRect(), o = t - e.left - e.width / 2, s = r - e.top - e.height / 2;
98
+ }, lt = (t, n) => {
99
+ const o = z.current;
100
+ if (!o) return null;
101
+ const e = o.getBoundingClientRect(), r = t - e.left - e.width / 2, i = n - e.top - e.height / 2;
102
102
  return {
103
- x: o,
104
- y: s
103
+ x: r,
104
+ y: i
105
105
  };
106
- }, _t = (t, r, n, e) => {
107
- const o = h(r, W, P), s = h(n, W, P);
108
- if (o === 0) return t;
109
- const l = s / o;
106
+ }, _t = (t, n, o, e) => {
107
+ const r = d(n, D, I), i = d(o, D, I);
108
+ if (r === 0) return t;
109
+ const l = i / r;
110
110
  return {
111
111
  x: (1 - l) * e.x + l * t.x,
112
112
  y: (1 - l) * e.y + l * t.y
113
113
  };
114
- }, Rt = (t, r, n) => {
115
- const e = c.current.zoom, o = h(t, W, P), s = c.current.offset, l = n ? _t(s, e, o, n) : r, I = et(l, o);
114
+ }, Rt = (t, n, o) => {
115
+ const e = c.current.zoom, r = d(t, D, I), i = c.current.offset, l = o ? _t(i, e, r, o) : n, O = et(l, r);
116
116
  c.current = {
117
- zoom: o,
118
- offset: I
117
+ zoom: r,
118
+ offset: O
119
119
  }, L || ct({
120
- zoom: o,
121
- offset: I
122
- }), k == null || k({
123
- zoom: o,
124
- offset: I
120
+ zoom: r,
121
+ offset: O
122
+ }), j == null || j({
123
+ zoom: r,
124
+ offset: O
125
125
  });
126
- }, V = (t, r, n) => {
127
- X.current = {
126
+ }, V = (t, n, o) => {
127
+ Y.current = {
128
128
  zoom: t,
129
- offset: r,
130
- anchor: n ?? null
129
+ offset: n,
130
+ anchor: o ?? null
131
131
  }, g.current == null && (g.current = window.requestAnimationFrame(() => {
132
132
  g.current = null;
133
- const e = X.current;
134
- X.current = null;
135
- const o = (e == null ? void 0 : e.zoom) ?? c.current.zoom, s = (e == null ? void 0 : e.offset) ?? c.current.offset, l = (e == null ? void 0 : e.anchor) ?? null;
136
- Rt(o, s, l);
133
+ const e = Y.current;
134
+ Y.current = null;
135
+ const r = (e == null ? void 0 : e.zoom) ?? c.current.zoom, i = (e == null ? void 0 : e.offset) ?? c.current.offset, l = (e == null ? void 0 : e.anchor) ?? null;
136
+ Rt(r, i, l);
137
137
  }));
138
138
  }, Lt = (t) => {
139
- if (S || !Q) return;
140
- const r = t.ctrlKey ? 1e-3 : 25e-5, n = c.current.zoom * Math.exp(-t.deltaY * r), e = lt(t.clientX, t.clientY);
141
- V(n, c.current.offset, e);
139
+ if (H || !Q) return;
140
+ const n = t.ctrlKey ? 1e-3 : 25e-5, o = c.current.zoom * Math.exp(-t.deltaY * n), e = lt(t.clientX, t.clientY);
141
+ V(o, c.current.offset, e);
142
142
  }, ut = (t) => {
143
- const r = f.width, n = f.height;
144
- if (!r || !n) return {
143
+ const n = f.width, o = f.height;
144
+ if (!n || !o) return {
145
145
  maxX: 0,
146
146
  maxY: 0
147
147
  };
148
- const e = h(t, W, P), o = B.width * e, s = B.height * e, l = Math.max(0, (o - r) / 2), I = Math.max(0, (s - n) / 2);
148
+ const e = d(t, D, I), r = q.width * e, i = q.height * e, l = Math.max(0, (r - n) / 2), O = Math.max(0, (i - o) / 2);
149
149
  return {
150
150
  maxX: l,
151
- maxY: I
151
+ maxY: O
152
152
  };
153
153
  }, Tt = (t) => {
154
- var o;
155
- const r = t.target, n = ((o = r.files) == null ? void 0 : o[0]) ?? null;
156
- if (v.current && (URL.revokeObjectURL(v.current), v.current = null), !n) {
157
- G(null), st(null), R == null || R(null), r.value = "";
154
+ var r;
155
+ const n = t.target, o = ((r = n.files) == null ? void 0 : r[0]) ?? null;
156
+ if (k.current && (URL.revokeObjectURL(k.current), k.current = null), !o) {
157
+ F(null), it(null), R == null || R(null), n.value = "";
158
158
  return;
159
159
  }
160
- const e = URL.createObjectURL(n);
161
- v.current = e, G(e), A(null), st(n), V($.zoom, $.offset), c.current = $, R == null || R(n), r.value = "";
162
- }, vt = (t) => {
163
- if (!(S || !Q || t.pointerType === "mouse" && t.button !== 0)) {
160
+ const e = URL.createObjectURL(o);
161
+ k.current = e, F(e), X(null), it(o), V(N.zoom, N.offset), c.current = N, R == null || R(o), n.value = "";
162
+ }, kt = (t) => {
163
+ if (!(H || !Q || t.pointerType === "mouse" && t.button !== 0)) {
164
164
  if (t.currentTarget.setPointerCapture(t.pointerId), t.pointerType === "touch") {
165
- const r = O.current;
166
- if (r.set(t.pointerId, {
165
+ const n = U.current;
166
+ if (n.set(t.pointerId, {
167
167
  x: t.clientX,
168
168
  y: t.clientY
169
- }), r.size === 2) {
169
+ }), n.size === 2) {
170
170
  b.current = null, T.current = null, tt(!1);
171
- const [n, e] = Array.from(r.values());
172
- E.current = Math.hypot(n.x - e.x, n.y - e.y);
171
+ const [o, e] = Array.from(n.values());
172
+ v.current = Math.hypot(o.x - e.x, o.y - e.y);
173
173
  return;
174
174
  }
175
175
  }
@@ -180,139 +180,139 @@ import '../../assets/index35.css';const P = 10, j = 0.1, Yt = 0.92, h = (u, p, _
180
180
  originY: c.current.offset.y
181
181
  };
182
182
  }
183
- }, Et = (t) => {
184
- if (S || !Q) return;
183
+ }, vt = (t) => {
184
+ if (H || !Q) return;
185
185
  if (t.pointerType === "touch") {
186
- const o = O.current;
187
- if (!o.has(t.pointerId)) return;
188
- if (o.set(t.pointerId, {
186
+ const r = U.current;
187
+ if (!r.has(t.pointerId)) return;
188
+ if (r.set(t.pointerId, {
189
189
  x: t.clientX,
190
190
  y: t.clientY
191
- }), o.size === 2) {
192
- const [s, l] = Array.from(o.values()), I = s.x - l.x, Ut = s.y - l.y, pt = Math.hypot(I, Ut), gt = {
193
- x: (s.x + l.x) / 2,
194
- y: (s.y + l.y) / 2
191
+ }), r.size === 2) {
192
+ const [i, l] = Array.from(r.values()), O = i.x - l.x, Et = i.y - l.y, pt = Math.hypot(O, Et), gt = {
193
+ x: (i.x + l.x) / 2,
194
+ y: (i.y + l.y) / 2
195
195
  };
196
- if (E.current) {
197
- const Ot = pt / E.current, It = c.current.zoom * Ot, Pt = lt(gt.x, gt.y);
198
- V(It, c.current.offset, Pt);
196
+ if (v.current) {
197
+ const Ut = pt / v.current, Ot = c.current.zoom * Ut, It = lt(gt.x, gt.y);
198
+ V(Ot, c.current.offset, It);
199
199
  }
200
- E.current = pt;
200
+ v.current = pt;
201
201
  return;
202
202
  }
203
203
  }
204
- if (T.current !== t.pointerId || !b.current || !rt) return;
205
- const r = t.clientX - b.current.x, n = t.clientY - b.current.y, e = Math.abs(r) + Math.abs(n);
206
- !ot && e > 2 && tt(!0), !(e <= 1) && V(c.current.zoom, {
207
- x: b.current.originX + r,
208
- y: b.current.originY + n
204
+ if (T.current !== t.pointerId || !b.current || !nt) return;
205
+ const n = t.clientX - b.current.x, o = t.clientY - b.current.y, e = Math.abs(n) + Math.abs(o);
206
+ !rt && e > 2 && tt(!0), !(e <= 1) && V(c.current.zoom, {
207
+ x: b.current.originX + n,
208
+ y: b.current.originY + o
209
209
  });
210
- }, dt = (t) => {
211
- t.pointerType === "touch" && (O.current.delete(t.pointerId), O.current.size < 2 && (E.current = null)), T.current === t.pointerId && (T.current = null, b.current = null, tt(!1));
210
+ }, ht = (t) => {
211
+ t.pointerType === "touch" && (U.current.delete(t.pointerId), U.current.size < 2 && (v.current = null)), T.current === t.pointerId && (T.current = null, b.current = null, tt(!1));
212
212
  };
213
- U(() => {
213
+ E(() => {
214
214
  if (!L) return;
215
- const t = h(L.zoom, W, P);
215
+ const t = d(L.zoom, D, I);
216
216
  c.current = {
217
217
  zoom: t,
218
218
  offset: et(L.offset, t)
219
219
  };
220
- }, [L, f.width, f.height, a == null ? void 0 : a.width, a == null ? void 0 : a.height]), U(() => () => {
221
- v.current && URL.revokeObjectURL(v.current);
222
- }, []), U(() => {
220
+ }, [L, f.width, f.height, a == null ? void 0 : a.width, a == null ? void 0 : a.height]), E(() => () => {
221
+ k.current && URL.revokeObjectURL(k.current);
222
+ }, []), E(() => {
223
223
  const t = z.current;
224
224
  if (!t) return;
225
- const r = () => {
226
- const o = t.getBoundingClientRect();
227
- Mt((s) => s.width === o.width && s.height === o.height ? s : {
228
- width: o.width,
229
- height: o.height
230
- }), Y && Y(o);
225
+ const n = () => {
226
+ const r = t.getBoundingClientRect();
227
+ Mt((i) => i.width === r.width && i.height === r.height ? i : {
228
+ width: r.width,
229
+ height: r.height
230
+ }), P && P(r);
231
231
  };
232
- r();
233
- const n = () => r();
234
- if (window.addEventListener("scroll", n, !0), typeof ResizeObserver > "u") {
235
- const o = () => r();
236
- return window.addEventListener("resize", o), () => {
237
- window.removeEventListener("resize", o), window.removeEventListener("scroll", n, !0);
232
+ n();
233
+ const o = () => n();
234
+ if (window.addEventListener("scroll", o, !0), typeof ResizeObserver > "u") {
235
+ const r = () => n();
236
+ return window.addEventListener("resize", r), () => {
237
+ window.removeEventListener("resize", r), window.removeEventListener("scroll", o, !0);
238
238
  };
239
239
  }
240
- const e = new ResizeObserver(() => r());
240
+ const e = new ResizeObserver(() => n());
241
241
  return e.observe(t), () => {
242
- e.disconnect(), window.removeEventListener("scroll", n, !0);
242
+ e.disconnect(), window.removeEventListener("scroll", o, !0);
243
243
  };
244
- }, [Y]), U(() => {
244
+ }, [P]), E(() => {
245
245
  if (L) return;
246
- const t = c.current.offset, r = et(t, H);
247
- t.x === r.x && t.y === r.y || (c.current = {
246
+ const t = c.current.offset, n = et(t, W);
247
+ t.x === n.x && t.y === n.y || (c.current = {
248
248
  zoom: c.current.zoom,
249
- offset: r
250
- }, ct((n) => ({
251
- ...n,
252
- offset: r
249
+ offset: n
250
+ }, ct((o) => ({
251
+ ...o,
252
+ offset: n
253
253
  })));
254
- }, [H, a, f.width, f.height]), U(() => {
255
- K || A(null);
256
- }, [K]), U(() => {
254
+ }, [W, a, f.width, f.height]), E(() => {
255
+ K || X(null);
256
+ }, [K]), E(() => {
257
257
  m.current = y;
258
- }, [y]), U(() => {
259
- var n;
258
+ }, [y]), E(() => {
259
+ var o;
260
260
  if (!y) return;
261
- if (!q || !f.width || !f.height || u) {
262
- (n = m.current) == null || n.call(m, null);
261
+ if (!G || !f.width || !f.height || u) {
262
+ (o = m.current) == null || o.call(m, null);
263
263
  return;
264
264
  }
265
265
  let t = !0;
266
- const r = window.setTimeout(() => {
267
- At({
268
- file: q,
266
+ const n = window.setTimeout(() => {
267
+ Xt({
268
+ file: G,
269
269
  fill: p,
270
270
  transform: {
271
- zoom: H,
272
- offset: N.offset
271
+ zoom: W,
272
+ offset: B.offset
273
273
  },
274
274
  viewport: f
275
275
  }).then((e) => {
276
- var o;
277
- t && ((o = m.current) == null || o.call(m, e));
276
+ var r;
277
+ t && ((r = m.current) == null || r.call(m, e));
278
278
  }).catch(() => {
279
279
  var e;
280
280
  t && ((e = m.current) == null || e.call(m, null));
281
281
  });
282
282
  }, 75);
283
283
  return () => {
284
- t = !1, window.clearTimeout(r);
284
+ t = !1, window.clearTimeout(n);
285
285
  };
286
- }, [u, H, N.offset, p, q, f]), U(() => () => {
286
+ }, [u, W, B.offset, p, G, f]), E(() => () => {
287
287
  g.current != null && (window.cancelAnimationFrame(g.current), g.current = null);
288
288
  }, []);
289
- const ht = ut(H), rt = !S && Q && (ht.maxX > 0 || ht.maxY > 0), mt = () => {
289
+ const dt = ut(W), nt = !H && Q && (dt.maxX > 0 || dt.maxY > 0), mt = () => {
290
290
  var t;
291
- return (t = F.current) == null ? void 0 : t.click();
291
+ return (t = $.current) == null ? void 0 : t.click();
292
292
  }, ft = (t) => {
293
293
  t.preventDefault(), t.stopPropagation(), mt();
294
294
  };
295
- return /* @__PURE__ */ J("div", { className: nt(M.croppable, C && M.standalone), onClick: () => {
296
- S && mt();
295
+ return /* @__PURE__ */ J("div", { className: ot(M.croppable, C && M.standalone), onClick: () => {
296
+ H && mt();
297
297
  }, "data-component": "croppable", children: [
298
- /* @__PURE__ */ w("input", { accept: "image/*", onChange: Tt, ref: F, type: "file" }),
299
- /* @__PURE__ */ w("div", { className: M.viewport, ref: z, onDragStart: (t) => t.preventDefault(), onPointerDown: vt, onPointerMove: Et, onPointerUp: dt, onPointerCancel: dt, onWheel: Lt, style: {
300
- "--croppable-height": `${_ ?? $t}px`,
301
- "--croppable-zoom": H,
302
- "--croppable-x": `${N.offset.x}px`,
303
- "--croppable-y": `${N.offset.y}px`,
298
+ /* @__PURE__ */ w("input", { accept: "image/*", onChange: Tt, ref: $, type: "file" }),
299
+ /* @__PURE__ */ w("div", { className: M.viewport, ref: z, onDragStart: (t) => t.preventDefault(), onPointerDown: kt, onPointerMove: vt, onPointerUp: ht, onPointerCancel: ht, onWheel: Lt, style: {
300
+ "--croppable-height": `${_ ?? Nt}px`,
301
+ "--croppable-zoom": W,
302
+ "--croppable-x": `${B.offset.x}px`,
303
+ "--croppable-y": `${B.offset.y}px`,
304
304
  ...a ? {
305
- "--croppable-image-width": `${B.width}px`,
306
- "--croppable-image-height": `${B.height}px`
305
+ "--croppable-image-width": `${q.width}px`,
306
+ "--croppable-image-height": `${q.height}px`
307
307
  } : null
308
- }, children: S ? /* @__PURE__ */ J("div", { className: M.empty, children: [
308
+ }, children: H ? /* @__PURE__ */ J("div", { className: M.empty, children: [
309
309
  /* @__PURE__ */ w(xt, { children: /* @__PURE__ */ w(yt, { name: "image", size: "large" }) }),
310
- /* @__PURE__ */ w(wt, { onClick: ft, children: i ?? bt })
311
- ] }) : /* @__PURE__ */ J("div", { className: nt(M.media, rt && M.draggable, rt && ot && M.dragging), children: [
312
- /* @__PURE__ */ w("div", { className: nt(M.inner), children: at }),
313
- it && /* @__PURE__ */ w("div", { className: M.overlay, children: /* @__PURE__ */ J("div", { className: M.empty, children: [
310
+ /* @__PURE__ */ w(wt, { onClick: ft, children: s ?? bt })
311
+ ] }) : /* @__PURE__ */ J("div", { className: ot(M.media, nt && M.draggable, nt && rt && M.dragging), children: [
312
+ /* @__PURE__ */ w("div", { className: ot(M.inner), children: at }),
313
+ st && /* @__PURE__ */ w("div", { className: M.overlay, children: /* @__PURE__ */ J("div", { className: M.empty, children: [
314
314
  /* @__PURE__ */ w(xt, { children: /* @__PURE__ */ w(yt, { name: "image", size: "large" }) }),
315
- /* @__PURE__ */ w(wt, { onClick: ft, children: i ?? bt })
315
+ /* @__PURE__ */ w(wt, { onClick: ft, children: s ?? bt })
316
316
  ] }) })
317
317
  ] }) })
318
318
  ] });
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index36.css');const e=require("react/jsx-runtime"),p=require("../../classix-5H4IWnMA.cjs"),a=require("react"),h=require("../button/index.cjs"),P=require("../icon/index.cjs"),T="_dialog_1ojxw_3",E="_close_1ojxw_24",F="_structured_1ojxw_32",M="_header_1ojxw_38",S="_content_1ojxw_49",X="_controls_1ojxw_57",Y="_fullscreen_1ojxw_77",s={dialog:T,close:E,structured:F,header:M,content:S,controls:X,fullscreen:Y},w=c=>a.Children.toArray(c).some(o=>a.isValidElement(o)?o.type===h.Button&&o.props.variant==="danger"?!0:w(o.props.children):!1),A=({children:c,className:o,controls:l,fullscreen:f=!1,header:_,onCancel:i,onClick:u,onClose:d,open:n=!1,setOpen:r,...B})=>{const g=a.useRef(null),x=w(l),j=f||_!=null||l!=null;a.useEffect(()=>{const t=g.current;t&&(n&&!t.open?t.showModal():!n&&t.open&&t.close())},[n]);const b=t=>{i==null||i(t),!(t.defaultPrevented||!r)&&(t.preventDefault(),r(!1))},q=t=>{if(u==null||u(t),x||t.defaultPrevented||t.target!==t.currentTarget||!r)return;const{bottom:N,left:R,right:D,top:k}=t.currentTarget.getBoundingClientRect();(t.clientX<R||t.clientX>D||t.clientY<k||t.clientY>N)&&r(!1)},y=t=>{d==null||d(t),n&&(r==null||r(!1))},m=r&&!x?e.jsx(h.Button,{"aria-label":"Close dialog",className:s.close,onClick:()=>r(!1),variant:"simple",children:e.jsx(P.Icon,{name:"x"})}):null;return e.jsx("dialog",{className:p.t(s.dialog,j&&s.structured,f&&s.fullscreen,o),onCancel:b,onClick:q,onClose:y,ref:g,...B,"data-component":"dialog",children:j?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:s.header,children:[_,m]}),e.jsx("div",{className:s.content,children:c}),l!=null&&e.jsx("div",{className:s.controls,children:l})]}):e.jsxs(e.Fragment,{children:[m,c]})})};exports.Dialog=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index36.css');const e=require("react/jsx-runtime"),P=require("../../classix-5H4IWnMA.cjs"),a=require("react"),j=require("../button/index.cjs"),T=require("../icon/index.cjs"),E="_dialog_gog2p_3",F="_close_gog2p_24",M="_fullscreen_gog2p_35",S="_structured_gog2p_56",X="_header_gog2p_62",Y="_content_gog2p_73",w="_controls_gog2p_81",s={dialog:E,close:F,fullscreen:M,structured:S,header:X,content:Y,controls:w},p=c=>a.Children.toArray(c).some(o=>a.isValidElement(o)?o.type===j.Button&&o.props.variant==="danger"?!0:p(o.props.children):!1),A=({children:c,className:o,controls:l,fullscreen:g=!1,header:f,onCancel:i,onClick:u,onClose:d,open:n=!1,setOpen:r,...B})=>{const _=a.useRef(null),m=p(l),h=g||f!=null||l!=null;a.useEffect(()=>{const t=_.current;t&&(n&&!t.open?t.showModal():!n&&t.open&&t.close())},[n]);const b=t=>{i==null||i(t),!(t.defaultPrevented||!r)&&(t.preventDefault(),r(!1))},q=t=>{if(u==null||u(t),m||t.defaultPrevented||t.target!==t.currentTarget||!r)return;const{bottom:N,left:R,right:D,top:k}=t.currentTarget.getBoundingClientRect();(t.clientX<R||t.clientX>D||t.clientY<k||t.clientY>N)&&r(!1)},y=t=>{d==null||d(t),n&&(r==null||r(!1))},x=r&&!m?e.jsx(j.Button,{"aria-label":"Close dialog",className:s.close,onClick:()=>r(!1),variant:"simple",children:e.jsx(T.Icon,{name:"x"})}):null;return e.jsx("dialog",{className:P.t(s.dialog,h&&s.structured,g&&s.fullscreen,o),onCancel:b,onClick:q,onClose:y,ref:_,...B,"data-component":"dialog",children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:s.header,children:[f,x]}),e.jsx("div",{className:s.content,children:c}),l!=null&&e.jsx("div",{className:s.controls,children:l})]}):e.jsxs(e.Fragment,{children:[x,c]})})};exports.Dialog=A;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,57 +1,57 @@
1
- import { jsx as e, jsxs as u, Fragment as j } from "react/jsx-runtime";
2
- import { t as T } from "../../classix-DG18itHa.js";
3
- import w, { useRef as X, useEffect as Y } from "react";
4
- import { Button as p } from "../button/index.js";
1
+ import { jsx as e, jsxs as u, Fragment as B } from "react/jsx-runtime";
2
+ import { t as X } from "../../classix-DG18itHa.js";
3
+ import N, { useRef as Y, useEffect as w } from "react";
4
+ import { Button as x } from "../button/index.js";
5
5
  import { Icon as A } from "../icon/index.js";
6
- import '../../assets/index36.css';const F = "_dialog_1ojxw_3", I = "_close_1ojxw_24", M = "_structured_1ojxw_32", V = "_header_1ojxw_38", q = "_content_1ojxw_49", z = "_controls_1ojxw_57", G = "_fullscreen_1ojxw_77", l = {
6
+ import '../../assets/index36.css';const F = "_dialog_gog2p_3", I = "_close_gog2p_24", M = "_fullscreen_gog2p_35", V = "_structured_gog2p_56", q = "_header_gog2p_62", z = "_content_gog2p_73", G = "_controls_gog2p_81", l = {
7
7
  dialog: F,
8
8
  close: I,
9
- structured: M,
10
- header: V,
11
- content: q,
12
- controls: z,
13
- fullscreen: G
14
- }, B = (c) => w.Children.toArray(c).some((o) => w.isValidElement(o) ? o.type === p && o.props.variant === "danger" ? !0 : B(o.props.children) : !1), U = ({
9
+ fullscreen: M,
10
+ structured: V,
11
+ header: q,
12
+ content: z,
13
+ controls: G
14
+ }, R = (c) => N.Children.toArray(c).some((o) => N.isValidElement(o) ? o.type === x && o.props.variant === "danger" ? !0 : R(o.props.children) : !1), U = ({
15
15
  children: c,
16
16
  className: o,
17
17
  controls: a,
18
18
  fullscreen: f = !1,
19
- header: _,
19
+ header: g,
20
20
  onCancel: n,
21
21
  onClick: i,
22
22
  onClose: d,
23
23
  open: s = !1,
24
24
  setOpen: t,
25
- ...N
25
+ ...k
26
26
  }) => {
27
- const m = X(null), g = B(a), h = f || _ != null || a != null;
28
- Y(() => {
29
- const r = m.current;
27
+ const _ = Y(null), m = R(a), h = f || g != null || a != null;
28
+ w(() => {
29
+ const r = _.current;
30
30
  r && (s && !r.open ? r.showModal() : !s && r.open && r.close());
31
31
  }, [s]);
32
- const R = (r) => {
32
+ const y = (r) => {
33
33
  n == null || n(r), !(r.defaultPrevented || !t) && (r.preventDefault(), t(!1));
34
- }, k = (r) => {
35
- if (i == null || i(r), g || r.defaultPrevented || r.target !== r.currentTarget || !t) return;
34
+ }, D = (r) => {
35
+ if (i == null || i(r), m || r.defaultPrevented || r.target !== r.currentTarget || !t) return;
36
36
  const {
37
- bottom: D,
38
- left: b,
39
- right: E,
40
- top: P
37
+ bottom: j,
38
+ left: E,
39
+ right: P,
40
+ top: T
41
41
  } = r.currentTarget.getBoundingClientRect();
42
- (r.clientX < b || r.clientX > E || r.clientY < P || r.clientY > D) && t(!1);
43
- }, y = (r) => {
42
+ (r.clientX < E || r.clientX > P || r.clientY < T || r.clientY > j) && t(!1);
43
+ }, b = (r) => {
44
44
  d == null || d(r), s && (t == null || t(!1));
45
- }, x = t && !g ? /* @__PURE__ */ e(p, { "aria-label": "Close dialog", className: l.close, onClick: () => t(!1), variant: "simple", children: /* @__PURE__ */ e(A, { name: "x" }) }) : null;
46
- return /* @__PURE__ */ e("dialog", { className: T(l.dialog, h && l.structured, f && l.fullscreen, o), onCancel: R, onClick: k, onClose: y, ref: m, ...N, "data-component": "dialog", children: h ? /* @__PURE__ */ u(j, { children: [
45
+ }, p = t && !m ? /* @__PURE__ */ e(x, { "aria-label": "Close dialog", className: l.close, onClick: () => t(!1), variant: "simple", children: /* @__PURE__ */ e(A, { name: "x" }) }) : null;
46
+ return /* @__PURE__ */ e("dialog", { className: X(l.dialog, h && l.structured, f && l.fullscreen, o), onCancel: y, onClick: D, onClose: b, ref: _, ...k, "data-component": "dialog", children: h ? /* @__PURE__ */ u(B, { children: [
47
47
  /* @__PURE__ */ u("div", { className: l.header, children: [
48
- _,
49
- x
48
+ g,
49
+ p
50
50
  ] }),
51
51
  /* @__PURE__ */ e("div", { className: l.content, children: c }),
52
52
  a != null && /* @__PURE__ */ e("div", { className: l.controls, children: a })
53
- ] }) : /* @__PURE__ */ u(j, { children: [
54
- x,
53
+ ] }) : /* @__PURE__ */ u(B, { children: [
54
+ p,
55
55
  c
56
56
  ] }) });
57
57
  };