@yourbestsoft/studio-screen-ui-kit 0.0.12 → 0.0.13

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