From a1469e40f1aa417f8080b12801366a343eef3908 Mon Sep 17 00:00:00 2001 From: Tobias Barsnes Date: Tue, 30 Apr 2024 08:27:34 +0200 Subject: [PATCH] feat(Label): Remove deprecated `as` prop (#1904) --- .../src/components/Typography/Label/Label.tsx | 60 +++++++++---------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/packages/react/src/components/Typography/Label/Label.tsx b/packages/react/src/components/Typography/Label/Label.tsx index b315ab8827..bf95423486 100644 --- a/packages/react/src/components/Typography/Label/Label.tsx +++ b/packages/react/src/components/Typography/Label/Label.tsx @@ -3,8 +3,6 @@ import { forwardRef } from 'react'; import cl from 'clsx'; import { Slot } from '@radix-ui/react-slot'; -import type { OverridableComponent } from '../../../types/OverridableComponent'; - import classes from './Label.module.css'; type FontWeights = 'regular' | 'medium' | 'semibold'; @@ -30,36 +28,34 @@ const fontWeightsClasses: Record = { }; /** Use `Label` for labels. */ -export const Label: OverridableComponent = - forwardRef( - ( - { - className, - size = 'medium', - spacing, - as = 'label', - weight = 'medium', - asChild, - ...rest - }, - ref, - ) => { - const Component = asChild ? Slot : as; - - return ( - - ); +export const Label = forwardRef( + ( + { + className, + size = 'medium', + spacing, + weight = 'medium', + asChild, + ...rest }, - ); + ref, + ) => { + const Component = asChild ? Slot : 'label'; + + return ( + + ); + }, +); Label.displayName = 'Label';