@yourbestsoft/studio-screen-ui-kit 0.0.1

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.
Files changed (76) hide show
  1. package/README.md +1 -0
  2. package/dist/App.d.ts +1 -0
  3. package/dist/ToolIconButton-Be6zefbX.js +520 -0
  4. package/dist/ToolIconButton-Be6zefbX.js.map +1 -0
  5. package/dist/components/button/Button.d.ts +26 -0
  6. package/dist/components/button/index.d.ts +1 -0
  7. package/dist/components/buttons-group/ButtonsGroup.d.ts +14 -0
  8. package/dist/components/buttons-group/index.d.ts +1 -0
  9. package/dist/components/card/Card.d.ts +17 -0
  10. package/dist/components/card/index.d.ts +1 -0
  11. package/dist/components/color-button/ColorButton.d.ts +10 -0
  12. package/dist/components/color-button/index.d.ts +1 -0
  13. package/dist/components/color-picker/ColorPicker.d.ts +9 -0
  14. package/dist/components/color-picker/colors.d.ts +2 -0
  15. package/dist/components/color-picker/hooks/usePalette.d.ts +18 -0
  16. package/dist/components/color-picker/hooks/usePaletteControls.d.ts +8 -0
  17. package/dist/components/color-picker/index.d.ts +1 -0
  18. package/dist/components/color-picker/parts/hex-input/HexInput.d.ts +9 -0
  19. package/dist/components/color-picker/parts/palette/Palette.d.ts +8 -0
  20. package/dist/components/color-picker/parts/shadow-list/ShadesList.d.ts +9 -0
  21. package/dist/components/color-picker/types.d.ts +9 -0
  22. package/dist/components/dialog/Dialog.d.ts +34 -0
  23. package/dist/components/dialog/index.d.ts +1 -0
  24. package/dist/components/drop-down/DropDown.d.ts +23 -0
  25. package/dist/components/drop-down/index.d.ts +1 -0
  26. package/dist/components/icon-button/IconButton.d.ts +10 -0
  27. package/dist/components/icon-button/index.d.ts +1 -0
  28. package/dist/components/index.d.ts +19 -0
  29. package/dist/components/pagination/Pagination.d.ts +9 -0
  30. package/dist/components/pagination/index.d.ts +1 -0
  31. package/dist/components/pagination/utils/getPagesArray.d.ts +6 -0
  32. package/dist/components/pagination/utils/getPagesArray.test.d.ts +1 -0
  33. package/dist/components/select/Select.d.ts +20 -0
  34. package/dist/components/select/index.d.ts +1 -0
  35. package/dist/components/shortcut/Shortcut.d.ts +22 -0
  36. package/dist/components/shortcut/index.d.ts +1 -0
  37. package/dist/components/sidebar/Sidebar.d.ts +31 -0
  38. package/dist/components/sidebar/index.d.ts +1 -0
  39. package/dist/components/slider/Slider.d.ts +9 -0
  40. package/dist/components/slider/index.d.ts +1 -0
  41. package/dist/components/switcher-buttons/SwitcherButtons.d.ts +17 -0
  42. package/dist/components/switcher-buttons/index.d.ts +1 -0
  43. package/dist/components/table/Table.d.ts +33 -0
  44. package/dist/components/table/index.d.ts +1 -0
  45. package/dist/components/text-field/index.d.ts +1 -0
  46. package/dist/components/text-field/text-field.d.ts +33 -0
  47. package/dist/components/theme-switcher/ThemeSwitcher.d.ts +1 -0
  48. package/dist/components/theme-switcher/index.d.ts +1 -0
  49. package/dist/components/toggle-switch/ToggleSwitch.d.ts +14 -0
  50. package/dist/components/toggle-switch/index.d.ts +1 -0
  51. package/dist/components/toolbar/Toolbar.d.ts +13 -0
  52. package/dist/components/toolbar/index.d.ts +2 -0
  53. package/dist/components/toolbar/tool-icon-button/ToolIconButton.d.ts +20 -0
  54. package/dist/components/toolbar/tool-icon-button/index.d.ts +1 -0
  55. package/dist/features/card-collection/CardCollection.d.ts +15 -0
  56. package/dist/features/card-collection/index.d.ts +1 -0
  57. package/dist/features/index.d.ts +3 -0
  58. package/dist/features/save-modal/SaveModal.d.ts +6 -0
  59. package/dist/features/save-modal/index.d.ts +1 -0
  60. package/dist/features/theme-provider/ThemeProvider.d.ts +12 -0
  61. package/dist/features/theme-provider/index.d.ts +1 -0
  62. package/dist/hooks/index.d.ts +2 -0
  63. package/dist/hooks/useKeyboardControls.d.ts +3 -0
  64. package/dist/hooks/useSelect.d.ts +17 -0
  65. package/dist/index.js +821 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/index2.js +102 -0
  68. package/dist/index2.js.map +1 -0
  69. package/dist/main.d.ts +1 -0
  70. package/dist/style.css +1 -0
  71. package/dist/utils/colorUtils.d.ts +2 -0
  72. package/dist/utils/fileUtils.d.ts +3 -0
  73. package/dist/utils/index.d.ts +3 -0
  74. package/dist/utils/typeUtils.d.ts +1 -0
  75. package/dist/vite.svg +1 -0
  76. package/package.json +80 -0
