@yourbestsoft/studio-screen-ui-kit 0.0.16 → 0.0.18

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