@graphty/compact-mantine 0.0.1 → 0.3.0

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.
package/dist/index.js ADDED
@@ -0,0 +1,1749 @@
1
+ import { CloseButton as Ge, ActionIcon as D, Button as je, RangeSlider as Xe, Radio as We, Slider as ae, Switch as Ze, Checkbox as ve, SegmentedControl as Ke, Kbd as Ye, Indicator as qe, ThemeIcon as Je, Avatar as Qe, Pill as et, Badge as tt, Text as H, RingProgress as rt, Progress as ot, Loader as nt, InputClearButton as it, JsonInput as at, FileInput as st, PillsInput as lt, TagsInput as ct, MultiSelect as ut, ColorInput as Pe, Autocomplete as pt, PasswordInput as dt, Textarea as ft, Select as we, NumberInput as le, TextInput as ye, Tabs as mt, Stepper as gt, Pagination as ht, NavLink as xt, Burger as bt, Anchor as zt, HoverCard as vt, Popover as oe, Tooltip as Pt, Menu as wt, createTheme as yt, Group as R, ColorSwatch as Ct, ColorPicker as St, Box as A, Stack as W, Divider as Ce, Collapse as Tt, UnstyledButton as _t, Paper as It, useComputedColorScheme as kt, rem as Q } from "@mantine/core";
2
+ import { jsxs as S, jsx as o, Fragment as Bt } from "react/jsx-runtime";
3
+ import { useUncontrolled as Z, useDisclosure as Se } from "@mantine/hooks";
4
+ import { X as ne, ChevronDown as ce, ChevronRight as Te, Plus as Rt, Minus as Ft } from "lucide-react";
5
+ import { useState as L, useEffect as U, useRef as G, useCallback as T, useMemo as _e, createContext as Ie, useContext as ue, useId as ke, isValidElement as Et, cloneElement as Ot } from "react";
6
+ import { createPortal as At } from "react-dom";
7
+ const Lt = [
8
+ "#d5d7da",
9
+ // 0 - lightest (light mode text)
10
+ "#a3a8b1",
11
+ // 1
12
+ "#7a828e",
13
+ // 2 - dimmed text
14
+ "#5f6873",
15
+ // 3
16
+ "#48525c",
17
+ // 4
18
+ "#374047",
19
+ // 5
20
+ "#2a3035",
21
+ // 6 - input background
22
+ "#1f2428",
23
+ // 7
24
+ "#161b22",
25
+ // 8
26
+ "#0d1117"
27
+ // 9 - darkest (main background)
28
+ ], Dt = {
29
+ dark: Lt
30
+ }, $t = {
31
+ Button: je.extend({
32
+ vars: (t, e) => e.size === "compact" ? {
33
+ root: {
34
+ "--button-height": "24px",
35
+ "--button-fz": "11px",
36
+ "--button-padding-x": "8px"
37
+ }
38
+ } : { root: {} }
39
+ }),
40
+ ActionIcon: D.extend({
41
+ vars: (t, e) => e.size === "compact" ? {
42
+ root: {
43
+ "--ai-size": "24px"
44
+ }
45
+ } : { root: {} }
46
+ }),
47
+ CloseButton: Ge.extend({
48
+ defaultProps: {
49
+ size: "compact"
50
+ },
51
+ vars: (t, e) => e.size === "compact" ? {
52
+ root: {
53
+ "--cb-size": "16px",
54
+ "--cb-icon-size": "12px"
55
+ }
56
+ } : { root: {} }
57
+ })
58
+ }, Ht = {
59
+ SegmentedControl: Ke.extend({
60
+ vars: (t, e) => e.size === "compact" ? {
61
+ root: {
62
+ "--sc-font-size": "10px",
63
+ "--sc-padding": "4px 8px"
64
+ }
65
+ } : { root: {} }
66
+ }),
67
+ Checkbox: ve.extend({
68
+ vars: (t, e) => e.size === "compact" ? {
69
+ root: {
70
+ "--checkbox-size": "16px"
71
+ }
72
+ } : { root: {} },
73
+ styles: (t, e) => e.size === "compact" ? {
74
+ label: {
75
+ fontSize: 11
76
+ }
77
+ } : {}
78
+ }),
79
+ Switch: Ze.extend({
80
+ vars: (t, e) => e.size === "compact" ? {
81
+ root: {
82
+ "--switch-height": "16px",
83
+ "--switch-width": "28px",
84
+ "--switch-thumb-size": "12px",
85
+ "--switch-track-label-padding": "2px",
86
+ "--switch-label-font-size": "5px"
87
+ }
88
+ } : { root: {} },
89
+ styles: (t, e) => e.size === "compact" ? {
90
+ label: {
91
+ fontSize: 11
92
+ }
93
+ } : {}
94
+ }),
95
+ Slider: ae.extend({
96
+ vars: (t, e) => e.size === "compact" ? {
97
+ root: {
98
+ "--slider-size": "4px",
99
+ "--slider-thumb-size": "12px"
100
+ }
101
+ } : { root: {} },
102
+ styles: (t, e) => e.size === "compact" ? {
103
+ markLabel: {
104
+ fontSize: 10,
105
+ marginTop: 2
106
+ }
107
+ } : {}
108
+ }),
109
+ Radio: We.extend({
110
+ vars: (t, e) => e.size === "compact" ? {
111
+ root: {
112
+ "--radio-size": "16px",
113
+ "--radio-icon-size": "6px"
114
+ }
115
+ } : { root: {} },
116
+ styles: (t, e) => e.size === "compact" ? {
117
+ label: {
118
+ fontSize: 11
119
+ }
120
+ } : {}
121
+ }),
122
+ RangeSlider: Xe.extend({
123
+ vars: (t, e) => e.size === "compact" ? {
124
+ root: {
125
+ "--slider-size": "4px",
126
+ "--slider-thumb-size": "12px"
127
+ }
128
+ } : { root: {} },
129
+ styles: (t, e) => e.size === "compact" ? {
130
+ markLabel: {
131
+ fontSize: 10,
132
+ marginTop: 2
133
+ }
134
+ } : {}
135
+ })
136
+ }, Mt = {
137
+ Text: H.extend({
138
+ vars: (t, e) => e.size === "compact" ? {
139
+ root: {
140
+ "--text-fz": "11px",
141
+ "--text-lh": "1.2"
142
+ }
143
+ } : { root: {} }
144
+ }),
145
+ Badge: tt.extend({
146
+ vars: (t, e) => e.size === "compact" ? {
147
+ root: {
148
+ "--badge-height": "14px",
149
+ "--badge-fz": "9px",
150
+ "--badge-padding-x": "4px"
151
+ }
152
+ } : { root: {} }
153
+ }),
154
+ Pill: et.extend({
155
+ vars: (t, e) => e.size === "compact" ? {
156
+ root: {
157
+ "--pill-height": "16px",
158
+ "--pill-fz": "10px"
159
+ }
160
+ } : { root: {} }
161
+ }),
162
+ Avatar: Qe.extend({
163
+ vars: (t, e) => e.size === "compact" ? {
164
+ root: {
165
+ "--avatar-size": "24px"
166
+ }
167
+ } : { root: {} }
168
+ }),
169
+ ThemeIcon: Je.extend({
170
+ vars: (t, e) => e.size === "compact" ? {
171
+ root: {
172
+ "--ti-size": "24px"
173
+ }
174
+ } : { root: {} }
175
+ }),
176
+ Indicator: qe.extend({
177
+ vars: (t, e) => e.size === "compact" ? {
178
+ root: {
179
+ "--indicator-size": "8px"
180
+ }
181
+ } : { root: {} }
182
+ }),
183
+ Kbd: Ye.extend({
184
+ vars: (t, e) => e.size === "compact" ? {
185
+ root: {
186
+ "--kbd-fz": "10px",
187
+ "--kbd-padding": "2px 4px"
188
+ }
189
+ } : { root: {} }
190
+ })
191
+ }, Nt = {
192
+ Loader: nt.extend({
193
+ vars: (t, e) => e.size === "compact" ? {
194
+ root: {
195
+ "--loader-size": "18px"
196
+ }
197
+ } : { root: {} }
198
+ }),
199
+ Progress: ot.extend({
200
+ vars: (t, e) => e.size === "compact" ? {
201
+ root: {
202
+ "--progress-size": "4px"
203
+ }
204
+ } : { root: {} },
205
+ styles: (t, e) => e.size === "compact" ? {
206
+ label: {
207
+ fontSize: 9
208
+ }
209
+ } : {}
210
+ }),
211
+ // Note: RingProgress uses numeric size directly in SVG calculations,
212
+ // so we can't use CSS variables. Use size={48} for compact-equivalent sizing.
213
+ RingProgress: rt.extend({
214
+ vars: () => ({ root: {} })
215
+ })
216
+ }, xe = 1e3, V = 1100, Vt = 8, br = 4, ee = {
217
+ root: {},
218
+ wrapper: {
219
+ "--input-size": "24px",
220
+ "--input-fz": "11px",
221
+ "--input-bg": "var(--mantine-color-default)",
222
+ "--input-bd": "none"
223
+ }
224
+ }, B = {
225
+ label: {
226
+ fontSize: 11,
227
+ color: "var(--mantine-color-dimmed)",
228
+ marginBottom: 1,
229
+ lineHeight: 1.2
230
+ },
231
+ input: {
232
+ paddingLeft: 8,
233
+ paddingRight: 8,
234
+ border: "none"
235
+ }
236
+ }, re = {
237
+ dropdown: {
238
+ padding: 4,
239
+ border: "none",
240
+ boxShadow: "var(--mantine-shadow-md)"
241
+ },
242
+ option: {
243
+ fontSize: 11,
244
+ padding: "4px 8px",
245
+ borderRadius: 4
246
+ },
247
+ options: {
248
+ // No gap between options for compact appearance
249
+ },
250
+ groupLabel: {
251
+ fontSize: 10,
252
+ padding: "4px 8px"
253
+ },
254
+ empty: {
255
+ fontSize: 11,
256
+ padding: "8px"
257
+ }
258
+ }, Ut = {
259
+ TextInput: ye.extend({
260
+ vars: (t, e) => e.size === "compact" ? ee : { root: {}, wrapper: {} },
261
+ styles: (t, e) => e.size === "compact" ? B : {}
262
+ }),
263
+ NumberInput: le.extend({
264
+ vars: (t, e) => e.size === "compact" ? {
265
+ root: {},
266
+ wrapper: {
267
+ "--input-size": "24px",
268
+ "--input-fz": "11px",
269
+ "--input-bg": "var(--mantine-color-default)",
270
+ "--input-bd": "none",
271
+ "--input-right-section-width": "24px"
272
+ },
273
+ controls: {
274
+ "--ni-chevron-size": "10px"
275
+ }
276
+ } : { root: {}, wrapper: {}, controls: {} },
277
+ styles: (t, e) => e.size === "compact" ? {
278
+ ...B,
279
+ control: {
280
+ borderColor: "transparent"
281
+ }
282
+ } : {}
283
+ }),
284
+ Select: we.extend({
285
+ defaultProps: {
286
+ comboboxProps: { zIndex: V }
287
+ },
288
+ vars: (t, e) => e.size === "compact" ? ee : { root: {}, wrapper: {} },
289
+ styles: (t, e) => e.size === "compact" ? {
290
+ ...B,
291
+ ...re
292
+ } : {}
293
+ }),
294
+ Textarea: ft.extend({
295
+ vars: (t, e) => e.size === "compact" ? {
296
+ root: {},
297
+ wrapper: {
298
+ "--input-fz": "11px",
299
+ "--input-bg": "var(--mantine-color-default)",
300
+ "--input-bd": "none"
301
+ }
302
+ } : { root: {}, wrapper: {} },
303
+ styles: (t, e) => e.size === "compact" ? B : {}
304
+ }),
305
+ PasswordInput: dt.extend({
306
+ vars: (t, e) => e.size === "compact" ? ee : { root: {}, wrapper: {} },
307
+ styles: (t, e) => e.size === "compact" ? {
308
+ ...B,
309
+ innerInput: {
310
+ paddingLeft: 8,
311
+ paddingRight: 8
312
+ }
313
+ } : {}
314
+ }),
315
+ Autocomplete: pt.extend({
316
+ defaultProps: {
317
+ comboboxProps: { zIndex: V }
318
+ },
319
+ vars: (t, e) => e.size === "compact" ? ee : { root: {}, wrapper: {} },
320
+ styles: (t, e) => e.size === "compact" ? {
321
+ ...B,
322
+ ...re
323
+ } : {}
324
+ }),
325
+ // ColorInput uses styles instead of vars due to complex type requirements
326
+ // (ColorInput requires eyeDropperIcon, eyeDropperButton, colorPreview CSS vars)
327
+ ColorInput: Pe.extend({
328
+ defaultProps: {
329
+ popoverProps: { zIndex: V }
330
+ },
331
+ styles: (t, e) => e.size === "compact" ? {
332
+ ...B,
333
+ wrapper: {
334
+ "--input-size": "24px",
335
+ "--input-fz": "11px",
336
+ "--input-bg": "var(--mantine-color-default)",
337
+ "--input-bd": "none"
338
+ }
339
+ } : {}
340
+ }),
341
+ MultiSelect: ut.extend({
342
+ defaultProps: {
343
+ comboboxProps: { zIndex: V }
344
+ },
345
+ vars: (t, e) => e.size === "compact" ? {
346
+ root: {},
347
+ wrapper: {
348
+ "--input-fz": "11px",
349
+ "--input-bg": "var(--mantine-color-default)",
350
+ "--input-bd": "none",
351
+ "--input-size": "24px",
352
+ "--combobox-chevron-size": "12px"
353
+ }
354
+ } : { root: {}, wrapper: {} },
355
+ styles: (t, e) => e.size === "compact" ? {
356
+ ...B,
357
+ ...re,
358
+ input: {
359
+ ...B.input,
360
+ minHeight: 24,
361
+ height: "auto",
362
+ display: "flex",
363
+ alignItems: "center",
364
+ paddingTop: 4,
365
+ paddingBottom: 4
366
+ },
367
+ inputField: {
368
+ minWidth: 60,
369
+ flexBasis: 60
370
+ },
371
+ pillsList: {
372
+ columnGap: 4,
373
+ rowGap: 2
374
+ },
375
+ pill: {
376
+ margin: 0,
377
+ paddingTop: 2,
378
+ paddingBottom: 2
379
+ }
380
+ } : {}
381
+ }),
382
+ TagsInput: ct.extend({
383
+ defaultProps: {
384
+ comboboxProps: { zIndex: V }
385
+ },
386
+ vars: (t, e) => e.size === "compact" ? {
387
+ root: {},
388
+ wrapper: {
389
+ "--input-fz": "11px",
390
+ "--input-bg": "var(--mantine-color-default)",
391
+ "--input-bd": "none"
392
+ }
393
+ } : { root: {}, wrapper: {} },
394
+ styles: (t, e) => e.size === "compact" ? {
395
+ ...B,
396
+ ...re,
397
+ input: {
398
+ ...B.input,
399
+ minHeight: 24,
400
+ height: "auto",
401
+ display: "flex",
402
+ alignItems: "center",
403
+ paddingTop: 4,
404
+ paddingBottom: 4
405
+ },
406
+ inputField: {
407
+ minWidth: 30,
408
+ flexBasis: 30
409
+ },
410
+ pillsList: {
411
+ columnGap: 4,
412
+ rowGap: 2
413
+ },
414
+ pill: {
415
+ margin: 0,
416
+ paddingTop: 2,
417
+ paddingBottom: 2
418
+ }
419
+ } : {}
420
+ }),
421
+ PillsInput: lt.extend({
422
+ vars: (t, e) => e.size === "compact" ? {
423
+ root: {},
424
+ wrapper: {
425
+ "--input-fz": "11px",
426
+ "--input-bg": "var(--mantine-color-default)",
427
+ "--input-bd": "none"
428
+ }
429
+ } : { root: {}, wrapper: {} },
430
+ styles: (t, e) => e.size === "compact" ? {
431
+ ...B,
432
+ input: {
433
+ ...B.input,
434
+ minHeight: 24,
435
+ height: "auto",
436
+ display: "flex",
437
+ alignItems: "center",
438
+ paddingTop: 4,
439
+ paddingBottom: 4
440
+ },
441
+ inputField: {
442
+ minWidth: 30,
443
+ flexBasis: 30
444
+ },
445
+ pillsList: {
446
+ columnGap: 4,
447
+ rowGap: 2
448
+ },
449
+ pill: {
450
+ margin: 0,
451
+ paddingTop: 2,
452
+ paddingBottom: 2
453
+ }
454
+ } : {}
455
+ }),
456
+ FileInput: st.extend({
457
+ vars: (t, e) => e.size === "compact" ? ee : { root: {}, wrapper: {} },
458
+ styles: (t, e) => e.size === "compact" ? B : {}
459
+ }),
460
+ JsonInput: at.extend({
461
+ vars: (t, e) => e.size === "compact" ? {
462
+ root: {},
463
+ wrapper: {
464
+ "--input-fz": "11px",
465
+ "--input-bg": "var(--mantine-color-default)",
466
+ "--input-bd": "none"
467
+ }
468
+ } : { root: {}, wrapper: {} },
469
+ styles: (t, e) => e.size === "compact" ? B : {}
470
+ }),
471
+ InputClearButton: it.extend({
472
+ defaultProps: {
473
+ size: "compact"
474
+ },
475
+ vars: (t, e) => e.size === "compact" ? {
476
+ root: {
477
+ "--cb-size": "16px",
478
+ "--cb-icon-size": "12px"
479
+ }
480
+ } : { root: {} }
481
+ })
482
+ }, Gt = {
483
+ // Anchor uses --text-fz since it inherits from Text component
484
+ Anchor: zt.extend({
485
+ styles: (t, e) => e.size === "compact" ? {
486
+ root: {
487
+ fontSize: 11
488
+ }
489
+ } : {}
490
+ }),
491
+ Burger: bt.extend({
492
+ vars: (t, e) => e.size === "compact" ? {
493
+ root: {
494
+ "--burger-size": "18px",
495
+ "--burger-line-size": "2px"
496
+ }
497
+ } : { root: {} }
498
+ }),
499
+ // NavLink uses styles since it doesn't have a size prop and requires
500
+ // a 'children' CSS variable. Apply styles based on custom variant prop.
501
+ NavLink: xt.extend({
502
+ styles: (t, e) => e.variant === "compact" ? {
503
+ root: {
504
+ fontSize: 11,
505
+ minHeight: 28
506
+ },
507
+ label: {
508
+ fontSize: 11
509
+ }
510
+ } : {}
511
+ }),
512
+ Pagination: ht.extend({
513
+ vars: (t, e) => e.size === "compact" ? {
514
+ root: {
515
+ "--pagination-control-size": "24px",
516
+ "--pagination-control-fz": "11px"
517
+ }
518
+ } : { root: {} }
519
+ }),
520
+ Stepper: gt.extend({
521
+ vars: (t, e) => e.size === "compact" ? {
522
+ root: {
523
+ "--stepper-icon-size": "24px",
524
+ "--stepper-fz": "11px",
525
+ "--stepper-spacing": "8px"
526
+ }
527
+ } : { root: {} }
528
+ }),
529
+ // Tabs uses styles since it doesn't have a size prop and the CSS vars
530
+ // for tabs are limited to --tabs-color and --tabs-radius.
531
+ // Apply styles based on custom variant prop.
532
+ Tabs: mt.extend({
533
+ styles: (t, e) => e.variant === "compact" ? {
534
+ tab: {
535
+ fontSize: 11,
536
+ padding: "6px 10px"
537
+ }
538
+ } : {}
539
+ })
540
+ }, jt = {
541
+ Menu: wt.extend({
542
+ defaultProps: {
543
+ zIndex: V
544
+ }
545
+ }),
546
+ Tooltip: Pt.extend({
547
+ defaultProps: {
548
+ zIndex: V
549
+ }
550
+ }),
551
+ Popover: oe.extend({
552
+ defaultProps: {
553
+ zIndex: V
554
+ }
555
+ }),
556
+ HoverCard: vt.extend({
557
+ defaultProps: {
558
+ zIndex: V
559
+ }
560
+ })
561
+ }, zr = yt({
562
+ colors: Dt,
563
+ // Spread all component extensions into the theme
564
+ // Each extension object provides compact size support for a category of components
565
+ components: {
566
+ ...Ut,
567
+ ...$t,
568
+ ...Ht,
569
+ ...Mt,
570
+ ...Nt,
571
+ ...Gt,
572
+ ...jt
573
+ }
574
+ }), vr = ["#5B8FF9", "#FF6B6B", "#61D095", "#F7B731", "#9B59B6"], Xt = [
575
+ "#5B8FF9FF",
576
+ "#FF6B6BFF",
577
+ "#61D095FF",
578
+ "#F7B731FF",
579
+ "#9B59B6FF",
580
+ "#5B8FF980",
581
+ "#FF6B6B80",
582
+ "#61D09580",
583
+ "#F7B73180",
584
+ "#9B59B680"
585
+ ], Wt = "#888888", Be = 255, Re = 100;
586
+ function Fe(t) {
587
+ return Math.round(parseInt(t, 16) / Be * Re);
588
+ }
589
+ function Ee(t) {
590
+ return Math.round(t / Re * Be).toString(16).padStart(2, "0");
591
+ }
592
+ function Pr(t) {
593
+ let e = t.replace("#", "");
594
+ e.length === 3 ? e = `${e.split("").map((r) => r + r).join("")}ff` : e.length === 4 ? e = e.split("").map((r) => r + r).join("") : e.length === 6 && (e = `${e}ff`);
595
+ const n = `#${e.slice(0, 6)}`, i = e.slice(6, 8), a = Fe(i);
596
+ return { hex: n, opacity: a };
597
+ }
598
+ function wr(t, e) {
599
+ const n = t.replace("#", ""), i = Ee(e);
600
+ return `#${n}${i}`;
601
+ }
602
+ function yr(t) {
603
+ return /^#?([A-Fa-f0-9]{3}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(t);
604
+ }
605
+ function Cr({
606
+ color: t,
607
+ defaultColor: e,
608
+ opacity: n,
609
+ defaultOpacity: i = 100,
610
+ onColorChange: a,
611
+ onOpacityChange: r,
612
+ label: s,
613
+ showOpacity: c = !0
614
+ }) {
615
+ const [g, b] = Z({
616
+ value: t,
617
+ defaultValue: void 0,
618
+ finalValue: void 0,
619
+ onChange: a
620
+ }), [z, h] = Z({
621
+ value: n,
622
+ defaultValue: void 0,
623
+ finalValue: void 0,
624
+ onChange: r
625
+ }), u = g === void 0, f = z === void 0, F = u && (!c || f), l = g ?? e, x = z ?? i, [v, _] = L(!1), [O, I] = L(l.replace("#", "").toUpperCase()), [$, j] = L(x);
626
+ U(() => {
627
+ I(l.replace("#", "").toUpperCase());
628
+ }, [l]), U(() => {
629
+ j(x);
630
+ }, [x]);
631
+ const q = (d) => {
632
+ if (d.length === 9) {
633
+ const E = d.slice(0, 7).toUpperCase(), k = d.slice(7, 9), y = Fe(k);
634
+ b(E), c && h(y);
635
+ } else
636
+ b(d.toUpperCase());
637
+ }, p = () => {
638
+ const d = Ee(x);
639
+ return `${l}${d}`.toUpperCase();
640
+ }, m = (d) => {
641
+ I(d.currentTarget.value.toUpperCase());
642
+ }, P = () => {
643
+ let d = O.toUpperCase();
644
+ d && !d.startsWith("#") && (d = `#${d}`), /^#[0-9A-F]{6}$/i.test(d) && d !== l ? b(d) : I(l.replace("#", "").toUpperCase());
645
+ }, w = (d) => {
646
+ j(d);
647
+ }, M = () => {
648
+ const d = typeof $ == "string" ? parseFloat($) : $;
649
+ if (isNaN(d))
650
+ j(x);
651
+ else {
652
+ const E = Math.min(100, Math.max(0, d));
653
+ E !== x && h(E);
654
+ }
655
+ }, K = () => {
656
+ b(void 0), c && h(void 0);
657
+ }, N = /* @__PURE__ */ S(R, { gap: 4, wrap: "nowrap", children: [
658
+ /* @__PURE__ */ S(R, { gap: 0, children: [
659
+ /* @__PURE__ */ S(oe, { opened: v, onChange: _, position: "bottom-start", shadow: "md", children: [
660
+ /* @__PURE__ */ o(oe.Target, { children: /* @__PURE__ */ o(
661
+ D,
662
+ {
663
+ variant: "filled",
664
+ size: 24,
665
+ radius: 0,
666
+ style: {
667
+ backgroundColor: "var(--mantine-color-default)",
668
+ borderRadius: "4px 0 0 4px"
669
+ },
670
+ onClick: () => {
671
+ _((d) => !d);
672
+ },
673
+ "aria-label": "Color swatch",
674
+ children: /* @__PURE__ */ o(
675
+ Ct,
676
+ {
677
+ color: l,
678
+ size: 14,
679
+ radius: 2,
680
+ style: {
681
+ border: "1px solid var(--mantine-color-default-border)"
682
+ }
683
+ }
684
+ )
685
+ }
686
+ ) }),
687
+ /* @__PURE__ */ o(oe.Dropdown, { p: "xs", children: /* @__PURE__ */ o(
688
+ St,
689
+ {
690
+ format: "hexa",
691
+ value: p(),
692
+ onChange: q,
693
+ swatches: [...Xt]
694
+ }
695
+ ) })
696
+ ] }),
697
+ /* @__PURE__ */ o(
698
+ ye,
699
+ {
700
+ size: "compact",
701
+ value: O,
702
+ onChange: m,
703
+ onBlur: P,
704
+ "aria-label": "Color hex value",
705
+ "data-is-default": u ? "true" : "false",
706
+ w: 72,
707
+ styles: {
708
+ input: {
709
+ borderRadius: c ? 0 : "0 4px 4px 0",
710
+ fontFamily: "monospace",
711
+ textTransform: "uppercase",
712
+ ...u ? {
713
+ fontStyle: "italic",
714
+ color: "var(--mantine-color-dimmed)"
715
+ } : {}
716
+ }
717
+ }
718
+ }
719
+ ),
720
+ c && /* @__PURE__ */ S(Bt, { children: [
721
+ /* @__PURE__ */ o(
722
+ A,
723
+ {
724
+ style: {
725
+ width: 1,
726
+ height: 24,
727
+ backgroundColor: "var(--mantine-color-default-border)"
728
+ }
729
+ }
730
+ ),
731
+ /* @__PURE__ */ o(
732
+ le,
733
+ {
734
+ size: "compact",
735
+ value: $,
736
+ onChange: w,
737
+ onBlur: M,
738
+ min: 0,
739
+ max: 100,
740
+ hideControls: !0,
741
+ suffix: "%",
742
+ "aria-label": "Opacity",
743
+ "data-is-default": f ? "true" : "false",
744
+ w: 54,
745
+ styles: {
746
+ input: {
747
+ borderRadius: "0 4px 4px 0",
748
+ textAlign: "right",
749
+ ...f ? {
750
+ fontStyle: "italic",
751
+ color: "var(--mantine-color-dimmed)"
752
+ } : {}
753
+ }
754
+ }
755
+ }
756
+ )
757
+ ] })
758
+ ] }),
759
+ !F && /* @__PURE__ */ o(
760
+ D,
761
+ {
762
+ variant: "subtle",
763
+ size: "xs",
764
+ c: "dimmed",
765
+ "aria-label": `Reset ${s ?? "color"} to default`,
766
+ onClick: K,
767
+ children: /* @__PURE__ */ o(ne, { size: 12 })
768
+ }
769
+ )
770
+ ] });
771
+ return s ? /* @__PURE__ */ S(W, { gap: 0, children: [
772
+ /* @__PURE__ */ o(H, { size: "xs", c: "dimmed", mb: 1, lh: 1.2, children: s }),
773
+ N
774
+ ] }) : N;
775
+ }
776
+ function Sr({ label: t, actions: e, children: n }) {
777
+ return /* @__PURE__ */ S(A, { children: [
778
+ /* @__PURE__ */ o(Ce, { color: "gray.7", mt: 8, mb: 0 }),
779
+ /* @__PURE__ */ S(R, { justify: "space-between", py: 8, children: [
780
+ /* @__PURE__ */ o(H, { size: "xs", fw: 500, lh: 1.2, children: t }),
781
+ e && /* @__PURE__ */ o(R, { gap: 4, children: e })
782
+ ] }),
783
+ /* @__PURE__ */ o(W, { gap: 0, children: n })
784
+ ] });
785
+ }
786
+ function Tr({
787
+ label: t,
788
+ defaultOpen: e = !0,
789
+ children: n,
790
+ hasConfiguredValues: i = !1
791
+ }) {
792
+ const [a, { toggle: r }] = Se(e);
793
+ return /* @__PURE__ */ S(A, { children: [
794
+ /* @__PURE__ */ o(Ce, { color: "gray.7", mt: 8, mb: 0 }),
795
+ /* @__PURE__ */ o(R, { justify: "space-between", py: 8, style: { cursor: "pointer" }, onClick: r, children: /* @__PURE__ */ S(R, { gap: 4, children: [
796
+ /* @__PURE__ */ o(
797
+ D,
798
+ {
799
+ variant: "subtle",
800
+ size: "xs",
801
+ c: "dimmed",
802
+ "aria-label": a ? `Collapse ${t}` : `Expand ${t}`,
803
+ children: a ? /* @__PURE__ */ o(ce, { size: 12 }) : /* @__PURE__ */ o(Te, { size: 12 })
804
+ }
805
+ ),
806
+ /* @__PURE__ */ o(H, { size: "xs", fw: 500, lh: 1.2, children: t }),
807
+ i && /* @__PURE__ */ o(
808
+ A,
809
+ {
810
+ "aria-label": `${t} has configured values`,
811
+ style: {
812
+ width: 6,
813
+ height: 6,
814
+ borderRadius: "50%",
815
+ backgroundColor: "var(--mantine-color-blue-5)",
816
+ marginLeft: 4
817
+ }
818
+ }
819
+ )
820
+ ] }) }),
821
+ /* @__PURE__ */ o(Tt, { in: a, children: /* @__PURE__ */ o(W, { gap: 0, children: n }) })
822
+ ] });
823
+ }
824
+ function _r({ label: t, defaultOpen: e = !1, children: n }) {
825
+ const [i, { toggle: a }] = Se(e);
826
+ return /* @__PURE__ */ S(A, { children: [
827
+ /* @__PURE__ */ S(R, { gap: 4, py: 4, style: { cursor: "pointer" }, onClick: a, children: [
828
+ /* @__PURE__ */ o(
829
+ D,
830
+ {
831
+ variant: "subtle",
832
+ size: "xs",
833
+ c: "dimmed",
834
+ "aria-label": i ? `Collapse ${t}` : `Expand ${t}`,
835
+ children: i ? /* @__PURE__ */ o(ce, { size: 10 }) : /* @__PURE__ */ o(Te, { size: 10 })
836
+ }
837
+ ),
838
+ /* @__PURE__ */ o(H, { size: "xs", c: "dimmed", lh: 1.2, children: t })
839
+ ] }),
840
+ i && /* @__PURE__ */ o(A, { pl: "md", children: /* @__PURE__ */ o(W, { gap: 4, children: n }) })
841
+ ] });
842
+ }
843
+ function Ir({
844
+ label: t,
845
+ checked: e,
846
+ defaultChecked: n,
847
+ onChange: i,
848
+ children: a
849
+ }) {
850
+ const [r, s] = Z({
851
+ value: e,
852
+ defaultValue: n,
853
+ finalValue: !1,
854
+ onChange: i
855
+ });
856
+ return /* @__PURE__ */ S(W, { gap: 4, children: [
857
+ /* @__PURE__ */ o(
858
+ ve,
859
+ {
860
+ size: "compact",
861
+ label: t,
862
+ checked: r,
863
+ onChange: (c) => {
864
+ s(c.currentTarget.checked);
865
+ }
866
+ }
867
+ ),
868
+ r && /* @__PURE__ */ o(A, { "data-testid": "effect-toggle-children", pl: "md", children: /* @__PURE__ */ o(W, { gap: 4, children: a }) })
869
+ ] });
870
+ }
871
+ function Zt() {
872
+ return crypto.randomUUID().slice(0, 8);
873
+ }
874
+ function se(t, e) {
875
+ return {
876
+ id: Zt(),
877
+ offset: t,
878
+ color: e
879
+ };
880
+ }
881
+ function Kt() {
882
+ return [se(0, "#6366F1"), se(1, "#06B6D4")];
883
+ }
884
+ function kr({
885
+ stops: t,
886
+ defaultStops: e,
887
+ direction: n,
888
+ defaultDirection: i = 0,
889
+ showDirection: a = !0,
890
+ onChange: r
891
+ }) {
892
+ const [s, c] = Z({
893
+ value: t,
894
+ defaultValue: e,
895
+ finalValue: Kt(),
896
+ onChange: (l) => r == null ? void 0 : r(l, g)
897
+ }), [g, b] = Z({
898
+ value: n,
899
+ defaultValue: i,
900
+ finalValue: 0,
901
+ onChange: (l) => r == null ? void 0 : r(s, l)
902
+ }), z = (l, x) => {
903
+ const v = [...s];
904
+ v[l] = { ...v[l], color: x }, c(v), r == null || r(v, g);
905
+ }, h = (l, x) => {
906
+ const v = [...s];
907
+ v[l] = { ...v[l], offset: x / 100 }, c(v), r == null || r(v, g);
908
+ }, u = (l) => {
909
+ b(l), r == null || r(s, l);
910
+ }, f = () => {
911
+ if (s.length >= 5)
912
+ return;
913
+ const l = s.length > 0 ? (s[s.length - 1].offset + 1) / 2 : 0.5, x = [...s, se(l, Wt)];
914
+ x.sort((v, _) => v.offset - _.offset), c(x), r == null || r(x, g);
915
+ }, F = (l) => {
916
+ if (s.length <= 2)
917
+ return;
918
+ const x = s.filter((v, _) => _ !== l);
919
+ c(x), r == null || r(x, g);
920
+ };
921
+ return /* @__PURE__ */ S(W, { gap: "xs", children: [
922
+ /* @__PURE__ */ S(R, { justify: "space-between", align: "center", children: [
923
+ /* @__PURE__ */ o(H, { size: "xs", c: "dimmed", children: "Color Stops" }),
924
+ /* @__PURE__ */ o(
925
+ D,
926
+ {
927
+ size: "compact",
928
+ variant: "subtle",
929
+ color: "gray",
930
+ onClick: f,
931
+ disabled: s.length >= 5,
932
+ "aria-label": "Add color stop",
933
+ children: /* @__PURE__ */ o(Rt, { size: 12 })
934
+ }
935
+ )
936
+ ] }),
937
+ s.map((l, x) => /* @__PURE__ */ S(R, { gap: "xs", align: "flex-end", children: [
938
+ /* @__PURE__ */ o(A, { style: { flex: 1 }, children: /* @__PURE__ */ o(
939
+ Pe,
940
+ {
941
+ size: "compact",
942
+ value: l.color,
943
+ onChange: (v) => {
944
+ z(x, v);
945
+ },
946
+ "aria-label": `Color stop ${x + 1}`
947
+ }
948
+ ) }),
949
+ /* @__PURE__ */ o(A, { style: { width: "80px" }, children: /* @__PURE__ */ o(
950
+ ae,
951
+ {
952
+ size: "compact",
953
+ min: 0,
954
+ max: 100,
955
+ value: l.offset * 100,
956
+ onChange: (v) => {
957
+ h(x, v);
958
+ },
959
+ label: (v) => `${Math.round(v)}%`,
960
+ "aria-label": `Stop ${x + 1} position`
961
+ }
962
+ ) }),
963
+ /* @__PURE__ */ o(
964
+ D,
965
+ {
966
+ size: "compact",
967
+ variant: "subtle",
968
+ color: "gray",
969
+ onClick: () => {
970
+ F(x);
971
+ },
972
+ disabled: s.length <= 2,
973
+ "aria-label": `Remove color stop ${x + 1}`,
974
+ children: /* @__PURE__ */ o(Ft, { size: 12 })
975
+ }
976
+ )
977
+ ] }, l.id)),
978
+ a && /* @__PURE__ */ S(A, { children: [
979
+ /* @__PURE__ */ o(H, { size: "xs", c: "dimmed", mb: 4, children: "Direction" }),
980
+ /* @__PURE__ */ o(
981
+ ae,
982
+ {
983
+ size: "compact",
984
+ min: 0,
985
+ max: 360,
986
+ value: g,
987
+ onChange: u,
988
+ label: (l) => `${l}°`,
989
+ "aria-label": "Gradient direction",
990
+ marks: [
991
+ { value: 0, label: "0°" },
992
+ { value: 90, label: "90°" },
993
+ { value: 180, label: "180°" },
994
+ { value: 270, label: "270°" },
995
+ { value: 360, label: "360°" }
996
+ ]
997
+ }
998
+ )
999
+ ] })
1000
+ ] });
1001
+ }
1002
+ function Yt({ children: t }) {
1003
+ return /* @__PURE__ */ o(A, { p: "sm", children: t });
1004
+ }
1005
+ const qt = [
1006
+ // Mantine portal containers
1007
+ "[data-portal]",
1008
+ // Combobox/Select dropdowns
1009
+ "[data-combobox-dropdown]",
1010
+ // Menu dropdowns
1011
+ "[data-menu-dropdown]",
1012
+ // Popover dropdowns
1013
+ "[data-popover-dropdown]",
1014
+ // Tooltip content
1015
+ "[data-tooltip]",
1016
+ // HoverCard dropdown
1017
+ "[data-hovercard-dropdown]",
1018
+ // DatePicker dropdowns
1019
+ "[data-dates-dropdown]",
1020
+ // Modal (just in case)
1021
+ "[data-modal]"
1022
+ ].join(", ");
1023
+ function Jt(t, e = !0) {
1024
+ U(() => {
1025
+ if (!e)
1026
+ return;
1027
+ const n = (i) => {
1028
+ const a = i.target;
1029
+ a.closest('[role="dialog"]') || a.closest("[data-popout-trigger]") || a.closest("[data-popout-portal-container]") || a.closest(qt) || t();
1030
+ };
1031
+ return document.addEventListener("mousedown", n), () => {
1032
+ document.removeEventListener("mousedown", n);
1033
+ };
1034
+ }, [t, e]);
1035
+ }
1036
+ function Qt(t, e = !0) {
1037
+ U(() => {
1038
+ if (!e)
1039
+ return;
1040
+ const n = (i) => {
1041
+ i.key === "Escape" && (i.preventDefault(), t());
1042
+ };
1043
+ return document.addEventListener("keydown", n), () => {
1044
+ document.removeEventListener("keydown", n);
1045
+ };
1046
+ }, [t, e]);
1047
+ }
1048
+ const pe = Ie(null), Oe = Ie(null);
1049
+ function Ae() {
1050
+ const t = ue(pe);
1051
+ if (!t)
1052
+ throw new Error("usePopoutContext must be used within a Popout component");
1053
+ return t;
1054
+ }
1055
+ function er() {
1056
+ return ue(pe);
1057
+ }
1058
+ function tr() {
1059
+ const t = ue(Oe);
1060
+ if (!t)
1061
+ throw new Error("usePopoutManagerContext must be used within a PopoutManager");
1062
+ return t;
1063
+ }
1064
+ function rr({ children: t, parentId: e = null }) {
1065
+ const n = ke(), [i, a] = L(!1), r = G(null), s = _e(
1066
+ () => ({
1067
+ id: n,
1068
+ isOpen: i,
1069
+ open: () => {
1070
+ a(!0);
1071
+ },
1072
+ close: () => {
1073
+ a(!1);
1074
+ },
1075
+ toggle: () => {
1076
+ a((c) => !c);
1077
+ },
1078
+ triggerRef: r,
1079
+ parentId: e
1080
+ }),
1081
+ [n, i, e]
1082
+ );
1083
+ return /* @__PURE__ */ o(pe.Provider, { value: s, children: t });
1084
+ }
1085
+ function or({ children: t }) {
1086
+ const [e, n] = L(null), i = G([]), a = G(/* @__PURE__ */ new Map()), r = G(/* @__PURE__ */ new Map()), [s, c] = L(0), g = T((p, m, P) => {
1087
+ var w, M;
1088
+ if (!i.current.includes(p)) {
1089
+ const K = i.current, N = [];
1090
+ for (const d of K)
1091
+ r.current.get(d) === (P ?? null) && N.push(d);
1092
+ for (const d of N.reverse()) {
1093
+ const E = [];
1094
+ for (const k of K) {
1095
+ let y = k;
1096
+ for (; y; ) {
1097
+ const Y = r.current.get(y);
1098
+ if (Y === d) {
1099
+ E.push(k);
1100
+ break;
1101
+ }
1102
+ y = Y ?? null;
1103
+ }
1104
+ }
1105
+ for (const k of E.reverse())
1106
+ (w = a.current.get(k)) == null || w();
1107
+ (M = a.current.get(d)) == null || M();
1108
+ }
1109
+ i.current = [...i.current.filter((d) => !N.includes(d) && !N.some((E) => {
1110
+ let k = d;
1111
+ for (; k; ) {
1112
+ const y = r.current.get(k);
1113
+ if (y === E)
1114
+ return !0;
1115
+ k = y ?? null;
1116
+ }
1117
+ return !1;
1118
+ })), p], a.current.set(p, m), r.current.set(p, P ?? null), c((d) => d + 1);
1119
+ }
1120
+ }, []), b = T((p) => {
1121
+ i.current = i.current.filter((m) => m !== p), a.current.delete(p), r.current.delete(p), c((m) => m + 1);
1122
+ }, []), z = T((p) => {
1123
+ const m = i.current.indexOf(p);
1124
+ return m >= 0 ? xe + m : xe;
1125
+ }, []), h = T((p) => {
1126
+ const m = i.current, P = m.indexOf(p);
1127
+ P === -1 || P === m.length - 1 || (i.current = [
1128
+ ...m.filter((w) => w !== p),
1129
+ p
1130
+ ], c((w) => w + 1));
1131
+ }, []), u = T((p) => r.current.get(p) ?? null, []), f = T((p, m) => {
1132
+ let P = m;
1133
+ for (; P; ) {
1134
+ const w = r.current.get(P);
1135
+ if (w === p)
1136
+ return !0;
1137
+ P = w ?? null;
1138
+ }
1139
+ return !1;
1140
+ }, []), F = T((p) => {
1141
+ const m = [], P = i.current;
1142
+ for (const w of P)
1143
+ f(p, w) && m.push(w);
1144
+ return m;
1145
+ }, [f]), l = T((p) => {
1146
+ const m = F(p);
1147
+ for (const P of [...m].reverse()) {
1148
+ const w = a.current.get(P);
1149
+ w == null || w();
1150
+ }
1151
+ }, [F]), x = T((p) => {
1152
+ l(p);
1153
+ const m = a.current.get(p);
1154
+ m == null || m();
1155
+ }, [l]), v = T((p, m) => {
1156
+ const P = i.current;
1157
+ for (const w of P) {
1158
+ if (w === p)
1159
+ continue;
1160
+ r.current.get(w) === m && x(w);
1161
+ }
1162
+ }, [x]), _ = T(() => {
1163
+ const p = i.current;
1164
+ if (p.length === 0)
1165
+ return;
1166
+ const m = p[p.length - 1], P = a.current.get(m);
1167
+ P == null || P();
1168
+ }, []), O = T(() => {
1169
+ const p = [...i.current];
1170
+ for (const m of p) {
1171
+ const P = a.current.get(m);
1172
+ P == null || P();
1173
+ }
1174
+ }, []), I = T(() => i.current.length > 0, []), [$, j] = L(!1);
1175
+ U(() => {
1176
+ j(i.current.length > 0);
1177
+ }, [s]), Qt(_, $), Jt(O, $);
1178
+ const q = _e(
1179
+ () => ({
1180
+ register: g,
1181
+ unregister: b,
1182
+ getZIndex: z,
1183
+ bringToFront: h,
1184
+ portalContainer: e,
1185
+ zIndexVersion: s,
1186
+ closeFocused: _,
1187
+ closeAll: O,
1188
+ hasOpenPopouts: I,
1189
+ closeWithDescendants: x,
1190
+ closeDescendants: l,
1191
+ closeSiblings: v,
1192
+ getParentId: u,
1193
+ isAncestor: f
1194
+ }),
1195
+ [g, b, z, h, e, s, _, O, I, x, l, v, u, f]
1196
+ );
1197
+ return /* @__PURE__ */ S(Oe.Provider, { value: q, children: [
1198
+ t,
1199
+ /* @__PURE__ */ o("div", { ref: n, "data-popout-portal-container": !0 })
1200
+ ] });
1201
+ }
1202
+ function nr(t) {
1203
+ const { isOpen: e, onDragStart: n } = t, [i, a] = L({ left: 0, top: 0 }), r = G(!1), s = G({
1204
+ x: 0,
1205
+ y: 0,
1206
+ offsetLeft: 0,
1207
+ offsetTop: 0
1208
+ }), c = T(() => {
1209
+ a({ left: 0, top: 0 });
1210
+ }, []), g = T(
1211
+ (h) => {
1212
+ const u = h.target;
1213
+ u.tagName === "INPUT" || u.tagName === "TEXTAREA" || u.tagName === "BUTTON" || u.tagName === "SELECT" || u.closest("button") || u.closest("input") || u.closest("textarea") || u.closest("select") || (r.current = !0, s.current = {
1214
+ x: h.clientX,
1215
+ y: h.clientY,
1216
+ offsetLeft: i.left,
1217
+ offsetTop: i.top
1218
+ }, n == null || n(), h.target.setPointerCapture(h.pointerId));
1219
+ },
1220
+ [i.left, i.top, n]
1221
+ ), b = T((h) => {
1222
+ if (!r.current)
1223
+ return;
1224
+ const u = h.clientX - s.current.x, f = h.clientY - s.current.y;
1225
+ a({
1226
+ left: s.current.offsetLeft + u,
1227
+ top: s.current.offsetTop + f
1228
+ });
1229
+ }, []), z = T((h) => {
1230
+ r.current && (r.current = !1, h.target.releasePointerCapture(h.pointerId));
1231
+ }, []);
1232
+ return e ? {
1233
+ dragTriggerProps: {
1234
+ "data-drag-trigger": !0,
1235
+ onPointerDown: g,
1236
+ onPointerMove: b,
1237
+ onPointerUp: z,
1238
+ style: {
1239
+ cursor: "grab",
1240
+ userSelect: "none",
1241
+ touchAction: "none"
1242
+ }
1243
+ },
1244
+ dragOffset: i,
1245
+ resetDragOffset: c
1246
+ } : {
1247
+ dragTriggerProps: {},
1248
+ dragOffset: { left: 0, top: 0 },
1249
+ resetDragOffset: c
1250
+ };
1251
+ }
1252
+ function ir({ id: t, label: e, isActive: n, onClick: i }) {
1253
+ return /* @__PURE__ */ o(
1254
+ _t,
1255
+ {
1256
+ role: "tab",
1257
+ id: `tab-${t}`,
1258
+ "aria-selected": n,
1259
+ "aria-controls": `tabpanel-${t}`,
1260
+ onClick: i,
1261
+ px: "xs",
1262
+ py: 3,
1263
+ style: {
1264
+ fontSize: "11px",
1265
+ fontWeight: n ? 500 : 400,
1266
+ color: n ? "var(--mantine-color-text)" : "var(--mantine-color-dimmed)",
1267
+ borderBottom: n ? "2px solid var(--mantine-color-blue-filled)" : "2px solid transparent",
1268
+ cursor: "pointer"
1269
+ },
1270
+ children: e
1271
+ }
1272
+ );
1273
+ }
1274
+ function ar({
1275
+ config: t,
1276
+ onClose: e,
1277
+ dragTriggerProps: n = {},
1278
+ actions: i = [],
1279
+ activeTab: a,
1280
+ onTabChange: r,
1281
+ titleId: s
1282
+ }) {
1283
+ var u;
1284
+ const { style: c, ...g } = n, z = t.variant === "tabs" ? t : null, h = (f) => {
1285
+ r && r(f);
1286
+ };
1287
+ return /* @__PURE__ */ S(
1288
+ R,
1289
+ {
1290
+ justify: "space-between",
1291
+ px: "sm",
1292
+ py: "xs",
1293
+ ...g,
1294
+ style: {
1295
+ ...c
1296
+ },
1297
+ children: [
1298
+ t.variant === "title" ? /* @__PURE__ */ o(H, { id: s, size: "compact", fw: 500, children: t.title }) : /* @__PURE__ */ S(R, { gap: 0, role: "tablist", "aria-label": "Panel tabs", children: [
1299
+ /* @__PURE__ */ o("span", { id: s, style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0, 0, 0, 0)" }, children: ((u = z == null ? void 0 : z.tabs[0]) == null ? void 0 : u.label) ?? "Settings" }),
1300
+ z == null ? void 0 : z.tabs.map((f) => /* @__PURE__ */ o(
1301
+ ir,
1302
+ {
1303
+ id: f.id,
1304
+ label: f.label,
1305
+ isActive: a === f.id,
1306
+ onClick: () => {
1307
+ h(f.id);
1308
+ }
1309
+ },
1310
+ f.id
1311
+ ))
1312
+ ] }),
1313
+ /* @__PURE__ */ S(R, { gap: 4, children: [
1314
+ i.map((f) => /* @__PURE__ */ o(
1315
+ D,
1316
+ {
1317
+ variant: "subtle",
1318
+ size: "compact",
1319
+ onClick: f.onClick,
1320
+ "aria-label": f.label,
1321
+ children: f.icon
1322
+ },
1323
+ f.id
1324
+ )),
1325
+ /* @__PURE__ */ o(D, { variant: "subtle", size: "compact", onClick: e, "aria-label": "Close panel", children: /* @__PURE__ */ o(ne, { size: 14 }) })
1326
+ ] })
1327
+ ]
1328
+ }
1329
+ );
1330
+ }
1331
+ function sr(t, e, n = Vt, i = {}) {
1332
+ const { placement: a = "left", alignment: r = "start", panelHeight: s = 0 } = i;
1333
+ let c, g;
1334
+ switch (a) {
1335
+ case "left":
1336
+ c = t.left - e - n, g = be(t, r, s);
1337
+ break;
1338
+ case "right":
1339
+ c = t.right + n, g = be(t, r, s);
1340
+ break;
1341
+ case "top":
1342
+ c = ze(t, r, e), g = t.top - s - n;
1343
+ break;
1344
+ case "bottom":
1345
+ c = ze(t, r, e), g = t.bottom + n;
1346
+ break;
1347
+ default: {
1348
+ const b = a;
1349
+ throw new Error(`Unknown placement: ${String(b)}`);
1350
+ }
1351
+ }
1352
+ return { left: c, top: g };
1353
+ }
1354
+ function be(t, e, n) {
1355
+ switch (e) {
1356
+ case "start":
1357
+ return t.top;
1358
+ case "center":
1359
+ return t.top + t.height / 2 - n / 2;
1360
+ case "end":
1361
+ return t.bottom - n;
1362
+ default: {
1363
+ const i = e;
1364
+ throw new Error(`Unknown alignment: ${String(i)}`);
1365
+ }
1366
+ }
1367
+ }
1368
+ function ze(t, e, n) {
1369
+ switch (e) {
1370
+ case "start":
1371
+ return t.left;
1372
+ case "center":
1373
+ return t.left + t.width / 2 - n / 2;
1374
+ case "end":
1375
+ return t.right - n;
1376
+ default: {
1377
+ const i = e;
1378
+ throw new Error(`Unknown alignment: ${String(i)}`);
1379
+ }
1380
+ }
1381
+ }
1382
+ function lr({
1383
+ width: t,
1384
+ height: e,
1385
+ header: n,
1386
+ children: i,
1387
+ anchorRef: a,
1388
+ placement: r = "left",
1389
+ alignment: s = "start",
1390
+ gap: c = 0,
1391
+ actions: g
1392
+ }) {
1393
+ var ge, he;
1394
+ const { isOpen: b, close: z, triggerRef: h, id: u, parentId: f } = Ae(), { getZIndex: F, portalContainer: l, register: x, unregister: v, bringToFront: _, zIndexVersion: O, closeWithDescendants: I, closeDescendants: $ } = tr(), j = ke(), q = `popout-panel-${u}`, p = `popout-title-${j}`, [m, P] = L(null), w = G(!1), M = G(null), K = T(() => {
1395
+ _(u);
1396
+ }, [_, u]), { dragTriggerProps: N, dragOffset: d, resetDragOffset: E } = nr({
1397
+ isOpen: b,
1398
+ onDragStart: K
1399
+ }), k = n.variant === "tabs", y = k ? n : null, Y = (y == null ? void 0 : y.defaultTab) ?? ((ge = y == null ? void 0 : y.tabs[0]) == null ? void 0 : ge.id), [de, fe] = L(Y), Le = T(
1400
+ (C) => {
1401
+ var X;
1402
+ fe(C), (X = y == null ? void 0 : y.onTabChange) == null || X.call(y, C);
1403
+ },
1404
+ [y]
1405
+ ), De = T(
1406
+ (C) => {
1407
+ C.stopPropagation(), $(u), _(u);
1408
+ },
1409
+ [$, _, u]
1410
+ ), $e = T(() => {
1411
+ I(u);
1412
+ }, [I, u]);
1413
+ if (U(() => (b ? x(u, z, f) : v(u), () => {
1414
+ v(u);
1415
+ }), [b, u, x, v, z, f]), U(() => {
1416
+ if (b) {
1417
+ let C = (a == null ? void 0 : a.current) ?? null;
1418
+ if (!C && f && (C = document.querySelector(`[data-popout-id="${f}"]`)), C || (C = h.current), C) {
1419
+ const X = C.getBoundingClientRect(), Ue = sr(X, t, c, {
1420
+ placement: r,
1421
+ alignment: s,
1422
+ panelHeight: e
1423
+ });
1424
+ P(Ue), w.current || (E(), k && fe(Y));
1425
+ }
1426
+ }
1427
+ w.current = b;
1428
+ }, [b, t, e, c, h, a, r, s, E, k, Y, f]), U(() => {
1429
+ if (b && M.current) {
1430
+ const C = setTimeout(() => {
1431
+ var X;
1432
+ (X = M.current) == null || X.focus();
1433
+ }, 0);
1434
+ return () => {
1435
+ clearTimeout(C);
1436
+ };
1437
+ } else !b && h.current && h.current.focus();
1438
+ }, [b, h]), !b || !l || !m)
1439
+ return null;
1440
+ const He = F(u), me = {
1441
+ left: m.left + d.left,
1442
+ top: m.top + d.top
1443
+ }, J = "1px solid light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.12))", te = "none", ie = a !== void 0 || f !== void 0, Me = () => ie ? {
1444
+ borderTop: r === "bottom" ? te : J,
1445
+ borderRight: r === "left" ? te : J,
1446
+ borderBottom: r === "top" ? te : J,
1447
+ borderLeft: r === "right" ? te : J
1448
+ } : { border: J }, Ne = () => {
1449
+ if (!ie)
1450
+ return {};
1451
+ const C = 8;
1452
+ switch (r) {
1453
+ case "left":
1454
+ return {
1455
+ borderTopLeftRadius: C,
1456
+ borderBottomLeftRadius: C,
1457
+ borderTopRightRadius: 0,
1458
+ borderBottomRightRadius: 0
1459
+ };
1460
+ case "right":
1461
+ return {
1462
+ borderTopLeftRadius: 0,
1463
+ borderBottomLeftRadius: 0,
1464
+ borderTopRightRadius: C,
1465
+ borderBottomRightRadius: C
1466
+ };
1467
+ case "top":
1468
+ return {
1469
+ borderTopLeftRadius: C,
1470
+ borderTopRightRadius: C,
1471
+ borderBottomLeftRadius: 0,
1472
+ borderBottomRightRadius: 0
1473
+ };
1474
+ case "bottom":
1475
+ return {
1476
+ borderTopLeftRadius: 0,
1477
+ borderTopRightRadius: 0,
1478
+ borderBottomLeftRadius: C,
1479
+ borderBottomRightRadius: C
1480
+ };
1481
+ default:
1482
+ return {};
1483
+ }
1484
+ }, Ve = /* @__PURE__ */ S(
1485
+ It,
1486
+ {
1487
+ ref: M,
1488
+ id: q,
1489
+ role: "dialog",
1490
+ "aria-modal": "false",
1491
+ "aria-labelledby": p,
1492
+ tabIndex: -1,
1493
+ radius: ie ? 0 : 8,
1494
+ onClick: De,
1495
+ "data-popout-id": u,
1496
+ ...f && { "data-parent-id": f },
1497
+ style: {
1498
+ position: "fixed",
1499
+ left: me.left,
1500
+ top: me.top,
1501
+ width: t,
1502
+ ...e !== void 0 && { height: e },
1503
+ zIndex: He,
1504
+ backgroundColor: "var(--mantine-color-body)",
1505
+ // Conditional borders for pixel-perfect edge alignment with anchor
1506
+ ...Me(),
1507
+ // Conditional border radius - flatten corners on snapping side
1508
+ ...Ne(),
1509
+ // Figma-style shadows: tight, hard near edges, softer further out
1510
+ boxShadow: [
1511
+ "0 1px 2px light-dark(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.4))",
1512
+ // Hard close shadow
1513
+ "0 4px 8px light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.35))",
1514
+ // Medium shadow
1515
+ "0 8px 16px light-dark(rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.25))"
1516
+ // Soft far shadow
1517
+ ].join(", "),
1518
+ // Focus outline for keyboard navigation
1519
+ outline: "none"
1520
+ },
1521
+ children: [
1522
+ /* @__PURE__ */ o(
1523
+ ar,
1524
+ {
1525
+ config: n,
1526
+ onClose: $e,
1527
+ dragTriggerProps: N,
1528
+ activeTab: de,
1529
+ onTabChange: Le,
1530
+ actions: g,
1531
+ titleId: p
1532
+ }
1533
+ ),
1534
+ /* @__PURE__ */ o(A, { children: k ? (he = y == null ? void 0 : y.tabs.find((C) => C.id === de)) == null ? void 0 : he.content : i })
1535
+ ]
1536
+ }
1537
+ );
1538
+ return At(Ve, l);
1539
+ }
1540
+ function cr({ children: t }) {
1541
+ const { toggle: e, triggerRef: n, isOpen: i, id: a } = Ae(), r = T(
1542
+ (g) => {
1543
+ g.stopPropagation(), e();
1544
+ },
1545
+ [e]
1546
+ );
1547
+ if (!Et(t))
1548
+ throw new Error("PopoutTrigger requires a single valid React element as its child");
1549
+ const s = `popout-panel-${a}`, c = t;
1550
+ return Ot(c, {
1551
+ onClick: (g) => {
1552
+ var b, z;
1553
+ (z = (b = c.props).onClick) == null || z.call(b, g), r(g);
1554
+ },
1555
+ ref: n,
1556
+ // Mark this element as a popout trigger for click-outside detection
1557
+ "data-popout-trigger": !0,
1558
+ // ARIA attributes for accessibility
1559
+ "aria-expanded": i,
1560
+ "aria-controls": s,
1561
+ "aria-haspopup": "dialog"
1562
+ });
1563
+ }
1564
+ function ur({ children: t }) {
1565
+ const e = er(), n = (e == null ? void 0 : e.id) ?? null;
1566
+ return /* @__PURE__ */ o(rr, { parentId: n, children: t });
1567
+ }
1568
+ const Br = Object.assign(ur, {
1569
+ Trigger: cr,
1570
+ Panel: lr,
1571
+ Content: Yt
1572
+ });
1573
+ function Rr({ children: t }) {
1574
+ return /* @__PURE__ */ o(or, { children: t });
1575
+ }
1576
+ function Fr({ label: t, value: e }) {
1577
+ return /* @__PURE__ */ S(R, { justify: "space-between", py: 4, children: [
1578
+ /* @__PURE__ */ o(H, { size: "compact", c: "dimmed", children: t }),
1579
+ /* @__PURE__ */ o(H, { size: "compact", c: "var(--mantine-color-text)", fw: 500, children: String(e) })
1580
+ ] });
1581
+ }
1582
+ function Er({
1583
+ label: t,
1584
+ value: e,
1585
+ defaultValue: n,
1586
+ onChange: i,
1587
+ min: a,
1588
+ max: r,
1589
+ step: s,
1590
+ decimalScale: c,
1591
+ suffix: g,
1592
+ hideControls: b = !0
1593
+ }) {
1594
+ const [z, h] = Z({
1595
+ value: e,
1596
+ defaultValue: void 0,
1597
+ // Start with undefined (using default)
1598
+ finalValue: void 0,
1599
+ onChange: i
1600
+ }), u = z === void 0, f = z ?? n, [F, l] = L(f);
1601
+ U(() => {
1602
+ l(z ?? n);
1603
+ }, [z, n]);
1604
+ const x = (O) => {
1605
+ l(O);
1606
+ }, v = () => {
1607
+ const O = typeof F == "string" ? parseFloat(F) : F;
1608
+ if (isNaN(O))
1609
+ l(z ?? n);
1610
+ else {
1611
+ let I = O;
1612
+ a !== void 0 && I < a && (I = a), r !== void 0 && I > r && (I = r), I !== z && h(I), l(I);
1613
+ }
1614
+ }, _ = () => {
1615
+ h(void 0);
1616
+ };
1617
+ return /* @__PURE__ */ S(R, { gap: 4, wrap: "nowrap", align: "flex-end", children: [
1618
+ /* @__PURE__ */ o(
1619
+ le,
1620
+ {
1621
+ label: t,
1622
+ "aria-label": t,
1623
+ value: F,
1624
+ onChange: x,
1625
+ onBlur: v,
1626
+ min: a,
1627
+ max: r,
1628
+ step: s,
1629
+ decimalScale: c,
1630
+ suffix: g,
1631
+ hideControls: b,
1632
+ size: "compact",
1633
+ "data-is-default": u ? "true" : "false",
1634
+ styles: {
1635
+ input: u ? {
1636
+ fontStyle: "italic",
1637
+ color: "var(--mantine-color-dimmed)"
1638
+ } : void 0
1639
+ },
1640
+ style: { flex: 1 }
1641
+ }
1642
+ ),
1643
+ !u && /* @__PURE__ */ o(
1644
+ D,
1645
+ {
1646
+ variant: "subtle",
1647
+ size: "xs",
1648
+ c: "dimmed",
1649
+ "aria-label": `Reset ${t} to default`,
1650
+ onClick: _,
1651
+ style: { marginBottom: 2 },
1652
+ children: /* @__PURE__ */ o(ne, { size: 12 })
1653
+ }
1654
+ )
1655
+ ] });
1656
+ }
1657
+ function Or({ label: t, value: e, defaultValue: n, options: i, onChange: a }) {
1658
+ const [r, s] = Z({
1659
+ value: e,
1660
+ defaultValue: void 0,
1661
+ // Start with undefined (using default)
1662
+ finalValue: void 0,
1663
+ onChange: a
1664
+ }), c = r === void 0, g = r ?? n, b = (h) => {
1665
+ h !== null && s(h);
1666
+ }, z = () => {
1667
+ s(void 0);
1668
+ };
1669
+ return /* @__PURE__ */ S(R, { gap: 4, wrap: "nowrap", align: "flex-end", children: [
1670
+ /* @__PURE__ */ o(
1671
+ we,
1672
+ {
1673
+ label: t,
1674
+ "aria-label": t,
1675
+ value: g,
1676
+ onChange: b,
1677
+ data: i,
1678
+ size: "compact",
1679
+ rightSection: /* @__PURE__ */ o(ce, { size: 14 }),
1680
+ rightSectionPointerEvents: "none",
1681
+ "data-is-default": c ? "true" : "false",
1682
+ allowDeselect: !1,
1683
+ styles: {
1684
+ input: c ? {
1685
+ fontStyle: "italic",
1686
+ color: "var(--mantine-color-dimmed)"
1687
+ } : void 0
1688
+ },
1689
+ style: { flex: 1 }
1690
+ }
1691
+ ),
1692
+ !c && /* @__PURE__ */ o(
1693
+ D,
1694
+ {
1695
+ variant: "subtle",
1696
+ size: "xs",
1697
+ c: "dimmed",
1698
+ "aria-label": `Reset ${t} to default`,
1699
+ onClick: z,
1700
+ style: { marginBottom: 2 },
1701
+ children: /* @__PURE__ */ o(ne, { size: 12 })
1702
+ }
1703
+ )
1704
+ ] });
1705
+ }
1706
+ function Ar() {
1707
+ return kt("dark");
1708
+ }
1709
+ const Lr = {
1710
+ xs: Q(4),
1711
+ sm: Q(8),
1712
+ md: Q(16),
1713
+ lg: Q(24),
1714
+ xl: Q(32)
1715
+ }, Dr = "0.1.0";
1716
+ export {
1717
+ Cr as CompactColorInput,
1718
+ Sr as ControlGroup,
1719
+ Tr as ControlSection,
1720
+ _r as ControlSubGroup,
1721
+ Wt as DEFAULT_GRADIENT_STOP_COLOR,
1722
+ Ir as EffectToggle,
1723
+ kr as GradientEditor,
1724
+ Lr as MANTINE_SPACING,
1725
+ Be as MAX_ALPHA_HEX,
1726
+ Re as MAX_OPACITY_PERCENT,
1727
+ Vt as POPOUT_GAP,
1728
+ br as POPOUT_NESTED_GAP,
1729
+ xe as POPOUT_Z_INDEX_BASE,
1730
+ Br as Popout,
1731
+ Rr as PopoutManager,
1732
+ vr as SWATCH_COLORS,
1733
+ Xt as SWATCH_COLORS_HEXA,
1734
+ Fr as StatRow,
1735
+ Er as StyleNumberInput,
1736
+ Or as StyleSelect,
1737
+ Dr as VERSION,
1738
+ Dt as compactColors,
1739
+ Lt as compactDarkColors,
1740
+ zr as compactTheme,
1741
+ se as createColorStop,
1742
+ Kt as createDefaultGradientStops,
1743
+ yr as isValidHex,
1744
+ Ee as opacityToAlphaHex,
1745
+ Fe as parseAlphaFromHexa,
1746
+ Pr as parseHexaColor,
1747
+ wr as toHexaColor,
1748
+ Ar as useActualColorScheme
1749
+ };