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.scss74
1 files changed, 33 insertions, 41 deletions
diff --git a/src/objects/_checkbox.scss b/src/objects/_checkbox.scss
index a254ec4..509822b 100644
--- a/src/objects/_checkbox.scss
+++ b/src/objects/_checkbox.scss
@@ -11,14 +11,20 @@
11 --pad-b: fn.global-dim(--size --65), 11 --pad-b: fn.global-dim(--size --65),
12 --rounding: fn.global-dim(--rounding), 12 --rounding: fn.global-dim(--rounding),
13 --spacing-sibling: fn.global-dim(--size --300), 13 --spacing-sibling: fn.global-dim(--size --300),
14
15 --key-focus: (
16 --border: fn.global-dim(--key-focus --border),
17 --border-offset: fn.global-dim(--key-focus --border-offset),
18 --outline: fn.global-dim(--key-focus --border),
19 ),
14 ), 20 ),
15 --colors: ( 21 --colors: (
16 --box-border: fn.global-color(--text-mute), 22 --box-border: fn.global-color(--text-mute-more),
17 --box-bg: fn.global-color(--base --75), 23 --box-bg: fn.global-color(--base --75),
18 24
19 --hover: ( 25 --hover: (
20 --label: fn.global-color(--heading), 26 --label: fn.global-color(--heading),
21 --box-border: fn.global-color(--text), 27 --box-border: fn.global-color(--text-mute),
22 ), 28 ),
23 --accent: ( 29 --accent: (
24 --box-border: fn.global-color(--accent --900), 30 --box-border: fn.global-color(--accent --900),
@@ -27,37 +33,40 @@
27 --box-border: fn.global-color(--accent --1000), 33 --box-border: fn.global-color(--accent --1000),
28 ), 34 ),
29 ), 35 ),
30 --key-focus: (
31 --bg: fn.global-color(--focus-static --400),
32 --label: fn.global-color(--focus-static --400-text),
33 --box-border: fn.global-color(--focus-static --1000),
34 --box-bg: fn.global-color(--focus-static --1000-text),
35 ),
36 --disabled: ( 36 --disabled: (
37 --label: fn.global-color(--text-disabled), 37 --label: fn.global-color(--text-disabled),
38 --box-border: fn.global-color(--border-strong), 38 --box-border: fn.global-color(--border-strong),
39 --box-bg: fn.global-color(--base --75), 39 --box-bg: fn.global-color(--base --75),
40 ) 40 ),
41 --key-focus: (
42 --label: fn.global-color(--focus --text),
43 --border: fn.global-color(--focus --border),
44 --outline: fn.global-color(--focus --outline),
45 ),
41 ), 46 ),
42 )); 47 ));
43 48
44 @include iro.bem-object(iro.props-namespace()) { 49 @include iro.bem-object(iro.props-namespace()) {
45 display: inline-flex; 50 display: inline-block;
46 position: relative; 51 position: relative;
47 align-items: flex-start; 52 margin-inline:
48 margin-inline: calc(-1 * fn.dim(--pad-i)) calc(fn.dim(--spacing-sibling) - fn.dim(--pad-b)); 53 calc(-1 * fn.dim(--pad-i) - fn.dim(--key-focus --border-offset))
54 calc(fn.dim(--spacing-sibling) - fn.dim(--pad-b) - fn.dim(--key-focus --border-offset));
49 padding-block: fn.dim(--pad-b); 55 padding-block: fn.dim(--pad-b);
50 padding-inline: fn.dim(--pad-i); 56 padding-inline: fn.dim(--pad-i);
51 57
52 @include iro.bem-elem('box') { 58 @include iro.bem-elem('box') {
53 display: block; 59 display: inline-block;
54 position: relative; 60 position: relative;
55 flex: 0 0 auto; 61 flex: 0 0 auto;
56 inline-size: fn.dim(--size); 62 inline-size: fn.dim(--size);
57 block-size: fn.dim(--size); 63 block-size: fn.dim(--size);
58 margin-block-start: calc(.5 * (fn.global-dim(--font --standard --line-height) * 1em - fn.dim(--size))); 64 margin-block-start: calc(.5em * fn.global-dim(--font --standard --line-height) - .5 * fn.dim(--size) - fn.dim(--key-focus --border-offset));
59 border-radius: fn.dim(--border); 65 border: fn.dim(--key-focus --border-offset) solid transparent;
66 border-radius: calc(fn.dim(--border) + fn.dim(--key-focus --border-offset));
60 background-color: fn.color(--box-border); 67 background-color: fn.color(--box-border);
68 background-clip: padding-box;
69 vertical-align: top;
61 70
62 &::before, 71 &::before,
63 &::after { 72 &::after {
@@ -110,8 +119,7 @@
110 } 119 }
111 120
112 @include iro.bem-elem('label') { 121 @include iro.bem-elem('label') {
113 align-self: baseline; 122 margin-inline-start: calc(fn.dim(--label-gap) - fn.dim(--key-focus --border-offset));
114 margin-left: fn.dim(--label-gap);
115 } 123 }
116 124
117 @include iro.bem-elem('native') { 125 @include iro.bem-elem('native') {
@@ -127,7 +135,8 @@
127 overflow: hidden; 135 overflow: hidden;
128 border-radius: fn.dim(--rounding); 136 border-radius: fn.dim(--rounding);
129 137
130 &:hover { 138 &:hover,
139 &:focus-visible {
131 @include iro.bem-sibling-elem('label') { 140 @include iro.bem-sibling-elem('label') {
132 color: fn.color(--hover --label); 141 color: fn.color(--hover --label);
133 } 142 }
@@ -180,26 +189,13 @@
180 } 189 }
181 190
182 &:focus-visible { 191 &:focus-visible {
183 background-color: fn.color(--key-focus --bg);
184
185 @include iro.bem-sibling-elem('label') { 192 @include iro.bem-sibling-elem('label') {
186 color: fn.color(--key-focus --label); 193 color: fn.color(--key-focus --label);
187 } 194 }
188 195
189 @include iro.bem-sibling-elem('box') { 196 @include iro.bem-sibling-elem('box') {
190 background-color: fn.color(--key-focus --box-border); 197 outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border);
191 198 box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline);
192 &::before {
193 background-color: fn.color(--key-focus --box-bg);
194 }
195
196 &::after {
197 border-color: fn.color(--key-focus --box-bg);
198 }
199
200 @include iro.bem-elem('check-icon') {
201 color: fn.color(--key-focus --box-bg);
202 }
203 } 199 }
204 } 200 }
205 } 201 }
@@ -217,7 +213,8 @@
217 background-color: fn.color(--accent --box-border); 213 background-color: fn.color(--accent --box-border);
218 } 214 }
219 215
220 &:hover { 216 &:hover,
217 &:focus-visible {
221 @include iro.bem-sibling-elem('box') { 218 @include iro.bem-sibling-elem('box') {
222 background-color: fn.color(--accent --hover --box-border); 219 background-color: fn.color(--accent --hover --box-border);
223 } 220 }
@@ -229,7 +226,8 @@
229 background-color: fn.color(--accent --box-border); 226 background-color: fn.color(--accent --box-border);
230 } 227 }
231 228
232 &:hover { 229 &:hover,
230 &:focus-visible {
233 @include iro.bem-sibling-elem('box') { 231 @include iro.bem-sibling-elem('box') {
234 background-color: fn.color(--accent --hover --box-border); 232 background-color: fn.color(--accent --hover --box-border);
235 } 233 }
@@ -257,12 +255,6 @@
257 } 255 }
258 } 256 }
259 } 257 }
260
261 &:focus-visible {
262 @include iro.bem-sibling-elem('box') {
263 background-color: fn.color(--key-focus --box-border);
264 }
265 }
266 } 258 }
267 } 259 }
268 } 260 }