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/_checkbox.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/_checkbox.scss')
-rw-r--r-- | src/objects/_checkbox.scss | 261 |
1 files changed, 0 insertions, 261 deletions
diff --git a/src/objects/_checkbox.scss b/src/objects/_checkbox.scss deleted file mode 100644 index 8527948..0000000 --- a/src/objects/_checkbox.scss +++ /dev/null | |||
@@ -1,261 +0,0 @@ | |||
1 | @use 'iro-sass/src/index' as iro; | ||
2 | @use '../functions' as fn; | ||
3 | |||
4 | @include iro.props-namespace('checkbox') { | ||
5 | @include iro.props-store(( | ||
6 | --dims: ( | ||
7 | --size: fn.global-dim(--size --175), | ||
8 | --label-gap: fn.global-dim(--size --125), | ||
9 | --border: fn.global-dim(--border --medium), | ||
10 | --pad-i: fn.global-dim(--size --65), | ||
11 | --pad-b: fn.global-dim(--size --65), | ||
12 | --rounding: fn.global-dim(--rounding), | ||
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 --outline), | ||
19 | ), | ||
20 | ), | ||
21 | --colors: ( | ||
22 | --box-border: fn.global-color(--text-mute-more), | ||
23 | --box-bg: fn.global-color(--base --75), | ||
24 | |||
25 | --hover: ( | ||
26 | --label: fn.global-color(--heading), | ||
27 | --box-border: fn.global-color(--text-mute), | ||
28 | ), | ||
29 | --accent: ( | ||
30 | --box-border: fn.global-color(--accent --900), | ||
31 | |||
32 | --hover: ( | ||
33 | --box-border: fn.global-color(--accent --1000), | ||
34 | ), | ||
35 | ), | ||
36 | --disabled: ( | ||
37 | --label: fn.global-color(--text-disabled), | ||
38 | --box-border: fn.global-color(--border-strong), | ||
39 | --box-bg: fn.global-color(--base --75), | ||
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 | ), | ||
46 | ), | ||
47 | )); | ||
48 | |||
49 | @include iro.bem-object(iro.props-namespace()) { | ||
50 | display: inline-block; | ||
51 | position: relative; | ||
52 | margin-inline: | ||
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)); | ||
55 | padding-block: fn.dim(--pad-b); | ||
56 | padding-inline: fn.dim(--pad-i); | ||
57 | |||
58 | @include iro.bem-elem('box') { | ||
59 | display: inline-block; | ||
60 | position: relative; | ||
61 | flex: 0 0 auto; | ||
62 | inline-size: fn.dim(--size); | ||
63 | block-size: 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)); | ||
65 | border: fn.dim(--key-focus --border-offset) solid transparent; | ||
66 | border-radius: calc(fn.dim(--border) + fn.dim(--key-focus --border-offset)); | ||
67 | background-color: fn.color(--box-border); | ||
68 | background-clip: padding-box; | ||
69 | vertical-align: top; | ||
70 | |||
71 | &::before, | ||
72 | &::after { | ||
73 | content: ''; | ||
74 | display: block; | ||
75 | position: absolute; | ||
76 | } | ||
77 | |||
78 | &::before { | ||
79 | z-index: 2; | ||
80 | inset-block-start: fn.dim(--border); | ||
81 | inset-inline-start: fn.dim(--border); | ||
82 | inline-size: calc(fn.dim(--size) - 2 * fn.dim(--border)); | ||
83 | block-size: calc(fn.dim(--size) - 2 * fn.dim(--border)); | ||
84 | transition: transform .2s ease; | ||
85 | background-color: fn.color(--box-bg); | ||
86 | } | ||
87 | |||
88 | &::after { | ||
89 | z-index: 3; | ||
90 | inset-block-start: calc(.5 * fn.dim(--size) - 1px); | ||
91 | inset-inline-start: calc(1.5 * fn.dim(--border)); | ||
92 | box-sizing: border-box; | ||
93 | inline-size: calc(fn.dim(--size) - 3 * fn.dim(--border)); | ||
94 | block-size: 0; | ||
95 | transform: scale(0); | ||
96 | transition: transform .2s ease; | ||
97 | border-block-width: 0 2px; | ||
98 | border-inline-width: 0 2px; | ||
99 | border-style: solid; | ||
100 | border-radius: 2px; | ||
101 | border-color: fn.color(--box-bg); | ||
102 | } | ||
103 | } | ||
104 | |||
105 | @include iro.bem-elem('check-icon') { | ||
106 | display: block; | ||
107 | position: absolute; | ||
108 | z-index: 2; | ||
109 | inset-block-start: calc(1 * fn.dim(--border)); | ||
110 | inset-inline-start: calc(1 * fn.dim(--border)); | ||
111 | inline-size: calc(100% - 2 * fn.dim(--border)); | ||
112 | block-size: calc(100% - 2 * fn.dim(--border)); | ||
113 | margin: 0; | ||
114 | transform: scale(0); | ||
115 | transform-origin: 40% 90%; | ||
116 | transition: transform .2s ease; | ||
117 | stroke-width: iro.fn-px-to-rem(3px); | ||
118 | color: fn.color(--box-bg); | ||
119 | } | ||
120 | |||
121 | @include iro.bem-elem('label') { | ||
122 | margin-inline-start: calc(fn.dim(--label-gap) - fn.dim(--key-focus --border-offset)); | ||
123 | } | ||
124 | |||
125 | @include iro.bem-elem('native') { | ||
126 | appearance: none; | ||
127 | position: absolute; | ||
128 | z-index: -1; | ||
129 | inset-block-start: 0; | ||
130 | inset-inline-start: 0; | ||
131 | inline-size: 100%; | ||
132 | block-size: 100%; | ||
133 | margin: 0; | ||
134 | padding: 0; | ||
135 | overflow: hidden; | ||
136 | border-radius: fn.dim(--rounding); | ||
137 | |||
138 | &:hover, | ||
139 | &:focus-visible { | ||
140 | @include iro.bem-sibling-elem('label') { | ||
141 | color: fn.color(--hover --label); | ||
142 | } | ||
143 | |||
144 | @include iro.bem-sibling-elem('box') { | ||
145 | background-color: fn.color(--hover --box-border); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | &:checked { | ||
150 | @include iro.bem-sibling-elem('box') { | ||
151 | &::before { | ||
152 | transform: scale(0); | ||
153 | } | ||
154 | |||
155 | @include iro.bem-elem('check-icon') { | ||
156 | transform: scale(1); | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | |||
161 | &:indeterminate { | ||
162 | @include iro.bem-sibling-elem('box') { | ||
163 | &::before { | ||
164 | transform: scale(0); | ||
165 | } | ||
166 | |||
167 | &::after { | ||
168 | transform: scale(1); | ||
169 | } | ||
170 | |||
171 | @include iro.bem-elem('check-icon') { | ||
172 | transform: scale(0); | ||
173 | } | ||
174 | } | ||
175 | } | ||
176 | |||
177 | &:disabled { | ||
178 | @include iro.bem-sibling-elem('label') { | ||
179 | color: fn.color(--disabled --label); | ||
180 | } | ||
181 | |||
182 | @include iro.bem-sibling-elem('box') { | ||
183 | background-color: fn.color(--disabled --box-border); | ||
184 | |||
185 | &::before { | ||
186 | background-color: fn.color(--disabled --box-bg); | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | |||
191 | &:focus-visible { | ||
192 | @include iro.bem-sibling-elem('label') { | ||
193 | color: fn.color(--key-focus --label); | ||
194 | } | ||
195 | |||
196 | @include iro.bem-sibling-elem('box') { | ||
197 | outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); | ||
198 | box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); | ||
199 | } | ||
200 | } | ||
201 | } | ||
202 | |||
203 | @include iro.bem-modifier('standalone') { | ||
204 | @include iro.bem-elem('box') { | ||
205 | margin-block-start: 0; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | @include iro.bem-modifier('accent') { | ||
210 | @include iro.bem-elem('native') { | ||
211 | &:checked { | ||
212 | @include iro.bem-sibling-elem('box') { | ||
213 | background-color: fn.color(--accent --box-border); | ||
214 | } | ||
215 | |||
216 | &:hover, | ||
217 | &:focus-visible { | ||
218 | @include iro.bem-sibling-elem('box') { | ||
219 | background-color: fn.color(--accent --hover --box-border); | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | |||
224 | &:indeterminate { | ||
225 | @include iro.bem-sibling-elem('box') { | ||
226 | background-color: fn.color(--accent --box-border); | ||
227 | } | ||
228 | |||
229 | &:hover, | ||
230 | &:focus-visible { | ||
231 | @include iro.bem-sibling-elem('box') { | ||
232 | background-color: fn.color(--accent --hover --box-border); | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | |||
237 | &:disabled { | ||
238 | @include iro.bem-sibling-elem('box') { | ||
239 | background-color: fn.color(--disabled --box-border); | ||
240 | |||
241 | &::before { | ||
242 | background-color: fn.color(--disabled --box-bg); | ||
243 | } | ||
244 | } | ||
245 | |||
246 | &:checked { | ||
247 | @include iro.bem-sibling-elem('box') { | ||
248 | background-color: fn.color(--disabled --box-border); | ||
249 | } | ||
250 | } | ||
251 | |||
252 | &:indeterminate { | ||
253 | @include iro.bem-sibling-elem('box') { | ||
254 | background-color: fn.color(--disabled --box-border); | ||
255 | } | ||
256 | } | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | } | ||
261 | } | ||