summaryrefslogtreecommitdiffstats
path: root/src/objects/_checkbox.scss
diff options
context:
space:
mode:
Diffstat (limited to 'src/objects/_checkbox.scss')
-rw-r--r--src/objects/_checkbox.scss57
1 files changed, 29 insertions, 28 deletions
diff --git a/src/objects/_checkbox.scss b/src/objects/_checkbox.scss
index f0c6b85..f902da7 100644
--- a/src/objects/_checkbox.scss
+++ b/src/objects/_checkbox.scss
@@ -1,5 +1,6 @@
1@use 'sass:meta'; 1@use 'sass:meta';
2@use 'iro-sass/src/iro-sass' as iro; 2@use 'iro-sass/src/bem' as bem;
3@use 'iro-sass/src/functions' as fn;
3@use 'iro-sass/src/props'; 4@use 'iro-sass/src/props';
4@use '../props' as *; 5@use '../props' as *;
5@use '../core.vars' as core; 6@use '../core.vars' as core;
@@ -10,7 +11,7 @@
10@mixin styles { 11@mixin styles {
11 @include materialize-at-root(meta.module-variables('vars')); 12 @include materialize-at-root(meta.module-variables('vars'));
12 13
13 @include iro.bem-object('checkbox') { 14 @include bem.object('checkbox') {
14 position: relative; 15 position: relative;
15 display: inline-block; 16 display: inline-block;
16 padding-block: props.get(vars.$pad-b); 17 padding-block: props.get(vars.$pad-b);
@@ -19,7 +20,7 @@
19 calc(-1 * props.get(vars.$pad-i) - props.get(vars.$key-focus--border-offset)) 20 calc(-1 * props.get(vars.$pad-i) - props.get(vars.$key-focus--border-offset))
20 calc(props.get(vars.$spacing-sibling) - props.get(vars.$pad-b) - props.get(vars.$key-focus--border-offset)); 21 calc(props.get(vars.$spacing-sibling) - props.get(vars.$pad-b) - props.get(vars.$key-focus--border-offset));
21 22
22 @include iro.bem-elem('box') { 23 @include bem.elem('box') {
23 position: relative; 24 position: relative;
24 display: inline-block; 25 display: inline-block;
25 flex: 0 0 auto; 26 flex: 0 0 auto;
@@ -66,7 +67,7 @@
66 } 67 }
67 } 68 }
68 69
69 @include iro.bem-elem('check-icon') { 70 @include bem.elem('check-icon') {
70 position: absolute; 71 position: absolute;
71 inset-block-start: calc(1 * props.get(vars.$border-width)); 72 inset-block-start: calc(1 * props.get(vars.$border-width));
72 inset-inline-start: calc(1 * props.get(vars.$border-width)); 73 inset-inline-start: calc(1 * props.get(vars.$border-width));
@@ -76,17 +77,17 @@
76 block-size: calc(100% - 2 * props.get(vars.$border-width)); 77 block-size: calc(100% - 2 * props.get(vars.$border-width));
77 margin: 0; 78 margin: 0;
78 color: props.get(vars.$box-bg-color); 79 color: props.get(vars.$box-bg-color);
79 stroke-width: iro.fn-px-to-rem(3px); 80 stroke-width: fn.px-to-rem(3px);
80 transition: transform .2s ease; 81 transition: transform .2s ease;
81 transform: scale(0); 82 transform: scale(0);
82 transform-origin: 40% 90%; 83 transform-origin: 40% 90%;
83 } 84 }
84 85
85 @include iro.bem-elem('label') { 86 @include bem.elem('label') {
86 margin-inline-start: calc(props.get(vars.$label-gap) - props.get(vars.$key-focus--border-offset)); 87 margin-inline-start: calc(props.get(vars.$label-gap) - props.get(vars.$key-focus--border-offset));
87 } 88 }
88 89
89 @include iro.bem-elem('native') { 90 @include bem.elem('native') {
90 position: absolute; 91 position: absolute;
91 inset-block-start: 0; 92 inset-block-start: 0;
92 inset-inline-start: 0; 93 inset-inline-start: 0;
@@ -101,29 +102,29 @@
101 102
102 &:hover, 103 &:hover,
103 &:focus-visible { 104 &:focus-visible {
104 @include iro.bem-sibling-elem('label') { 105 @include bem.sibling-elem('label') {
105 color: props.get(vars.$hover--label-color); 106 color: props.get(vars.$hover--label-color);
106 } 107 }
107 108
108 @include iro.bem-sibling-elem('box') { 109 @include bem.sibling-elem('box') {
109 background-color: props.get(vars.$hover--box-border-color); 110 background-color: props.get(vars.$hover--box-border-color);
110 } 111 }
111 } 112 }
112 113
113 &:checked { 114 &:checked {
114 @include iro.bem-sibling-elem('box') { 115 @include bem.sibling-elem('box') {
115 &::before { 116 &::before {
116 transform: scale(0); 117 transform: scale(0);
117 } 118 }
118 119
119 @include iro.bem-elem('check-icon') { 120 @include bem.elem('check-icon') {
120 transform: scale(1); 121 transform: scale(1);
121 } 122 }
122 } 123 }
123 } 124 }
124 125
125 &:indeterminate { 126 &:indeterminate {
126 @include iro.bem-sibling-elem('box') { 127 @include bem.sibling-elem('box') {
127 &::before { 128 &::before {
128 transform: scale(0); 129 transform: scale(0);
129 } 130 }
@@ -132,18 +133,18 @@
132 transform: scale(1); 133 transform: scale(1);
133 } 134 }
134 135
135 @include iro.bem-elem('check-icon') { 136 @include bem.elem('check-icon') {
136 transform: scale(0); 137 transform: scale(0);
137 } 138 }
138 } 139 }
139 } 140 }
140 141
141 &:disabled { 142 &:disabled {
142 @include iro.bem-sibling-elem('label') { 143 @include bem.sibling-elem('label') {
143 color: props.get(vars.$disabled--label-color); 144 color: props.get(vars.$disabled--label-color);
144 } 145 }
145 146
146 @include iro.bem-sibling-elem('box') { 147 @include bem.sibling-elem('box') {
147 background-color: props.get(vars.$disabled--box-border-color); 148 background-color: props.get(vars.$disabled--box-border-color);
148 149
149 &::before { 150 &::before {
@@ -153,11 +154,11 @@
153 } 154 }
154 155
155 &:focus-visible { 156 &:focus-visible {
156 @include iro.bem-sibling-elem('label') { 157 @include bem.sibling-elem('label') {
157 color: props.get(vars.$key-focus--label-color); 158 color: props.get(vars.$key-focus--label-color);
158 } 159 }
159 160
160 @include iro.bem-sibling-elem('box') { 161 @include bem.sibling-elem('box') {
161 outline: props.get(vars.$key-focus--border-color) solid props.get(vars.$key-focus--border-width); 162 outline: props.get(vars.$key-focus--border-color) solid props.get(vars.$key-focus--border-width);
162 box-shadow: 163 box-shadow:
163 0 164 0
@@ -169,42 +170,42 @@
169 } 170 }
170 } 171 }
171 172
172 @include iro.bem-modifier('standalone') { 173 @include bem.modifier('standalone') {
173 @include iro.bem-elem('box') { 174 @include bem.elem('box') {
174 margin-block-start: 0; 175 margin-block-start: 0;
175 } 176 }
176 } 177 }
177 178
178 @include iro.bem-modifier('accent') { 179 @include bem.modifier('accent') {
179 @include iro.bem-elem('native') { 180 @include bem.elem('native') {
180 &:checked { 181 &:checked {
181 @include iro.bem-sibling-elem('box') { 182 @include bem.sibling-elem('box') {
182 background-color: props.get(vars.$accent--box-border-color); 183 background-color: props.get(vars.$accent--box-border-color);
183 } 184 }
184 185
185 &:hover, 186 &:hover,
186 &:focus-visible { 187 &:focus-visible {
187 @include iro.bem-sibling-elem('box') { 188 @include bem.sibling-elem('box') {
188 background-color: props.get(vars.$accent--hover--box-border-color); 189 background-color: props.get(vars.$accent--hover--box-border-color);
189 } 190 }
190 } 191 }
191 } 192 }
192 193
193 &:indeterminate { 194 &:indeterminate {
194 @include iro.bem-sibling-elem('box') { 195 @include bem.sibling-elem('box') {
195 background-color: props.get(vars.$accent--box-border-color); 196 background-color: props.get(vars.$accent--box-border-color);
196 } 197 }
197 198
198 &:hover, 199 &:hover,
199 &:focus-visible { 200 &:focus-visible {
200 @include iro.bem-sibling-elem('box') { 201 @include bem.sibling-elem('box') {
201 background-color: props.get(vars.$accent--hover--box-border-color); 202 background-color: props.get(vars.$accent--hover--box-border-color);
202 } 203 }
203 } 204 }
204 } 205 }
205 206
206 &:disabled { 207 &:disabled {
207 @include iro.bem-sibling-elem('box') { 208 @include bem.sibling-elem('box') {
208 background-color: props.get(vars.$disabled--box-border-color); 209 background-color: props.get(vars.$disabled--box-border-color);
209 210
210 &::before { 211 &::before {
@@ -213,13 +214,13 @@
213 } 214 }
214 215
215 &:checked { 216 &:checked {
216 @include iro.bem-sibling-elem('box') { 217 @include bem.sibling-elem('box') {
217 background-color: props.get(vars.$disabled--box-border-color); 218 background-color: props.get(vars.$disabled--box-border-color);
218 } 219 }
219 } 220 }
220 221
221 &:indeterminate { 222 &:indeterminate {
222 @include iro.bem-sibling-elem('box') { 223 @include bem.sibling-elem('box') {
223 background-color: props.get(vars.$disabled--box-border-color); 224 background-color: props.get(vars.$disabled--box-border-color);
224 } 225 }
225 } 226 }