chore(theme): lint

This commit is contained in:
Benjamin Canac
2024-04-12 14:01:23 +02:00
parent 290e4ce150
commit 74a640ceca
11 changed files with 51 additions and 65 deletions

View File

@@ -13,19 +13,19 @@ export default {
'2xs': { '2xs': {
root: 'size-5 text-[10px]' root: 'size-5 text-[10px]'
}, },
xs: { 'xs': {
root: 'size-6 text-xs' root: 'size-6 text-xs'
}, },
sm: { 'sm': {
root: 'size-7 text-sm' root: 'size-7 text-sm'
}, },
md: { 'md': {
root: 'size-8 text-base' root: 'size-8 text-base'
}, },
lg: { 'lg': {
root: 'size-9 text-lg' root: 'size-9 text-lg'
}, },
xl: { 'xl': {
root: 'size-10 text-xl' root: 'size-10 text-xl'
}, },
'2xl': { '2xl': {

View File

@@ -25,27 +25,27 @@ export default (config: { colors: string[] }) => ({
leadingIcon: 'size-4', leadingIcon: 'size-4',
trailingIcon: 'size-4' trailingIcon: 'size-4'
}, },
xs: { 'xs': {
base: 'px-2.5 py-1.5 text-xs gap-x-1.5', base: 'px-2.5 py-1.5 text-xs gap-x-1.5',
leadingIcon: 'size-4', leadingIcon: 'size-4',
trailingIcon: 'size-4' trailingIcon: 'size-4'
}, },
sm: { 'sm': {
base: 'px-2.5 py-1.5 text-sm gap-x-1.5', base: 'px-2.5 py-1.5 text-sm gap-x-1.5',
leadingIcon: 'size-5', leadingIcon: 'size-5',
trailingIcon: 'size-5' trailingIcon: 'size-5'
}, },
md: { 'md': {
base: 'px-3 py-2 text-sm gap-x-2', base: 'px-3 py-2 text-sm gap-x-2',
leadingIcon: 'size-5', leadingIcon: 'size-5',
trailingIcon: 'size-5' trailingIcon: 'size-5'
}, },
lg: { 'lg': {
base: 'px-3.5 py-2.5 text-sm gap-x-2.5', base: 'px-3.5 py-2.5 text-sm gap-x-2.5',
leadingIcon: 'size-5', leadingIcon: 'size-5',
trailingIcon: 'size-5' trailingIcon: 'size-5'
}, },
xl: { 'xl': {
base: 'px-3.5 py-2.5 text-base gap-x-2.5', base: 'px-3.5 py-2.5 text-base gap-x-2.5',
leadingIcon: 'size-6', leadingIcon: 'size-6',
trailingIcon: 'size-6' trailingIcon: 'size-6'

View File

@@ -17,27 +17,27 @@ export default (config: { colors: string[] }) => ({
container: 'h-4', container: 'h-4',
wrapper: 'text-xs' wrapper: 'text-xs'
}, },
xs: { 'xs': {
base: 'size-3.5', base: 'size-3.5',
container: 'h-4', container: 'h-4',
wrapper: 'text-xs' wrapper: 'text-xs'
}, },
sm: { 'sm': {
base: 'size-4', base: 'size-4',
container: 'h-5', container: 'h-5',
wrapper: 'text-sm' wrapper: 'text-sm'
}, },
md: { 'md': {
base: 'size-[18px]', base: 'size-[18px]',
container: 'h-5', container: 'h-5',
wrapper: 'text-sm' wrapper: 'text-sm'
}, },
lg: { 'lg': {
base: 'size-5', base: 'size-5',
container: 'h-6', container: 'h-6',
wrapper: 'text-base' wrapper: 'text-base'
}, },
xl: { 'xl': {
base: 'size-[22px]', base: 'size-[22px]',
container: 'h-6', container: 'h-6',
wrapper: 'text-base' wrapper: 'text-base'
@@ -62,7 +62,7 @@ export default (config: { colors: string[] }) => ({
true: '' true: ''
} }
}, },
compoundVariants: config.colors.flatMap((color) => ([{ compoundVariants: config.colors.flatMap(color => ([{
color, color,
checked: true, checked: true,
class: `ring-2 ring-inset ring-${color}-500 dark:ring-${color}-400 bg-${color}-500 dark:bg-${color}-400` class: `ring-2 ring-inset ring-${color}-500 dark:ring-${color}-400 bg-${color}-500 dark:bg-${color}-400`

View File

@@ -13,11 +13,11 @@ export default (config: { colors: string[] }) => ({
size: { size: {
'3xs': 'h-[4px] min-w-[4px] text-[4px]', '3xs': 'h-[4px] min-w-[4px] text-[4px]',
'2xs': 'h-[5px] min-w-[5px] text-[5px]', '2xs': 'h-[5px] min-w-[5px] text-[5px]',
xs: 'h-[6px] min-w-[6px] text-[6px]', 'xs': 'h-[6px] min-w-[6px] text-[6px]',
sm: 'h-[7px] min-w-[7px] text-[7px]', 'sm': 'h-[7px] min-w-[7px] text-[7px]',
md: 'h-[8px] min-w-[8px] text-[8px]', 'md': 'h-[8px] min-w-[8px] text-[8px]',
lg: 'h-[9px] min-w-[9px] text-[9px]', 'lg': 'h-[9px] min-w-[9px] text-[9px]',
xl: 'h-[10px] min-w-[10px] text-[10px]', 'xl': 'h-[10px] min-w-[10px] text-[10px]',
'2xl': 'h-[11px] min-w-[11px] text-[11px]', '2xl': 'h-[11px] min-w-[11px] text-[11px]',
'3xl': 'h-[12px] min-w-[12px] text-[12px]' '3xl': 'h-[12px] min-w-[12px] text-[12px]'
}, },

View File

@@ -13,15 +13,14 @@ export default {
variants: { variants: {
size: { size: {
'2xs': { root: 'text-xs' }, '2xs': { root: 'text-xs' },
xs: { root: 'text-xs' }, 'xs': { root: 'text-xs' },
sm: { root: 'text-sm' }, 'sm': { root: 'text-sm' },
md: { root: 'text-sm' }, 'md': { root: 'text-sm' },
lg: { root: 'text-base' }, 'lg': { root: 'text-base' },
xl: { root: 'text-base' } 'xl': { root: 'text-base' }
}, },
required: { required: {
true: { true: {
// eslint-disable-next-line quotes
label: `after:content-['*'] after:ms-0.5 after:text-red-500 dark:after:text-red-400` label: `after:content-['*'] after:ms-0.5 after:text-red-500 dark:after:text-red-400`
} }
} }

View File

@@ -17,35 +17,35 @@ export default (config: { colors: string[] }) => {
leadingIcon: 'size-4', leadingIcon: 'size-4',
trailingIcon: 'size-4' trailingIcon: 'size-4'
}, },
xs: { 'xs': {
base: 'text-sm gap-x-1.5 px-2.5 py-1', base: 'text-sm gap-x-1.5 px-2.5 py-1',
leading: 'px-2.5', leading: 'px-2.5',
trailing: 'px-2.5', trailing: 'px-2.5',
leadingIcon: 'size-4', leadingIcon: 'size-4',
trailingIcon: 'size-4' trailingIcon: 'size-4'
}, },
sm: { 'sm': {
base: 'text-sm gap-x-1.5 px-2.5 py-1.5', base: 'text-sm gap-x-1.5 px-2.5 py-1.5',
leading: 'px-2.5', leading: 'px-2.5',
trailing: 'px-2.5', trailing: 'px-2.5',
leadingIcon: 'size-5', leadingIcon: 'size-5',
trailingIcon: 'size-5' trailingIcon: 'size-5'
}, },
md: { 'md': {
base: 'text-sm gap-x-1.5 px-3 py-2', base: 'text-sm gap-x-1.5 px-3 py-2',
leading: 'px-3', leading: 'px-3',
trailing: 'px-3', trailing: 'px-3',
leadingIcon: 'size-5', leadingIcon: 'size-5',
trailingIcon: 'size-5' trailingIcon: 'size-5'
}, },
lg: { 'lg': {
base: 'text-sm gap-x-2.5 px-3.5 py-2.5', base: 'text-sm gap-x-2.5 px-3.5 py-2.5',
leading: 'px-3.5', leading: 'px-3.5',
trailing: 'px-3.5', trailing: 'px-3.5',
leadingIcon: 'size-5', leadingIcon: 'size-5',
trailingIcon: 'size-5' trailingIcon: 'size-5'
}, },
xl: { 'xl': {
base: 'text-base gap-x-2.5 px-3.5 py-2.5', base: 'text-base gap-x-2.5 px-3.5 py-2.5',
leading: 'px-3.5', leading: 'px-3.5',
trailing: 'px-3.5', trailing: 'px-3.5',

View File

@@ -3,12 +3,10 @@ export default (config: { colors: string[] }) => ({
root: 'relative', root: 'relative',
fieldset: 'flex flex-col', fieldset: 'flex flex-col',
legend: 'mb-1 block font-medium text-gray-700 dark:text-gray-200', legend: 'mb-1 block font-medium text-gray-700 dark:text-gray-200',
option: 'flex items-start', option: 'flex items-start',
base: 'rounded-full ring ring-inset ring-gray-300 dark:ring-gray-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-offset-white dark:focus-visible:outline-offset-gray-900', base: 'rounded-full ring ring-inset ring-gray-300 dark:ring-gray-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-offset-white dark:focus-visible:outline-offset-gray-900',
indicator: 'flex items-center justify-center size-full rounded-full after:bg-white dark:after:bg-gray-900 after:rounded-full', indicator: 'flex items-center justify-center size-full rounded-full after:bg-white dark:after:bg-gray-900 after:rounded-full',
container: 'flex items-center', container: 'flex items-center',
wrapper: 'ms-2', wrapper: 'ms-2',
label: 'block font-medium text-gray-700 dark:text-gray-200', label: 'block font-medium text-gray-700 dark:text-gray-200',
description: 'text-gray-500 dark:text-gray-400' description: 'text-gray-500 dark:text-gray-400'
@@ -18,7 +16,6 @@ export default (config: { colors: string[] }) => ({
base: `focus-visible:outline-${color}-500 dark:focus-visible:outline-${color}-400`, base: `focus-visible:outline-${color}-500 dark:focus-visible:outline-${color}-400`,
indicator: `bg-${color}-500 dark:bg-${color}-400` indicator: `bg-${color}-500 dark:bg-${color}-400`
}])), }])),
size: { size: {
'2xs': { '2xs': {
fieldset: 'gap-0.5', fieldset: 'gap-0.5',
@@ -27,35 +24,35 @@ export default (config: { colors: string[] }) => ({
container: 'h-4', container: 'h-4',
indicator: 'after:size-1' indicator: 'after:size-1'
}, },
xs: { 'xs': {
fieldset: 'gap-0.5', fieldset: 'gap-0.5',
base: 'size-3.5', base: 'size-3.5',
option: 'text-xs', option: 'text-xs',
container: 'h-4', container: 'h-4',
indicator: 'after:size-1' indicator: 'after:size-1'
}, },
sm: { 'sm': {
fieldset: 'gap-1', fieldset: 'gap-1',
base: 'size-4', base: 'size-4',
option: 'text-sm', option: 'text-sm',
container: 'h-5', container: 'h-5',
indicator: 'after:size-1.5' indicator: 'after:size-1.5'
}, },
md: { 'md': {
fieldset: 'gap-1', fieldset: 'gap-1',
base: 'size-[18px]', base: 'size-[18px]',
option: 'text-sm', option: 'text-sm',
container: 'h-5', container: 'h-5',
indicator: 'after:size-1.5' indicator: 'after:size-1.5'
}, },
lg: { 'lg': {
fieldset: 'gap-1.5', fieldset: 'gap-1.5',
base: 'size-5', base: 'size-5',
option: 'text-base', option: 'text-base',
container: 'h-6', container: 'h-6',
indicator: 'after:size-2' indicator: 'after:size-2'
}, },
xl: { 'xl': {
fieldset: 'gap-1.5', fieldset: 'gap-1.5',
base: 'size-[22px]', base: 'size-[22px]',
option: 'text-base', option: 'text-base',
@@ -63,21 +60,18 @@ export default (config: { colors: string[] }) => ({
indicator: 'after:size-2' indicator: 'after:size-2'
} }
}, },
disabled: { disabled: {
true: { true: {
base: 'cursor-not-allowed opacity-75', base: 'cursor-not-allowed opacity-75',
label: 'cursor-not-allowed opacity-75' label: 'cursor-not-allowed opacity-75'
} }
}, },
required: { required: {
true: { true: {
legend: 'after:content-[\'*\'] after:ms-0.5 after:text-red-500 dark:after:text-red-400' legend: 'after:content-[\'*\'] after:ms-0.5 after:text-red-500 dark:after:text-red-400'
} }
} }
}, },
defaultVariants: { defaultVariants: {
size: 'sm', size: 'sm',
color: 'primary' color: 'primary'

View File

@@ -28,11 +28,11 @@ export default (config: { colors: string[] }) => ({
}, },
size: { size: {
'2xs': '', '2xs': '',
xs: '', 'xs': '',
sm: '', 'sm': '',
md: '', 'md': '',
lg: '', 'lg': '',
xl: '' 'xl': ''
}, },
type: { type: {
solid: { solid: {

View File

@@ -15,27 +15,27 @@ export default (config: { colors: string[] }) => ({
thumb: 'size-2 data-[state=checked]:translate-x-2', thumb: 'size-2 data-[state=checked]:translate-x-2',
icon: 'size-1' icon: 'size-1'
}, },
xs: { 'xs': {
root: 'h-4 w-7', root: 'h-4 w-7',
thumb: 'size-3 data-[state=checked]:translate-x-3', thumb: 'size-3 data-[state=checked]:translate-x-3',
icon: 'size-2' icon: 'size-2'
}, },
sm: { 'sm': {
root: 'h-5 w-9', root: 'h-5 w-9',
thumb: 'size-4 data-[state=checked]:translate-x-4', thumb: 'size-4 data-[state=checked]:translate-x-4',
icon: 'size-3' icon: 'size-3'
}, },
md: { 'md': {
root: 'h-6 w-11', root: 'h-6 w-11',
thumb: 'size-5 data-[state=checked]:translate-x-5', thumb: 'size-5 data-[state=checked]:translate-x-5',
icon: 'size-4' icon: 'size-4'
}, },
lg: { 'lg': {
root: 'h-7 w-[52px]', root: 'h-7 w-[52px]',
thumb: 'size-6 data-[state=checked]:translate-x-6', thumb: 'size-6 data-[state=checked]:translate-x-6',
icon: 'size-5' icon: 'size-5'
}, },
xl: { 'xl': {
root: 'h-8 w-[60px]', root: 'h-8 w-[60px]',
thumb: 'size-7 data-[state=checked]:translate-x-7', thumb: 'size-7 data-[state=checked]:translate-x-7',
icon: 'size-6' icon: 'size-6'

View File

@@ -3,42 +3,37 @@ export default (config: { colors: string[] }) => ({
root: 'relative', root: 'relative',
base: 'relative block w-full disabled:cursor-not-allowed disabled:opacity-75 focus:outline-none border-0 rounded-md placeholder-gray-400 dark:placeholder-gray-500' base: 'relative block w-full disabled:cursor-not-allowed disabled:opacity-75 focus:outline-none border-0 rounded-md placeholder-gray-400 dark:placeholder-gray-500'
}, },
variants: { variants: {
size: { size: {
'2xs': { '2xs': {
base: 'text-xs gap-x-1 px-2 py-1' base: 'text-xs gap-x-1 px-2 py-1'
}, },
xs: { 'xs': {
base: 'text-sm gap-x-1.5 px-2.5 py-1' base: 'text-sm gap-x-1.5 px-2.5 py-1'
}, },
sm: { 'sm': {
base: 'text-sm gap-x-1.5 px-2.5 py-1.5' base: 'text-sm gap-x-1.5 px-2.5 py-1.5'
}, },
md: { 'md': {
base: 'text-sm gap-x-1.5 px-3 py-2' base: 'text-sm gap-x-1.5 px-3 py-2'
}, },
lg: { 'lg': {
base: 'text-sm gap-x-2.5 px-3.5 py-2.5' base: 'text-sm gap-x-2.5 px-3.5 py-2.5'
}, },
xl: { 'xl': {
base: 'text-base gap-x-2.5 px-3.5 py-2.5' base: 'text-base gap-x-2.5 px-3.5 py-2.5'
} }
}, },
variant: { variant: {
outline: '', outline: '',
none: 'bg-transparent focus:ring-0 focus:shadow-none' none: 'bg-transparent focus:ring-0 focus:shadow-none'
}, },
color: { color: {
...Object.fromEntries(config.colors.map((color: string) => [color, ''])), ...Object.fromEntries(config.colors.map((color: string) => [color, ''])),
white: '', white: '',
gray: '' gray: ''
} }
}, },
compoundVariants: [ compoundVariants: [
...config.colors.map((color: string) => ({ ...config.colors.map((color: string) => ({
color, color,
@@ -54,7 +49,6 @@ export default (config: { colors: string[] }) => ({
class: 'shadow-sm bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-white ring ring-inset ring-gray-300 dark:ring-gray-700 focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400' class: 'shadow-sm bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-white ring ring-inset ring-gray-300 dark:ring-gray-700 focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400'
} }
], ],
defaultVariants: { defaultVariants: {
size: 'sm', size: 'sm',
color: 'white', color: 'white',

View File

@@ -3,7 +3,6 @@ export default {
content: 'flex items-center gap-1 bg-white dark:bg-gray-900 text-gray-900 dark:text-white shadow rounded ring ring-gray-200 dark:ring-gray-800 h-6 px-2 py-1 text-xs select-none will-change-[transform,opacity]', content: 'flex items-center gap-1 bg-white dark:bg-gray-900 text-gray-900 dark:text-white shadow rounded ring ring-gray-200 dark:ring-gray-800 h-6 px-2 py-1 text-xs select-none will-change-[transform,opacity]',
arrow: 'fill-gray-200 dark:fill-gray-800', arrow: 'fill-gray-200 dark:fill-gray-800',
text: 'truncate', text: 'truncate',
// eslint-disable-next-line quotes
shortcuts: `hidden lg:inline-flex items-center shrink-0 gap-0.5 before:content-['·'] before:mr-0.5` shortcuts: `hidden lg:inline-flex items-center shrink-0 gap-0.5 before:content-['·'] before:mr-0.5`
}, },
variants: { variants: {