Skip to content

Commit 8d0f6d6

Browse files
author
Konstantin Dinev
authored
Merge branch 'master' into rkaraivanov/textarea
2 parents 2eeb443 + 4bcf648 commit 8d0f6d6

11 files changed

Lines changed: 500 additions & 345 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@use 'sass:map';
2+
@use '../../../../styles/utilities' as *;
3+
@use '../../../../styles/themes/schemas' as *;
4+
5+
@mixin theme() {
6+
$schema: extend(
7+
(
8+
name: 'ig-switch'
9+
),
10+
map.get($dark-bootstrap-schema, 'switch')
11+
);
12+
$theme: digest-schema($schema);
13+
14+
igc-switch {
15+
@include css-vars($theme);
16+
}
17+
}
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1+
@use 'sass:map';
12
@use '../../../../styles/utilities' as *;
3+
@use '../../../../styles/themes/schemas' as *;
24

35
@mixin theme() {
6+
$schema: extend(
7+
(
8+
name: 'switch'
9+
),
10+
map.get($dark-fluent-schema, 'switch')
11+
);
12+
$theme: digest-schema($schema);
13+
414
igc-switch {
5-
--thumb-color: #{color(gray, 500)};
6-
--disabled-thumb-color: #{color(gray, 100)};
7-
--hover-color: #{color(gray, 900)};
8-
--checked-hover-color: #{color(primary, 200)};
9-
--invalid-color: #{color(error, 200)};
10-
--invalid-hover-color: #{color(error, 100)};
11-
--disabled-color: #{color(gray, 200)};
15+
@include css-vars($theme);
1216
}
1317
}
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1+
@use 'sass:map';
12
@use '../../../../styles/utilities' as *;
3+
@use '../../../../styles/themes/schemas' as *;
24

35
@mixin theme() {
6+
$schema: extend(
7+
(
8+
name: 'ig-switch'
9+
),
10+
map.get($dark-indigo-schema, 'switch')
11+
);
12+
$theme: digest-schema($schema);
13+
414
igc-switch {
5-
--border-color: #{color(gray, 700)};
6-
--checked-color: #{color(gray, 900)};
7-
--thumb-color: #{color(gray, 700)};
8-
--disabled-color: #{color(gray, 400)};
15+
@include css-vars($theme);
916
}
1017
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@use 'sass:map';
2+
@use '../../../../styles/utilities' as *;
3+
@use '../../../../styles/themes/schemas' as *;
4+
5+
@mixin theme() {
6+
$schema: extend(
7+
(
8+
name: 'ig-switch'
9+
),
10+
map.get($dark-material-schema, 'switch')
11+
);
12+
$theme: digest-schema($schema);
13+
14+
igc-switch {
15+
@include css-vars($theme);
16+
17+
&:hover {
18+
&::part(thumb) {
19+
&::after {
20+
opacity: .12;
21+
}
22+
}
23+
24+
&::part(thumb checked) {
25+
&::after {
26+
opacity: .12;
27+
}
28+
}
29+
}
30+
31+
&:focus-within {
32+
&::part(thumb) {
33+
&::after {
34+
opacity: .24;
35+
}
36+
}
37+
38+
&::part(thumb checked) {
39+
&::after {
40+
opacity: .24;
41+
}
42+
}
43+
}
44+
}
45+
}
Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,59 @@
1+
@use 'sass:map';
12
@use '../../../../styles/common/component';
23
@use '../../../../styles/utilities' as *;
4+
@use '../../../../styles/themes/schemas' as *;
35

46
:host {
57
display: inline-flex;
68
font-family: var(--ig-font-family);
7-
8-
--size: #{rem(36px)};
9-
--thumb-size: #{rem(20px)};
10-
--thumb-offset: #{rem(-1px)};
119
}
1210

1311
input[type='checkbox'] {
1412
@include hide-default();
1513
}
1614

17-
label {
15+
[part~='base'] {
1816
display: flex;
1917
flex-flow: row nowrap;
2018
align-items: center;
2119
cursor: pointer;
22-
gap: rem(8px);
23-
24-
&:hover [part~='thumb'] {
25-
&::after {
26-
background: color(gray, 600, .06);
27-
}
28-
}
29-
30-
&:focus-within [part~='thumb'] {
31-
&::after {
32-
background: color(gray, 600, .12);
33-
}
34-
}
20+
gap: var(--label-gap);
3521
}
3622

3723
[part~='control'] {
3824
display: flex;
3925
flex-shrink: 0;
4026
align-items: center;
4127
user-select: none;
42-
transition: all .2s ease-in-out;
4328
}
4429

4530
[part~='thumb'] {
46-
@include border-radius(rem(10px));
47-
4831
position: relative;
49-
animation-name: thumb-off;
5032
animation-duration: .2s;
5133
animation-fill-mode: none;
34+
}
35+
36+
[part~='control'],
37+
[part~='thumb'] {
5238
transition: all .2s ease-in-out;
5339
}
5440

5541
[part~='thumb'][part~='checked'] {
56-
animation-name: thumb-on;
5742
animation-duration: .2s;
5843
animation-fill-mode: forwards;
5944
}
6045

6146
[part~='label'] {
62-
@include type-style('subtitle-1');
63-
6447
display: inline-block;
65-
color: color(gray, 900);
6648
cursor: pointer;
6749
user-select: none;
68-
word-wrap: break-all;
69-
transition: all .2s ease-in-out;
50+
word-wrap: break-word;
7051
}
7152

7253
:host([disabled]) {
7354
user-select: none;
7455
pointer-events: none;
7556
cursor: initial;
76-
77-
[part~='label'] {
78-
color: color(gray, 400);
79-
}
80-
}
81-
82-
:host(:not([disabled])[invalid]) {
83-
[part~='label'] {
84-
color: color(error, 500);
85-
}
86-
87-
[part~='thumb'] {
88-
background: color(error, 500);
89-
}
9057
}
9158

9259
:host([label-position='before']) {
@@ -101,16 +68,17 @@ label {
10168
}
10269

10370
to {
104-
margin-inline-start: calc(var(--size) - var(--thumb-size) - var(--thumb-offset));
71+
margin-inline-start: calc(var(--size) - var(--thumb-size));
10572
}
10673
}
10774

10875
@keyframes thumb-off {
10976
from {
110-
margin-inline-start: calc(var(--size) - var(--thumb-size) - var(--thumb-offset));
77+
margin-inline-start: calc(var(--size) - var(--thumb-size));
11178
}
11279

11380
to {
11481
margin-inline-start: var(--thumb-offset);
11582
}
11683
}
84+

0 commit comments

Comments
 (0)