Skip to content

Commit 76207a7

Browse files
authored
Merge pull request #722 from LekoArts/tailwind-preset
feat: Update Tailwind preset with new transforms/transitions
2 parents f9cf914 + d5f7bc6 commit 76207a7

File tree

1 file changed

+99
-3
lines changed

1 file changed

+99
-3
lines changed

packages/preset-tailwind/src/index.ts

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ export const colors = {
257257

258258
export const baseFonts = {
259259
sans:
260-
'-apple-system, BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"',
261-
serif: 'Georgia, Cambria, "Times New Roman", Times, serif',
260+
'system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"',
261+
serif: 'Georgia,Cambria,"Times New Roman",Times,serif',
262262
mono: 'Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace',
263263
}
264264

@@ -377,11 +377,12 @@ export const radii = {
377377
none: '0',
378378
sm: '0.125rem',
379379
default: '0.25rem',
380+
md: '0.375rem',
380381
lg: '0.5rem',
381382
full: '9999px',
382383
}
383384

384-
export const sizes = {
385+
const tailwindSpacing = {
385386
px: '1px',
386387
'0': '0',
387388
'1': '0.25rem',
@@ -401,6 +402,9 @@ export const sizes = {
401402
'48': '12rem',
402403
'56': '14rem',
403404
'64': '16rem',
405+
}
406+
407+
const tailwindMaxWidth = {
404408
xs: '20rem',
405409
sm: '24rem',
406410
md: '28rem',
@@ -411,6 +415,9 @@ export const sizes = {
411415
'4xl': '56rem',
412416
'5xl': '64rem',
413417
'6xl': '72rem',
418+
}
419+
420+
const tailwindWidth = {
414421
'1/2': '50%',
415422
'1/3': '33.333333%',
416423
'2/3': '66.666667%',
@@ -437,12 +444,20 @@ export const sizes = {
437444
'9/12': '75%',
438445
'10/12': '83.333333%',
439446
'11/12': '91.666667%',
447+
}
448+
449+
export const sizes = {
450+
...tailwindSpacing,
451+
...tailwindMaxWidth,
452+
...tailwindWidth,
440453
full: '100%',
441454
screenHeight: '100vh',
442455
screenWidth: '100vw',
443456
}
444457

445458
export const shadows = {
459+
xs: '0 0 0 1px rgba(0, 0, 0, 0.05)',
460+
sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
446461
default: '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)',
447462
md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
448463
lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
@@ -535,6 +550,85 @@ export const styles = {
535550
},
536551
}
537552

553+
export const transforms = {
554+
transformOrigin: {
555+
center: 'center',
556+
top: 'top',
557+
'top-right': 'top right',
558+
right: 'right',
559+
'bottom-right': 'bottom right',
560+
bottom: 'bottom',
561+
'bottom-left': 'bottom left',
562+
left: 'left',
563+
'top-left': 'top left',
564+
},
565+
translate: {
566+
...tailwindSpacing,
567+
'-full': '-100%',
568+
'-1/2': '-50%',
569+
'1/2': '50%',
570+
full: '100%',
571+
},
572+
scale: {
573+
'0': '0',
574+
'50': '.5',
575+
'75': '.75',
576+
'90': '.9',
577+
'95': '.95',
578+
'100': '1',
579+
'105': '1.05',
580+
'110': '1.1',
581+
'125': '1.25',
582+
'150': '1.5',
583+
},
584+
rotate: {
585+
'-180': '-180deg',
586+
'-90': '-90deg',
587+
'-45': '-45deg',
588+
'0': '0',
589+
'45': '45deg',
590+
'90': '90deg',
591+
'180': '180deg',
592+
},
593+
skew: {
594+
'-12': '-12deg',
595+
'-6': '-6deg',
596+
'-3': '-3deg',
597+
'0': '0',
598+
'3': '3deg',
599+
'6': '6deg',
600+
'12': '12deg',
601+
},
602+
}
603+
604+
export const transitions = {
605+
property: {
606+
none: 'none',
607+
all: 'all',
608+
default: 'background-color, border-color, color, fill, stroke, opacity, box-shadow, transform',
609+
colors: 'background-color, border-color, color, fill, stroke',
610+
opacity: 'opacity',
611+
shadow: 'box-shadow',
612+
transform: 'transform',
613+
},
614+
timingFunction: {
615+
linear: 'linear',
616+
in: 'cubic-bezier(0.4, 0, 1, 1)',
617+
out: 'cubic-bezier(0, 0, 0.2, 1)',
618+
'in-out': 'cubic-bezier(0.4, 0, 0.2, 1)',
619+
},
620+
duration: {
621+
'75': '75ms',
622+
'100': '100ms',
623+
'150': '150ms',
624+
'200': '200ms',
625+
'300': '300ms',
626+
'500': '500ms',
627+
'700': '700ms',
628+
'1000': '1000ms',
629+
},
630+
}
631+
538632
export const tailwind = {
539633
borderWidths,
540634
breakpoints,
@@ -552,6 +646,8 @@ export const tailwind = {
552646
styles,
553647
buttons,
554648
inputs,
649+
transforms,
650+
transitions,
555651
}
556652

557653
export default tailwind

0 commit comments

Comments
 (0)