diff options
author | Volpeon <git@volpeon.ink> | 2024-06-25 17:39:03 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2024-06-25 17:39:03 +0200 |
commit | 4de75e0f305b2cb4a026073440f2bac7c34df817 (patch) | |
tree | 628f71b6f917bb9357ae14d018149509db655e4e /src/objects/_radio.scss | |
parent | Update (diff) | |
download | iro-design-4de75e0f305b2cb4a026073440f2bac7c34df817.tar.gz iro-design-4de75e0f305b2cb4a026073440f2bac7c34df817.tar.bz2 iro-design-4de75e0f305b2cb4a026073440f2bac7c34df817.zip |
Focus indicator style
Diffstat (limited to 'src/objects/_radio.scss')
-rw-r--r-- | src/objects/_radio.scss | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/src/objects/_radio.scss b/src/objects/_radio.scss index 12dc6ca..7ade7e1 100644 --- a/src/objects/_radio.scss +++ b/src/objects/_radio.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 | --circle-border: fn.global-color(--text-mute), | 22 | --circle-border: fn.global-color(--text-mute-more), |
17 | --circle-bg: fn.global-color(--base --75), | 23 | --circle-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 | --circle-border: fn.global-color(--text), | 27 | --circle-border: fn.global-color(--text-mute), |
22 | ), | 28 | ), |
23 | --accent: ( | 29 | --accent: ( |
24 | --circle-border: fn.global-color(--accent --900), | 30 | --circle-border: fn.global-color(--accent --900), |
@@ -27,37 +33,39 @@ | |||
27 | --circle-border: fn.global-color(--accent --1000), | 33 | --circle-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 | --circle-border: fn.global-color(--focus-static --1000), | ||
34 | --circle-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 | --circle-border: fn.global-color(--border-strong), | 38 | --circle-border: fn.global-color(--border-strong), |
39 | --circle-bg: fn.global-color(--base --75), | 39 | --circle-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-i)); | 53 | calc(-1 * fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)) |
54 | calc(fn.dim(--spacing-sibling) - fn.dim(--pad-i) - 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('circle') { | 58 | @include iro.bem-elem('circle') { |
53 | display: block; | 59 | display: inline-block; |
54 | box-sizing: border-box; | ||
55 | flex: 0 0 auto; | 60 | flex: 0 0 auto; |
56 | inline-size: fn.dim(--diameter); | 61 | inline-size: fn.dim(--diameter); |
57 | block-size: fn.dim(--diameter); | 62 | block-size: fn.dim(--diameter); |
58 | margin-block-start: calc(.5 * (fn.global-dim(--font --standard --line-height) * 1em - fn.dim(--diameter))); | 63 | margin-block-start: calc(.5em * fn.global-dim(--font --standard --line-height) - .5 * fn.dim(--diameter) - fn.dim(--key-focus --border-offset)); |
64 | border: fn.dim(--key-focus --border-offset) solid transparent; | ||
59 | border-radius: 2em; | 65 | border-radius: 2em; |
60 | background-color: fn.color(--circle-border); | 66 | background-color: fn.color(--circle-border); |
67 | background-clip: padding-box; | ||
68 | vertical-align: top; | ||
61 | 69 | ||
62 | &::after { | 70 | &::after { |
63 | content: ''; | 71 | content: ''; |
@@ -74,8 +82,7 @@ | |||
74 | } | 82 | } |
75 | 83 | ||
76 | @include iro.bem-elem('label') { | 84 | @include iro.bem-elem('label') { |
77 | align-self: baseline; | 85 | margin-inline-start: calc(fn.dim(--label-gap) - fn.dim(--key-focus --border-offset)); |
78 | margin-inline-start: fn.dim(--label-gap); | ||
79 | } | 86 | } |
80 | 87 | ||
81 | @include iro.bem-elem('native') { | 88 | @include iro.bem-elem('native') { |
@@ -91,7 +98,8 @@ | |||
91 | overflow: hidden; | 98 | overflow: hidden; |
92 | border-radius: fn.dim(--rounding); | 99 | border-radius: fn.dim(--rounding); |
93 | 100 | ||
94 | &:hover { | 101 | &:hover, |
102 | &:focus-visible { | ||
95 | @include iro.bem-sibling-elem('label') { | 103 | @include iro.bem-sibling-elem('label') { |
96 | color: fn.color(--hover --label); | 104 | color: fn.color(--hover --label); |
97 | } | 105 | } |
@@ -124,18 +132,13 @@ | |||
124 | } | 132 | } |
125 | 133 | ||
126 | &:focus-visible { | 134 | &:focus-visible { |
127 | background-color: fn.color(--key-focus --bg); | ||
128 | |||
129 | @include iro.bem-sibling-elem('label') { | 135 | @include iro.bem-sibling-elem('label') { |
130 | color: fn.color(--key-focus --label); | 136 | color: fn.color(--key-focus --label); |
131 | } | 137 | } |
132 | 138 | ||
133 | @include iro.bem-sibling-elem('circle') { | 139 | @include iro.bem-sibling-elem('circle') { |
134 | background-color: fn.color(--key-focus --circle-border); | 140 | outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); |
135 | 141 | box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); | |
136 | &::after { | ||
137 | background-color: fn.color(--key-focus --circle-bg); | ||
138 | } | ||
139 | } | 142 | } |
140 | } | 143 | } |
141 | } | 144 | } |
@@ -153,7 +156,8 @@ | |||
153 | background-color: fn.color(--accent --circle-border); | 156 | background-color: fn.color(--accent --circle-border); |
154 | } | 157 | } |
155 | 158 | ||
156 | &:hover { | 159 | &:hover, |
160 | &:focus-visible { | ||
157 | @include iro.bem-sibling-elem('circle') { | 161 | @include iro.bem-sibling-elem('circle') { |
158 | background-color: fn.color(--accent --hover --circle-border); | 162 | background-color: fn.color(--accent --hover --circle-border); |
159 | } | 163 | } |
@@ -175,12 +179,6 @@ | |||
175 | } | 179 | } |
176 | } | 180 | } |
177 | } | 181 | } |
178 | |||
179 | &:focus-visible { | ||
180 | @include iro.bem-sibling-elem('circle') { | ||
181 | background-color: fn.color(--key-focus --circle-border); | ||
182 | } | ||
183 | } | ||
184 | } | 182 | } |
185 | } | 183 | } |
186 | } | 184 | } |