package/dist/index.js ADDED
@@ -0,0 +1,821 @@
1
+ import { D as H, B as F, u as J } from "./ToolIconButton-Be6zefbX.js";
2
+ import { a as an, d as ln, b as rn, c as dn, C as hn, e as _n, g as un, S as mn, h as pn, T as gn, i as fn, j as yn, f as kn } from "./ToolIconButton-Be6zefbX.js";
3
+ import { jsx as s, jsxs as g, Fragment as Q } from "react/jsx-runtime";
4
+ import m from "classnames";
5
+ import { useState as k, useEffect as K, useCallback as M, useRef as G } from "react";
6
+ import { ClipboardCopy as X, ChevronLeft as Y, ChevronRight as Z, ChevronDown as ee, Sun as te, Moon as ne, Computer as oe } from "lucide-react";
7
+ const se = "_buttonGroup_ejhd6_1", ce = "_button_ejhd6_1", ae = "_label_ejhd6_37", le = "_single_ejhd6_42", ie = "_first_ejhd6_46", re = "_last_ejhd6_50", de = "_selected_ejhd6_54", B = {
8
+ buttonGroup: se,
9
+ button: ce,
10
+ label: ae,
11
+ single: le,
12
+ first: ie,
13
+ last: re,
14
+ selected: de
15
+ }, Jt = ({ buttons: n, className: o }) => /* @__PURE__ */ s("div", { className: m(B.buttonGroup, o), children: n.map((t, e) => {
16
+ const a = n.length === 1, l = e === 0 && !a, c = e === n.length - 1 && !a;
17
+ return /* @__PURE__ */ g(
18
+ "button",
19
+ {
20
+ onClick: t.onClick,
21
+ disabled: t.disabled,
22
+ className: m(B.button, {
23
+ [B.first]: l,
24
+ [B.last]: c,
25
+ [B.selected]: t.selected,
26
+ [B.single]: a
27
+ }),
28
+ ...t,
29
+ children: [
30
+ t.icon && t.icon,
31
+ t.label && /* @__PURE__ */ s("span", { className: B.label, children: t.label })
32
+ ]
33
+ },
34
+ e
35
+ );
36
+ }) }), he = (n, o, t, e) => [
37
+ Math.min(255, Math.round(n + (255 - n) * e)),
38
+ Math.min(255, Math.round(o + (255 - o) * e)),
39
+ Math.min(255, Math.round(t + (255 - t) * e))
40
+ ], O = (n, o) => {
41
+ if (o === 5 || n === "transparent" || n === "#ffffff" || n === "#1e1e1e")
42
+ return n;
43
+ const [t, e, a] = q(n), l = (5 - o) * 0.2, [c, i, h] = he(t, e, a, l);
44
+ return _e(c, i, h);
45
+ }, q = (n) => {
46
+ const o = n.replace("#", ""), t = parseInt(o, 16);
47
+ return [t >> 16 & 255, t >> 8 & 255, t & 255];
48
+ }, _e = (n, o, t) => "#" + [n, o, t].map((e) => {
49
+ const a = e.toString(16);
50
+ return a.length === 1 ? "0" + a : a;
51
+ }).join(""), ue = (n) => {
52
+ if (n === "transparent")
53
+ return "#000";
54
+ const [o, t, e] = q(n);
55
+ return (o * 299 + t * 587 + e * 114) / 1e3 > 128 ? "#000" : "#fff";
56
+ }, me = "_colorButton_wldf2_1", pe = "_hotkey_wldf2_22", ge = "_selected_wldf2_26", fe = "_disabled_wldf2_33", ye = "_transparent_wldf2_41", ke = "_small_wldf2_46", be = "_medium_wldf2_52", ve = "_large_wldf2_58", I = {
57
+ colorButton: me,
58
+ hotkey: pe,
59
+ selected: ge,
60
+ disabled: fe,
61
+ transparent: ye,
62
+ small: ke,
63
+ medium: be,
64
+ large: ve
65
+ }, P = (n) => {
66
+ const {
67
+ className: o,
68
+ color: t,
69
+ disabled: e,
70
+ hotkey: a,
71
+ selected: l,
72
+ size: c = "small",
73
+ ...i
74
+ } = n;
75
+ return /* @__PURE__ */ s(
76
+ "button",
77
+ {
78
+ className: m(
79
+ I.colorButton,
80
+ I[c],
81
+ e && I.disabled,
82
+ l && I.selected,
83
+ t === "transparent" && I.transparent,
84
+ o
85
+ ),
86
+ style: { "--swatch-color": t },
87
+ disabled: e,
88
+ ...i,
89
+ children: /* @__PURE__ */ s("p", { className: I.hotkey, style: { color: ue(t) }, children: a })
90
+ }
91
+ );
92
+ }, we = "_content_1ybrq_1", Ce = "_section_1ybrq_11", Ne = "_title_1ybrq_17", S = {
93
+ content: we,
94
+ section: Ce,
95
+ title: Ne
96
+ }, xe = [
97
+ {
98
+ color: "transparent",
99
+ hotkey: "q",
100
+ name: "transparent"
101
+ },
102
+ {
103
+ color: "#ffffff",
104
+ hotkey: "w",
105
+ name: "white"
106
+ },
107
+ {
108
+ color: "#343a40",
109
+ hotkey: "e",
110
+ name: "gray"
111
+ },
112
+ {
113
+ color: "#1e1e1e",
114
+ hotkey: "r",
115
+ name: "black"
116
+ },
117
+ {
118
+ color: "#846358",
119
+ hotkey: "t",
120
+ name: "bronze"
121
+ },
122
+ {
123
+ color: "#0c8599",
124
+ hotkey: "a",
125
+ name: "cyan"
126
+ },
127
+ {
128
+ color: "#1971c2",
129
+ hotkey: "s",
130
+ name: "blue"
131
+ },
132
+ {
133
+ color: "#6741d9",
134
+ hotkey: "d",
135
+ name: "violet"
136
+ },
137
+ {
138
+ color: "#9c36b5",
139
+ hotkey: "f",
140
+ name: "grape"
141
+ },
142
+ {
143
+ color: "#c2255c",
144
+ hotkey: "g",
145
+ name: "pink"
146
+ },
147
+ {
148
+ color: "#2f9e44",
149
+ hotkey: "z",
150
+ name: "green"
151
+ },
152
+ {
153
+ color: "#099268",
154
+ hotkey: "x",
155
+ name: "teal"
156
+ },
157
+ {
158
+ color: "#f08c00",
159
+ hotkey: "c",
160
+ name: "yellow"
161
+ },
162
+ {
163
+ color: "#e8590c",
164
+ hotkey: "v",
165
+ name: "orange"
166
+ },
167
+ {
168
+ color: "#e03131",
169
+ hotkey: "b",
170
+ name: "red"
171
+ }
172
+ ], Be = ({
173
+ colors: n,
174
+ selectedColor: o,
175
+ selectedShadeIndex: t
176
+ }) => {
177
+ const [e, a] = k(t), [l, c] = k(
178
+ () => j(n, t)
179
+ ), [i, h] = k(() => ({
180
+ ...o ?? { ...n[0], index: 0 },
181
+ index: o?.index ?? 0
182
+ })), r = (_) => {
183
+ const u = j(n, _);
184
+ console.log(u), c(u), h(Se(u, i));
185
+ }, d = (_, u = 999) => {
186
+ h({ ...W(_, e), index: u });
187
+ };
188
+ return K(() => {
189
+ r(e);
190
+ }, [e, n, i.index]), {
191
+ activeColor: i,
192
+ activeShade: e,
193
+ palette: l,
194
+ setActiveColorHandler: d,
195
+ setActiveShade: a
196
+ };
197
+ }, W = (n, o) => ({
198
+ ...n,
199
+ color: O(n.color, o)
200
+ }), j = (n, o) => n.map((t) => W(t, o)), Se = (n, o) => ({
201
+ ...n[o.index] ?? n[0],
202
+ index: o.index ?? 0
203
+ }), Ie = ({
204
+ onSelect: n,
205
+ options: o,
206
+ selectedId: t
207
+ }) => {
208
+ const [e, a] = k(!1), [l, c] = k(null), [i, h] = k(
209
+ t && o.find((u) => u.value === t) || null
210
+ );
211
+ K(() => {
212
+ if (t) {
213
+ const u = o.find((f) => f.value === t);
214
+ h(u || null);
215
+ }
216
+ }, [t, o]);
217
+ const r = M(
218
+ (u) => {
219
+ h(u), n && n(u.value), a(!1), c(null);
220
+ },
221
+ [n]
222
+ ), d = M(
223
+ (u) => {
224
+ if (!e) {
225
+ (u.key === "Enter" || u.key === " ") && (a(!0), c(0));
226
+ return;
227
+ }
228
+ switch (u.key) {
229
+ case "ArrowDown": {
230
+ c(
231
+ (f) => f === null ? 0 : Math.min(f + 1, o.length - 1)
232
+ );
233
+ break;
234
+ }
235
+ case "ArrowUp": {
236
+ c(
237
+ (f) => f === null ? o.length - 1 : Math.max(f - 1, 0)
238
+ );
239
+ break;
240
+ }
241
+ case "Enter": {
242
+ l !== null && r(o[l]);
243
+ break;
244
+ }
245
+ case "Escape": {
246
+ a(!1);
247
+ break;
248
+ }
249
+ }
250
+ },
251
+ [e, l, o, r]
252
+ ), _ = M(() => {
253
+ a(!1), c(null);
254
+ }, []);
255
+ return {
256
+ handleChange: r,
257
+ handleKeyDown: d,
258
+ handleOutsideClick: _,
259
+ highlightedIndex: l,
260
+ isOpen: e,
261
+ selectedItem: i,
262
+ setIsOpen: a
263
+ };
264
+ }, Te = (n) => {
265
+ K(() => {
266
+ const o = (t) => {
267
+ n.forEach((e) => e(t));
268
+ };
269
+ return window.addEventListener("keydown", o), () => {
270
+ window.removeEventListener("keydown", o);
271
+ };
272
+ }, [n]);
273
+ }, Le = (n) => {
274
+ const { palette: o, setActiveColorHandler: t, setActiveShade: e } = n;
275
+ Te([(c) => {
276
+ if (c.shiftKey && c.code.startsWith("Digit")) {
277
+ const i = parseInt(c.code.replace("Digit", ""), 10);
278
+ i >= 1 && i <= 5 && e(i);
279
+ }
280
+ }, (c) => {
281
+ const i = c.key.toLowerCase(), h = o.findIndex(
282
+ (d) => d?.hotkey?.toLowerCase() === i
283
+ ), r = o[h];
284
+ h !== -1 && t(r, h);
285
+ }]);
286
+ }, Ke = "_iconButton_yk1r1_14", Re = "_primary_yk1r1_34", $e = "_secondary_yk1r1_46", ze = "_transparent_yk1r1_54", He = "_selected_yk1r1_65", Me = "_disabled_yk1r1_74", R = {
287
+ iconButton: Ke,
288
+ primary: Re,
289
+ secondary: $e,
290
+ transparent: ze,
291
+ selected: He,
292
+ disabled: Me
293
+ }, T = (n) => {
294
+ const {
295
+ className: o,
296
+ disabled: t,
297
+ icon: e,
298
+ selected: a,
299
+ variants: l = "primary",
300
+ ...c
301
+ } = n;
302
+ return /* @__PURE__ */ s(
303
+ "button",
304
+ {
305
+ className: m(
306
+ R.iconButton,
307
+ R[l],
308
+ a && R.selected,
309
+ t && R.disabled,
310
+ o
311
+ ),
312
+ disabled: t,
313
+ ...c,
314
+ children: e
315
+ }
316
+ );
317
+ }, Ae = "_hexInput_x3rtz_1", De = "_inputContainer_x3rtz_11", Ve = "_hash_x3rtz_18", Pe = "_input_x3rtz_11", je = "_error_x3rtz_39", Ee = "_copyButton_x3rtz_42", Fe = "_slot_x3rtz_48", Ge = "_copiedMessage_x3rtz_55", Oe = "_fadeInOut_x3rtz_1", w = {
318
+ hexInput: Ae,
319
+ inputContainer: De,
320
+ hash: Ve,
321
+ input: Pe,
322
+ error: je,
323
+ copyButton: Ee,
324
+ slot: Fe,
325
+ copiedMessage: Ge,
326
+ fadeInOut: Oe
327
+ }, qe = (n) => {
328
+ const {
329
+ children: o,
330
+ className: t,
331
+ color: e,
332
+ onChange: a,
333
+ placeholder: l = "RRGGBB",
334
+ ...c
335
+ } = n, [i, h] = k(
336
+ e.startsWith("#") ? e.slice(1) : e
337
+ ), [r, d] = k(!1);
338
+ K(() => {
339
+ h(e.startsWith("#") ? e.slice(1) : e);
340
+ }, [e]);
341
+ const _ = (b) => /^#([0-9A-F]{3}|[0-9A-F]{6})$/i.test("#" + b), u = (b) => {
342
+ const y = b.target.value;
343
+ h(y), _(y) && a("#" + y);
344
+ }, f = () => {
345
+ const b = "#" + i;
346
+ navigator.clipboard.writeText(b), d(!0), setTimeout(() => d(!1), 1e3);
347
+ };
348
+ return /* @__PURE__ */ g("div", { className: w.hexInput, children: [
349
+ /* @__PURE__ */ s(
350
+ T,
351
+ {
352
+ icon: /* @__PURE__ */ s(X, {}),
353
+ onClick: f,
354
+ className: w.copyButton
355
+ }
356
+ ),
357
+ /* @__PURE__ */ g("div", { className: w.inputContainer, children: [
358
+ /* @__PURE__ */ s("span", { className: w.hash, children: "#" }),
359
+ /* @__PURE__ */ s(
360
+ "input",
361
+ {
362
+ ...c,
363
+ className: m(
364
+ w.input,
365
+ _(i) ? "" : w.error,
366
+ t
367
+ ),
368
+ value: i,
369
+ onChange: u,
370
+ placeholder: l,
371
+ "aria-label": "Hex code"
372
+ }
373
+ )
374
+ ] }),
375
+ r && /* @__PURE__ */ s("div", { className: w.copiedMessage, children: /* @__PURE__ */ s("span", { children: "Copied!" }) }),
376
+ o && /* @__PURE__ */ s("div", { className: w.slot, children: o })
377
+ ] });
378
+ }, We = "_colorsList_1brrj_1", Ue = {
379
+ colorsList: We
380
+ }, Je = ({
381
+ activeColor: n,
382
+ palette: o,
383
+ setActiveColorHandler: t
384
+ }) => /* @__PURE__ */ s("div", { className: Ue.colorsList, children: o.map((e, a) => /* @__PURE__ */ s(
385
+ P,
386
+ {
387
+ color: e.color,
388
+ hotkey: e.hotkey,
389
+ selected: n.index === a,
390
+ onClick: () => t(e, a),
391
+ size: "large"
392
+ },
393
+ e.name
394
+ )) }), Qe = "_shadowList_1srdv_1", Xe = "_shadowText_1srdv_6", E = {
395
+ shadowList: Qe,
396
+ shadowText: Xe
397
+ }, Ye = ({
398
+ activeColor: n,
399
+ activeShade: o,
400
+ colors: t,
401
+ setActiveShade: e
402
+ }) => {
403
+ const a = [1, 2, 3, 4, 5], l = t[n.index];
404
+ return ["#ffffff", "transparent", "#000000", "#1e1e1e"].includes(
405
+ n?.color
406
+ ) || !t[n.index] ? /* @__PURE__ */ s("div", { className: E.shadowText, children: /* @__PURE__ */ s("p", { children: "No shades available for this color" }) }) : /* @__PURE__ */ s("div", { className: E.shadowList, children: a.map((c) => /* @__PURE__ */ s(
407
+ P,
408
+ {
409
+ color: O(l.color, c),
410
+ hotkey: `⇧+${c}`,
411
+ selected: o === c,
412
+ onClick: () => e(c),
413
+ size: "large"
414
+ },
415
+ c
416
+ )) });
417
+ }, Qt = (n) => {
418
+ const { changeColor: o, colors: t, selectedColor: e, selectedShadeIndex: a = 5 } = n, l = xe || t, {
419
+ activeColor: c,
420
+ activeShade: i,
421
+ palette: h,
422
+ setActiveColorHandler: r,
423
+ setActiveShade: d
424
+ } = Be({ colors: l, selectedColor: e, selectedShadeIndex: a });
425
+ return Le({
426
+ palette: h,
427
+ setActiveColorHandler: r,
428
+ setActiveShade: d
429
+ }), /* @__PURE__ */ g(H.Root, { children: [
430
+ /* @__PURE__ */ s(H.Trigger, { children: /* @__PURE__ */ s(P, { size: "medium", color: c.color }) }),
431
+ /* @__PURE__ */ g(H.Content, { className: S.content, children: [
432
+ /* @__PURE__ */ g("div", { className: S.section, children: [
433
+ /* @__PURE__ */ s("h3", { className: S.title, children: "Colors" }),
434
+ /* @__PURE__ */ s(
435
+ Je,
436
+ {
437
+ palette: h,
438
+ activeColor: c,
439
+ setActiveColorHandler: (_, u) => {
440
+ r(_, u), o && o(_);
441
+ }
442
+ }
443
+ )
444
+ ] }),
445
+ /* @__PURE__ */ g("div", { className: S.section, children: [
446
+ /* @__PURE__ */ s("h3", { className: S.title, children: "Shades" }),
447
+ /* @__PURE__ */ s(
448
+ Ye,
449
+ {
450
+ colors: l,
451
+ activeShade: i,
452
+ activeColor: c,
453
+ setActiveShade: d
454
+ }
455
+ )
456
+ ] }),
457
+ /* @__PURE__ */ g("div", { className: S.section, children: [
458
+ /* @__PURE__ */ s("h3", { className: S.title, children: "Hex code" }),
459
+ /* @__PURE__ */ s(
460
+ qe,
461
+ {
462
+ color: c.color,
463
+ onChange: (_) => {
464
+ r({ ...c, color: _ }), o && o({ ...c, color: _ });
465
+ }
466
+ }
467
+ )
468
+ ] })
469
+ ] })
470
+ ] });
471
+ }, Ze = "_pagination_3kmd4_1", et = "_pages_3kmd4_13", $ = {
472
+ pagination: Ze,
473
+ pages: et
474
+ };
475
+ function tt({
476
+ boundaryCount: n,
477
+ currentPage: o,
478
+ siblingCount: t,
479
+ totalPages: e
480
+ }) {
481
+ const a = n * 2 + t * 2 + 1;
482
+ if (e <= a)
483
+ return Array.from({ length: e }, (d, _) => _ + 1);
484
+ const l = [], c = Array.from({ length: n }, (d, _) => _ + 1), i = Array.from(
485
+ { length: n },
486
+ (d, _) => e - n + _ + 1
487
+ ), h = Math.max(o - t, n + 1), r = Math.min(
488
+ o + t,
489
+ e - n
490
+ );
491
+ l.push(...c), h > n + 1 && l.push("...");
492
+ for (let d = h; d <= r; d++)
493
+ l.push(d);
494
+ return r < e - n && l.push("..."), l.push(...i), l;
495
+ }
496
+ const Xt = (n) => {
497
+ const {
498
+ boundaryCount: o = 2,
499
+ currentPage: t,
500
+ onPageChange: e,
501
+ siblingCount: a = 1,
502
+ totalPages: l
503
+ } = n, c = tt({
504
+ boundaryCount: o,
505
+ currentPage: t,
506
+ siblingCount: a,
507
+ totalPages: l
508
+ }), i = () => {
509
+ t > 1 && e(t - 1);
510
+ }, h = () => {
511
+ t < l && e(t + 1);
512
+ };
513
+ return /* @__PURE__ */ g("div", { className: $.pagination, children: [
514
+ /* @__PURE__ */ s(
515
+ T,
516
+ {
517
+ onClick: i,
518
+ disabled: t === 1,
519
+ icon: /* @__PURE__ */ s(Y, { size: 16 }),
520
+ variants: "transparent"
521
+ }
522
+ ),
523
+ /* @__PURE__ */ s("div", { className: $.pages, children: c.map((r, d) => r === "..." ? /* @__PURE__ */ s("span", { className: $.ellipsis, children: "..." }, `ellipsis-${d}`) : /* @__PURE__ */ s(
524
+ T,
525
+ {
526
+ onClick: () => e(Number(r)),
527
+ icon: r,
528
+ selected: t === r
529
+ },
530
+ r
531
+ )) }),
532
+ /* @__PURE__ */ s(
533
+ T,
534
+ {
535
+ onClick: h,
536
+ disabled: t === l,
537
+ className: $.nextButton,
538
+ icon: /* @__PURE__ */ s(Z, { size: 16 }),
539
+ variants: "transparent"
540
+ }
541
+ )
542
+ ] });
543
+ }, nt = "_selectContainer_1kdni_1", ot = "_selectButton_1kdni_5", st = "_selectIcon_1kdni_10", ct = "_selectIconOpen_1kdni_14", at = "_selectMenu_1kdni_18", lt = "_positionBottomRight_1kdni_44", it = "_positionBottomLeft_1kdni_50", rt = "_positionTopRight_1kdni_56", dt = "_positionTopLeft_1kdni_62", ht = "_positionRight_1kdni_68", _t = "_positionLeft_1kdni_74", ut = "_positionBottom_1kdni_44", mt = "_positionTop_1kdni_56", pt = "_menuItem_1kdni_92", gt = "_menuItemSelected_1kdni_102", ft = "_menuItemHover_1kdni_106", yt = "_menuItemHighlighted_1kdni_110", p = {
544
+ selectContainer: nt,
545
+ selectButton: ot,
546
+ selectIcon: st,
547
+ selectIconOpen: ct,
548
+ selectMenu: at,
549
+ positionBottomRight: lt,
550
+ positionBottomLeft: it,
551
+ positionTopRight: rt,
552
+ positionTopLeft: dt,
553
+ positionRight: ht,
554
+ positionLeft: _t,
555
+ positionBottom: ut,
556
+ positionTop: mt,
557
+ menuItem: pt,
558
+ menuItemSelected: gt,
559
+ menuItemHover: ft,
560
+ menuItemHighlighted: yt
561
+ }, Yt = ({
562
+ fullWidth: n = !0,
563
+ onSelect: o,
564
+ options: t,
565
+ position: e = "bottom-left",
566
+ selectedId: a,
567
+ slot_left: l,
568
+ slot_right: c,
569
+ style: i,
570
+ title: h = "Select",
571
+ value: r
572
+ }) => {
573
+ const d = G(null), {
574
+ handleChange: _,
575
+ handleKeyDown: u,
576
+ handleOutsideClick: f,
577
+ highlightedIndex: b,
578
+ isOpen: y,
579
+ selectedItem: N,
580
+ setIsOpen: v
581
+ } = Ie({ onSelect: o, options: t, selectedId: a });
582
+ K(() => {
583
+ const x = (z) => {
584
+ d.current && !d.current.contains(z.target) && f();
585
+ };
586
+ return document.addEventListener("mousedown", x), () => {
587
+ document.removeEventListener("mousedown", x);
588
+ };
589
+ }, [f]);
590
+ const U = m(p.selectMenu, {
591
+ [p.positionBottom]: e === "bottom",
592
+ [p.positionBottomLeft]: e === "bottom-left",
593
+ [p.positionBottomRight]: e === "bottom-right",
594
+ [p.positionLeft]: e === "left",
595
+ [p.positionRight]: e === "right",
596
+ [p.positionTop]: e === "top",
597
+ [p.positionTopLeft]: e === "top-left",
598
+ [p.positionTopRight]: e === "top-right"
599
+ });
600
+ return /* @__PURE__ */ g(
601
+ "div",
602
+ {
603
+ ref: d,
604
+ className: p.selectContainer,
605
+ onKeyDown: u,
606
+ tabIndex: 0,
607
+ children: [
608
+ /* @__PURE__ */ g(
609
+ F,
610
+ {
611
+ id: r,
612
+ "aria-label": "Toggle select",
613
+ variant: "tertiary",
614
+ "aria-haspopup": "true",
615
+ "aria-expanded": y,
616
+ type: "button",
617
+ onClick: () => v(!y),
618
+ className: m(p.selectButton, i),
619
+ fullWidth: n,
620
+ children: [
621
+ /* @__PURE__ */ s("span", { children: N?.label || h }),
622
+ /* @__PURE__ */ s(
623
+ ee,
624
+ {
625
+ size: 20,
626
+ className: m(p.selectIcon, {
627
+ [p.selectIconOpen]: y
628
+ })
629
+ }
630
+ )
631
+ ]
632
+ }
633
+ ),
634
+ y && /* @__PURE__ */ s("div", { "aria-label": "Select menu", className: U, children: /* @__PURE__ */ s("ul", { role: "menu", "aria-labelledby": r, "aria-orientation": "vertical", children: t?.map((x, z) => /* @__PURE__ */ g(
635
+ "li",
636
+ {
637
+ onClick: () => _(x),
638
+ className: m(p.menuItem, p.menuItemHover, {
639
+ [p.menuItemHighlighted]: b === z,
640
+ [p.menuItemSelected]: N?.value === x.value
641
+ }),
642
+ children: [
643
+ l,
644
+ /* @__PURE__ */ s("span", { children: x.label }),
645
+ c
646
+ ]
647
+ },
648
+ x.value
649
+ )) }) })
650
+ ]
651
+ }
652
+ );
653
+ }, kt = "_groupTitle_eelpn_23", bt = "_list_eelpn_30", vt = "_item_eelpn_35", wt = "_itemKeysVariants_eelpn_45", Ct = "_itemKeysSeparator_eelpn_50", Nt = "_itemDescription_eelpn_54", xt = "_itemKey_eelpn_45", C = {
654
+ groupTitle: kt,
655
+ list: bt,
656
+ item: vt,
657
+ itemKeysVariants: wt,
658
+ itemKeysSeparator: Ct,
659
+ itemDescription: Nt,
660
+ itemKey: xt
661
+ }, Bt = (n) => {
662
+ const { children: o, className: t, title: e } = n;
663
+ return /* @__PURE__ */ g("div", { className: m(C.group, t), children: [
664
+ /* @__PURE__ */ s("h4", { className: C.groupTitle, children: e }),
665
+ o
666
+ ] });
667
+ }, St = (n) => {
668
+ const { children: o, className: t } = n;
669
+ return /* @__PURE__ */ s("div", { className: m(C.list, t), children: o });
670
+ }, It = (n) => {
671
+ const { className: o, description: t, keysVariants: e } = n, a = (l) => l.map((c, i) => /* @__PURE__ */ s("span", { className: C.itemKey, children: c }, i));
672
+ return /* @__PURE__ */ g("div", { className: m(C.item, o), children: [
673
+ /* @__PURE__ */ s("div", { className: C.itemDescription, children: t }),
674
+ /* @__PURE__ */ s("div", { className: C.itemKeysVariants, children: e.map(
675
+ (l, c) => c === 0 ? a(l) : /* @__PURE__ */ g(Q, { children: [
676
+ /* @__PURE__ */ s("span", { className: C.itemKeysSeparator, children: "or" }),
677
+ a(l)
678
+ ] })
679
+ ) })
680
+ ] });
681
+ }, Zt = { Group: Bt, Item: It, List: St }, Tt = "_slider_1b9o2_1", Lt = "_focused_1b9o2_37", A = {
682
+ "slider-container": "_slider-container_1b9o2_1",
683
+ slider: Tt,
684
+ focused: Lt
685
+ }, en = (n) => {
686
+ const { initialValue: o = 50, max: t = 100, min: e = 0, onChange: a, step: l = 1 } = n, [c, i] = k(o), [h, r] = k(!1), d = G(null), _ = (N) => {
687
+ const v = Number(N.target.value);
688
+ i(v), a && a(v);
689
+ }, u = (N) => {
690
+ N.key === "ArrowRight" ? i((v) => Math.min(v + l, t)) : N.key === "ArrowLeft" && i((v) => Math.max(v - l, e));
691
+ }, f = () => r(!0), b = () => r(!1), y = (c - e) / (t - e) * 100;
692
+ return /* @__PURE__ */ s("div", { className: m(A.container, h && A.focused), children: /* @__PURE__ */ s(
693
+ "input",
694
+ {
695
+ type: "range",
696
+ min: e,
697
+ max: t,
698
+ step: l,
699
+ value: c,
700
+ onChange: _,
701
+ onKeyDown: u,
702
+ ref: d,
703
+ onFocus: f,
704
+ onBlur: b,
705
+ tabIndex: 0,
706
+ className: A.slider,
707
+ style: {
708
+ "--slider-background-color": "#ddd",
709
+ "--slider-fill-color": "#6965db",
710
+ background: h ? `linear-gradient(to right, #363399 ${y}%, #ccc ${y}%)` : `linear-gradient(to right, var(--slider-fill-color) ${y}%, var(--slider-background-color) ${y}%)`
711
+ }
712
+ }
713
+ ) });
714
+ }, Kt = "_themeSwitcher_11ggx_18", Rt = "_themeButton_11ggx_27", $t = "_background_11ggx_31", zt = "_selectedButton_11ggx_42", D = {
715
+ themeSwitcher: Kt,
716
+ themeButton: Rt,
717
+ background: $t,
718
+ selectedButton: zt
719
+ }, tn = () => {
720
+ const { setTheme: n, theme: o } = J(), t = [
721
+ { icon: /* @__PURE__ */ s(te, {}), label: "Light", value: "light" },
722
+ { icon: /* @__PURE__ */ s(ne, {}), label: "Dark", value: "dark" },
723
+ { icon: /* @__PURE__ */ s(oe, {}), label: "System", value: "system" }
724
+ ];
725
+ return /* @__PURE__ */ s("div", { className: D.themeSwitcher, children: t.map((e) => /* @__PURE__ */ s(
726
+ T,
727
+ {
728
+ icon: e.icon,
729
+ variants: "transparent",
730
+ onClick: () => n(e.value),
731
+ "aria-label": e.label,
732
+ selected: e.value === o,
733
+ className: m(
734
+ D.themeButton,
735
+ e.value === o && D.selectedButton
736
+ )
737
+ },
738
+ e.value
739
+ )) });
740
+ }, Ht = "_toggleSwitch_1w0s9_14", Mt = "_button_1w0s9_24", At = "_selected_1w0s9_41", L = {
741
+ toggleSwitch: Ht,
742
+ button: Mt,
743
+ selected: At
744
+ }, nn = (n) => {
745
+ const { defaultValue: o, options: t, ...e } = n, [a, l] = k(
746
+ o || t[0].value
747
+ ), c = (i) => {
748
+ l(i);
749
+ };
750
+ return /* @__PURE__ */ s("div", { className: m(L.toggleSwitch), ...e, children: t.map(({ icon: i, leftSlot: h, rightSlot: r, value: d, ..._ }) => h || r ? /* @__PURE__ */ g(
751
+ F,
752
+ {
753
+ variant: "text",
754
+ className: m(
755
+ L.button,
756
+ a === d && L.selected
757
+ ),
758
+ onClick: () => c(d),
759
+ children: [
760
+ h,
761
+ i,
762
+ r
763
+ ]
764
+ }
765
+ ) : /* @__PURE__ */ s(
766
+ T,
767
+ {
768
+ variants: "transparent",
769
+ className: m(
770
+ L.button,
771
+ a === d && L.selected
772
+ ),
773
+ onClick: () => c(d),
774
+ icon: i,
775
+ ..._
776
+ }
777
+ )) });
778
+ }, Dt = "_toolbar_18q11_1", Vt = "_separator_18q11_11", Pt = "_vertical_18q11_16", jt = "_horizontal_18q11_28", V = {
779
+ toolbar: Dt,
780
+ separator: Vt,
781
+ vertical: Pt,
782
+ horizontal: jt
783
+ }, Et = (n) => {
784
+ const { children: o, className: t, direction: e = "horizontal" } = n;
785
+ return /* @__PURE__ */ s(
786
+ "div",
787
+ {
788
+ className: m(V.toolbar, e && V[e], t),
789
+ children: o
790
+ }
791
+ );
792
+ }, Ft = ({}) => /* @__PURE__ */ s("div", { className: V.separator }), on = { Root: Et, Separator: Ft };
793
+ export {
794
+ F as Button,
795
+ an as ButtonRender,
796
+ Jt as ButtonsGroup,
797
+ ln as Card,
798
+ rn as CardContent,
799
+ dn as CardHeader,
800
+ hn as CardRoot,
801
+ P as ColorButton,
802
+ Qt as ColorPicker,
803
+ _n as Dialog,
804
+ H as DropDown,
805
+ T as IconButton,
806
+ Xt as Pagination,
807
+ Yt as Select,
808
+ Zt as Shortcut,
809
+ un as Sidebar,
810
+ mn as SidebarContext,
811
+ en as Slider,
812
+ pn as SwitcherButtons,
813
+ gn as Table,
814
+ fn as TextField,
815
+ tn as ThemeSwitcher,
816
+ nn as ToggleSwitch,
817
+ yn as ToolIconButton,
818
+ on as Toolbar,
819
+ kn as useSidebarContext
820
+ };
821
+ //# sourceMappingURL=index.js.map