|
1 | 1 | @use 'sass:map'; |
2 | 2 | @use 'sass:math'; |
3 | 3 | @use '../../base' as *; |
4 | | -@use '../ripple/ripple-component' as *; |
5 | | -@use '../ripple/ripple-theme' as *; |
6 | 4 | @use 'igniteui-theming/sass/animations' as *; |
7 | 5 | @use '../../themes/schemas' as *; |
8 | 6 |
|
|
19 | 17 | /// @param {Color} $label-color-hover [null]- The text color used for the label text on hover. |
20 | 18 | /// @param {Color} $empty-color [null] - The unchecked border color. |
21 | 19 | /// @param {Color} $empty-color-hover [null] - The unchecked border color on hover. |
| 20 | +/// @param {Color} $empty-fill-color [null] - The unchecked fill color. |
22 | 21 | /// @param {Color} $fill-color [null] - The checked border and fill colors. |
23 | 22 | /// @param {Color} $fill-color-hover [null] - The checked border and fill colors on hover. |
24 | 23 | /// @param {Color} $tick-color [null] - The checked mark color. |
25 | | -/// @param {Color} tick-color-hover [null] - The checked mark color on hover. |
| 24 | +/// @param {Color} $tick-color-hover [null] - The checked mark color on hover. |
26 | 25 | /// @param {Color} $disabled-color [null] - The disabled border and fill colors. |
27 | 26 | /// @param {Color} $disabled-indeterminate-color [null] - The disabled border and fill colors in indeterminate state. |
28 | 27 | /// @param {Color} $disabled-color-label [null] - The disabled label color. |
|
47 | 46 | $label-color-hover: null, |
48 | 47 | $empty-color: null, |
49 | 48 | $empty-color-hover: null, |
| 49 | + $empty-fill-color: null, |
50 | 50 | $fill-color: null, |
51 | 51 | $fill-color-hover: null, |
52 | 52 | $tick-color: null, |
|
77 | 77 | label-color-hover: $label-color-hover, |
78 | 78 | empty-color: $empty-color, |
79 | 79 | empty-color-hover: $empty-color-hover, |
| 80 | + empty-fill-color: $empty-fill-color, |
80 | 81 | fill-color: $fill-color, |
81 | 82 | fill-color-hover: $fill-color-hover, |
82 | 83 | tick-color: $tick-color, |
|
99 | 100 | /// @deprecated Use the `css-vars` mixin instead. |
100 | 101 | /// @see {mixin} css-vars |
101 | 102 | /// @param {Map} $theme - The theme used to style the component. |
102 | | -/// @requires {mixin} ripple |
103 | | -/// @requires ripple-theme |
104 | 103 | @mixin checkbox($theme) { |
105 | 104 | @include css-vars($theme); |
106 | 105 | $theme-variant: map.get($theme, '_meta', 'theme-variant'); |
|
137 | 136 | indigo-design: none, |
138 | 137 | ), $variant); |
139 | 138 |
|
140 | | - $label-margin: rem(8px); |
| 139 | + $label-margin: map.get(( |
| 140 | + material: rem(12px), |
| 141 | + fluent: rem(8px), |
| 142 | + bootstrap: rem(8px), |
| 143 | + indigo-design: rem(8px), |
| 144 | + ), $variant); |
141 | 145 |
|
142 | 146 | $mark-stroke: map.get(( |
143 | 147 | material: 3, |
|
147 | 151 | ), $variant); |
148 | 152 |
|
149 | 153 | $mark-offset: map.get(( |
150 | | - material: 0, |
| 154 | + material: .5px, |
151 | 155 | fluent: -1px, |
152 | | - bootstrap: 0, |
153 | | - indigo-design: 0, |
| 156 | + bootstrap: .5px, |
| 157 | + indigo-design: 1px, |
154 | 158 | ), $variant); |
155 | 159 |
|
156 | 160 | $mark-length: 24; |
|
159 | 163 | $ripple-size: rem(40px); |
160 | 164 | $ripple-radius: math.div($ripple-size, 2); |
161 | 165 |
|
162 | | - $ripple-theme: ripple-theme( |
163 | | - $schema: $light-material-schema, |
164 | | - $color: var-get($theme, 'fill-color') |
165 | | - ); |
166 | | - |
167 | 166 | @include scale-in-center(); |
168 | 167 |
|
169 | 168 | %cbx-display { |
|
191 | 190 | position: relative; |
192 | 191 | width: $size; |
193 | 192 | height: $size; |
| 193 | + |
| 194 | + //ripple color |
| 195 | + --color: #{var-get($theme, 'empty-color')}; |
| 196 | + } |
| 197 | + |
| 198 | + %cbx-composite-wrapper--x { |
| 199 | + //ripple color |
| 200 | + --color: #{var-get($theme, 'fill-color')}; |
194 | 201 | } |
195 | 202 |
|
196 | 203 | %cbx-composite { |
|
200 | 207 | width: $size; |
201 | 208 | height: $size; |
202 | 209 | min-width: $size; |
| 210 | + background: var-get($theme, 'empty-fill-color'); |
203 | 211 | border-width: $border-width; |
204 | 212 | border-style: solid; |
205 | 213 | border-color: var-get($theme, 'empty-color'); |
|
210 | 218 | } |
211 | 219 |
|
212 | 220 | %cbx-composite--hover { |
213 | | - @if $variant == 'indigo-design' { |
| 221 | + @if $variant == 'indigo-design' or $variant == 'bootstrap' { |
214 | 222 | border-color: var-get($theme, 'empty-color-hover'); |
215 | 223 | } |
216 | 224 | } |
|
222 | 230 |
|
223 | 231 | %cbx-composite--invalid { |
224 | 232 | border-color: var-get($theme, 'error-color'); |
| 233 | + |
| 234 | + @if $variant == 'bootstrap' and $theme-variant == 'dark' { |
| 235 | + %cbx-composite-mark { |
| 236 | + stroke: black; |
| 237 | + } |
| 238 | + } |
| 239 | + } |
| 240 | + |
| 241 | + %cbx-composite-wrapper--invalid { |
| 242 | + //ripple color |
| 243 | + --color: #{var-get($theme, 'error-color')}; |
225 | 244 | } |
226 | 245 |
|
227 | 246 | %cbx-composite--invalid--hover { |
228 | | - @if $variant != 'bootstrap' { |
229 | | - border-color: var-get($theme, 'error-color-hover'); |
230 | | - } @else { |
231 | | - border-color: var-get($theme, 'error-color'); |
232 | | - } |
| 247 | + border-color: var-get($theme, 'error-color-hover'); |
233 | 248 | } |
234 | 249 |
|
235 | 250 | %cbx-composite--x--invalid { |
|
243 | 258 | } |
244 | 259 |
|
245 | 260 | %cbx-composite--x--invalid--hover { |
246 | | - @if $variant != 'bootstrap' { |
247 | | - border-color: var-get($theme, 'error-color-hover'); |
248 | | - background: var-get($theme, 'error-color-hover'); |
249 | | - } @else { |
250 | | - border-color: var-get($theme, 'error-color'); |
251 | | - background: var-get($theme, 'error-color'); |
252 | | - } |
| 261 | + border-color: var-get($theme, 'error-color-hover'); |
| 262 | + background: var-get($theme, 'error-color-hover'); |
253 | 263 | } |
254 | 264 |
|
255 | 265 | %cbx-composite--disabled { |
256 | 266 | border-color: var-get($theme, 'disabled-color'); |
257 | | - background: transparent; |
258 | 267 |
|
259 | | - @if $bootstrap-theme { |
260 | | - border-color: var-get($theme, 'disabled-color-label'); |
| 268 | + @if $variant == 'bootstrap' and $theme-variant == 'dark' { |
| 269 | + background: color($color: 'surface', $variant: 500); |
261 | 270 | } |
262 | 271 | } |
263 | 272 |
|
264 | 273 | %cbx-composite--x--disabled { |
265 | | - @if $variant != 'indigo-design' { |
| 274 | + @if $variant == 'material' or $variant == 'fluent' { |
266 | 275 | background: var-get($theme, 'disabled-color'); |
267 | 276 | } |
268 | 277 |
|
|
273 | 282 | } |
274 | 283 |
|
275 | 284 | @if $bootstrap-theme { |
276 | | - border-color: var-get($theme, 'disabled-color'); |
| 285 | + background: var-get($theme, 'disabled-indeterminate-color'); |
| 286 | + border-color: transparent; |
277 | 287 | } |
278 | 288 | } |
279 | 289 |
|
|
289 | 299 | opacity: 0; |
290 | 300 | z-index: 1; |
291 | 301 | transition: opacity .1s $ease-out-quad; |
| 302 | + |
| 303 | + @if $variant == 'material' { |
| 304 | + inset-inline-start: -.5px; |
| 305 | + } |
292 | 306 | } |
293 | 307 |
|
294 | 308 | %igx-checkbox--indeterminate { |
|
303 | 317 |
|
304 | 318 | @if $variant != 'fluent' { |
305 | 319 | background: var-get($theme, 'fill-color-hover'); |
| 320 | + } @else { |
| 321 | + background: transparent; |
306 | 322 | } |
307 | 323 |
|
308 | 324 | &::before { |
|
325 | 341 |
|
326 | 342 | %cbx-composite { |
327 | 343 | background: transparent; |
328 | | - |
| 344 | + |
329 | 345 | &::before { |
330 | 346 | content: ''; |
331 | 347 | position: absolute; |
|
356 | 372 | } |
357 | 373 |
|
358 | 374 | %cbx-composite--x--hover { |
359 | | - @if $variant != 'bootstrap' { |
360 | | - border-color: var-get($theme, 'error-color-hover'); |
361 | | - background: var-get($theme, 'error-color-hover'); |
362 | | - } @else { |
363 | | - border-color: var-get($theme, 'error-color'); |
364 | | - background: var-get($theme, 'error-color'); |
365 | | - } |
| 375 | + border-color: var-get($theme, 'error-color-hover'); |
| 376 | + background: var-get($theme, 'error-color-hover'); |
366 | 377 | } |
367 | 378 |
|
368 | 379 | @if $variant == 'fluent' { |
|
380 | 391 |
|
381 | 392 | &:hover { |
382 | 393 | %cbx-composite { |
| 394 | + background: transparent; |
383 | 395 | border-color: var-get($theme, 'error-color-hover'); |
384 | 396 |
|
385 | 397 | &::before { |
|
420 | 432 | @if $variant == 'fluent' { |
421 | 433 | stroke: var-get($theme, 'error-color'); |
422 | 434 | } |
| 435 | + |
| 436 | + @if $variant == 'fluent' and $theme-variant == 'dark' { |
| 437 | + stroke: color($color: 'error', $variant: 500); |
| 438 | + } |
423 | 439 | } |
424 | 440 |
|
425 | 441 | %cbx-composite-mark--in--fluent { |
|
434 | 450 | cursor: pointer; |
435 | 451 | user-select: none; |
436 | 452 | word-wrap: break-all; |
| 453 | + transition: color .2s $ease-out-quad; |
437 | 454 |
|
438 | 455 | &:empty { |
439 | 456 | margin: 0; |
|
473 | 490 | } |
474 | 491 |
|
475 | 492 | %cbx-ripple { |
476 | | - @include ripple($ripple-theme); |
477 | | - @include css-vars($ripple-theme); |
478 | 493 | display: $ripple-display; |
479 | 494 | position: absolute; |
480 | 495 | top: calc(50% - #{$ripple-radius}); |
|
507 | 522 | %igx-checkbox--focused { |
508 | 523 | @if $variant == 'fluent' { |
509 | 524 | position: relative; |
510 | | - $focus-outline-offset-top: rem(2px); |
511 | | - $focus-outline-offset-left: rem(2px); |
| 525 | + $focus-outline-offset: rem(2px); |
512 | 526 |
|
513 | 527 | &::after { |
514 | 528 | content: ''; |
515 | 529 | position: absolute; |
516 | | - top: -$focus-outline-offset-top; |
517 | | - inset-inline-start: -$focus-outline-offset-left; |
| 530 | + inset: -$focus-outline-offset; |
518 | 531 | box-shadow: 0 0 0 rem(1px) var-get($theme, 'focus-outline-color'); |
519 | | - width: calc(100% + (#{$focus-outline-offset-left} * 2)); |
520 | | - height: calc(100% + (#{$focus-outline-offset-top} * 2)); |
521 | 532 | } |
522 | 533 | } |
523 | 534 |
|
524 | 535 | @if $variant == 'bootstrap' { |
525 | 536 | %cbx-composite { |
526 | 537 | border-radius: var-get($theme, 'border-radius'); |
527 | | - box-shadow: 0 0 0 rem(2px) var-get($theme, 'focus-outline-color'); |
| 538 | + border-color: color($color: 'primary', $variant: 200); |
| 539 | + box-shadow: 0 0 0 rem(4px) var-get($theme, 'focus-outline-color'); |
528 | 540 | } |
529 | 541 | } |
530 | 542 |
|
|
536 | 548 | } |
537 | 549 | } |
538 | 550 |
|
| 551 | + %igx-checkbox--focused-hovered { |
| 552 | + @if $variant == 'bootstrap' { |
| 553 | + %cbx-composite { |
| 554 | + border-color: color($color: 'primary', $variant: 300); |
| 555 | + } |
| 556 | + } |
| 557 | + } |
| 558 | + |
539 | 559 | %igx-checkbox--focused-checked { |
540 | 560 | @if $variant == 'indigo-design' { |
541 | 561 | %cbx-composite { |
542 | 562 | border-radius: var-get($theme, 'border-radius'); |
543 | 563 | box-shadow: 0 0 0 rem(3px) var-get($theme, 'focus-outline-color-focused'); |
544 | 564 | } |
545 | 565 | } |
| 566 | + |
| 567 | + @if $variant == 'bootstrap' { |
| 568 | + %cbx-composite { |
| 569 | + border-color: transparent; |
| 570 | + } |
| 571 | + } |
546 | 572 | } |
547 | 573 |
|
548 | 574 | %igx-checkbox--focused-invalid { |
549 | 575 | @if $variant == 'bootstrap' { |
550 | 576 | %cbx-composite { |
551 | | - box-shadow: 0 0 0 rem(2px) var-get($theme, 'error-color-hover'); |
| 577 | + border-color: var-get($theme, 'error-color'); |
| 578 | + box-shadow: 0 0 0 rem(4px) var-get($theme, 'focus-outline-color-error'); |
| 579 | + } |
| 580 | + |
| 581 | + &:hover { |
| 582 | + %cbx-composite { |
| 583 | + border-color: var-get($theme, 'error-color-hover'); |
| 584 | + } |
552 | 585 | } |
553 | 586 | } |
554 | 587 |
|
|
0 commit comments