Skip to content

Commit aa381da

Browse files
committed
refactor: update naming in label variants constant
1 parent 8c437a4 commit aa381da

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

packages/ui/src/components/checkbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const Checkbox = forwardRef<ElementRef<typeof CheckboxPrimitive.Root>, CheckboxP
2323
</CheckboxPrimitive.Indicator>
2424
</CheckboxPrimitive.Root>
2525
{label && (
26-
<Label className="leading-tight" theme="foreground-1" htmlFor={props.id}>
26+
<Label className="leading-tight" color="foreground-1" htmlFor={props.id}>
2727
{label}
2828
</Label>
2929
)}

packages/ui/src/components/input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
6161
return (
6262
<ControlGroup>
6363
{label && (
64-
<Label className="mb-2.5" theme={disabled ? 'foreground-9' : 'foreground-2'} optional={optional} htmlFor={id}>
64+
<Label className="mb-2.5" color={disabled ? 'foreground-9' : 'foreground-2'} optional={optional} htmlFor={id}>
6565
{label}
6666
</Label>
6767
)}

packages/ui/src/components/label.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const labelVariants = cva('peer-disabled:cursor-not-allowed peer-disabled:opacit
1111
variant: {
1212
default: 'text-sm font-normal leading-none'
1313
},
14-
theme: {
14+
color: {
1515
'foreground-1': 'text-foreground-1',
1616
'foreground-2': 'text-foreground-2',
1717
'foreground-5': 'text-foreground-5',
@@ -20,15 +20,15 @@ const labelVariants = cva('peer-disabled:cursor-not-allowed peer-disabled:opacit
2020
},
2121
defaultVariants: {
2222
variant: 'default',
23-
theme: 'foreground-1'
23+
color: 'foreground-1'
2424
}
2525
})
2626

2727
const LabelRoot = forwardRef<
2828
ElementRef<typeof LabelPrimitive.Root>,
29-
ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>
30-
>(({ className, variant, theme, ...props }, ref) => (
31-
<LabelPrimitive.Root ref={ref} className={cn(labelVariants({ variant, theme }), className)} {...props} />
29+
Omit<ComponentPropsWithoutRef<typeof LabelPrimitive.Root>, 'color'> & VariantProps<typeof labelVariants>
30+
>(({ className, variant, color, ...props }, ref) => (
31+
<LabelPrimitive.Root ref={ref} className={cn(labelVariants({ variant, color }), className)} {...props} />
3232
))
3333
LabelRoot.displayName = LabelPrimitive.Root.displayName
3434

@@ -38,9 +38,9 @@ interface LabelProps extends VariantProps<typeof labelVariants>, PropsWithChildr
3838
className?: string
3939
}
4040

41-
const Label = ({ htmlFor, optional, theme, variant, children, className }: LabelProps) => {
41+
const Label = ({ htmlFor, optional, color, variant, children, className }: LabelProps) => {
4242
return (
43-
<LabelRoot htmlFor={htmlFor} variant={variant} theme={theme} className={className}>
43+
<LabelRoot htmlFor={htmlFor} variant={variant} color={color} className={className}>
4444
{children} {optional && <span className="text-foreground-7 align-top">(optional)</span>}
4545
</LabelRoot>
4646
)

packages/ui/src/components/select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const Select: FC<SelectProps> = ({
3535
}) => (
3636
<SelectPrimitive.Root {...props}>
3737
{label && (
38-
<Label className="mb-2.5" theme={disabled ? 'foreground-9' : 'foreground-2'} htmlFor={name}>
38+
<Label className="mb-2.5" color={disabled ? 'foreground-9' : 'foreground-2'} htmlFor={name}>
3939
{label}
4040
</Label>
4141
)}

packages/ui/src/components/textarea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
2323
return (
2424
<ControlGroup>
2525
{label && (
26-
<Label className="mb-2.5" theme={disabled ? 'foreground-9' : 'foreground-2'} optional={optional} htmlFor={id}>
26+
<Label className="mb-2.5" color={disabled ? 'foreground-9' : 'foreground-2'} optional={optional} htmlFor={id}>
2727
{label}
2828
</Label>
2929
)}

0 commit comments

Comments
 (0)