@@ -10,7 +10,6 @@ import {
1010 StyledLabel
1111} from '../common/SwitchBase' ;
1212import { noOp } from '../common/utils' ;
13- import { StyledMenuListItem } from '../MenuList/MenuList' ;
1413import { StyledScrollView } from '../ScrollView/ScrollView' ;
1514import { CommonThemeProps } from '../types' ;
1615
@@ -25,7 +24,7 @@ type CheckboxProps = {
2524 onChange ?: React . ChangeEventHandler < HTMLInputElement > ;
2625 style ?: React . CSSProperties ;
2726 value ?: number | string ;
28- variant ?: 'default' | 'flat' | 'menu' ;
27+ variant ?: 'default' | 'flat' ;
2928} & Omit <
3029 React . InputHTMLAttributes < HTMLInputElement > ,
3130 | 'checked'
@@ -41,7 +40,7 @@ type CheckboxProps = {
4140
4241type CheckmarkProps = {
4342 $disabled : boolean ;
44- variant : 'default' | 'flat' | 'menu' ;
43+ variant : 'default' | 'flat' ;
4544} ;
4645
4746const sharedCheckboxStyles = css `
@@ -77,20 +76,6 @@ const StyledFlatCheckbox = styled.div<CommonThemeProps>`
7776 $disabled ? theme . flatLight : theme . canvas } ;
7877` ;
7978
80- const StyledMenuCheckbox = styled . div < CommonThemeProps > `
81- position: relative;
82- box-sizing: border-box;
83- display: inline-block;
84- background: ${ ( { $disabled, theme } ) =>
85- $disabled ? theme . flatLight : theme . canvas } ;
86- ${ sharedCheckboxStyles }
87- width: ${ size - 4 } px;
88- height: ${ size - 4 } px;
89- background: none;
90- border: none;
91- outline: none;
92- ` ;
93-
9479const CheckmarkIcon = styled . span . attrs ( ( ) => ( {
9580 'data-testid' : 'checkmarkIcon'
9681} ) ) < CheckmarkProps > `
@@ -113,30 +98,8 @@ const CheckmarkIcon = styled.span.attrs(() => ({
11398 border-width: 0 3px 3px 0;
11499 transform: translate(-50%, -50%) rotate(45deg);
115100
116- ${ ( { $disabled, theme, variant } ) =>
117- variant === 'menu'
118- ? css `
119- border-color : ${ $disabled
120- ? theme . materialTextDisabled
121- : theme . materialText } ;
122- filter : drop-shadow (
123- 1px 1px 0px
124- ${ $disabled ? theme . materialTextDisabledShadow : 'transparent' }
125- );
126- `
127- : css `
128- border-color : ${ $disabled
129- ? theme . checkmarkDisabled
130- : theme . checkmark } ;
131- ` }
132- ${ StyledMenuListItem } :hover & {
133- ${ ( { $disabled, theme, variant } ) =>
134- ! $disabled &&
135- variant === 'menu' &&
136- css `
137- border-color : ${ theme . materialTextInvert } ;
138- ` } ;
139- }
101+ border-color: ${ p =>
102+ p . $disabled ? p . theme . checkmarkDisabled : p . theme . checkmark } ;
140103 }
141104` ;
142105const IndeterminateIcon = styled . span . attrs ( ( ) => ( {
@@ -145,16 +108,9 @@ const IndeterminateIcon = styled.span.attrs(() => ({
145108 display: inline-block;
146109 position: relative;
147110
148- ${ ( { variant } ) =>
149- variant === 'menu'
150- ? css `
151- height : calc (100% - 4px );
152- width : calc (100% - 4px );
153- `
154- : css `
155- width : 100% ;
156- height : 100% ;
157- ` }
111+ width: 100%;
112+ height: 100%;
113+
158114 &:after {
159115 content: '';
160116 display: block;
@@ -167,27 +123,12 @@ const IndeterminateIcon = styled.span.attrs(() => ({
167123 mainColor : $disabled ? theme . checkmarkDisabled : theme . checkmark
168124 } ) }
169125 background-position: 0px 0px, 2px 2px;
170-
171- ${ ( { $disabled, theme, variant } ) =>
172- variant === 'menu' &&
173- css `
174- ${ StyledMenuListItem } : hover & {
175- ${ createHatchedBackground ( {
176- mainColor : theme . materialTextInvert
177- } ) }
178- }
179- filter : drop-shadow (
180- 1px 1px 0px
181- ${ $disabled ? theme . materialTextDisabledShadow : 'transparent' }
182- );
183- ` } ;
184126 }
185127` ;
186128
187129const CheckboxComponents = {
188130 flat : StyledFlatCheckbox ,
189- default : StyledCheckbox ,
190- menu : StyledMenuCheckbox
131+ default : StyledCheckbox
191132} ;
192133
193134const Checkbox = forwardRef < HTMLInputElement , CheckboxProps > (
0 commit comments