@fiscozen/composables 1.0.0 → 1.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.
@@ -0,0 +1,1453 @@
1
+ import { ref as g, reactive as Y, onUnmounted as Q, nextTick as J, onMounted as k, computed as F, watch as B, onBeforeUnmount as N, defineComponent as Z, useSlots as _, toRef as I, toRefs as ee, createElementBlock as j, openBlock as M, renderSlot as C, createElementVNode as V, withDirectives as T, createCommentVNode as U, createBlock as te, unref as P, normalizeClass as q, vShow as G, Teleport as oe } from "vue";
2
+ const le = (e, t) => {
3
+ const o = Math.pow(10, t);
4
+ return Math.trunc(e * o) / o;
5
+ }, ne = (e, {
6
+ minimumFractionDigits: t = 0,
7
+ maximumFractionDigits: o = 2,
8
+ roundDecimals: l = !0,
9
+ useGrouping: r = !0
10
+ } = {}) => e == null || isNaN(e) || !isFinite(e) ? "" : (l ? e : le(e, o)).toLocaleString("it-IT", {
11
+ minimumFractionDigits: t,
12
+ maximumFractionDigits: o,
13
+ useGrouping: r
14
+ }), re = (e) => {
15
+ if (!e || typeof e != "string")
16
+ return NaN;
17
+ let t = e.trim();
18
+ return t.includes(",") && (t = t.replace(/\./g, ""), t = t.replace(",", ".")), parseFloat(t);
19
+ }, ze = (e, t) => {
20
+ let o = t;
21
+ const l = t % e, r = t >= 0 ? e : -e;
22
+ return l !== 0 && (o = Math.abs(l) >= e / 2 ? t + r - l : t - l), o;
23
+ }, ke = (e, t, o) => Math.max(e, Math.min(t, o)), z = new DOMRect(0, 0, window.innerWidth, window.innerHeight), b = (e, t, o, l, r) => {
24
+ let n = r ? "bottom" : "right", p = r ? "bottom-start" : "right-start";
25
+ z.width = window.innerWidth, z.height = window.innerHeight, z.x = 0, z.y = 0;
26
+ const y = e ? e.getBoundingClientRect() : z, d = t.getBoundingClientRect(), v = o.getBoundingClientRect(), h = (v.left - y.left - d.width) / y.width, x = (y.right - v.right - d.width) / y.width, c = (v.top - y.top - d.height) / y.height, i = (y.bottom - v.bottom - d.height) / y.height;
27
+ let s = [
28
+ {
29
+ key: "right",
30
+ space: x
31
+ },
32
+ {
33
+ key: "top",
34
+ space: c
35
+ },
36
+ {
37
+ key: "bottom",
38
+ space: i
39
+ },
40
+ {
41
+ key: "left",
42
+ space: h
43
+ }
44
+ ].sort((u, f) => f.space - u.space);
45
+ if (r && (s = s.filter((u) => u.key === "top" || u.key === "bottom")), n = s[0].key, !l) {
46
+ const u = (d.height - v.height) / 2;
47
+ switch (n) {
48
+ case "right":
49
+ case "left":
50
+ y.top > v.top - u && (l = "end"), y.bottom < v.top - u && (l = "start");
51
+ break;
52
+ }
53
+ }
54
+ return p = l ? `${n}-${l}` : n, p;
55
+ }, ae = (e, t, o, l) => ({
56
+ x: t.x + e.width * o / 100,
57
+ y: t.y + e.height * l / 100
58
+ }), W = (e) => typeof e == "string" ? document.querySelector(e) : e, ie = (e) => ({
59
+ left: parseFloat(e.marginLeft),
60
+ right: parseFloat(e.marginRight),
61
+ top: parseFloat(e.marginTop),
62
+ bottom: parseFloat(e.marginBottom)
63
+ }), se = {
64
+ // Bottom positions - content below opener
65
+ bottom: (e, t) => ({
66
+ position: {
67
+ x: e.left - t.left + e.width / 2,
68
+ y: e.bottom
69
+ },
70
+ transform: { x: -50, y: 0 }
71
+ }),
72
+ "bottom-start": (e, t) => ({
73
+ position: {
74
+ x: e.left - t.left,
75
+ y: e.bottom
76
+ },
77
+ transform: { x: 0, y: 0 }
78
+ }),
79
+ "bottom-end": (e, t) => ({
80
+ position: {
81
+ x: e.right + t.right,
82
+ y: e.bottom
83
+ },
84
+ transform: { x: -100, y: 0 }
85
+ }),
86
+ // Top positions - content above opener
87
+ top: (e, t) => ({
88
+ position: {
89
+ x: e.left - t.left + e.width / 2,
90
+ y: e.top - t.bottom
91
+ },
92
+ transform: { x: -50, y: -100 }
93
+ }),
94
+ "top-start": (e, t) => ({
95
+ position: {
96
+ x: e.left - t.left,
97
+ y: e.top - t.bottom
98
+ },
99
+ transform: { x: 0, y: -100 }
100
+ }),
101
+ "top-end": (e, t) => ({
102
+ position: {
103
+ x: e.right + t.right,
104
+ y: e.top - t.bottom
105
+ },
106
+ transform: { x: -100, y: -100 }
107
+ }),
108
+ // Left positions - content to left of opener
109
+ left: (e, t) => ({
110
+ position: {
111
+ x: e.left - t.right,
112
+ y: e.top - t.top + e.height / 2
113
+ },
114
+ transform: { x: -100, y: -50 }
115
+ }),
116
+ "left-start": (e, t) => ({
117
+ position: {
118
+ x: e.left - t.right,
119
+ y: e.top - t.top
120
+ },
121
+ transform: { x: -100, y: 0 }
122
+ }),
123
+ "left-end": (e, t) => ({
124
+ position: {
125
+ x: e.left - t.right,
126
+ y: e.bottom + t.bottom
127
+ },
128
+ transform: { x: -100, y: -100 }
129
+ }),
130
+ // Right positions - content to right of opener
131
+ right: (e, t) => ({
132
+ position: {
133
+ x: e.right + t.left,
134
+ y: e.top - t.top + e.height / 2
135
+ },
136
+ transform: { x: 0, y: -50 }
137
+ }),
138
+ "right-start": (e, t) => ({
139
+ position: {
140
+ x: e.right + t.left,
141
+ y: e.top - t.top
142
+ },
143
+ transform: { x: 0, y: 0 }
144
+ }),
145
+ "right-end": (e, t) => ({
146
+ position: {
147
+ x: e.right + t.left,
148
+ y: e.bottom + t.bottom
149
+ },
150
+ transform: { x: 0, y: -100 }
151
+ })
152
+ }, pe = (e, t, o) => {
153
+ const l = se[e];
154
+ return l ? l(t, o) : { position: { x: 0, y: 0 }, transform: { x: 0, y: 0 } };
155
+ }, ue = {
156
+ bottom: (e, t) => ({
157
+ position: {
158
+ x: e.left + e.width / 2,
159
+ y: e.bottom - t.height
160
+ },
161
+ transform: { x: -50, y: 0 }
162
+ }),
163
+ "bottom-start": (e, t) => ({
164
+ position: {
165
+ x: e.left,
166
+ y: e.bottom - t.height
167
+ },
168
+ transform: { x: 0, y: 0 }
169
+ }),
170
+ "bottom-end": (e, t) => ({
171
+ position: {
172
+ x: e.right - t.width,
173
+ y: e.bottom - t.height
174
+ },
175
+ transform: { x: 0, y: 0 }
176
+ }),
177
+ top: (e) => ({
178
+ position: {
179
+ x: e.left + e.width / 2,
180
+ y: e.top
181
+ },
182
+ transform: { x: -50, y: 0 }
183
+ }),
184
+ "top-start": (e) => ({
185
+ position: {
186
+ x: e.left,
187
+ y: e.top
188
+ },
189
+ transform: { x: 0, y: 0 }
190
+ }),
191
+ "top-end": (e, t) => ({
192
+ position: {
193
+ x: e.right - t.width,
194
+ y: e.top
195
+ },
196
+ transform: { x: 0, y: 0 }
197
+ }),
198
+ left: (e, t) => ({
199
+ position: {
200
+ x: e.left,
201
+ y: e.top + (e.height - t.height) / 2
202
+ },
203
+ transform: { x: 0, y: 0 }
204
+ }),
205
+ "left-start": (e) => ({
206
+ position: {
207
+ x: e.left,
208
+ y: e.top
209
+ },
210
+ transform: { x: 0, y: 0 }
211
+ }),
212
+ "left-end": (e, t) => ({
213
+ position: {
214
+ x: e.left,
215
+ y: e.bottom - t.height
216
+ },
217
+ transform: { x: 0, y: 0 }
218
+ }),
219
+ right: (e, t) => ({
220
+ position: {
221
+ x: e.right - t.width,
222
+ y: e.top + (e.height - t.height) / 2
223
+ },
224
+ transform: { x: 0, y: 0 }
225
+ }),
226
+ "right-start": (e, t) => ({
227
+ position: {
228
+ x: e.right - t.width,
229
+ y: e.top
230
+ },
231
+ transform: { x: 0, y: 0 }
232
+ }),
233
+ "right-end": (e, t) => ({
234
+ position: {
235
+ x: e.right - t.width,
236
+ y: e.bottom - t.height
237
+ },
238
+ transform: { x: 0, y: 0 }
239
+ })
240
+ }, ce = (e, t, o) => {
241
+ const l = ue[e];
242
+ return l ? l(t, o) : { position: { x: 0, y: 0 }, transform: { x: 0, y: 0 } };
243
+ }, fe = (e, t, o, l) => {
244
+ const r = { ...e }, n = { ...l };
245
+ if (e.x < o.left && (r.x = o.left, n.x = 0), e.x + t.width > o.right) {
246
+ const p = o.right - t.width;
247
+ p > 0 && (r.x = p), n.x = 0;
248
+ }
249
+ if (e.y < o.top && (r.y = o.top, n.y = 0), e.y + t.height > o.bottom) {
250
+ const p = o.bottom - t.height;
251
+ p > 0 && (r.y = p), n.y = 0;
252
+ }
253
+ return { position: r, transform: n };
254
+ }, ye = (e, t, o, l, r) => {
255
+ const n = r ? null : t;
256
+ switch (e) {
257
+ case "auto":
258
+ return b(n, o, l);
259
+ case "auto-vertical":
260
+ return b(n, o, l, void 0, !0);
261
+ case "auto-start":
262
+ return b(n, o, l, "start");
263
+ case "auto-vertical-start":
264
+ return b(n, o, l, "start", !0);
265
+ case "auto-end":
266
+ return b(n, o, l, "end");
267
+ case "auto-vertical-end":
268
+ return b(n, o, l, "end", !0);
269
+ default:
270
+ return "bottom-start";
271
+ }
272
+ }, ve = (e) => e.startsWith("auto"), de = (e) => {
273
+ const t = g("auto"), o = g(), l = g(), r = g(), n = g(), p = Y({ position: { x: 0, y: 0 } }), y = {
274
+ root: null,
275
+ rootMargin: "0px",
276
+ threshold: 1,
277
+ ...e.element.value.intersectionOptions
278
+ }, d = g(new IntersectionObserver(() => {
279
+ }, y)), v = () => {
280
+ var u, f;
281
+ const c = W(e.element.value.domRef.value);
282
+ if (!c)
283
+ return null;
284
+ const i = (u = e.container) != null && u.value ? W(e.container.value.domRef.value) ?? document.body : document.body, s = (f = e.opener) != null && f.value ? W(e.opener.value.domRef.value) : null;
285
+ return { element: c, container: i, opener: s };
286
+ }, h = (c) => {
287
+ var i;
288
+ return {
289
+ element: c.element.getBoundingClientRect(),
290
+ container: c.container.getBoundingClientRect(),
291
+ opener: ((i = c.opener) == null ? void 0 : i.getBoundingClientRect()) ?? null
292
+ };
293
+ }, x = (c = !1) => J(() => {
294
+ var O, R, L;
295
+ o.value = ((O = e.position) == null ? void 0 : O.value) ?? "auto";
296
+ const i = v();
297
+ if (!i) return;
298
+ Object.assign(i.element.style, {
299
+ position: "fixed",
300
+ top: "0px",
301
+ left: "0px"
302
+ });
303
+ const s = h(i);
304
+ l.value = s.element, r.value = s.opener ?? void 0, n.value = s.container, d.value.observe(i.element), d.value.observe(i.container), ve(o.value) && i.opener && (o.value = ye(
305
+ o.value,
306
+ i.container,
307
+ i.element,
308
+ i.opener,
309
+ ((R = e.useViewport) == null ? void 0 : R.value) ?? !1
310
+ ));
311
+ const u = ie(window.getComputedStyle(i.element)), f = i.opener && s.opener ? pe(o.value, s.opener, u) : ce(o.value, s.container, s.element), E = ae(
312
+ s.element,
313
+ f.position,
314
+ f.transform.x,
315
+ f.transform.y
316
+ ), S = fe(
317
+ E,
318
+ s.element,
319
+ s.container,
320
+ f.transform
321
+ );
322
+ p.position.x = S.position.x, p.position.y = S.position.y, Object.assign(i.element.style, {
323
+ top: `${p.position.y}px`,
324
+ left: `${p.position.x}px`,
325
+ position: "fixed",
326
+ display: "flex"
327
+ }), l.value = i.element.getBoundingClientRect(), (L = e.callback) != null && L.value && !c && e.callback.value(l, r, n, t, o);
328
+ });
329
+ return Q(() => {
330
+ d.value.disconnect();
331
+ }), {
332
+ float: p,
333
+ rect: l,
334
+ setPosition: x,
335
+ position: t,
336
+ actualPosition: o,
337
+ openerRect: r,
338
+ containerRect: n
339
+ };
340
+ };
341
+ function $(e) {
342
+ const t = window.matchMedia(e), o = g(t.matches);
343
+ function l(r) {
344
+ o.value = r.matches;
345
+ }
346
+ return k(() => {
347
+ t.addEventListener("change", l);
348
+ }), Q(() => {
349
+ t.removeEventListener("change", l);
350
+ }), F(() => o.value);
351
+ }
352
+ function Ee(e) {
353
+ return {
354
+ isGreater(t) {
355
+ return $(`(min-width: ${e[t]})`);
356
+ },
357
+ isSmaller(t) {
358
+ return $(`(max-width: ${e[t]})`);
359
+ },
360
+ isInBetween(t, o) {
361
+ return $(`(min-width: ${e[t]}) and (max-width: ${e[o]})`);
362
+ }
363
+ };
364
+ }
365
+ function Oe(e, t, o) {
366
+ if (!e)
367
+ throw new Error("A target component has to be provided.");
368
+ if (!t)
369
+ throw new Error("A callback has to be provided.");
370
+ const l = (r) => {
371
+ !e.value || r.target === e.value || r.composedPath().includes(e.value) || typeof t == "function" && t();
372
+ };
373
+ o && B(o, (r, n) => {
374
+ n && n.removeEventListener("click", l), r == null || r.addEventListener("click", l);
375
+ }), k(() => {
376
+ o || document.addEventListener("click", l);
377
+ }), N(() => {
378
+ var r;
379
+ if (o) {
380
+ (r = o.value) == null || r.removeEventListener("click", l);
381
+ return;
382
+ }
383
+ document.removeEventListener("click", l);
384
+ });
385
+ }
386
+ function Le(e, t) {
387
+ if (!e)
388
+ throw new Error("A target component has to be provided.");
389
+ if (!t || typeof t != "function")
390
+ throw new Error("A callback has to be provided.");
391
+ const o = (l) => {
392
+ t(l);
393
+ };
394
+ k(() => {
395
+ e.value.addEventListener("keydown", o);
396
+ }), N(() => {
397
+ e.value.removeEventListener("keydown", o);
398
+ });
399
+ }
400
+ function Be(e, t) {
401
+ if (!e || typeof e != "function")
402
+ throw new Error("A callback has to be provided.");
403
+ const o = (l) => {
404
+ e(l);
405
+ };
406
+ k(() => {
407
+ if (!t) {
408
+ document.addEventListener("keyup", o);
409
+ return;
410
+ }
411
+ t.value.addEventListener("keyup", o);
412
+ }), N(() => {
413
+ if (!t) {
414
+ document.removeEventListener("keyup", o);
415
+ return;
416
+ }
417
+ t.value.removeEventListener("keyup", o);
418
+ });
419
+ }
420
+ const $e = (e) => ({
421
+ format: ne,
422
+ parse: re
423
+ }), xe = {
424
+ blue: {
425
+ 50: {
426
+ value: "#eff1ff",
427
+ type: "color"
428
+ },
429
+ 100: {
430
+ value: "#dee2ff",
431
+ type: "color"
432
+ },
433
+ 200: {
434
+ value: "#bdc5ff",
435
+ type: "color"
436
+ },
437
+ 300: {
438
+ value: "#9ca8ff",
439
+ type: "color"
440
+ },
441
+ 400: {
442
+ value: "#7b8bff",
443
+ type: "color"
444
+ },
445
+ 500: {
446
+ value: "#5a6eff",
447
+ type: "color"
448
+ },
449
+ 600: {
450
+ value: "#4858cc",
451
+ type: "color"
452
+ },
453
+ 700: {
454
+ value: "#364299",
455
+ type: "color"
456
+ },
457
+ 800: {
458
+ value: "#242c66",
459
+ type: "color"
460
+ },
461
+ 900: {
462
+ value: "#1b214c",
463
+ type: "color"
464
+ }
465
+ },
466
+ purple: {
467
+ 50: {
468
+ value: "#f8f4ff",
469
+ type: "color"
470
+ },
471
+ 100: {
472
+ value: "#f0e9ff",
473
+ type: "color"
474
+ },
475
+ 200: {
476
+ value: "#e1d3ff",
477
+ type: "color"
478
+ },
479
+ 300: {
480
+ value: "#d2bdff",
481
+ type: "color"
482
+ },
483
+ 400: {
484
+ value: "#c3a7ff",
485
+ type: "color"
486
+ },
487
+ 500: {
488
+ value: "#b491ff",
489
+ type: "color"
490
+ },
491
+ 600: {
492
+ value: "#9074cc",
493
+ type: "color"
494
+ },
495
+ 700: {
496
+ value: "#6c5799",
497
+ type: "color"
498
+ },
499
+ 800: {
500
+ value: "#483a66",
501
+ type: "color"
502
+ },
503
+ 900: {
504
+ value: "#241d33",
505
+ type: "color"
506
+ }
507
+ },
508
+ orange: {
509
+ 50: {
510
+ value: "#fff2ef",
511
+ type: "color"
512
+ },
513
+ 100: {
514
+ value: "#ffe4de",
515
+ type: "color"
516
+ },
517
+ 200: {
518
+ value: "#ffc9bd",
519
+ type: "color"
520
+ },
521
+ 300: {
522
+ value: "#ffae9c",
523
+ type: "color"
524
+ },
525
+ 400: {
526
+ value: "#ff937b",
527
+ type: "color"
528
+ },
529
+ 500: {
530
+ value: "#ff785a",
531
+ type: "color"
532
+ },
533
+ 600: {
534
+ value: "#cc6048",
535
+ type: "color"
536
+ },
537
+ 700: {
538
+ value: "#994836",
539
+ type: "color"
540
+ },
541
+ 800: {
542
+ value: "#663024",
543
+ type: "color"
544
+ },
545
+ 900: {
546
+ value: "#331812",
547
+ type: "color"
548
+ }
549
+ },
550
+ pink: {
551
+ 50: {
552
+ value: "#fff5f5",
553
+ type: "color"
554
+ },
555
+ 100: {
556
+ value: "#ffe0e0",
557
+ type: "color"
558
+ },
559
+ 200: {
560
+ value: "#ffcbcb",
561
+ type: "color"
562
+ },
563
+ 300: {
564
+ value: "#ffc0c0",
565
+ type: "color"
566
+ },
567
+ 400: {
568
+ value: "#ffabab",
569
+ type: "color"
570
+ },
571
+ 500: {
572
+ value: "#ff9696",
573
+ type: "color"
574
+ },
575
+ 600: {
576
+ value: "#cc7878",
577
+ type: "color"
578
+ },
579
+ 700: {
580
+ value: "#995a5a",
581
+ type: "color"
582
+ },
583
+ 800: {
584
+ value: "#663c3c",
585
+ type: "color"
586
+ },
587
+ 900: {
588
+ value: "#331e1e",
589
+ type: "color"
590
+ }
591
+ },
592
+ yellow: {
593
+ 50: {
594
+ value: "#fffbf4",
595
+ type: "color"
596
+ },
597
+ 100: {
598
+ value: "#fff3de",
599
+ type: "color"
600
+ },
601
+ 200: {
602
+ value: "#ffebc8",
603
+ type: "color"
604
+ },
605
+ 300: {
606
+ value: "#ffe7bd",
607
+ type: "color"
608
+ },
609
+ 400: {
610
+ value: "#ffdfa7",
611
+ type: "color"
612
+ },
613
+ 500: {
614
+ value: "#ffd791",
615
+ type: "color"
616
+ },
617
+ 600: {
618
+ value: "#ccac74",
619
+ type: "color"
620
+ },
621
+ 700: {
622
+ value: "#998157",
623
+ type: "color"
624
+ },
625
+ 800: {
626
+ value: "#806c49",
627
+ type: "color"
628
+ },
629
+ 900: {
630
+ value: "#4c402b",
631
+ type: "color"
632
+ }
633
+ },
634
+ semantic: {
635
+ error: {
636
+ 50: {
637
+ value: "#fef3f3",
638
+ type: "color"
639
+ },
640
+ 100: {
641
+ value: "#f8baba",
642
+ type: "color"
643
+ },
644
+ 200: {
645
+ value: "#f04242",
646
+ type: "color"
647
+ },
648
+ 300: {
649
+ value: "#aa2f2f",
650
+ type: "color"
651
+ }
652
+ },
653
+ warning: {
654
+ 50: {
655
+ value: "#fff8f3",
656
+ type: "color"
657
+ },
658
+ 100: {
659
+ value: "#ffdabd",
660
+ type: "color"
661
+ },
662
+ 200: {
663
+ value: "#ffae4f",
664
+ type: "color"
665
+ },
666
+ 300: {
667
+ value: "#b47b38",
668
+ type: "color"
669
+ }
670
+ },
671
+ success: {
672
+ 50: {
673
+ value: "#f2f8f6",
674
+ type: "color"
675
+ },
676
+ 100: {
677
+ value: "#b5d8ce",
678
+ type: "color"
679
+ },
680
+ 200: {
681
+ value: "#0fa88c",
682
+ type: "color"
683
+ },
684
+ 300: {
685
+ value: "#0b7763",
686
+ type: "color"
687
+ }
688
+ },
689
+ info: {
690
+ 50: {
691
+ value: "#f3f7ff",
692
+ type: "color"
693
+ },
694
+ 100: {
695
+ value: "#b4c8e1",
696
+ type: "color"
697
+ },
698
+ 200: {
699
+ value: "#4e9fff",
700
+ type: "color"
701
+ },
702
+ 300: {
703
+ value: "#3770b4",
704
+ type: "color"
705
+ }
706
+ }
707
+ },
708
+ background: {
709
+ "white-smoke": {
710
+ value: "#f7f6f3",
711
+ type: "color"
712
+ },
713
+ seashell: {
714
+ value: "#f8ece7",
715
+ type: "color"
716
+ },
717
+ "pale-purple": {
718
+ value: "#f2e6ff",
719
+ type: "color"
720
+ },
721
+ "alice-blue": {
722
+ value: "#ecf2fc",
723
+ type: "color"
724
+ }
725
+ },
726
+ grey: {
727
+ 100: {
728
+ value: "#e9edf0",
729
+ type: "color"
730
+ },
731
+ 200: {
732
+ value: "#d1dde6",
733
+ type: "color"
734
+ },
735
+ 300: {
736
+ value: "#9da9b2",
737
+ type: "color"
738
+ },
739
+ 400: {
740
+ value: "#6e777e",
741
+ type: "color"
742
+ },
743
+ 500: {
744
+ value: "#596167",
745
+ type: "color"
746
+ }
747
+ },
748
+ core: {
749
+ white: {
750
+ value: "#ffffff",
751
+ type: "color"
752
+ },
753
+ black: {
754
+ value: "#2c282f",
755
+ type: "color"
756
+ }
757
+ },
758
+ "font-sans": {
759
+ "sharp-grotesk": {
760
+ value: '"Sharp Grotesk", sans-serif',
761
+ type: "fontFamilies"
762
+ },
763
+ inter: {
764
+ value: '"Inter", sans-serif',
765
+ type: "fontFamilies"
766
+ }
767
+ },
768
+ font: {
769
+ light: {
770
+ value: "300",
771
+ type: "fontWeights"
772
+ },
773
+ normal: {
774
+ value: "400",
775
+ type: "fontWeights"
776
+ },
777
+ medium: {
778
+ value: "500",
779
+ type: "fontWeights"
780
+ }
781
+ },
782
+ spacing: {
783
+ 0: {
784
+ value: "0px",
785
+ type: "spacing"
786
+ },
787
+ 1: {
788
+ value: "1px",
789
+ type: "spacing"
790
+ },
791
+ 2: {
792
+ value: "2px",
793
+ type: "spacing"
794
+ },
795
+ 4: {
796
+ value: "4px",
797
+ type: "spacing"
798
+ },
799
+ 6: {
800
+ value: "6px",
801
+ type: "spacing"
802
+ },
803
+ 8: {
804
+ value: "8px",
805
+ type: "spacing"
806
+ },
807
+ 10: {
808
+ value: "10px",
809
+ type: "spacing"
810
+ },
811
+ 12: {
812
+ value: "12px",
813
+ type: "spacing"
814
+ },
815
+ 14: {
816
+ value: "14px",
817
+ type: "spacing"
818
+ },
819
+ 16: {
820
+ value: "16px",
821
+ type: "spacing"
822
+ },
823
+ 20: {
824
+ value: "20px",
825
+ type: "spacing"
826
+ },
827
+ 24: {
828
+ value: "24px",
829
+ type: "spacing"
830
+ },
831
+ 28: {
832
+ value: "28px",
833
+ type: "spacing"
834
+ },
835
+ 32: {
836
+ value: "32px",
837
+ type: "spacing"
838
+ },
839
+ 36: {
840
+ value: "36px",
841
+ type: "spacing"
842
+ },
843
+ 40: {
844
+ value: "40px",
845
+ type: "spacing"
846
+ },
847
+ 44: {
848
+ value: "44px",
849
+ type: "spacing"
850
+ },
851
+ 48: {
852
+ value: "48px",
853
+ type: "spacing"
854
+ },
855
+ 56: {
856
+ value: "56px",
857
+ type: "spacing"
858
+ },
859
+ 64: {
860
+ value: "64px",
861
+ type: "spacing"
862
+ },
863
+ 80: {
864
+ value: "80px",
865
+ type: "spacing"
866
+ },
867
+ 96: {
868
+ value: "96px",
869
+ type: "spacing"
870
+ },
871
+ 112: {
872
+ value: "112px",
873
+ type: "spacing"
874
+ },
875
+ 128: {
876
+ value: "128px",
877
+ type: "spacing"
878
+ },
879
+ 144: {
880
+ value: "144px",
881
+ type: "spacing"
882
+ },
883
+ 160: {
884
+ value: "160px",
885
+ type: "spacing"
886
+ },
887
+ 176: {
888
+ value: "176px",
889
+ type: "spacing"
890
+ },
891
+ 192: {
892
+ value: "192px",
893
+ type: "spacing"
894
+ },
895
+ 208: {
896
+ value: "208px",
897
+ type: "spacing"
898
+ },
899
+ 224: {
900
+ value: "224px",
901
+ type: "spacing"
902
+ },
903
+ 240: {
904
+ value: "240px",
905
+ type: "spacing"
906
+ },
907
+ 256: {
908
+ value: "256px",
909
+ type: "spacing"
910
+ },
911
+ 288: {
912
+ value: "288px",
913
+ type: "spacing"
914
+ },
915
+ 320: {
916
+ value: "320px",
917
+ type: "spacing"
918
+ },
919
+ 384: {
920
+ value: "384px",
921
+ type: "spacing"
922
+ }
923
+ },
924
+ border: {
925
+ 0: {
926
+ value: "0px",
927
+ type: "borderWidth"
928
+ },
929
+ 1: {
930
+ value: "1px",
931
+ type: "borderWidth"
932
+ },
933
+ 2: {
934
+ value: "2px",
935
+ type: "borderWidth"
936
+ },
937
+ 4: {
938
+ value: "4px",
939
+ type: "borderWidth"
940
+ },
941
+ 8: {
942
+ value: "8px",
943
+ type: "borderWidth"
944
+ }
945
+ },
946
+ rounded: {
947
+ none: {
948
+ value: "0px",
949
+ type: "borderRadius"
950
+ },
951
+ sm: {
952
+ value: "2px",
953
+ type: "borderRadius"
954
+ },
955
+ base: {
956
+ value: "4px",
957
+ type: "borderRadius"
958
+ },
959
+ md: {
960
+ value: "6px",
961
+ type: "borderRadius"
962
+ },
963
+ lg: {
964
+ value: "8px",
965
+ type: "borderRadius"
966
+ },
967
+ xl: {
968
+ value: "12px",
969
+ type: "borderRadius"
970
+ },
971
+ "2xl": {
972
+ value: "16px",
973
+ type: "borderRadius"
974
+ },
975
+ "3xl": {
976
+ value: "24px",
977
+ type: "borderRadius"
978
+ },
979
+ full: {
980
+ value: "9999px",
981
+ type: "borderRadius"
982
+ }
983
+ },
984
+ breakpoint: {
985
+ xs: {
986
+ value: "376px",
987
+ type: "sizing"
988
+ },
989
+ sm: {
990
+ value: "640px",
991
+ type: "sizing"
992
+ },
993
+ md: {
994
+ value: "768px",
995
+ type: "sizing"
996
+ },
997
+ lg: {
998
+ value: "1024px",
999
+ type: "sizing"
1000
+ },
1001
+ xl: {
1002
+ value: "1280px",
1003
+ type: "sizing"
1004
+ },
1005
+ "2xl": {
1006
+ value: "1440px",
1007
+ type: "sizing"
1008
+ },
1009
+ "3xl": {
1010
+ value: "1536px",
1011
+ type: "sizing"
1012
+ }
1013
+ },
1014
+ shadow: {
1015
+ none: {
1016
+ value: {
1017
+ color: "#000000",
1018
+ type: "dropShadow",
1019
+ x: "0",
1020
+ y: "0",
1021
+ blur: "0",
1022
+ spread: "0"
1023
+ },
1024
+ type: "boxShadow"
1025
+ },
1026
+ sm: {
1027
+ value: {
1028
+ color: "#0000000d",
1029
+ type: "dropShadow",
1030
+ x: "0",
1031
+ y: "1",
1032
+ blur: "2",
1033
+ spread: "0"
1034
+ },
1035
+ type: "boxShadow"
1036
+ },
1037
+ base: {
1038
+ value: [
1039
+ {
1040
+ color: "#0000000f",
1041
+ type: "dropShadow",
1042
+ x: "0",
1043
+ y: "1",
1044
+ blur: "2",
1045
+ spread: "0"
1046
+ },
1047
+ {
1048
+ color: "#0000001a",
1049
+ type: "dropShadow",
1050
+ x: "0",
1051
+ y: "1",
1052
+ blur: "3",
1053
+ spread: "0"
1054
+ }
1055
+ ],
1056
+ type: "boxShadow"
1057
+ },
1058
+ md: {
1059
+ value: [
1060
+ {
1061
+ color: "#0000000f",
1062
+ type: "dropShadow",
1063
+ x: "0",
1064
+ y: "2",
1065
+ blur: "4",
1066
+ spread: "-1"
1067
+ },
1068
+ {
1069
+ color: "#0000001a",
1070
+ type: "dropShadow",
1071
+ x: "0",
1072
+ y: "4",
1073
+ blur: "6",
1074
+ spread: "-1"
1075
+ }
1076
+ ],
1077
+ type: "boxShadow"
1078
+ },
1079
+ lg: {
1080
+ value: [
1081
+ {
1082
+ color: "#0000000d",
1083
+ type: "dropShadow",
1084
+ x: "0",
1085
+ y: "4",
1086
+ blur: "6",
1087
+ spread: "-2"
1088
+ },
1089
+ {
1090
+ color: "#0000001a",
1091
+ type: "dropShadow",
1092
+ x: "0",
1093
+ y: "10",
1094
+ blur: "15",
1095
+ spread: "-3"
1096
+ }
1097
+ ],
1098
+ type: "boxShadow"
1099
+ },
1100
+ xl: {
1101
+ value: [
1102
+ {
1103
+ color: "#0000000a",
1104
+ type: "dropShadow",
1105
+ x: "0",
1106
+ y: "10",
1107
+ blur: "10",
1108
+ spread: "-5"
1109
+ },
1110
+ {
1111
+ color: "#0000001a",
1112
+ type: "dropShadow",
1113
+ x: "0",
1114
+ y: "20",
1115
+ blur: "25",
1116
+ spread: "-5"
1117
+ }
1118
+ ],
1119
+ type: "boxShadow"
1120
+ },
1121
+ "2xl": {
1122
+ value: {
1123
+ color: "#00000040",
1124
+ type: "dropShadow",
1125
+ x: "0",
1126
+ y: "25",
1127
+ blur: "50",
1128
+ spread: "-12"
1129
+ },
1130
+ type: "boxShadow"
1131
+ },
1132
+ inner: {
1133
+ value: {
1134
+ color: "#0000000f",
1135
+ type: "innerShadow",
1136
+ x: "0",
1137
+ y: "2",
1138
+ blur: "4",
1139
+ spread: "0"
1140
+ },
1141
+ type: "boxShadow"
1142
+ }
1143
+ },
1144
+ underline: {
1145
+ value: "underline",
1146
+ type: "textDecoration"
1147
+ },
1148
+ text: {
1149
+ xs: {
1150
+ value: "12px",
1151
+ type: "fontSizes"
1152
+ },
1153
+ sm: {
1154
+ value: "14px",
1155
+ type: "fontSizes"
1156
+ },
1157
+ base: {
1158
+ value: "16px",
1159
+ type: "fontSizes"
1160
+ },
1161
+ lg: {
1162
+ value: "18px",
1163
+ type: "fontSizes"
1164
+ },
1165
+ xl: {
1166
+ value: "20px",
1167
+ type: "fontSizes"
1168
+ },
1169
+ "2xl": {
1170
+ value: "24px",
1171
+ type: "fontSizes"
1172
+ },
1173
+ "3xl": {
1174
+ value: "30px",
1175
+ type: "fontSizes"
1176
+ },
1177
+ "4xl": {
1178
+ value: "36px",
1179
+ type: "fontSizes"
1180
+ },
1181
+ "5xl": {
1182
+ value: "48px",
1183
+ type: "fontSizes"
1184
+ },
1185
+ "6xl": {
1186
+ value: "60px",
1187
+ type: "fontSizes"
1188
+ },
1189
+ "7xl": {
1190
+ value: "72px",
1191
+ type: "fontSizes"
1192
+ },
1193
+ "8xl": {
1194
+ value: "96px",
1195
+ type: "fontSizes"
1196
+ },
1197
+ "9xl": {
1198
+ value: "128px",
1199
+ type: "fontSizes"
1200
+ }
1201
+ },
1202
+ leading: {
1203
+ xs: {
1204
+ value: "16px",
1205
+ type: "lineHeights"
1206
+ },
1207
+ sm: {
1208
+ value: "18px",
1209
+ type: "lineHeights"
1210
+ },
1211
+ base: {
1212
+ value: "20px",
1213
+ type: "lineHeights"
1214
+ },
1215
+ lg: {
1216
+ value: "24px",
1217
+ type: "lineHeights"
1218
+ },
1219
+ xl: {
1220
+ value: "28px",
1221
+ type: "lineHeights"
1222
+ },
1223
+ "2xl": {
1224
+ value: "32px",
1225
+ type: "lineHeights"
1226
+ },
1227
+ "3xl": {
1228
+ value: "36px",
1229
+ type: "lineHeights"
1230
+ },
1231
+ "4xl": {
1232
+ value: "40px",
1233
+ type: "lineHeights"
1234
+ },
1235
+ "5xl": {
1236
+ value: "48px",
1237
+ type: "lineHeights"
1238
+ },
1239
+ "6xl": {
1240
+ value: "60px",
1241
+ type: "lineHeights"
1242
+ },
1243
+ "7xl": {
1244
+ value: "72px",
1245
+ type: "lineHeights"
1246
+ },
1247
+ "8xl": {
1248
+ value: "96px",
1249
+ type: "lineHeights"
1250
+ },
1251
+ "9xl": {
1252
+ value: "128px",
1253
+ type: "lineHeights"
1254
+ }
1255
+ }
1256
+ }, H = {
1257
+ global: xe
1258
+ }, he = [
1259
+ "blue",
1260
+ "purple",
1261
+ "orange",
1262
+ "pink",
1263
+ "yellow",
1264
+ "grey",
1265
+ "core"
1266
+ ], ge = {
1267
+ safeColorNames: he
1268
+ }, me = [
1269
+ "error",
1270
+ "warning",
1271
+ "success",
1272
+ "info"
1273
+ ], be = {
1274
+ semanticColorNames: me
1275
+ }, we = ge.safeColorNames, Se = be.semanticColorNames, w = {};
1276
+ we.forEach((e) => {
1277
+ const t = H.global[e];
1278
+ t && Object.keys(t).forEach((o) => {
1279
+ var r;
1280
+ const l = (r = t[o]) == null ? void 0 : r.value;
1281
+ l && (w[e] || (w[e] = {}), w[e][o] = l);
1282
+ });
1283
+ });
1284
+ const K = H.global.semantic;
1285
+ K && Se.forEach((e) => {
1286
+ const t = K[e];
1287
+ t && typeof t == "object" && Object.keys(t).forEach((o) => {
1288
+ var r;
1289
+ const l = (r = t[o]) == null ? void 0 : r.value;
1290
+ if (l) {
1291
+ const n = `semantic-${e}`;
1292
+ w[n] || (w[n] = {}), w[n][o] = l;
1293
+ }
1294
+ });
1295
+ });
1296
+ const Re = Object.entries(H.global.breakpoint).reduce(
1297
+ (e, [t, o]) => (e[t] = o.value, e),
1298
+ {}
1299
+ ), Ne = /* @__PURE__ */ Z({
1300
+ __name: "FzFloating",
1301
+ props: {
1302
+ isOpen: { type: Boolean, default: !1 },
1303
+ position: { default: "auto" },
1304
+ container: {},
1305
+ contentClass: {},
1306
+ openerClass: {},
1307
+ overrideContentClass: { type: Boolean },
1308
+ overrideOpener: {},
1309
+ teleport: { type: Boolean, default: !1 },
1310
+ useViewport: { type: Boolean }
1311
+ },
1312
+ emits: ["fzfloating:setPosition"],
1313
+ setup(e, { expose: t, emit: o }) {
1314
+ const l = e, r = o, n = g(null), p = g(null), y = _(), d = $(`(max-width: ${Re.xs})`);
1315
+ let v = !1, h = !1, x = null, c = null;
1316
+ const i = {
1317
+ position: l.position,
1318
+ element: {
1319
+ // @ts-ignore
1320
+ domRef: n
1321
+ },
1322
+ container: {
1323
+ // @ts-ignore
1324
+ domRef: I(l.container || document.body)
1325
+ },
1326
+ opener: {
1327
+ domRef: I(null)
1328
+ },
1329
+ useViewport: l.useViewport,
1330
+ callback(...a) {
1331
+ r("fzfloating:setPosition", ...a);
1332
+ }
1333
+ }, s = ee(i);
1334
+ y.opener && (i.opener = {
1335
+ // @ts-ignore
1336
+ domRef: p
1337
+ });
1338
+ const u = de(s), f = () => {
1339
+ v || !h || (v = !0, requestAnimationFrame(() => {
1340
+ h && l.isOpen && u.setPosition(), v = !1;
1341
+ }));
1342
+ };
1343
+ k(() => {
1344
+ h = !0;
1345
+ });
1346
+ const E = () => {
1347
+ f();
1348
+ }, S = () => {
1349
+ f();
1350
+ }, O = () => {
1351
+ window.addEventListener("scroll", E, !0), window.addEventListener("resize", S), n.value && !x && (x = new ResizeObserver(() => {
1352
+ f();
1353
+ }), x.observe(n.value)), p.value && !c && (c = new ResizeObserver(() => {
1354
+ f();
1355
+ }), c.observe(p.value));
1356
+ }, R = () => {
1357
+ window.removeEventListener("scroll", E, !0), window.removeEventListener("resize", S), x && (x.disconnect(), x = null), c && (c.disconnect(), c = null);
1358
+ };
1359
+ B(
1360
+ () => l.position,
1361
+ () => f()
1362
+ ), B(
1363
+ () => l.isOpen,
1364
+ (a) => {
1365
+ var D;
1366
+ if (!a || !n.value || !h) {
1367
+ R();
1368
+ return;
1369
+ }
1370
+ O();
1371
+ const m = (D = p.value) == null ? void 0 : D.getBoundingClientRect();
1372
+ n.value.style.position = "fixed", n.value.style.top = "0px", n.value.style.left = "0px", n.value.style.transform = "none", n.value.style.width = d.value ? (m == null ? void 0 : m.width) + "px" : "auto", u.setPosition();
1373
+ }
1374
+ ), B(
1375
+ () => l.overrideOpener,
1376
+ (a) => {
1377
+ a && s.opener && s.opener.value && (s.opener.value = {
1378
+ domRef: a
1379
+ });
1380
+ }
1381
+ ), N(() => {
1382
+ h = !1, R();
1383
+ });
1384
+ const L = (a) => a.startsWith("bottom") ? "mt-4" : a.startsWith("top") ? "mb-4" : a.startsWith("left") ? "mr-4" : a.startsWith("right") ? "ml-4" : "mt-4", X = F(() => {
1385
+ var m;
1386
+ const a = ((m = u.actualPosition) == null ? void 0 : m.value) ?? l.position;
1387
+ return L(a);
1388
+ }), A = F(() => l.overrideContentClass ? l.contentClass : ["bg-core-white fixed", X.value, l.contentClass]);
1389
+ return t({
1390
+ setPosition: u.setPosition
1391
+ }), (a, m) => (M(), j("div", null, [
1392
+ C(a.$slots, "opener-start"),
1393
+ V("div", {
1394
+ ref_key: "opener",
1395
+ ref: p,
1396
+ class: "inline-flex w-full sm:w-auto"
1397
+ }, [
1398
+ C(a.$slots, "opener", {
1399
+ isOpen: e.isOpen,
1400
+ floating: P(u)
1401
+ })
1402
+ ], 512),
1403
+ C(a.$slots, "opener-end"),
1404
+ e.teleport ? U("", !0) : T((M(), j("div", {
1405
+ key: 0,
1406
+ ref_key: "content",
1407
+ ref: n,
1408
+ class: q(["fz__floating__content w-full sm:w-auto", A.value])
1409
+ }, [
1410
+ C(a.$slots, "default", {
1411
+ isOpen: e.isOpen,
1412
+ floating: P(u)
1413
+ })
1414
+ ], 2)), [
1415
+ [G, a.$slots.default && (!a.$slots.opener || a.$slots.opener && e.isOpen)]
1416
+ ]),
1417
+ e.teleport ? (M(), te(oe, {
1418
+ key: 1,
1419
+ to: "body"
1420
+ }, [
1421
+ T(V("div", {
1422
+ ref_key: "content",
1423
+ ref: n,
1424
+ class: q(["fz__floating__content", A.value])
1425
+ }, [
1426
+ C(a.$slots, "default", {
1427
+ isOpen: e.isOpen,
1428
+ floating: P(u)
1429
+ })
1430
+ ], 2), [
1431
+ [G, a.$slots.default && (!a.$slots.opener || a.$slots.opener && e.isOpen)]
1432
+ ])
1433
+ ])) : U("", !0)
1434
+ ]));
1435
+ }
1436
+ });
1437
+ export {
1438
+ Ne as FzFloating,
1439
+ ae as calcRealPos,
1440
+ ke as clamp,
1441
+ ne as format,
1442
+ b as getHighestAvailableSpacePos,
1443
+ re as parse,
1444
+ ze as roundTo,
1445
+ le as truncateDecimals,
1446
+ Ee as useBreakpoints,
1447
+ Oe as useClickOutside,
1448
+ $e as useCurrency,
1449
+ de as useFloating,
1450
+ Le as useKeyDown,
1451
+ Be as useKeyUp,
1452
+ $ as useMediaQuery
1453
+ };