@fiscozen/tab 0.1.11 → 1.0.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/tab.js DELETED
@@ -1,1108 +0,0 @@
1
- import { defineComponent as w, inject as O, computed as v, createElementBlock as h, openBlock as c, mergeProps as _, createBlock as d, createCommentVNode as T, createElementVNode as z, renderSlot as x, unref as b, toDisplayString as E, withCtx as m, createTextVNode as U, ref as g, Fragment as B, renderList as R, createVNode as N, onMounted as j, onBeforeUnmount as L, useSlots as q, provide as G, watch as Q, normalizeClass as C } from "vue";
2
- import { useMediaQuery as Y, FzFloating as J } from "@fiscozen/composables";
3
- import { FzIcon as V } from "@fiscozen/icons";
4
- import { FzBadge as K } from "@fiscozen/badge";
5
- const D = {
6
- sm: "text-sm h-40 gap-6 py-8 px-12",
7
- md: "text-md h-40 gap-8 py-12 px-14"
8
- }, X = {
9
- picker: "bg-background-alice-blue text-blue-500",
10
- tab: "bg-white text-blue-500"
11
- }, Z = {
12
- picker: "bg-white hover:bg-background-alice-blue text-black hover:text-blue-500",
13
- tab: "text-grey-500 bg-grey-100 hover:bg-background-alice-blue active:bg-white active:text-blue-500"
14
- }, ee = {
15
- blue: {
16
- 50: {
17
- value: "#eff1ff",
18
- type: "color"
19
- },
20
- 100: {
21
- value: "#dee2ff",
22
- type: "color"
23
- },
24
- 200: {
25
- value: "#bdc5ff",
26
- type: "color"
27
- },
28
- 300: {
29
- value: "#9ca8ff",
30
- type: "color"
31
- },
32
- 400: {
33
- value: "#7b8bff",
34
- type: "color"
35
- },
36
- 500: {
37
- value: "#5a6eff",
38
- type: "color"
39
- },
40
- 600: {
41
- value: "#4858cc",
42
- type: "color"
43
- },
44
- 700: {
45
- value: "#364299",
46
- type: "color"
47
- },
48
- 800: {
49
- value: "#242c66",
50
- type: "color"
51
- },
52
- 900: {
53
- value: "#1b214c",
54
- type: "color"
55
- }
56
- },
57
- purple: {
58
- 50: {
59
- value: "#f8f4ff",
60
- type: "color"
61
- },
62
- 100: {
63
- value: "#f0e9ff",
64
- type: "color"
65
- },
66
- 200: {
67
- value: "#e1d3ff",
68
- type: "color"
69
- },
70
- 300: {
71
- value: "#d2bdff",
72
- type: "color"
73
- },
74
- 400: {
75
- value: "#c3a7ff",
76
- type: "color"
77
- },
78
- 500: {
79
- value: "#b491ff",
80
- type: "color"
81
- },
82
- 600: {
83
- value: "#9074cc",
84
- type: "color"
85
- },
86
- 700: {
87
- value: "#6c5799",
88
- type: "color"
89
- },
90
- 800: {
91
- value: "#483a66",
92
- type: "color"
93
- },
94
- 900: {
95
- value: "#241d33",
96
- type: "color"
97
- }
98
- },
99
- orange: {
100
- 50: {
101
- value: "#fff2ef",
102
- type: "color"
103
- },
104
- 100: {
105
- value: "#ffe4de",
106
- type: "color"
107
- },
108
- 200: {
109
- value: "#ffc9bd",
110
- type: "color"
111
- },
112
- 300: {
113
- value: "#ffae9c",
114
- type: "color"
115
- },
116
- 400: {
117
- value: "#ff937b",
118
- type: "color"
119
- },
120
- 500: {
121
- value: "#ff785a",
122
- type: "color"
123
- },
124
- 600: {
125
- value: "#cc6048",
126
- type: "color"
127
- },
128
- 700: {
129
- value: "#994836",
130
- type: "color"
131
- },
132
- 800: {
133
- value: "#663024",
134
- type: "color"
135
- },
136
- 900: {
137
- value: "#331812",
138
- type: "color"
139
- }
140
- },
141
- pink: {
142
- 50: {
143
- value: "#fff5f5",
144
- type: "color"
145
- },
146
- 100: {
147
- value: "#ffe0e0",
148
- type: "color"
149
- },
150
- 200: {
151
- value: "#ffcbcb",
152
- type: "color"
153
- },
154
- 300: {
155
- value: "#ffc0c0",
156
- type: "color"
157
- },
158
- 400: {
159
- value: "#ffabab",
160
- type: "color"
161
- },
162
- 500: {
163
- value: "#ff9696",
164
- type: "color"
165
- },
166
- 600: {
167
- value: "#cc7878",
168
- type: "color"
169
- },
170
- 700: {
171
- value: "#995a5a",
172
- type: "color"
173
- },
174
- 800: {
175
- value: "#663c3c",
176
- type: "color"
177
- },
178
- 900: {
179
- value: "#331e1e",
180
- type: "color"
181
- }
182
- },
183
- yellow: {
184
- 50: {
185
- value: "#fffbf4",
186
- type: "color"
187
- },
188
- 100: {
189
- value: "#fff3de",
190
- type: "color"
191
- },
192
- 200: {
193
- value: "#ffebc8",
194
- type: "color"
195
- },
196
- 300: {
197
- value: "#ffe7bd",
198
- type: "color"
199
- },
200
- 400: {
201
- value: "#ffdfa7",
202
- type: "color"
203
- },
204
- 500: {
205
- value: "#ffd791",
206
- type: "color"
207
- },
208
- 600: {
209
- value: "#ccac74",
210
- type: "color"
211
- },
212
- 700: {
213
- value: "#998157",
214
- type: "color"
215
- },
216
- 800: {
217
- value: "#806c49",
218
- type: "color"
219
- },
220
- 900: {
221
- value: "#4c402b",
222
- type: "color"
223
- }
224
- },
225
- semantic: {
226
- error: {
227
- 50: {
228
- value: "#fef3f3",
229
- type: "color"
230
- },
231
- 100: {
232
- value: "#f8baba",
233
- type: "color"
234
- },
235
- 200: {
236
- value: "#f04242",
237
- type: "color"
238
- },
239
- 300: {
240
- value: "#aa2f2f",
241
- type: "color"
242
- }
243
- },
244
- warning: {
245
- 50: {
246
- value: "#fff8f3",
247
- type: "color"
248
- },
249
- 100: {
250
- value: "#ffdabd",
251
- type: "color"
252
- },
253
- 200: {
254
- value: "#ffae4f",
255
- type: "color"
256
- },
257
- 300: {
258
- value: "#b47b38",
259
- type: "color"
260
- }
261
- },
262
- success: {
263
- 50: {
264
- value: "#f2f8f6",
265
- type: "color"
266
- },
267
- 100: {
268
- value: "#b5d8ce",
269
- type: "color"
270
- },
271
- 200: {
272
- value: "#0fa88c",
273
- type: "color"
274
- },
275
- 300: {
276
- value: "#0b7763",
277
- type: "color"
278
- }
279
- },
280
- info: {
281
- 50: {
282
- value: "#f3f7ff",
283
- type: "color"
284
- },
285
- 100: {
286
- value: "#b4c8e1",
287
- type: "color"
288
- },
289
- 200: {
290
- value: "#4e9fff",
291
- type: "color"
292
- },
293
- 300: {
294
- value: "#3770b4",
295
- type: "color"
296
- }
297
- }
298
- },
299
- background: {
300
- "white-smoke": {
301
- value: "#f7f6f3",
302
- type: "color"
303
- },
304
- seashell: {
305
- value: "#f8ece7",
306
- type: "color"
307
- },
308
- "pale-purple": {
309
- value: "#f2e6ff",
310
- type: "color"
311
- },
312
- "alice-blue": {
313
- value: "#ecf2fc",
314
- type: "color"
315
- }
316
- },
317
- grey: {
318
- 100: {
319
- value: "#e9edf0",
320
- type: "color"
321
- },
322
- 200: {
323
- value: "#d1dde6",
324
- type: "color"
325
- },
326
- 300: {
327
- value: "#9da9b2",
328
- type: "color"
329
- },
330
- 400: {
331
- value: "#6e777e",
332
- type: "color"
333
- },
334
- 500: {
335
- value: "#596167",
336
- type: "color"
337
- }
338
- },
339
- core: {
340
- white: {
341
- value: "#ffffff",
342
- type: "color"
343
- },
344
- black: {
345
- value: "#2c282f",
346
- type: "color"
347
- }
348
- },
349
- "font-sans": {
350
- "sharp-grotesk": {
351
- value: '"Sharp Grotesk", sans-serif',
352
- type: "fontFamilies"
353
- },
354
- inter: {
355
- value: '"Inter", sans-serif',
356
- type: "fontFamilies"
357
- }
358
- },
359
- font: {
360
- light: {
361
- value: "300",
362
- type: "fontWeights"
363
- },
364
- normal: {
365
- value: "400",
366
- type: "fontWeights"
367
- },
368
- medium: {
369
- value: "500",
370
- type: "fontWeights"
371
- }
372
- },
373
- spacing: {
374
- 0: {
375
- value: "0px",
376
- type: "spacing"
377
- },
378
- 1: {
379
- value: "1px",
380
- type: "spacing"
381
- },
382
- 2: {
383
- value: "2px",
384
- type: "spacing"
385
- },
386
- 4: {
387
- value: "4px",
388
- type: "spacing"
389
- },
390
- 6: {
391
- value: "6px",
392
- type: "spacing"
393
- },
394
- 8: {
395
- value: "8px",
396
- type: "spacing"
397
- },
398
- 10: {
399
- value: "10px",
400
- type: "spacing"
401
- },
402
- 12: {
403
- value: "12px",
404
- type: "spacing"
405
- },
406
- 14: {
407
- value: "14px",
408
- type: "spacing"
409
- },
410
- 16: {
411
- value: "16px",
412
- type: "spacing"
413
- },
414
- 20: {
415
- value: "20px",
416
- type: "spacing"
417
- },
418
- 24: {
419
- value: "24px",
420
- type: "spacing"
421
- },
422
- 28: {
423
- value: "28px",
424
- type: "spacing"
425
- },
426
- 32: {
427
- value: "32px",
428
- type: "spacing"
429
- },
430
- 36: {
431
- value: "36px",
432
- type: "spacing"
433
- },
434
- 40: {
435
- value: "40px",
436
- type: "spacing"
437
- },
438
- 44: {
439
- value: "44px",
440
- type: "spacing"
441
- },
442
- 48: {
443
- value: "48px",
444
- type: "spacing"
445
- },
446
- 56: {
447
- value: "56px",
448
- type: "spacing"
449
- },
450
- 64: {
451
- value: "64px",
452
- type: "spacing"
453
- },
454
- 80: {
455
- value: "80px",
456
- type: "spacing"
457
- },
458
- 96: {
459
- value: "96px",
460
- type: "spacing"
461
- },
462
- 112: {
463
- value: "112px",
464
- type: "spacing"
465
- },
466
- 128: {
467
- value: "128px",
468
- type: "spacing"
469
- },
470
- 144: {
471
- value: "144px",
472
- type: "spacing"
473
- },
474
- 160: {
475
- value: "160px",
476
- type: "spacing"
477
- },
478
- 176: {
479
- value: "176px",
480
- type: "spacing"
481
- },
482
- 192: {
483
- value: "192px",
484
- type: "spacing"
485
- },
486
- 208: {
487
- value: "208px",
488
- type: "spacing"
489
- },
490
- 224: {
491
- value: "224px",
492
- type: "spacing"
493
- },
494
- 240: {
495
- value: "240px",
496
- type: "spacing"
497
- },
498
- 256: {
499
- value: "256px",
500
- type: "spacing"
501
- },
502
- 288: {
503
- value: "288px",
504
- type: "spacing"
505
- },
506
- 320: {
507
- value: "320px",
508
- type: "spacing"
509
- },
510
- 384: {
511
- value: "384px",
512
- type: "spacing"
513
- }
514
- },
515
- border: {
516
- 0: {
517
- value: "0px",
518
- type: "borderWidth"
519
- },
520
- 1: {
521
- value: "1px",
522
- type: "borderWidth"
523
- },
524
- 2: {
525
- value: "2px",
526
- type: "borderWidth"
527
- },
528
- 4: {
529
- value: "4px",
530
- type: "borderWidth"
531
- },
532
- 8: {
533
- value: "8px",
534
- type: "borderWidth"
535
- }
536
- },
537
- rounded: {
538
- none: {
539
- value: "0px",
540
- type: "borderRadius"
541
- },
542
- sm: {
543
- value: "2px",
544
- type: "borderRadius"
545
- },
546
- base: {
547
- value: "4px",
548
- type: "borderRadius"
549
- },
550
- md: {
551
- value: "6px",
552
- type: "borderRadius"
553
- },
554
- lg: {
555
- value: "8px",
556
- type: "borderRadius"
557
- },
558
- xl: {
559
- value: "12px",
560
- type: "borderRadius"
561
- },
562
- "2xl": {
563
- value: "16px",
564
- type: "borderRadius"
565
- },
566
- "3xl": {
567
- value: "24px",
568
- type: "borderRadius"
569
- },
570
- full: {
571
- value: "9999px",
572
- type: "borderRadius"
573
- }
574
- },
575
- breakpoint: {
576
- xs: {
577
- value: "376px",
578
- type: "sizing"
579
- },
580
- sm: {
581
- value: "640px",
582
- type: "sizing"
583
- },
584
- md: {
585
- value: "768px",
586
- type: "sizing"
587
- },
588
- lg: {
589
- value: "1024px",
590
- type: "sizing"
591
- },
592
- xl: {
593
- value: "1280px",
594
- type: "sizing"
595
- },
596
- "2xl": {
597
- value: "1440px",
598
- type: "sizing"
599
- },
600
- "3xl": {
601
- value: "1536px",
602
- type: "sizing"
603
- }
604
- },
605
- shadow: {
606
- none: {
607
- value: {
608
- color: "#000000",
609
- type: "dropShadow",
610
- x: "0",
611
- y: "0",
612
- blur: "0",
613
- spread: "0"
614
- },
615
- type: "boxShadow"
616
- },
617
- sm: {
618
- value: {
619
- color: "#0000000d",
620
- type: "dropShadow",
621
- x: "0",
622
- y: "1",
623
- blur: "2",
624
- spread: "0"
625
- },
626
- type: "boxShadow"
627
- },
628
- base: {
629
- value: [
630
- {
631
- color: "#0000000f",
632
- type: "dropShadow",
633
- x: "0",
634
- y: "1",
635
- blur: "2",
636
- spread: "0"
637
- },
638
- {
639
- color: "#0000001a",
640
- type: "dropShadow",
641
- x: "0",
642
- y: "1",
643
- blur: "3",
644
- spread: "0"
645
- }
646
- ],
647
- type: "boxShadow"
648
- },
649
- md: {
650
- value: [
651
- {
652
- color: "#0000000f",
653
- type: "dropShadow",
654
- x: "0",
655
- y: "2",
656
- blur: "4",
657
- spread: "-1"
658
- },
659
- {
660
- color: "#0000001a",
661
- type: "dropShadow",
662
- x: "0",
663
- y: "4",
664
- blur: "6",
665
- spread: "-1"
666
- }
667
- ],
668
- type: "boxShadow"
669
- },
670
- lg: {
671
- value: [
672
- {
673
- color: "#0000000d",
674
- type: "dropShadow",
675
- x: "0",
676
- y: "4",
677
- blur: "6",
678
- spread: "-2"
679
- },
680
- {
681
- color: "#0000001a",
682
- type: "dropShadow",
683
- x: "0",
684
- y: "10",
685
- blur: "15",
686
- spread: "-3"
687
- }
688
- ],
689
- type: "boxShadow"
690
- },
691
- xl: {
692
- value: [
693
- {
694
- color: "#0000000a",
695
- type: "dropShadow",
696
- x: "0",
697
- y: "10",
698
- blur: "10",
699
- spread: "-5"
700
- },
701
- {
702
- color: "#0000001a",
703
- type: "dropShadow",
704
- x: "0",
705
- y: "20",
706
- blur: "25",
707
- spread: "-5"
708
- }
709
- ],
710
- type: "boxShadow"
711
- },
712
- "2xl": {
713
- value: {
714
- color: "#00000040",
715
- type: "dropShadow",
716
- x: "0",
717
- y: "25",
718
- blur: "50",
719
- spread: "-12"
720
- },
721
- type: "boxShadow"
722
- },
723
- inner: {
724
- value: {
725
- color: "#0000000f",
726
- type: "innerShadow",
727
- x: "0",
728
- y: "2",
729
- blur: "4",
730
- spread: "0"
731
- },
732
- type: "boxShadow"
733
- }
734
- },
735
- underline: {
736
- value: "underline",
737
- type: "textDecoration"
738
- },
739
- text: {
740
- xs: {
741
- value: "12px",
742
- type: "fontSizes"
743
- },
744
- sm: {
745
- value: "14px",
746
- type: "fontSizes"
747
- },
748
- base: {
749
- value: "16px",
750
- type: "fontSizes"
751
- },
752
- lg: {
753
- value: "18px",
754
- type: "fontSizes"
755
- },
756
- xl: {
757
- value: "20px",
758
- type: "fontSizes"
759
- },
760
- "2xl": {
761
- value: "24px",
762
- type: "fontSizes"
763
- },
764
- "3xl": {
765
- value: "30px",
766
- type: "fontSizes"
767
- },
768
- "4xl": {
769
- value: "36px",
770
- type: "fontSizes"
771
- },
772
- "5xl": {
773
- value: "48px",
774
- type: "fontSizes"
775
- },
776
- "6xl": {
777
- value: "60px",
778
- type: "fontSizes"
779
- },
780
- "7xl": {
781
- value: "72px",
782
- type: "fontSizes"
783
- },
784
- "8xl": {
785
- value: "96px",
786
- type: "fontSizes"
787
- },
788
- "9xl": {
789
- value: "128px",
790
- type: "fontSizes"
791
- }
792
- },
793
- leading: {
794
- xs: {
795
- value: "16px",
796
- type: "lineHeights"
797
- },
798
- sm: {
799
- value: "18px",
800
- type: "lineHeights"
801
- },
802
- base: {
803
- value: "20px",
804
- type: "lineHeights"
805
- },
806
- lg: {
807
- value: "24px",
808
- type: "lineHeights"
809
- },
810
- xl: {
811
- value: "28px",
812
- type: "lineHeights"
813
- },
814
- "2xl": {
815
- value: "32px",
816
- type: "lineHeights"
817
- },
818
- "3xl": {
819
- value: "36px",
820
- type: "lineHeights"
821
- },
822
- "4xl": {
823
- value: "40px",
824
- type: "lineHeights"
825
- },
826
- "5xl": {
827
- value: "48px",
828
- type: "lineHeights"
829
- },
830
- "6xl": {
831
- value: "60px",
832
- type: "lineHeights"
833
- },
834
- "7xl": {
835
- value: "72px",
836
- type: "lineHeights"
837
- },
838
- "8xl": {
839
- value: "96px",
840
- type: "lineHeights"
841
- },
842
- "9xl": {
843
- value: "128px",
844
- type: "lineHeights"
845
- }
846
- }
847
- }, $ = {
848
- global: ee
849
- }, le = [
850
- "blue",
851
- "purple",
852
- "orange",
853
- "pink",
854
- "yellow",
855
- "grey",
856
- "core"
857
- ], te = {
858
- safeColorNames: le
859
- }, ae = [
860
- "error",
861
- "warning",
862
- "success",
863
- "info"
864
- ], oe = {
865
- semanticColorNames: ae
866
- }, pe = te.safeColorNames, se = oe.semanticColorNames, y = {};
867
- pe.forEach((e) => {
868
- const t = $.global[e];
869
- t && Object.keys(t).forEach((l) => {
870
- var p;
871
- const a = (p = t[l]) == null ? void 0 : p.value;
872
- a && (y[e] || (y[e] = {}), y[e][l] = a);
873
- });
874
- });
875
- const H = $.global.semantic;
876
- H && se.forEach((e) => {
877
- const t = H[e];
878
- t && typeof t == "object" && Object.keys(t).forEach((l) => {
879
- var p;
880
- const a = (p = t[l]) == null ? void 0 : p.value;
881
- if (a) {
882
- const s = `semantic-${e}`;
883
- y[s] || (y[s] = {}), y[s][l] = a;
884
- }
885
- });
886
- });
887
- const re = Object.entries($.global.breakpoint).reduce(
888
- (e, [t, l]) => (e[t] = l.value, e),
889
- {}
890
- ), ue = { class: "text-ellipsis flex-1 whitespace-nowrap overflow-hidden" }, W = /* @__PURE__ */ w({
891
- __name: "FzTabButton",
892
- props: {
893
- tab: {},
894
- size: {},
895
- type: { default: "tab" },
896
- readonly: { type: Boolean, default: !1 },
897
- maxWidth: { default: "136px" }
898
- },
899
- emits: ["click"],
900
- setup(e, { emit: t }) {
901
- const l = Y(`(max-width: ${re.xs})`), a = e, p = O("selectedTab"), s = t, f = v(() => [
902
- "w-auto flex font-medium items-center rounded-md",
903
- D[a.size],
904
- a.type === "picker" ? "text-left" : "",
905
- (p == null ? void 0 : p.value) === a.tab.title ? X[a.type] : Z[a.type],
906
- a.tab.disabled ? "cursor-not-allowed" : "cursor-pointer",
907
- a.maxWidth && !l.value ? `max-w-[${a.maxWidth}]` : "",
908
- l.value ? "!max-w-full !w-full" : ""
909
- ]), u = () => {
910
- a.tab.disabled || (a.readonly || (p.value = a.tab.title), s("click"));
911
- };
912
- return (n, S) => (c(), h("button", _({
913
- class: f.value,
914
- onClick: u
915
- }, e.tab), [
916
- e.tab.icon ? (c(), d(b(V), {
917
- key: 0,
918
- name: e.tab.icon,
919
- size: e.size
920
- }, null, 8, ["name", "size"])) : T("", !0),
921
- z("span", ue, E(e.tab.title), 1),
922
- e.tab.badgeContent != null ? (c(), d(b(K), {
923
- key: 1,
924
- color: b(p) === e.tab.title ? "blue" : "black",
925
- size: e.size
926
- }, {
927
- default: m(() => [
928
- U(E(e.tab.badgeContent), 1)
929
- ]),
930
- _: 1
931
- }, 8, ["color", "size"])) : T("", !0),
932
- x(n.$slots, "default")
933
- ], 16));
934
- }
935
- }), ne = { class: "flex flex-col p-4 rounded shadow overflow-hidden bg-core-white z-10 w-full" }, ie = /* @__PURE__ */ w({
936
- __name: "FzTabPicker",
937
- props: {
938
- tabs: {},
939
- size: {}
940
- },
941
- setup(e) {
942
- const t = g(!1), l = e;
943
- g();
944
- const a = O("selectedTab"), p = v(() => l.tabs.find((f) => f.title === (a == null ? void 0 : a.value)));
945
- v(() => [
946
- "flex items-center text-left max-w-[136px] rounded-md h-auto bg-white text-blue-500 font-medium cursor-pointer capitalize ",
947
- D[l.size]
948
- ]);
949
- const s = () => {
950
- t.value = !1;
951
- };
952
- return (f, u) => (c(), d(b(J), {
953
- position: "bottom",
954
- isOpen: t.value,
955
- class: "w-full overflow-hidden",
956
- contentClass: "bg-transparent z-70"
957
- }, {
958
- opener: m(() => [
959
- N(W, {
960
- tab: p.value,
961
- size: e.size,
962
- class: "w-full sm:w-auto",
963
- type: "tab",
964
- readonly: "",
965
- onClick: u[0] || (u[0] = (n) => t.value = !t.value)
966
- }, {
967
- default: m(() => [
968
- N(b(V), {
969
- name: t.value ? "chevron-up" : "chevron-down",
970
- size: e.size
971
- }, null, 8, ["name", "size"])
972
- ]),
973
- _: 1
974
- }, 8, ["tab", "size"])
975
- ]),
976
- default: m(() => [
977
- z("div", ne, [
978
- (c(!0), h(B, null, R(e.tabs, (n) => (c(), d(W, {
979
- tab: n,
980
- size: e.size,
981
- type: "picker",
982
- onClick: s
983
- }, null, 8, ["tab", "size"]))), 256))
984
- ])
985
- ]),
986
- _: 1
987
- }, 8, ["isOpen"]));
988
- }
989
- }), F = /* @__PURE__ */ w({
990
- __name: "FzTab",
991
- props: {
992
- title: {},
993
- icon: {},
994
- badgeContent: {},
995
- disabled: { type: Boolean },
996
- initialSelected: { type: Boolean },
997
- maxWidth: {}
998
- },
999
- setup(e) {
1000
- const t = e, l = O("selectedTab"), a = v(() => (l == null ? void 0 : l.value) === t.title);
1001
- return j(() => {
1002
- l === void 0 ? console.error(
1003
- "[Fiscozen Design System]: FzTab must be used inside a FzTabs component"
1004
- ) : t.initialSelected && (l.value = t.title);
1005
- }), L(() => {
1006
- (l == null ? void 0 : l.value) === t.title && (l.value = "");
1007
- }), (p, s) => a.value ? x(p.$slots, "default", { key: 0 }) : T("", !0);
1008
- }
1009
- }), ce = "tab-container flex rounded-lg gap-8 p-2 bg-grey-100 w-fit max-w-full overflow-x-auto w-full sm:w-auto", fe = /* @__PURE__ */ w({
1010
- __name: "FzTabs",
1011
- props: {
1012
- size: { default: "sm" },
1013
- horizontalOverflow: { type: Boolean },
1014
- vertical: { type: Boolean, default: !1 }
1015
- },
1016
- emits: ["change"],
1017
- setup(e, { emit: t }) {
1018
- const l = e, a = t, p = q(), s = g(), f = g(!1), u = g("");
1019
- G("selectedTab", u);
1020
- const n = v(() => p.default ? p.default().filter((o) => o.type === F || typeof o.type == "symbol").map((o) => {
1021
- if (o.type === F) return o.props;
1022
- if (typeof o.type == "symbol") {
1023
- const i = o.children;
1024
- return !i || i === "v-if" ? null : i.filter((r) => r.type === F).map((r) => r.props);
1025
- }
1026
- }).flat().filter((o) => o != null) : []), S = v(() => [
1027
- l.vertical ? "flex-col" : "flex-row"
1028
- ]), I = v(() => [
1029
- "flex",
1030
- l.vertical ? "flex-row" : "flex-col"
1031
- ]);
1032
- function A(o) {
1033
- o.preventDefault(), o.stopPropagation(), o.deltaY > 0 ? s.value.scrollLeft += 100 : s.value.scrollLeft -= 100;
1034
- }
1035
- function k() {
1036
- if (!s.value) return !1;
1037
- const o = s.value.parentElement ?? document.body;
1038
- f.value = s.value.scrollWidth > o.clientWidth;
1039
- }
1040
- return j(() => {
1041
- if (n.value.length === 0)
1042
- console.warn(
1043
- "[Fiscozen Design System]: FzTabs must have at least one FzTab child"
1044
- );
1045
- else {
1046
- const o = n.value.find((r) => r.initialSelected);
1047
- o ? u.value = o.title : u.value = n.value[0].title;
1048
- const i = n.value.map((r) => r.title).filter((r, M, P) => P.indexOf(r) !== M);
1049
- i.length && console.warn(
1050
- `[Fiscozen Design System]: FzTabs has duplicate titles: ${i.join(", ")}, this may cause unexpected behavior.`
1051
- );
1052
- }
1053
- k(), window.addEventListener("resize", k);
1054
- }), L(() => {
1055
- window.removeEventListener("resize", k);
1056
- }), Q(
1057
- () => u.value,
1058
- () => {
1059
- var i;
1060
- u.value === "" && n.value.length > 0 && (u.value = ((i = n.value.find((r) => r.initialSelected)) == null ? void 0 : i.title) ?? n.value[0].title);
1061
- const o = s.value.querySelector(
1062
- `button[title="${u.value}"]`
1063
- );
1064
- o && f.value && o.scrollIntoView({
1065
- behavior: "smooth",
1066
- block: "nearest",
1067
- inline: "center"
1068
- }), a("change", u.value);
1069
- }
1070
- ), (o, i) => (c(), h("div", {
1071
- class: C(I.value)
1072
- }, [
1073
- z("div", {
1074
- class: C(["flex", S.value])
1075
- }, [
1076
- z("div", {
1077
- class: C([ce, S.value]),
1078
- ref_key: "tabContainer",
1079
- ref: s,
1080
- onWheel: A
1081
- }, [
1082
- !e.horizontalOverflow && f.value ? (c(), d(ie, {
1083
- key: 0,
1084
- tabs: n.value,
1085
- size: e.size
1086
- }, null, 8, ["tabs", "size"])) : (c(!0), h(B, { key: 1 }, R(n.value, (r) => (c(), d(W, {
1087
- tab: r,
1088
- key: r.title,
1089
- size: e.size,
1090
- maxWidth: r.maxWidth
1091
- }, null, 8, ["tab", "size", "maxWidth"]))), 128)),
1092
- x(o.$slots, "tabs-container-end", {}, void 0, !0)
1093
- ], 34),
1094
- x(o.$slots, "tabs-end", {}, void 0, !0)
1095
- ], 2),
1096
- x(o.$slots, "default", { selected: u.value }, void 0, !0)
1097
- ], 2));
1098
- }
1099
- }), ve = (e, t) => {
1100
- const l = e.__vccOpts || e;
1101
- for (const [a, p] of t)
1102
- l[a] = p;
1103
- return l;
1104
- }, ge = /* @__PURE__ */ ve(fe, [["__scopeId", "data-v-f9fcb49a"]]);
1105
- export {
1106
- F as FzTab,
1107
- ge as FzTabs
1108
- };