@bobbykim/manguito-theme 0.1.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/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ import GenerateMCLClass from './theme/generateClass'
2
+ import type { ClassType, InputType } from './theme/generateClass'
3
+
4
+ const generateClass = (type: ClassType, value: InputType): string => {
5
+ const mclGenerate = new GenerateMCLClass(type, value)
6
+
7
+ return mclGenerate.generateClassName()
8
+ }
9
+
10
+ export default generateClass
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@bobbykim/manguito-theme",
3
+ "version": "0.1.0",
4
+ "description": "main theme file for manguito components library. Other MCL components will need to import this file to run.",
5
+ "type": "module",
6
+ "main": "index.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "author": {
11
+ "name": "Bobby Kim",
12
+ "url": "https://www.devbobbykim.com/"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/bobbykim89/manguito-component-library.git"
17
+ },
18
+ "license": "MIT"
19
+ }
@@ -0,0 +1,231 @@
1
+ import MCLTheme from './theme'
2
+ import type {
3
+ ColorPalette,
4
+ HeadingSize,
5
+ BodyText,
6
+ FontWeight,
7
+ Range,
8
+ OpacityRange,
9
+ SpacingLevel,
10
+ } from './theme.types'
11
+
12
+ /**
13
+ * @TailwindCSS - Good practice is to let all of used classes to be in full instead of generated dynamically using methods such as string literal.
14
+ * @Interface - ClassType to define the case, and Input type to generate tailwind clssname.
15
+ * @Export GenerateRDSClass - extends RDSTheme class
16
+ */
17
+
18
+ export type ClassType =
19
+ | 'BGCOLOR'
20
+ | 'BEFOREBG'
21
+ | 'AFTERBG'
22
+ | 'TEXTCOLOR'
23
+ | 'DISABLEDTEXTCOLOR'
24
+ | 'SVGFILL'
25
+ | 'RINGCOLOR'
26
+ | 'FOCUSRING'
27
+ | 'ACTIVERING'
28
+ | 'ACTIVEBG'
29
+ | 'H1'
30
+ | 'H2'
31
+ | 'H3'
32
+ | 'H4'
33
+ | 'BODYTEXT'
34
+ | 'FONTWEIGHT'
35
+ | 'BORDER'
36
+ | 'BORDERX'
37
+ | 'BORDERY'
38
+ | 'BORDERT'
39
+ | 'BORDERL'
40
+ | 'BORDERB'
41
+ | 'BORDERTW'
42
+ | 'BORDERLW'
43
+ | 'HVBGCOLOR'
44
+ | 'HVTEXTCOLOR'
45
+ | 'BGOPACITY'
46
+ | 'OPACITY'
47
+ | 'MARGINB'
48
+
49
+ export type InputType =
50
+ | ColorPalette
51
+ | HeadingSize
52
+ | BodyText
53
+ | FontWeight
54
+ | Range<12>
55
+ | OpacityRange
56
+ | SpacingLevel
57
+
58
+ class GenerateMCLClass extends MCLTheme {
59
+ classType: ClassType
60
+ classValue: InputType
61
+
62
+ constructor(classType: ClassType, classValue: InputType) {
63
+ super()
64
+ this.classType = classType
65
+ this.classValue = classValue
66
+ }
67
+ generateClassName(): string {
68
+ switch (this.classType) {
69
+ case 'BGCOLOR':
70
+ case 'BEFOREBG':
71
+ case 'AFTERBG':
72
+ case 'TEXTCOLOR':
73
+ case 'DISABLEDTEXTCOLOR':
74
+ case 'SVGFILL':
75
+ case 'RINGCOLOR':
76
+ case 'FOCUSRING':
77
+ case 'ACTIVERING':
78
+ case 'ACTIVEBG':
79
+ return this.getColorClass()
80
+ case 'HVBGCOLOR':
81
+ case 'HVTEXTCOLOR':
82
+ return this.getHoverColorClass()
83
+ case 'H1':
84
+ case 'H2':
85
+ case 'H3':
86
+ case 'H4':
87
+ return this.getHeadingTextSizeClass()
88
+ case 'BODYTEXT':
89
+ return this.getBodyTextSizeClass()
90
+ case 'FONTWEIGHT':
91
+ return this.getFontWeightClass()
92
+ case 'BORDER':
93
+ case 'BORDERX':
94
+ case 'BORDERY':
95
+ case 'BORDERT':
96
+ case 'BORDERB':
97
+ case 'BORDERL':
98
+ return this.getBorderColorClass()
99
+ case 'BORDERTW':
100
+ case 'BORDERLW':
101
+ return this.getBorderWidthClass()
102
+ case 'BGOPACITY':
103
+ return this.getBgOpacityClass()
104
+ case 'OPACITY':
105
+ return this.getOpacityClass()
106
+ case 'MARGINB':
107
+ return this.getSpacingClass()
108
+ default:
109
+ return
110
+ }
111
+ }
112
+ getColorClass(): string {
113
+ const {
114
+ bgColor,
115
+ beforeBgColor,
116
+ afterBgColor,
117
+ textColor,
118
+ disabledTextColor,
119
+ svgFillColor,
120
+ ringColor,
121
+ ringFocusColor,
122
+ ringActiveColor,
123
+ bgActiveColor,
124
+ } = MCLTheme
125
+ if (this.classType === 'BGCOLOR') {
126
+ return bgColor[this.classValue]
127
+ }
128
+ if (this.classType === 'BEFOREBG') {
129
+ return beforeBgColor[this.classValue]
130
+ }
131
+ if (this.classType === 'AFTERBG') {
132
+ return afterBgColor[this.classValue]
133
+ }
134
+ if (this.classType === 'TEXTCOLOR') {
135
+ return textColor[this.classValue]
136
+ }
137
+ if (this.classType === 'DISABLEDTEXTCOLOR') {
138
+ return disabledTextColor[this.classValue]
139
+ }
140
+ if (this.classType === 'SVGFILL') {
141
+ return svgFillColor[this.classValue]
142
+ }
143
+ if (this.classType === 'FOCUSRING') {
144
+ return ringFocusColor[this.classValue]
145
+ }
146
+ if (this.classType === 'ACTIVERING') {
147
+ return ringActiveColor[this.classValue]
148
+ }
149
+ if (this.classType === 'ACTIVEBG') {
150
+ return bgActiveColor[this.classValue]
151
+ }
152
+ return ringColor[this.classValue]
153
+ }
154
+ getHoverColorClass(): string {
155
+ const { hoverBgColor, hoverTextColor } = MCLTheme
156
+ if (this.classType === 'HVBGCOLOR') {
157
+ return hoverBgColor[this.classValue]
158
+ }
159
+ return hoverTextColor[this.classValue]
160
+ }
161
+ getHeadingTextSizeClass(): string {
162
+ const { heading1, heading2, heading3, heading4 } = MCLTheme
163
+ if (this.classType === 'H1') {
164
+ return heading1[this.classValue]
165
+ }
166
+ if (this.classType === 'H2') {
167
+ return heading2[this.classValue]
168
+ }
169
+ if (this.classType === 'H3') {
170
+ return heading3[this.classValue]
171
+ }
172
+ return heading4[this.classValue]
173
+ }
174
+ getBodyTextSizeClass(): string {
175
+ const { bodyText } = MCLTheme
176
+ return bodyText[this.classValue]
177
+ }
178
+ getFontWeightClass(): string {
179
+ const { fontweight } = MCLTheme
180
+ return fontweight[this.classValue]
181
+ }
182
+ getBorderColorClass(): string {
183
+ const {
184
+ borderColor,
185
+ borderXColor,
186
+ borderYColor,
187
+ borderTopColor,
188
+ borderBottomColor,
189
+ borderLeftColor,
190
+ } = MCLTheme
191
+ if (this.classType === 'BORDERX') {
192
+ return borderXColor[this.classValue]
193
+ }
194
+ if (this.classType === 'BORDERY') {
195
+ return borderYColor[this.classValue]
196
+ }
197
+ if (this.classType === 'BORDERT') {
198
+ return borderTopColor[this.classValue]
199
+ }
200
+ if (this.classType === 'BORDERB') {
201
+ return borderBottomColor[this.classValue]
202
+ }
203
+ if (this.classType === 'BORDERL') {
204
+ return borderLeftColor[this.classValue]
205
+ }
206
+ return borderColor[this.classValue]
207
+ }
208
+ getBorderWidthClass(): string {
209
+ const { borderTopWidth, borderLeftWidth } = MCLTheme
210
+ if (this.classType === 'BORDERTW') {
211
+ return borderTopWidth[this.classValue]
212
+ }
213
+ return borderLeftWidth[this.classValue]
214
+ }
215
+ getBgOpacityClass(): string {
216
+ const { backgroundOpacity } = MCLTheme
217
+ return backgroundOpacity[this.classValue]
218
+ }
219
+ getOpacityClass(): string {
220
+ const { opacity } = MCLTheme
221
+ return opacity[this.classValue]
222
+ }
223
+ getSpacingClass(): string {
224
+ const { marginBottom } = MCLTheme
225
+ if (this.classType === 'MARGINB') {
226
+ return marginBottom[this.classValue]
227
+ }
228
+ }
229
+ }
230
+
231
+ export default GenerateMCLClass
package/theme/theme.ts ADDED
@@ -0,0 +1,554 @@
1
+ /**
2
+ * @TailwindCSS - Good practice is to let all of used classes to be in full instead of generated dynamically using methods such as string literal.
3
+ * @Interface - Classes for color, header text, body text, border color, border width(top, left).
4
+ * @Export RDSTheme - an abstract class
5
+ */
6
+
7
+ export interface ColorClass {
8
+ primary: string
9
+ secondary: string
10
+ success: string
11
+ info: string
12
+ warning: string
13
+ danger: string
14
+ 'light-1': string
15
+ 'light-2': string
16
+ 'light-3': string
17
+ 'light-4': string
18
+ 'dark-1': string
19
+ 'dark-2': string
20
+ 'dark-3': string
21
+ 'dark-4': string
22
+ black: string
23
+ white: string
24
+ transparent: string
25
+ }
26
+
27
+ export interface HeaderSizeClass {
28
+ sm: string
29
+ md: string
30
+ lg: string
31
+ xl: string
32
+ }
33
+
34
+ export interface BodyTextClass {
35
+ xs: string
36
+ sm: string
37
+ md: string
38
+ lg: string
39
+ xl: string
40
+ }
41
+
42
+ export interface FontWeightClass {
43
+ light: string
44
+ normal: string
45
+ bold: string
46
+ }
47
+
48
+ export interface BorderWidth {
49
+ 1: string
50
+ 2: string
51
+ 3: string
52
+ 4: string
53
+ 5: string
54
+ 6: string
55
+ 7: string
56
+ 8: string
57
+ 9: string
58
+ 10: string
59
+ 11: string
60
+ 12: string
61
+ }
62
+
63
+ export interface Opacity {
64
+ 10: string
65
+ 20: string
66
+ 30: string
67
+ 40: string
68
+ 50: string
69
+ 60: string
70
+ 70: string
71
+ 80: string
72
+ 90: string
73
+ 100: string
74
+ }
75
+
76
+ export interface Spacing {
77
+ '0': string
78
+ '3xs': string
79
+ '2xs': string
80
+ xs: string
81
+ sm: string
82
+ md: string
83
+ lg: string
84
+ xl: string
85
+ '2xl': string
86
+ '3xl': string
87
+ }
88
+
89
+ abstract class MCLTheme {
90
+ // bg color class
91
+ protected static bgColor: ColorClass = {
92
+ primary: 'bg-primary',
93
+ secondary: 'bg-secondary',
94
+ success: 'bg-success',
95
+ danger: 'bg-danger',
96
+ info: 'bg-info',
97
+ warning: 'bg-warning',
98
+ 'light-1': 'bg-light-1',
99
+ 'light-2': 'bg-light-2',
100
+ 'light-3': 'bg-light-3',
101
+ 'light-4': 'bg-light-4',
102
+ 'dark-1': 'bg-dark-1',
103
+ 'dark-2': 'bg-dark-2',
104
+ 'dark-3': 'bg-dark-3',
105
+ 'dark-4': 'bg-dark-4',
106
+ black: 'bg-black',
107
+ white: 'bg-white',
108
+ transparent: 'bg-transparent',
109
+ }
110
+ // hover bg color class
111
+ protected static hoverBgColor: ColorClass = {
112
+ primary: 'hover:bg-primary',
113
+ secondary: 'hover:bg-secondary',
114
+ success: 'hover:bg-success',
115
+ danger: 'hover:bg-danger',
116
+ info: 'hover:bg-info',
117
+ warning: 'hover:bg-warning',
118
+ 'light-1': 'hover:bg-light-1',
119
+ 'light-2': 'hover:bg-light-2',
120
+ 'light-3': 'hover:bg-light-3',
121
+ 'light-4': 'hover:bg-light-4',
122
+ 'dark-1': 'hover:bg-dark-1',
123
+ 'dark-2': 'hover:bg-dark-2',
124
+ 'dark-3': 'hover:bg-dark-3',
125
+ 'dark-4': 'hover:bg-dark-4',
126
+ black: 'hover:bg-black',
127
+ white: 'hover:bg-white',
128
+ transparent: 'hover:bg-transparent',
129
+ }
130
+ // ::before bg color class
131
+ protected static beforeBgColor: ColorClass = {
132
+ primary: 'before:bg-primary',
133
+ secondary: 'before:bg-secondary',
134
+ success: 'before:bg-success',
135
+ danger: 'before:bg-danger',
136
+ info: 'before:bg-info',
137
+ warning: 'before:bg-warning',
138
+ 'light-1': 'before:bg-light-1',
139
+ 'light-2': 'before:bg-light-2',
140
+ 'light-3': 'before:bg-light-3',
141
+ 'light-4': 'before:bg-light-4',
142
+ 'dark-1': 'before:bg-dark-1',
143
+ 'dark-2': 'before:bg-dark-2',
144
+ 'dark-3': 'before:bg-dark-3',
145
+ 'dark-4': 'before:bg-dark-4',
146
+ black: 'before:bg-black',
147
+ white: 'before:bg-white',
148
+ transparent: 'before:bg-transparent',
149
+ }
150
+ // ::after bg color class
151
+ protected static afterBgColor: ColorClass = {
152
+ primary: 'after:bg-primary',
153
+ secondary: 'after:bg-secondary',
154
+ success: 'after:bg-success',
155
+ danger: 'after:bg-danger',
156
+ info: 'after:bg-info',
157
+ warning: 'after:bg-warning',
158
+ 'light-1': 'after:bg-light-1',
159
+ 'light-2': 'after:bg-light-2',
160
+ 'light-3': 'after:bg-light-3',
161
+ 'light-4': 'after:bg-light-4',
162
+ 'dark-1': 'after:bg-dark-1',
163
+ 'dark-2': 'after:bg-dark-2',
164
+ 'dark-3': 'after:bg-dark-3',
165
+ 'dark-4': 'after:bg-dark-4',
166
+ black: 'after:bg-black',
167
+ white: 'after:bg-white',
168
+ transparent: 'after:bg-transparent',
169
+ }
170
+ // text color class
171
+ protected static textColor: ColorClass = {
172
+ primary: 'text-primary',
173
+ secondary: 'text-secondary',
174
+ success: 'text-success',
175
+ danger: 'text-danger',
176
+ info: 'text-info',
177
+ warning: 'text-warning',
178
+ 'light-1': 'text-light-1',
179
+ 'light-2': 'text-light-2',
180
+ 'light-3': 'text-light-3',
181
+ 'light-4': 'text-light-4',
182
+ 'dark-1': 'text-dark-1',
183
+ 'dark-2': 'text-dark-2',
184
+ 'dark-3': 'text-dark-3',
185
+ 'dark-4': 'text-dark-4',
186
+ black: 'text-black',
187
+ white: 'text-white',
188
+ transparent: 'text-transparent',
189
+ }
190
+ // hover text color class
191
+ protected static hoverTextColor: ColorClass = {
192
+ primary: 'hover:text-primary',
193
+ secondary: 'hover:text-secondary',
194
+ success: 'hover:text-success',
195
+ danger: 'hover:text-danger',
196
+ info: 'hover:text-info',
197
+ warning: 'hover:text-warning',
198
+ 'light-1': 'hover:text-light-1',
199
+ 'light-2': 'hover:text-light-2',
200
+ 'light-3': 'hover:text-light-3',
201
+ 'light-4': 'hover:text-light-4',
202
+ 'dark-1': 'hover:text-dark-1',
203
+ 'dark-2': 'hover:text-dark-2',
204
+ 'dark-3': 'hover:text-dark-3',
205
+ 'dark-4': 'hover:text-dark-4',
206
+ black: 'hover:text-black',
207
+ white: 'hover:text-white',
208
+ transparent: 'hover:text-transparent',
209
+ }
210
+ // disabled text color class
211
+ protected static disabledTextColor: ColorClass = {
212
+ primary: 'disabled:text-primary',
213
+ secondary: 'disabled:text-secondary',
214
+ success: 'disabled:text-success',
215
+ danger: 'disabled:text-danger',
216
+ info: 'disabled:text-info',
217
+ warning: 'disabled:text-warning',
218
+ 'light-1': 'disabled:text-light-1',
219
+ 'light-2': 'disabled:text-light-2',
220
+ 'light-3': 'disabled:text-light-3',
221
+ 'light-4': 'disabled:text-light-4',
222
+ 'dark-1': 'disabled:text-dark-1',
223
+ 'dark-2': 'disabled:text-dark-2',
224
+ 'dark-3': 'disabled:text-dark-3',
225
+ 'dark-4': 'disabled:text-dark-4',
226
+ black: 'disabled:text-black',
227
+ white: 'disabled:text-white',
228
+ transparent: 'disabled:text-transparent',
229
+ }
230
+ // SVG fill color class
231
+ protected static svgFillColor: ColorClass = {
232
+ primary: 'fill-primary',
233
+ secondary: 'fill-secondary',
234
+ success: 'fill-success',
235
+ danger: 'fill-danger',
236
+ info: 'fill-info',
237
+ warning: 'fill-warning',
238
+ 'light-1': 'fill-light-1',
239
+ 'light-2': 'fill-light-2',
240
+ 'light-3': 'fill-light-3',
241
+ 'light-4': 'fill-light-4',
242
+ 'dark-1': 'fill-dark-1',
243
+ 'dark-2': 'fill-dark-2',
244
+ 'dark-3': 'fill-dark-3',
245
+ 'dark-4': 'fill-dark-4',
246
+ black: 'fill-black',
247
+ white: 'fill-white',
248
+ transparent: 'fill-transparent',
249
+ }
250
+ // ring color class
251
+ protected static ringColor: ColorClass = {
252
+ primary: 'ring-primary',
253
+ secondary: 'ring-secondary',
254
+ success: 'ring-success',
255
+ danger: 'ring-danger',
256
+ info: 'ring-info',
257
+ warning: 'ring-warning',
258
+ 'light-1': 'ring-light-1',
259
+ 'light-2': 'ring-light-2',
260
+ 'light-3': 'ring-light-3',
261
+ 'light-4': 'ring-light-4',
262
+ 'dark-1': 'ring-dark-1',
263
+ 'dark-2': 'ring-dark-2',
264
+ 'dark-3': 'ring-dark-3',
265
+ 'dark-4': 'ring-dark-4',
266
+ black: 'ring-black',
267
+ white: 'ring-white',
268
+ transparent: 'ring-transparent',
269
+ }
270
+ // focus:ring color class
271
+ protected static ringFocusColor: ColorClass = {
272
+ primary: 'focus:ring-primary',
273
+ secondary: 'focus:ring-secondary',
274
+ success: 'focus:ring-success',
275
+ danger: 'focus:ring-danger',
276
+ info: 'focus:ring-info',
277
+ warning: 'focus:ring-warning',
278
+ 'light-1': 'focus:ring-light-1',
279
+ 'light-2': 'focus:ring-light-2',
280
+ 'light-3': 'focus:ring-light-3',
281
+ 'light-4': 'focus:ring-light-4',
282
+ 'dark-1': 'focus:ring-dark-1',
283
+ 'dark-2': 'focus:ring-dark-2',
284
+ 'dark-3': 'focus:ring-dark-3',
285
+ 'dark-4': 'focus:ring-dark-4',
286
+ black: 'focus:ring-black',
287
+ white: 'focus:ring-white',
288
+ transparent: 'focus:ring-transparent',
289
+ }
290
+ // active:ring color class
291
+ protected static ringActiveColor: ColorClass = {
292
+ primary: 'active:ring-primary',
293
+ secondary: 'active:ring-secondary',
294
+ success: 'active:ring-success',
295
+ danger: 'active:ring-danger',
296
+ info: 'active:ring-info',
297
+ warning: 'active:ring-warning',
298
+ 'light-1': 'active:ring-light-1',
299
+ 'light-2': 'active:ring-light-2',
300
+ 'light-3': 'active:ring-light-3',
301
+ 'light-4': 'active:ring-light-4',
302
+ 'dark-1': 'active:ring-dark-1',
303
+ 'dark-2': 'active:ring-dark-2',
304
+ 'dark-3': 'active:ring-dark-3',
305
+ 'dark-4': 'active:ring-dark-4',
306
+ black: 'active:ring-black',
307
+ white: 'active:ring-white',
308
+ transparent: 'active:ring-transparent',
309
+ }
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',
329
+ }
330
+ // h1 class
331
+ protected static heading1: HeaderSizeClass = {
332
+ sm: 'h1-sm',
333
+ md: 'h1-md',
334
+ lg: 'h1-lg',
335
+ xl: 'h1-xl',
336
+ }
337
+ // h2 class
338
+ protected static heading2: HeaderSizeClass = {
339
+ sm: 'h2-sm',
340
+ md: 'h2-md',
341
+ lg: 'h2-lg',
342
+ xl: 'h2-xl',
343
+ }
344
+ // h3 class
345
+ protected static heading3: HeaderSizeClass = {
346
+ sm: 'h3-sm',
347
+ md: 'h3-md',
348
+ lg: 'h3-lg',
349
+ xl: 'h3-xl',
350
+ }
351
+ // h4 class
352
+ protected static heading4: HeaderSizeClass = {
353
+ sm: 'h4-sm',
354
+ md: 'h4-md',
355
+ lg: 'h4-lg',
356
+ xl: 'h4-xl',
357
+ }
358
+ // body text class
359
+ protected static bodyText: BodyTextClass = {
360
+ xs: 'text-xs',
361
+ sm: 'text-sm',
362
+ md: 'text-md',
363
+ lg: 'text-lg',
364
+ xl: 'text-xl',
365
+ }
366
+ // font weight class
367
+ protected static fontweight: FontWeightClass = {
368
+ light: 'font-light',
369
+ normal: 'font-normal',
370
+ bold: 'font-bold',
371
+ }
372
+ // border color classes
373
+ protected static borderColor: ColorClass = {
374
+ primary: 'border-primary',
375
+ secondary: 'border-secondary',
376
+ success: 'border-success',
377
+ danger: 'border-danger',
378
+ info: 'border-info',
379
+ warning: 'border-warning',
380
+ 'light-1': 'border-light-1',
381
+ 'light-2': 'border-light-2',
382
+ 'light-3': 'border-light-3',
383
+ 'light-4': 'border-light-4',
384
+ 'dark-1': 'border-dark-1',
385
+ 'dark-2': 'border-dark-2',
386
+ 'dark-3': 'border-dark-3',
387
+ 'dark-4': 'border-dark-4',
388
+ black: 'border-black',
389
+ white: 'border-white',
390
+ transparent: 'border-transparent',
391
+ }
392
+ protected static borderXColor: ColorClass = {
393
+ primary: 'border-x-primary',
394
+ secondary: 'border-x-secondary',
395
+ success: 'border-x-success',
396
+ danger: 'border-x-danger',
397
+ info: 'border-x-info',
398
+ warning: 'border-x-warning',
399
+ 'light-1': 'border-x-light-1',
400
+ 'light-2': 'border-x-light-2',
401
+ 'light-3': 'border-x-light-3',
402
+ 'light-4': 'border-x-light-4',
403
+ 'dark-1': 'border-x-dark-1',
404
+ 'dark-2': 'border-x-dark-2',
405
+ 'dark-3': 'border-x-dark-3',
406
+ 'dark-4': 'border-x-dark-4',
407
+ black: 'border-x-black',
408
+ white: 'border-x-white',
409
+ transparent: 'border-x-transparent',
410
+ }
411
+ protected static borderYColor: ColorClass = {
412
+ primary: 'border-y-primary',
413
+ secondary: 'border-y-secondary',
414
+ success: 'border-y-success',
415
+ danger: 'border-y-danger',
416
+ info: 'border-y-info',
417
+ warning: 'border-y-warning',
418
+ 'light-1': 'border-y-light-1',
419
+ 'light-2': 'border-y-light-2',
420
+ 'light-3': 'border-y-light-3',
421
+ 'light-4': 'border-y-light-4',
422
+ 'dark-1': 'border-y-dark-1',
423
+ 'dark-2': 'border-y-dark-2',
424
+ 'dark-3': 'border-y-dark-3',
425
+ 'dark-4': 'border-y-dark-4',
426
+ black: 'border-y-black',
427
+ white: 'border-y-white',
428
+ transparent: 'border-y-transparent',
429
+ }
430
+ protected static borderTopColor: ColorClass = {
431
+ primary: 'border-t-primary',
432
+ secondary: 'border-t-secondary',
433
+ success: 'border-t-success',
434
+ danger: 'border-t-danger',
435
+ info: 'border-t-info',
436
+ warning: 'border-t-warning',
437
+ 'light-1': 'border-t-light-1',
438
+ 'light-2': 'border-t-light-2',
439
+ 'light-3': 'border-t-light-3',
440
+ 'light-4': 'border-t-light-4',
441
+ 'dark-1': 'border-t-dark-1',
442
+ 'dark-2': 'border-t-dark-2',
443
+ 'dark-3': 'border-t-dark-3',
444
+ 'dark-4': 'border-t-dark-4',
445
+ black: 'border-t-black',
446
+ white: 'border-t-white',
447
+ transparent: 'border-t-transparent',
448
+ }
449
+ protected static borderLeftColor: ColorClass = {
450
+ primary: 'border-l-primary',
451
+ secondary: 'border-l-secondary',
452
+ success: 'border-l-success',
453
+ danger: 'border-l-danger',
454
+ info: 'border-l-info',
455
+ warning: 'border-l-warning',
456
+ 'light-1': 'border-l-light-1',
457
+ 'light-2': 'border-l-light-2',
458
+ 'light-3': 'border-l-light-3',
459
+ 'light-4': 'border-l-light-4',
460
+ 'dark-1': 'border-l-dark-1',
461
+ 'dark-2': 'border-l-dark-2',
462
+ 'dark-3': 'border-l-dark-3',
463
+ 'dark-4': 'border-l-dark-4',
464
+ black: 'border-l-black',
465
+ white: 'border-l-white',
466
+ transparent: 'border-l-transparent',
467
+ }
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',
486
+ }
487
+ // Border width class for top/left
488
+ protected static borderTopWidth: BorderWidth = {
489
+ 1: 'border-t-[1px]',
490
+ 2: 'border-t-[2px]',
491
+ 3: 'border-t-[3px]',
492
+ 4: 'border-t-[4px]',
493
+ 5: 'border-t-[5px]',
494
+ 6: 'border-t-[6px]',
495
+ 7: 'border-t-[7px]',
496
+ 8: 'border-t-[8px]',
497
+ 9: 'border-t-[9px]',
498
+ 10: 'border-t-[10px]',
499
+ 11: 'border-t-[11px]',
500
+ 12: 'border-t-[12px]',
501
+ }
502
+ protected static borderLeftWidth: BorderWidth = {
503
+ 1: 'border-l-[1px]',
504
+ 2: 'border-l-[2px]',
505
+ 3: 'border-l-[3px]',
506
+ 4: 'border-l-[4px]',
507
+ 5: 'border-l-[5px]',
508
+ 6: 'border-l-[6px]',
509
+ 7: 'border-l-[7px]',
510
+ 8: 'border-l-[8px]',
511
+ 9: 'border-l-[9px]',
512
+ 10: 'border-l-[10px]',
513
+ 11: 'border-l-[11px]',
514
+ 12: 'border-l-[12px]',
515
+ }
516
+ protected static backgroundOpacity: Opacity = {
517
+ 10: 'bg-opacity-10',
518
+ 20: 'bg-opacity-20',
519
+ 30: 'bg-opacity-30',
520
+ 40: 'bg-opacity-40',
521
+ 50: 'bg-opacity-50',
522
+ 60: 'bg-opacity-60',
523
+ 70: 'bg-opacity-70',
524
+ 80: 'bg-opacity-80',
525
+ 90: 'bg-opacity-90',
526
+ 100: 'bg-opacity-100',
527
+ }
528
+ protected static opacity: Opacity = {
529
+ 10: 'opacity-10',
530
+ 20: 'opacity-20',
531
+ 30: 'opacity-30',
532
+ 40: 'opacity-40',
533
+ 50: 'opacity-50',
534
+ 60: 'opacity-60',
535
+ 70: 'opacity-70',
536
+ 80: 'opacity-80',
537
+ 90: 'opacity-90',
538
+ 100: 'opacity-100',
539
+ }
540
+ protected static marginBottom: Spacing = {
541
+ '0': 'mb-0',
542
+ '3xs': 'mb-3xs',
543
+ '2xs': 'mb-2xs',
544
+ xs: 'mb-xs',
545
+ sm: 'mb-sm',
546
+ md: 'mb-md',
547
+ lg: 'mb-lg',
548
+ xl: 'mb-xl',
549
+ '2xl': 'mb-2xl',
550
+ '3xl': 'mb-3xl',
551
+ }
552
+ }
553
+
554
+ export default MCLTheme
@@ -0,0 +1,57 @@
1
+ // Colors for bg-color and font-color
2
+ export type ColorPalette =
3
+ | 'primary'
4
+ | 'secondary'
5
+ | 'success'
6
+ | 'info'
7
+ | 'warning'
8
+ | 'danger'
9
+ | 'light-1'
10
+ | 'light-2'
11
+ | 'light-3'
12
+ | 'light-4'
13
+ | 'dark-1'
14
+ | 'dark-2'
15
+ | 'dark-3'
16
+ | 'dark-4'
17
+ | 'black'
18
+ | 'white'
19
+ | 'transparent'
20
+ // Available spacings
21
+ export type SpacingLevel =
22
+ | '0'
23
+ | '3xs'
24
+ | '2xs'
25
+ | 'xs'
26
+ | 'sm'
27
+ | 'md'
28
+ | 'lg'
29
+ | 'xl'
30
+ | '2xl'
31
+ | '3xl'
32
+ // Available heading levels
33
+ export type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4'
34
+ // Available heading sizes
35
+ export type HeadingSize = 'sm' | 'md' | 'lg' | 'xl'
36
+ // Available body text sizes
37
+ export type BodyText = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
38
+ // Font weight
39
+ export type FontWeight = 'light' | 'normal' | 'bold'
40
+ // border positions
41
+ export type Position = 'left' | 'right'
42
+ // link targets
43
+ export type CtaTarget = '_self' | '_blank'
44
+ // Highlight positions
45
+ export type Location = 'left' | 'top'
46
+ // available ranges
47
+ export type Range<T extends number> = number extends T ? number : _Range<T, []>
48
+ export type _Range<
49
+ T extends number,
50
+ R extends unknown[]
51
+ > = R['length'] extends T ? R['length'] : R['length'] | _Range<T, [T, ...R]>
52
+ export type ButtonSize = 'small' | 'medium' | 'large'
53
+ export type OpacityRange = 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100
54
+ export type Directions = 'left' | 'right'
55
+ export type ColumnWidth = 25 | 50 | 75 | 100
56
+ export type CrossOrigin = 'use-credentials' | 'anonymous'
57
+ export type InputType = 'text' | 'email' | 'password'
@@ -0,0 +1,210 @@
1
+ const mclTheme = {
2
+ fontSize: {
3
+ xs: '12px',
4
+ sm: '14px',
5
+ md: '16px',
6
+ lg: '18px',
7
+ xl: '20px',
8
+ },
9
+ container: {
10
+ center: true,
11
+ screens: {
12
+ sm: '640px',
13
+ md: '768px',
14
+ lg: '1024px',
15
+ xl: '1280px',
16
+ },
17
+ },
18
+ extend: {
19
+ colors: {
20
+ primary: '#ec489a',
21
+ secondary: '#00feda',
22
+ success: '#78be20',
23
+ info: '#00a3e0',
24
+ warning: '#f1ac18',
25
+ danger: '#cc2f2f',
26
+ 'light-1': '#fafafa',
27
+ 'light-2': '#f1f1f1',
28
+ 'light-3': '#e8e8e8',
29
+ 'light-4': '#d0d0d0',
30
+ 'dark-1': '#747474',
31
+ 'dark-2': '#484848',
32
+ 'dark-3': '#1f2937',
33
+ 'dark-4': '#191919',
34
+ },
35
+ spacing: {
36
+ '3xs': '4px',
37
+ '2xs': '8px',
38
+ xs: '16px',
39
+ sm: '24px',
40
+ md: '32px',
41
+ lg: '48px',
42
+ xl: '64px',
43
+ '2xl': '96px',
44
+ '3xl': '128px',
45
+ },
46
+ },
47
+ }
48
+
49
+ const mclHeading = ({ addComponents, theme }) => {
50
+ addComponents({
51
+ body: {
52
+ // default font size
53
+ fontSize: '1rem',
54
+ lineHeight: '1.5',
55
+ },
56
+ h1: {
57
+ // default medium size
58
+ fontSize: '30px',
59
+ fontWeight: 'bold',
60
+ lineHeight: '1.2',
61
+ '@screen md': { fontSize: '30px' },
62
+ '@screen lg': { fontSize: '48px' },
63
+ },
64
+ '.h1-sm': {
65
+ fontSize: '24px',
66
+ fontWeight: 'bold',
67
+ lineHeight: '1.2',
68
+ '@screen md': { fontSize: '24px' },
69
+ '@screen lg': { fontSize: '36px' },
70
+ },
71
+ '.h1-md': {
72
+ fontSize: '30px',
73
+ fontWeight: 'bold',
74
+ lineHeight: '1.2',
75
+ '@screen md': { fontSize: '30px' },
76
+ '@screen lg': { fontSize: '48px' },
77
+ },
78
+ '.h1-lg': {
79
+ fontSize: '36px',
80
+ fontWeight: 'bold',
81
+ lineHeight: '1.2',
82
+ '@screen md': { fontSize: '36px' },
83
+ '@screen lg': { fontSize: '56px' },
84
+ },
85
+ '.h1-xl': {
86
+ fontSize: '56px',
87
+ fontWeight: 'bold',
88
+ lineHeight: '1.2',
89
+ '@screen md': { fontSize: '56px' },
90
+ '@screen lg': { fontSize: '72px' },
91
+ },
92
+ h2: {
93
+ // default medium size
94
+ fontSize: '24px',
95
+ fontWeight: 'bold',
96
+ lineHeight: '1.2',
97
+ '@screen md': { fontSize: '24px' },
98
+ '@screen lg': { fontSize: '36px' },
99
+ },
100
+ '.h2-sm': {
101
+ fontSize: '18px',
102
+ fontWeight: 'bold',
103
+ lineHeight: '1.2',
104
+ '@screen md': { fontSize: '18px' },
105
+ '@screen lg': { fontSize: '24px' },
106
+ },
107
+ '.h2-md': {
108
+ fontSize: '24px',
109
+ fontWeight: 'bold',
110
+ lineHeight: '1.2',
111
+ '@screen md': { fontSize: '24px' },
112
+ '@screen lg': { fontSize: '36px' },
113
+ },
114
+ '.h2-lg': {
115
+ fontSize: '30px',
116
+ fontWeight: 'bold',
117
+ lineHeight: '1.2',
118
+ '@screen md': { fontSize: '30px' },
119
+ '@screen lg': { fontSize: '48px' },
120
+ },
121
+ '.h2-xl': {
122
+ fontSize: '48px',
123
+ fontWeight: 'bold',
124
+ lineHeight: '1.2',
125
+ '@screen md': { fontSize: '48px' },
126
+ '@screen lg': { fontSize: '60px' },
127
+ },
128
+ h3: {
129
+ // default medium size
130
+ fontSize: '18px',
131
+ fontWeight: 'bold',
132
+ lineHeight: '1.2',
133
+ '@screen md': { fontSize: '18px' },
134
+ '@screen lg': { fontSize: '20px' },
135
+ },
136
+ '.h3-sm': {
137
+ fontSize: '16px',
138
+ fontWeight: 'bold',
139
+ lineHeight: '1.2',
140
+ '@screen md': { fontSize: '16px' },
141
+ '@screen lg': { fontSize: '16px' },
142
+ },
143
+ '.h3-md': {
144
+ fontSize: '18px',
145
+ fontWeight: 'bold',
146
+ lineHeight: '1.2',
147
+ '@screen md': { fontSize: '18px' },
148
+ '@screen lg': { fontSize: '20px' },
149
+ },
150
+ '.h3-lg': {
151
+ fontSize: '18px',
152
+ fontWeight: 'bold',
153
+ lineHeight: '1.2',
154
+ '@screen md': { fontSize: '18px' },
155
+ '@screen lg': { fontSize: '24px' },
156
+ },
157
+ '.h3-xl': {
158
+ fontSize: '30px',
159
+ fontWeight: 'bold',
160
+ lineHeight: '1.2',
161
+ '@screen md': { fontSize: '30px' },
162
+ '@screen lg': { fontSize: '36px' },
163
+ },
164
+ h4: {
165
+ // default medium size
166
+ fontSize: '16px',
167
+ fontWeight: 'bold',
168
+ lineHeight: '1.2',
169
+ '@screen md': { fontSize: '16px' },
170
+ '@screen lg': { fontSize: '18px' },
171
+ },
172
+ 'h4-sm': {
173
+ fontSize: '14px',
174
+ fontWeight: 'bold',
175
+ lineHeight: '1.2',
176
+ '@screen md': { fontSize: '14px' },
177
+ '@screen lg': { fontSize: '16px' },
178
+ },
179
+ 'h4-md': {
180
+ fontSize: '16px',
181
+ fontWeight: 'bold',
182
+ lineHeight: '1.2',
183
+ '@screen md': { fontSize: '16px' },
184
+ '@screen lg': { fontSize: '18px' },
185
+ },
186
+ 'h4-lg': {
187
+ fontSize: '16px',
188
+ fontWeight: 'bold',
189
+ lineHeight: '1.2',
190
+ '@screen md': { fontSize: '16px' },
191
+ '@screen lg': { fontSize: '20px' },
192
+ },
193
+ 'h4-xl': {
194
+ fontSize: '24px',
195
+ fontWeight: 'bold',
196
+ lineHeight: '1.2',
197
+ '@screen md': { fontSize: '24px' },
198
+ '@screen lg': { fontSize: '30px' },
199
+ },
200
+ '.mcl-link': {
201
+ color: theme('colors.primary'),
202
+ textDecoration: 'underline',
203
+ },
204
+ })
205
+ }
206
+
207
+ module.exports = {
208
+ mclTheme: mclTheme,
209
+ mclHeading: mclHeading,
210
+ }