-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
Copy pathtailwind.config.js
314 lines (305 loc) · 9 KB
/
tailwind.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
43
44
45
46
47
48
49
50
51
52
53
54
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
const colors = require('tailwindcss/colors');
const plugin = require('tailwindcss/plugin');
function hexToHsl(hex) {
// Remove the '#' character from the beginning of the hex code
hex = hex.replace('#', '');
// Convert hex code to RGB
const red = parseInt(hex.substring(0, 2), 16) / 255;
const green = parseInt(hex.substring(2, 4), 16) / 255;
const blue = parseInt(hex.substring(4, 6), 16) / 255;
const max = Math.max(red, green, blue);
const min = Math.min(red, green, blue);
let hue,
saturation,
lightness = (max + min) / 2;
if (max === min) {
hue = saturation = 0; // achromatic
} else {
const delta = max - min;
saturation =
lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
switch (max) {
case red:
hue = (green - blue) / delta + (green < blue ? 6 : 0);
break;
case green:
hue = (blue - red) / delta + 2;
break;
case blue:
hue = (red - green) / delta + 4;
break;
}
hue *= 60;
}
return `${parseFloat(hue.toFixed(2))}, ${parseFloat(
(100 * saturation).toFixed(2)
)}%, ${parseFloat((100 * lightness).toFixed(2))}%`;
}
function dataStateVariant(state, { addVariant, e }) {
addVariant(`data-state-${state}`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${e(
`data-state-${state}${separator}${className}`
)}[data-state='${state}']`;
});
});
addVariant(`group-data-state-${state}`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.group[data-state='${state}'] .${e(
`group-data-state-${state}${separator}${className}`
)}`;
});
});
addVariant(`peer-data-state-${state}`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.peer[data-state='${state}'] ~ .${e(
`peer-data-state-${state}${separator}${className}`
)}`;
});
});
}
module.exports = {
safelist: {
standard: /background$/,
},
darkMode: 'class',
theme: {
fontFamily: {
sans: ['Gudea', 'ui-sans-serif', 'system-ui'],
mono: ['"Overpass Mono"', 'ui-monospace', 'monospace'],
},
extend: {
boxShadow: {
eq: 'rgb(0 0 0) 0px 0px 2px',
},
colors: {
current: 'currentColor',
yellow: colors.amber,
gray: colors.slate,
primary: {
light: '#fad170',
DEFAULT: '#f9c548',
dark: '#d5ae52',
darker: '#ae8e3e',
},
cloud: {
DEFAULT: '#1eb4d4',
dark: '#197b98',
darker: '#074c4c',
},
secondary: {
light: '#eef4f7',
DEFAULT: '#297393',
dark: '#14394a',
},
legacybg: {
DEFAULT: '#f8fafb',
},
muted: {
DEFAULT: '#64748B',
dark: '#64748B',
},
},
spacing: {
xs: '0.571rem', // ~9.5 px
sm: '0.857rem', // ~14 px
md: '1.429rem', // ~23 px
lg: '2.286rem', // 36.5px
xl: '2.857rem', // 45.7px
input: '2.5rem', // 41.5px
btn: '2.5rem', // 41.5px
btnsm: '2rem', // 32px
formlabel: '0.571rem', // ~9.5 px
},
fontSize: {
sm: ['0.875rem', { lineHeight: '1.25rem' }],
base: ['1rem', { lineHeight: '1.5rem' }],
lg: ['1.143rem', { lineHeight: '1.429rem' }],
xl: ['1.714rem', { lineHeight: '2.143rem' }],
subtitle: ['1.300rem', { lineHeight: '2.143rem' }], // ~20 px
title: ['1.5rem', { lineHeight: '2.143rem' }], // ~24 px
},
width: {
inherit: 'inherit',
},
keyframes: {
onboardingWizardFadeIn: {
'0%': {
opacity: '0',
scale: '.9',
},
'50%': {
opacity: '.5',
scale: '.95',
},
'100%': {
opacity: '1',
scale: '1',
},
},
collapsibleContentOpen: {
from: {
height: '0',
},
to: {
height: 'var(--radix-collapsible-content-height)',
},
},
collapsibleContentClose: {
from: {
height: 'var(--radix-collapsible-content-height)',
},
to: {
height: '0',
},
},
slideUpAndFade: {
from: {
opacity: `0`,
transform: `translateY(2px)`,
},
to: {
opacity: `1`,
transform: `translateY(0)`,
},
},
slideRightAndFade: {
from: {
opacity: `0`,
transform: `translateX(-2px)`,
},
to: {
opacity: `1`,
transform: `translateX(0)`,
},
},
slideDownAndFade: {
from: {
opacity: `0`,
transform: `translateY(-2px)`,
},
to: {
opacity: `1`,
transform: `translateY(0)`,
},
},
slideLeftAndFade: {
from: {
opacity: `0`,
transform: `translateX(2px)`,
},
to: {
opacity: `1`,
transform: `translateX(0)`,
},
},
notificationOpen: {
from: {
opacity: `0`,
transform: `translateX(100%)`,
},
to: {
opacity: `1`,
transform: `translateX(0)`,
},
},
notificationClose: {
from: {
opacity: `1`,
transform: `translateY(0)`,
},
to: {
opacity: `0`,
transform: `translateY(-100%)`,
},
},
dropdownMenuContentOpen: {
from: {
opacity: '0',
},
to: {
opacity: '1',
},
},
dropdownMenuContentClose: {
from: {
opacity: '1',
},
to: {
opacity: '0',
},
},
fadeIn: {
from: { opacity: 0 },
to: { opacity: 1 },
},
alertContentShow: {
from: { opacity: 0, transform: 'translate(-50%, -48%) scale(0.96)' },
to: { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' },
},
},
animation: {
collapsibleContentOpen: 'collapsibleContentOpen 300ms ease-out',
collapsibleContentClose: 'collapsibleContentClose 300ms ease-out',
collapsibleContentOpenFast: 'collapsibleContentOpen 200ms ease-out',
collapsibleContentCloseFast: 'collapsibleContentClose 200ms ease-out',
slideUpAndFade: 'slideUpAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
slideRightAndFade:
'slideRightAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
slideDownAndFade:
'slideDownAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
slideLeftAndFade:
'slideLeftAndFade 400ms cubic-bezier(0.16, 1, 0.3, 1)',
notificationOpen: 'notificationOpen 300ms ease-in-out',
notificationClose: 'notificationClose 300ms ease-in-out',
dropdownMenuContentOpen: 'dropdownMenuContentOpen 100ms ease-in',
dropdownMenuContentClose: 'dropdownMenuContentClose 100ms ease-out',
overlayShow: 'overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1)',
contentShow: 'contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1)',
},
},
},
plugins: [
require('@tailwindcss/typography'),
require('@tailwindcss/forms'),
require('tailwindcss-radix')(),
plugin(helpers => {
// variants that help styling Radix-UI components
dataStateVariant('open', helpers);
dataStateVariant('closed', helpers);
dataStateVariant('on', helpers);
dataStateVariant('checked', helpers);
dataStateVariant('unchecked', helpers);
}),
plugin(function ({ addBase, theme }) {
const colors = {
'--tw-font-family-sans': theme('fontFamily.sans'),
'--tw-font-family-mono': theme('fontFamily.mono'),
'--tw-color-white-hex': '#ffffff',
'--tw-color-white-hsl': '0, 0%, 100%',
'--tw-color-black-hex': '#000000',
'--tw-color-black-hsl': '0, 0%, 0%',
};
Object.entries(theme('colors'))
.filter(([name]) => !['white', 'black'].includes(name))
.forEach(([name, color]) => {
Object.entries(color).forEach(([shade, value]) => {
if (typeof value === 'object') {
Object.entries(value).forEach(([shade, hex]) => {
if (hex?.startsWith('#')) {
colors[`--tw-color-${name}-${shade}-hex`] = hex;
colors[`--tw-color-${name}-${shade}-hsl`] = hexToHsl(hex);
}
});
} else if (typeof value === 'string' && value?.startsWith('#')) {
colors[`--tw-color-${name}-${shade}-hex`] = value;
colors[`--tw-color-${name}-${shade}-hsl`] = hexToHsl(value);
}
});
});
addBase({
'*, ::before, ::after': colors,
});
}),
],
};