summaryrefslogtreecommitdiffstats
path: root/src/objects/_text-field.scss
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2022-02-06 17:17:33 +0100
committerVolpeon <git@volpeon.ink>2022-02-06 17:17:33 +0100
commit3524f1bac11c8a9d1640bfeac5ceb063ff96d623 (patch)
tree52907b3161045c2d24bba18442c1ece9c12986a6 /src/objects/_text-field.scss
parentUpdated action button (diff)
downloadiro-design-3524f1bac11c8a9d1640bfeac5ceb063ff96d623.tar.gz
iro-design-3524f1bac11c8a9d1640bfeac5ceb063ff96d623.tar.bz2
iro-design-3524f1bac11c8a9d1640bfeac5ceb063ff96d623.zip
Improved variable structure
Diffstat (limited to 'src/objects/_text-field.scss')
-rw-r--r--src/objects/_text-field.scss96
1 files changed, 50 insertions, 46 deletions
diff --git a/src/objects/_text-field.scss b/src/objects/_text-field.scss
index 51b8c5a..aef79d7 100644
--- a/src/objects/_text-field.scss
+++ b/src/objects/_text-field.scss
@@ -1,32 +1,33 @@
1@use 'iro-sass/src/index' as iro; 1@use 'iro-sass/src/index' as iro;
2@use '../functions' as fn;
2@use '../vars'; 3@use '../vars';
3@use '../mixins/typography'; 4@use '../mixins/typography';
4 5
5@mixin invalid { 6@mixin invalid {
6 @include iro.bem-sibling-elem('bg') { 7 @include iro.bem-sibling-elem('bg') {
7 border-color: iro.props-get(--colors --error --border); 8 border-color: fn.color(--error --border);
8 box-shadow: iro.props-get(--colors --error --shadow); 9 box-shadow: fn.color(--error --shadow);
9 } 10 }
10 11
11 &:hover { 12 &:hover {
12 @include iro.bem-sibling-elem('bg') { 13 @include iro.bem-sibling-elem('bg') {
13 border-color: iro.props-get(--colors --error --hover --border); 14 border-color: fn.color(--error --hover --border);
14 box-shadow: iro.props-get(--colors --error --hover --shadow); 15 box-shadow: fn.color(--error --hover --shadow);
15 } 16 }
16 } 17 }
17 18
18 &:focus { 19 &:focus {
19 @include iro.bem-sibling-elem('bg') { 20 @include iro.bem-sibling-elem('bg') {
20 border-color: iro.props-get(--colors --error --focus --border); 21 border-color: fn.color(--error --focus --border);
21 box-shadow: iro.props-get(--colors --error --focus --shadow); 22 box-shadow: fn.color(--error --focus --shadow);
22 } 23 }
23 } 24 }
24} 25}
25 26
26@mixin keyboard-focus { 27@mixin keyboard-focus {
27 @include iro.bem-sibling-elem('bg') { 28 @include iro.bem-sibling-elem('bg') {
28 border-color: iro.props-get(--colors --key-focus --border); 29 border-color: fn.color(--key-focus --border);
29 box-shadow: iro.props-get(--colors --key-focus --shadow); 30 box-shadow: fn.color(--key-focus --shadow);
30 } 31 }
31} 32}
32 33
@@ -35,60 +36,63 @@
35 --dims: ( 36 --dims: (
36 --padding-x: .6rem, 37 --padding-x: .6rem,
37 --padding-y: .5rem, 38 --padding-y: .5rem,
38 --border-width: iro.props-get(--dims --border-width --thin, $global: true), 39 --border-width: fn.dim(--border-width --thin, $global: true),
39 --border-radius: 2px, 40 --border-radius: 2px,
40 41
41 --focus: ( 42 --focus: (
42 --border-width: iro.props-get(--dims --border-width --medium, $global: true), 43 --border-width: fn.dim(--border-width --medium, $global: true),
43 ) 44 )
44 ), 45 ),
46 ), 'dims');
47
48 @include iro.props-store((
45 --colors: ( 49 --colors: (
46 --bg: iro.props-get(--colors --bg-hi2, $global: true), 50 --bg: fn.color(--bg-hi2, $global: true),
47 --placeholder: iro.props-get(--colors --fg-hi2, $global: true), 51 --placeholder: fn.color(--fg-hi2, $global: true),
48 --text: iro.props-get(--colors --fg, $global: true), 52 --text: fn.color(--fg, $global: true),
49 --border: iro.props-get(--colors --obj-lo, $global: true), 53 --border: fn.color(--obj-lo, $global: true),
50 --shadow: 0 0 0 0 transparent, 54 --shadow: 0 0 0 0 transparent,
51 55
52 --hover: ( 56 --hover: (
53 --border: iro.props-get(--colors --fg-hi2, $global: true), 57 --border: fn.color(--fg-hi2, $global: true),
54 --shadow: 0 0 0 0 transparent, 58 --shadow: 0 0 0 0 transparent,
55 ), 59 ),
56 --focus: ( 60 --focus: (
57 --border: iro.props-get(--colors --accent --primary, $global: true), 61 --border: fn.color(--accent --primary, $global: true),
58 --shadow: 0 0 0 0 transparent, 62 --shadow: 0 0 0 0 transparent,
59 ), 63 ),
60 --key-focus: ( 64 --key-focus: (
61 --border: iro.props-get(--colors --focus --fill, $global: true), 65 --border: fn.color(--focus --fill, $global: true),
62 --shadow: iro.props-get(--colors --focus --shadow, $global: true), 66 --shadow: fn.color(--focus --shadow, $global: true),
63 ), 67 ),
64 --error: ( 68 --error: (
65 --border: iro.props-get(--colors --accent --error-hi, $global: true), 69 --border: fn.color(--accent --error-hi, $global: true),
66 --shadow: 0 0 0 0 transparent, 70 --shadow: 0 0 0 0 transparent,
67 71
68 --hover: ( 72 --hover: (
69 --border: iro.props-get(--colors --accent --error, $global: true), 73 --border: fn.color(--accent --error, $global: true),
70 --shadow: 0 0 0 0 transparent, 74 --shadow: 0 0 0 0 transparent,
71 ), 75 ),
72 --focus: ( 76 --focus: (
73 --border: iro.props-get(--colors --accent --error, $global: true), 77 --border: fn.color(--accent --error, $global: true),
74 --shadow: 0 0 0 0 transparent, 78 --shadow: 0 0 0 0 transparent,
75 ), 79 ),
76 ), 80 ),
77 --disabled: ( 81 --disabled: (
78 --bg: iro.props-get(--colors --obj-hi, $global: true), 82 --bg: fn.color(--obj-hi, $global: true),
79 --placeholder: iro.props-get(--colors --fg-hi3, $global: true), 83 --placeholder: fn.color(--fg-hi3, $global: true),
80 --text: iro.props-get(--colors --fg-hi3, $global: true), 84 --text: fn.color(--fg-hi3, $global: true),
81 --border: iro.props-get(--colors --obj-hi, $global: true), 85 --border: fn.color(--obj-hi, $global: true),
82 --shadow: 0 0 0 0 transparent, 86 --shadow: 0 0 0 0 transparent,
83 ), 87 ),
84 ), 88 ),
85 )); 89 ), 'colors');
86 90
87 @include iro.bem-object(iro.props-namespace()) { 91 @include iro.bem-object(iro.props-namespace()) {
88 position: relative; 92 position: relative;
89 min-width: 0; 93 min-width: 0;
90 padding: iro.props-get(--dims --padding-y) iro.props-get(--dims --padding-x); 94 padding: fn.dim(--padding-y) fn.dim(--padding-x);
91 background-color: iro.props-get(--colors --bg); 95 background-color: fn.color(--bg);
92 96
93 @include iro.bem-elem('bg') { 97 @include iro.bem-elem('bg') {
94 display: block; 98 display: block;
@@ -97,9 +101,9 @@
97 right: 0; 101 right: 0;
98 bottom: 0; 102 bottom: 0;
99 left: 0; 103 left: 0;
100 border: iro.props-get(--dims --border-width) solid iro.props-get(--colors --border); 104 border: fn.dim(--border-width) solid fn.color(--border);
101 border-radius: iro.props-get(--dims --border-radius); 105 border-radius: fn.dim(--border-radius);
102 box-shadow: iro.props-get(--colors --shadow); 106 box-shadow: fn.color(--shadow);
103 pointer-events: none; 107 pointer-events: none;
104 } 108 }
105 109
@@ -107,19 +111,19 @@
107 @include typography.set-font(vars.$font--main, (size: 1em, line-height: vars.$line-height)); 111 @include typography.set-font(vars.$font--main, (size: 1em, line-height: vars.$line-height));
108 112
109 width: 100%; 113 width: 100%;
110 color: iro.props-get(--colors --text); 114 color: fn.color(--text);
111 resize: none; 115 resize: none;
112 116
113 &::placeholder { 117 &::placeholder {
114 opacity: 1; 118 opacity: 1;
115 color: iro.props-get(--colors --placeholder); 119 color: fn.color(--placeholder);
116 font-style: italic; 120 font-style: italic;
117 } 121 }
118 122
119 &:hover { 123 &:hover {
120 @include iro.bem-sibling-elem('bg') { 124 @include iro.bem-sibling-elem('bg') {
121 border-color: iro.props-get(--colors --hover --border); 125 border-color: fn.color(--hover --border);
122 box-shadow: iro.props-get(--colors --hover --shadow); 126 box-shadow: fn.color(--hover --shadow);
123 } 127 }
124 } 128 }
125 129
@@ -127,15 +131,15 @@
127 outline: 0; 131 outline: 0;
128 132
129 @include iro.bem-sibling-elem('bg') { 133 @include iro.bem-sibling-elem('bg') {
130 $offset: calc(iro.props-get(--dims --border-width) - iro.props-get(--dims --focus --border-width)); 134 $offset: calc(fn.dim(--border-width) - fn.dim(--focus --border-width));
131 135
132 top: $offset; 136 top: $offset;
133 right: $offset; 137 right: $offset;
134 bottom: $offset; 138 bottom: $offset;
135 left: $offset; 139 left: $offset;
136 border: iro.props-get(--dims --focus --border-width) solid iro.props-get(--colors --focus --border); 140 border: fn.dim(--focus --border-width) solid fn.color(--focus --border);
137 border-radius: calc(iro.props-get(--dims --border-radius) - $offset); 141 border-radius: calc(fn.dim(--border-radius) - $offset);
138 box-shadow: iro.props-get(--colors --focus --shadow); 142 box-shadow: fn.color(--focus --shadow);
139 } 143 }
140 } 144 }
141 145
@@ -172,29 +176,29 @@
172 176
173 @include iro.bem-elem('native') { 177 @include iro.bem-elem('native') {
174 box-sizing: border-box; 178 box-sizing: border-box;
175 padding: iro.props-get(--dims --padding-y) iro.props-get(--dims --padding-x); 179 padding: fn.dim(--padding-y) fn.dim(--padding-x);
176 } 180 }
177 } 181 }
178 182
179 @include iro.bem-is('disabled') { 183 @include iro.bem-is('disabled') {
180 background-color: iro.props-get(--colors --disabled --bg); 184 background-color: fn.color(--disabled --bg);
181 185
182 @include iro.bem-elem('native') { 186 @include iro.bem-elem('native') {
183 color: iro.props-get(--colors --disabled --text); 187 color: fn.color(--disabled --text);
184 188
185 &::placeholder { 189 &::placeholder {
186 color: iro.props-get(--colors --disabled --placeholder); 190 color: fn.color(--disabled --placeholder);
187 } 191 }
188 } 192 }
189 193
190 @include iro.bem-elem('bg') { 194 @include iro.bem-elem('bg') {
191 border-color: iro.props-get(--colors --disabled --border); 195 border-color: fn.color(--disabled --border);
192 } 196 }
193 197
194 @include iro.bem-is('invalid') { 198 @include iro.bem-is('invalid') {
195 @include iro.bem-elem('native') { 199 @include iro.bem-elem('native') {
196 @include iro.bem-sibling-elem('bg') { 200 @include iro.bem-sibling-elem('bg') {
197 border-color: iro.props-get(--colors --disabled --border); 201 border-color: fn.color(--disabled --border);
198 } 202 }
199 } 203 }
200 } 204 }
@@ -202,7 +206,7 @@
202 @include iro.bem-elem('native') { 206 @include iro.bem-elem('native') {
203 &:invalid { 207 &:invalid {
204 @include iro.bem-sibling-elem('bg') { 208 @include iro.bem-sibling-elem('bg') {
205 border-color: iro.props-get(--colors --disabled --border); 209 border-color: fn.color(--disabled --border);
206 } 210 }
207 } 211 }
208 } 212 }