@julseb-lib/react 0.0.88 → 0.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +639 -639
- package/dist/index.es.js +3247 -2717
- package/dist/index.umd.js +586 -586
- package/dist/lib/Mixins.tsx +970 -970
- package/dist/lib/components/Image/Image.tsx +77 -73
- package/dist/lib/components/Image/ImageFunction.tsx +39 -37
- package/dist/lib/components/Timepicker/Timepicker.tsx +234 -235
- package/dist/lib/components/Youtube/types.ts +5 -4
- package/dist/lib/index.ts +56 -55
- package/dist/lib/types/global.ts +129 -128
- package/dist/lib/types/index.ts +0 -1
- package/license.md +21 -0
- package/package.json +1 -1
- /package/dist/lib/{types/design-tokens.ts → design-tokens.ts} +0 -0
package/dist/lib/Mixins.tsx
CHANGED
|
@@ -3,988 +3,988 @@ import type { Property } from "csstype"
|
|
|
3
3
|
import { stringifyPx } from "@julseb-lib/utils"
|
|
4
4
|
import { overlaysMap } from "./lib-utils"
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
COLORS_LIGHT,
|
|
7
|
+
COLORS_DARK,
|
|
8
|
+
RADIUSES,
|
|
9
|
+
SHADOWS,
|
|
10
|
+
SPACERS,
|
|
11
|
+
TRANSITIONS,
|
|
12
|
+
FONT_SIZES,
|
|
13
|
+
FONT_WEIGHTS,
|
|
14
14
|
} from "./Variables"
|
|
15
|
+
import { designTokens } from "./design-tokens"
|
|
15
16
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
type LibPositionExtract,
|
|
17
|
+
type LibAllColors,
|
|
18
|
+
type LibColorsShort,
|
|
19
|
+
type LibColorsHover,
|
|
20
|
+
type LibOverlays,
|
|
21
|
+
type ILibRadius,
|
|
22
|
+
type LibShadows,
|
|
23
|
+
type ILibBoxShadow,
|
|
24
|
+
type LibSpacers,
|
|
25
|
+
type ILibPadding,
|
|
26
|
+
type LibTransitions,
|
|
27
|
+
type LibRadiuses,
|
|
28
|
+
type CssJustifyItems,
|
|
29
|
+
type CssAlignItems,
|
|
30
|
+
type CssJustifyContent,
|
|
31
|
+
type CssAlignContent,
|
|
32
|
+
type CssFlexDirection,
|
|
33
|
+
type CssFlexWrap,
|
|
34
|
+
type LibFontSizes,
|
|
35
|
+
type LibFontWeights,
|
|
36
|
+
type ILibMargin,
|
|
37
|
+
type ILibBorder,
|
|
38
|
+
type LibAllColorsAndOverlays,
|
|
39
|
+
type ILibOutline,
|
|
40
|
+
type LibColorsHoverAndCurrent,
|
|
41
|
+
type LibThemeNames,
|
|
42
|
+
type LibPositionExtract,
|
|
43
43
|
} from "./types"
|
|
44
44
|
|
|
45
45
|
type ILibIconMixin = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
$name: string
|
|
47
|
+
$color?: LibAllColors
|
|
48
|
+
$size?: number
|
|
49
|
+
$isLibIcon?: boolean
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const getColorMixinFromTheme = (
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
54
|
+
themeName?: LibThemeNames
|
|
55
55
|
) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
56
|
+
let THEME: DefaultTheme
|
|
57
|
+
|
|
58
|
+
if (themeName) {
|
|
59
|
+
THEME = (
|
|
60
|
+
themeName === "dark" ? COLORS_DARK : COLORS_LIGHT
|
|
61
|
+
) as DefaultTheme
|
|
62
|
+
} else if (theme === null) {
|
|
63
|
+
THEME = COLORS_LIGHT
|
|
64
|
+
} else {
|
|
65
|
+
THEME = theme
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const colorsShortMap = new Map<LibColorsShort, keyof typeof THEME>([
|
|
69
|
+
["primary", "PRIMARY_500"],
|
|
70
|
+
["secondary", "SECONDARY_500"],
|
|
71
|
+
["success", "SUCCESS_500"],
|
|
72
|
+
["danger", "DANGER_500"],
|
|
73
|
+
["warning", "WARNING_500"],
|
|
74
|
+
["gray", "GRAY_500"],
|
|
75
|
+
["black", "BLACK"],
|
|
76
|
+
["white", "WHITE"],
|
|
77
|
+
])
|
|
78
|
+
|
|
79
|
+
const allColorsMap = new Map<LibAllColors, keyof typeof THEME>([
|
|
80
|
+
...Array.from(colorsShortMap.entries()),
|
|
81
|
+
["gray-50", "GRAY_50"],
|
|
82
|
+
["gray-100", "GRAY_100"],
|
|
83
|
+
["gray-200", "GRAY_200"],
|
|
84
|
+
["gray-300", "GRAY_300"],
|
|
85
|
+
["gray-400", "GRAY_400"],
|
|
86
|
+
["gray-500", "GRAY_500"],
|
|
87
|
+
["gray-600", "GRAY_600"],
|
|
88
|
+
["gray-700", "GRAY_700"],
|
|
89
|
+
["gray-800", "GRAY_800"],
|
|
90
|
+
["gray-900", "GRAY_900"],
|
|
91
|
+
["primary-50", "PRIMARY_50"],
|
|
92
|
+
["primary-100", "PRIMARY_100"],
|
|
93
|
+
["primary-200", "PRIMARY_200"],
|
|
94
|
+
["primary-300", "PRIMARY_300"],
|
|
95
|
+
["primary-400", "PRIMARY_400"],
|
|
96
|
+
["primary-500", "PRIMARY_500"],
|
|
97
|
+
["primary-600", "PRIMARY_600"],
|
|
98
|
+
["primary-700", "PRIMARY_700"],
|
|
99
|
+
["primary-800", "PRIMARY_800"],
|
|
100
|
+
["primary-900", "PRIMARY_900"],
|
|
101
|
+
["secondary-50", "SECONDARY_50"],
|
|
102
|
+
["secondary-100", "SECONDARY_100"],
|
|
103
|
+
["secondary-200", "SECONDARY_200"],
|
|
104
|
+
["secondary-300", "SECONDARY_300"],
|
|
105
|
+
["secondary-400", "SECONDARY_400"],
|
|
106
|
+
["secondary-500", "SECONDARY_500"],
|
|
107
|
+
["secondary-600", "SECONDARY_600"],
|
|
108
|
+
["secondary-700", "SECONDARY_700"],
|
|
109
|
+
["secondary-800", "SECONDARY_800"],
|
|
110
|
+
["secondary-900", "SECONDARY_900"],
|
|
111
|
+
["success-50", "SUCCESS_50"],
|
|
112
|
+
["success-100", "SUCCESS_100"],
|
|
113
|
+
["success-200", "SUCCESS_200"],
|
|
114
|
+
["success-300", "SUCCESS_300"],
|
|
115
|
+
["success-400", "SUCCESS_400"],
|
|
116
|
+
["success-500", "SUCCESS_500"],
|
|
117
|
+
["success-600", "SUCCESS_600"],
|
|
118
|
+
["success-700", "SUCCESS_700"],
|
|
119
|
+
["success-800", "SUCCESS_800"],
|
|
120
|
+
["success-900", "SUCCESS_900"],
|
|
121
|
+
["danger-50", "DANGER_50"],
|
|
122
|
+
["danger-100", "DANGER_100"],
|
|
123
|
+
["danger-200", "DANGER_200"],
|
|
124
|
+
["danger-300", "DANGER_300"],
|
|
125
|
+
["danger-400", "DANGER_400"],
|
|
126
|
+
["danger-500", "DANGER_500"],
|
|
127
|
+
["danger-600", "DANGER_600"],
|
|
128
|
+
["danger-700", "DANGER_700"],
|
|
129
|
+
["danger-800", "DANGER_800"],
|
|
130
|
+
["danger-900", "DANGER_900"],
|
|
131
|
+
["warning-50", "WARNING_50"],
|
|
132
|
+
["warning-100", "WARNING_100"],
|
|
133
|
+
["warning-200", "WARNING_200"],
|
|
134
|
+
["warning-300", "WARNING_300"],
|
|
135
|
+
["warning-400", "WARNING_400"],
|
|
136
|
+
["warning-500", "WARNING_500"],
|
|
137
|
+
["warning-600", "WARNING_600"],
|
|
138
|
+
["warning-700", "WARNING_700"],
|
|
139
|
+
["warning-800", "WARNING_800"],
|
|
140
|
+
["warning-900", "WARNING_900"],
|
|
141
|
+
["background", "BACKGROUND"],
|
|
142
|
+
["font", "FONT"],
|
|
143
|
+
["currentColor", "CURRENT_COLOR"],
|
|
144
|
+
["transparent", "TRANSPARENT"],
|
|
145
|
+
])
|
|
146
|
+
|
|
147
|
+
const ColorsShort = ($color: LibColorsShort = "primary") =>
|
|
148
|
+
THEME[colorsShortMap.get($color) as keyof typeof THEME]
|
|
149
|
+
|
|
150
|
+
const AllColors = ($color: LibAllColors) =>
|
|
151
|
+
THEME[allColorsMap.get($color) as keyof typeof THEME]
|
|
152
|
+
|
|
153
|
+
const ColorsAndOverlays = ($color: LibAllColorsAndOverlays | undefined) => {
|
|
154
|
+
if (!$color) return null as any
|
|
155
|
+
|
|
156
|
+
const overlayColors = Object.keys(
|
|
157
|
+
designTokens.overlays
|
|
158
|
+
) as Array<LibOverlays>
|
|
159
|
+
|
|
160
|
+
if (overlayColors.find(c => c === $color)) {
|
|
161
|
+
return Mixins.Overlay($color as LibOverlays)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return Mixins.AllColors($color as LibAllColors, theme, themeName)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const ColorsHoverDefault = (
|
|
168
|
+
$color: LibColorsHoverAndCurrent = "primary"
|
|
169
|
+
) => {
|
|
170
|
+
if ($color === "currentColor") return "currentColor"
|
|
171
|
+
|
|
172
|
+
// @ts-ignore
|
|
173
|
+
const colorsMap = new Map<LibColorsHover, keyof typeof THEME>([
|
|
174
|
+
["primary", THEME.PRIMARY_500],
|
|
175
|
+
["secondary", THEME.SECONDARY_500],
|
|
176
|
+
["success", THEME.SUCCESS_500],
|
|
177
|
+
["danger", THEME.DANGER_500],
|
|
178
|
+
["warning", THEME.WARNING_500],
|
|
179
|
+
["white", THEME.WHITE],
|
|
180
|
+
["gray", THEME.GRAY_500],
|
|
181
|
+
["font", THEME.LINK_FONT_DEFAULT],
|
|
182
|
+
["background", THEME.LINK_BACKGROUND_DEFAULT],
|
|
183
|
+
])
|
|
184
|
+
|
|
185
|
+
return colorsMap.get($color)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const ColorsHoverHover = ($color: LibColorsHoverAndCurrent = "primary") => {
|
|
189
|
+
if ($color === "currentColor") return "currentColor"
|
|
190
|
+
|
|
191
|
+
// @ts-ignore
|
|
192
|
+
const colorsMap = new Map<LibColorsHover, keyof typeof THEME>([
|
|
193
|
+
["primary", THEME.PRIMARY_300],
|
|
194
|
+
["secondary", THEME.SECONDARY_300],
|
|
195
|
+
["success", THEME.SUCCESS_300],
|
|
196
|
+
["danger", THEME.DANGER_300],
|
|
197
|
+
["warning", THEME.WARNING_300],
|
|
198
|
+
["white", THEME.GRAY_300],
|
|
199
|
+
["gray", THEME.GRAY_300],
|
|
200
|
+
["font", THEME.LINK_FONT_HOVER],
|
|
201
|
+
["background", THEME.LINK_BACKGROUND_HOVER],
|
|
202
|
+
])
|
|
203
|
+
|
|
204
|
+
return colorsMap.get($color)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const ColorsHoverActive = (
|
|
208
|
+
$color: LibColorsHoverAndCurrent = "primary"
|
|
209
|
+
) => {
|
|
210
|
+
if ($color === "currentColor") return "currentColor"
|
|
211
|
+
// @ts-ignore
|
|
212
|
+
const colorsMap = new Map<LibColorsHover, keyof typeof THEME>([
|
|
213
|
+
["primary", THEME.PRIMARY_600],
|
|
214
|
+
["secondary", THEME.SECONDARY_600],
|
|
215
|
+
["success", THEME.SUCCESS_600],
|
|
216
|
+
["danger", THEME.DANGER_600],
|
|
217
|
+
["warning", THEME.WARNING_600],
|
|
218
|
+
["white", THEME.GRAY_100],
|
|
219
|
+
["gray", THEME.GRAY_600],
|
|
220
|
+
["font", THEME.LINK_FONT_ACTIVE],
|
|
221
|
+
["background", THEME.LINK_BACKGROUND_ACTIVE],
|
|
222
|
+
])
|
|
223
|
+
|
|
224
|
+
return colorsMap.get($color)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const ColorsGhostDefault = (
|
|
228
|
+
$color: LibColorsHoverAndCurrent = "primary"
|
|
229
|
+
) => {
|
|
230
|
+
if ($color === "currentColor") return "currentColor"
|
|
231
|
+
|
|
232
|
+
// @ts-ignore
|
|
233
|
+
const colorsMap = new Map<LibColorsHover, keyof typeof THEME>([
|
|
234
|
+
["primary", THEME.PRIMARY_50],
|
|
235
|
+
["secondary", THEME.SECONDARY_50],
|
|
236
|
+
["success", THEME.SUCCESS_50],
|
|
237
|
+
["danger", THEME.DANGER_50],
|
|
238
|
+
["warning", THEME.WARNING_50],
|
|
239
|
+
["white", THEME.GRAY_50],
|
|
240
|
+
["gray", THEME.GRAY_50],
|
|
241
|
+
["font", THEME.FONT_GHOST_DEFAULT],
|
|
242
|
+
["background", THEME.BACKGROUND_GHOST_DEFAULT],
|
|
243
|
+
])
|
|
244
|
+
|
|
245
|
+
return colorsMap.get($color)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const ColorsGhostHover = ($color: LibColorsHoverAndCurrent = "primary") => {
|
|
249
|
+
if ($color === "currentColor") return "currentColor"
|
|
250
|
+
|
|
251
|
+
// @ts-ignore
|
|
252
|
+
const colorsMap = new Map<LibColorsHover, keyof typeof THEME>([
|
|
253
|
+
["primary", THEME.PRIMARY_200],
|
|
254
|
+
["secondary", THEME.SECONDARY_200],
|
|
255
|
+
["success", THEME.SUCCESS_200],
|
|
256
|
+
["danger", THEME.DANGER_200],
|
|
257
|
+
["warning", THEME.WARNING_200],
|
|
258
|
+
["white", THEME.GRAY_200],
|
|
259
|
+
["gray", THEME.GRAY_200],
|
|
260
|
+
["font", THEME.FONT_GHOST_HOVER],
|
|
261
|
+
["background", THEME.BACKGROUND_GHOST_HOVER],
|
|
262
|
+
])
|
|
263
|
+
|
|
264
|
+
return colorsMap.get($color)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const ColorsGhostActive = (
|
|
268
|
+
$color: LibColorsHoverAndCurrent = "primary"
|
|
269
|
+
) => {
|
|
270
|
+
if ($color === "currentColor") return "currentColor"
|
|
271
|
+
|
|
272
|
+
// @ts-ignore
|
|
273
|
+
const colorsMap = new Map<LibColorsHover, keyof typeof THEME>([
|
|
274
|
+
["primary", THEME.PRIMARY_100],
|
|
275
|
+
["secondary", THEME.SECONDARY_100],
|
|
276
|
+
["success", THEME.SUCCESS_100],
|
|
277
|
+
["danger", THEME.DANGER_100],
|
|
278
|
+
["warning", THEME.WARNING_100],
|
|
279
|
+
["white", THEME.GRAY_100],
|
|
280
|
+
["gray", THEME.GRAY_100],
|
|
281
|
+
["font", THEME.FONT_GHOST_ACTIVE],
|
|
282
|
+
["background", THEME.BACKGROUND_GHOST_ACTIVE],
|
|
283
|
+
])
|
|
284
|
+
|
|
285
|
+
return colorsMap.get($color)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const Colors50 = (
|
|
289
|
+
$color: Exclude<LibColorsShort, "black" | "white"> = "primary"
|
|
290
|
+
) => {
|
|
291
|
+
// @ts-ignore
|
|
292
|
+
const colorsMap = new Map<LibColorsShort, keyof typeof THEME>([
|
|
293
|
+
["primary", THEME.PRIMARY_50],
|
|
294
|
+
["secondary", THEME.SECONDARY_50],
|
|
295
|
+
["success", THEME.SUCCESS_50],
|
|
296
|
+
["danger", THEME.DANGER_50],
|
|
297
|
+
["warning", THEME.WARNING_50],
|
|
298
|
+
["gray", THEME.GRAY_50],
|
|
299
|
+
])
|
|
300
|
+
|
|
301
|
+
return colorsMap.get($color)
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return {
|
|
305
|
+
ColorsShort,
|
|
306
|
+
AllColors,
|
|
307
|
+
ColorsAndOverlays,
|
|
308
|
+
ColorsHoverDefault,
|
|
309
|
+
ColorsHoverHover,
|
|
310
|
+
ColorsHoverActive,
|
|
311
|
+
ColorsGhostDefault,
|
|
312
|
+
ColorsGhostHover,
|
|
313
|
+
ColorsGhostActive,
|
|
314
|
+
Colors50,
|
|
315
|
+
}
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
class mixins {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
319
|
+
/**
|
|
320
|
+
* @description Returns any color from the library
|
|
321
|
+
* @param $color: Any color from the library
|
|
322
|
+
* @param theme?: Default theme
|
|
323
|
+
* @param themeName?: "light" | "dark"
|
|
324
|
+
* @example background-color: ${({ theme }) => Mixins.AllColors("primary", theme)}
|
|
325
|
+
*/
|
|
326
|
+
AllColors = (
|
|
327
|
+
$color: LibAllColors,
|
|
328
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
329
|
+
themeName?: LibThemeNames
|
|
330
|
+
) => getColorMixinFromTheme(theme, themeName).AllColors($color)
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @description Returns a color by short name
|
|
334
|
+
* @param $color: "primary" | "secondary" | "success" | "danger" | "warning" | "gray" | "black" | "white"
|
|
335
|
+
* @param theme?: Default theme
|
|
336
|
+
* @param themeName?: "light" | "dark"
|
|
337
|
+
* @example background-color: ${({ theme }) => Mixins.ColorsShort("secondary", theme)}
|
|
338
|
+
*/
|
|
339
|
+
ColorsShort = (
|
|
340
|
+
$color: LibColorsShort,
|
|
341
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
342
|
+
themeName?: LibThemeNames
|
|
343
|
+
) => getColorMixinFromTheme(theme, themeName).ColorsShort($color)
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* @description Returns any color or overlay from the library
|
|
347
|
+
* @param $color: Any color or overlay from the library
|
|
348
|
+
* @param theme?: Default theme
|
|
349
|
+
* @param themeName?: "light" | "dark"
|
|
350
|
+
* @example background-color: ${({ theme }) => Mixins.ColorsAndOverlays("gray-200", theme)}
|
|
351
|
+
*/
|
|
352
|
+
ColorsAndOverlays = (
|
|
353
|
+
$color: LibAllColorsAndOverlays | undefined,
|
|
354
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
355
|
+
themeName?: LibThemeNames
|
|
356
|
+
) => getColorMixinFromTheme(theme, themeName).ColorsAndOverlays($color)
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @description Returns a color for components changing on hover, default state
|
|
360
|
+
* @param $color: "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "gray" | "font" | "background" | "currentColor"
|
|
361
|
+
* @param theme?: Default theme
|
|
362
|
+
* @param themeName?: "light" | "dark"
|
|
363
|
+
* @example background-color: ${({ theme }) => Mixins.ColorsHoverDefault("success", theme)}
|
|
364
|
+
*/
|
|
365
|
+
ColorsHoverDefault = (
|
|
366
|
+
$color: LibColorsHoverAndCurrent,
|
|
367
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
368
|
+
themeName?: LibThemeNames
|
|
369
|
+
) => getColorMixinFromTheme(theme, themeName).ColorsHoverDefault($color)
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* @description Returns a color for components changing on hover, hover state
|
|
373
|
+
* @param $color: "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "gray" | "font" | "background" | "currentColor"
|
|
374
|
+
* @param theme?: Default theme
|
|
375
|
+
* @param themeName?: "light" | "dark"
|
|
376
|
+
* @example background-color: ${({ theme }) => Mixins.ColorsHoverHover("success", theme)}
|
|
377
|
+
*/
|
|
378
|
+
ColorsHoverHover = (
|
|
379
|
+
$color: LibColorsHoverAndCurrent,
|
|
380
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
381
|
+
themeName?: LibThemeNames
|
|
382
|
+
) => getColorMixinFromTheme(theme, themeName).ColorsHoverHover($color)
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* @description Returns a color for components changing on hover, active state
|
|
386
|
+
* @param $color: "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "gray" | "font" | "background" | "currentColor"
|
|
387
|
+
* @param theme?: Default theme
|
|
388
|
+
* @param themeName?: "light" | "dark"
|
|
389
|
+
* @example background-color: ${({ theme }) => Mixins.ColorsHoverActive("success", theme)}
|
|
390
|
+
*/
|
|
391
|
+
ColorsHoverActive = (
|
|
392
|
+
$color: LibColorsHoverAndCurrent,
|
|
393
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
394
|
+
themeName?: LibThemeNames
|
|
395
|
+
) => getColorMixinFromTheme(theme, themeName).ColorsHoverActive($color)
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* @description Returns a color for components changing on hover with ghost colors, default state
|
|
399
|
+
* @param $color: "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "gray" | "font" | "background" | "currentColor"
|
|
400
|
+
* @param theme?: Default theme
|
|
401
|
+
* @param themeName?: "light" | "dark"
|
|
402
|
+
* @example background-color: ${({ theme }) => Mixins.ColorsGhostDefault("danger", theme)}
|
|
403
|
+
*/
|
|
404
|
+
ColorsGhostDefault = (
|
|
405
|
+
$color: LibColorsHoverAndCurrent,
|
|
406
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
407
|
+
themeName?: LibThemeNames
|
|
408
|
+
) => getColorMixinFromTheme(theme, themeName).ColorsGhostDefault($color)
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* @description Returns a color for components changing on hover with ghost colors, hover state
|
|
412
|
+
* @param $color: "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "gray" | "font" | "background" | "currentColor"
|
|
413
|
+
* @param theme?: Default theme
|
|
414
|
+
* @param themeName?: "light" | "dark"
|
|
415
|
+
* @example background-color: ${({ theme }) => Mixins.ColorsGhostHover("danger", theme)}
|
|
416
|
+
*/
|
|
417
|
+
ColorsGhostHover = (
|
|
418
|
+
$color: LibColorsHoverAndCurrent,
|
|
419
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
420
|
+
themeName?: LibThemeNames
|
|
421
|
+
) => getColorMixinFromTheme(theme, themeName).ColorsGhostHover($color)
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* @description Returns a color for components changing on hover with ghost colors, active state
|
|
425
|
+
* @param $color: "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "gray" | "font" | "background" | "currentColor"
|
|
426
|
+
* @param theme?: Default theme
|
|
427
|
+
* @param themeName?: "light" | "dark"
|
|
428
|
+
* @example background-color: ${({ theme }) => Mixins.ColorsGhostActive("danger", theme)}
|
|
429
|
+
*/
|
|
430
|
+
ColorsGhostActive = (
|
|
431
|
+
$color: LibColorsHoverAndCurrent,
|
|
432
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
433
|
+
themeName?: LibThemeNames
|
|
434
|
+
) => getColorMixinFromTheme(theme, themeName).ColorsGhostActive($color)
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* @description Returns one of the colors 50
|
|
438
|
+
* @param $color: "primary" | "secondary" | "success" | "danger" | "warning" | "gray"
|
|
439
|
+
* @param theme?: Default theme
|
|
440
|
+
* @param themeName?: "light" | "dark"
|
|
441
|
+
* @example background-color: ${({ theme }) => Mixins.Colors50("secondary", theme)}
|
|
442
|
+
*/
|
|
443
|
+
Colors50 = (
|
|
444
|
+
$color: Exclude<LibColorsShort, "black" | "white">,
|
|
445
|
+
theme: DefaultTheme | null = COLORS_LIGHT,
|
|
446
|
+
themeName?: LibThemeNames
|
|
447
|
+
) => getColorMixinFromTheme(theme, themeName).Colors50($color)
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* @description Returns an icon mixin component
|
|
451
|
+
* @prop $name: string
|
|
452
|
+
* @prop $color?: Any color from the library
|
|
453
|
+
* @prop $size?: number
|
|
454
|
+
*/
|
|
455
|
+
Icon = ({
|
|
456
|
+
$name,
|
|
457
|
+
$color = "currentColor",
|
|
458
|
+
$size = 16,
|
|
459
|
+
$isLibIcon,
|
|
460
|
+
}: ILibIconMixin) => {
|
|
461
|
+
const iconURL = $isLibIcon ? $name : `/icons/${$name}.svg`
|
|
462
|
+
|
|
463
|
+
return css`
|
|
464
|
+
content: "";
|
|
465
|
+
background-color: ${({ theme }) => Mixins.AllColors($color, theme)};
|
|
466
|
+
-webkit-mask-image: url(${iconURL});
|
|
467
|
+
-webkit-mask-size: cover;
|
|
468
|
+
mask-image: url(${$isLibIcon ? $name : `/icons/${$name}.svg`});
|
|
469
|
+
mask-size: cover;
|
|
470
|
+
width: ${$size}px;
|
|
471
|
+
height: ${$size}px;
|
|
472
|
+
display: inline-block;
|
|
473
|
+
`
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* @description Returns an overlay from the library
|
|
478
|
+
* @param $overlay?: "black-50" | "black-80" | "white-50" | "white-80" | "gradient-black" | "gradient-white"
|
|
479
|
+
*/
|
|
480
|
+
Overlay = ($overlay: LibOverlays | undefined) => {
|
|
481
|
+
if (!$overlay) return null
|
|
482
|
+
|
|
483
|
+
return overlaysMap.get($overlay)
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* @description Returns a border radius with the radiuses from the library
|
|
488
|
+
* @param $borderRadius: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "round" | "circle" | number | { topLeft?: LibRadiuses; topRight?: LibRadiuses; bottomLeft?: LibRadiuses; bottomRight?: LibRadiuses }
|
|
489
|
+
*/
|
|
490
|
+
BorderRadius = ($borderRadius: ILibRadius | undefined) => {
|
|
491
|
+
if (!$borderRadius) return null
|
|
492
|
+
|
|
493
|
+
const radiusMap = new Map<ILibRadius, RADIUSES>([
|
|
494
|
+
["xxl", RADIUSES.XXL],
|
|
495
|
+
["xl", RADIUSES.XL],
|
|
496
|
+
["l", RADIUSES.L],
|
|
497
|
+
["m", RADIUSES.M],
|
|
498
|
+
["s", RADIUSES.S],
|
|
499
|
+
["xs", RADIUSES.XS],
|
|
500
|
+
["round", RADIUSES.ROUND],
|
|
501
|
+
["circle", RADIUSES.CIRCLE],
|
|
502
|
+
])
|
|
503
|
+
|
|
504
|
+
const getRadius = ($radius: LibRadiuses) =>
|
|
505
|
+
typeof $radius === "number"
|
|
506
|
+
? stringifyPx($radius)
|
|
507
|
+
: radiusMap.get($radius)
|
|
508
|
+
|
|
509
|
+
if (
|
|
510
|
+
typeof $borderRadius === "number" ||
|
|
511
|
+
typeof $borderRadius === "string"
|
|
512
|
+
)
|
|
513
|
+
return css`
|
|
514
|
+
border-radius: ${getRadius($borderRadius)};
|
|
515
|
+
`
|
|
516
|
+
|
|
517
|
+
const { topLeft, topRight, bottomLeft, bottomRight } = $borderRadius
|
|
518
|
+
|
|
519
|
+
return css`
|
|
520
|
+
border-top-left-radius: ${topLeft && getRadius(topLeft)};
|
|
521
|
+
border-top-right-radius: ${topRight && getRadius(topRight)};
|
|
522
|
+
border-bottom-left-radius: ${bottomLeft && getRadius(bottomLeft)};
|
|
523
|
+
border-bottom-right-radius: ${bottomRight &&
|
|
524
|
+
getRadius(bottomRight)};
|
|
525
|
+
`
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* @description Returns a transition from the library
|
|
530
|
+
* @param $transition: "short" | "long" | "bezier"
|
|
531
|
+
*/
|
|
532
|
+
Transition = ($transition: LibTransitions | undefined) => {
|
|
533
|
+
if (!$transition) return null
|
|
534
|
+
|
|
535
|
+
const transitionsMap = new Map<LibTransitions, TRANSITIONS>([
|
|
536
|
+
["short", TRANSITIONS.SHORT],
|
|
537
|
+
["long", TRANSITIONS.LONG],
|
|
538
|
+
["bezier", TRANSITIONS.BEZIER],
|
|
539
|
+
])
|
|
540
|
+
|
|
541
|
+
return transitionsMap.get($transition)
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* @description Returns a shadow from the library
|
|
546
|
+
* @param $shadow "xxl" | "xl" | "l" | "m" | "s" | "xs"
|
|
547
|
+
*/
|
|
548
|
+
Shadow = ($shadow: LibShadows | undefined) => {
|
|
549
|
+
if (!$shadow) return null
|
|
550
|
+
|
|
551
|
+
const shadowMap = new Map<LibShadows, SHADOWS>([
|
|
552
|
+
["xxl", SHADOWS.XXL],
|
|
553
|
+
["xl", SHADOWS.XL],
|
|
554
|
+
["l", SHADOWS.L],
|
|
555
|
+
["m", SHADOWS.M],
|
|
556
|
+
["s", SHADOWS.S],
|
|
557
|
+
["xs", SHADOWS.XS],
|
|
558
|
+
])
|
|
559
|
+
|
|
560
|
+
return shadowMap.get($shadow)
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* @description Returns a box shadow
|
|
565
|
+
* @param $boxShadow "xxl" | "xl" | "l" | "m" | "s" | "xs" | { default: LibShadows; hover: LibShadows; active: LibShadows }
|
|
566
|
+
*/
|
|
567
|
+
BoxShadow = ($boxShadow?: ILibBoxShadow) => {
|
|
568
|
+
if (!$boxShadow) return null
|
|
569
|
+
|
|
570
|
+
if (typeof $boxShadow === "string")
|
|
571
|
+
return css`
|
|
572
|
+
box-shadow: ${Mixins.Shadow($boxShadow)};
|
|
573
|
+
`
|
|
574
|
+
|
|
575
|
+
return css`
|
|
576
|
+
box-shadow: ${Mixins.Shadow($boxShadow.default)};
|
|
577
|
+
|
|
578
|
+
&:hover {
|
|
579
|
+
box-shadow: ${Mixins.Shadow($boxShadow.hover)};
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
&:active {
|
|
583
|
+
box-shadow: ${Mixins.Shadow($boxShadow.active)};
|
|
584
|
+
}
|
|
585
|
+
`
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* @description Returns a font size from the library
|
|
590
|
+
* @param $fontSize "display-h1" | "display-h2" | "display-h3" | "display-h4" | "display-h5" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body" | "small" | "inherit" | number
|
|
591
|
+
*/
|
|
592
|
+
FontSize = (
|
|
593
|
+
$fontSize: LibFontSizes | "inherit" | number | undefined = "body"
|
|
594
|
+
) => {
|
|
595
|
+
if (!$fontSize) return null
|
|
596
|
+
|
|
597
|
+
if (typeof $fontSize === "number") return stringifyPx($fontSize)
|
|
598
|
+
|
|
599
|
+
const fontSizesMap = new Map<
|
|
600
|
+
LibFontSizes | "inherit",
|
|
601
|
+
FONT_SIZES | "inherit"
|
|
602
|
+
>([
|
|
603
|
+
["display-h1", FONT_SIZES.DISPLAY_H1],
|
|
604
|
+
["display-h2", FONT_SIZES.DISPLAY_H2],
|
|
605
|
+
["display-h3", FONT_SIZES.DISPLAY_H3],
|
|
606
|
+
["display-h4", FONT_SIZES.DISPLAY_H4],
|
|
607
|
+
["display-h5", FONT_SIZES.DISPLAY_H5],
|
|
608
|
+
["h1", FONT_SIZES.H1],
|
|
609
|
+
["h2", FONT_SIZES.H2],
|
|
610
|
+
["h3", FONT_SIZES.H3],
|
|
611
|
+
["h4", FONT_SIZES.H4],
|
|
612
|
+
["h5", FONT_SIZES.H5],
|
|
613
|
+
["h6", FONT_SIZES.H6],
|
|
614
|
+
["body", FONT_SIZES.BODY],
|
|
615
|
+
["small", FONT_SIZES.SMALL],
|
|
616
|
+
["inherit", "inherit"],
|
|
617
|
+
])
|
|
618
|
+
|
|
619
|
+
return fontSizesMap.get($fontSize)
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* @description Returns a font weight from the library
|
|
624
|
+
* @param $fontWeight: "regular" | "bold" | "black"
|
|
625
|
+
*/
|
|
626
|
+
FontWeight = ($fontWeight: LibFontWeights = "regular") => {
|
|
627
|
+
if (!$fontWeight) return null
|
|
628
|
+
|
|
629
|
+
const fontWeightsMap = new Map<LibFontWeights, FONT_WEIGHTS>([
|
|
630
|
+
["regular", FONT_WEIGHTS.REGULAR],
|
|
631
|
+
["bold", FONT_WEIGHTS.BOLD],
|
|
632
|
+
["black", FONT_WEIGHTS.BLACK],
|
|
633
|
+
])
|
|
634
|
+
|
|
635
|
+
return fontWeightsMap.get($fontWeight)
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* @description Returns a spacer from the library
|
|
640
|
+
* @param $spacer: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px" | "auto"
|
|
641
|
+
*/
|
|
642
|
+
Spacer = ($spacer: LibSpacers | "auto" | undefined) => {
|
|
643
|
+
if (!$spacer) return null
|
|
644
|
+
|
|
645
|
+
if (typeof $spacer === "number") return stringifyPx($spacer)
|
|
646
|
+
|
|
647
|
+
if ($spacer === "0px") return "0px"
|
|
648
|
+
|
|
649
|
+
const spacersMap = new Map<LibSpacers | "auto", SPACERS | "auto">([
|
|
650
|
+
["xxl", SPACERS.XXL],
|
|
651
|
+
["xl", SPACERS.XL],
|
|
652
|
+
["l", SPACERS.L],
|
|
653
|
+
["m", SPACERS.M],
|
|
654
|
+
["s", SPACERS.S],
|
|
655
|
+
["xs", SPACERS.XS],
|
|
656
|
+
["xxs", SPACERS.XXS],
|
|
657
|
+
["auto", "auto"],
|
|
658
|
+
])
|
|
659
|
+
|
|
660
|
+
return spacersMap.get($spacer)
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* @description Shorthand to hide a scroolbar in CSS
|
|
665
|
+
*/
|
|
666
|
+
HideScrollbar = css`
|
|
667
|
+
-ms-overflow-style: none;
|
|
668
|
+
scrollbar-width: none;
|
|
669
|
+
|
|
670
|
+
&::-webkit-scrollbar {
|
|
671
|
+
display: none;
|
|
672
|
+
}
|
|
673
|
+
`
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* @description Shorthand to stretch all the tags inside the Wrapper / Wain / Aside compoents
|
|
677
|
+
*/
|
|
678
|
+
StretchTags = css`
|
|
679
|
+
& > div,
|
|
680
|
+
& > h1,
|
|
681
|
+
& > h2,
|
|
682
|
+
& > h3,
|
|
683
|
+
& > h4,
|
|
684
|
+
& > h5,
|
|
685
|
+
& > h6,
|
|
686
|
+
& > p,
|
|
687
|
+
& > ul,
|
|
688
|
+
& > ol,
|
|
689
|
+
& > dl,
|
|
690
|
+
& > section,
|
|
691
|
+
& > input,
|
|
692
|
+
& > article,
|
|
693
|
+
& > hr,
|
|
694
|
+
& > pre,
|
|
695
|
+
& > table,
|
|
696
|
+
& > header,
|
|
697
|
+
& > footer,
|
|
698
|
+
& > iframe,
|
|
699
|
+
& > nav,
|
|
700
|
+
& > noscript,
|
|
701
|
+
& > picture,
|
|
702
|
+
& > select,
|
|
703
|
+
& > textarea,
|
|
704
|
+
& > form {
|
|
705
|
+
align-self: stretch;
|
|
706
|
+
}
|
|
707
|
+
`
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* @description Adds padding to element
|
|
711
|
+
* @argument $padding: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px" | { left?: LibSpacers | "auto"; top?: LibSpacers | "auto"; right?: LibSpacers | "auto"; bottom?: LibSpacers | "auto"; leftRight?: LibSpacers | "auto"; topBottom?: LibSpacers | "auto" }
|
|
712
|
+
*/
|
|
713
|
+
Padding = ($padding: ILibPadding | undefined) => {
|
|
714
|
+
if (!$padding) return null
|
|
715
|
+
|
|
716
|
+
if (typeof $padding === "string" || typeof $padding === "number")
|
|
717
|
+
return css`
|
|
718
|
+
padding: ${Mixins.Spacer($padding)};
|
|
719
|
+
`
|
|
720
|
+
|
|
721
|
+
return css`
|
|
722
|
+
padding-left: ${($padding?.left || $padding?.leftRight) &&
|
|
723
|
+
Mixins.Spacer($padding?.left || $padding?.leftRight)};
|
|
724
|
+
padding-top: ${($padding?.top || $padding?.topBottom) &&
|
|
725
|
+
Mixins.Spacer($padding?.top || $padding?.topBottom)};
|
|
726
|
+
padding-right: ${($padding?.right || $padding?.leftRight) &&
|
|
727
|
+
Mixins.Spacer($padding?.right || $padding?.leftRight)};
|
|
728
|
+
padding-bottom: ${($padding?.bottom || $padding?.topBottom) &&
|
|
729
|
+
Mixins.Spacer($padding?.bottom || $padding?.topBottom)};
|
|
730
|
+
`
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* @description Adds margins to element
|
|
735
|
+
* @argument $margin: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px" | "auto" | "0 auto" | { left?: LibSpacers | "auto"; top?: LibSpacers | "auto"; right?: LibSpacers | "auto"; bottom?: LibSpacers | "auto"; leftRight?: LibSpacers | "auto"; topBottom?: LibSpacers | "auto" }
|
|
736
|
+
*/
|
|
737
|
+
Margin = ($margin: ILibMargin) => {
|
|
738
|
+
if (!$margin) return null
|
|
739
|
+
|
|
740
|
+
if ($margin === "0 auto")
|
|
741
|
+
return css`
|
|
742
|
+
margin: 0 auto;
|
|
743
|
+
`
|
|
744
|
+
|
|
745
|
+
if (typeof $margin === "string" || typeof $margin === "number")
|
|
746
|
+
return css`
|
|
747
|
+
margin: ${Mixins.Spacer($margin)};
|
|
748
|
+
`
|
|
749
|
+
|
|
750
|
+
return css`
|
|
751
|
+
margin-left: ${($margin?.left || $margin?.leftRight) &&
|
|
752
|
+
Mixins.Spacer($margin?.left || $margin?.leftRight)};
|
|
753
|
+
margin-top: ${($margin?.top || $margin?.topBottom) &&
|
|
754
|
+
Mixins.Spacer($margin?.top || $margin?.topBottom)};
|
|
755
|
+
margin-right: ${($margin?.right || $margin?.leftRight) &&
|
|
756
|
+
Mixins.Spacer($margin?.right || $margin?.leftRight)};
|
|
757
|
+
margin-bottom: ${($margin?.bottom || $margin?.topBottom) &&
|
|
758
|
+
Mixins.Spacer($margin?.bottom || $margin?.topBottom)};
|
|
759
|
+
`
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* @description Mixin for components using CSS Grid
|
|
764
|
+
* @prop $inline?: boolean
|
|
765
|
+
* @prop $col?: number | string
|
|
766
|
+
* @prop $gap?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
767
|
+
* @prop $columnGap?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
768
|
+
* @prop $rowGap?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
769
|
+
* @prop $justifyItems?: CssJustifyItems
|
|
770
|
+
* @prop $alignItems?: CssAlignItems
|
|
771
|
+
* @prop $justifyContent?: CssJustifyContent
|
|
772
|
+
* @prop $alignContent?: CssAlignContent
|
|
773
|
+
*/
|
|
774
|
+
Grid = ({
|
|
775
|
+
$inline,
|
|
776
|
+
$col,
|
|
777
|
+
$gap,
|
|
778
|
+
$columnGap,
|
|
779
|
+
$rowGap,
|
|
780
|
+
$justifyItems,
|
|
781
|
+
$alignItems,
|
|
782
|
+
$justifyContent,
|
|
783
|
+
$alignContent,
|
|
784
|
+
$padding,
|
|
785
|
+
}: {
|
|
786
|
+
$inline?: boolean
|
|
787
|
+
$col?: number | string
|
|
788
|
+
$gap?: LibSpacers
|
|
789
|
+
$columnGap?: LibSpacers
|
|
790
|
+
$rowGap?: LibSpacers
|
|
791
|
+
$justifyItems?: CssJustifyItems
|
|
792
|
+
$alignItems?: CssAlignItems
|
|
793
|
+
$justifyContent?: CssJustifyContent
|
|
794
|
+
$alignContent?: CssAlignContent
|
|
795
|
+
$padding?: ILibPadding
|
|
796
|
+
}) => css`
|
|
797
|
+
display: ${$inline ? "inline-grid" : "grid"};
|
|
798
|
+
grid-template-columns: ${$col && typeof $col === "number"
|
|
799
|
+
? `repeat(${$col}, 1fr)`
|
|
800
|
+
: $col};
|
|
801
|
+
gap: ${$gap && Mixins.Spacer($gap)};
|
|
802
|
+
column-gap: ${$columnGap && Mixins.Spacer($columnGap)};
|
|
803
|
+
row-gap: ${$rowGap && Mixins.Spacer($rowGap)};
|
|
804
|
+
justify-content: ${$justifyContent};
|
|
805
|
+
justify-items: ${$justifyItems};
|
|
806
|
+
align-items: ${$alignItems};
|
|
807
|
+
align-content: ${$alignContent};
|
|
808
|
+
${Mixins.Padding($padding)}
|
|
809
|
+
`
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* @description Mixin for components using CSS Flexbox
|
|
813
|
+
* @prop $inline?: boolean
|
|
814
|
+
* @prop $flexDirection?: CssFlexDirection
|
|
815
|
+
* @prop $flexWrap?: CssFlexWrap
|
|
816
|
+
* @prop $justifyContent?: CssJustifyContent
|
|
817
|
+
* @prop $alignItems?: CssAlignItems
|
|
818
|
+
* @prop $justifyItems?: CssJustifyItems
|
|
819
|
+
* @prop $alignContent?: CssAlignContent
|
|
820
|
+
* @prop $gap?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
821
|
+
* @prop $columnGap?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
822
|
+
* @prop $rowGap?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
823
|
+
*/
|
|
824
|
+
Flexbox = ({
|
|
825
|
+
$inline,
|
|
826
|
+
$flexDirection,
|
|
827
|
+
$flexWrap,
|
|
828
|
+
$justifyContent,
|
|
829
|
+
$alignItems,
|
|
830
|
+
$justifyItems,
|
|
831
|
+
$alignContent,
|
|
832
|
+
$gap,
|
|
833
|
+
$columnGap,
|
|
834
|
+
$rowGap,
|
|
835
|
+
$padding,
|
|
836
|
+
}: {
|
|
837
|
+
$inline?: boolean
|
|
838
|
+
$flexDirection?: CssFlexDirection
|
|
839
|
+
$flexWrap?: CssFlexWrap
|
|
840
|
+
$justifyContent?: CssJustifyContent
|
|
841
|
+
$alignItems?: CssAlignItems
|
|
842
|
+
$justifyItems?: CssJustifyItems
|
|
843
|
+
$alignContent?: CssAlignContent
|
|
844
|
+
$gap?: LibSpacers
|
|
845
|
+
$columnGap?: LibSpacers
|
|
846
|
+
$rowGap?: LibSpacers
|
|
847
|
+
$padding?: ILibPadding
|
|
848
|
+
}) => css`
|
|
849
|
+
display: ${$inline ? "inline-flex" : "flex"};
|
|
850
|
+
flex-direction: ${$flexDirection};
|
|
851
|
+
flex-wrap: ${$flexWrap};
|
|
852
|
+
justify-content: ${$justifyContent};
|
|
853
|
+
justify-items: ${$justifyItems};
|
|
854
|
+
align-items: ${$alignItems};
|
|
855
|
+
align-content: ${$alignContent};
|
|
856
|
+
gap: ${$gap && Mixins.Spacer($gap)};
|
|
857
|
+
column-gap: ${$columnGap && Mixins.Spacer($columnGap)};
|
|
858
|
+
row-gap: ${$rowGap && Mixins.Spacer($rowGap)};
|
|
859
|
+
${Mixins.Padding($padding)}
|
|
860
|
+
`
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* @description Adds border to element
|
|
864
|
+
* @prop style?: CssBorderStyle
|
|
865
|
+
* @prop width?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
866
|
+
* @prop color?: Any color from the library
|
|
867
|
+
*/
|
|
868
|
+
Border = ($border?: ILibBorder) => {
|
|
869
|
+
if (!$border) return null
|
|
870
|
+
|
|
871
|
+
const { style, width, color } = $border
|
|
872
|
+
|
|
873
|
+
const borderValues: ILibBorder = {
|
|
874
|
+
style: style || "solid",
|
|
875
|
+
width: width || 1,
|
|
876
|
+
color: color || "gray-200",
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
return css`
|
|
880
|
+
border-style: ${borderValues.style};
|
|
881
|
+
border-width: ${Mixins.Spacer(borderValues.width)};
|
|
882
|
+
border-color: ${({ theme }) =>
|
|
883
|
+
Mixins.AllColors(borderValues.color as LibAllColors, theme)};
|
|
884
|
+
`
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* @description Adds outline to element
|
|
889
|
+
* @prop style?: CssOutlineStyle
|
|
890
|
+
* @prop width?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
891
|
+
* @prop color?: Any color from the library
|
|
892
|
+
*/
|
|
893
|
+
Outline = ($outline?: ILibOutline) => {
|
|
894
|
+
if (!$outline) return null
|
|
895
|
+
|
|
896
|
+
const { style, width, color } = $outline
|
|
897
|
+
|
|
898
|
+
const outlineValues: ILibBorder = {
|
|
899
|
+
style: style || "solid",
|
|
900
|
+
width: width || 1,
|
|
901
|
+
color: color || "white",
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
return css`
|
|
905
|
+
outline-style: ${outlineValues.style};
|
|
906
|
+
outline-width: ${Mixins.Spacer(outlineValues.width)};
|
|
907
|
+
outline-color: ${({ theme }) =>
|
|
908
|
+
Mixins.AllColors(outlineValues.color as LibAllColors, theme)};
|
|
909
|
+
`
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* @description Adds background-image to element
|
|
914
|
+
* @prop img: string
|
|
915
|
+
* @prop clip?: CssBackgroundClip
|
|
916
|
+
* @prop origin?: CssBackgroundOrigin
|
|
917
|
+
* @prop position?: CssBackgroundPosition
|
|
918
|
+
* @prop repeat?: CssBackgroundRepeat
|
|
919
|
+
* @prop size?: CssBackgroundSize
|
|
920
|
+
*/
|
|
921
|
+
BackgroundImage = ({
|
|
922
|
+
$img,
|
|
923
|
+
$clip,
|
|
924
|
+
$origin = "border-box",
|
|
925
|
+
$position = "center",
|
|
926
|
+
$repeat = "no-repeat",
|
|
927
|
+
$size = "cover",
|
|
928
|
+
}: {
|
|
929
|
+
$img: string
|
|
930
|
+
$clip?: Property.BackgroundClip
|
|
931
|
+
$origin?: Property.BackgroundOrigin
|
|
932
|
+
$position?: Property.BackgroundPosition
|
|
933
|
+
$repeat?: Property.BackgroundRepeat
|
|
934
|
+
$size?: Property.BackgroundSize
|
|
935
|
+
}) => {
|
|
936
|
+
if (!$img) return null
|
|
937
|
+
|
|
938
|
+
return css`
|
|
939
|
+
background-image: url(${$img});
|
|
940
|
+
background-origin: ${$origin};
|
|
941
|
+
background-position: ${$position};
|
|
942
|
+
background-repeat: ${$repeat};
|
|
943
|
+
background-size: ${$size};
|
|
944
|
+
|
|
945
|
+
${$clip &&
|
|
946
|
+
($clip === "text"
|
|
947
|
+
? css`
|
|
948
|
+
background-clip: text;
|
|
949
|
+
-webkit-background-clip: text;
|
|
950
|
+
color: transparent;
|
|
951
|
+
`
|
|
952
|
+
: css`
|
|
953
|
+
background-clip: ${$clip};
|
|
954
|
+
`)}
|
|
955
|
+
`
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* @description Adds position to element
|
|
960
|
+
* @prop $position?: "relative" | "absolute" | "fixed"
|
|
961
|
+
* @prop $left?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
962
|
+
* @prop $top?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
963
|
+
* @prop $right?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
964
|
+
* @prop $bottom?: "xxl" | "xl" | "l" | "m" | "s" | "xs" | "xxs" | number | "0px"
|
|
965
|
+
*/
|
|
966
|
+
Position = ({
|
|
967
|
+
$position,
|
|
968
|
+
$left,
|
|
969
|
+
$top,
|
|
970
|
+
$right,
|
|
971
|
+
$bottom,
|
|
972
|
+
$zIndex,
|
|
973
|
+
}: {
|
|
974
|
+
$position?: LibPositionExtract
|
|
975
|
+
$left?: LibSpacers | "unset"
|
|
976
|
+
$top?: LibSpacers | "unset"
|
|
977
|
+
$right?: LibSpacers | "unset"
|
|
978
|
+
$bottom?: LibSpacers | "unset"
|
|
979
|
+
$zIndex?: number
|
|
980
|
+
}) => css`
|
|
981
|
+
position: ${$position};
|
|
982
|
+
left: ${$left && $left !== "unset" && Mixins.Spacer($left)};
|
|
983
|
+
top: ${$top && $top !== "unset" && Mixins.Spacer($top)};
|
|
984
|
+
right: ${$right && $right !== "unset" && Mixins.Spacer($right)};
|
|
985
|
+
bottom: ${$bottom && $bottom !== "unset" && Mixins.Spacer($bottom)};
|
|
986
|
+
z-index: ${$zIndex};
|
|
987
|
+
`
|
|
988
988
|
}
|
|
989
989
|
|
|
990
990
|
export const Mixins = new mixins()
|