summaryrefslogtreecommitdiffstats
path: root/src/objects/_radio.scss
diff options
context:
space:
mode:
Diffstat (limited to 'src/objects/_radio.scss')
-rw-r--r--src/objects/_radio.scss86
1 files changed, 45 insertions, 41 deletions
diff --git a/src/objects/_radio.scss b/src/objects/_radio.scss
index 213b7c4..fd821d3 100644
--- a/src/objects/_radio.scss
+++ b/src/objects/_radio.scss
@@ -1,61 +1,65 @@
1@use 'iro-sass/src/index' as iro; 1@use 'iro-sass/src/index' as iro;
2@use '../functions' as fn;
2 3
3@include iro.props-namespace('radio') { 4@include iro.props-namespace('radio') {
4 @include iro.props-store(( 5 @include iro.props-store((
5 --dims: ( 6 --dims: (
6 --diameter: iro.fn-px-to-rem(15px), 7 --diameter: iro.fn-px-to-rem(15px),
7 --label-gap: .6rem, 8 --label-gap: .6rem,
8 --border-width: iro.props-get(--dims --border-width --medium, $global: true), 9 --border-width: fn.dim(--border-width --medium, $global: true),
9 --padding-x: .3rem, 10 --padding-x: .3rem,
10 --padding-y: .3rem, 11 --padding-y: .3rem,
11 --margin-right: iro.props-get(--dims --spacing --x --md, $global: true), 12 --margin-right: fn.dim(--spacing --x --md, $global: true),
12 ), 13 ),
14 ), 'dims');
15
16 @include iro.props-store((
13 --colors: ( 17 --colors: (
14 --circle-border: iro.props-get(--colors --fg-hi, $global: true), 18 --circle-border: fn.color(--fg-hi, $global: true),
15 --circle-bg: iro.props-get(--colors --bg-hi, $global: true), 19 --circle-bg: fn.color(--bg-hi, $global: true),
16 20
17 --hover: ( 21 --hover: (
18 --label: iro.props-get(--colors --fg-lo, $global: true), 22 --label: fn.color(--fg-lo, $global: true),
19 --circle-border: iro.props-get(--colors --fg, $global: true), 23 --circle-border: fn.color(--fg, $global: true),
20 ), 24 ),
21 --accent: ( 25 --accent: (
22 --circle-border: iro.props-get(--colors --accent --primary, $global: true), 26 --circle-border: fn.color(--accent --primary, $global: true),
23 27
24 --hover: ( 28 --hover: (
25 --circle-border: iro.props-get(--colors --accent --primary-lo, $global: true), 29 --circle-border: fn.color(--accent --primary-lo, $global: true),
26 ), 30 ),
27 ), 31 ),
28 --key-focus: ( 32 --key-focus: (
29 --label: iro.props-get(--colors --focus --text, $global: true), 33 --label: fn.color(--focus --text, $global: true),
30 --circle-border: iro.props-get(--colors --focus --fill, $global: true), 34 --circle-border: fn.color(--focus --fill, $global: true),
31 --shadow: iro.props-get(--colors --focus --shadow, $global: true), 35 --shadow: fn.color(--focus --shadow, $global: true),
32 ), 36 ),
33 --disabled: ( 37 --disabled: (
34 --label: iro.props-get(--colors --fg-hi3, $global: true), 38 --label: fn.color(--fg-hi3, $global: true),
35 --circle-border: iro.props-get(--colors --obj-lo, $global: true), 39 --circle-border: fn.color(--obj-lo, $global: true),
36 --circle-bg: iro.props-get(--colors --bg-hi, $global: true), 40 --circle-bg: fn.color(--bg-hi, $global: true),
37 ) 41 )
38 ), 42 ),
39 )); 43 ), 'colors');
40 44
41 @include iro.bem-object(iro.props-namespace()) { 45 @include iro.bem-object(iro.props-namespace()) {
42 display: inline-flex; 46 display: inline-flex;
43 position: relative; 47 position: relative;
44 align-items: flex-start; 48 align-items: flex-start;
45 margin-right: calc(-1 * iro.props-get(--dims --padding-x) + iro.props-get(--dims --margin-right)); 49 margin-right: calc(-1 * fn.dim(--padding-x) + fn.dim(--margin-right));
46 margin-left: calc(-1 * iro.props-get(--dims --padding-x)); 50 margin-left: calc(-1 * fn.dim(--padding-x));
47 padding: iro.props-get(--dims --padding-y) iro.props-get(--dims --padding-x); 51 padding: fn.dim(--padding-y) fn.dim(--padding-x);
48 52
49 @include iro.bem-elem('circle') { 53 @include iro.bem-elem('circle') {
50 display: block; 54 display: block;
51 position: relative; 55 position: relative;
52 box-sizing: border-box; 56 box-sizing: border-box;
53 flex: 0 0 auto; 57 flex: 0 0 auto;
54 width: iro.props-get(--dims --diameter); 58 width: fn.dim(--diameter);
55 height: iro.props-get(--dims --diameter); 59 height: fn.dim(--diameter);
56 margin-top: calc(.5 * (#{$line-height * 1em} - #{iro.props-get(--dims --diameter)})); 60 margin-top: calc(.5 * (#{$line-height * 1em} - #{fn.dim(--diameter)}));
57 border-radius: 2em; 61 border-radius: 2em;
58 background-color: iro.props-get(--colors --circle-border); 62 background-color: fn.color(--circle-border);
59 63
60 &::after { 64 &::after {
61 content: ''; 65 content: '';
@@ -63,19 +67,19 @@
63 position: absolute; 67 position: absolute;
64 z-index: 10; 68 z-index: 10;
65 top: 50%; 69 top: 50%;
66 left: iro.props-get(--dims --border-width); 70 left: fn.dim(--border-width);
67 width: calc(iro.props-get(--dims --diameter) - 2 * iro.props-get(--dims --border-width)); 71 width: calc(fn.dim(--diameter) - 2 * fn.dim(--border-width));
68 height: calc(iro.props-get(--dims --diameter) - 2 * iro.props-get(--dims --border-width)); 72 height: calc(fn.dim(--diameter) - 2 * fn.dim(--border-width));
69 transform: translateY(-50%); 73 transform: translateY(-50%);
70 transition: transform .2s ease; 74 transition: transform .2s ease;
71 border-radius: iro.props-get(--dims --diameter); 75 border-radius: fn.dim(--diameter);
72 background-color: iro.props-get(--colors --circle-bg); 76 background-color: fn.color(--circle-bg);
73 } 77 }
74 } 78 }
75 79
76 @include iro.bem-elem('label') { 80 @include iro.bem-elem('label') {
77 align-self: baseline; 81 align-self: baseline;
78 margin-left: iro.props-get(--dims --label-gap); 82 margin-left: fn.dim(--label-gap);
79 } 83 }
80 84
81 @include iro.bem-elem('native') { 85 @include iro.bem-elem('native') {
@@ -91,11 +95,11 @@
91 95
92 &:hover { 96 &:hover {
93 @include iro.bem-sibling-elem('label') { 97 @include iro.bem-sibling-elem('label') {
94 color: iro.props-get(--colors --hover --label); 98 color: fn.color(--hover --label);
95 } 99 }
96 100
97 @include iro.bem-sibling-elem('circle') { 101 @include iro.bem-sibling-elem('circle') {
98 background-color: iro.props-get(--colors --hover --circle-border); 102 background-color: fn.color(--hover --circle-border);
99 } 103 }
100 } 104 }
101 105
@@ -109,14 +113,14 @@
109 113
110 &:disabled { 114 &:disabled {
111 @include iro.bem-sibling-elem('label') { 115 @include iro.bem-sibling-elem('label') {
112 color: iro.props-get(--colors --disabled --label); 116 color: fn.color(--disabled --label);
113 } 117 }
114 118
115 @include iro.bem-sibling-elem('circle') { 119 @include iro.bem-sibling-elem('circle') {
116 background-color: iro.props-get(--colors --disabled --circle-border); 120 background-color: fn.color(--disabled --circle-border);
117 121
118 &::after { 122 &::after {
119 background-color: iro.props-get(--colors --disabled --circle-bg); 123 background-color: fn.color(--disabled --circle-bg);
120 } 124 }
121 } 125 }
122 } 126 }
@@ -124,12 +128,12 @@
124 @include iro.bem-at-theme('keyboard') { 128 @include iro.bem-at-theme('keyboard') {
125 &:focus { 129 &:focus {
126 @include iro.bem-sibling-elem('label') { 130 @include iro.bem-sibling-elem('label') {
127 color: iro.props-get(--colors --key-focus --label); 131 color: fn.color(--key-focus --label);
128 } 132 }
129 133
130 @include iro.bem-sibling-elem('circle') { 134 @include iro.bem-sibling-elem('circle') {
131 background-color: iro.props-get(--colors --key-focus --circle-border); 135 background-color: fn.color(--key-focus --circle-border);
132 box-shadow: iro.props-get(--colors --key-focus --shadow); 136 box-shadow: fn.color(--key-focus --shadow);
133 } 137 }
134 } 138 }
135 } 139 }
@@ -139,28 +143,28 @@
139 @include iro.bem-elem('native') { 143 @include iro.bem-elem('native') {
140 &:checked { 144 &:checked {
141 @include iro.bem-sibling-elem('circle') { 145 @include iro.bem-sibling-elem('circle') {
142 background-color: iro.props-get(--colors --accent --circle-border); 146 background-color: fn.color(--accent --circle-border);
143 } 147 }
144 148
145 &:hover { 149 &:hover {
146 @include iro.bem-sibling-elem('circle') { 150 @include iro.bem-sibling-elem('circle') {
147 background-color: iro.props-get(--colors --accent --hover --circle-border); 151 background-color: fn.color(--accent --hover --circle-border);
148 } 152 }
149 } 153 }
150 } 154 }
151 155
152 &:disabled { 156 &:disabled {
153 @include iro.bem-sibling-elem('circle') { 157 @include iro.bem-sibling-elem('circle') {
154 background-color: iro.props-get(--colors --disabled --circle-border); 158 background-color: fn.color(--disabled --circle-border);
155 159
156 &::after { 160 &::after {
157 background-color: iro.props-get(--colors --disabled --circle-bg); 161 background-color: fn.color(--disabled --circle-bg);
158 } 162 }
159 } 163 }
160 164
161 &:checked { 165 &:checked {
162 @include iro.bem-sibling-elem('circle') { 166 @include iro.bem-sibling-elem('circle') {
163 background-color: iro.props-get(--colors --disabled --circle-border); 167 background-color: fn.color(--disabled --circle-border);
164 } 168 }
165 } 169 }
166 } 170 }