66 checkbox_indeterminate ,
77} from '@equinor/eds-icons'
88import { TypographyNext } from '../../Typography'
9+ import { Icon } from '../Icon'
910import type { CheckboxProps } from './Checkbox.types'
1011
1112const classNames = ( ...classes : ( string | boolean | undefined ) [ ] ) =>
@@ -39,8 +40,6 @@ export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
3940
4041 const labelClasses = classNames ( 'eds-checkbox__label' )
4142
42- const iconClasses = classNames ( 'eds-checkbox__icon' )
43-
4443 const sharedWrapperProps : Record < string , unknown > = {
4544 style,
4645 'data-disabled' : disabled ? 'true' : undefined ,
@@ -64,53 +63,18 @@ export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
6463 data-indeterminate = { indeterminate }
6564 { ...rest }
6665 />
67- { indeterminate ? (
68- < svg
69- className = { iconClasses }
70- viewBox = "0 0 24 24"
71- xmlns = "http://www.w3.org/2000/svg"
72- aria-hidden = "true"
73- >
74- < path
75- className = "eds-checkbox__icon-path eds-checkbox__icon-path--indeterminate"
76- fillRule = "evenodd"
77- clipRule = "evenodd"
78- d = {
79- Array . isArray ( checkbox_indeterminate . svgPathData )
80- ? checkbox_indeterminate . svgPathData . join ( ' ' )
81- : checkbox_indeterminate . svgPathData
82- }
83- />
84- </ svg >
85- ) : (
86- < svg
87- className = { iconClasses }
88- viewBox = "0 0 24 24"
89- xmlns = "http://www.w3.org/2000/svg"
90- aria-hidden = "true"
91- >
92- < path
93- className = "eds-checkbox__icon-path eds-checkbox__icon-path--checked"
94- fillRule = "evenodd"
95- clipRule = "evenodd"
96- d = {
97- Array . isArray ( checkbox . svgPathData )
98- ? checkbox . svgPathData . join ( ' ' )
99- : checkbox . svgPathData
100- }
101- />
102- < path
103- className = "eds-checkbox__icon-path eds-checkbox__icon-path--unchecked"
104- fillRule = "evenodd"
105- clipRule = "evenodd"
106- d = {
107- Array . isArray ( checkbox_outline . svgPathData )
108- ? checkbox_outline . svgPathData . join ( ' ' )
109- : checkbox_outline . svgPathData
110- }
111- />
112- </ svg >
113- ) }
66+ < Icon
67+ data = { checkbox }
68+ className = "eds-checkbox__icon eds-checkbox__icon--checked"
69+ />
70+ < Icon
71+ data = { checkbox_outline }
72+ className = "eds-checkbox__icon eds-checkbox__icon--unchecked"
73+ />
74+ < Icon
75+ data = { checkbox_indeterminate }
76+ className = "eds-checkbox__icon eds-checkbox__icon--indeterminate"
77+ />
11478 </ span >
11579 )
11680
0 commit comments