@vacano/ui 1.4.0 → 1.4.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.
- package/dist/index.cjs +23 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +202 -182
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as s, m as nr, g as ar, s as lr, r as dr, u as cr, i as sr, L as pr, a as P, M as ur, C as Eo, X as Dt, b as Co, c as st, d as pt, F as rt } from "./X-Cm-i8Bh7.js";
|
|
2
2
|
import { css as hr, Global as br, withEmotionCache as gr, ThemeContext as fr, keyframes as He } from "@emotion/react";
|
|
3
3
|
import * as Re from "react";
|
|
4
|
-
import { useMemo as re, useRef as U, useImperativeHandle as
|
|
4
|
+
import { useMemo as re, useRef as U, useImperativeHandle as xr, useState as V, useCallback as M, useLayoutEffect as lt, useEffect as je, cloneElement as $r, createContext as yr, useReducer as vr, useContext as wr } from "react";
|
|
5
5
|
import { C as o, a as l, K as fe, g as mr, u as kr, B as Ie, m as Ne } from "./media-BR6nutcO.js";
|
|
6
6
|
import { n as D } from "./tooling-YDHxmiMT.js";
|
|
7
7
|
import { createPortal as ve } from "react-dom";
|
|
@@ -193,12 +193,12 @@ var zr = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|def
|
|
|
193
193
|
if (a !== void 0 && f.push("label:" + a + ";"), h[0] == null || h[0].raw === void 0)
|
|
194
194
|
f.push.apply(f, h);
|
|
195
195
|
else {
|
|
196
|
-
var
|
|
197
|
-
f.push(
|
|
196
|
+
var $ = h[0];
|
|
197
|
+
f.push($[0]);
|
|
198
198
|
for (var C = h.length, w = 1; w < C; w++)
|
|
199
|
-
f.push(h[w],
|
|
199
|
+
f.push(h[w], $[w]);
|
|
200
200
|
}
|
|
201
|
-
var v = gr(function(y,
|
|
201
|
+
var v = gr(function(y, x, m) {
|
|
202
202
|
var g = b && y.as || n, T = "", N = [], L = y;
|
|
203
203
|
if (y.theme == null) {
|
|
204
204
|
L = {};
|
|
@@ -206,14 +206,14 @@ var zr = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|def
|
|
|
206
206
|
L[q] = y[q];
|
|
207
207
|
L.theme = Re.useContext(fr);
|
|
208
208
|
}
|
|
209
|
-
typeof y.className == "string" ? T = ar(
|
|
210
|
-
var I = lr(f.concat(N),
|
|
211
|
-
T +=
|
|
209
|
+
typeof y.className == "string" ? T = ar(x.registered, N, y.className) : y.className != null && (T = y.className + " ");
|
|
210
|
+
var I = lr(f.concat(N), x.registered, L);
|
|
211
|
+
T += x.key + "-" + I.name, c !== void 0 && (T += " " + c);
|
|
212
212
|
var F = b && d === void 0 ? Yt(g) : u, O = {};
|
|
213
213
|
for (var z in y)
|
|
214
214
|
b && z === "as" || F(z) && (O[z] = y[z]);
|
|
215
215
|
return O.className = T, m && (O.ref = m), /* @__PURE__ */ Re.createElement(Re.Fragment, null, /* @__PURE__ */ Re.createElement(Tr, {
|
|
216
|
-
cache:
|
|
216
|
+
cache: x,
|
|
217
217
|
serialized: I,
|
|
218
218
|
isStringTag: typeof g == "string"
|
|
219
219
|
}), /* @__PURE__ */ Re.createElement(g, O));
|
|
@@ -222,9 +222,9 @@ var zr = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|def
|
|
|
222
222
|
value: function() {
|
|
223
223
|
return "." + c;
|
|
224
224
|
}
|
|
225
|
-
}), v.withComponent = function(y,
|
|
226
|
-
var m = e(y, Tt({}, r,
|
|
227
|
-
shouldForwardProp: Ht(v,
|
|
225
|
+
}), v.withComponent = function(y, x) {
|
|
226
|
+
var m = e(y, Tt({}, r, x, {
|
|
227
|
+
shouldForwardProp: Ht(v, x, !0)
|
|
228
228
|
}));
|
|
229
229
|
return m.apply(void 0, f);
|
|
230
230
|
}, v;
|
|
@@ -617,11 +617,11 @@ const jt = {
|
|
|
617
617
|
keyBindings: b = [],
|
|
618
618
|
size: h = "default",
|
|
619
619
|
type: f = "button",
|
|
620
|
-
variant:
|
|
620
|
+
variant: $ = "normal",
|
|
621
621
|
...C
|
|
622
622
|
}) => {
|
|
623
623
|
const w = U(null);
|
|
624
|
-
|
|
624
|
+
xr(u, () => w.current, []), kr(b, () => {
|
|
625
625
|
var y;
|
|
626
626
|
(y = w.current) == null || y.click();
|
|
627
627
|
});
|
|
@@ -642,7 +642,7 @@ const jt = {
|
|
|
642
642
|
type: v,
|
|
643
643
|
disabled: i,
|
|
644
644
|
className: Xt("container", t),
|
|
645
|
-
$variant:
|
|
645
|
+
$variant: $,
|
|
646
646
|
$size: h,
|
|
647
647
|
$fullWidth: !!n,
|
|
648
648
|
$iconOnly: !!a && !(e || (b == null ? void 0 : b.length) > 0),
|
|
@@ -650,7 +650,7 @@ const jt = {
|
|
|
650
650
|
c && /* @__PURE__ */ s(Or, { $size: h }),
|
|
651
651
|
a && !c && /* @__PURE__ */ s(Ar, { $size: h, children: a }),
|
|
652
652
|
e && /* @__PURE__ */ s(Dr, { className: Xt("label", r == null ? void 0 : r.label), children: e }),
|
|
653
|
-
/* @__PURE__ */ s(Yr, { keys: b, variant:
|
|
653
|
+
/* @__PURE__ */ s(Yr, { keys: b, variant: $ === "system" ? "light" : "dark" })
|
|
654
654
|
]
|
|
655
655
|
}
|
|
656
656
|
);
|
|
@@ -699,15 +699,15 @@ const jt = {
|
|
|
699
699
|
label: o.red,
|
|
700
700
|
icon: o.white
|
|
701
701
|
}
|
|
702
|
-
},
|
|
702
|
+
}, xe = (e) => Ut[e] ?? Ut.normal, Vr = p.label`
|
|
703
703
|
display: inline-flex;
|
|
704
|
-
align-items:
|
|
704
|
+
align-items: flex-start;
|
|
705
705
|
gap: 8px;
|
|
706
706
|
cursor: ${(e) => e.$disabled ? "not-allowed" : "pointer"};
|
|
707
707
|
opacity: ${(e) => e.$disabled ? 0.5 : 1};
|
|
708
708
|
|
|
709
709
|
&:has(input:focus-visible) > span:first-of-type {
|
|
710
|
-
box-shadow: 0 0 0 2px ${(e) =>
|
|
710
|
+
box-shadow: 0 0 0 2px ${(e) => xe(e.$variant).box.focusShadow};
|
|
711
711
|
}
|
|
712
712
|
`, Wr = p.input`
|
|
713
713
|
position: absolute;
|
|
@@ -724,8 +724,8 @@ const jt = {
|
|
|
724
724
|
height: 18px;
|
|
725
725
|
border-radius: 6px;
|
|
726
726
|
border: 1.5px solid
|
|
727
|
-
${(e) => e.$checked || e.$indeterminate ?
|
|
728
|
-
background-color: ${(e) => e.$checked || e.$indeterminate ?
|
|
727
|
+
${(e) => e.$checked || e.$indeterminate ? xe(e.$variant).box.borderChecked : xe(e.$variant).box.border};
|
|
728
|
+
background-color: ${(e) => e.$checked || e.$indeterminate ? xe(e.$variant).box.backgroundChecked : xe(e.$variant).box.background};
|
|
729
729
|
transition:
|
|
730
730
|
border-color 0.15s ease,
|
|
731
731
|
background-color 0.15s ease,
|
|
@@ -734,7 +734,7 @@ const jt = {
|
|
|
734
734
|
display: inline-flex;
|
|
735
735
|
align-items: center;
|
|
736
736
|
justify-content: center;
|
|
737
|
-
color: ${(e) =>
|
|
737
|
+
color: ${(e) => xe(e.$variant).icon};
|
|
738
738
|
opacity: ${(e) => e.$visible ? 1 : 0};
|
|
739
739
|
transform: ${(e) => e.$visible ? "scale(1)" : "scale(0.5)"};
|
|
740
740
|
transition:
|
|
@@ -748,9 +748,19 @@ const jt = {
|
|
|
748
748
|
`, qr = p.span`
|
|
749
749
|
font-size: 14px;
|
|
750
750
|
font-weight: 500;
|
|
751
|
-
line-height: 1;
|
|
752
|
-
color: ${(e) =>
|
|
751
|
+
line-height: 1.4;
|
|
752
|
+
color: ${(e) => xe(e.$variant).label};
|
|
753
753
|
user-select: none;
|
|
754
|
+
|
|
755
|
+
a {
|
|
756
|
+
color: inherit;
|
|
757
|
+
text-decoration: underline;
|
|
758
|
+
cursor: pointer;
|
|
759
|
+
|
|
760
|
+
&:hover {
|
|
761
|
+
text-decoration: none;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
754
764
|
`, Le = D("checkbox"), Ot = ({
|
|
755
765
|
checked: e,
|
|
756
766
|
className: t,
|
|
@@ -1022,7 +1032,7 @@ const jt = {
|
|
|
1022
1032
|
...u
|
|
1023
1033
|
}) => {
|
|
1024
1034
|
const b = (h, f) => {
|
|
1025
|
-
n(f ? [...d, h] : d.filter((
|
|
1035
|
+
n(f ? [...d, h] : d.filter(($) => $ !== h));
|
|
1026
1036
|
};
|
|
1027
1037
|
return /* @__PURE__ */ P(ei, { ...u, ref: c, className: ut("container", e), children: [
|
|
1028
1038
|
i && /* @__PURE__ */ s(ti, { className: ut("label", t == null ? void 0 : t.label), $disabled: r, children: i }),
|
|
@@ -1184,8 +1194,8 @@ const jt = {
|
|
|
1184
1194
|
open: b = !0,
|
|
1185
1195
|
ref: h,
|
|
1186
1196
|
submitBindings: f,
|
|
1187
|
-
|
|
1188
|
-
}) => b ? /* @__PURE__ */ P(si, {
|
|
1197
|
+
...$
|
|
1198
|
+
}) => b ? /* @__PURE__ */ P(si, { ...$, ref: h, className: Ae("container", r), $open: b, children: [
|
|
1189
1199
|
/* @__PURE__ */ s(pi, { className: Ae("message", i == null ? void 0 : i.message), children: c }),
|
|
1190
1200
|
/* @__PURE__ */ P(ui, { className: Ae("actions", i == null ? void 0 : i.actions), children: [
|
|
1191
1201
|
/* @__PURE__ */ s(
|
|
@@ -1298,11 +1308,11 @@ const jt = {
|
|
|
1298
1308
|
focus: l(o.red, 30)
|
|
1299
1309
|
}
|
|
1300
1310
|
}, ce = 36, dt = 2, gi = 12, fi = (e, t, r = "en") => {
|
|
1301
|
-
const i = e.getFullYear(), n = e.getMonth(), a = e.getDate(), c = e.getHours(), d = e.getMinutes(), u = e.getSeconds(), b = c % 12 || 12, h = c >= 12, f = new Intl.DateTimeFormat(r, { month: "long" }).format(e),
|
|
1311
|
+
const i = e.getFullYear(), n = e.getMonth(), a = e.getDate(), c = e.getHours(), d = e.getMinutes(), u = e.getSeconds(), b = c % 12 || 12, h = c >= 12, f = new Intl.DateTimeFormat(r, { month: "long" }).format(e), $ = new Intl.DateTimeFormat(r, { month: "short" }).format(e), C = new Intl.DateTimeFormat(r, { weekday: "long" }).format(e), w = new Intl.DateTimeFormat(r, { weekday: "short" }).format(e), v = (T) => T.toString().padStart(2, "0"), y = (T) => T.toString().padStart(2, " "), x = (T) => `\0${T}\0`, m = [
|
|
1302
1312
|
["2006", "YEARFOUR", i.toString()],
|
|
1303
1313
|
["January", "MONTHLONG", f],
|
|
1304
1314
|
["Monday", "WEEKDAYLONG", C],
|
|
1305
|
-
["Jan", "MONTHSHORT",
|
|
1315
|
+
["Jan", "MONTHSHORT", $],
|
|
1306
1316
|
["Mon", "WEEKDAYSHORT", w],
|
|
1307
1317
|
["06", "YEARTWO", i.toString().slice(-2)],
|
|
1308
1318
|
["01", "MONTHPAD", v(n + 1)],
|
|
@@ -1321,13 +1331,13 @@ const jt = {
|
|
|
1321
1331
|
];
|
|
1322
1332
|
let g = t;
|
|
1323
1333
|
for (const [T, N] of m)
|
|
1324
|
-
g = g.split(T).join(
|
|
1334
|
+
g = g.split(T).join(x(N));
|
|
1325
1335
|
for (const [, T, N] of m)
|
|
1326
|
-
g = g.split(
|
|
1336
|
+
g = g.split(x(T)).join(N);
|
|
1327
1337
|
return g;
|
|
1328
|
-
},
|
|
1329
|
-
const i =
|
|
1330
|
-
let a =
|
|
1338
|
+
}, xi = (e, t) => new Date(e, t + 1, 0).getDate(), $i = (e, t) => new Date(e, t, 1).getDay(), yi = (e, t, r = 1) => {
|
|
1339
|
+
const i = xi(e, t);
|
|
1340
|
+
let a = $i(e, t) - r;
|
|
1331
1341
|
a < 0 && (a += 7);
|
|
1332
1342
|
const c = [];
|
|
1333
1343
|
for (let d = 0; d < a; d++)
|
|
@@ -1666,12 +1676,12 @@ const jt = {
|
|
|
1666
1676
|
size: b = "default",
|
|
1667
1677
|
variant: h = "normal",
|
|
1668
1678
|
disabled: f = !1,
|
|
1669
|
-
fullWidth:
|
|
1679
|
+
fullWidth: $ = !1,
|
|
1670
1680
|
label: C,
|
|
1671
1681
|
portalRenderNode: w,
|
|
1672
1682
|
open: v,
|
|
1673
1683
|
onOpen: y,
|
|
1674
|
-
onClose:
|
|
1684
|
+
onClose: x,
|
|
1675
1685
|
className: m,
|
|
1676
1686
|
classnames: g,
|
|
1677
1687
|
ref: T,
|
|
@@ -1697,8 +1707,8 @@ const jt = {
|
|
|
1697
1707
|
const S = e ?? L;
|
|
1698
1708
|
B(S), Y(S.getFullYear() - 6);
|
|
1699
1709
|
}, [f, J, y, r, e, L]), te = M(() => {
|
|
1700
|
-
J || I(!1),
|
|
1701
|
-
}, [J,
|
|
1710
|
+
J || I(!1), x == null || x();
|
|
1711
|
+
}, [J, x]), jo = M(() => {
|
|
1702
1712
|
Q ? te() : Mt();
|
|
1703
1713
|
}, [Q, te, Mt]), Vo = M(
|
|
1704
1714
|
(S) => {
|
|
@@ -1877,7 +1887,7 @@ const jt = {
|
|
|
1877
1887
|
{
|
|
1878
1888
|
...N,
|
|
1879
1889
|
ref: T ?? X,
|
|
1880
|
-
$fullWidth:
|
|
1890
|
+
$fullWidth: $,
|
|
1881
1891
|
className: ee("container", m),
|
|
1882
1892
|
children: [
|
|
1883
1893
|
C && /* @__PURE__ */ s(Ci, { children: C }),
|
|
@@ -2018,7 +2028,7 @@ const jt = {
|
|
|
2018
2028
|
trigger: b,
|
|
2019
2029
|
...h
|
|
2020
2030
|
}) => {
|
|
2021
|
-
const [f,
|
|
2031
|
+
const [f, $] = V(!1), [C, w] = V({ top: 0, left: 0 }), [v, y] = V("bottom"), x = U(null), m = U(null), g = U(null), T = c !== void 0, N = T ? c : f, L = M(() => {
|
|
2022
2032
|
var B, W;
|
|
2023
2033
|
if (!m.current) return;
|
|
2024
2034
|
const O = m.current.getBoundingClientRect(), z = ((B = g.current) == null ? void 0 : B.offsetHeight) ?? Ji, H = ((W = g.current) == null ? void 0 : W.offsetWidth) ?? 160, k = window.innerHeight - O.bottom - Ke, A = O.top - Ke, E = k < z && A > k ? "top" : "bottom";
|
|
@@ -2029,18 +2039,18 @@ const jt = {
|
|
|
2029
2039
|
w({ top: X, left: Y });
|
|
2030
2040
|
}
|
|
2031
2041
|
}, [e, d]), q = M(() => {
|
|
2032
|
-
T ? N ? n == null || n() : a == null || a() :
|
|
2042
|
+
T ? N ? n == null || n() : a == null || a() : $((O) => {
|
|
2033
2043
|
const z = !O;
|
|
2034
2044
|
return z ? a == null || a() : n == null || n(), z;
|
|
2035
2045
|
});
|
|
2036
2046
|
}, [T, N, n, a]), I = M(() => {
|
|
2037
|
-
T ||
|
|
2047
|
+
T || $(!1), n == null || n();
|
|
2038
2048
|
}, [T, n]);
|
|
2039
2049
|
lt(() => {
|
|
2040
2050
|
N && L();
|
|
2041
2051
|
}, [N, L]), je(() => {
|
|
2042
2052
|
const O = (A) => {
|
|
2043
|
-
const E = A.target, B =
|
|
2053
|
+
const E = A.target, B = x.current && !x.current.contains(E), W = g.current && !g.current.contains(E);
|
|
2044
2054
|
d ? B && W && I() : B && I();
|
|
2045
2055
|
}, z = (A) => {
|
|
2046
2056
|
A.key === "Escape" && I();
|
|
@@ -2077,14 +2087,14 @@ const jt = {
|
|
|
2077
2087
|
children: t
|
|
2078
2088
|
}
|
|
2079
2089
|
);
|
|
2080
|
-
return /* @__PURE__ */ P(qi, { ...h, ref: u ??
|
|
2090
|
+
return /* @__PURE__ */ P(qi, { ...h, ref: u ?? x, className: Ze("container", r), children: [
|
|
2081
2091
|
/* @__PURE__ */ s(
|
|
2082
2092
|
Gi,
|
|
2083
2093
|
{
|
|
2084
2094
|
ref: m,
|
|
2085
2095
|
onClick: q,
|
|
2086
2096
|
className: Ze("trigger", i == null ? void 0 : i.trigger),
|
|
2087
|
-
children:
|
|
2097
|
+
children: $r(b)
|
|
2088
2098
|
}
|
|
2089
2099
|
),
|
|
2090
2100
|
F
|
|
@@ -2306,18 +2316,18 @@ const jt = {
|
|
|
2306
2316
|
overflow: hidden;
|
|
2307
2317
|
border-radius: 50%;
|
|
2308
2318
|
}
|
|
2309
|
-
`,
|
|
2319
|
+
`, xn = {
|
|
2310
2320
|
tl: "nw-resize",
|
|
2311
2321
|
tr: "ne-resize",
|
|
2312
2322
|
bl: "sw-resize",
|
|
2313
2323
|
br: "se-resize"
|
|
2314
|
-
},
|
|
2324
|
+
}, $n = {
|
|
2315
2325
|
tl: { h: "left", v: "top" },
|
|
2316
2326
|
tr: { h: "right", v: "top" },
|
|
2317
2327
|
bl: { h: "left", v: "bottom" },
|
|
2318
2328
|
br: { h: "right", v: "bottom" }
|
|
2319
2329
|
}, Je = (e, t) => {
|
|
2320
|
-
const r =
|
|
2330
|
+
const r = xn[t], { h: i, v: n } = $n[t];
|
|
2321
2331
|
return `
|
|
2322
2332
|
.${e} {
|
|
2323
2333
|
display: block;
|
|
@@ -2547,9 +2557,9 @@ const Sn = (e) => {
|
|
|
2547
2557
|
config: { ...Nt.config, ...e },
|
|
2548
2558
|
css: mn(t)
|
|
2549
2559
|
}), Pn = (e, t) => {
|
|
2550
|
-
var
|
|
2560
|
+
var $;
|
|
2551
2561
|
const r = e(), i = document.querySelector(
|
|
2552
|
-
`.${(
|
|
2562
|
+
`.${($ = r.css) == null ? void 0 : $.body[0]}`
|
|
2553
2563
|
);
|
|
2554
2564
|
if (!i)
|
|
2555
2565
|
return r.frame;
|
|
@@ -2666,7 +2676,7 @@ const Tn = (e) => {
|
|
|
2666
2676
|
portalArea: "portalArea",
|
|
2667
2677
|
portal: "portal",
|
|
2668
2678
|
previewImage: "previewImage"
|
|
2669
|
-
},
|
|
2679
|
+
}, $e = (e, t) => {
|
|
2670
2680
|
if (Be.has(e))
|
|
2671
2681
|
return Be.get(e);
|
|
2672
2682
|
if (!t)
|
|
@@ -2680,27 +2690,27 @@ const Tn = (e) => {
|
|
|
2680
2690
|
}, Gn = () => {
|
|
2681
2691
|
Be.clear();
|
|
2682
2692
|
}, Zn = (e, t) => {
|
|
2683
|
-
const r =
|
|
2693
|
+
const r = $e("header", t.css);
|
|
2684
2694
|
r && (r.innerText = e);
|
|
2685
2695
|
}, Kn = (e, t) => {
|
|
2686
|
-
const r =
|
|
2696
|
+
const r = $e("sourceImage", t.css);
|
|
2687
2697
|
r && (r.setAttribute("src", e), r.style.height = `${t.frame.height}px`, r.style.width = `${t.frame.width}px`, r.style.left = `${t.frame.left}px`, r.style.top = `${t.frame.top}px`);
|
|
2688
|
-
const i =
|
|
2698
|
+
const i = $e("portalArea", t.css);
|
|
2689
2699
|
i && (i.style.height = `${t.frame.height}px`, i.style.width = `${t.frame.width}px`, i.style.left = `${t.frame.left}px`, i.style.top = `${t.frame.top}px`);
|
|
2690
|
-
const n =
|
|
2700
|
+
const n = $e("portal", t.css);
|
|
2691
2701
|
n && (n.style.width = `${t.portal.size}px`, n.style.height = `${t.portal.size}px`, n.style.left = `${t.portal.left}px`, n.style.top = `${t.portal.top}px`);
|
|
2692
|
-
const a =
|
|
2702
|
+
const a = $e("previewImage", t.css);
|
|
2693
2703
|
a && (a.setAttribute("src", e), a.style.height = `${t.frame.height}px`, a.style.width = `${t.frame.width}px`, a.style.marginLeft = `-${t.portal.left}px`, a.style.marginTop = `-${t.portal.top}px`);
|
|
2694
2704
|
}, Jn = (e, t) => {
|
|
2695
|
-
const r =
|
|
2705
|
+
const r = $e("portal", t.css);
|
|
2696
2706
|
r && (r.style.left = `${e.left}px`, r.style.top = `${e.top}px`, r.style.width = `${e.size}px`, r.style.height = `${e.size}px`);
|
|
2697
|
-
const i =
|
|
2707
|
+
const i = $e("previewImage", t.css);
|
|
2698
2708
|
i && (i.style.marginLeft = `-${e.left}px`, i.style.marginTop = `-${e.top}px`);
|
|
2699
|
-
},
|
|
2709
|
+
}, xt = 1, Qn = (e) => {
|
|
2700
2710
|
var C, w;
|
|
2701
|
-
const t = e(), r = document.createElement("canvas"), i = t.frame.width ||
|
|
2711
|
+
const t = e(), r = document.createElement("canvas"), i = t.frame.width || xt, n = t.frame.height || xt, a = t.sourceWidth / i, c = t.sourceHeight / n, d = t.portal.left * a, u = t.portal.top * c, b = Math.max(
|
|
2702
2712
|
t.portal.size * Math.min(a, c),
|
|
2703
|
-
|
|
2713
|
+
xt
|
|
2704
2714
|
), h = t.config.outputSize > 0 ? t.config.outputSize : b;
|
|
2705
2715
|
r.width = h, r.height = h;
|
|
2706
2716
|
const f = document.querySelector(
|
|
@@ -2717,15 +2727,15 @@ const Tn = (e) => {
|
|
|
2717
2727
|
h,
|
|
2718
2728
|
h
|
|
2719
2729
|
));
|
|
2720
|
-
const
|
|
2730
|
+
const $ = r.toDataURL(
|
|
2721
2731
|
`image/${t.config.type}`,
|
|
2722
2732
|
t.config.compression
|
|
2723
2733
|
);
|
|
2724
2734
|
return new Promise((v, y) => {
|
|
2725
2735
|
try {
|
|
2726
2736
|
r.toBlob(
|
|
2727
|
-
(
|
|
2728
|
-
if (r.remove(),
|
|
2737
|
+
(x) => {
|
|
2738
|
+
if (r.remove(), !x) {
|
|
2729
2739
|
y(
|
|
2730
2740
|
new Error(
|
|
2731
2741
|
`Failed to create blob for type: image/${t.config.type}`
|
|
@@ -2733,20 +2743,20 @@ const Tn = (e) => {
|
|
|
2733
2743
|
);
|
|
2734
2744
|
return;
|
|
2735
2745
|
}
|
|
2736
|
-
v([x
|
|
2746
|
+
v([$, x]);
|
|
2737
2747
|
},
|
|
2738
2748
|
`image/${t.config.type}`,
|
|
2739
2749
|
t.config.compression
|
|
2740
2750
|
);
|
|
2741
|
-
} catch (
|
|
2742
|
-
r.remove(), y(
|
|
2751
|
+
} catch (x) {
|
|
2752
|
+
r.remove(), y(x);
|
|
2743
2753
|
}
|
|
2744
2754
|
});
|
|
2745
2755
|
}, ea = (e, t, r) => {
|
|
2746
2756
|
const { emitted: i, portal: n, frame: a, config: c } = t();
|
|
2747
2757
|
let d = i.left - i.X + e.clientX, u = i.top - i.Y + e.clientY;
|
|
2748
|
-
const b = c.framePadding, h = a.width - c.framePadding - n.size, f = c.framePadding,
|
|
2749
|
-
d < b && (d = b), d > h && (d = h), u < f && (u = f), u >
|
|
2758
|
+
const b = c.framePadding, h = a.width - c.framePadding - n.size, f = c.framePadding, $ = a.height - c.framePadding - n.size;
|
|
2759
|
+
d < b && (d = b), d > h && (d = h), u < f && (u = f), u > $ && (u = $), r({
|
|
2750
2760
|
portal: {
|
|
2751
2761
|
...n,
|
|
2752
2762
|
left: d,
|
|
@@ -2777,24 +2787,24 @@ const Tn = (e) => {
|
|
|
2777
2787
|
}
|
|
2778
2788
|
case ae.RESIZE_TL: {
|
|
2779
2789
|
const h = Math.min(u, b);
|
|
2780
|
-
let f = n.size - h,
|
|
2790
|
+
let f = n.size - h, $ = n.left + h, C = n.top + h;
|
|
2781
2791
|
if (f < d.minPortalSize) {
|
|
2782
2792
|
const w = n.size - d.minPortalSize;
|
|
2783
|
-
f = d.minPortalSize,
|
|
2793
|
+
f = d.minPortalSize, $ = n.left + w, C = n.top + w;
|
|
2784
2794
|
}
|
|
2785
2795
|
if (C < d.framePadding) {
|
|
2786
2796
|
const w = d.framePadding - C;
|
|
2787
|
-
C = d.framePadding,
|
|
2797
|
+
C = d.framePadding, $ = $ + w, f = f - w;
|
|
2788
2798
|
}
|
|
2789
|
-
if (
|
|
2790
|
-
const w = d.framePadding -
|
|
2791
|
-
|
|
2799
|
+
if ($ < d.framePadding) {
|
|
2800
|
+
const w = d.framePadding - $;
|
|
2801
|
+
$ = d.framePadding, C = C + w, f = f - w;
|
|
2792
2802
|
}
|
|
2793
2803
|
return r({
|
|
2794
2804
|
portal: {
|
|
2795
2805
|
...a,
|
|
2796
2806
|
top: C,
|
|
2797
|
-
left:
|
|
2807
|
+
left: $,
|
|
2798
2808
|
size: f
|
|
2799
2809
|
}
|
|
2800
2810
|
});
|
|
@@ -2839,9 +2849,9 @@ const Tn = (e) => {
|
|
|
2839
2849
|
pageY: t.pageY
|
|
2840
2850
|
};
|
|
2841
2851
|
}, oa = (e, t) => {
|
|
2842
|
-
var
|
|
2852
|
+
var $, C, w;
|
|
2843
2853
|
const r = e(), i = document.querySelector(
|
|
2844
|
-
`.${(
|
|
2854
|
+
`.${($ = r.css) == null ? void 0 : $.portal[0]}`
|
|
2845
2855
|
), n = document.querySelector(
|
|
2846
2856
|
`.${(C = r.css) == null ? void 0 : C.portalArea[0]}`
|
|
2847
2857
|
), a = document.querySelector(
|
|
@@ -2850,11 +2860,11 @@ const Tn = (e) => {
|
|
|
2850
2860
|
let c = null, d = null;
|
|
2851
2861
|
const u = (v) => {
|
|
2852
2862
|
v.preventDefault();
|
|
2853
|
-
const { portal: y } = e(),
|
|
2863
|
+
const { portal: y } = e(), x = oo(v);
|
|
2854
2864
|
if (v.target) {
|
|
2855
2865
|
const m = v.target.getAttribute("data-action"), g = {
|
|
2856
|
-
X:
|
|
2857
|
-
Y:
|
|
2866
|
+
X: x.pageX,
|
|
2867
|
+
Y: x.pageY,
|
|
2858
2868
|
left: y.left,
|
|
2859
2869
|
top: y.top,
|
|
2860
2870
|
size: y.size
|
|
@@ -2909,8 +2919,8 @@ const Tn = (e) => {
|
|
|
2909
2919
|
}
|
|
2910
2920
|
return null;
|
|
2911
2921
|
}, ia = (e, t, r, i, n, a, c) => {
|
|
2912
|
-
const d = (
|
|
2913
|
-
c ? c(
|
|
2922
|
+
const d = (x) => {
|
|
2923
|
+
c ? c(x) : console.error(`HqCropper: ${x}`);
|
|
2914
2924
|
};
|
|
2915
2925
|
if (!e.target.files || e.target.files.length === 0) {
|
|
2916
2926
|
d("Can't read file input");
|
|
@@ -2922,35 +2932,35 @@ const Tn = (e) => {
|
|
|
2922
2932
|
return;
|
|
2923
2933
|
}
|
|
2924
2934
|
const f = new FileReader();
|
|
2925
|
-
let
|
|
2935
|
+
let $ = null;
|
|
2926
2936
|
const C = () => {
|
|
2927
2937
|
var g;
|
|
2928
|
-
const
|
|
2929
|
-
`.${(g =
|
|
2938
|
+
const x = t(), m = document.querySelector(
|
|
2939
|
+
`.${(g = x.css) == null ? void 0 : g.root[0]}`
|
|
2930
2940
|
);
|
|
2931
|
-
m && (m.remove(), document.removeEventListener("keydown", w),
|
|
2932
|
-
}, w = (
|
|
2933
|
-
|
|
2934
|
-
}, v = (
|
|
2935
|
-
|
|
2936
|
-
}, y = (
|
|
2937
|
-
|
|
2941
|
+
m && (m.remove(), document.removeEventListener("keydown", w), $ == null || $(), Gn(), a(), r(Nt));
|
|
2942
|
+
}, w = (x) => {
|
|
2943
|
+
x.key === "Escape" && t().sourceBase64 && v(x);
|
|
2944
|
+
}, v = (x) => {
|
|
2945
|
+
x.preventDefault(), C();
|
|
2946
|
+
}, y = (x) => {
|
|
2947
|
+
x.preventDefault();
|
|
2938
2948
|
const m = t();
|
|
2939
2949
|
Qn(t).then(([g, T]) => {
|
|
2940
|
-
i(g, T, m), v(
|
|
2950
|
+
i(g, T, m), v(x);
|
|
2941
2951
|
}).catch((g) => {
|
|
2942
2952
|
d(
|
|
2943
2953
|
g instanceof Error ? g.message : "Failed to crop image"
|
|
2944
2954
|
);
|
|
2945
2955
|
});
|
|
2946
2956
|
};
|
|
2947
|
-
f.onload = (
|
|
2957
|
+
f.onload = (x) => {
|
|
2948
2958
|
const m = new Image();
|
|
2949
|
-
if (
|
|
2959
|
+
if (!x.target || typeof x.target.result != "string") {
|
|
2950
2960
|
d("Can't load result image");
|
|
2951
2961
|
return;
|
|
2952
2962
|
}
|
|
2953
|
-
m.src =
|
|
2963
|
+
m.src = x.target.result, m.onerror = () => {
|
|
2954
2964
|
d("Failed to load image");
|
|
2955
2965
|
}, m.onload = () => {
|
|
2956
2966
|
var N;
|
|
@@ -2960,10 +2970,10 @@ const Tn = (e) => {
|
|
|
2960
2970
|
frame: g,
|
|
2961
2971
|
portal: T,
|
|
2962
2972
|
fileName: u.name,
|
|
2963
|
-
sourceBase64: (N =
|
|
2973
|
+
sourceBase64: (N = x.target) == null ? void 0 : N.result,
|
|
2964
2974
|
sourceHeight: m.height,
|
|
2965
2975
|
sourceWidth: m.width
|
|
2966
|
-
}),
|
|
2976
|
+
}), $ = oa(t, r), document.addEventListener("keydown", w);
|
|
2967
2977
|
};
|
|
2968
2978
|
}, f.onerror = () => {
|
|
2969
2979
|
d("Failed to read file");
|
|
@@ -3102,7 +3112,7 @@ const Tn = (e) => {
|
|
|
3102
3112
|
b,
|
|
3103
3113
|
h
|
|
3104
3114
|
]) };
|
|
3105
|
-
},
|
|
3115
|
+
}, $t = D("image-cropper"), sd = ({
|
|
3106
3116
|
allowedTypes: e,
|
|
3107
3117
|
applyLabel: t,
|
|
3108
3118
|
buttonLabel: r = "Select Image",
|
|
@@ -3115,13 +3125,13 @@ const Tn = (e) => {
|
|
|
3115
3125
|
onError: b,
|
|
3116
3126
|
outputSize: h,
|
|
3117
3127
|
portalSize: f,
|
|
3118
|
-
previewSize:
|
|
3128
|
+
previewSize: $ = 120,
|
|
3119
3129
|
ref: C,
|
|
3120
3130
|
type: w,
|
|
3121
3131
|
value: v,
|
|
3122
3132
|
...y
|
|
3123
3133
|
}) => {
|
|
3124
|
-
const [
|
|
3134
|
+
const [x, m] = V(v ?? null), { open: g } = ca({
|
|
3125
3135
|
allowedTypes: e,
|
|
3126
3136
|
applyLabel: t,
|
|
3127
3137
|
cancelLabel: i,
|
|
@@ -3135,15 +3145,15 @@ const Tn = (e) => {
|
|
|
3135
3145
|
portalSize: f,
|
|
3136
3146
|
type: w
|
|
3137
3147
|
});
|
|
3138
|
-
return /* @__PURE__ */ P(on, { ...y, ref: C, className:
|
|
3139
|
-
/* @__PURE__ */ s(rn, { $size:
|
|
3148
|
+
return /* @__PURE__ */ P(on, { ...y, ref: C, className: $t("container", n), children: [
|
|
3149
|
+
/* @__PURE__ */ s(rn, { $size: $, className: $t("preview", a == null ? void 0 : a.preview), children: x ? /* @__PURE__ */ s("img", { src: x, alt: "Preview" }) : /* @__PURE__ */ s(nn, { children: "No image" }) }),
|
|
3140
3150
|
/* @__PURE__ */ s(
|
|
3141
3151
|
nt,
|
|
3142
3152
|
{
|
|
3143
3153
|
variant: "system",
|
|
3144
3154
|
onClick: g,
|
|
3145
|
-
className:
|
|
3146
|
-
style: { width:
|
|
3155
|
+
className: $t("button", a == null ? void 0 : a.button),
|
|
3156
|
+
style: { width: $ },
|
|
3147
3157
|
children: r
|
|
3148
3158
|
}
|
|
3149
3159
|
)
|
|
@@ -3313,11 +3323,11 @@ const Tn = (e) => {
|
|
|
3313
3323
|
border: o.red,
|
|
3314
3324
|
label: o.red
|
|
3315
3325
|
}
|
|
3316
|
-
},
|
|
3326
|
+
}, xa = p.div`
|
|
3317
3327
|
display: flex;
|
|
3318
3328
|
flex-direction: column;
|
|
3319
3329
|
gap: 4px;
|
|
3320
|
-
`,
|
|
3330
|
+
`, $a = p(Pe)`
|
|
3321
3331
|
margin-left: 6px;
|
|
3322
3332
|
color: ${(e) => Lo[e.$variant].label};
|
|
3323
3333
|
`, ya = p.button`
|
|
@@ -3405,25 +3415,25 @@ const Tn = (e) => {
|
|
|
3405
3415
|
placeholder: b = "Select...",
|
|
3406
3416
|
ref: h,
|
|
3407
3417
|
searchPlaceholder: f = "Search...",
|
|
3408
|
-
value:
|
|
3418
|
+
value: $,
|
|
3409
3419
|
variant: C = "normal",
|
|
3410
3420
|
...w
|
|
3411
3421
|
}) => {
|
|
3412
|
-
const [v, y] = V(!1), [
|
|
3413
|
-
if (
|
|
3414
|
-
const z =
|
|
3422
|
+
const [v, y] = V(!1), [x, m] = V(""), g = re(() => u.filter((z) => $.includes(z.value)), [u, $]), T = re(() => {
|
|
3423
|
+
if (!x.trim()) return u;
|
|
3424
|
+
const z = x.toLowerCase().trim();
|
|
3415
3425
|
return u.filter((H) => H.label.toLowerCase().includes(z));
|
|
3416
|
-
}, [u,
|
|
3426
|
+
}, [u, x]), N = a === 1 / 0 ? g : g.slice(0, a), L = g.length - N.length, q = () => {
|
|
3417
3427
|
r || (y(!0), m(""));
|
|
3418
3428
|
}, I = () => {
|
|
3419
3429
|
y(!1), m("");
|
|
3420
3430
|
}, F = (z) => {
|
|
3421
|
-
|
|
3431
|
+
$.includes(z) ? d($.filter((H) => H !== z)) : d([...$, z]);
|
|
3422
3432
|
}, O = (z) => {
|
|
3423
|
-
d(
|
|
3433
|
+
d($.filter((H) => H !== z));
|
|
3424
3434
|
};
|
|
3425
|
-
return /* @__PURE__ */ P(
|
|
3426
|
-
n && /* @__PURE__ */ s(
|
|
3435
|
+
return /* @__PURE__ */ P(xa, { ...w, ref: h, className: ie("container", e), children: [
|
|
3436
|
+
n && /* @__PURE__ */ s($a, { $variant: C, className: ie("label", t == null ? void 0 : t.trigger), children: n }),
|
|
3427
3437
|
/* @__PURE__ */ s(
|
|
3428
3438
|
ya,
|
|
3429
3439
|
{
|
|
@@ -3469,7 +3479,7 @@ const Tn = (e) => {
|
|
|
3469
3479
|
ha,
|
|
3470
3480
|
{
|
|
3471
3481
|
type: "text",
|
|
3472
|
-
value:
|
|
3482
|
+
value: x,
|
|
3473
3483
|
onChange: (z) => m(z.target.value),
|
|
3474
3484
|
placeholder: f,
|
|
3475
3485
|
autoFocus: !0,
|
|
@@ -3486,7 +3496,7 @@ const Tn = (e) => {
|
|
|
3486
3496
|
/* @__PURE__ */ s(
|
|
3487
3497
|
Ot,
|
|
3488
3498
|
{
|
|
3489
|
-
checked:
|
|
3499
|
+
checked: $.includes(z.value),
|
|
3490
3500
|
disabled: z.disabled,
|
|
3491
3501
|
onChange: () => F(z.value)
|
|
3492
3502
|
}
|
|
@@ -3595,65 +3605,65 @@ const Tn = (e) => {
|
|
|
3595
3605
|
variant: b = "normal",
|
|
3596
3606
|
...h
|
|
3597
3607
|
}) => {
|
|
3598
|
-
const f = U([]),
|
|
3599
|
-
const
|
|
3600
|
-
|
|
3608
|
+
const f = U([]), $ = M((y) => {
|
|
3609
|
+
const x = f.current[y];
|
|
3610
|
+
x && (x.focus(), x.select());
|
|
3601
3611
|
}, []), C = M(
|
|
3602
|
-
(y,
|
|
3603
|
-
const g =
|
|
3612
|
+
(y, x) => {
|
|
3613
|
+
const g = x.target.value.replace(/\D/g, "").slice(-1);
|
|
3604
3614
|
if (!g) return;
|
|
3605
3615
|
const T = u.padEnd(n, " ").split(""), N = T.findIndex((F) => F === " " || F === ""), L = N !== -1 ? N : y;
|
|
3606
3616
|
T[L] = g;
|
|
3607
3617
|
const q = T.join("").replace(/ /g, "");
|
|
3608
3618
|
a == null || a(q);
|
|
3609
3619
|
const I = L + 1;
|
|
3610
|
-
I < n &&
|
|
3620
|
+
I < n && $(I);
|
|
3611
3621
|
},
|
|
3612
|
-
[u, n, a,
|
|
3622
|
+
[u, n, a, $]
|
|
3613
3623
|
), w = M(
|
|
3614
|
-
(y,
|
|
3615
|
-
if (
|
|
3616
|
-
|
|
3624
|
+
(y, x) => {
|
|
3625
|
+
if (x.key === "Backspace") {
|
|
3626
|
+
x.preventDefault();
|
|
3617
3627
|
const m = u.split("");
|
|
3618
|
-
m[y] ? (m[y] = "", a == null || a(m.join(""))) : y > 0 && (m[y - 1] = "", a == null || a(m.join("")),
|
|
3619
|
-
} else
|
|
3628
|
+
m[y] ? (m[y] = "", a == null || a(m.join(""))) : y > 0 && (m[y - 1] = "", a == null || a(m.join("")), $(y - 1));
|
|
3629
|
+
} else x.key === "ArrowLeft" && y > 0 ? (x.preventDefault(), $(y - 1)) : x.key === "ArrowRight" && y < n - 1 && (x.preventDefault(), $(y + 1));
|
|
3620
3630
|
},
|
|
3621
|
-
[u, n, a,
|
|
3631
|
+
[u, n, a, $]
|
|
3622
3632
|
), v = M(
|
|
3623
3633
|
(y) => {
|
|
3624
3634
|
y.preventDefault();
|
|
3625
|
-
const
|
|
3626
|
-
if (
|
|
3627
|
-
a == null || a(
|
|
3628
|
-
const m = Math.min(
|
|
3629
|
-
|
|
3635
|
+
const x = y.clipboardData.getData("text").replace(/\D/g, "").slice(0, n);
|
|
3636
|
+
if (x) {
|
|
3637
|
+
a == null || a(x);
|
|
3638
|
+
const m = Math.min(x.length, n - 1);
|
|
3639
|
+
$(m);
|
|
3630
3640
|
}
|
|
3631
3641
|
},
|
|
3632
|
-
[n, a,
|
|
3642
|
+
[n, a, $]
|
|
3633
3643
|
);
|
|
3634
3644
|
return /* @__PURE__ */ P(Ca, { ref: c, className: wt("container", e), ...h, children: [
|
|
3635
3645
|
i && /* @__PURE__ */ s(Ta, { variant: b, className: wt("label", t == null ? void 0 : t.label), children: i }),
|
|
3636
|
-
/* @__PURE__ */ s(Ra, { $size: d, children: Array.from({ length: n }).map((y,
|
|
3646
|
+
/* @__PURE__ */ s(Ra, { $size: d, children: Array.from({ length: n }).map((y, x) => /* @__PURE__ */ s(
|
|
3637
3647
|
Ia,
|
|
3638
3648
|
{
|
|
3639
3649
|
ref: (m) => {
|
|
3640
|
-
f.current[
|
|
3650
|
+
f.current[x] = m;
|
|
3641
3651
|
},
|
|
3642
3652
|
type: "text",
|
|
3643
3653
|
inputMode: "numeric",
|
|
3644
3654
|
autoComplete: "one-time-code",
|
|
3645
3655
|
maxLength: 2,
|
|
3646
3656
|
disabled: r,
|
|
3647
|
-
value: u[
|
|
3648
|
-
onChange: (m) => C(
|
|
3649
|
-
onKeyDown: (m) => w(
|
|
3657
|
+
value: u[x] ?? "",
|
|
3658
|
+
onChange: (m) => C(x, m),
|
|
3659
|
+
onKeyDown: (m) => w(x, m),
|
|
3650
3660
|
onPaste: v,
|
|
3651
3661
|
onFocus: (m) => m.target.select(),
|
|
3652
3662
|
$size: d,
|
|
3653
3663
|
$variant: b,
|
|
3654
3664
|
className: wt("input", t == null ? void 0 : t.input)
|
|
3655
3665
|
},
|
|
3656
|
-
|
|
3666
|
+
x
|
|
3657
3667
|
)) })
|
|
3658
3668
|
] });
|
|
3659
3669
|
}, po = {
|
|
@@ -3785,7 +3795,7 @@ const Tn = (e) => {
|
|
|
3785
3795
|
}
|
|
3786
3796
|
}, ye = (e) => ho[e] ?? ho.normal, Fa = p.label`
|
|
3787
3797
|
display: inline-flex;
|
|
3788
|
-
align-items:
|
|
3798
|
+
align-items: flex-start;
|
|
3789
3799
|
gap: 8px;
|
|
3790
3800
|
cursor: ${(e) => e.$disabled ? "not-allowed" : "pointer"};
|
|
3791
3801
|
opacity: ${(e) => e.$disabled ? 0.5 : 1};
|
|
@@ -3830,6 +3840,16 @@ const Tn = (e) => {
|
|
|
3830
3840
|
line-height: 1.5;
|
|
3831
3841
|
color: ${(e) => ye(e.$variant).label};
|
|
3832
3842
|
user-select: none;
|
|
3843
|
+
|
|
3844
|
+
a {
|
|
3845
|
+
color: inherit;
|
|
3846
|
+
text-decoration: underline;
|
|
3847
|
+
cursor: pointer;
|
|
3848
|
+
|
|
3849
|
+
&:hover {
|
|
3850
|
+
text-decoration: none;
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3833
3853
|
`, Oe = D("radio"), Ao = ({
|
|
3834
3854
|
checked: e,
|
|
3835
3855
|
className: t,
|
|
@@ -4107,7 +4127,7 @@ const Tn = (e) => {
|
|
|
4107
4127
|
padding: "0 14px",
|
|
4108
4128
|
radius: "16px"
|
|
4109
4129
|
}
|
|
4110
|
-
},
|
|
4130
|
+
}, xo = {
|
|
4111
4131
|
normal: {
|
|
4112
4132
|
background: {
|
|
4113
4133
|
static: l(o.black, 2),
|
|
@@ -4140,7 +4160,7 @@ const Tn = (e) => {
|
|
|
4140
4160
|
placeholder: l(o.red, 40),
|
|
4141
4161
|
focus: l(o.red, 30)
|
|
4142
4162
|
}
|
|
4143
|
-
}, St = (e) => fo[e] ?? fo.default, pe = (e) =>
|
|
4163
|
+
}, St = (e) => fo[e] ?? fo.default, pe = (e) => xo[e] ?? xo.normal, Ja = p.div`
|
|
4144
4164
|
position: relative;
|
|
4145
4165
|
display: grid;
|
|
4146
4166
|
gap: 2px;
|
|
@@ -4231,7 +4251,7 @@ const Tn = (e) => {
|
|
|
4231
4251
|
justify-content: center;
|
|
4232
4252
|
flex-shrink: 0;
|
|
4233
4253
|
color: ${o.black};
|
|
4234
|
-
`, ze = D("select"),
|
|
4254
|
+
`, ze = D("select"), xd = ({
|
|
4235
4255
|
className: e,
|
|
4236
4256
|
classnames: t,
|
|
4237
4257
|
disabled: r = !1,
|
|
@@ -4244,10 +4264,10 @@ const Tn = (e) => {
|
|
|
4244
4264
|
ref: b,
|
|
4245
4265
|
size: h = "default",
|
|
4246
4266
|
value: f,
|
|
4247
|
-
variant:
|
|
4267
|
+
variant: $ = "normal",
|
|
4248
4268
|
...C
|
|
4249
4269
|
}) => {
|
|
4250
|
-
const [w, v] = V(!1), [y,
|
|
4270
|
+
const [w, v] = V(!1), [y, x] = V({
|
|
4251
4271
|
top: 0,
|
|
4252
4272
|
left: 0,
|
|
4253
4273
|
width: 0
|
|
@@ -4259,7 +4279,7 @@ const Tn = (e) => {
|
|
|
4259
4279
|
const k = g.current.getBoundingClientRect(), A = L * kt + _e;
|
|
4260
4280
|
let E = k.top - A;
|
|
4261
4281
|
const B = c.length * kt + _e * 2, W = 8, Y = window.innerHeight - B - 8;
|
|
4262
|
-
E < W && (E = W), E > Y && (E = Y),
|
|
4282
|
+
E < W && (E = W), E > Y && (E = Y), x({
|
|
4263
4283
|
top: E,
|
|
4264
4284
|
left: k.left - _e,
|
|
4265
4285
|
width: k.width + _e * 2
|
|
@@ -4346,7 +4366,7 @@ const Tn = (e) => {
|
|
|
4346
4366
|
ref: g,
|
|
4347
4367
|
type: "button",
|
|
4348
4368
|
$size: h,
|
|
4349
|
-
$variant:
|
|
4369
|
+
$variant: $,
|
|
4350
4370
|
$disabled: r,
|
|
4351
4371
|
$hasValue: !!N,
|
|
4352
4372
|
disabled: r,
|
|
@@ -4365,7 +4385,7 @@ const Tn = (e) => {
|
|
|
4365
4385
|
]
|
|
4366
4386
|
}
|
|
4367
4387
|
);
|
|
4368
|
-
},
|
|
4388
|
+
}, $o = {
|
|
4369
4389
|
xs: { size: "16px", borderWidth: "2px" },
|
|
4370
4390
|
sm: { size: "20px", borderWidth: "2px" },
|
|
4371
4391
|
md: { size: "32px", borderWidth: "3px" },
|
|
@@ -4373,7 +4393,7 @@ const Tn = (e) => {
|
|
|
4373
4393
|
}, yo = {
|
|
4374
4394
|
track: l(o.black, 15),
|
|
4375
4395
|
indicator: o.black
|
|
4376
|
-
}, zt = (e) =>
|
|
4396
|
+
}, zt = (e) => $o[e] ?? $o.md, ll = He`
|
|
4377
4397
|
0% {
|
|
4378
4398
|
transform: rotate(0deg);
|
|
4379
4399
|
}
|
|
@@ -4388,7 +4408,7 @@ const Tn = (e) => {
|
|
|
4388
4408
|
border-top-color: ${yo.indicator};
|
|
4389
4409
|
border-radius: 50%;
|
|
4390
4410
|
animation: ${ll} 0.8s linear infinite;
|
|
4391
|
-
`, cl = D("spinner"),
|
|
4411
|
+
`, cl = D("spinner"), $d = ({
|
|
4392
4412
|
"aria-label": e = "Loading",
|
|
4393
4413
|
className: t,
|
|
4394
4414
|
ref: r,
|
|
@@ -4479,11 +4499,11 @@ const Tn = (e) => {
|
|
|
4479
4499
|
d && /* @__PURE__ */ s(fl, { className: tt("trend", r == null ? void 0 : r.trend), $variant: u, children: d })
|
|
4480
4500
|
]
|
|
4481
4501
|
}
|
|
4482
|
-
),
|
|
4502
|
+
), xl = p.div`
|
|
4483
4503
|
display: flex;
|
|
4484
4504
|
align-items: ${(e) => e.$orientation === "vertical" ? "flex-start" : "center"};
|
|
4485
4505
|
flex-direction: ${(e) => e.$orientation === "vertical" ? "column" : "row"};
|
|
4486
|
-
`,
|
|
4506
|
+
`, $l = p.div`
|
|
4487
4507
|
display: flex;
|
|
4488
4508
|
align-items: ${(e) => e.$orientation === "vertical" ? "flex-start" : "center"};
|
|
4489
4509
|
flex-direction: ${(e) => e.$orientation === "vertical" ? "column" : "row"};
|
|
@@ -4566,21 +4586,21 @@ const Tn = (e) => {
|
|
|
4566
4586
|
}) => {
|
|
4567
4587
|
const u = re(() => a.findIndex((b) => b.value === c), [a, c]);
|
|
4568
4588
|
return /* @__PURE__ */ s(
|
|
4569
|
-
|
|
4589
|
+
xl,
|
|
4570
4590
|
{
|
|
4571
4591
|
...d,
|
|
4572
4592
|
ref: n,
|
|
4573
4593
|
$orientation: i,
|
|
4574
4594
|
className: Me("container", e),
|
|
4575
4595
|
children: a.map((b, h) => {
|
|
4576
|
-
const f = b.value === c,
|
|
4577
|
-
return /* @__PURE__ */ P(
|
|
4596
|
+
const f = b.value === c, $ = h < u, C = h === a.length - 1;
|
|
4597
|
+
return /* @__PURE__ */ P($l, { $orientation: i, children: [
|
|
4578
4598
|
/* @__PURE__ */ P(
|
|
4579
4599
|
yl,
|
|
4580
4600
|
{
|
|
4581
4601
|
type: "button",
|
|
4582
4602
|
$active: f,
|
|
4583
|
-
$completed:
|
|
4603
|
+
$completed: $,
|
|
4584
4604
|
$clickable: !!r,
|
|
4585
4605
|
onClick: () => r == null ? void 0 : r(b.value),
|
|
4586
4606
|
className: Me("step", t == null ? void 0 : t.step),
|
|
@@ -4589,7 +4609,7 @@ const Tn = (e) => {
|
|
|
4589
4609
|
vl,
|
|
4590
4610
|
{
|
|
4591
4611
|
$active: f,
|
|
4592
|
-
$completed:
|
|
4612
|
+
$completed: $,
|
|
4593
4613
|
className: Me("circle", t == null ? void 0 : t.circle),
|
|
4594
4614
|
children: h + 1
|
|
4595
4615
|
}
|
|
@@ -4598,7 +4618,7 @@ const Tn = (e) => {
|
|
|
4598
4618
|
wl,
|
|
4599
4619
|
{
|
|
4600
4620
|
$active: f,
|
|
4601
|
-
$completed:
|
|
4621
|
+
$completed: $,
|
|
4602
4622
|
className: Me("label", t == null ? void 0 : t.label),
|
|
4603
4623
|
children: b.label
|
|
4604
4624
|
}
|
|
@@ -4609,7 +4629,7 @@ const Tn = (e) => {
|
|
|
4609
4629
|
!C && /* @__PURE__ */ s(
|
|
4610
4630
|
ml,
|
|
4611
4631
|
{
|
|
4612
|
-
$completed:
|
|
4632
|
+
$completed: $,
|
|
4613
4633
|
$orientation: i,
|
|
4614
4634
|
className: Me("line", t == null ? void 0 : t.line)
|
|
4615
4635
|
}
|
|
@@ -4752,23 +4772,23 @@ const Tn = (e) => {
|
|
|
4752
4772
|
placeholder: b = "Add tag...",
|
|
4753
4773
|
portalRenderNode: h,
|
|
4754
4774
|
ref: f,
|
|
4755
|
-
value:
|
|
4775
|
+
value: $,
|
|
4756
4776
|
variant: C = "normal",
|
|
4757
4777
|
...w
|
|
4758
4778
|
}) => {
|
|
4759
|
-
const v = U(null), y = U(null),
|
|
4779
|
+
const v = U(null), y = U(null), x = U(null), m = U(null), [g, T] = V(""), [N, L] = V(!1), [q, I] = V("bottom"), [F, O] = V({
|
|
4760
4780
|
top: 0,
|
|
4761
4781
|
left: 0,
|
|
4762
4782
|
width: 0
|
|
4763
4783
|
}), z = re(() => {
|
|
4764
|
-
const R = u.filter((J) =>
|
|
4784
|
+
const R = u.filter((J) => !$.includes(J.value));
|
|
4765
4785
|
if (!g.trim()) return R;
|
|
4766
4786
|
const _ = g.toLowerCase().trim();
|
|
4767
4787
|
return R.filter((J) => J.label.toLowerCase().includes(_));
|
|
4768
|
-
}, [u,
|
|
4788
|
+
}, [u, $, g]), H = N && u.length > 0, k = M(() => {
|
|
4769
4789
|
var Ve;
|
|
4770
4790
|
if (!y.current) return;
|
|
4771
|
-
const R = y.current.getBoundingClientRect(), _ = ((Ve =
|
|
4791
|
+
const R = y.current.getBoundingClientRect(), _ = ((Ve = x.current) == null ? void 0 : Ve.offsetHeight) ?? 200, J = window.innerHeight - R.bottom - ot, Q = R.top - ot, we = J < _ && Q > J ? "top" : "bottom";
|
|
4772
4792
|
if (I(we), h) {
|
|
4773
4793
|
const ct = we === "bottom" ? R.bottom + ot : R.top - _ - ot;
|
|
4774
4794
|
O({
|
|
@@ -4787,9 +4807,9 @@ const Tn = (e) => {
|
|
|
4787
4807
|
const A = M(
|
|
4788
4808
|
(R) => {
|
|
4789
4809
|
const _ = R.trim();
|
|
4790
|
-
return !_ ||
|
|
4810
|
+
return !_ || $.includes(_) ? !1 : (d([...$, _]), T(""), !0);
|
|
4791
4811
|
},
|
|
4792
|
-
[
|
|
4812
|
+
[$, d]
|
|
4793
4813
|
), E = (R) => {
|
|
4794
4814
|
if (R.key === r && g.trim())
|
|
4795
4815
|
if (R.preventDefault(), a)
|
|
@@ -4800,12 +4820,12 @@ const Tn = (e) => {
|
|
|
4800
4820
|
);
|
|
4801
4821
|
_ && A(_.value);
|
|
4802
4822
|
}
|
|
4803
|
-
else R.key === "Backspace" && !g &&
|
|
4823
|
+
else R.key === "Backspace" && !g && $.length > 0 && d($.slice(0, -1));
|
|
4804
4824
|
}, B = (R) => {
|
|
4805
4825
|
var _;
|
|
4806
4826
|
A(R), (_ = m.current) == null || _.focus();
|
|
4807
4827
|
}, W = (R) => {
|
|
4808
|
-
d(
|
|
4828
|
+
d($.filter((_) => _ !== R));
|
|
4809
4829
|
}, Y = () => {
|
|
4810
4830
|
var R;
|
|
4811
4831
|
i || (R = m.current) == null || R.focus();
|
|
@@ -4826,7 +4846,7 @@ const Tn = (e) => {
|
|
|
4826
4846
|
onClick: Y,
|
|
4827
4847
|
className: ne("trigger", t == null ? void 0 : t.trigger),
|
|
4828
4848
|
children: [
|
|
4829
|
-
|
|
4849
|
+
$.map((R) => /* @__PURE__ */ s(
|
|
4830
4850
|
It,
|
|
4831
4851
|
{
|
|
4832
4852
|
deletable: !i,
|
|
@@ -4846,7 +4866,7 @@ const Tn = (e) => {
|
|
|
4846
4866
|
onFocus: () => L(!0),
|
|
4847
4867
|
onBlur: () => setTimeout(() => L(!1), 150),
|
|
4848
4868
|
onKeyDown: E,
|
|
4849
|
-
placeholder:
|
|
4869
|
+
placeholder: $.length === 0 ? b : "",
|
|
4850
4870
|
disabled: i,
|
|
4851
4871
|
$disabled: i,
|
|
4852
4872
|
className: ne("input", t == null ? void 0 : t.input)
|
|
@@ -4859,7 +4879,7 @@ const Tn = (e) => {
|
|
|
4859
4879
|
/* @__PURE__ */ s(
|
|
4860
4880
|
Cl,
|
|
4861
4881
|
{
|
|
4862
|
-
ref:
|
|
4882
|
+
ref: x,
|
|
4863
4883
|
$open: H,
|
|
4864
4884
|
$position: q,
|
|
4865
4885
|
style: {
|
|
@@ -4885,7 +4905,7 @@ const Tn = (e) => {
|
|
|
4885
4905
|
) : /* @__PURE__ */ s(
|
|
4886
4906
|
El,
|
|
4887
4907
|
{
|
|
4888
|
-
ref:
|
|
4908
|
+
ref: x,
|
|
4889
4909
|
$open: H,
|
|
4890
4910
|
$position: q,
|
|
4891
4911
|
className: ne("dropdown", t == null ? void 0 : t.dropdown),
|
|
@@ -5346,7 +5366,7 @@ const Tn = (e) => {
|
|
|
5346
5366
|
variant: u = "dark",
|
|
5347
5367
|
...b
|
|
5348
5368
|
}) => {
|
|
5349
|
-
const [h, f] = V(!1), [
|
|
5369
|
+
const [h, f] = V(!1), [$, C] = V(null), [w, v] = V(a), [y, x] = V({ top: 0, left: 0 }), m = U(null), g = U(null), T = M(() => {
|
|
5350
5370
|
var B, W;
|
|
5351
5371
|
if (!m.current) return;
|
|
5352
5372
|
const I = m.current.getBoundingClientRect(), F = ((B = g.current) == null ? void 0 : B.offsetWidth) ?? 100, O = ((W = g.current) == null ? void 0 : W.offsetHeight) ?? 30, z = I.top - ue, H = window.innerHeight - I.bottom - ue, k = I.left - ue, A = window.innerWidth - I.right - ue;
|
|
@@ -5370,7 +5390,7 @@ const Tn = (e) => {
|
|
|
5370
5390
|
Y = 0, X = 0;
|
|
5371
5391
|
}
|
|
5372
5392
|
const R = 8;
|
|
5373
|
-
X = Math.max(R, Math.min(X, window.innerWidth - F - R)), Y = Math.max(R, Math.min(Y, window.innerHeight - O - R)),
|
|
5393
|
+
X = Math.max(R, Math.min(X, window.innerWidth - F - R)), Y = Math.max(R, Math.min(Y, window.innerHeight - O - R)), x({ top: Y, left: X });
|
|
5374
5394
|
}
|
|
5375
5395
|
}, [a, c]);
|
|
5376
5396
|
lt(() => {
|
|
@@ -5382,7 +5402,7 @@ const Tn = (e) => {
|
|
|
5382
5402
|
}, n);
|
|
5383
5403
|
C(I);
|
|
5384
5404
|
}, L = () => {
|
|
5385
|
-
|
|
5405
|
+
$ && (clearTimeout($), C(null)), f(!1);
|
|
5386
5406
|
}, q = c ? ve(
|
|
5387
5407
|
/* @__PURE__ */ s(
|
|
5388
5408
|
Ul,
|
|
@@ -5452,8 +5472,8 @@ export {
|
|
|
5452
5472
|
Ao as Radio,
|
|
5453
5473
|
gd as RadioCard,
|
|
5454
5474
|
fd as RadioGroup,
|
|
5455
|
-
|
|
5456
|
-
|
|
5475
|
+
xd as Select,
|
|
5476
|
+
$d as Spinner,
|
|
5457
5477
|
yd as StatusCard,
|
|
5458
5478
|
vd as Stepper,
|
|
5459
5479
|
md as Tabs,
|