@bobbykim/manguito-theme 0.1.4 → 0.2.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/theme/theme.ts CHANGED
@@ -86,6 +86,12 @@ export interface Spacing {
86
86
  '3xl': string
87
87
  }
88
88
 
89
+ export interface Alignment {
90
+ left: string
91
+ center: string
92
+ right: string
93
+ }
94
+
89
95
  abstract class MCLTheme {
90
96
  // bg color class
91
97
  protected static bgColor: ColorClass = {
@@ -167,6 +173,26 @@ abstract class MCLTheme {
167
173
  white: 'after:bg-white',
168
174
  transparent: 'after:bg-transparent',
169
175
  }
176
+ // active:bg color class
177
+ protected static bgActiveColor: ColorClass = {
178
+ primary: 'active:bg-primary',
179
+ secondary: 'active:bg-secondary',
180
+ success: 'active:bg-success',
181
+ danger: 'active:bg-danger',
182
+ info: 'active:bg-info',
183
+ warning: 'active:bg-warning',
184
+ 'light-1': 'active:bg-light-1',
185
+ 'light-2': 'active:bg-light-2',
186
+ 'light-3': 'active:bg-light-3',
187
+ 'light-4': 'active:bg-light-4',
188
+ 'dark-1': 'active:bg-dark-1',
189
+ 'dark-2': 'active:bg-dark-2',
190
+ 'dark-3': 'active:bg-dark-3',
191
+ 'dark-4': 'active:bg-dark-4',
192
+ black: 'active:bg-black',
193
+ white: 'active:bg-white',
194
+ transparent: 'active:bg-transparent',
195
+ }
170
196
  // text color class
171
197
  protected static textColor: ColorClass = {
172
198
  primary: 'text-primary',
@@ -307,25 +333,45 @@ abstract class MCLTheme {
307
333
  white: 'active:ring-white',
308
334
  transparent: 'active:ring-transparent',
309
335
  }
310
- // active:bg color class
311
- protected static bgActiveColor: ColorClass = {
312
- primary: 'active:bg-primary',
313
- secondary: 'active:bg-secondary',
314
- success: 'active:bg-success',
315
- danger: 'active:bg-danger',
316
- info: 'active:bg-info',
317
- warning: 'active:bg-warning',
318
- 'light-1': 'active:bg-light-1',
319
- 'light-2': 'active:bg-light-2',
320
- 'light-3': 'active:bg-light-3',
321
- 'light-4': 'active:bg-light-4',
322
- 'dark-1': 'active:bg-dark-1',
323
- 'dark-2': 'active:bg-dark-2',
324
- 'dark-3': 'active:bg-dark-3',
325
- 'dark-4': 'active:bg-dark-4',
326
- black: 'active:bg-black',
327
- white: 'active:bg-white',
328
- transparent: 'active:bg-transparent',
336
+ // btn color class
337
+ protected static btnColor: ColorClass = {
338
+ primary: 'btn-primary',
339
+ secondary: 'btn-secondary',
340
+ success: 'btn-success',
341
+ danger: 'btn-danger',
342
+ info: 'btn-info',
343
+ warning: 'btn-warning',
344
+ 'light-1': 'btn-light-1',
345
+ 'light-2': 'btn-light-2',
346
+ 'light-3': 'btn-light-3',
347
+ 'light-4': 'btn-light-4',
348
+ 'dark-1': 'btn-dark-1',
349
+ 'dark-2': 'btn-dark-2',
350
+ 'dark-3': 'btn-dark-3',
351
+ 'dark-4': 'btn-dark-4',
352
+ black: 'btn-black',
353
+ white: 'btn-white',
354
+ transparent: 'btn-transparent',
355
+ }
356
+ // list color class
357
+ protected static listColor: ColorClass = {
358
+ primary: 'mcl-list-primary',
359
+ secondary: 'mcl-list-secondary',
360
+ success: 'mcl-list-success',
361
+ danger: 'mcl-list-danger',
362
+ info: 'mcl-list-info',
363
+ warning: 'mcl-list-warning',
364
+ 'light-1': 'mcl-list-light-1',
365
+ 'light-2': 'mcl-list-light-2',
366
+ 'light-3': 'mcl-list-light-3',
367
+ 'light-4': 'mcl-list-light-4',
368
+ 'dark-1': 'mcl-list-dark-1',
369
+ 'dark-2': 'mcl-list-dark-2',
370
+ 'dark-3': 'mcl-list-dark-3',
371
+ 'dark-4': 'mcl-list-dark-4',
372
+ black: 'mcl-list-black',
373
+ white: 'mcl-list-white',
374
+ transparent: 'mcl-list-transparent',
329
375
  }
330
376
  // h1 class
331
377
  protected static heading1: HeaderSizeClass = {
@@ -446,6 +492,25 @@ abstract class MCLTheme {
446
492
  white: 'border-t-white',
447
493
  transparent: 'border-t-transparent',
448
494
  }
495
+ protected static borderBottomColor: ColorClass = {
496
+ primary: 'border-b-primary',
497
+ secondary: 'border-b-secondary',
498
+ success: 'border-b-success',
499
+ danger: 'border-b-danger',
500
+ info: 'border-b-info',
501
+ warning: 'border-b-warning',
502
+ 'light-1': 'border-b-light-1',
503
+ 'light-2': 'border-b-light-2',
504
+ 'light-3': 'border-b-light-3',
505
+ 'light-4': 'border-b-light-4',
506
+ 'dark-1': 'border-b-dark-1',
507
+ 'dark-2': 'border-b-dark-2',
508
+ 'dark-3': 'border-b-dark-3',
509
+ 'dark-4': 'border-b-dark-4',
510
+ black: 'border-b-black',
511
+ white: 'border-b-white',
512
+ transparent: 'border-b-transparent',
513
+ }
449
514
  protected static borderLeftColor: ColorClass = {
450
515
  primary: 'border-l-primary',
451
516
  secondary: 'border-l-secondary',
@@ -465,26 +530,68 @@ abstract class MCLTheme {
465
530
  white: 'border-l-white',
466
531
  transparent: 'border-l-transparent',
467
532
  }
468
- protected static borderBottomColor: ColorClass = {
469
- primary: 'border-b-primary',
470
- secondary: 'border-b-secondary',
471
- success: 'border-b-success',
472
- danger: 'border-b-danger',
473
- info: 'border-b-info',
474
- warning: 'border-b-warning',
475
- 'light-1': 'border-b-light-1',
476
- 'light-2': 'border-b-light-2',
477
- 'light-3': 'border-b-light-3',
478
- 'light-4': 'border-b-light-4',
479
- 'dark-1': 'border-b-dark-1',
480
- 'dark-2': 'border-b-dark-2',
481
- 'dark-3': 'border-b-dark-3',
482
- 'dark-4': 'border-b-dark-4',
483
- black: 'border-b-black',
484
- white: 'border-b-white',
485
- transparent: 'border-b-transparent',
533
+ protected static borderRightColor: ColorClass = {
534
+ primary: 'border-r-primary',
535
+ secondary: 'border-r-secondary',
536
+ success: 'border-r-success',
537
+ danger: 'border-r-danger',
538
+ info: 'border-r-info',
539
+ warning: 'border-r-warning',
540
+ 'light-1': 'border-r-light-1',
541
+ 'light-2': 'border-r-light-2',
542
+ 'light-3': 'border-r-light-3',
543
+ 'light-4': 'border-r-light-4',
544
+ 'dark-1': 'border-r-dark-1',
545
+ 'dark-2': 'border-r-dark-2',
546
+ 'dark-3': 'border-r-dark-3',
547
+ 'dark-4': 'border-r-dark-4',
548
+ black: 'border-r-black',
549
+ white: 'border-r-white',
550
+ transparent: 'border-r-transparent',
551
+ }
552
+ // Border width class
553
+ protected static borderWidth: BorderWidth = {
554
+ 1: 'border-[1px]',
555
+ 2: 'border-[2px]',
556
+ 3: 'border-[3px]',
557
+ 4: 'border-[4px]',
558
+ 5: 'border-[5px]',
559
+ 6: 'border-[6px]',
560
+ 7: 'border-[7px]',
561
+ 8: 'border-[8px]',
562
+ 9: 'border-[9px]',
563
+ 10: 'border-[10px]',
564
+ 11: 'border-[11px]',
565
+ 12: 'border-[12px]',
566
+ }
567
+ protected static borderXWidth: BorderWidth = {
568
+ 1: 'border-x-[1px]',
569
+ 2: 'border-x-[2px]',
570
+ 3: 'border-x-[3px]',
571
+ 4: 'border-x-[4px]',
572
+ 5: 'border-x-[5px]',
573
+ 6: 'border-x-[6px]',
574
+ 7: 'border-x-[7px]',
575
+ 8: 'border-x-[8px]',
576
+ 9: 'border-x-[9px]',
577
+ 10: 'border-x-[10px]',
578
+ 11: 'border-x-[11px]',
579
+ 12: 'border-x-[12px]',
580
+ }
581
+ protected static borderYWidth: BorderWidth = {
582
+ 1: 'border-y-[1px]',
583
+ 2: 'border-y-[2px]',
584
+ 3: 'border-y-[3px]',
585
+ 4: 'border-y-[4px]',
586
+ 5: 'border-y-[5px]',
587
+ 6: 'border-y-[6px]',
588
+ 7: 'border-y-[7px]',
589
+ 8: 'border-y-[8px]',
590
+ 9: 'border-y-[9px]',
591
+ 10: 'border-y-[10px]',
592
+ 11: 'border-y-[11px]',
593
+ 12: 'border-y-[12px]',
486
594
  }
487
- // Border width class for top/left
488
595
  protected static borderTopWidth: BorderWidth = {
489
596
  1: 'border-t-[1px]',
490
597
  2: 'border-t-[2px]',
@@ -499,6 +606,20 @@ abstract class MCLTheme {
499
606
  11: 'border-t-[11px]',
500
607
  12: 'border-t-[12px]',
501
608
  }
609
+ protected static borderBottomWidth: BorderWidth = {
610
+ 1: 'border-b-[1px]',
611
+ 2: 'border-b-[2px]',
612
+ 3: 'border-b-[3px]',
613
+ 4: 'border-b-[4px]',
614
+ 5: 'border-b-[5px]',
615
+ 6: 'border-b-[6px]',
616
+ 7: 'border-b-[7px]',
617
+ 8: 'border-b-[8px]',
618
+ 9: 'border-b-[9px]',
619
+ 10: 'border-b-[10px]',
620
+ 11: 'border-b-[11px]',
621
+ 12: 'border-b-[12px]',
622
+ }
502
623
  protected static borderLeftWidth: BorderWidth = {
503
624
  1: 'border-l-[1px]',
504
625
  2: 'border-l-[2px]',
@@ -513,6 +634,21 @@ abstract class MCLTheme {
513
634
  11: 'border-l-[11px]',
514
635
  12: 'border-l-[12px]',
515
636
  }
637
+ protected static borderRightWidth: BorderWidth = {
638
+ 1: 'border-r-[1px]',
639
+ 2: 'border-r-[2px]',
640
+ 3: 'border-r-[3px]',
641
+ 4: 'border-r-[4px]',
642
+ 5: 'border-r-[5px]',
643
+ 6: 'border-r-[6px]',
644
+ 7: 'border-r-[7px]',
645
+ 8: 'border-r-[8px]',
646
+ 9: 'border-r-[9px]',
647
+ 10: 'border-r-[10px]',
648
+ 11: 'border-r-[11px]',
649
+ 12: 'border-r-[12px]',
650
+ }
651
+ // opacity
516
652
  protected static backgroundOpacity: Opacity = {
517
653
  10: 'bg-opacity-10',
518
654
  20: 'bg-opacity-20',
@@ -537,6 +673,55 @@ abstract class MCLTheme {
537
673
  90: 'opacity-90',
538
674
  100: 'opacity-100',
539
675
  }
676
+ // spacing: margin
677
+ protected static margin: Spacing = {
678
+ '0': 'm-0',
679
+ '3xs': 'm-3xs',
680
+ '2xs': 'm-2xs',
681
+ xs: 'm-xs',
682
+ sm: 'm-sm',
683
+ md: 'm-md',
684
+ lg: 'm-lg',
685
+ xl: 'm-xl',
686
+ '2xl': 'm-2xl',
687
+ '3xl': 'm-3xl',
688
+ }
689
+ protected static marginX: Spacing = {
690
+ '0': 'mx-0',
691
+ '3xs': 'mx-3xs',
692
+ '2xs': 'mx-2xs',
693
+ xs: 'mx-xs',
694
+ sm: 'mx-sm',
695
+ md: 'mx-md',
696
+ lg: 'mx-lg',
697
+ xl: 'mx-xl',
698
+ '2xl': 'mx-2xl',
699
+ '3xl': 'mx-3xl',
700
+ }
701
+ protected static marginY: Spacing = {
702
+ '0': 'my-0',
703
+ '3xs': 'my-3xs',
704
+ '2xs': 'my-2xs',
705
+ xs: 'my-xs',
706
+ sm: 'my-sm',
707
+ md: 'my-md',
708
+ lg: 'my-lg',
709
+ xl: 'my-xl',
710
+ '2xl': 'my-2xl',
711
+ '3xl': 'my-3xl',
712
+ }
713
+ protected static marginTop: Spacing = {
714
+ '0': 'mt-0',
715
+ '3xs': 'mt-3xs',
716
+ '2xs': 'mt-2xs',
717
+ xs: 'mt-xs',
718
+ sm: 'mt-sm',
719
+ md: 'mt-md',
720
+ lg: 'mt-lg',
721
+ xl: 'mt-xl',
722
+ '2xl': 'mt-2xl',
723
+ '3xl': 'mt-3xl',
724
+ }
540
725
  protected static marginBottom: Spacing = {
541
726
  '0': 'mb-0',
542
727
  '3xs': 'mb-3xs',
@@ -549,6 +734,115 @@ abstract class MCLTheme {
549
734
  '2xl': 'mb-2xl',
550
735
  '3xl': 'mb-3xl',
551
736
  }
737
+ protected static marginLeft: Spacing = {
738
+ '0': 'ml-0',
739
+ '3xs': 'ml-3xs',
740
+ '2xs': 'ml-2xs',
741
+ xs: 'ml-xs',
742
+ sm: 'ml-sm',
743
+ md: 'ml-md',
744
+ lg: 'ml-lg',
745
+ xl: 'ml-xl',
746
+ '2xl': 'ml-2xl',
747
+ '3xl': 'ml-3xl',
748
+ }
749
+ protected static marginRight: Spacing = {
750
+ '0': 'mr-0',
751
+ '3xs': 'mr-3xs',
752
+ '2xs': 'mr-2xs',
753
+ xs: 'mr-xs',
754
+ sm: 'mr-sm',
755
+ md: 'mr-md',
756
+ lg: 'mr-lg',
757
+ xl: 'mr-xl',
758
+ '2xl': 'mr-2xl',
759
+ '3xl': 'mr-3xl',
760
+ }
761
+ // spacing: padding
762
+ protected static padding: Spacing = {
763
+ '0': 'p-0',
764
+ '3xs': 'p-3xs',
765
+ '2xs': 'p-2xs',
766
+ xs: 'p-xs',
767
+ sm: 'p-sm',
768
+ md: 'p-md',
769
+ lg: 'p-lg',
770
+ xl: 'p-xl',
771
+ '2xl': 'p-2xl',
772
+ '3xl': 'p-3xl',
773
+ }
774
+ protected static paddingX: Spacing = {
775
+ '0': 'px-0',
776
+ '3xs': 'px-3xs',
777
+ '2xs': 'px-2xs',
778
+ xs: 'px-xs',
779
+ sm: 'px-sm',
780
+ md: 'px-md',
781
+ lg: 'px-lg',
782
+ xl: 'px-xl',
783
+ '2xl': 'px-2xl',
784
+ '3xl': 'px-3xl',
785
+ }
786
+ protected static paddingY: Spacing = {
787
+ '0': 'py-0',
788
+ '3xs': 'py-3xs',
789
+ '2xs': 'py-2xs',
790
+ xs: 'py-xs',
791
+ sm: 'py-sm',
792
+ md: 'py-md',
793
+ lg: 'py-lg',
794
+ xl: 'py-xl',
795
+ '2xl': 'py-2xl',
796
+ '3xl': 'py-3xl',
797
+ }
798
+ protected static paddingTop: Spacing = {
799
+ '0': 'pt-0',
800
+ '3xs': 'pt-3xs',
801
+ '2xs': 'pt-2xs',
802
+ xs: 'pt-xs',
803
+ sm: 'pt-sm',
804
+ md: 'pt-md',
805
+ lg: 'pt-lg',
806
+ xl: 'pt-xl',
807
+ '2xl': 'pt-2xl',
808
+ '3xl': 'pt-3xl',
809
+ }
810
+ protected static paddingBottom: Spacing = {
811
+ '0': 'pb-0',
812
+ '3xs': 'pb-3xs',
813
+ '2xs': 'pb-2xs',
814
+ xs: 'pb-xs',
815
+ sm: 'pb-sm',
816
+ md: 'pb-md',
817
+ lg: 'pb-lg',
818
+ xl: 'pb-xl',
819
+ '2xl': 'pb-2xl',
820
+ '3xl': 'pb-3xl',
821
+ }
822
+ protected static paddingLeft: Spacing = {
823
+ '0': 'pl-0',
824
+ '3xs': 'pl-3xs',
825
+ '2xs': 'pl-2xs',
826
+ xs: 'pl-xs',
827
+ sm: 'pl-sm',
828
+ md: 'pl-md',
829
+ lg: 'pl-lg',
830
+ xl: 'pl-xl',
831
+ '2xl': 'pl-2xl',
832
+ '3xl': 'pl-3xl',
833
+ }
834
+ protected static paddingRight: Spacing = {
835
+ '0': 'pr-0',
836
+ '3xs': 'pr-3xs',
837
+ '2xs': 'pr-2xs',
838
+ xs: 'pr-xs',
839
+ sm: 'pr-sm',
840
+ md: 'pr-md',
841
+ lg: 'pr-lg',
842
+ xl: 'pr-xl',
843
+ '2xl': 'pr-2xl',
844
+ '3xl': 'pr-3xl',
845
+ }
552
846
  // spacing gap class for flex/grid
553
847
  protected static gap: Spacing = {
554
848
  '0': 'gap-0',
@@ -562,6 +856,12 @@ abstract class MCLTheme {
562
856
  '2xl': 'gap-2xl',
563
857
  '3xl': 'gap-3xl',
564
858
  }
859
+ // text alignment
860
+ protected static textAlign: Alignment = {
861
+ left: 'text-left',
862
+ center: 'text-center',
863
+ right: 'text-right',
864
+ }
565
865
  }
566
866
 
567
867
  export default MCLTheme
@@ -38,17 +38,25 @@ export type BodyText = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
38
38
  // Font weight
39
39
  export type FontWeight = 'light' | 'normal' | 'bold'
40
40
  // border positions
41
- export type Position = 'left' | 'right'
41
+ export type Position = 'left' | 'center' | 'right'
42
42
  // link targets
43
43
  export type CtaTarget = '_self' | '_blank'
44
44
  // Highlight positions
45
- export type Location = 'left' | 'top'
45
+ export type Location = 'left' | 'right' | 'top' | 'bottom'
46
46
  // available ranges
47
- export type Range<T extends number> = number extends T ? number : _Range<T, []>
48
- export type _Range<
47
+ type _RangeArray<
49
48
  T extends number,
50
- R extends unknown[]
51
- > = R['length'] extends T ? R['length'] : R['length'] | _Range<T, [T, ...R]>
49
+ R extends unknown[] = []
50
+ > = R['length'] extends T ? R : _RangeArray<T, [...R, 1]>
51
+ type IntRange<
52
+ T extends number[],
53
+ E extends number,
54
+ R extends number = never
55
+ > = T['length'] extends E ? R | E : IntRange<[...T, 1], E, R | T['length']>
56
+ export type Range<T extends number, R extends number> = IntRange<
57
+ _RangeArray<T>,
58
+ R
59
+ >
52
60
  export type ButtonSize = 'small' | 'medium' | 'large'
53
61
  export type OpacityRange = 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100
54
62
  export type Directions = 'left' | 'right'