File tree Expand file tree Collapse file tree 1 file changed +42
-24
lines changed Expand file tree Collapse file tree 1 file changed +42
-24
lines changed Original file line number Diff line number Diff line change 11
11
</script >
12
12
13
13
<label
14
- class:custom-icon ={icon }
15
14
for ={input }
16
15
class =" m3-font-label-large"
17
- style ="display: {display };"
16
+ style ="display: {display }; overflow: hidden; "
18
17
{...extraOptions }
19
18
>
20
19
<div class =" layer" />
21
- <div class =" pad" />
22
20
{#if icon }
23
21
<div class =" custom icon" >
24
22
<Icon {icon } />
27
25
<div class =" check icon" >
28
26
<Icon icon ={iconCheck } />
29
27
</div >
28
+ <div class =" start-pad pad" />
30
29
<slot />
31
- <div class ="pad" class:hidden ={icon } />
30
+ {#if ! icon }
31
+ <div class =" end-pad pad" />
32
+ {/if }
32
33
</label >
33
34
34
35
<style >
60
61
inset : 0 ;
61
62
transition : all 200ms ;
62
63
}
63
- .icon ,
64
- .pad {
64
+ .icon {
65
+ height : 1.125 rem ;
65
66
transition : all 200ms ;
66
67
flex-shrink : 0 ;
68
+ transform-origin : 0.563rem 0.563rem ;
67
69
}
68
70
.icon > :global(svg ) {
69
71
width : 1.125rem ;
70
72
height : 1.125rem ;
71
73
}
72
- .pad {
73
- width : 0.8125rem ; /* (1.125 + 0.5) / 2 */
74
- }
75
74
76
- .custom-icon .icon {
77
- transition : none ;
78
- }
79
- :global(input :checked ) + label > .pad ,
80
- label .custom-icon > .pad {
75
+ .check.icon {
81
76
width : 0 ;
77
+ opacity : 0 ;
82
78
}
83
- .icon {
84
- width : 0 ;
85
- height : 1.125rem ;
86
- overflow : hidden ;
79
+ :global(input :checked ) + label > .check.icon {
80
+ opacity : 1 ;
87
81
}
88
- :global(input :checked ) + label > .check.icon ,
89
- .custom.icon {
90
- width : 1.125rem ;
91
- margin-right : 0.5rem ;
82
+ .custom.icon + .check.icon {
83
+ rotate : -60deg ;
92
84
}
93
- :global(input :checked ) + label > .custom.icon {
85
+ :global(input :checked ) + label > .custom.icon + .check.icon {
86
+ rotate : 0deg ;
87
+ }
88
+ .custom.icon {
94
89
width : 0 ;
95
- margin-right : 0 ;
90
+ opacity : 0 ;
91
+ rotate : 60deg ;
92
+ }
93
+ :global(input :not (:checked )) + label > .custom.icon {
94
+ opacity : 1 ;
95
+ rotate : 0deg ;
96
+ }
97
+
98
+ .pad {
99
+ transition : all 200ms ;
100
+ flex-shrink : 0 ;
101
+ }
102
+ .start-pad {
103
+ width : 0.8125rem ;
104
+ }
105
+ .end-pad {
106
+ width : 0.8125rem ;
107
+ }
108
+ :global(input :checked ) + label > .start-pad ,
109
+ .custom.icon ~ .start-pad {
110
+ width : 1.625rem ;
111
+ }
112
+ :global(input :checked ) + label > .end-pad {
113
+ width : 0rem ;
96
114
}
97
115
98
116
label {
You can’t perform that action at this time.
0 commit comments