@@ -4,7 +4,10 @@ import {
4
4
} from '@umbraco-ui/uui-base/lib/animations' ;
5
5
import { defineElement } from '@umbraco-ui/uui-base/lib/registration' ;
6
6
import { UUIBooleanInputElement } from '@umbraco-ui/uui-boolean-input/lib' ;
7
- import { iconCheck } from '@umbraco-ui/uui-icon-registry-essential/lib/svgs' ;
7
+ import {
8
+ iconCheck ,
9
+ iconSubtract ,
10
+ } from '@umbraco-ui/uui-icon-registry-essential/lib/svgs' ;
8
11
import { css , html } from 'lit' ;
9
12
10
13
/**
@@ -25,7 +28,9 @@ export class UUICheckboxElement extends UUIBooleanInputElement {
25
28
renderCheckbox ( ) {
26
29
return html `
27
30
<div id= "ticker" >
28
- <div id= "icon-check" > ${ iconCheck } </ div>
31
+ <div id= "icon-check" >
32
+ ${ this . indeterminate ? iconSubtract : iconCheck }
33
+ </ div>
29
34
</ div>
30
35
` ;
31
36
}
@@ -83,15 +88,18 @@ export class UUICheckboxElement extends UUIBooleanInputElement {
83
88
var (--uui-color-surface-emphasis )
84
89
);
85
90
}
86
- input : checked : not ([disabled ]) + # ticker {
91
+ input : checked : not ([disabled ]) + # ticker ,
92
+ input : indeterminate : not ([disabled ]) + # ticker {
87
93
border-color : var (--uui-color-selected );
88
94
}
89
95
90
- label : hover input : checked : not ([disabled ]) + # ticker {
96
+ label : hover input : checked : not ([disabled ]) + # ticker ,
97
+ label : hover input : indeterminate : not ([disabled ]) + # ticker {
91
98
border-color : var (--uui-color-selected-emphasis );
92
99
}
93
100
94
- label : focus input : checked + # ticker {
101
+ label : focus input : checked + # ticker ,
102
+ label : focus input : indeterminate + # ticker {
95
103
border-color : var (--uui-color-selected-emphasis );
96
104
}
97
105
@@ -126,18 +134,22 @@ export class UUICheckboxElement extends UUIBooleanInputElement {
126
134
transform : scale (0 );
127
135
opacity : 0 ;
128
136
}
129
- label : hover input : checked : not ([disabled ]) + # ticker ::before {
137
+ label : hover input : checked : not ([disabled ]) + # ticker ::before ,
138
+ label : hover input : indeterminate : not ([disabled ]) + # ticker ::before {
130
139
background-color : var (--uui-color-selected-emphasis );
131
140
}
132
141
133
- input : checked + # ticker ::before {
142
+ input : checked + # ticker ::before ,
143
+ input : indeterminate + # ticker ::before {
134
144
transform : scale (1 );
135
145
opacity : 1 ;
136
146
}
137
- input : checked + # ticker # icon-check {
147
+ input : checked + # ticker # icon-check ,
148
+ input : indeterminate + # ticker # icon-check {
138
149
opacity : 1 ;
139
150
}
140
- label : focus input : checked + # ticker {
151
+ label : focus input : checked + # ticker ,
152
+ label : focus input : indeterminate + # ticker {
141
153
background-color : var (--uui-color-selected-emphasis );
142
154
}
143
155
@@ -154,15 +166,27 @@ export class UUICheckboxElement extends UUIBooleanInputElement {
154
166
transform : scale (0.9 );
155
167
}
156
168
169
+ : host (: not ([disabled ], [readonly ]))
170
+ label : active
171
+ input : indeterminate
172
+ + # ticker ::before {
173
+ /** Stretch when mouse down */
174
+ transform : scale (0.9 );
175
+ }
176
+
157
177
: host (: not ([pristine ]): invalid ) # ticker ,
158
178
: host (: not ([pristine ]): invalid ) label : hover # ticker ,
159
179
: host (: not ([pristine ]): invalid ) label : hover input : checked : not ([disabled ]) + # ticker ,
180
+ : host (: not ([pristine ]): invalid ) label : hover input : indeterminate : not ([disabled ]) + # ticker ,
160
181
: host (: not ([pristine ]): invalid ) label : focus input : checked + # ticker ,
182
+ : host (: not ([pristine ]): invalid ) label : focus input : indeterminate + # ticker ,
161
183
/* polyfill support */
162
184
: host (: not ([pristine ])[internals-invalid ]) # ticker ,
163
185
: host (: not ([pristine ])[internals-invalid ]) label : hover # ticker ,
164
186
: host (: not ([pristine ])[internals-invalid ]) label : hover input : checked : not ([disabled ]) + # ticker ,
165
- : host (: not ([pristine ])[internals-invalid ]) label : focus input : checked + # ticker {
187
+ : host (: not ([pristine ])[internals-invalid ]) label : hover input : indeterminate : not ([disabled ]) + # ticker ,
188
+ : host (: not ([pristine ])[internals-invalid ]) label : focus input : checked + # ticker ,
189
+ : host (: not ([pristine ])[internals-invalid ]) label : focus input : indeterminate + # ticker {
166
190
border : 1px solid var (--uui-color-danger-standalone );
167
191
}
168
192
@@ -172,6 +196,9 @@ export class UUICheckboxElement extends UUIBooleanInputElement {
172
196
: host ([disabled ]) input : checked + # ticker {
173
197
background-color : var (--uui-color-disabled );
174
198
}
199
+ : host ([disabled ]) input : indeterminate + # ticker {
200
+ background-color : var (--uui-color-disabled );
201
+ }
175
202
: host ([disabled ]) # ticker ::before {
176
203
background-color : var (--uui-color-disabled );
177
204
}
@@ -181,7 +208,8 @@ export class UUICheckboxElement extends UUIBooleanInputElement {
181
208
: host ([disabled ]) label : active # ticker {
182
209
animation : ${ UUIHorizontalShakeAnimationValue } ;
183
210
}
184
- : host ([disabled ]) input : checked + # ticker # icon-check {
211
+ : host ([disabled ]) input : checked + # ticker # icon-check ,
212
+ : host ([disabled ]) input : indeterminate + # ticker # icon-check {
185
213
color : var (--uui-color-disabled-contrast );
186
214
}
187
215
` ,
0 commit comments