@solibo/solibo-ui 2.2.13 → 2.2.14
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/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index46.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index48.css +1 -1
- package/dist/assets/index49.css +1 -1
- package/dist/assets/index50.css +1 -1
- package/dist/assets/index51.css +1 -1
- package/dist/assets/index52.css +1 -1
- package/dist/assets/index53.css +1 -1
- package/dist/assets/index54.css +1 -1
- package/dist/assets/index55.css +1 -1
- package/dist/assets/index56.css +1 -1
- package/dist/assets/index57.css +1 -1
- package/dist/assets/index58.css +1 -1
- package/dist/assets/index59.css +1 -0
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index60.css +1 -0
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.js +9 -9
- package/dist/components/app-shell/index.cjs +1 -1
- package/dist/components/app-shell/index.js +1 -1
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.js +1 -1
- package/dist/components/avatar/index.cjs +1 -1
- package/dist/components/avatar/index.js +38 -39
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.js +1 -1
- package/dist/components/branding/index.cjs +1 -1
- package/dist/components/branding/index.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +49 -49
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +23 -17
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/clipboard/index.cjs +1 -1
- package/dist/components/clipboard/index.js +1 -1
- package/dist/components/collapsible/index.cjs +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/comment/index.cjs +1 -1
- package/dist/components/comment/index.js +1 -1
- package/dist/components/comments/index.cjs +1 -1
- package/dist/components/comments/index.js +2 -2
- package/dist/components/controls/index.cjs +1 -1
- package/dist/components/controls/index.js +1 -1
- package/dist/components/croppable/index.cjs +1 -1
- package/dist/components/croppable/index.js +152 -152
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/divider/index.cjs +1 -1
- package/dist/components/divider/index.js +1 -1
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +3 -3
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +1 -1
- package/dist/components/editor/index.cjs +1 -1
- package/dist/components/editor/index.js +237 -234
- package/dist/components/empty-state/index.cjs +1 -1
- package/dist/components/empty-state/index.js +1 -1
- package/dist/components/fieldset/index.cjs +1 -1
- package/dist/components/fieldset/index.js +1 -1
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +1 -1
- package/dist/components/file/index.cjs +1 -1
- package/dist/components/file/index.js +1 -1
- package/dist/components/footer/index.cjs +1 -1
- package/dist/components/footer/index.js +1 -1
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +21 -12
- package/dist/components/graph/index.cjs +1 -1
- package/dist/components/graph/index.js +1 -1
- package/dist/components/group/index.cjs +1 -1
- package/dist/components/group/index.js +1 -1
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.js +1 -1
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/iframe/index.cjs +1 -1
- package/dist/components/iframe/index.js +2 -2
- package/dist/components/image/index.cjs +1 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +4 -2
- package/dist/components/label/index.cjs +1 -0
- package/dist/components/label/index.js +18 -0
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +1 -1
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +1 -1
- package/dist/components/message/index.cjs +1 -1
- package/dist/components/message/index.js +2 -2
- package/dist/components/messages/index.cjs +1 -1
- package/dist/components/messages/index.js +2 -2
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +1 -1
- package/dist/components/object/index.cjs +1 -1
- package/dist/components/object/index.js +1 -1
- package/dist/components/page-layout/index.cjs +1 -1
- package/dist/components/page-layout/index.js +1 -1
- package/dist/components/panel/index.cjs +1 -1
- package/dist/components/panel/index.js +1 -1
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/portal/index.cjs +1 -1
- package/dist/components/portal/index.js +1 -1
- package/dist/components/radio/index.cjs +1 -0
- package/dist/components/radio/index.js +35 -0
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +2 -2
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +3 -2
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.js +30 -29
- package/dist/components/toggle/index.cjs +1 -1
- package/dist/components/toggle/index.js +16 -16
- package/dist/components/toolbar/index.cjs +1 -1
- package/dist/components/toolbar/index.js +8 -9
- package/dist/components/tooltip/index.cjs +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/{index-DqZSdMHT.cjs → index-B4dFheLl.cjs} +1 -1
- package/dist/{index-KGoXYG8u.js → index-BJiUk1q2.js} +2 -2
- package/dist/index-BQoXmNo3.cjs +1 -0
- package/dist/index-Bre56YYa.js +90 -0
- package/dist/{index-Bl5EEYDv.cjs → index-BwfsmdF6.cjs} +1 -1
- package/dist/index-CHJNMNDr.cjs +1 -0
- package/dist/index-GPsHvb4d.js +74 -0
- package/dist/{index-DQuc_Zkg.js → index-acMNM3VJ.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +30 -7
- package/dist/index.js +74 -70
- package/dist/tokens.css +79 -38
- package/dist/tokens.json +627 -257
- package/package.json +1 -1
- package/dist/index-FSKjg3Z8.js +0 -82
- package/dist/index-HVXauXrX.js +0 -73
- package/dist/index-S1XsOUKE.cjs +0 -1
- package/dist/index-riaH5c_S.cjs +0 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { jsxs as q, jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import xt from "classix";
|
|
3
|
-
import { useRef as _, useState as
|
|
3
|
+
import { useRef as _, useState as I, useEffect as L } from "react";
|
|
4
4
|
import { Toolbar as rr } from "../toolbar/index.js";
|
|
5
5
|
import { Button as it } from "../button/index.js";
|
|
6
|
-
import { Figure as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import '../../assets/
|
|
9
|
-
const
|
|
6
|
+
import { Figure as er } from "../figure/index.js";
|
|
7
|
+
import { Icon as nr } from "../icon/index.js";
|
|
8
|
+
import '../../assets/index38.css';const v = 10, F = 0.1, or = 0.92, y = (c, u, z) => Math.min(z, Math.max(u, c)), cr = (c) => new Promise((u, z) => {
|
|
9
|
+
const l = URL.createObjectURL(c), d = new globalThis.Image();
|
|
10
10
|
d.onload = () => {
|
|
11
|
-
URL.revokeObjectURL(
|
|
11
|
+
URL.revokeObjectURL(l), u(d);
|
|
12
12
|
}, d.onerror = () => {
|
|
13
|
-
URL.revokeObjectURL(
|
|
14
|
-
}, d.src =
|
|
13
|
+
URL.revokeObjectURL(l), z(new Error("croppable-image-load-failed"));
|
|
14
|
+
}, d.src = l;
|
|
15
15
|
}), sr = async ({
|
|
16
16
|
file: c,
|
|
17
|
-
fill:
|
|
17
|
+
fill: u,
|
|
18
18
|
transform: z,
|
|
19
|
-
viewport:
|
|
19
|
+
viewport: l
|
|
20
20
|
}) => {
|
|
21
|
-
const d = await cr(c), M =
|
|
22
|
-
if (!
|
|
21
|
+
const d = await cr(c), M = l.width / d.naturalWidth, tt = l.height / d.naturalHeight, D = Math.max(M, tt), G = d.naturalWidth * D, Z = d.naturalHeight * D, R = u === "width" ? Math.max(F, M / D) : u === "height" ? Math.max(F, tt / D) : F, E = y(z.zoom, R, v), T = D * E, A = G * E, J = Z * E, at = (l.width - A) / 2 + z.offset.x, P = (l.height - J) / 2 + z.offset.y, K = y(-at / T, 0, d.naturalWidth), U = y(-P / T, 0, d.naturalHeight), x = y(l.width / T, 1, Math.max(1, d.naturalWidth - K)), b = y(l.height / T, 1, Math.max(1, d.naturalHeight - U)), O = document.createElement("canvas"), N = O.getContext("2d");
|
|
22
|
+
if (!N)
|
|
23
23
|
throw new Error("croppable-image-context-missing");
|
|
24
|
-
|
|
24
|
+
O.width = Math.max(1, Math.round(x)), O.height = Math.max(1, Math.round(b)), N.drawImage(d, K, U, x, b, 0, 0, O.width, O.height);
|
|
25
25
|
const f = c.type.startsWith("image/") ? c.type : "image/jpeg", g = await new Promise((S) => {
|
|
26
|
-
|
|
26
|
+
O.toBlob(S, f, or);
|
|
27
27
|
});
|
|
28
28
|
if (!g)
|
|
29
29
|
throw new Error("croppable-image-export-failed");
|
|
@@ -31,29 +31,29 @@ import '../../assets/index39.css';const j = 10, F = 0.1, or = 0.92, y = (c, l, z
|
|
|
31
31
|
lastModified: Date.now(),
|
|
32
32
|
type: g.type || f
|
|
33
33
|
});
|
|
34
|
-
}, ir = "
|
|
34
|
+
}, ir = "_croppable_i05ue_1", ar = "_empty_i05ue_15", ur = "_action_i05ue_28", lr = "_caption_i05ue_35", dr = "_media_i05ue_42", pr = "_viewport_i05ue_53", hr = "_draggable_i05ue_65", mr = "_dragging_i05ue_69", fr = "_inner_i05ue_73", gr = "_standalone_i05ue_89", a = {
|
|
35
35
|
croppable: ir,
|
|
36
36
|
empty: ar,
|
|
37
|
-
"drop-target": "_drop-
|
|
38
|
-
action:
|
|
39
|
-
caption:
|
|
37
|
+
"drop-target": "_drop-target_i05ue_23",
|
|
38
|
+
action: ur,
|
|
39
|
+
caption: lr,
|
|
40
40
|
media: dr,
|
|
41
41
|
viewport: pr,
|
|
42
42
|
draggable: hr,
|
|
43
43
|
dragging: mr,
|
|
44
44
|
inner: fr,
|
|
45
45
|
standalone: gr
|
|
46
|
-
}, wr = 192,
|
|
46
|
+
}, wr = 192, X = {
|
|
47
47
|
offset: {
|
|
48
48
|
x: 0,
|
|
49
49
|
y: 0
|
|
50
50
|
},
|
|
51
51
|
zoom: 1
|
|
52
|
-
},
|
|
52
|
+
}, Xt = (c, u) => (c == null ? void 0 : c.file) === u.file && (c == null ? void 0 : c.source) === u.source && (c == null ? void 0 : c.settings) === u.settings, Tr = ({
|
|
53
53
|
cancelLabel: c,
|
|
54
|
-
children:
|
|
54
|
+
children: u,
|
|
55
55
|
deleteLabel: z,
|
|
56
|
-
fill:
|
|
56
|
+
fill: l = "none",
|
|
57
57
|
height: d,
|
|
58
58
|
image: M,
|
|
59
59
|
isDeleting: tt,
|
|
@@ -61,18 +61,18 @@ import '../../assets/index39.css';const j = 10, F = 0.1, or = 0.92, y = (c, l, z
|
|
|
61
61
|
onCroppableChange: G,
|
|
62
62
|
onDelete: Z,
|
|
63
63
|
onFileChange: R,
|
|
64
|
-
onImageChange:
|
|
65
|
-
onSave:
|
|
66
|
-
onTransformChange:
|
|
64
|
+
onImageChange: E,
|
|
65
|
+
onSave: T,
|
|
66
|
+
onTransformChange: A,
|
|
67
67
|
saveLabel: J,
|
|
68
68
|
standalone: at,
|
|
69
|
-
transform:
|
|
69
|
+
transform: P,
|
|
70
70
|
uploadLabel: K
|
|
71
71
|
}) => {
|
|
72
|
-
const
|
|
72
|
+
const U = _(null), x = _(null), b = _(null), O = _(null), N = _(0), f = _(E), g = _(null), S = _(null), B = _(null), Q = _(/* @__PURE__ */ new Map()), i = _(X), ut = _(null), [w, rt] = I(null), [lt, dt] = I(null), [bt, et] = I(!1), [kt, pt] = I(!1), [Yt, ht] = I(X), [k, mt] = I(null), [m, Ht] = I({
|
|
73
73
|
width: 0,
|
|
74
74
|
height: 0
|
|
75
|
-
}), [_t, ft] =
|
|
75
|
+
}), [_t, ft] = I(null), [V, nt] = I(null), C = (() => {
|
|
76
76
|
const t = m.width, r = m.height;
|
|
77
77
|
if (!t || !r) return {
|
|
78
78
|
width: 0,
|
|
@@ -84,125 +84,125 @@ import '../../assets/index39.css';const j = 10, F = 0.1, or = 0.92, y = (c, l, z
|
|
|
84
84
|
height: r,
|
|
85
85
|
minZoom: F
|
|
86
86
|
};
|
|
87
|
-
const
|
|
87
|
+
const n = t / w.width, e = r / w.height, o = Math.max(n, e), s = l === "width" ? n / o : l === "height" ? e / o : 0;
|
|
88
88
|
return {
|
|
89
89
|
width: w.width * o,
|
|
90
90
|
height: w.height * o,
|
|
91
91
|
minZoom: Math.max(F, s)
|
|
92
92
|
};
|
|
93
|
-
})(), $ = C.minZoom,
|
|
93
|
+
})(), $ = C.minZoom, Y = P ?? Yt, H = y(Y.zoom, $, v), ot = lt ?? M ?? null, zt = !u && !!M && !lt && !k, ct = !zt, Mt = u ?? (ot ? /* @__PURE__ */ p("img", { alt: "", draggable: !1, onLoad: (t) => {
|
|
94
94
|
const r = t.currentTarget;
|
|
95
95
|
r.naturalWidth && r.naturalHeight && rt({
|
|
96
96
|
width: r.naturalWidth,
|
|
97
97
|
height: r.naturalHeight
|
|
98
98
|
});
|
|
99
|
-
}, src: ot }) : null),
|
|
100
|
-
file:
|
|
101
|
-
source:
|
|
102
|
-
settings: JSON.stringify([
|
|
99
|
+
}, src: ot }) : null), W = Mt == null, gt = {
|
|
100
|
+
file: k,
|
|
101
|
+
source: lt,
|
|
102
|
+
settings: JSON.stringify([l, H, Y.offset.x, Y.offset.y, m.width, m.height])
|
|
103
103
|
};
|
|
104
|
-
|
|
105
|
-
!V || !M || M === V.image && M !== V.crop.source || (ft(V.crop),
|
|
104
|
+
L(() => {
|
|
105
|
+
!V || !M || M === V.image && M !== V.crop.source || (ft(V.crop), nt(null));
|
|
106
106
|
}, [M, V]);
|
|
107
107
|
const wt = (t, r) => {
|
|
108
108
|
const {
|
|
109
|
-
maxX:
|
|
110
|
-
maxY:
|
|
109
|
+
maxX: n,
|
|
110
|
+
maxY: e
|
|
111
111
|
} = Dt(r);
|
|
112
112
|
return {
|
|
113
|
-
x: y(t.x, -
|
|
114
|
-
y: y(t.y, -
|
|
113
|
+
x: y(t.x, -n, n),
|
|
114
|
+
y: y(t.y, -e, e)
|
|
115
115
|
};
|
|
116
116
|
}, Rt = (t, r) => {
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
119
|
-
const
|
|
117
|
+
const n = ut.current;
|
|
118
|
+
if (!n) return null;
|
|
119
|
+
const e = n.getBoundingClientRect(), o = t - e.left - e.width / 2, s = r - e.top - e.height / 2;
|
|
120
120
|
return {
|
|
121
121
|
x: o,
|
|
122
122
|
y: s
|
|
123
123
|
};
|
|
124
|
-
},
|
|
125
|
-
const o = y(r, $,
|
|
124
|
+
}, jt = (t, r, n, e) => {
|
|
125
|
+
const o = y(r, $, v), s = y(n, $, v);
|
|
126
126
|
if (o === 0) return t;
|
|
127
127
|
const h = s / o;
|
|
128
128
|
return {
|
|
129
|
-
x: (1 - h) *
|
|
130
|
-
y: (1 - h) *
|
|
129
|
+
x: (1 - h) * e.x + h * t.x,
|
|
130
|
+
y: (1 - h) * e.y + h * t.y
|
|
131
131
|
};
|
|
132
|
-
},
|
|
133
|
-
const
|
|
132
|
+
}, vt = (t, r, n) => {
|
|
133
|
+
const e = i.current.zoom, o = y(t, $, v), s = i.current.offset, h = n ? jt(s, e, o, n) : r, j = wt(h, o);
|
|
134
134
|
i.current = {
|
|
135
135
|
zoom: o,
|
|
136
|
-
offset:
|
|
137
|
-
},
|
|
136
|
+
offset: j
|
|
137
|
+
}, P || ht({
|
|
138
138
|
zoom: o,
|
|
139
|
-
offset:
|
|
140
|
-
}),
|
|
139
|
+
offset: j
|
|
140
|
+
}), A == null || A({
|
|
141
141
|
zoom: o,
|
|
142
|
-
offset:
|
|
142
|
+
offset: j
|
|
143
143
|
});
|
|
144
|
-
}, st = (t, r,
|
|
144
|
+
}, st = (t, r, n) => {
|
|
145
145
|
S.current = {
|
|
146
146
|
zoom: t,
|
|
147
147
|
offset: r,
|
|
148
|
-
anchor:
|
|
148
|
+
anchor: n ?? null
|
|
149
149
|
}, x.current == null && (x.current = window.requestAnimationFrame(() => {
|
|
150
150
|
x.current = null;
|
|
151
|
-
const
|
|
151
|
+
const e = S.current;
|
|
152
152
|
S.current = null;
|
|
153
|
-
const o = (
|
|
154
|
-
|
|
153
|
+
const o = (e == null ? void 0 : e.zoom) ?? i.current.zoom, s = (e == null ? void 0 : e.offset) ?? i.current.offset, h = (e == null ? void 0 : e.anchor) ?? null;
|
|
154
|
+
vt(o, s, h);
|
|
155
155
|
}));
|
|
156
156
|
}, Zt = (t) => {
|
|
157
|
-
if (
|
|
158
|
-
const r = t.ctrlKey ? 1e-3 : 25e-5,
|
|
159
|
-
st(
|
|
157
|
+
if (W || !ct) return;
|
|
158
|
+
const r = t.ctrlKey ? 1e-3 : 25e-5, n = i.current.zoom * Math.exp(-t.deltaY * r), e = Rt(t.clientX, t.clientY);
|
|
159
|
+
st(n, i.current.offset, e);
|
|
160
160
|
}, Dt = (t) => {
|
|
161
|
-
const r = m.width,
|
|
162
|
-
if (!r || !
|
|
161
|
+
const r = m.width, n = m.height;
|
|
162
|
+
if (!r || !n) return {
|
|
163
163
|
maxX: 0,
|
|
164
164
|
maxY: 0
|
|
165
165
|
};
|
|
166
|
-
const
|
|
166
|
+
const e = y(t, $, v), o = C.width * e, s = C.height * e, h = Math.max(0, (o - r) / 2), j = Math.max(0, (s - n) / 2);
|
|
167
167
|
return {
|
|
168
168
|
maxX: h,
|
|
169
|
-
maxY:
|
|
169
|
+
maxY: j
|
|
170
170
|
};
|
|
171
|
-
},
|
|
172
|
-
if (
|
|
171
|
+
}, Tt = (t) => {
|
|
172
|
+
if (nt(null), ft(null), g.current && (URL.revokeObjectURL(g.current), g.current = null), !t) {
|
|
173
173
|
dt(null), mt(null), R == null || R(null);
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
const r = URL.createObjectURL(t);
|
|
177
|
-
g.current = r, dt(r), rt(null), mt(t), st(
|
|
177
|
+
g.current = r, dt(r), rt(null), mt(t), st(X.zoom, X.offset), i.current = X, R == null || R(t);
|
|
178
178
|
}, St = (t) => {
|
|
179
179
|
var r;
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
-
if (t.preventDefault(), t.stopPropagation(),
|
|
183
|
-
const r = Array.from(t.dataTransfer.files).find((
|
|
184
|
-
r &&
|
|
185
|
-
},
|
|
186
|
-
|
|
180
|
+
Tt(((r = t.target.files) == null ? void 0 : r[0]) ?? null), t.target.value = "";
|
|
181
|
+
}, Pt = (t) => !D && (Array.from(t.items ?? []).some((r) => r.kind === "file" && r.type.startsWith("image/")) || Array.from(t.files ?? []).some((r) => r.type.startsWith("image/"))), Bt = (t) => {
|
|
182
|
+
if (t.preventDefault(), t.stopPropagation(), N.current = 0, pt(!1), D) return;
|
|
183
|
+
const r = Array.from(t.dataTransfer.files).find((n) => n.type.startsWith("image/"));
|
|
184
|
+
r && Tt(r);
|
|
185
|
+
}, Ut = () => {
|
|
186
|
+
nt(null), ft(null), x.current != null && (window.cancelAnimationFrame(x.current), x.current = null), S.current = null, U.current = null, b.current = null, B.current = null, Q.current.clear(), et(!1), g.current && (URL.revokeObjectURL(g.current), g.current = null), dt(null), rt(null), mt(null), i.current = X, ht(X), A == null || A(X), R == null || R(null);
|
|
187
187
|
}, $t = (t) => {
|
|
188
|
-
t.stopPropagation(),
|
|
188
|
+
t.stopPropagation(), Ut();
|
|
189
189
|
}, qt = (t) => {
|
|
190
|
-
t.stopPropagation(),
|
|
190
|
+
t.stopPropagation(), Ut(), Z == null || Z();
|
|
191
191
|
}, Ft = (t) => {
|
|
192
|
-
if (!(
|
|
192
|
+
if (!(W || !ct || t.pointerType === "mouse" && t.button !== 0)) {
|
|
193
193
|
if (t.currentTarget.setPointerCapture(t.pointerId), t.pointerType === "touch") {
|
|
194
194
|
const r = Q.current;
|
|
195
195
|
if (r.set(t.pointerId, {
|
|
196
196
|
x: t.clientX,
|
|
197
197
|
y: t.clientY
|
|
198
198
|
}), r.size === 2) {
|
|
199
|
-
b.current = null,
|
|
200
|
-
const [
|
|
201
|
-
B.current = Math.hypot(
|
|
199
|
+
b.current = null, U.current = null, et(!1);
|
|
200
|
+
const [n, e] = Array.from(r.values());
|
|
201
|
+
B.current = Math.hypot(n.x - e.x, n.y - e.y);
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
U.current = t.pointerId, b.current = {
|
|
206
206
|
x: t.clientX,
|
|
207
207
|
y: t.clientY,
|
|
208
208
|
originX: i.current.offset.x,
|
|
@@ -210,7 +210,7 @@ import '../../assets/index39.css';const j = 10, F = 0.1, or = 0.92, y = (c, l, z
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
}, Gt = (t) => {
|
|
213
|
-
if (
|
|
213
|
+
if (W || !ct) return;
|
|
214
214
|
if (t.pointerType === "touch") {
|
|
215
215
|
const o = Q.current;
|
|
216
216
|
if (!o.has(t.pointerId)) return;
|
|
@@ -218,154 +218,154 @@ import '../../assets/index39.css';const j = 10, F = 0.1, or = 0.92, y = (c, l, z
|
|
|
218
218
|
x: t.clientX,
|
|
219
219
|
y: t.clientY
|
|
220
220
|
}), o.size === 2) {
|
|
221
|
-
const [s, h] = Array.from(o.values()),
|
|
221
|
+
const [s, h] = Array.from(o.values()), j = s.x - h.x, Qt = s.y - h.y, Nt = Math.hypot(j, Qt), Wt = {
|
|
222
222
|
x: (s.x + h.x) / 2,
|
|
223
223
|
y: (s.y + h.y) / 2
|
|
224
224
|
};
|
|
225
225
|
if (B.current) {
|
|
226
|
-
const Vt =
|
|
226
|
+
const Vt = Nt / B.current, Ct = i.current.zoom * Vt, tr = Rt(Wt.x, Wt.y);
|
|
227
227
|
st(Ct, i.current.offset, tr);
|
|
228
228
|
}
|
|
229
|
-
B.current =
|
|
229
|
+
B.current = Nt;
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
if (
|
|
234
|
-
const r = t.clientX - b.current.x,
|
|
235
|
-
!bt &&
|
|
233
|
+
if (U.current !== t.pointerId || !b.current || !yt) return;
|
|
234
|
+
const r = t.clientX - b.current.x, n = t.clientY - b.current.y, e = Math.abs(r) + Math.abs(n);
|
|
235
|
+
!bt && e > 2 && et(!0), !(e <= 1) && st(i.current.zoom, {
|
|
236
236
|
x: b.current.originX + r,
|
|
237
|
-
y: b.current.originY +
|
|
237
|
+
y: b.current.originY + n
|
|
238
238
|
});
|
|
239
|
-
},
|
|
240
|
-
t.pointerType === "touch" && (Q.current.delete(t.pointerId), Q.current.size < 2 && (B.current = null)),
|
|
239
|
+
}, Ot = (t) => {
|
|
240
|
+
t.pointerType === "touch" && (Q.current.delete(t.pointerId), Q.current.size < 2 && (B.current = null)), U.current === t.pointerId && (U.current = null, b.current = null, et(!1));
|
|
241
241
|
};
|
|
242
|
-
|
|
243
|
-
if (!
|
|
244
|
-
const t = y(
|
|
242
|
+
L(() => {
|
|
243
|
+
if (!P) return;
|
|
244
|
+
const t = y(P.zoom, $, v);
|
|
245
245
|
i.current = {
|
|
246
246
|
zoom: t,
|
|
247
|
-
offset: wt(
|
|
247
|
+
offset: wt(P.offset, t)
|
|
248
248
|
};
|
|
249
|
-
}, [
|
|
249
|
+
}, [P, m.width, m.height, w == null ? void 0 : w.width, w == null ? void 0 : w.height]), L(() => () => {
|
|
250
250
|
g.current && URL.revokeObjectURL(g.current);
|
|
251
|
-
}, []),
|
|
252
|
-
const t =
|
|
251
|
+
}, []), L(() => {
|
|
252
|
+
const t = ut.current;
|
|
253
253
|
if (!t) return;
|
|
254
254
|
const r = () => {
|
|
255
255
|
const o = t.getBoundingClientRect();
|
|
256
|
-
|
|
256
|
+
Ht((s) => s.width === o.width && s.height === o.height ? s : {
|
|
257
257
|
width: o.width,
|
|
258
258
|
height: o.height
|
|
259
259
|
}), G && G(o);
|
|
260
260
|
};
|
|
261
261
|
r();
|
|
262
|
-
const
|
|
263
|
-
if (window.addEventListener("scroll",
|
|
262
|
+
const n = () => r();
|
|
263
|
+
if (window.addEventListener("scroll", n, !0), typeof ResizeObserver > "u") {
|
|
264
264
|
const o = () => r();
|
|
265
265
|
return window.addEventListener("resize", o), () => {
|
|
266
|
-
window.removeEventListener("resize", o), window.removeEventListener("scroll",
|
|
266
|
+
window.removeEventListener("resize", o), window.removeEventListener("scroll", n, !0);
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
|
-
const
|
|
270
|
-
return
|
|
271
|
-
|
|
269
|
+
const e = new ResizeObserver(() => r());
|
|
270
|
+
return e.observe(t), () => {
|
|
271
|
+
e.disconnect(), window.removeEventListener("scroll", n, !0);
|
|
272
272
|
};
|
|
273
|
-
}, [G]),
|
|
274
|
-
if (
|
|
275
|
-
const t = i.current.offset, r = wt(t,
|
|
273
|
+
}, [G]), L(() => {
|
|
274
|
+
if (P) return;
|
|
275
|
+
const t = i.current.offset, r = wt(t, H);
|
|
276
276
|
t.x === r.x && t.y === r.y || (i.current = {
|
|
277
277
|
zoom: i.current.zoom,
|
|
278
278
|
offset: r
|
|
279
|
-
}, ht((
|
|
280
|
-
...
|
|
279
|
+
}, ht((n) => ({
|
|
280
|
+
...n,
|
|
281
281
|
offset: r
|
|
282
282
|
})));
|
|
283
|
-
}, [
|
|
283
|
+
}, [H, w, m.width, m.height]), L(() => {
|
|
284
284
|
ot || rt(null);
|
|
285
|
-
}, [ot]),
|
|
286
|
-
f.current =
|
|
287
|
-
}, [
|
|
288
|
-
var
|
|
289
|
-
if (!
|
|
290
|
-
if (!
|
|
291
|
-
(
|
|
285
|
+
}, [ot]), L(() => {
|
|
286
|
+
f.current = E;
|
|
287
|
+
}, [E]), L(() => {
|
|
288
|
+
var n;
|
|
289
|
+
if (!E) return;
|
|
290
|
+
if (!k || !m.width || !m.height || u) {
|
|
291
|
+
(n = f.current) == null || n.call(f, null);
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
294
294
|
let t = !0;
|
|
295
295
|
const r = window.setTimeout(() => {
|
|
296
296
|
sr({
|
|
297
|
-
file:
|
|
298
|
-
fill:
|
|
297
|
+
file: k,
|
|
298
|
+
fill: l,
|
|
299
299
|
transform: {
|
|
300
|
-
zoom:
|
|
301
|
-
offset:
|
|
300
|
+
zoom: H,
|
|
301
|
+
offset: Y.offset
|
|
302
302
|
},
|
|
303
303
|
viewport: m
|
|
304
|
-
}).then((
|
|
304
|
+
}).then((e) => {
|
|
305
305
|
var o;
|
|
306
|
-
t && ((o = f.current) == null || o.call(f,
|
|
306
|
+
t && ((o = f.current) == null || o.call(f, e));
|
|
307
307
|
}).catch(() => {
|
|
308
|
-
var
|
|
309
|
-
t && ((
|
|
308
|
+
var e;
|
|
309
|
+
t && ((e = f.current) == null || e.call(f, null));
|
|
310
310
|
});
|
|
311
311
|
}, 75);
|
|
312
312
|
return () => {
|
|
313
313
|
t = !1, window.clearTimeout(r);
|
|
314
314
|
};
|
|
315
|
-
}, [
|
|
315
|
+
}, [u, H, Y.offset, l, k, m]), L(() => () => {
|
|
316
316
|
x.current != null && (window.cancelAnimationFrame(x.current), x.current = null);
|
|
317
317
|
}, []);
|
|
318
|
-
const
|
|
318
|
+
const It = Dt(H), yt = !W && ct && (It.maxX > 0 || It.maxY > 0), Lt = !W && !zt && !!T && !Xt(_t, gt), Et = !!M && !u && !!k && !Xt(_t, gt), Jt = !Et && !W && !!(k || Z), At = () => {
|
|
319
319
|
var t;
|
|
320
|
-
return (t =
|
|
320
|
+
return (t = O.current) == null ? void 0 : t.click();
|
|
321
321
|
}, Kt = (t) => {
|
|
322
|
-
t.preventDefault(), t.stopPropagation(),
|
|
322
|
+
t.preventDefault(), t.stopPropagation(), At();
|
|
323
323
|
};
|
|
324
|
-
return /* @__PURE__ */ q("div", { className: xt(a.croppable, at && a.standalone,
|
|
325
|
-
t.preventDefault(), t.stopPropagation(),
|
|
324
|
+
return /* @__PURE__ */ q("div", { className: xt(a.croppable, at && a.standalone, kt && a["drop-target"]), onDragEnter: (t) => {
|
|
325
|
+
t.preventDefault(), t.stopPropagation(), N.current += 1, pt(Pt(t.dataTransfer));
|
|
326
326
|
}, onDragOver: (t) => {
|
|
327
|
-
t.preventDefault(), t.stopPropagation(), t.dataTransfer.dropEffect =
|
|
327
|
+
t.preventDefault(), t.stopPropagation(), t.dataTransfer.dropEffect = Pt(t.dataTransfer) ? "copy" : "none";
|
|
328
328
|
}, onDragLeave: (t) => {
|
|
329
|
-
t.preventDefault(), t.stopPropagation(),
|
|
329
|
+
t.preventDefault(), t.stopPropagation(), N.current = Math.max(0, N.current - 1), N.current || pt(!1);
|
|
330
330
|
}, onDrop: Bt, onClick: () => {
|
|
331
|
-
|
|
331
|
+
W && At();
|
|
332
332
|
}, "data-component": "croppable", children: [
|
|
333
|
-
/* @__PURE__ */ p("input", { accept: "image/*", onChange: St, ref:
|
|
334
|
-
/* @__PURE__ */ p("div", { className: a.viewport, ref:
|
|
333
|
+
/* @__PURE__ */ p("input", { accept: "image/*", onChange: St, ref: O, type: "file" }),
|
|
334
|
+
/* @__PURE__ */ p("div", { className: a.viewport, ref: ut, onDragStart: (t) => t.preventDefault(), onPointerDown: Ft, onPointerMove: Gt, onPointerUp: Ot, onPointerCancel: Ot, onWheel: Zt, style: {
|
|
335
335
|
"--croppable-height": `${d ?? wr}px`,
|
|
336
|
-
"--croppable-zoom":
|
|
337
|
-
"--croppable-x": `${
|
|
338
|
-
"--croppable-y": `${
|
|
336
|
+
"--croppable-zoom": H,
|
|
337
|
+
"--croppable-x": `${Y.offset.x}px`,
|
|
338
|
+
"--croppable-y": `${Y.offset.y}px`,
|
|
339
339
|
...w ? {
|
|
340
340
|
"--croppable-image-width": `${C.width}px`,
|
|
341
341
|
"--croppable-image-height": `${C.height}px`
|
|
342
342
|
} : null
|
|
343
|
-
}, children:
|
|
343
|
+
}, children: W ? /* @__PURE__ */ p("div", { className: a.empty, children: /* @__PURE__ */ p(er, { children: /* @__PURE__ */ p(nr, { name: "Image", size: "large" }) }) }) : /* @__PURE__ */ p("div", { className: xt(a.media, yt && a.draggable, yt && bt && a.dragging), children: /* @__PURE__ */ p("div", { className: xt(a.inner), children: Mt }) }) }),
|
|
344
344
|
/* @__PURE__ */ q(rr, { children: [
|
|
345
|
-
|
|
345
|
+
Lt && /* @__PURE__ */ q("span", { className: a.action, children: [
|
|
346
346
|
/* @__PURE__ */ p(it, { isLoading: D, "aria-label": J ?? "Save image", icon: "FloppyDisk", onClick: () => {
|
|
347
|
-
|
|
347
|
+
nt({
|
|
348
348
|
image: M,
|
|
349
349
|
crop: gt
|
|
350
|
-
}),
|
|
350
|
+
}), T == null || T();
|
|
351
351
|
}, variant: "primary" }),
|
|
352
352
|
J && /* @__PURE__ */ p("span", { className: a.caption, children: J })
|
|
353
353
|
] }),
|
|
354
|
-
!
|
|
355
|
-
/* @__PURE__ */ p(it, { "aria-label": K, icon: "UploadSimple", onClick: Kt, variant: "
|
|
354
|
+
!Lt && /* @__PURE__ */ q("span", { className: a.action, children: [
|
|
355
|
+
/* @__PURE__ */ p(it, { "aria-label": K, icon: "UploadSimple", onClick: Kt, variant: "tertiary" }),
|
|
356
356
|
/* @__PURE__ */ p("span", { className: a.caption, children: K })
|
|
357
357
|
] }),
|
|
358
|
-
|
|
359
|
-
/* @__PURE__ */ p(it, { "aria-label": c ?? "Cancel changes", icon: "X", onClick: $t, variant: "
|
|
358
|
+
Et && /* @__PURE__ */ q("span", { className: a.action, children: [
|
|
359
|
+
/* @__PURE__ */ p(it, { "aria-label": c ?? "Cancel changes", icon: "X", onClick: $t, variant: "tertiary" }),
|
|
360
360
|
c && /* @__PURE__ */ p("span", { className: a.caption, children: c })
|
|
361
361
|
] }),
|
|
362
362
|
Jt && /* @__PURE__ */ q("span", { className: a.action, children: [
|
|
363
|
-
/* @__PURE__ */ p(it, { "aria-label": z ?? "Delete image", icon: "Trash", intent: "danger", isLoading: tt, onClick: qt, variant: "
|
|
363
|
+
/* @__PURE__ */ p(it, { "aria-label": z ?? "Delete image", icon: "Trash", intent: "danger", isLoading: tt, onClick: qt, variant: "tertiary" }),
|
|
364
364
|
z && /* @__PURE__ */ p("span", { className: a.caption, children: z })
|
|
365
365
|
] })
|
|
366
366
|
] })
|
|
367
367
|
] });
|
|
368
368
|
};
|
|
369
369
|
export {
|
|
370
|
-
|
|
370
|
+
Tr as Croppable
|
|
371
371
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index39.css');const e=require("react/jsx-runtime"),p=require("classix"),a=require("react"),j=require("../button/index.cjs"),P=require("../icon/index.cjs"),T="_dialog_cz5d0_3",X="_close_cz5d0_34",E="_fullscreen_cz5d0_45",F="_structured_cz5d0_87",M="_content_cz5d0_87",S="_header_cz5d0_96",Y="_controls_cz5d0_101",r={dialog:T,close:X,fullscreen:E,structured:F,content:M,header:S,controls:Y},z=l=>a.Children.toArray(l).some(s=>a.isValidElement(s)?s.type===j.Button&&s.props.intent==="danger"?!0:z(s.props.children):!1),w=({children:l,className:s,controls:n,fullscreen:f=!1,header:_,onCancel:i,onClick:d,onClose:u,open:o=!1,setOpen:c,...B})=>{const g=a.useRef(null),m=z(n),h=f||_!=null||n!=null;a.useEffect(()=>{const t=g.current;t&&(o&&!t.open?t.showModal():!o&&t.open&&t.close())},[o]);const b=t=>{i==null||i(t),!(t.defaultPrevented||!c)&&(t.preventDefault(),c(!1))},q=t=>{if(d==null||d(t),m||t.defaultPrevented||t.target!==t.currentTarget||!c)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)&&c(!1)},y=t=>{u==null||u(t),o&&(c==null||c(!1))},x=c&&!m?e.jsx(j.Button,{"aria-label":"Close dialog",className:r.close,onClick:()=>c(!1),variant:"simple",children:e.jsx(P.Icon,{name:"X"})}):null;return e.jsx("dialog",{className:p(r.dialog,h&&r.structured,f&&r.fullscreen,s),onCancel:b,onClick:q,onClose:y,ref:g,...B,"data-component":"dialog",children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:r.header,children:[_,x]}),e.jsx("div",{className:r.content,children:l}),n!=null&&e.jsx("div",{className:r.controls,children:n})]}):e.jsxs(e.Fragment,{children:[x,l]})})};exports.Dialog=w;
|
|
@@ -3,7 +3,7 @@ import P from "classix";
|
|
|
3
3
|
import B, { useRef as T, useEffect as Y } from "react";
|
|
4
4
|
import { Button as N } from "../button/index.js";
|
|
5
5
|
import { Icon as w } from "../icon/index.js";
|
|
6
|
-
import '../../assets/
|
|
6
|
+
import '../../assets/index39.css';const A = "_dialog_cz5d0_3", F = "_close_cz5d0_34", I = "_fullscreen_cz5d0_45", M = "_structured_cz5d0_87", V = "_content_cz5d0_87", q = "_header_cz5d0_96", G = "_controls_cz5d0_101", c = {
|
|
7
7
|
dialog: A,
|
|
8
8
|
close: F,
|
|
9
9
|
fullscreen: I,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index40.css');const r=require("react/jsx-runtime"),d=require("classix"),t="_divider_1oie5_1",s={divider:t},o=({className:e,...i})=>r.jsx("hr",{className:d(s.divider,e),...i,"data-component":"divider"});exports.Divider=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index41.css');const s=require("react/jsx-runtime"),C=require("classix"),r=require("react"),V=require("../button/index.cjs"),$e=require("../../icons-BIdcCH-v.cjs"),fe=require("../../index-CHJNMNDr.cjs"),De=require("../list/index.cjs"),Fe=require("../loading/index.cjs"),F=require("../../index-BQoXmNo3.cjs");function L(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(L).join(" "):r.isValidElement(t)?L(t.props.children):""}function Le(t){return r.isValidElement(t)&&t.type==="option"}function Me(t){return r.isValidElement(t)&&t.type==="optgroup"}function Qe(t){return r.isValidElement(t)&&t.type===r.Fragment}function We(t){return r.isValidElement(t)&&t.type===F.Select}function Z(t,c,i=!1){const o=[];return r.Children.forEach(t,n=>{if(Qe(n))o.push(...Z(n.props.children,c,i));else if(Le(n)){const a=L(n.props.children).trim(),h=n.props.value!=null?String(n.props.value):a;o.push({disabled:i||!!n.props.disabled,groupLabel:c,hidden:!!n.props.hidden,isPlaceholder:!!(n.props.hidden&&h===""),label:n.props.children,selected:!!n.props.selected,text:a,value:h})}else Me(n)&&o.push(...Z(n.props.children,n.props.label,i||!!n.props.disabled))}),o}function ze(t){const c=t.trim();if(!c)return null;const o=[.../[*?]/.test(c)?c:`*${c}*`].map(n=>n==="*"?".*":n==="?"?".":n.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${o}$`,"i")}function Ge(t,c){const i=ze(c),o=t.filter(n=>!n.hidden&&!n.isPlaceholder);return i?o.filter(n=>i.test([n.groupLabel,n.text,n.value].filter(Boolean).join(" "))):o}function Pe(t,c){return t.find(i=>i.value===c)??t.find(i=>i.isPlaceholder)??t[0]}function Te(t,c,i){var o,n;return c!=null?String(c):i!=null?String(i):((o=t.find(a=>a.selected))==null?void 0:o.value)??((n=t[0])==null?void 0:n.value)??""}function Ae(t){if(We(t)){const{children:c,placeholder:i,...o}=t.props;return{children:s.jsxs(s.Fragment,{children:[i&&s.jsx("option",{hidden:!0,value:"",children:i}),c]}),props:o}}return{children:t.props.children,props:t.props}}const Ke="_combobox_5r227_3",Oe="_dropdown_5r227_20",He="_empty_5r227_25",Je="_group_5r227_26",Ue="_placeholder_5r227_27",Xe="_filter_5r227_35",Ye="_native_5r227_45",Ze="_option_5r227_55",et="_options_5r227_76",tt="_panel_5r227_83",nt="_selected_5r227_108",st="_text_5r227_112",rt="_trigger_5r227_120",lt="_minimal_5r227_157",it="_inline_5r227_217",ot="_label_5r227_249",l={combobox:Ke,"combobox-input":"_combobox-input_5r227_12",dropdown:Oe,empty:He,group:Je,placeholder:Ue,filter:Xe,native:Ye,option:Ze,options:et,panel:tt,selected:nt,text:st,trigger:rt,minimal:lt,inline:it,label:ot,"inline-field":"_inline-field_5r227_255"};function pe(t,c){return{"--icon-svg":$e.iconSVG(t,c)}}const ct=({children:t,className:c,combobox:i=!1,createOption:o,emptyLabel:n="No matches found",errorLabel:a,onRetry:h,retryLabel:me="Retry",label:b,filterOptions:_e=!0,hasNextPage:v=!1,loading:m=!1,loadMoreLabel:be="Load more",onLoadMore:g,onOpenChange:I,onSearchChange:B,searchValue:M,renderOption:Q,searchPlaceholder:W="Filter",selectedItems:ve,variant:j="default",...xe})=>{const z=Ae(t),{defaultValue:ye,onChange:G,value:P,...he}=z.props,u=F.sanitizeSelectProps(he),{className:ge,...je}=u,ee=r.useRef(null),te=r.useRef(null),k=r.useId(),ne=r.useRef(null),x=r.useRef(null),se=r.useRef(null),re=r.useRef(null),T=r.useRef(!1),A=r.useRef(!1),K=r.useRef(g),le=!!g,w=Z(z.children),E=P!=null,O=Te(w,P,ye),[H,J]=r.useState(()=>O),[d,we]=r.useState(!1),[Ee,Re]=r.useState(""),R=M??Ee,N=r.useCallback(e=>{M===void 0&&Re(e),B==null||B(e)},[B,M]),p=r.useCallback(e=>{T.current===e||e&&u.disabled||(T.current=e,we(e),I==null||I(e),e||N(""))},[I,u.disabled,N]),q=E?String(P):H,ie={default:F.resolveColor("--colors-semantic-content-secondary"),white:F.resolveColor("--color-white","white")},oe=j==="minimal"?ie.white:ie.default,$=Pe(w,q),Ne=pe("CaretDown",oe),Se=pe("MagnifyingGlass",oe),U=Ge(w,_e?R:""),y=R.trim(),D=!!(i&&o&&y&&o.isValid(y)),Ce=b&&j==="inline"?fe.formatInlineLabel(b):b,ce=e=>e?(Q==null?void 0:Q({groupLabel:e.groupLabel,isSelected:e.value===q,label:e.label,text:e.text,value:e.value}))??e.label:"Select an option";r.useEffect(()=>{!E&&!w.some(e=>e.value===H)&&J(O)},[O,H,E,w]),r.useEffect(()=>{var e;d&&((e=x.current)==null||e.focus())},[d]),r.useEffect(()=>{if(!d)return;const e=f=>{var _;(_=te.current)!=null&&_.contains(f.target)||p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[p,d]),r.useEffect(()=>{K.current=g},[g]),r.useEffect(()=>{u.disabled&&p(!1)},[p,u.disabled]);const X=r.useCallback(()=>{!T.current||u.disabled||m||a||!v||!K.current||A.current||(A.current=!0,K.current())},[a,v,m,u.disabled]);r.useEffect(()=>{if(A.current=!1,!d||u.disabled||m||a||!v||!le)return;const e=re.current,f=se.current;if(!e||!f||typeof IntersectionObserver>"u")return;let _=!0;const S=new IntersectionObserver(ke=>{_&&ke.some(qe=>qe.isIntersecting)&&X()},{root:f});return S.observe(e),()=>{_=!1,S.disconnect()}},[d,m,a,v,le,X,U.length,R,u.disabled]);const Ve=e=>{E||J(e.target.value),G==null||G(e)},Y=()=>{var e;p(!1),i||(e=ee.current)==null||e.focus()},ae=()=>{var e;N(""),p(!0),(e=x.current)==null||e.focus()},ue=()=>{!o||!D||(o.onCreate(y),ae())},Ie=e=>{var S;E||J(e);const f=ne.current;if(!f){Y();return}const _=(S=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:S.set;_==null||_.call(f,e),f.dispatchEvent(new Event("change",{bubbles:!0})),i?ae():Y()},Be=e=>{e.key==="Escape"&&Y(),e.key==="Enter"&&e.target===x.current&&D&&(e.preventDefault(),ue())},de=s.jsxs("div",{className:C(l.dropdown,j==="inline"&&l.inline,j==="minimal"&&l.minimal,c),onKeyDown:Be,ref:te,...xe,"data-component":"dropdown",children:[s.jsx("select",{...je,"aria-hidden":"true",className:C(l.native,ge),onChange:Ve,ref:ne,tabIndex:-1,value:q,children:z.children}),i?s.jsxs("div",{className:l.combobox,onClick:()=>{var e;return(e=x.current)==null?void 0:e.focus()},children:[ve,s.jsx("input",{"aria-autocomplete":"list","aria-expanded":d,"aria-label":u["aria-label"]??b??W,className:l["combobox-input"],disabled:u.disabled,onChange:e=>{N(e.target.value),p(!0)},onClick:()=>p(!0),onFocus:()=>p(!0),placeholder:W||void 0,ref:x,role:"combobox",type:"text",value:R})]}):s.jsx(V.Button,{"aria-expanded":d,"aria-haspopup":"dialog","aria-labelledby":b?`${k} ${k}-value`:void 0,className:C(l.trigger,($==null?void 0:$.isPlaceholder)&&l.placeholder),"data-open":d?"true":void 0,disabled:u.disabled,onClick:()=>p(!d),ref:ee,style:Ne,variant:"simple",children:s.jsx("span",{className:l.text,id:`${k}-value`,children:ce($)})}),d&&s.jsxs("div",{className:l.panel,children:[!i&&s.jsx(fe.Input,{"aria-label":"Filter",className:l.filter,icon:"MagnifyingGlass",onChange:e=>N(e.target.value),placeholder:W,ref:x,style:Se,type:"search",value:R}),s.jsxs(De.List,{"aria-label":"Dropdown","aria-busy":m||void 0,className:l.options,ref:se,children:[U.map(e=>{const f=e.value===q;return s.jsx("li",{"data-component":"dropdown",children:s.jsxs(V.Button,{"aria-label":f?`${e.text}, selected`:e.text,className:C(l.option,f&&l.selected),disabled:e.disabled,onClick:()=>Ie(e.value),variant:"tertiary",children:[s.jsx("span",{className:l.text,children:ce(e)}),e.groupLabel&&s.jsx("small",{className:l.group,children:e.groupLabel})]})},`${e.groupLabel??"root"}-${e.value}`)}),D&&o&&s.jsx("li",{children:s.jsx(V.Button,{"aria-label":L(o.render(y))||y,className:l.option,onClick:ue,variant:"tertiary",children:s.jsx("span",{className:l.text,children:o.render(y)})})}),U.length===0&&!D&&!m&&!a&&!v&&s.jsx("li",{className:l.empty,children:n}),a&&s.jsxs("li",{className:l.empty,children:[s.jsx("span",{role:"alert",children:a}),h&&s.jsx(V.Button,{disabled:m,onClick:h,variant:"tertiary",children:me})]}),m&&s.jsx("li",{"aria-label":"Loading",className:l.empty,role:"status",children:s.jsx(Fe.Loading,{size:"small"})}),v&&g&&!a&&s.jsx("li",{ref:re,children:s.jsx(V.Button,{className:l.option,disabled:m,onClick:X,variant:"tertiary",children:be})})]})]})]});return b?s.jsxs("div",{className:C(l.label,j==="inline"&&l["inline-field"]),"data-component":"dropdown",children:[s.jsx("span",{id:k,children:Ce}),de]}):de};exports.Dropdown=ct;
|
|
@@ -3,11 +3,11 @@ import $ from "classix";
|
|
|
3
3
|
import ze, { Children as Ge, isValidElement as B, useRef as b, useId as Me, useState as te, useCallback as ne, useEffect as w } from "react";
|
|
4
4
|
import { Button as k } from "../button/index.js";
|
|
5
5
|
import { i as Pe } from "../../icons-DVeBguFb.js";
|
|
6
|
-
import { f as qe, I as Ae } from "../../index-
|
|
6
|
+
import { f as qe, I as Ae } from "../../index-Bre56YYa.js";
|
|
7
7
|
import { List as Ke } from "../list/index.js";
|
|
8
8
|
import { Loading as Te } from "../loading/index.js";
|
|
9
|
-
import { S as He, s as Oe, r as _e } from "../../index-
|
|
10
|
-
import '../../assets/
|
|
9
|
+
import { S as He, s as Oe, r as _e } from "../../index-GPsHvb4d.js";
|
|
10
|
+
import '../../assets/index41.css';function z(t) {
|
|
11
11
|
return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(z).join(" ") : B(t) ? z(t.props.children) : "";
|
|
12
12
|
}
|
|
13
13
|
function Je(t) {
|