File tree Expand file tree Collapse file tree 3 files changed +15
-12
lines changed Expand file tree Collapse file tree 3 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { flexCss, FlexVariants } from '../flex/flex';
7
7
8
8
import styles from './form-field.module.css' ;
9
9
10
- type LabelProps < C extends ElementType > = PolyProps <
10
+ export type LabelProps < C extends ElementType > = PolyProps <
11
11
C ,
12
12
FlexVariants & {
13
13
label : ReactNode ;
@@ -16,7 +16,7 @@ type LabelProps<C extends ElementType> = PolyProps<
16
16
size ?: 'sm' | 'md' | 'lg' ;
17
17
}
18
18
> ;
19
- type LabelComponent = < C extends ElementType = 'label' > ( props : LabelProps < C > ) => ReactElement | null ;
19
+ export type LabelComponent = < C extends ElementType = 'label' > ( props : LabelProps < C > ) => ReactElement | null ;
20
20
21
21
export const Label : LabelComponent = forwardRef (
22
22
< C extends ElementType = 'label' > (
Original file line number Diff line number Diff line change 1
1
import {
2
2
ComponentProps ,
3
+ ElementType ,
3
4
forwardRef ,
4
5
ForwardRefExoticComponent ,
5
6
ReactElement ,
@@ -18,6 +19,8 @@ import { ListItem, ListItemVariants } from '../shared/list-item';
18
19
import { useIsomorphicLayoutEffect } from '../utils/hooks' ;
19
20
import { Presence } from '../shared/presence' ;
20
21
22
+ import type { LabelComponent , LabelProps } from '../form-field/label' ;
23
+ import type { PolyRef } from '../utils/polymorphic' ;
21
24
import styles from './menu.module.css' ;
22
25
23
26
interface MenuProps {
@@ -109,13 +112,15 @@ export const Separator = (props: ComponentProps<'div'>) => {
109
112
return < div { ...props } className = { clsx ( styles . separator , props . className ) } /> ;
110
113
} ;
111
114
112
- const MenuLabel = forwardRef ( ( props , ref ) => {
113
- return (
114
- < RdxMenu . Label asChild >
115
- < Label { ...props } ref = { ref } />
116
- </ RdxMenu . Label >
117
- ) ;
118
- } ) as typeof Label ;
115
+ const MenuLabel : LabelComponent = forwardRef (
116
+ < C extends ElementType = 'label' > ( props : LabelProps < C > , ref : PolyRef < C > ) => {
117
+ return (
118
+ < RdxMenu . Label asChild >
119
+ < Label { ...props } ref = { ref } />
120
+ </ RdxMenu . Label >
121
+ ) ;
122
+ }
123
+ ) ;
119
124
120
125
MenuRoot . List = List ;
121
126
MenuRoot . Item = MenuItem ;
Original file line number Diff line number Diff line change @@ -22,9 +22,7 @@ export const ColorBox = ({ color, className }: ColorBoxProps) => {
22
22
return (
23
23
< div className = { `w-1/4 flex-1 grow-0 basis-1/4 p-2 last-of-type:grow ${ className } ` } >
24
24
< Column className = "h-full" >
25
- < Text textStyle = "label-sm" weight = { 600 } >
26
- { color }
27
- </ Text >
25
+ < Text textStyle = "label-sm" > { color } </ Text >
28
26
< Text textStyle = "mono-sm" > { defaultTheme . colors [ color ] } </ Text >
29
27
< div className = "self-end mt-auto" >
30
28
< CopyButton label = "Copy color token" text = { color } />
You can’t perform that action at this time.
0 commit comments