This repository was archived by the owner on Dec 29, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 1
- import type { CheckboxProps , ToggleProps } from '@react-types/checkbox' ;
1
+ import type {
2
+ CheckboxProps as RTCheckboxProps ,
3
+ ToggleProps ,
4
+ } from '@react-types/checkbox' ;
2
5
import { gsap } from 'gsap' ;
3
- import type { ComponentPropsWithRef } from 'react' ;
6
+ import type { ComponentPropsWithRef , ReactNode } from 'react' ;
4
7
import { useEffect , useRef } from 'react' ;
5
8
import { useCheckbox } from 'react-aria' ;
6
9
import { useToggleState } from 'react-stately' ;
@@ -67,19 +70,18 @@ const IconContainer = styled('div', {
67
70
transform : 'translate(-50%, -50%)' ,
68
71
} ) ;
69
72
70
- type CustomCheckboxProps = {
71
- text ?: string ;
73
+ type CheckboxProps = RTCheckboxProps & {
74
+ label ?: ReactNode ;
72
75
} ;
73
-
74
76
export const Checkbox = ( {
75
77
validationState,
76
- text ,
78
+ label ,
77
79
defaultSelected,
78
80
isIndeterminate,
79
81
...restProps
80
82
} : CheckboxProps &
81
83
ComponentPropsWithRef < 'input' > &
82
- CustomCheckboxProps &
84
+ RTCheckboxProps &
83
85
ToggleProps ) => {
84
86
const ref = useRef < HTMLInputElement > ( null ) ;
85
87
const { isSelected, toggle, setSelected } = useToggleState ( {
@@ -117,7 +119,7 @@ export const Checkbox = ({
117
119
< IconContainer >
118
120
< CheckIcon strokeDashoffset = { isSelected ? '' : '21' } />
119
121
</ IconContainer >
120
- { text }
122
+ { label }
121
123
</ Label >
122
124
) ;
123
125
} ;
You can’t perform that action at this time.
0 commit comments