@yourbestsoft/studio-screen-ui-kit 0.0.13 → 0.0.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/ToolIconButton-CtrbbDcL.js +647 -0
- package/dist/ToolIconButton-CtrbbDcL.js.map +1 -0
- package/dist/components/drop-down/DropDown.d.ts +1 -1
- package/dist/components/drop-down/hooks/useDropdownPosition.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index2.js +2 -2
- package/package.json +1 -1
- package/dist/ToolIconButton-BeXfpEJ7.js +0 -642
- package/dist/ToolIconButton-BeXfpEJ7.js.map +0 -1
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
import { jsx as i, jsxs as k, Fragment as X } from "react/jsx-runtime";
|
|
2
|
+
import h from "classnames";
|
|
3
|
+
import Z, { forwardRef as N, useEffect as y, useState as O, useCallback as R, useLayoutEffect as tt, createContext as A, useRef as I, useContext as $ } from "react";
|
|
4
|
+
import { createPortal as et } from "react-dom";
|
|
5
|
+
import { Eye as ot, EyeOff as nt, X as st, Search as rt } from "lucide-react";
|
|
6
|
+
const ct = "_text_4m304_1", it = "_tertiary_4m304_1", at = "_secondary_4m304_1", lt = "_primary_4m304_1", dt = "_fullWidth_4m304_50", ut = "_buttonWithIcon_4m304_54", ht = "_content_4m304_61", _t = "_shortcut_4m304_70", mt = "_disabled_4m304_82", T = {
|
|
7
|
+
text: ct,
|
|
8
|
+
tertiary: it,
|
|
9
|
+
secondary: at,
|
|
10
|
+
primary: lt,
|
|
11
|
+
fullWidth: dt,
|
|
12
|
+
buttonWithIcon: ut,
|
|
13
|
+
content: ht,
|
|
14
|
+
shortcut: _t,
|
|
15
|
+
disabled: mt
|
|
16
|
+
}, bt = ({
|
|
17
|
+
children: t,
|
|
18
|
+
className: e,
|
|
19
|
+
component: o = "button",
|
|
20
|
+
disabled: n,
|
|
21
|
+
fullWidth: r,
|
|
22
|
+
icon: s,
|
|
23
|
+
shortcut: c,
|
|
24
|
+
variant: d = "primary",
|
|
25
|
+
...u
|
|
26
|
+
}, _) => {
|
|
27
|
+
const m = /* @__PURE__ */ k("div", { className: T.buttonWithIcon, children: [
|
|
28
|
+
/* @__PURE__ */ k("div", { className: T.content, children: [
|
|
29
|
+
s,
|
|
30
|
+
t
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ i("div", { className: T.shortcut, children: c })
|
|
33
|
+
] });
|
|
34
|
+
return /* @__PURE__ */ i(
|
|
35
|
+
o,
|
|
36
|
+
{
|
|
37
|
+
className: h(
|
|
38
|
+
T[d],
|
|
39
|
+
r && T.fullWidth,
|
|
40
|
+
n && T.disabled,
|
|
41
|
+
s && T.icon,
|
|
42
|
+
e
|
|
43
|
+
),
|
|
44
|
+
children: s ? m : t,
|
|
45
|
+
disabled: n,
|
|
46
|
+
ref: _,
|
|
47
|
+
...u
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}, to = N(bt), gt = "_content_23x5h_1", ft = "_header_23x5h_1", pt = "_root_23x5h_7", wt = "_contentAfterHeader_23x5h_22", H = {
|
|
51
|
+
content: gt,
|
|
52
|
+
header: ft,
|
|
53
|
+
root: pt,
|
|
54
|
+
contentAfterHeader: wt
|
|
55
|
+
}, V = N(
|
|
56
|
+
({ className: t, ...e }, o) => /* @__PURE__ */ i("div", { className: h(H.root, t), ref: o, ...e })
|
|
57
|
+
), Ct = N(
|
|
58
|
+
({ className: t, ignoreHeader: e, ...o }, n) => /* @__PURE__ */ i(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: h(
|
|
62
|
+
H.content,
|
|
63
|
+
!e && H.contentAfterHeader,
|
|
64
|
+
t
|
|
65
|
+
),
|
|
66
|
+
ref: n,
|
|
67
|
+
...o
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
), vt = N(
|
|
71
|
+
({ className: t, ...e }, o) => /* @__PURE__ */ i("div", { className: h(H.header, t), ref: o, ...e })
|
|
72
|
+
), eo = Object.assign(V, {
|
|
73
|
+
Content: Ct,
|
|
74
|
+
Header: vt,
|
|
75
|
+
Root: V
|
|
76
|
+
}), yt = (t, e = {}) => {
|
|
77
|
+
const {
|
|
78
|
+
enabled: o = !0,
|
|
79
|
+
preventDefault: n = !1,
|
|
80
|
+
stopPropagation: r = !1
|
|
81
|
+
} = e;
|
|
82
|
+
y(() => {
|
|
83
|
+
if (!o) return;
|
|
84
|
+
const s = (c) => {
|
|
85
|
+
n && c.preventDefault(), r && c.stopPropagation(), t.forEach((d) => d(c));
|
|
86
|
+
};
|
|
87
|
+
return window.addEventListener("keydown", s), () => {
|
|
88
|
+
window.removeEventListener("keydown", s);
|
|
89
|
+
};
|
|
90
|
+
}, [t, o, n, r]);
|
|
91
|
+
}, kt = (t, e, o = {}) => (n) => {
|
|
92
|
+
const {
|
|
93
|
+
ctrlKey: r = !1,
|
|
94
|
+
shiftKey: s = !1,
|
|
95
|
+
altKey: c = !1,
|
|
96
|
+
metaKey: d = !1
|
|
97
|
+
} = o;
|
|
98
|
+
n.key === t && n.ctrlKey === r && n.shiftKey === s && n.altKey === c && n.metaKey === d && e(n);
|
|
99
|
+
}, Nt = (t) => kt("Escape", t), xt = (t, e = !0) => (o) => {
|
|
100
|
+
if (!e || o.key !== "Tab" || !t.current) return;
|
|
101
|
+
const n = t.current.querySelectorAll(
|
|
102
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
103
|
+
), r = n[0], s = n[n.length - 1];
|
|
104
|
+
o.shiftKey ? document.activeElement === r && (o.preventDefault(), s?.focus()) : document.activeElement === s && (o.preventDefault(), r?.focus());
|
|
105
|
+
}, Tt = (t, e, o) => {
|
|
106
|
+
y(() => {
|
|
107
|
+
if (!e) return;
|
|
108
|
+
const n = (r) => {
|
|
109
|
+
r.key === "Escape" && o() && t();
|
|
110
|
+
};
|
|
111
|
+
return document.addEventListener("keydown", n), () => {
|
|
112
|
+
document.removeEventListener("keydown", n);
|
|
113
|
+
};
|
|
114
|
+
}, [t, e, o]);
|
|
115
|
+
}, Et = (t, e, o) => {
|
|
116
|
+
y(() => {
|
|
117
|
+
if (o)
|
|
118
|
+
return window.addEventListener("resize", t), window.addEventListener("scroll", e, !0), () => {
|
|
119
|
+
window.removeEventListener("resize", t), window.removeEventListener("scroll", e, !0);
|
|
120
|
+
};
|
|
121
|
+
}, [t, e, o]);
|
|
122
|
+
}, St = "_root_ibcdq_1", Dt = "_dropdownContent_ibcdq_6", Ot = "_left_ibcdq_30", $t = "_center_ibcdq_34", qt = "_right_ibcdq_39", Pt = "_top_ibcdq_43", Rt = "_bottom_ibcdq_47", Wt = "_fixedPosition_ibcdq_51", G = {
|
|
123
|
+
root: St,
|
|
124
|
+
dropdownContent: Dt,
|
|
125
|
+
left: Ot,
|
|
126
|
+
center: $t,
|
|
127
|
+
right: qt,
|
|
128
|
+
top: Pt,
|
|
129
|
+
bottom: Rt,
|
|
130
|
+
fixedPosition: Wt
|
|
131
|
+
}, Lt = (t, e, o, n = "left", r = "bottom", s = 8) => {
|
|
132
|
+
const [c, d] = O({
|
|
133
|
+
horizontal: n,
|
|
134
|
+
left: 0,
|
|
135
|
+
top: 0,
|
|
136
|
+
vertical: r
|
|
137
|
+
}), u = R(() => {
|
|
138
|
+
const _ = t.current, m = e.current;
|
|
139
|
+
if (!_ || !m) return;
|
|
140
|
+
const a = m.getBoundingClientRect(), l = _.getBoundingClientRect(), p = window.innerWidth, E = window.innerHeight, b = 16;
|
|
141
|
+
let w = r, C = n, v = 0, f = 0;
|
|
142
|
+
const W = E - a.bottom, L = a.top;
|
|
143
|
+
r === "bottom" ? W >= l.height + s + b ? (w = "bottom", v = a.bottom + s) : L >= l.height + s + b ? (w = "top", v = a.top - l.height - s) : (w = W > L ? "bottom" : "top", v = w === "bottom" ? a.bottom + s : a.top - l.height - s) : L >= l.height + s + b ? (w = "top", v = a.top - l.height - s) : W >= l.height + s + b ? (w = "bottom", v = a.bottom + s) : (w = L > W ? "top" : "bottom", v = w === "top" ? a.top - l.height - s : a.bottom + s), n === "left" ? (f = a.left, f + l.width > p - b && (f = p - l.width - b, C = "right"), f < b && (f = b, C = "left")) : n === "right" ? (f = a.right - l.width, f < b && (f = b, C = "left"), f + l.width > p - b && (f = p - l.width - b, C = "right")) : (f = a.left + (a.width - l.width) / 2, f < b ? (f = b, C = "left") : f + l.width > p - b && (f = p - l.width - b, C = "right")), v = Math.max(
|
|
144
|
+
b,
|
|
145
|
+
Math.min(v, E - l.height - b)
|
|
146
|
+
), d({
|
|
147
|
+
horizontal: C,
|
|
148
|
+
left: f,
|
|
149
|
+
top: v,
|
|
150
|
+
vertical: w
|
|
151
|
+
});
|
|
152
|
+
}, [t, e, r, n, s]);
|
|
153
|
+
return tt(() => {
|
|
154
|
+
o && u();
|
|
155
|
+
}, [o, u]), { calculatePosition: u, position: c };
|
|
156
|
+
}, q = [], It = (t, e) => (y(() => {
|
|
157
|
+
if (e && t.current)
|
|
158
|
+
return q.push(t.current), () => {
|
|
159
|
+
const n = q.indexOf(t.current);
|
|
160
|
+
n !== -1 && q.splice(n, 1);
|
|
161
|
+
};
|
|
162
|
+
}, [e, t]), { isTopOfStack: R(() => t.current ? q[q.length - 1] === t.current : !1, [t]) }), J = A(
|
|
163
|
+
void 0
|
|
164
|
+
), B = () => {
|
|
165
|
+
const t = $(J);
|
|
166
|
+
if (!t)
|
|
167
|
+
throw new Error("useDropDownContext must be used within a DropDown.Root");
|
|
168
|
+
return t;
|
|
169
|
+
}, Ht = ({
|
|
170
|
+
children: t,
|
|
171
|
+
closeOnEsc: e = !0,
|
|
172
|
+
closeOnOutsideClick: o = !0,
|
|
173
|
+
defaultVisible: n = !1
|
|
174
|
+
}) => {
|
|
175
|
+
const [r, s] = O(n), c = I(null), d = I(null), u = R(() => {
|
|
176
|
+
s(!1);
|
|
177
|
+
}, []), _ = R(() => {
|
|
178
|
+
s((a) => !a);
|
|
179
|
+
}, []), { isTopOfStack: m } = It(c, r);
|
|
180
|
+
return y(() => {
|
|
181
|
+
if (!r || !o) return;
|
|
182
|
+
const a = (l) => {
|
|
183
|
+
const p = l.target;
|
|
184
|
+
c.current && !c.current.contains(p) && d.current && !d.current.contains(p) && u();
|
|
185
|
+
};
|
|
186
|
+
return window.addEventListener("mousedown", a), () => window.removeEventListener("mousedown", a);
|
|
187
|
+
}, [r, o, u]), Tt(u, e && r, m), /* @__PURE__ */ i(
|
|
188
|
+
J.Provider,
|
|
189
|
+
{
|
|
190
|
+
value: { close: u, contentRef: d, rootRef: c, toggle: _, visible: r },
|
|
191
|
+
children: /* @__PURE__ */ i("div", { ref: c, className: G.root, children: t })
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
}, Kt = ({ children: t }) => {
|
|
195
|
+
const { toggle: e } = B();
|
|
196
|
+
return /* @__PURE__ */ i("div", { onClick: e, children: t });
|
|
197
|
+
}, Ft = ({
|
|
198
|
+
children: t,
|
|
199
|
+
className: e,
|
|
200
|
+
horizontal: o = "left",
|
|
201
|
+
offset: n = 8,
|
|
202
|
+
vertical: r = "bottom"
|
|
203
|
+
}) => {
|
|
204
|
+
const { close: s, contentRef: c, rootRef: d, visible: u } = B(), { calculatePosition: _, position: m } = Lt(
|
|
205
|
+
c,
|
|
206
|
+
d,
|
|
207
|
+
u,
|
|
208
|
+
o,
|
|
209
|
+
r,
|
|
210
|
+
n
|
|
211
|
+
);
|
|
212
|
+
return y(() => {
|
|
213
|
+
const a = c.current;
|
|
214
|
+
if (!a) return;
|
|
215
|
+
const l = new ResizeObserver(() => _());
|
|
216
|
+
return l.observe(a), () => l.disconnect();
|
|
217
|
+
}, [_, c]), Et(_, s, u), u ? et(
|
|
218
|
+
/* @__PURE__ */ i(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
ref: c,
|
|
222
|
+
className: h(G.dropdownContent, e),
|
|
223
|
+
style: {
|
|
224
|
+
left: `${m.left}px`,
|
|
225
|
+
top: `${m.top}px`
|
|
226
|
+
},
|
|
227
|
+
tabIndex: -1,
|
|
228
|
+
children: t
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
document.body
|
|
232
|
+
) : null;
|
|
233
|
+
}, At = ({ children: t, onClick: e }) => {
|
|
234
|
+
const { close: o } = B(), n = R(
|
|
235
|
+
(r) => {
|
|
236
|
+
e?.(r), o();
|
|
237
|
+
},
|
|
238
|
+
[e, o]
|
|
239
|
+
);
|
|
240
|
+
return /* @__PURE__ */ i("div", { onClick: n, children: t });
|
|
241
|
+
}, oo = { Close: At, Content: Ft, Root: Ht, Trigger: Kt }, Bt = "_dialogOverlay_1h2c4_1", Mt = "_dialogTrigger_1h2c4_13", Vt = "_dialogContent_1h2c4_21", jt = "_dialogClose_1h2c4_34", zt = "_dialogTitle_1h2c4_42", Xt = "_dialogSeparator_1h2c4_47", D = {
|
|
242
|
+
dialogOverlay: Bt,
|
|
243
|
+
dialogTrigger: Mt,
|
|
244
|
+
dialogContent: Vt,
|
|
245
|
+
dialogClose: jt,
|
|
246
|
+
dialogTitle: zt,
|
|
247
|
+
dialogSeparator: Xt
|
|
248
|
+
}, K = Z.createContext(null), Gt = ({
|
|
249
|
+
children: t,
|
|
250
|
+
isOpen: e,
|
|
251
|
+
onStateChange: o
|
|
252
|
+
}) => {
|
|
253
|
+
const n = I(null), [r, s] = O(!1), c = e !== void 0 ? e : r, d = (_) => {
|
|
254
|
+
e === void 0 && s(_), o && o(_);
|
|
255
|
+
}, u = [
|
|
256
|
+
Nt(() => d(!1)),
|
|
257
|
+
xt(n, c)
|
|
258
|
+
];
|
|
259
|
+
return yt(u, { enabled: c }), y(() => (c ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
|
|
260
|
+
document.body.style.overflow = "unset";
|
|
261
|
+
}), [c]), y(() => {
|
|
262
|
+
if (c && n.current) {
|
|
263
|
+
const m = n.current.querySelectorAll(
|
|
264
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
265
|
+
)[0];
|
|
266
|
+
m && m.focus();
|
|
267
|
+
}
|
|
268
|
+
}, [c]), /* @__PURE__ */ i(K.Provider, { value: { dialogRef: n, isOpen: c, setIsOpen: d }, children: /* @__PURE__ */ i("div", { children: t }) });
|
|
269
|
+
}, Jt = ({
|
|
270
|
+
as: t,
|
|
271
|
+
children: e,
|
|
272
|
+
...o
|
|
273
|
+
}) => {
|
|
274
|
+
const n = $(K);
|
|
275
|
+
if (!n) throw new Error("Trigger must be used within a Dialog.Root");
|
|
276
|
+
const { setIsOpen: r } = n;
|
|
277
|
+
return /* @__PURE__ */ i(
|
|
278
|
+
t || "button",
|
|
279
|
+
{
|
|
280
|
+
onClick: () => {
|
|
281
|
+
r(!0);
|
|
282
|
+
},
|
|
283
|
+
...o,
|
|
284
|
+
className: D.dialogTrigger,
|
|
285
|
+
role: t && t !== "button" ? "button" : void 0,
|
|
286
|
+
children: e
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
}, Qt = N(
|
|
290
|
+
({ children: t, classNameOverlay: e, className: o, closeOnBackdropClick: n = !0 }, r) => {
|
|
291
|
+
const s = $(K);
|
|
292
|
+
if (!s) throw new Error("Content must be used within a Dialog.Root");
|
|
293
|
+
const { dialogRef: c, isOpen: d, setIsOpen: u } = s, _ = (m) => {
|
|
294
|
+
n && m.target === m.currentTarget && u(!1);
|
|
295
|
+
};
|
|
296
|
+
return d ? /* @__PURE__ */ i(
|
|
297
|
+
"div",
|
|
298
|
+
{
|
|
299
|
+
ref: c,
|
|
300
|
+
className: h(D.dialogOverlay, e),
|
|
301
|
+
onClick: _,
|
|
302
|
+
role: "dialog",
|
|
303
|
+
"aria-modal": "true",
|
|
304
|
+
children: /* @__PURE__ */ i(
|
|
305
|
+
"div",
|
|
306
|
+
{
|
|
307
|
+
className: h(D.dialogContent, o),
|
|
308
|
+
onClick: (m) => m.stopPropagation(),
|
|
309
|
+
children: t
|
|
310
|
+
}
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
) : null;
|
|
314
|
+
}
|
|
315
|
+
), Ut = ({
|
|
316
|
+
as: t,
|
|
317
|
+
children: e,
|
|
318
|
+
...o
|
|
319
|
+
}) => {
|
|
320
|
+
const n = $(K);
|
|
321
|
+
if (!n) throw new Error("Close must be used within a Dialog.Root");
|
|
322
|
+
const { setIsOpen: r } = n;
|
|
323
|
+
return /* @__PURE__ */ i(
|
|
324
|
+
t || "button",
|
|
325
|
+
{
|
|
326
|
+
onClick: () => {
|
|
327
|
+
r(!1);
|
|
328
|
+
},
|
|
329
|
+
...o,
|
|
330
|
+
className: h(D.dialogClose, o.className),
|
|
331
|
+
role: t && t !== "button" ? "button" : void 0,
|
|
332
|
+
children: e
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
}, Yt = ({ children: t, className: e }) => /* @__PURE__ */ i("h2", { className: h(D.dialogTitle, e), children: t }), Zt = ({}) => /* @__PURE__ */ i("div", { className: D.dialogSeparator }), no = {
|
|
336
|
+
Close: Ut,
|
|
337
|
+
Content: Qt,
|
|
338
|
+
Root: Gt,
|
|
339
|
+
Separator: Zt,
|
|
340
|
+
Title: Yt,
|
|
341
|
+
Trigger: Jt
|
|
342
|
+
}, te = "_sidebar_dg2au_12", ee = "_trigger_dg2au_16", oe = "_content_dg2au_21", ne = "_left_dg2au_34", se = "_open_dg2au_38", re = "_right_dg2au_42", ce = "_bottom_dg2au_50", ie = "_top_dg2au_63", S = {
|
|
343
|
+
sidebar: te,
|
|
344
|
+
trigger: ee,
|
|
345
|
+
content: oe,
|
|
346
|
+
left: ne,
|
|
347
|
+
open: se,
|
|
348
|
+
right: re,
|
|
349
|
+
bottom: ce,
|
|
350
|
+
top: ie
|
|
351
|
+
}, Q = A(
|
|
352
|
+
void 0
|
|
353
|
+
), M = () => {
|
|
354
|
+
const t = $(Q);
|
|
355
|
+
if (!t)
|
|
356
|
+
throw new Error("useSidebarContext must be used within a SidebarProvider");
|
|
357
|
+
return t;
|
|
358
|
+
}, ae = ({ children: t, isOpen: e, setIsOpen: o }) => /* @__PURE__ */ i(
|
|
359
|
+
Q.Provider,
|
|
360
|
+
{
|
|
361
|
+
value: {
|
|
362
|
+
isOpen: e,
|
|
363
|
+
setIsOpen: () => o(!e)
|
|
364
|
+
},
|
|
365
|
+
children: t
|
|
366
|
+
}
|
|
367
|
+
), le = ({ children: t }) => {
|
|
368
|
+
const { setIsOpen: e } = M(), o = (n) => {
|
|
369
|
+
n.preventDefault(), e(!0);
|
|
370
|
+
};
|
|
371
|
+
return /* @__PURE__ */ i("div", { className: S.trigger, onClick: o, children: t });
|
|
372
|
+
}, de = ({
|
|
373
|
+
children: t,
|
|
374
|
+
className: e,
|
|
375
|
+
closeOnOutsideClick: o = !0,
|
|
376
|
+
position: n = "right"
|
|
377
|
+
}) => {
|
|
378
|
+
const { isOpen: r, setIsOpen: s } = M(), c = I(null);
|
|
379
|
+
return y(() => {
|
|
380
|
+
if (!o) return;
|
|
381
|
+
const d = (u) => {
|
|
382
|
+
c.current && !c.current.contains(u.target) && s(!1);
|
|
383
|
+
};
|
|
384
|
+
return r && document.addEventListener("mousedown", d), () => {
|
|
385
|
+
document.removeEventListener("mousedown", d);
|
|
386
|
+
};
|
|
387
|
+
}, [r, s, o]), /* @__PURE__ */ i(
|
|
388
|
+
"div",
|
|
389
|
+
{
|
|
390
|
+
ref: c,
|
|
391
|
+
className: h(
|
|
392
|
+
S[n],
|
|
393
|
+
S.content,
|
|
394
|
+
{
|
|
395
|
+
[S.close]: !r,
|
|
396
|
+
[S.open]: r
|
|
397
|
+
},
|
|
398
|
+
e
|
|
399
|
+
),
|
|
400
|
+
children: t
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
}, ue = ({ children: t }) => {
|
|
404
|
+
const { setIsOpen: e } = M(), o = (n) => {
|
|
405
|
+
n.preventDefault(), e(!1);
|
|
406
|
+
};
|
|
407
|
+
return /* @__PURE__ */ i("button", { className: S.close, onClick: o, children: t });
|
|
408
|
+
}, so = {
|
|
409
|
+
Close: ue,
|
|
410
|
+
Content: de,
|
|
411
|
+
Root: ae,
|
|
412
|
+
Trigger: le
|
|
413
|
+
}, he = "_switcher_k6tdq_1", _e = "_buttons_k6tdq_6", me = "_separator_k6tdq_10", F = {
|
|
414
|
+
switcher: he,
|
|
415
|
+
buttons: _e,
|
|
416
|
+
separator: me
|
|
417
|
+
}, ro = N(
|
|
418
|
+
({
|
|
419
|
+
className: t,
|
|
420
|
+
component: e,
|
|
421
|
+
componentValues: o,
|
|
422
|
+
containerProps: n,
|
|
423
|
+
onChange: r,
|
|
424
|
+
selectedValue: s,
|
|
425
|
+
slot: c
|
|
426
|
+
}, d) => {
|
|
427
|
+
const [u, _] = O(
|
|
428
|
+
s || o[0].value
|
|
429
|
+
), m = (a) => {
|
|
430
|
+
_(a), r && r(a);
|
|
431
|
+
};
|
|
432
|
+
return /* @__PURE__ */ k("div", { ref: d, className: F.switcher, ...n, children: [
|
|
433
|
+
/* @__PURE__ */ i("div", { className: h(F.buttons, t), children: o.map((a, l) => /* @__PURE__ */ i(
|
|
434
|
+
e,
|
|
435
|
+
{
|
|
436
|
+
...a,
|
|
437
|
+
selected: u === a.value,
|
|
438
|
+
onClick: () => m(a.value)
|
|
439
|
+
},
|
|
440
|
+
l
|
|
441
|
+
)) }),
|
|
442
|
+
c && /* @__PURE__ */ k(X, { children: [
|
|
443
|
+
/* @__PURE__ */ i("div", { className: F.separator }),
|
|
444
|
+
c
|
|
445
|
+
] })
|
|
446
|
+
] });
|
|
447
|
+
}
|
|
448
|
+
), be = "_root_1b0i5_13", ge = "_header_1b0i5_19", fe = "_footer_1b0i5_23", pe = "_row_1b0i5_28", we = "_body_1b0i5_41", Ce = "_head_1b0i5_19", ve = "_cell_1b0i5_48", ye = "_caption_1b0i5_65", ke = "_storiesFooterCellOne_1b0i5_70", Ne = "_storiesFooterCellTwo_1b0i5_73", x = {
|
|
449
|
+
root: be,
|
|
450
|
+
header: ge,
|
|
451
|
+
footer: fe,
|
|
452
|
+
row: pe,
|
|
453
|
+
body: we,
|
|
454
|
+
head: Ce,
|
|
455
|
+
cell: ve,
|
|
456
|
+
caption: ye,
|
|
457
|
+
storiesFooterCellOne: ke,
|
|
458
|
+
storiesFooterCellTwo: Ne
|
|
459
|
+
}, j = ({ children: t, className: e }) => /* @__PURE__ */ i("table", { className: h(x.root, e), children: t }), xe = ({ children: t, className: e }) => /* @__PURE__ */ i("caption", { className: h(x.caption, e), children: t }), Te = ({ children: t, className: e }) => /* @__PURE__ */ i("thead", { className: h(x.header, e), children: t }), Ee = ({
|
|
460
|
+
children: t,
|
|
461
|
+
className: e,
|
|
462
|
+
onBlur: o,
|
|
463
|
+
onClick: n,
|
|
464
|
+
onDoubleClick: r
|
|
465
|
+
}) => /* @__PURE__ */ i(
|
|
466
|
+
"tr",
|
|
467
|
+
{
|
|
468
|
+
className: h(x.row, e),
|
|
469
|
+
onClick: n,
|
|
470
|
+
onDoubleClick: r,
|
|
471
|
+
onBlur: o,
|
|
472
|
+
children: t
|
|
473
|
+
}
|
|
474
|
+
), Se = ({ children: t, className: e }) => /* @__PURE__ */ i("th", { className: h(x.head, e), children: t }), De = ({ children: t, className: e }) => /* @__PURE__ */ i("tbody", { className: h(x.body, e), children: t }), Oe = ({ children: t, className: e }) => /* @__PURE__ */ i("td", { className: h(x.cell, e), children: t }), $e = ({ children: t, className: e }) => /* @__PURE__ */ i("tfoot", { className: h(x.footer, e), children: t }), co = Object.assign(j, {
|
|
475
|
+
Body: De,
|
|
476
|
+
Caption: xe,
|
|
477
|
+
Cell: Oe,
|
|
478
|
+
Footer: $e,
|
|
479
|
+
Head: Se,
|
|
480
|
+
Header: Te,
|
|
481
|
+
Root: j,
|
|
482
|
+
Row: Ee
|
|
483
|
+
}), qe = "_inputContainer_iqbs3_1", Pe = "_input_iqbs3_1", Re = "_inputSearch_iqbs3_40", We = "_error_iqbs3_43", Le = "_button_iqbs3_58", Ie = "_buttonWithLabel_iqbs3_68", He = "_resetSearchValue_iqbs3_73", Ke = "_searchOutline_iqbs3_80", Fe = "_errorMessage_iqbs3_87", g = {
|
|
484
|
+
inputContainer: qe,
|
|
485
|
+
input: Pe,
|
|
486
|
+
inputSearch: Re,
|
|
487
|
+
error: We,
|
|
488
|
+
button: Le,
|
|
489
|
+
buttonWithLabel: Ie,
|
|
490
|
+
resetSearchValue: He,
|
|
491
|
+
searchOutline: Ke,
|
|
492
|
+
errorMessage: Fe
|
|
493
|
+
}, io = N(({ className: t, error: e, label: o, onChange: n, required: r, ...s }, c) => {
|
|
494
|
+
const [d, u] = O(!1), _ = (l) => n(l.currentTarget.value), m = h(g.input, e && g.error, t);
|
|
495
|
+
let a;
|
|
496
|
+
if (!s.as || s.as === "input") {
|
|
497
|
+
const { inputType: l, ...p } = s, E = l === "search", b = l === "password", w = d ? "text" : "password";
|
|
498
|
+
a = /* @__PURE__ */ k(X, { children: [
|
|
499
|
+
/* @__PURE__ */ i(
|
|
500
|
+
"input",
|
|
501
|
+
{
|
|
502
|
+
className: h(m, E && g.inputSearch),
|
|
503
|
+
onChange: _,
|
|
504
|
+
ref: c,
|
|
505
|
+
type: b ? w : l,
|
|
506
|
+
...p
|
|
507
|
+
}
|
|
508
|
+
),
|
|
509
|
+
b && (d ? /* @__PURE__ */ i(
|
|
510
|
+
ot,
|
|
511
|
+
{
|
|
512
|
+
strokeWidth: 2.5,
|
|
513
|
+
width: 20,
|
|
514
|
+
className: h(g.button, o && g.buttonWithLabel),
|
|
515
|
+
onClick: () => u((C) => !C)
|
|
516
|
+
}
|
|
517
|
+
) : /* @__PURE__ */ i(
|
|
518
|
+
nt,
|
|
519
|
+
{
|
|
520
|
+
strokeWidth: 2.5,
|
|
521
|
+
width: 20,
|
|
522
|
+
className: h(g.button, o && g.buttonWithLabel),
|
|
523
|
+
onClick: () => u((C) => !C)
|
|
524
|
+
}
|
|
525
|
+
)),
|
|
526
|
+
E && s.value && /* @__PURE__ */ i(
|
|
527
|
+
st,
|
|
528
|
+
{
|
|
529
|
+
onClick: () => n(""),
|
|
530
|
+
className: h(
|
|
531
|
+
g.button,
|
|
532
|
+
o && g.buttonWithLabel,
|
|
533
|
+
g.resetSearchValue
|
|
534
|
+
),
|
|
535
|
+
strokeWidth: 2.5,
|
|
536
|
+
size: 24
|
|
537
|
+
}
|
|
538
|
+
),
|
|
539
|
+
E && /* @__PURE__ */ i(
|
|
540
|
+
rt,
|
|
541
|
+
{
|
|
542
|
+
className: h(
|
|
543
|
+
g.searchOutline,
|
|
544
|
+
o && g.searchOutlineWithLabel
|
|
545
|
+
),
|
|
546
|
+
size: 20
|
|
547
|
+
}
|
|
548
|
+
)
|
|
549
|
+
] });
|
|
550
|
+
}
|
|
551
|
+
return s.as === "textarea" && (a = /* @__PURE__ */ i(
|
|
552
|
+
"textarea",
|
|
553
|
+
{
|
|
554
|
+
className: m,
|
|
555
|
+
onChange: _,
|
|
556
|
+
ref: c,
|
|
557
|
+
...s
|
|
558
|
+
}
|
|
559
|
+
)), /* @__PURE__ */ k("div", { className: g.root, children: [
|
|
560
|
+
/* @__PURE__ */ k("span", { className: g.title, children: [
|
|
561
|
+
o,
|
|
562
|
+
r && /* @__PURE__ */ i("span", { className: g.titleError, children: "*" })
|
|
563
|
+
] }),
|
|
564
|
+
/* @__PURE__ */ i("div", { className: g.inputContainer, children: a }),
|
|
565
|
+
/* @__PURE__ */ i("div", { className: g.errorMessage, children: e })
|
|
566
|
+
] });
|
|
567
|
+
}), U = A(void 0), ao = ({ children: t }) => {
|
|
568
|
+
const e = Y() || "system", [o, n] = O(e);
|
|
569
|
+
return /* @__PURE__ */ i(U.Provider, { value: { setTheme: n, theme: o }, children: t });
|
|
570
|
+
}, lo = () => {
|
|
571
|
+
const t = $(U);
|
|
572
|
+
if (!t)
|
|
573
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
574
|
+
return Ae(t.theme), t;
|
|
575
|
+
}, Ae = (t) => {
|
|
576
|
+
const e = Y();
|
|
577
|
+
Be(t || e);
|
|
578
|
+
}, Be = (t) => {
|
|
579
|
+
const e = window.matchMedia("(prefers-color-scheme: dark)");
|
|
580
|
+
if (t === "system") {
|
|
581
|
+
const o = e.matches ? "dark" : "light";
|
|
582
|
+
localStorage.setItem("theme", t), z(o);
|
|
583
|
+
} else
|
|
584
|
+
localStorage.setItem("theme", t), z(t);
|
|
585
|
+
}, z = (t) => {
|
|
586
|
+
document.documentElement.setAttribute("data-theme", t);
|
|
587
|
+
}, Y = () => {
|
|
588
|
+
const t = localStorage.getItem("theme");
|
|
589
|
+
if (t) return t;
|
|
590
|
+
}, Me = "_root_17w6h_1", Ve = "_icon_17w6h_11", je = "_active_17w6h_27", ze = "_disabled_17w6h_31", Xe = "_keybinding_17w6h_44", P = {
|
|
591
|
+
root: Me,
|
|
592
|
+
icon: Ve,
|
|
593
|
+
active: je,
|
|
594
|
+
disabled: ze,
|
|
595
|
+
keybinding: Xe
|
|
596
|
+
}, uo = N(
|
|
597
|
+
(t, e) => {
|
|
598
|
+
const { classes: o, disabled: n, icon: r, isActive: s, keybinding: c, onClick: d, title: u } = t, _ = Ge(o, s, n);
|
|
599
|
+
return /* @__PURE__ */ k("label", { className: P.root, title: u, children: [
|
|
600
|
+
/* @__PURE__ */ i(
|
|
601
|
+
"div",
|
|
602
|
+
{
|
|
603
|
+
className: _.icon,
|
|
604
|
+
ref: e,
|
|
605
|
+
tabIndex: n ? -1 : 0,
|
|
606
|
+
role: "button",
|
|
607
|
+
"aria-pressed": s,
|
|
608
|
+
"aria-disabled": n,
|
|
609
|
+
onClick: n ? void 0 : d,
|
|
610
|
+
children: r
|
|
611
|
+
}
|
|
612
|
+
),
|
|
613
|
+
c && /* @__PURE__ */ i("span", { className: _.keybinding, children: c })
|
|
614
|
+
] });
|
|
615
|
+
}
|
|
616
|
+
), Ge = (t, e, o) => ({
|
|
617
|
+
icon: h(
|
|
618
|
+
P.icon,
|
|
619
|
+
{
|
|
620
|
+
[P.active]: e,
|
|
621
|
+
[P.disabled]: o
|
|
622
|
+
},
|
|
623
|
+
t?.icon
|
|
624
|
+
),
|
|
625
|
+
keybinding: h(P.keybinding, t?.keybinding)
|
|
626
|
+
});
|
|
627
|
+
export {
|
|
628
|
+
to as B,
|
|
629
|
+
V as C,
|
|
630
|
+
oo as D,
|
|
631
|
+
Q as S,
|
|
632
|
+
co as T,
|
|
633
|
+
lo as a,
|
|
634
|
+
bt as b,
|
|
635
|
+
Ct as c,
|
|
636
|
+
vt as d,
|
|
637
|
+
eo as e,
|
|
638
|
+
no as f,
|
|
639
|
+
M as g,
|
|
640
|
+
so as h,
|
|
641
|
+
ro as i,
|
|
642
|
+
io as j,
|
|
643
|
+
uo as k,
|
|
644
|
+
ao as l,
|
|
645
|
+
yt as u
|
|
646
|
+
};
|
|
647
|
+
//# sourceMappingURL=ToolIconButton-CtrbbDcL.js.map
|