diff options
author | Volpeon <git@volpeon.ink> | 2024-10-17 16:45:00 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2024-10-17 16:45:00 +0200 |
commit | 50f6acc739f24bfa2ca080d08e90d82f8fa83543 (patch) | |
tree | 404dbe97d34b7e4fc3293c8e6a8c92d9941ac51e /src/objects/_action-button.scss | |
parent | Colors (diff) | |
download | iro-design-50f6acc739f24bfa2ca080d08e90d82f8fa83543.tar.gz iro-design-50f6acc739f24bfa2ca080d08e90d82f8fa83543.tar.bz2 iro-design-50f6acc739f24bfa2ca080d08e90d82f8fa83543.zip |
Revamped variable management
Diffstat (limited to 'src/objects/_action-button.scss')
-rw-r--r-- | src/objects/_action-button.scss | 343 |
1 files changed, 0 insertions, 343 deletions
diff --git a/src/objects/_action-button.scss b/src/objects/_action-button.scss deleted file mode 100644 index 7fe9d44..0000000 --- a/src/objects/_action-button.scss +++ /dev/null | |||
@@ -1,343 +0,0 @@ | |||
1 | @use 'sass:list'; | ||
2 | @use 'iro-sass/src/index' as iro; | ||
3 | @use '../functions' as fn; | ||
4 | |||
5 | $sizes: 'sm' 'lg' 'xl' !default; | ||
6 | $static-themes: 'black' 'white' !default; | ||
7 | |||
8 | @mixin static-theme($theme: ()) { | ||
9 | border-color: fn.color(list.join($theme, --disabled --border)); | ||
10 | background-color: fn.color(list.join($theme, --disabled --bg)); | ||
11 | color: fn.color(list.join($theme, --disabled --label)); | ||
12 | |||
13 | &::after { | ||
14 | outline-color: fn.color(list.join($theme, --key-focus --border)); | ||
15 | box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(list.join($theme, --key-focus --outline)); | ||
16 | } | ||
17 | |||
18 | &:link, | ||
19 | &:visited, | ||
20 | &:enabled { | ||
21 | border-color: fn.color(list.join($theme, --border)); | ||
22 | background-color: fn.color(list.join($theme, --bg)); | ||
23 | color: fn.color(list.join($theme, --label)); | ||
24 | |||
25 | &:hover, | ||
26 | &:focus-visible { | ||
27 | border-color: fn.color(list.join($theme, --hover --border)); | ||
28 | background-color: fn.color(list.join($theme, --hover --bg)); | ||
29 | color: fn.color(list.join($theme, --hover --label)); | ||
30 | } | ||
31 | |||
32 | &:active { | ||
33 | border-color: fn.color(list.join($theme, --active --border)); | ||
34 | background-color: fn.color(list.join($theme, --active --bg)); | ||
35 | color: fn.color(list.join($theme, --active --label)); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | @include iro.bem-modifier('quiet') { | ||
40 | border-color: transparent; | ||
41 | background-color: transparent; | ||
42 | color: fn.color(list.join($theme, --quiet --disabled --label)); | ||
43 | |||
44 | &:link, | ||
45 | &:visited, | ||
46 | &:enabled { | ||
47 | border-color: transparent; | ||
48 | background-color: transparent; | ||
49 | color: fn.color(list.join($theme, --quiet --label)); | ||
50 | |||
51 | &:hover, | ||
52 | &:focus-visible { | ||
53 | border-color: transparent; | ||
54 | background-color: fn.color(list.join($theme, --quiet --hover --bg)); | ||
55 | color: fn.color(list.join($theme, --quiet --hover --label)); | ||
56 | } | ||
57 | |||
58 | &:active { | ||
59 | border-color: transparent; | ||
60 | background-color: fn.color(list.join($theme, --quiet --active --bg)); | ||
61 | color: fn.color(list.join($theme, --quiet --active --label)); | ||
62 | } | ||
63 | } | ||
64 | } | ||
65 | |||
66 | @include iro.bem-is('selected') { | ||
67 | border-color: fn.color(list.join($theme, --selected --disabled --border)); | ||
68 | background-color: fn.color(list.join($theme, --selected --disabled --bg)); | ||
69 | color: fn.color(list.join($theme, --selected --disabled --label)); | ||
70 | |||
71 | &:link, | ||
72 | &:visited, | ||
73 | &:enabled { | ||
74 | border-color: fn.color(list.join($theme, --selected --border)); | ||
75 | background-color: fn.color(list.join($theme, --selected --bg)); | ||
76 | color: fn.color(list.join($theme, --selected --label)); | ||
77 | |||
78 | &:hover, | ||
79 | &:focus-visible { | ||
80 | border-color: fn.color(list.join($theme, --selected --hover --border)); | ||
81 | background-color: fn.color(list.join($theme, --selected --hover --bg)); | ||
82 | color: fn.color(list.join($theme, --selected --hover --label)); | ||
83 | } | ||
84 | |||
85 | &:active { | ||
86 | border-color: fn.color(list.join($theme, --selected --active --border)); | ||
87 | background-color: fn.color(list.join($theme, --selected --active --bg)); | ||
88 | color: fn.color(list.join($theme, --selected --active --label)); | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | |||
94 | @include iro.props-namespace('action-button') { | ||
95 | @include iro.props-store(( | ||
96 | --dims: ( | ||
97 | --line-height: 1.4, | ||
98 | --pad-i: fn.global-dim(--size --150), | ||
99 | --pad-i-pill: fn.global-dim(--size --200), | ||
100 | --pad-b: fn.global-dim(--size --85), | ||
101 | --border: fn.global-dim(--border --thin), | ||
102 | --rounding: fn.global-dim(--rounding), | ||
103 | --font-size: fn.global-dim(--font-size --100), | ||
104 | |||
105 | --sm: ( | ||
106 | --pad-i: fn.global-dim(--size --100), | ||
107 | --pad-i-pill: fn.global-dim(--size --150), | ||
108 | --pad-b: fn.global-dim(--size --40), | ||
109 | --font-size: fn.global-dim(--font-size --75), | ||
110 | ), | ||
111 | --lg: ( | ||
112 | --pad-i: fn.global-dim(--size --175), | ||
113 | --pad-i-pill: fn.global-dim(--size --225), | ||
114 | --pad-b: fn.global-dim(--size --115), | ||
115 | --font-size: fn.global-dim(--font-size --150), | ||
116 | ), | ||
117 | --xl: ( | ||
118 | --pad-i: fn.global-dim(--size --225), | ||
119 | --pad-i-pill: fn.global-dim(--size --300), | ||
120 | --pad-b: fn.global-dim(--size --150), | ||
121 | --font-size: fn.global-dim(--font-size --200), | ||
122 | ), | ||
123 | |||
124 | --key-focus: ( | ||
125 | --border: fn.global-dim(--key-focus --border), | ||
126 | --border-offset: fn.global-dim(--key-focus --border-offset), | ||
127 | --outline: fn.global-dim(--key-focus --outline), | ||
128 | ), | ||
129 | ), | ||
130 | --colors: ( | ||
131 | --bg: fn.global-color(--base --75), | ||
132 | --label: fn.global-color(--text), | ||
133 | --border: fn.global-color(--border-strong), | ||
134 | |||
135 | --hover: ( | ||
136 | --bg: fn.global-color(--border-mute), | ||
137 | --label: fn.global-color(--heading), | ||
138 | --border: fn.global-color(--text-mute-more), | ||
139 | ), | ||
140 | --active: ( | ||
141 | --bg: fn.global-color(--border), | ||
142 | --label: fn.global-color(--heading), | ||
143 | --border: fn.global-color(--text-mute), | ||
144 | ), | ||
145 | --disabled: ( | ||
146 | --bg: fn.global-color(--bg-l1), | ||
147 | --label: fn.global-color(--border-strong), | ||
148 | --border: fn.global-color(--border), | ||
149 | ), | ||
150 | --key-focus: ( | ||
151 | --border: fn.global-color(--focus --border), | ||
152 | --outline: fn.global-color(--focus --outline), | ||
153 | ), | ||
154 | |||
155 | --selected: ( | ||
156 | --bg: fn.global-color(--text-mute), | ||
157 | --label: fn.global-color(--base --50), | ||
158 | --border: fn.global-color(--text-mute), | ||
159 | |||
160 | --hover: ( | ||
161 | --bg: fn.global-color(--text), | ||
162 | --label: fn.global-color(--base --50), | ||
163 | --border: fn.global-color(--text), | ||
164 | ), | ||
165 | --active: ( | ||
166 | --bg: fn.global-color(--heading), | ||
167 | --label: fn.global-color(--base --50), | ||
168 | --border: fn.global-color(--heading), | ||
169 | ), | ||
170 | --disabled: ( | ||
171 | --bg: fn.global-color(--border-mute), | ||
172 | --label: fn.global-color(--border-strong), | ||
173 | --border: fn.global-color(--border-mute), | ||
174 | ), | ||
175 | ), | ||
176 | |||
177 | --quiet: ( | ||
178 | --label: fn.global-color(--text), | ||
179 | |||
180 | --hover: ( | ||
181 | --bg: fn.global-color(--border-mute), | ||
182 | --label: fn.global-color(--heading), | ||
183 | ), | ||
184 | --active: ( | ||
185 | --bg: fn.global-color(--border), | ||
186 | --label: fn.global-color(--heading), | ||
187 | ), | ||
188 | --disabled: ( | ||
189 | --label: fn.global-color(--border-strong), | ||
190 | ), | ||
191 | ), | ||
192 | ), | ||
193 | )); | ||
194 | |||
195 | @each $theme in $static-themes { | ||
196 | @include iro.props-store(( | ||
197 | --colors: ( | ||
198 | --static-#{$theme}: ( | ||
199 | --bg: fn.global-color(--#{$theme}-transparent --100), | ||
200 | --label: fn.global-color(--#{$theme}-transparent --900), | ||
201 | --border: fn.global-color(--#{$theme}-transparent --400), | ||
202 | |||
203 | --hover: ( | ||
204 | --bg: fn.global-color(--#{$theme}-transparent --300), | ||
205 | --label: fn.global-color(--#{$theme}-transparent --900), | ||
206 | --border: fn.global-color(--#{$theme}-transparent --500), | ||
207 | ), | ||
208 | --active: ( | ||
209 | --bg: fn.global-color(--#{$theme}-transparent --400), | ||
210 | --label: fn.global-color(--#{$theme}-transparent --900), | ||
211 | --border: fn.global-color(--#{$theme}-transparent --600), | ||
212 | ), | ||
213 | --disabled: ( | ||
214 | --bg: fn.global-color(--#{$theme}-transparent --100), | ||
215 | --label: fn.global-color(--#{$theme}-transparent --500), | ||
216 | --border: fn.global-color(--#{$theme}-transparent --300), | ||
217 | ), | ||
218 | --key-focus: ( | ||
219 | --border: fn.global-color(--#{$theme}-transparent --900), | ||
220 | --outline: fn.global-color(--#{$theme}-transparent --300), | ||
221 | ), | ||
222 | |||
223 | --selected: ( | ||
224 | --bg: fn.global-color(--#{$theme}-transparent --800), | ||
225 | --label: fn.global-color(--#{$theme}-transparent --text), | ||
226 | --border: fn.global-color(--#{$theme}-transparent --100), | ||
227 | |||
228 | --hover: ( | ||
229 | --bg: fn.global-color(--#{$theme}-transparent --900), | ||
230 | --label: fn.global-color(--#{$theme}-transparent --text), | ||
231 | --border: fn.global-color(--#{$theme}-transparent --100), | ||
232 | ), | ||
233 | --active: ( | ||
234 | --bg: fn.global-color(--#{$theme}-transparent --900), | ||
235 | --label: fn.global-color(--#{$theme}-transparent --text), | ||
236 | --border: fn.global-color(--#{$theme}-transparent --100), | ||
237 | ), | ||
238 | --disabled: ( | ||
239 | --bg: fn.global-color(--#{$theme}-transparent --200), | ||
240 | --label: fn.global-color(--#{$theme}-transparent --500), | ||
241 | --border: fn.global-color(--#{$theme}-transparent --100), | ||
242 | ), | ||
243 | ), | ||
244 | |||
245 | --quiet: ( | ||
246 | --label: fn.global-color(--#{$theme}-transparent --900), | ||
247 | |||
248 | --hover: ( | ||
249 | --bg: fn.global-color(--#{$theme}-transparent --300), | ||
250 | --label: fn.global-color(--#{$theme}-transparent --900), | ||
251 | ), | ||
252 | --active: ( | ||
253 | --bg: fn.global-color(--#{$theme}-transparent --400), | ||
254 | --label: fn.global-color(--#{$theme}-transparent --900), | ||
255 | ), | ||
256 | --disabled: ( | ||
257 | --label: fn.global-color(--#{$theme}-transparent --500), | ||
258 | ), | ||
259 | ), | ||
260 | ), | ||
261 | ) | ||
262 | )); | ||
263 | } | ||
264 | |||
265 | @include iro.bem-object(iro.props-namespace()) { | ||
266 | display: inline-block; | ||
267 | position: relative; | ||
268 | padding-block: fn.dim(--pad-b); | ||
269 | padding-inline: fn.dim(--pad-i); | ||
270 | border: fn.dim(--border) solid fn.color(--disabled --border); | ||
271 | border-radius: fn.dim(--rounding); | ||
272 | background-color: fn.color(--disabled --bg); | ||
273 | color: fn.color(--disabled --label); | ||
274 | line-height: fn.dim(--line-height); | ||
275 | text-align: center; | ||
276 | text-decoration: none; | ||
277 | text-overflow: ellipsis; | ||
278 | white-space: nowrap; | ||
279 | |||
280 | &::after { | ||
281 | content: ''; | ||
282 | display: none; | ||
283 | position: absolute; | ||
284 | z-index: 1; | ||
285 | inset: calc(-1 * fn.dim(--border) - fn.dim(--key-focus --border-offset)); | ||
286 | border-radius: calc(fn.dim(--rounding) + fn.dim(--key-focus --border-offset)); | ||
287 | outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); | ||
288 | box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); | ||
289 | pointer-events: none; | ||
290 | } | ||
291 | |||
292 | &:link, | ||
293 | &:visited, | ||
294 | &:enabled { | ||
295 | &:focus-visible { | ||
296 | &::after { | ||
297 | display: block; | ||
298 | } | ||
299 | } | ||
300 | } | ||
301 | |||
302 | @include static-theme; | ||
303 | |||
304 | @each $theme in $static-themes { | ||
305 | @include iro.bem-modifier(static-#{$theme}) { | ||
306 | @include static-theme(--static-#{$theme}); | ||
307 | } | ||
308 | } | ||
309 | |||
310 | @include iro.bem-modifier('pill') { | ||
311 | padding-inline: fn.dim(--pad-i-pill); | ||
312 | border-radius: 100em; | ||
313 | |||
314 | &::after { | ||
315 | border-radius: 100em; | ||
316 | } | ||
317 | } | ||
318 | |||
319 | @each $size in $sizes { | ||
320 | @include iro.bem-modifier($size) { | ||
321 | padding-block: fn.dim(--#{$size} --pad-b); | ||
322 | padding-inline: fn.dim(--#{$size} --pad-i); | ||
323 | font-size: fn.dim(--#{$size} --font-size); | ||
324 | |||
325 | @include iro.bem-modifier('pill') { | ||
326 | padding-inline: fn.dim(--#{$size} --pad-i-pill); | ||
327 | } | ||
328 | } | ||
329 | } | ||
330 | |||
331 | @include iro.bem-modifier('icon') { | ||
332 | inline-size: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-b)); | ||
333 | padding-inline: 0; | ||
334 | |||
335 | @each $size in $sizes { | ||
336 | @include iro.bem-modifier($size) { | ||
337 | inline-size: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--#{$size} --pad-b)); | ||
338 | padding-inline: 0; | ||
339 | } | ||
340 | } | ||
341 | } | ||
342 | } | ||
343 | } | ||