diff options
Diffstat (limited to 'src/objects/_button.scss')
-rw-r--r-- | src/objects/_button.scss | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/objects/_button.scss b/src/objects/_button.scss index 08dc0ea..49f3f67 100644 --- a/src/objects/_button.scss +++ b/src/objects/_button.scss | |||
@@ -29,7 +29,8 @@ $static-themes: 'black' 'white' !default; | |||
29 | &:link, | 29 | &:link, |
30 | &:visited, | 30 | &:visited, |
31 | &:enabled { | 31 | &:enabled { |
32 | &:hover { | 32 | &:hover, |
33 | &:focus-visible { | ||
33 | border-color: transparent; | 34 | border-color: transparent; |
34 | background-color: fn.color(list.join($key, --hover --bg)); | 35 | background-color: fn.color(list.join($key, --hover --bg)); |
35 | color: fn.color(list.join($key, --hover --label)); | 36 | color: fn.color(list.join($key, --hover --label)); |
@@ -58,15 +59,9 @@ $static-themes: 'black' 'white' !default; | |||
58 | 59 | ||
59 | @include theme(static-#{$theme}); | 60 | @include theme(static-#{$theme}); |
60 | 61 | ||
61 | &:link, | 62 | &::after { |
62 | &:visited, | 63 | outline: fn.color(list.join($key, --key-focus --border)) solid fn.dim(--key-focus --border); |
63 | &:enabled { | 64 | box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(list.join($key, --key-focus --outline)); |
64 | &:focus-visible { | ||
65 | border-color: fn.color(list.join($key, --key-focus --border)); | ||
66 | outline: fn.color(list.join($key, --key-focus --outline)) solid fn.dim(--key-focus --outline); | ||
67 | background-color: fn.color(list.join($key, --key-focus --bg)); | ||
68 | color: fn.color(list.join($key, --key-focus --label)); | ||
69 | } | ||
70 | } | 65 | } |
71 | } | 66 | } |
72 | 67 | ||
@@ -97,7 +92,9 @@ $static-themes: 'black' 'white' !default; | |||
97 | ), | 92 | ), |
98 | 93 | ||
99 | --key-focus: ( | 94 | --key-focus: ( |
100 | --outline: fn.global-dim(--key-focus --border), | 95 | --border: fn.global-dim(--key-focus --border), |
96 | --border-offset: fn.global-dim(--key-focus --border-offset), | ||
97 | --outline: fn.global-dim(--key-focus --outline), | ||
101 | ), | 98 | ), |
102 | ), | 99 | ), |
103 | --colors: ( | 100 | --colors: ( |
@@ -120,10 +117,9 @@ $static-themes: 'black' 'white' !default; | |||
120 | --label: fn.global-color(--text-disabled), | 117 | --label: fn.global-color(--text-disabled), |
121 | ), | 118 | ), |
122 | --key-focus: ( | 119 | --key-focus: ( |
123 | --bg: fn.global-color(--base --50), | 120 | --label: fn.global-color(--focus --text), |
124 | --label: fn.global-color(--heading), | 121 | --border: fn.global-color(--focus --border), |
125 | --border: fn.global-color(--focus --1100), | 122 | --outline: fn.global-color(--focus --outline), |
126 | --outline: fn.global-color(--focus --400), | ||
127 | ), | 123 | ), |
128 | 124 | ||
129 | --primary: ( | 125 | --primary: ( |
@@ -216,6 +212,7 @@ $static-themes: 'black' 'white' !default; | |||
216 | 212 | ||
217 | @include iro.bem-object(iro.props-namespace()) { | 213 | @include iro.bem-object(iro.props-namespace()) { |
218 | display: inline-block; | 214 | display: inline-block; |
215 | position: relative; | ||
219 | padding-block: fn.dim(--pad-b); | 216 | padding-block: fn.dim(--pad-b); |
220 | padding-inline: fn.dim(--pad-i); | 217 | padding-inline: fn.dim(--pad-i); |
221 | border: fn.dim(--border) solid transparent; | 218 | border: fn.dim(--border) solid transparent; |
@@ -228,6 +225,19 @@ $static-themes: 'black' 'white' !default; | |||
228 | line-height: fn.dim(--line-height); | 225 | line-height: fn.dim(--line-height); |
229 | text-align: center; | 226 | text-align: center; |
230 | text-decoration: none; | 227 | text-decoration: none; |
228 | |||
229 | &::after { | ||
230 | content: ''; | ||
231 | display: none; | ||
232 | position: absolute; | ||
233 | z-index: 1; | ||
234 | inset-block: calc(-1 * fn.dim(--border) - fn.dim(--key-focus --border-offset)); | ||
235 | inset-inline: calc(-1 * fn.dim(--border) - fn.dim(--key-focus --border-offset)); | ||
236 | border-radius: fn.dim(--rounding); | ||
237 | outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); | ||
238 | box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); | ||
239 | pointer-events: none; | ||
240 | } | ||
231 | 241 | ||
232 | @include iro.bem-modifier('block') { | 242 | @include iro.bem-modifier('block') { |
233 | display: block; | 243 | display: block; |
@@ -263,10 +273,9 @@ $static-themes: 'black' 'white' !default; | |||
263 | &:visited, | 273 | &:visited, |
264 | &:enabled { | 274 | &:enabled { |
265 | &:focus-visible { | 275 | &:focus-visible { |
266 | border-color: fn.color(--key-focus --border); | 276 | &::after { |
267 | outline: fn.color(--key-focus --outline) solid fn.dim(--key-focus --outline); | 277 | display: block; |
268 | background-color: fn.color(--key-focus --bg); | 278 | } |
269 | color: fn.color(--key-focus --label); | ||
270 | } | 279 | } |
271 | } | 280 | } |
272 | 281 | ||