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

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,981 @@
1
+ import { jsx as c, jsxs as E, Fragment as Y } from "react/jsx-runtime";
2
+ import h from "classnames";
3
+ import F, { forwardRef as S, useEffect as N, useState as $, useCallback as D, useLayoutEffect as at, createContext as Q, useRef as A, useMemo as U, useContext as R, useId as lt } from "react";
4
+ import { createPortal as ot } from "react-dom";
5
+ import { Eye as dt, EyeOff as ut, X as mt, Search as _t } from "lucide-react";
6
+ const ft = "_text_4m304_1", ht = "_tertiary_4m304_1", pt = "_secondary_4m304_1", gt = "_primary_4m304_1", bt = "_fullWidth_4m304_50", yt = "_buttonWithIcon_4m304_54", wt = "_content_4m304_61", vt = "_shortcut_4m304_70", Ct = "_disabled_4m304_82", L = {
7
+ text: ft,
8
+ tertiary: ht,
9
+ secondary: pt,
10
+ primary: gt,
11
+ fullWidth: bt,
12
+ buttonWithIcon: yt,
13
+ content: wt,
14
+ shortcut: vt,
15
+ disabled: Ct
16
+ }, kt = ({
17
+ children: t,
18
+ className: e,
19
+ component: o = "button",
20
+ disabled: n,
21
+ fullWidth: r,
22
+ icon: s,
23
+ shortcut: i,
24
+ variant: l = "primary",
25
+ ...d
26
+ }, u) => {
27
+ const a = /* @__PURE__ */ E("div", { className: L.buttonWithIcon, children: [
28
+ /* @__PURE__ */ E("div", { className: L.content, children: [
29
+ s,
30
+ t
31
+ ] }),
32
+ /* @__PURE__ */ c("div", { className: L.shortcut, children: i })
33
+ ] });
34
+ return /* @__PURE__ */ c(
35
+ o,
36
+ {
37
+ className: h(
38
+ L[l],
39
+ r && L.fullWidth,
40
+ n && L.disabled,
41
+ s && L.icon,
42
+ e
43
+ ),
44
+ children: s ? a : t,
45
+ disabled: n,
46
+ ref: u,
47
+ ...d
48
+ }
49
+ );
50
+ }, Wo = S(kt), Nt = "_content_23x5h_1", xt = "_header_23x5h_1", Tt = "_root_23x5h_7", Dt = "_contentAfterHeader_23x5h_22", M = {
51
+ content: Nt,
52
+ header: xt,
53
+ root: Tt,
54
+ contentAfterHeader: Dt
55
+ }, J = S(
56
+ ({ className: t, ...e }, o) => /* @__PURE__ */ c("div", { className: h(M.root, t), ref: o, ...e })
57
+ ), Et = S(
58
+ ({ className: t, ignoreHeader: e, ...o }, n) => /* @__PURE__ */ c(
59
+ "div",
60
+ {
61
+ className: h(
62
+ M.content,
63
+ !e && M.contentAfterHeader,
64
+ t
65
+ ),
66
+ ref: n,
67
+ ...o
68
+ }
69
+ )
70
+ ), St = S(
71
+ ({ className: t, ...e }, o) => /* @__PURE__ */ c("div", { className: h(M.header, t), ref: o, ...e })
72
+ ), Ho = Object.assign(J, {
73
+ Content: Et,
74
+ Header: St,
75
+ Root: J
76
+ }), $t = (t, e = {}) => {
77
+ const {
78
+ enabled: o = !0,
79
+ preventDefault: n = !1,
80
+ stopPropagation: r = !1
81
+ } = e;
82
+ N(() => {
83
+ if (!o) return;
84
+ const s = (i) => {
85
+ n && i.preventDefault(), r && i.stopPropagation(), t.forEach((l) => l(i));
86
+ };
87
+ return window.addEventListener("keydown", s), () => {
88
+ window.removeEventListener("keydown", s);
89
+ };
90
+ }, [t, o, n, r]);
91
+ }, It = (t, e, o = {}) => (n) => {
92
+ const {
93
+ ctrlKey: r = !1,
94
+ shiftKey: s = !1,
95
+ altKey: i = !1,
96
+ metaKey: l = !1
97
+ } = o;
98
+ n.key === t && n.ctrlKey === r && n.shiftKey === s && n.altKey === i && n.metaKey === l && e(n);
99
+ }, Lt = (t) => It("Escape", t), Pt = (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
+ }, Ot = (t, e, o) => {
106
+ N(() => {
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
+ }, Rt = (t, e, o) => {
116
+ N(() => {
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
+ }, qt = "_root_ibcdq_1", Wt = "_dropdownContent_ibcdq_6", Ht = "_left_ibcdq_30", Bt = "_center_ibcdq_34", Kt = "_right_ibcdq_39", At = "_top_ibcdq_43", Ft = "_bottom_ibcdq_47", Mt = "_fixedPosition_ibcdq_51", nt = {
123
+ root: qt,
124
+ dropdownContent: Wt,
125
+ left: Ht,
126
+ center: Bt,
127
+ right: Kt,
128
+ top: At,
129
+ bottom: Ft,
130
+ fixedPosition: Mt
131
+ }, Vt = (t, e, o, n = "left", r = "bottom", s = 8) => {
132
+ const [i, l] = $({
133
+ horizontal: n,
134
+ left: 0,
135
+ top: 0,
136
+ vertical: r
137
+ }), d = D(() => {
138
+ const u = t.current, a = e.current;
139
+ if (!u || !a) return;
140
+ const m = a.getBoundingClientRect(), _ = u.getBoundingClientRect(), g = window.innerWidth, b = window.innerHeight, f = 16;
141
+ let y = r, p = n, x = 0, v = 0;
142
+ const C = b - m.bottom, T = m.top;
143
+ r === "bottom" ? C >= _.height + s + f ? (y = "bottom", x = m.bottom + s) : T >= _.height + s + f ? (y = "top", x = m.top - _.height - s) : (y = C > T ? "bottom" : "top", x = y === "bottom" ? m.bottom + s : m.top - _.height - s) : T >= _.height + s + f ? (y = "top", x = m.top - _.height - s) : C >= _.height + s + f ? (y = "bottom", x = m.bottom + s) : (y = T > C ? "top" : "bottom", x = y === "top" ? m.top - _.height - s : m.bottom + s), n === "left" ? (v = m.left, v + _.width > g - f && (v = g - _.width - f, p = "right"), v < f && (v = f, p = "left")) : n === "right" ? (v = m.right - _.width, v < f && (v = f, p = "left"), v + _.width > g - f && (v = g - _.width - f, p = "right")) : (v = m.left + (m.width - _.width) / 2, v < f ? (v = f, p = "left") : v + _.width > g - f && (v = g - _.width - f, p = "right")), x = Math.max(
144
+ f,
145
+ Math.min(x, b - _.height - f)
146
+ ), l({
147
+ horizontal: p,
148
+ left: v,
149
+ top: x,
150
+ vertical: y
151
+ });
152
+ }, [t, e, r, n, s]);
153
+ return at(() => {
154
+ o && d();
155
+ }, [o, d]), { calculatePosition: d, position: i };
156
+ }, B = [], jt = (t, e) => (N(() => {
157
+ if (e && t.current)
158
+ return B.push(t.current), () => {
159
+ const n = B.indexOf(t.current);
160
+ n !== -1 && B.splice(n, 1);
161
+ };
162
+ }, [e, t]), { isTopOfStack: D(() => t.current ? B[B.length - 1] === t.current : !1, [t]) }), P = (t) => {
163
+ t.stopPropagation(), t.nativeEvent?.stopImmediatePropagation?.();
164
+ }, zt = (t, e) => t ? e ? `${t} ${e}` : t : e, Yt = (t, e) => t ? e ? { ...t, ...e } : t : e;
165
+ function Qt(...t) {
166
+ return (e) => {
167
+ t.forEach((o) => {
168
+ o && (typeof o == "function" ? o(e) : o.current = e);
169
+ });
170
+ };
171
+ }
172
+ const V = F.forwardRef(
173
+ ({ children: t, className: e, style: o, ...n }, r) => {
174
+ if (!F.isValidElement(t)) return null;
175
+ const s = t.props, i = { ...s, ...n };
176
+ for (const l of Object.keys(n)) {
177
+ if (!l.startsWith("on")) continue;
178
+ const d = n[l], u = s[l];
179
+ typeof d == "function" && typeof u == "function" && (i[l] = (a) => {
180
+ u(a), d(a);
181
+ });
182
+ }
183
+ return i.className = zt(s.className, e), i.style = Yt(s.style, o), i.ref = Qt(t.ref, r), F.cloneElement(t, i);
184
+ }
185
+ );
186
+ V.displayName = "Slot";
187
+ const st = Q(
188
+ void 0
189
+ ), X = () => {
190
+ const t = R(st);
191
+ if (!t)
192
+ throw new Error("useDropDownContext must be used within a DropDown.Root");
193
+ return t;
194
+ }, Ut = ({
195
+ children: t,
196
+ closeOnEsc: e = !0,
197
+ closeOnOutsideClick: o = !0,
198
+ consumeOutsideClick: n = !0,
199
+ defaultVisible: r = !1
200
+ }) => {
201
+ const [s, i] = $(r), l = A(null), d = A(null), u = D(() => i(!1), []), a = D(() => i((g) => !g), []), { isTopOfStack: m } = jt(l, s);
202
+ N(() => {
203
+ if (!s || !o) return;
204
+ const g = (b) => {
205
+ if (!m || typeof b.button == "number" && b.button !== 0) return;
206
+ const f = l.current, y = d.current, p = b.target, x = b.composedPath?.() ?? [], v = !!f && (x.includes(f) || !!p && f.contains(p)), C = !!y && (x.includes(y) || !!p && y.contains(p));
207
+ v || C || (n && (b.preventDefault(), b.stopPropagation(), b.stopImmediatePropagation?.()), u());
208
+ };
209
+ return document.addEventListener("pointerdown", g, !0), () => {
210
+ document.removeEventListener("pointerdown", g, !0);
211
+ };
212
+ }, [s, o, n, u, m]), Ot(u, e && s, m);
213
+ const _ = U(
214
+ () => ({ close: u, contentRef: d, rootRef: l, toggle: a, visible: s }),
215
+ [u, a, s]
216
+ );
217
+ return /* @__PURE__ */ c(st.Provider, { value: _, children: /* @__PURE__ */ c("div", { ref: l, className: nt.root, children: t }) });
218
+ }, Xt = ({ asChild: t = !1, children: e }) => {
219
+ const { toggle: o } = X(), n = D((i) => {
220
+ P(i);
221
+ }, []), r = D(
222
+ (i) => {
223
+ P(i), o();
224
+ },
225
+ [o]
226
+ ), s = D(
227
+ (i) => {
228
+ (i.key === "Enter" || i.key === " ") && (i.preventDefault(), P(i), o());
229
+ },
230
+ [o]
231
+ );
232
+ return t ? /* @__PURE__ */ c(V, { onPointerDown: n, onClick: r, children: e }) : /* @__PURE__ */ c(
233
+ "div",
234
+ {
235
+ role: "button",
236
+ tabIndex: 0,
237
+ onPointerDown: n,
238
+ onClick: r,
239
+ onKeyDown: s,
240
+ children: e
241
+ }
242
+ );
243
+ }, Gt = ({
244
+ asChild: t = !1,
245
+ children: e,
246
+ className: o,
247
+ horizontal: n = "left",
248
+ offset: r = 8,
249
+ vertical: s = "bottom"
250
+ }) => {
251
+ const { close: i, contentRef: l, rootRef: d, visible: u } = X(), { calculatePosition: a, position: m } = Vt(
252
+ l,
253
+ d,
254
+ u,
255
+ n,
256
+ s,
257
+ r
258
+ );
259
+ if (N(() => {
260
+ const g = l.current;
261
+ if (!g) return;
262
+ const b = new ResizeObserver(() => a());
263
+ return b.observe(g), () => b.disconnect();
264
+ }, [a]), Rt(a, i, u), !u) return null;
265
+ const _ = {
266
+ className: h(nt.dropdownContent, o),
267
+ onClick: P,
268
+ onPointerDown: P,
269
+ style: { left: `${m.left}px`, top: `${m.top}px` },
270
+ tabIndex: -1
271
+ };
272
+ return ot(
273
+ t ? /* @__PURE__ */ c(V, { ref: l, ..._, children: e }) : /* @__PURE__ */ c("div", { ref: l, ..._, children: e }),
274
+ document.body
275
+ );
276
+ }, Jt = ({ asChild: t = !1, children: e, onClick: o }) => {
277
+ const { close: n } = X(), r = D(
278
+ (s) => {
279
+ P(s), o?.(s), n();
280
+ },
281
+ [o, n]
282
+ );
283
+ return t ? /* @__PURE__ */ c(V, { onClick: r, children: e }) : /* @__PURE__ */ c("div", { onClick: r, children: e });
284
+ }, Bo = { Close: Jt, Content: Gt, Root: Ut, Trigger: Xt }, Zt = "_dialogOverlay_1h2c4_1", te = "_dialogTrigger_1h2c4_13", ee = "_dialogContent_1h2c4_21", oe = "_dialogClose_1h2c4_34", ne = "_dialogTitle_1h2c4_42", se = "_dialogSeparator_1h2c4_47", O = {
285
+ dialogOverlay: Zt,
286
+ dialogTrigger: te,
287
+ dialogContent: ee,
288
+ dialogClose: oe,
289
+ dialogTitle: ne,
290
+ dialogSeparator: se
291
+ }, j = F.createContext(null), re = ({
292
+ children: t,
293
+ isOpen: e,
294
+ onStateChange: o
295
+ }) => {
296
+ const n = A(null), [r, s] = $(!1), i = e !== void 0 ? e : r, l = (u) => {
297
+ e === void 0 && s(u), o && o(u);
298
+ }, d = [
299
+ Lt(() => l(!1)),
300
+ Pt(n, i)
301
+ ];
302
+ return $t(d, { enabled: i }), N(() => (i ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
303
+ document.body.style.overflow = "unset";
304
+ }), [i]), N(() => {
305
+ if (i && n.current) {
306
+ const a = n.current.querySelectorAll(
307
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
308
+ )[0];
309
+ a && a.focus();
310
+ }
311
+ }, [i]), /* @__PURE__ */ c(j.Provider, { value: { dialogRef: n, isOpen: i, setIsOpen: l }, children: /* @__PURE__ */ c("div", { children: t }) });
312
+ }, ie = ({
313
+ as: t,
314
+ children: e,
315
+ ...o
316
+ }) => {
317
+ const n = R(j);
318
+ if (!n) throw new Error("Trigger must be used within a Dialog.Root");
319
+ const { setIsOpen: r } = n;
320
+ return /* @__PURE__ */ c(
321
+ t || "button",
322
+ {
323
+ onClick: () => {
324
+ r(!0);
325
+ },
326
+ ...o,
327
+ className: O.dialogTrigger,
328
+ role: t && t !== "button" ? "button" : void 0,
329
+ children: e
330
+ }
331
+ );
332
+ }, ce = S(
333
+ ({ children: t, classNameOverlay: e, className: o, closeOnBackdropClick: n = !0 }, r) => {
334
+ const s = R(j);
335
+ if (!s) throw new Error("Content must be used within a Dialog.Root");
336
+ const { dialogRef: i, isOpen: l, setIsOpen: d } = s, u = (a) => {
337
+ n && a.target === a.currentTarget && d(!1);
338
+ };
339
+ return l ? /* @__PURE__ */ c(
340
+ "div",
341
+ {
342
+ ref: i,
343
+ className: h(O.dialogOverlay, e),
344
+ onClick: u,
345
+ role: "dialog",
346
+ "aria-modal": "true",
347
+ children: /* @__PURE__ */ c(
348
+ "div",
349
+ {
350
+ className: h(O.dialogContent, o),
351
+ onClick: (a) => a.stopPropagation(),
352
+ children: t
353
+ }
354
+ )
355
+ }
356
+ ) : null;
357
+ }
358
+ ), ae = ({
359
+ as: t,
360
+ children: e,
361
+ ...o
362
+ }) => {
363
+ const n = R(j);
364
+ if (!n) throw new Error("Close must be used within a Dialog.Root");
365
+ const { setIsOpen: r } = n;
366
+ return /* @__PURE__ */ c(
367
+ t || "button",
368
+ {
369
+ onClick: () => {
370
+ r(!1);
371
+ },
372
+ ...o,
373
+ className: h(O.dialogClose, o.className),
374
+ role: t && t !== "button" ? "button" : void 0,
375
+ children: e
376
+ }
377
+ );
378
+ }, le = ({ children: t, className: e }) => /* @__PURE__ */ c("h2", { className: h(O.dialogTitle, e), children: t }), de = ({}) => /* @__PURE__ */ c("div", { className: O.dialogSeparator }), Ko = {
379
+ Close: ae,
380
+ Content: ce,
381
+ Root: re,
382
+ Separator: de,
383
+ Title: le,
384
+ Trigger: ie
385
+ }, ue = "_trigger_m956w_15", me = "_toggle_m956w_24", _e = "_overlay_m956w_31", fe = "_overlayOpen_m956w_41", he = "_content_m956w_46", pe = "_left_m956w_60", ge = "_isOpen_m956w_64", be = "_right_m956w_68", ye = "_bottom_m956w_76", we = "_top_m956w_89", ve = "_closeButton_m956w_102", Ce = "_variant_navigation_m956w_111", ke = "_isClosed_m956w_117", Ne = "_layout_m956w_128", xe = "_layoutHeader_m956w_135", Te = "_layoutBody_m956w_142", De = "_layoutFooter_m956w_147", Ee = "_nav_m956w_155", Se = "_navItem_m956w_161", $e = "_navItemActive_m956w_180", Ie = "_navItemDisabled_m956w_184", Le = "_navIcon_m956w_189", Pe = "_navTitle_m956w_198", Oe = "_srOnly_m956w_221", w = {
386
+ trigger: ue,
387
+ toggle: me,
388
+ overlay: _e,
389
+ overlayOpen: fe,
390
+ content: he,
391
+ left: pe,
392
+ isOpen: ge,
393
+ right: be,
394
+ bottom: ye,
395
+ top: we,
396
+ closeButton: ve,
397
+ variant_navigation: Ce,
398
+ isClosed: ke,
399
+ layout: Ne,
400
+ layoutHeader: xe,
401
+ layoutBody: Te,
402
+ layoutFooter: De,
403
+ nav: Ee,
404
+ navItem: Se,
405
+ navItemActive: $e,
406
+ navItemDisabled: Ie,
407
+ navIcon: Le,
408
+ navTitle: Pe,
409
+ srOnly: Oe
410
+ }, q = typeof window < "u" && typeof document < "u", rt = Q(
411
+ void 0
412
+ ), W = () => {
413
+ const t = R(rt);
414
+ if (!t)
415
+ throw new Error("useSidebarContext must be used within a SidebarProvider");
416
+ return t;
417
+ }, Re = (t) => {
418
+ const [e, o] = $(!1);
419
+ return N(() => {
420
+ if (!q) return;
421
+ const n = window.matchMedia(t), r = () => o(n.matches);
422
+ return r(), typeof n.addEventListener == "function" ? (n.addEventListener("change", r), () => n.removeEventListener("change", r)) : (n.addListener(r), () => n.removeListener(r));
423
+ }, [t]), e;
424
+ }, qe = (t) => {
425
+ N(() => {
426
+ if (!q || !t) return;
427
+ const e = document.body, o = window.scrollY, n = {
428
+ left: e.style.left,
429
+ overflow: e.style.overflow,
430
+ paddingRight: e.style.paddingRight,
431
+ position: e.style.position,
432
+ right: e.style.right,
433
+ top: e.style.top,
434
+ width: e.style.width
435
+ }, r = window.innerWidth - document.documentElement.clientWidth;
436
+ 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", r > 0 && (e.style.paddingRight = `${r}px`), () => {
437
+ 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);
438
+ };
439
+ }, [t]);
440
+ }, We = (t) => {
441
+ const e = t.querySelectorAll(
442
+ [
443
+ "a[href]",
444
+ "button:not([disabled])",
445
+ "textarea:not([disabled])",
446
+ "input:not([disabled])",
447
+ "select:not([disabled])",
448
+ '[tabindex]:not([tabindex="-1"])'
449
+ ].join(",")
450
+ );
451
+ return Array.from(e).filter((o) => {
452
+ const n = window.getComputedStyle(o);
453
+ return n.visibility !== "hidden" && n.display !== "none";
454
+ });
455
+ }, He = (t, e) => {
456
+ N(() => {
457
+ if (!q || !t) return;
458
+ const o = e.current;
459
+ if (!o) return;
460
+ const n = (r) => {
461
+ if (r.key !== "Tab") return;
462
+ const s = We(o);
463
+ if (s.length === 0) {
464
+ r.preventDefault(), o.focus();
465
+ return;
466
+ }
467
+ const i = s[0], l = s[s.length - 1], d = document.activeElement;
468
+ r.shiftKey ? (!d || d === i || !o.contains(d)) && (r.preventDefault(), l.focus()) : (!d || d === l || !o.contains(d)) && (r.preventDefault(), i.focus());
469
+ };
470
+ return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
471
+ }, [t, e]);
472
+ }, Be = ({
473
+ children: t,
474
+ desktopMinWidth: e = 1024,
475
+ isOpen: o,
476
+ position: n = "right",
477
+ setIsOpen: r,
478
+ variant: s = "drawer"
479
+ }) => {
480
+ const [i, l] = $(n), d = lt();
481
+ N(() => {
482
+ l(n);
483
+ }, [n]);
484
+ const u = Re(`(min-width: ${e}px)`), a = s === "drawer" || !u;
485
+ qe(o && a);
486
+ const m = A(null);
487
+ N(() => {
488
+ if (!q || !a) return;
489
+ if (o) {
490
+ m.current = document.activeElement;
491
+ return;
492
+ }
493
+ const p = m.current;
494
+ p && typeof p.focus == "function" && p.focus(), m.current = null;
495
+ }, [o, a]);
496
+ const _ = D(
497
+ (p) => {
498
+ r(p);
499
+ },
500
+ [r]
501
+ ), g = D(() => r(!0), [r]), b = D(() => r(!1), [r]), f = D(() => r((p) => !p), [r]), y = U(
502
+ () => ({
503
+ close: b,
504
+ contentId: d,
505
+ desktopMinWidth: e,
506
+ isDesktop: u,
507
+ isOpen: o,
508
+ open: g,
509
+ position: i,
510
+ setOpen: _,
511
+ setPosition: l,
512
+ toggle: f,
513
+ variant: s
514
+ }),
515
+ [
516
+ b,
517
+ d,
518
+ e,
519
+ u,
520
+ o,
521
+ g,
522
+ i,
523
+ _,
524
+ f,
525
+ s
526
+ ]
527
+ );
528
+ return /* @__PURE__ */ c(rt.Provider, { value: y, children: t });
529
+ }, Ke = ({ children: t, className: e }) => {
530
+ const { contentId: o, isOpen: n, open: r } = W();
531
+ return /* @__PURE__ */ c(
532
+ "button",
533
+ {
534
+ type: "button",
535
+ className: h(w.trigger, e),
536
+ onClick: r,
537
+ "aria-haspopup": "dialog",
538
+ "aria-controls": o,
539
+ "aria-expanded": n,
540
+ children: t
541
+ }
542
+ );
543
+ }, Ae = ({ children: t, className: e }) => {
544
+ const { contentId: o, isOpen: n, toggle: r } = W();
545
+ return /* @__PURE__ */ c(
546
+ "button",
547
+ {
548
+ type: "button",
549
+ className: h(w.toggle, e),
550
+ onClick: r,
551
+ "aria-controls": o,
552
+ "aria-expanded": n,
553
+ children: t
554
+ }
555
+ );
556
+ }, Fe = ({
557
+ children: t,
558
+ className: e,
559
+ closeOnClick: o = !0
560
+ }) => {
561
+ const { close: n, isDesktop: r, isOpen: s, position: i, variant: l } = W(), d = l === "drawer" || !r;
562
+ if (!q || !d) return null;
563
+ const u = /* @__PURE__ */ c(
564
+ "div",
565
+ {
566
+ className: h(
567
+ w.overlay,
568
+ w[`overlay_${i}`],
569
+ { [w.overlayOpen]: s },
570
+ e
571
+ ),
572
+ onMouseDown: (a) => {
573
+ o && a.target === a.currentTarget && (a.preventDefault(), n());
574
+ },
575
+ "aria-hidden": !s,
576
+ children: t
577
+ }
578
+ );
579
+ return ot(u, document.body);
580
+ }, Z = (t) => {
581
+ if (t !== void 0)
582
+ return typeof t == "number" ? `${t}px` : t;
583
+ }, Me = ({
584
+ children: t,
585
+ className: e,
586
+ closeOnEsc: o = !0,
587
+ closeOnOutsideClick: n = !0,
588
+ collapsedWidth: r,
589
+ position: s,
590
+ width: i
591
+ }) => {
592
+ const {
593
+ close: l,
594
+ contentId: d,
595
+ isDesktop: u,
596
+ isOpen: a,
597
+ position: m,
598
+ setPosition: _,
599
+ variant: g
600
+ } = W(), b = s ?? m, f = g === "drawer" || !u, y = A(null);
601
+ N(() => {
602
+ _(b);
603
+ }, [b, _]), N(() => {
604
+ if (!o || !a || !f) return;
605
+ const C = (T) => {
606
+ T.key === "Escape" && l();
607
+ };
608
+ return document.addEventListener("keydown", C), () => document.removeEventListener("keydown", C);
609
+ }, [a, o, l, f]), N(() => {
610
+ if (!n || !a || !f || !q) return;
611
+ const C = (T) => {
612
+ if ("button" in T && typeof T.button == "number" && T.button !== 0)
613
+ return;
614
+ const H = y.current, G = T.target;
615
+ !H || !G || H.contains(G) || l();
616
+ };
617
+ return document.addEventListener("pointerdown", C), () => document.removeEventListener("pointerdown", C);
618
+ }, [n, a, f, l]), He(
619
+ a && f,
620
+ y
621
+ ), N(() => {
622
+ a && f && y.current?.focus();
623
+ }, [a, f]);
624
+ const p = U(() => {
625
+ const C = {}, T = Z(i), H = Z(r);
626
+ return T && (C["--sidebar-width"] = T), H && (C["--sidebar-collapsed-width"] = H), C;
627
+ }, [i, r]), x = f ? a ? t : null : t, v = h(
628
+ w.content,
629
+ w[b],
630
+ w[`variant_${g}`],
631
+ { [w.isClosed]: !a, [w.isOpen]: a },
632
+ e
633
+ );
634
+ return f ? /* @__PURE__ */ c(
635
+ "div",
636
+ {
637
+ id: d,
638
+ ref: (C) => {
639
+ y.current = C;
640
+ },
641
+ tabIndex: -1,
642
+ role: "dialog",
643
+ "aria-modal": "true",
644
+ "aria-hidden": !a,
645
+ style: p,
646
+ className: v,
647
+ children: x
648
+ }
649
+ ) : /* @__PURE__ */ c(
650
+ "aside",
651
+ {
652
+ id: d,
653
+ ref: (C) => {
654
+ y.current = C;
655
+ },
656
+ style: p,
657
+ className: v,
658
+ children: x
659
+ }
660
+ );
661
+ }, Ve = ({ children: t, className: e }) => {
662
+ const { close: o } = W();
663
+ return /* @__PURE__ */ c(
664
+ "button",
665
+ {
666
+ type: "button",
667
+ className: h(w.closeButton, e),
668
+ onClick: o,
669
+ children: t
670
+ }
671
+ );
672
+ }, je = ({
673
+ children: t,
674
+ className: e,
675
+ footer: o,
676
+ header: n
677
+ }) => /* @__PURE__ */ E("div", { className: h(w.layout, e), children: [
678
+ n ? /* @__PURE__ */ c("div", { className: w.layoutHeader, children: n }) : null,
679
+ /* @__PURE__ */ c("div", { className: w.layoutBody, children: t }),
680
+ o ? /* @__PURE__ */ c("div", { className: w.layoutFooter, children: o }) : null
681
+ ] }), ze = ({
682
+ "aria-label": t = "Sidebar navigation",
683
+ children: e,
684
+ className: o
685
+ }) => /* @__PURE__ */ c("nav", { className: h(w.nav, o), "aria-label": t, children: e }), Ye = ({
686
+ active: t,
687
+ className: e,
688
+ disabled: o,
689
+ href: n,
690
+ icon: r,
691
+ onClick: s,
692
+ title: i
693
+ }) => {
694
+ const { isDesktop: l, isOpen: d, variant: u } = W(), a = u === "navigation" && l && !d, m = h(
695
+ w.navItem,
696
+ { [w.navItemActive]: !!t, [w.navItemDisabled]: !!o },
697
+ e
698
+ ), _ = /* @__PURE__ */ E(Y, { children: [
699
+ /* @__PURE__ */ c("span", { className: w.navIcon, "aria-hidden": "true", children: r }),
700
+ /* @__PURE__ */ E("span", { className: w.navTitle, children: [
701
+ i,
702
+ a ? /* @__PURE__ */ c("span", { className: w.srOnly, children: i }) : null
703
+ ] })
704
+ ] });
705
+ return n ? /* @__PURE__ */ c(
706
+ "a",
707
+ {
708
+ className: m,
709
+ href: n,
710
+ "aria-current": t ? "page" : void 0,
711
+ "aria-label": a ? i : void 0,
712
+ title: a ? i : void 0,
713
+ onClick: (g) => {
714
+ if (o) {
715
+ g.preventDefault();
716
+ return;
717
+ }
718
+ s?.();
719
+ },
720
+ children: _
721
+ }
722
+ ) : /* @__PURE__ */ c(
723
+ "button",
724
+ {
725
+ type: "button",
726
+ className: m,
727
+ disabled: o,
728
+ "aria-current": t ? "page" : void 0,
729
+ "aria-label": a ? i : void 0,
730
+ title: a ? i : void 0,
731
+ onClick: () => {
732
+ o || s?.();
733
+ },
734
+ children: _
735
+ }
736
+ );
737
+ }, Ao = {
738
+ Close: Ve,
739
+ Content: Me,
740
+ Layout: je,
741
+ Nav: ze,
742
+ NavItem: Ye,
743
+ Overlay: Fe,
744
+ Root: Be,
745
+ Toggle: Ae,
746
+ Trigger: Ke
747
+ }, Qe = "_switcher_k6tdq_1", Ue = "_buttons_k6tdq_6", Xe = "_separator_k6tdq_10", z = {
748
+ switcher: Qe,
749
+ buttons: Ue,
750
+ separator: Xe
751
+ }, Fo = S(
752
+ ({
753
+ className: t,
754
+ component: e,
755
+ componentValues: o,
756
+ containerProps: n,
757
+ onChange: r,
758
+ selectedValue: s,
759
+ slot: i
760
+ }, l) => {
761
+ const [d, u] = $(
762
+ s || o[0].value
763
+ ), a = (m) => {
764
+ u(m), r && r(m);
765
+ };
766
+ return /* @__PURE__ */ E("div", { ref: l, className: z.switcher, ...n, children: [
767
+ /* @__PURE__ */ c("div", { className: h(z.buttons, t), children: o.map((m, _) => /* @__PURE__ */ c(
768
+ e,
769
+ {
770
+ ...m,
771
+ selected: d === m.value,
772
+ onClick: () => a(m.value)
773
+ },
774
+ _
775
+ )) }),
776
+ i && /* @__PURE__ */ E(Y, { children: [
777
+ /* @__PURE__ */ c("div", { className: z.separator }),
778
+ i
779
+ ] })
780
+ ] });
781
+ }
782
+ ), Ge = "_root_1b0i5_13", Je = "_header_1b0i5_19", Ze = "_footer_1b0i5_23", to = "_row_1b0i5_28", eo = "_body_1b0i5_41", oo = "_head_1b0i5_19", no = "_cell_1b0i5_48", so = "_caption_1b0i5_65", ro = "_storiesFooterCellOne_1b0i5_70", io = "_storiesFooterCellTwo_1b0i5_73", I = {
783
+ root: Ge,
784
+ header: Je,
785
+ footer: Ze,
786
+ row: to,
787
+ body: eo,
788
+ head: oo,
789
+ cell: no,
790
+ caption: so,
791
+ storiesFooterCellOne: ro,
792
+ storiesFooterCellTwo: io
793
+ }, tt = ({ children: t, className: e }) => /* @__PURE__ */ c("table", { className: h(I.root, e), children: t }), co = ({ children: t, className: e }) => /* @__PURE__ */ c("caption", { className: h(I.caption, e), children: t }), ao = ({ children: t, className: e }) => /* @__PURE__ */ c("thead", { className: h(I.header, e), children: t }), lo = ({
794
+ children: t,
795
+ className: e,
796
+ onBlur: o,
797
+ onClick: n,
798
+ onDoubleClick: r
799
+ }) => /* @__PURE__ */ c(
800
+ "tr",
801
+ {
802
+ className: h(I.row, e),
803
+ onClick: n,
804
+ onDoubleClick: r,
805
+ onBlur: o,
806
+ children: t
807
+ }
808
+ ), uo = ({ children: t, className: e }) => /* @__PURE__ */ c("th", { className: h(I.head, e), children: t }), mo = ({ children: t, className: e }) => /* @__PURE__ */ c("tbody", { className: h(I.body, e), children: t }), _o = ({ children: t, className: e }) => /* @__PURE__ */ c("td", { className: h(I.cell, e), children: t }), fo = ({ children: t, className: e }) => /* @__PURE__ */ c("tfoot", { className: h(I.footer, e), children: t }), Mo = Object.assign(tt, {
809
+ Body: mo,
810
+ Caption: co,
811
+ Cell: _o,
812
+ Footer: fo,
813
+ Head: uo,
814
+ Header: ao,
815
+ Root: tt,
816
+ Row: lo
817
+ }), ho = "_inputContainer_iqbs3_1", po = "_input_iqbs3_1", go = "_inputSearch_iqbs3_40", bo = "_error_iqbs3_43", yo = "_button_iqbs3_58", wo = "_buttonWithLabel_iqbs3_68", vo = "_resetSearchValue_iqbs3_73", Co = "_searchOutline_iqbs3_80", ko = "_errorMessage_iqbs3_87", k = {
818
+ inputContainer: ho,
819
+ input: po,
820
+ inputSearch: go,
821
+ error: bo,
822
+ button: yo,
823
+ buttonWithLabel: wo,
824
+ resetSearchValue: vo,
825
+ searchOutline: Co,
826
+ errorMessage: ko
827
+ }, Vo = S(({ className: t, error: e, label: o, onChange: n, required: r, ...s }, i) => {
828
+ const [l, d] = $(!1), u = (_) => n(_.currentTarget.value), a = h(k.input, e && k.error, t);
829
+ let m;
830
+ if (!s.as || s.as === "input") {
831
+ const { inputType: _, ...g } = s, b = _ === "search", f = _ === "password", y = l ? "text" : "password";
832
+ m = /* @__PURE__ */ E(Y, { children: [
833
+ /* @__PURE__ */ c(
834
+ "input",
835
+ {
836
+ className: h(a, b && k.inputSearch),
837
+ onChange: u,
838
+ ref: i,
839
+ type: f ? y : _,
840
+ ...g
841
+ }
842
+ ),
843
+ f && (l ? /* @__PURE__ */ c(
844
+ dt,
845
+ {
846
+ strokeWidth: 2.5,
847
+ width: 20,
848
+ className: h(k.button, o && k.buttonWithLabel),
849
+ onClick: () => d((p) => !p)
850
+ }
851
+ ) : /* @__PURE__ */ c(
852
+ ut,
853
+ {
854
+ strokeWidth: 2.5,
855
+ width: 20,
856
+ className: h(k.button, o && k.buttonWithLabel),
857
+ onClick: () => d((p) => !p)
858
+ }
859
+ )),
860
+ b && s.value && /* @__PURE__ */ c(
861
+ mt,
862
+ {
863
+ onClick: () => n(""),
864
+ className: h(
865
+ k.button,
866
+ o && k.buttonWithLabel,
867
+ k.resetSearchValue
868
+ ),
869
+ strokeWidth: 2.5,
870
+ size: 24
871
+ }
872
+ ),
873
+ b && /* @__PURE__ */ c(
874
+ _t,
875
+ {
876
+ className: h(
877
+ k.searchOutline,
878
+ o && k.searchOutlineWithLabel
879
+ ),
880
+ size: 20
881
+ }
882
+ )
883
+ ] });
884
+ }
885
+ return s.as === "textarea" && (m = /* @__PURE__ */ c(
886
+ "textarea",
887
+ {
888
+ className: a,
889
+ onChange: u,
890
+ ref: i,
891
+ ...s
892
+ }
893
+ )), /* @__PURE__ */ E("div", { className: k.root, children: [
894
+ /* @__PURE__ */ E("span", { className: k.title, children: [
895
+ o,
896
+ r && /* @__PURE__ */ c("span", { className: k.titleError, children: "*" })
897
+ ] }),
898
+ /* @__PURE__ */ c("div", { className: k.inputContainer, children: m }),
899
+ /* @__PURE__ */ c("div", { className: k.errorMessage, children: e })
900
+ ] });
901
+ }), it = Q(void 0), jo = ({ children: t }) => {
902
+ const e = ct() || "system", [o, n] = $(e);
903
+ return /* @__PURE__ */ c(it.Provider, { value: { setTheme: n, theme: o }, children: t });
904
+ }, zo = () => {
905
+ const t = R(it);
906
+ if (!t)
907
+ throw new Error("useTheme must be used within a ThemeProvider");
908
+ return No(t.theme), t;
909
+ }, No = (t) => {
910
+ const e = ct();
911
+ xo(t || e);
912
+ }, xo = (t) => {
913
+ const e = window.matchMedia("(prefers-color-scheme: dark)");
914
+ if (t === "system") {
915
+ const o = e.matches ? "dark" : "light";
916
+ localStorage.setItem("theme", t), et(o);
917
+ } else
918
+ localStorage.setItem("theme", t), et(t);
919
+ }, et = (t) => {
920
+ document.documentElement.setAttribute("data-theme", t);
921
+ }, ct = () => {
922
+ const t = localStorage.getItem("theme");
923
+ if (t) return t;
924
+ }, To = "_root_17w6h_1", Do = "_icon_17w6h_11", Eo = "_active_17w6h_27", So = "_disabled_17w6h_31", $o = "_keybinding_17w6h_44", K = {
925
+ root: To,
926
+ icon: Do,
927
+ active: Eo,
928
+ disabled: So,
929
+ keybinding: $o
930
+ }, Yo = S(
931
+ (t, e) => {
932
+ const { classes: o, disabled: n, icon: r, isActive: s, keybinding: i, onClick: l, title: d } = t, u = Io(o, s, n);
933
+ return /* @__PURE__ */ E("label", { className: K.root, title: d, children: [
934
+ /* @__PURE__ */ c(
935
+ "div",
936
+ {
937
+ className: u.icon,
938
+ ref: e,
939
+ tabIndex: n ? -1 : 0,
940
+ role: "button",
941
+ "aria-pressed": s,
942
+ "aria-disabled": n,
943
+ onClick: n ? void 0 : l,
944
+ children: r
945
+ }
946
+ ),
947
+ i && /* @__PURE__ */ c("span", { className: u.keybinding, children: i })
948
+ ] });
949
+ }
950
+ ), Io = (t, e, o) => ({
951
+ icon: h(
952
+ K.icon,
953
+ {
954
+ [K.active]: e,
955
+ [K.disabled]: o
956
+ },
957
+ t?.icon
958
+ ),
959
+ keybinding: h(K.keybinding, t?.keybinding)
960
+ });
961
+ export {
962
+ Wo as B,
963
+ J as C,
964
+ Bo as D,
965
+ rt as S,
966
+ Mo as T,
967
+ zo as a,
968
+ kt as b,
969
+ Et as c,
970
+ St as d,
971
+ Ho as e,
972
+ Ko as f,
973
+ W as g,
974
+ Ao as h,
975
+ Fo as i,
976
+ Vo as j,
977
+ Yo as k,
978
+ jo as l,
979
+ $t as u
980
+ };
981
+ //# sourceMappingURL=ToolIconButton-Uf4-mshy.js.map