refactor(ui): enhance component className structure for better readability and maintainability
This commit is contained in:
parent
9cb378f197
commit
573c3053b6
9 changed files with 553 additions and 24 deletions
|
@ -7,7 +7,33 @@ function Card({ className, ...props }: React.ComponentProps<'div'>) {
|
||||||
<div
|
<div
|
||||||
data-slot='card'
|
data-slot='card'
|
||||||
className={cn(
|
className={cn(
|
||||||
'bg-card flex flex-col gap-6 py-6 shadow-[4px_4px_9px_9px_rgba(0,0,0,0.25)] rounded-[11px]',
|
/* Text */
|
||||||
|
'',
|
||||||
|
/* Background */
|
||||||
|
'bg-card',
|
||||||
|
/* Border */
|
||||||
|
'rounded-[11px]',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'',
|
||||||
|
/* Shadow */
|
||||||
|
'shadow-[4px_4px_9px_9px_rgba(0,0,0,0.25)]',
|
||||||
|
/* Opacity */
|
||||||
|
'',
|
||||||
|
/* Scaling */
|
||||||
|
'',
|
||||||
|
/* Spacing */
|
||||||
|
'gap-6 py-6',
|
||||||
|
/* Alignment */
|
||||||
|
'flex flex-col',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
@ -7,7 +7,31 @@ function Card({ className, ...props }: React.ComponentProps<'div'>) {
|
||||||
<div
|
<div
|
||||||
data-slot='card'
|
data-slot='card'
|
||||||
className={cn(
|
className={cn(
|
||||||
'bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm',
|
/* Text */
|
||||||
|
'text-card-foreground',
|
||||||
|
/* Background */
|
||||||
|
'bg-card',
|
||||||
|
/* Border */
|
||||||
|
'border rounded-xl',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'',
|
||||||
|
/* Shadow */
|
||||||
|
'shadow-sm',
|
||||||
|
/* Opacity */
|
||||||
|
'',
|
||||||
|
/* Scaling */
|
||||||
|
'',
|
||||||
|
/* Spacing */
|
||||||
|
'py-6 gap-6',
|
||||||
|
/* Alignment */
|
||||||
|
'flex flex-col',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -20,7 +44,34 @@ function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
||||||
<div
|
<div
|
||||||
data-slot='card-header'
|
data-slot='card-header'
|
||||||
className={cn(
|
className={cn(
|
||||||
'@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',
|
/* Text */
|
||||||
|
'',
|
||||||
|
/* Background */
|
||||||
|
'',
|
||||||
|
/* Border */
|
||||||
|
'',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'',
|
||||||
|
/* Shadow */
|
||||||
|
'',
|
||||||
|
/* Opacity */
|
||||||
|
'',
|
||||||
|
/* Scaling */
|
||||||
|
'',
|
||||||
|
/* Spacing */
|
||||||
|
'gap-1.5 px-6 [.border-b]:pb-6',
|
||||||
|
/* Alignment */
|
||||||
|
'grid auto-rows-min grid-rows-[auto_auto]',
|
||||||
|
'items-start has-data-[slot=card-action]:grid-cols-[1fr_auto]',
|
||||||
|
/* Miscellanneous */
|
||||||
|
'@container/card-header',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
@ -42,7 +42,38 @@ function DropdownMenuContent({
|
||||||
data-slot='dropdown-menu-content'
|
data-slot='dropdown-menu-content'
|
||||||
sideOffset={sideOffset}
|
sideOffset={sideOffset}
|
||||||
className={cn(
|
className={cn(
|
||||||
'bg-popover text-text data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md',
|
/* Text */
|
||||||
|
'text-text',
|
||||||
|
/* Background */
|
||||||
|
'bg-popover',
|
||||||
|
/* Border */
|
||||||
|
'border rounded-md',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'',
|
||||||
|
/* Shadow */
|
||||||
|
'shadow-md',
|
||||||
|
/* Opacity */
|
||||||
|
'',
|
||||||
|
/* Scaling */
|
||||||
|
'max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem]',
|
||||||
|
/* Spacing */
|
||||||
|
'p-1',
|
||||||
|
/* Alignment */
|
||||||
|
'z-50 origin-(--radix-dropdown-menu-content-transform-origin)',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'overflow-x-hidden overflow-y-auto',
|
||||||
|
'data-[state=open]:animate-in data-[state=closed]:animate-out',
|
||||||
|
'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
||||||
|
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
||||||
|
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2',
|
||||||
|
'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -74,7 +105,38 @@ function DropdownMenuItem({
|
||||||
data-inset={inset}
|
data-inset={inset}
|
||||||
data-variant={variant}
|
data-variant={variant}
|
||||||
className={cn(
|
className={cn(
|
||||||
"focus:bg-popover-hover focus:text-text data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
/* Text */
|
||||||
|
'text-sm focus:text-text data-[variant=destructive]:text-destructive',
|
||||||
|
'data-[variant=destructive]:focus:text-destructive',
|
||||||
|
'data-[variant=destructive]:*:[svg]:!text-destructive',
|
||||||
|
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||||
|
/* Background */
|
||||||
|
'focus:bg-popover-hover data-[variant=destructive]:focus:bg-destructive/10',
|
||||||
|
'dark:data-[variant=destructive]:focus:bg-destructive/20',
|
||||||
|
/* Border */
|
||||||
|
'rounded-sm',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'cursor-default data-[disabled]:pointer-events-none data-[inset]:pl-8',
|
||||||
|
'[&_svg]:pointer-events-none',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'outline-hidden',
|
||||||
|
/* Shadow */
|
||||||
|
'',
|
||||||
|
/* Opacity */
|
||||||
|
'data-[disabled]:opacity-50',
|
||||||
|
/* Scaling */
|
||||||
|
" [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
/* Spacing */
|
||||||
|
'gap-2 px-2 py-1.5',
|
||||||
|
/* Alignment */
|
||||||
|
'relative flex items-center [&_svg]:shrink-0',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'select-none',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -92,7 +154,35 @@ function DropdownMenuCheckboxItem({
|
||||||
<DropdownMenuPrimitive.CheckboxItem
|
<DropdownMenuPrimitive.CheckboxItem
|
||||||
data-slot='dropdown-menu-checkbox-item'
|
data-slot='dropdown-menu-checkbox-item'
|
||||||
className={cn(
|
className={cn(
|
||||||
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
' ',
|
||||||
|
/* Text */
|
||||||
|
'focus:text-accent-foreground text-sm',
|
||||||
|
/* Background */
|
||||||
|
'focus:bg-accent',
|
||||||
|
/* Border */
|
||||||
|
'rounded-sm',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'cursor-default select-none data-[disabled]:pointer-events-none',
|
||||||
|
'[&_svg]:pointer-events-none',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'outline-hidden',
|
||||||
|
/* Shadow */
|
||||||
|
'',
|
||||||
|
/* Opacity */
|
||||||
|
'data-[disabled]:opacity-50',
|
||||||
|
/* Scaling */
|
||||||
|
"[&_svg:not([class*='size-'])]:size-4",
|
||||||
|
/* Spacing */
|
||||||
|
'gap-2 py-1.5 pr-2 pl-8',
|
||||||
|
/* Alignment */
|
||||||
|
'relative flex items-center [&_svg]:shrink-0',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
checked={checked}
|
checked={checked}
|
||||||
|
@ -128,7 +218,33 @@ function DropdownMenuRadioItem({
|
||||||
<DropdownMenuPrimitive.RadioItem
|
<DropdownMenuPrimitive.RadioItem
|
||||||
data-slot='dropdown-menu-radio-item'
|
data-slot='dropdown-menu-radio-item'
|
||||||
className={cn(
|
className={cn(
|
||||||
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
/* Text */
|
||||||
|
'focus:text-accent-foreground text-sm',
|
||||||
|
/* Background */
|
||||||
|
'focus:bg-accent',
|
||||||
|
/* Border */
|
||||||
|
'rounded-sm',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'cursor-default select-none data-[disabled]:pointer-events-none [&_svg]:pointer-events-none',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'outline-hidden',
|
||||||
|
/* Shadow */
|
||||||
|
'',
|
||||||
|
/* Opacity */
|
||||||
|
'data-[disabled]:opacity-50',
|
||||||
|
/* Scaling */
|
||||||
|
"[&_svg:not([class*='size-'])]:size-4",
|
||||||
|
/* Spacing */
|
||||||
|
'gap-2 py-1.5 pr-2 pl-8',
|
||||||
|
/* Alignment */
|
||||||
|
'relative flex items-center [&_svg]:shrink-0',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -211,7 +327,34 @@ function DropdownMenuSubTrigger({
|
||||||
data-slot='dropdown-menu-sub-trigger'
|
data-slot='dropdown-menu-sub-trigger'
|
||||||
data-inset={inset}
|
data-inset={inset}
|
||||||
className={cn(
|
className={cn(
|
||||||
'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8',
|
' ',
|
||||||
|
/* Text */
|
||||||
|
'text-sm focus:text-accent-foreground data-[state=open]:text-accent-foreground',
|
||||||
|
/* Background */
|
||||||
|
'focus:bg-accent data-[state=open]:bg-accent',
|
||||||
|
/* Border */
|
||||||
|
'rounded-sm',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'cursor-default select-none',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'outline-hidden',
|
||||||
|
/* Shadow */
|
||||||
|
'',
|
||||||
|
/* Opacity */
|
||||||
|
'',
|
||||||
|
/* Scaling */
|
||||||
|
'',
|
||||||
|
/* Spacing */
|
||||||
|
'px-2 py-1.5 data-[inset]:pl-8',
|
||||||
|
/* Alignment */
|
||||||
|
'flex items-center',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -230,7 +373,38 @@ function DropdownMenuSubContent({
|
||||||
<DropdownMenuPrimitive.SubContent
|
<DropdownMenuPrimitive.SubContent
|
||||||
data-slot='dropdown-menu-sub-content'
|
data-slot='dropdown-menu-sub-content'
|
||||||
className={cn(
|
className={cn(
|
||||||
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg',
|
' ',
|
||||||
|
/* Text */
|
||||||
|
'text-popover-foreground',
|
||||||
|
/* Background */
|
||||||
|
'bg-popover',
|
||||||
|
/* Border */
|
||||||
|
'border rounded-md',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'',
|
||||||
|
/* Shadow */
|
||||||
|
'shadow-lg',
|
||||||
|
/* Opacity */
|
||||||
|
'',
|
||||||
|
/* Scaling */
|
||||||
|
'min-w-[8rem]',
|
||||||
|
/* Spacing */
|
||||||
|
'p-1',
|
||||||
|
/* Alignment */
|
||||||
|
'z-50 origin-(--radix-dropdown-menu-content-transform-origin)',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'overflow-hidden',
|
||||||
|
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0',
|
||||||
|
'data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
||||||
|
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2',
|
||||||
|
'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
@ -32,7 +32,37 @@ function HoverCardContent({
|
||||||
align={align}
|
align={align}
|
||||||
sideOffset={sideOffset}
|
sideOffset={sideOffset}
|
||||||
className={cn(
|
className={cn(
|
||||||
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',
|
/* Text */
|
||||||
|
'text-text',
|
||||||
|
/* Background */
|
||||||
|
'bg-popover',
|
||||||
|
/* Border */
|
||||||
|
'border rounded-md',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'outline-hidden',
|
||||||
|
/* Shadow */
|
||||||
|
'shadow-md',
|
||||||
|
/* Opacity */
|
||||||
|
'',
|
||||||
|
/* Scaling */
|
||||||
|
'w-64',
|
||||||
|
/* Spacing */
|
||||||
|
'p-4',
|
||||||
|
/* Alignment */
|
||||||
|
'z-50',
|
||||||
|
/* Miscellanneous */
|
||||||
|
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0',
|
||||||
|
'data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
||||||
|
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2',
|
||||||
|
'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
||||||
|
'origin-(--radix-hover-card-content-transform-origin)',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
@ -8,9 +8,32 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
||||||
type={type}
|
type={type}
|
||||||
data-slot='input'
|
data-slot='input'
|
||||||
className={cn(
|
className={cn(
|
||||||
'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-label disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
/* Text */
|
||||||
'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
'text-text-input selection:text-text md:text-sm file:text-destructive file:text-sm placeholder:text-text-muted-input',
|
||||||
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
/* Background */
|
||||||
|
'bg-transparent selection:bg-muted-input file:bg-transparent',
|
||||||
|
/* Border */
|
||||||
|
'rounded-md border border-input focus-visible:border-ring aria-invalid:border-destructive file:border-0',
|
||||||
|
/* Font */
|
||||||
|
'file:font-label',
|
||||||
|
/* Cursor */
|
||||||
|
'disabled:pointer-events-none disabled:cursor-not-allowed',
|
||||||
|
/* Ring */
|
||||||
|
'focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40',
|
||||||
|
/* Outline */
|
||||||
|
'outline-none',
|
||||||
|
/* Shadow */
|
||||||
|
'shadow-md transition-[color,box-shadow] ',
|
||||||
|
/* Opacity */
|
||||||
|
'disabled:opacity-50 ',
|
||||||
|
/* Scaling */
|
||||||
|
'h-9 w-full min-w-0 file:h-7',
|
||||||
|
/* Spacing */
|
||||||
|
'px-3 py-1',
|
||||||
|
/* Alignment */
|
||||||
|
'flex file:inline-flex',
|
||||||
|
/* Miscellaneous */
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
@ -13,7 +13,33 @@ function Label({
|
||||||
<LabelPrimitive.Root
|
<LabelPrimitive.Root
|
||||||
data-slot='label'
|
data-slot='label'
|
||||||
className={cn(
|
className={cn(
|
||||||
'flex items-center gap-2 text-sm leading-none font-label select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
/* Text */
|
||||||
|
'text-sm',
|
||||||
|
/* Background */
|
||||||
|
'',
|
||||||
|
/* Border */
|
||||||
|
'',
|
||||||
|
/* Font */
|
||||||
|
'font-label',
|
||||||
|
/* Cursor */
|
||||||
|
'group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'',
|
||||||
|
/* Shadow */
|
||||||
|
'',
|
||||||
|
/* Opacity */
|
||||||
|
'group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50',
|
||||||
|
/* Scaling */
|
||||||
|
'',
|
||||||
|
/* Spacing */
|
||||||
|
'gap-2',
|
||||||
|
/* Alignment */
|
||||||
|
'flex items-center',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'select-none leading-none',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
@ -37,7 +37,37 @@ function SelectTrigger({
|
||||||
data-slot='select-trigger'
|
data-slot='select-trigger'
|
||||||
data-size={size}
|
data-size={size}
|
||||||
className={cn(
|
className={cn(
|
||||||
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
/* Text */
|
||||||
|
'text-sm data-[placeholder]:text-muted-foreground',
|
||||||
|
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||||
|
/* Background */
|
||||||
|
'bg-transparent dark:bg-input/30 dark:hover:bg-input/50',
|
||||||
|
/* Border */
|
||||||
|
'border rounded-md border-input focus-visible:border-ring aria-invalid:border-destructive',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'disabled:cursor-not-allowed [&_svg]:pointer-events-none',
|
||||||
|
/* Ring */
|
||||||
|
'focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:ring-destructive/20',
|
||||||
|
'dark:aria-invalid:ring-destructive/40',
|
||||||
|
/* Outline */
|
||||||
|
'outline-none',
|
||||||
|
/* Shadow */
|
||||||
|
'shadow-xs',
|
||||||
|
/* Opacity */
|
||||||
|
'disabled:opacity-50',
|
||||||
|
/* Scaling */
|
||||||
|
'w-fit data-[size=default]:h-9 data-[size=sm]:h-8 [&_svg]:shrink-0',
|
||||||
|
"[&_svg:not([class*='size-'])]:size-4",
|
||||||
|
/* Spacing */
|
||||||
|
'gap-2 px-3 py-2 *:data-[slot=select-value]:gap-2',
|
||||||
|
/* Alignment */
|
||||||
|
'flex items-center justify-between *:data-[slot=select-value]:flex',
|
||||||
|
'*:data-[slot=select-value]:items-center',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'whitespace-nowrap transition-[color,box-shadow] *:data-[slot=select-value]:line-clamp-1',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -61,9 +91,42 @@ function SelectContent({
|
||||||
<SelectPrimitive.Content
|
<SelectPrimitive.Content
|
||||||
data-slot='select-content'
|
data-slot='select-content'
|
||||||
className={cn(
|
className={cn(
|
||||||
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',
|
' ',
|
||||||
|
/* Text */
|
||||||
|
'text-popover-foreground',
|
||||||
|
/* Background */
|
||||||
|
'bg-popover',
|
||||||
|
/* Border */
|
||||||
|
'border rounded-md',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'',
|
||||||
|
/* Shadow */
|
||||||
|
'shadow-md',
|
||||||
|
/* Opacity */
|
||||||
|
'',
|
||||||
|
/* Scaling */
|
||||||
|
'max-h-(--radix-select-content-available-height) min-w-[8rem]',
|
||||||
|
/* Spacing */
|
||||||
|
'',
|
||||||
|
/* Alignment */
|
||||||
|
'relative z-50 origin-(--radix-select-content-transform-origin)',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'overflow-x-hidden overflow-y-auto data-[side=top]:slide-in-from-bottom-2',
|
||||||
|
'data-[side=right]:slide-in-from-left-2 data-[side=left]:slide-in-from-right-2',
|
||||||
|
'data-[side=bottom]:slide-in-from-top-2',
|
||||||
|
'data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95',
|
||||||
|
'data-[state=open]:fade-in-0 data-[state=open]:animate-in',
|
||||||
|
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0',
|
||||||
|
/* ////////// */
|
||||||
position === 'popper' &&
|
position === 'popper' &&
|
||||||
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1',
|
||||||
|
'data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
position={position}
|
position={position}
|
||||||
|
@ -74,7 +137,8 @@ function SelectContent({
|
||||||
className={cn(
|
className={cn(
|
||||||
'p-1',
|
'p-1',
|
||||||
position === 'popper' &&
|
position === 'popper' &&
|
||||||
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1',
|
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]',
|
||||||
|
'scroll-my-1',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
@ -107,7 +171,34 @@ function SelectItem({
|
||||||
<SelectPrimitive.Item
|
<SelectPrimitive.Item
|
||||||
data-slot='select-item'
|
data-slot='select-item'
|
||||||
className={cn(
|
className={cn(
|
||||||
"focus:bg-accent focus:text-text [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
' ',
|
||||||
|
/* Text */
|
||||||
|
"text-sm focus:text-text [&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||||
|
/* Background */
|
||||||
|
'focus:bg-accent',
|
||||||
|
/* Border */
|
||||||
|
'rounded-sm',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'cursor-default select-none data-[disabled]:pointer-events-none [&_svg]:pointer-events-none',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'outline-hidden',
|
||||||
|
/* Shadow */
|
||||||
|
'',
|
||||||
|
/* Opacity */
|
||||||
|
'data-[disabled]:opacity-50',
|
||||||
|
/* Scaling */
|
||||||
|
"w-full [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
/* Spacing */
|
||||||
|
'gap-2 py-1.5 pr-8 pl-2 *:[span]:last:gap-2',
|
||||||
|
/* Alignment */
|
||||||
|
'relative flex items-center *:[span]:last:flex *:[span]:last:items-center',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
@ -13,7 +13,33 @@ function Switch({
|
||||||
<SwitchPrimitive.Root
|
<SwitchPrimitive.Root
|
||||||
data-slot='switch'
|
data-slot='switch'
|
||||||
className={cn(
|
className={cn(
|
||||||
'peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
|
/* Text */
|
||||||
|
'',
|
||||||
|
/* Background */
|
||||||
|
'data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring dark:data-[state=unchecked]:bg-input/80',
|
||||||
|
/* Border */
|
||||||
|
'border border-transparent rounded-full',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'disabled:cursor-not-allowed',
|
||||||
|
/* Ring */
|
||||||
|
'focus-visible:ring-ring/50',
|
||||||
|
/* Outline */
|
||||||
|
'outline-none',
|
||||||
|
/* Shadow */
|
||||||
|
'shadow-xs',
|
||||||
|
/* Opacity */
|
||||||
|
'disabled:opacity-50',
|
||||||
|
/* Scaling */
|
||||||
|
'h-[1.15rem] w-8',
|
||||||
|
/* Spacing */
|
||||||
|
'',
|
||||||
|
/* Alignment */
|
||||||
|
'inline-flex shrink-0 items-center',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'peer transition-all focus-visible:ring-[3px]',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -21,7 +47,35 @@ function Switch({
|
||||||
<SwitchPrimitive.Thumb
|
<SwitchPrimitive.Thumb
|
||||||
data-slot='switch-thumb'
|
data-slot='switch-thumb'
|
||||||
className={cn(
|
className={cn(
|
||||||
'bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0',
|
/* Text */
|
||||||
|
'',
|
||||||
|
/* Background */
|
||||||
|
'bg-background dark:data-[state=unchecked]:bg-foreground',
|
||||||
|
'dark:data-[state=checked]:bg-primary-foreground',
|
||||||
|
/* Border */
|
||||||
|
'rounded-full',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'pointer-events-none',
|
||||||
|
/* Ring */
|
||||||
|
'ring-0',
|
||||||
|
/* Outline */
|
||||||
|
'',
|
||||||
|
/* Shadow */
|
||||||
|
'',
|
||||||
|
/* Opacity */
|
||||||
|
'',
|
||||||
|
/* Scaling */
|
||||||
|
'size-4',
|
||||||
|
/* Spacing */
|
||||||
|
'',
|
||||||
|
/* Alignment */
|
||||||
|
'',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'block transition-transform data-[state=checked]:translate-x-[calc(100%-2px)]',
|
||||||
|
'data-[state=unchecked]:translate-x-0',
|
||||||
|
/* ////////// */
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</SwitchPrimitive.Root>
|
</SwitchPrimitive.Root>
|
||||||
|
|
|
@ -26,8 +26,34 @@ function TabsList({
|
||||||
<TabsPrimitive.List
|
<TabsPrimitive.List
|
||||||
data-slot='tabs-list'
|
data-slot='tabs-list'
|
||||||
className={cn(
|
className={cn(
|
||||||
'bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]',
|
' ',
|
||||||
className,
|
/* Text */
|
||||||
|
'text-muted-foreground',
|
||||||
|
/* Background */
|
||||||
|
'bg-muted',
|
||||||
|
/* Border */
|
||||||
|
'rounded-lg',
|
||||||
|
/* Font */
|
||||||
|
'',
|
||||||
|
/* Cursor */
|
||||||
|
'',
|
||||||
|
/* Ring */
|
||||||
|
'',
|
||||||
|
/* Outline */
|
||||||
|
'',
|
||||||
|
/* Shadow */
|
||||||
|
'',
|
||||||
|
/* Opacity */
|
||||||
|
'',
|
||||||
|
/* Scaling */
|
||||||
|
'h-9 w-fit',
|
||||||
|
/* Spacing */
|
||||||
|
'p-[3px]',
|
||||||
|
/* Alignment */
|
||||||
|
'inline-flex items-center justify-center',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'',
|
||||||
|
/* ////////// */ className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
@ -42,7 +68,35 @@ function TabsTrigger({
|
||||||
<TabsPrimitive.Trigger
|
<TabsPrimitive.Trigger
|
||||||
data-slot='tabs-trigger'
|
data-slot='tabs-trigger'
|
||||||
className={cn(
|
className={cn(
|
||||||
"data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
/* Text */
|
||||||
|
'text-sm dark:data-[state=active]:text-foreground text-foreground dark:text-muted-foreground',
|
||||||
|
/* Background */
|
||||||
|
'data-[state=active]:bg-background dark:data-[state=active]:bg-input/30',
|
||||||
|
/* Border */
|
||||||
|
'border rounded-md focus-visible:border-ring dark:data-[state=active]:border-input',
|
||||||
|
'border-transparent',
|
||||||
|
/* Font */
|
||||||
|
'font-medium',
|
||||||
|
/* Cursor */
|
||||||
|
'disabled:pointer-events-none [&_svg]:pointer-events-none',
|
||||||
|
/* Ring */
|
||||||
|
'focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
||||||
|
/* Outline */
|
||||||
|
'focus-visible:outline-ring focus-visible:outline-1',
|
||||||
|
/* Shadow */
|
||||||
|
'data-[state=active]:shadow-sm',
|
||||||
|
/* Opacity */
|
||||||
|
'disabled:opacity-50',
|
||||||
|
/* Scaling */
|
||||||
|
"h-[calc(100%-1px)] [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
/* Spacing */
|
||||||
|
'gap-1.5 px-2 py-1 [&_svg]:shrink-0',
|
||||||
|
/* Alignment */
|
||||||
|
'inline-flex flex-1 items-center justify-center whitespace-nowrap',
|
||||||
|
'transition-[color,box-shadow]',
|
||||||
|
/* Miscellaneous */
|
||||||
|
'',
|
||||||
|
/* ////////// */
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue