@yourbestsoft/studio-screen-ui-kit 0.0.14 → 0.0.15

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