summaryrefslogtreecommitdiffstats
path: root/src/objects/_button.scss
diff options
context:
space:
mode:
Diffstat (limited to 'src/objects/_button.scss')
-rw-r--r--src/objects/_button.scss74
1 files changed, 43 insertions, 31 deletions
diff --git a/src/objects/_button.scss b/src/objects/_button.scss
index a823f17..1a0e52c 100644
--- a/src/objects/_button.scss
+++ b/src/objects/_button.scss
@@ -2,7 +2,7 @@
2@use 'iro-sass/src/index' as iro; 2@use 'iro-sass/src/index' as iro;
3@use '../functions' as fn; 3@use '../functions' as fn;
4 4
5$themes: primary accent positive negative warning; 5$themes: accent negative;
6 6
7@mixin button-variant($theme: null) { 7@mixin button-variant($theme: null) {
8 $key: if($theme == null, (), --#{$theme}); 8 $key: if($theme == null, (), --#{$theme});
@@ -19,6 +19,7 @@ $themes: primary accent positive negative warning;
19 &:link, 19 &:link,
20 &:visited, 20 &:visited,
21 &:enabled { 21 &:enabled {
22 border-color: fn.color(list.join($key, --outline-border));
22 background-color: transparent; 23 background-color: transparent;
23 color: fn.color(list.join($key, --outline-label)); 24 color: fn.color(list.join($key, --outline-label));
24 } 25 }
@@ -66,11 +67,16 @@ $themes: primary accent positive negative warning;
66 --pad-b: fn.global-dim(--size --150), 67 --pad-b: fn.global-dim(--size --150),
67 --font-size: fn.global-dim(--font-size --200), 68 --font-size: fn.global-dim(--font-size --200),
68 ), 69 ),
70
71 --key-focus: (
72 --border: fn.global-dim(--key-focus --border),
73 ),
69 ), 74 ),
70 --colors: ( 75 --colors: (
71 --bg: fn.global-color(--border-mute), 76 --bg: fn.global-color(--border-mute),
72 --label: fn.global-color(--text), 77 --label: fn.global-color(--text),
73 --outline-label: fn.global-color(--text), 78 --outline-border: fn.global-color(--border),
79 --outline-label: fn.global-color(--text),
74 80
75 --hover: ( 81 --hover: (
76 --bg: fn.global-color(--border), 82 --bg: fn.global-color(--border),
@@ -81,19 +87,21 @@ $themes: primary accent positive negative warning;
81 --label: fn.global-color(--heading), 87 --label: fn.global-color(--heading),
82 ), 88 ),
83 --disabled: ( 89 --disabled: (
84 --bg: fn.global-color(--border-mute), 90 --bg: fn.global-color(--border-mute),
85 --label: fn.global-color(--text-disabled), 91 --outline-border: fn.global-color(--border),
92 --label: fn.global-color(--text-disabled),
86 ), 93 ),
87 --key-focus: ( 94 --key-focus: (
88 --bg: fn.global-color(--base --50), 95 --bg: fn.global-color(--base --50),
89 --label: fn.global-color(--heading), 96 --label: fn.global-color(--heading),
90 --border: fn.global-color(--yellow-static --400), 97 --border: fn.global-color(--focus-static --400),
91 ), 98 ),
92 99
93 --primary: ( 100 --primary: (
94 --bg: fn.global-color(--base --800), 101 --bg: fn.global-color(--base --800),
95 --label: fn.global-color(--base --800-text), 102 --label: fn.global-color(--base --800-text),
96 --outline-label: fn.global-color(--text), 103 --outline-border: fn.global-color(--base --800),
104 --outline-label: fn.global-color(--text),
97 105
98 --hover: ( 106 --hover: (
99 --bg: fn.global-color(--base --900), 107 --bg: fn.global-color(--base --900),
@@ -108,26 +116,25 @@ $themes: primary accent positive negative warning;
108 )); 116 ));
109 117
110 @each $theme in $themes { 118 @each $theme in $themes {
111 @if $theme != primary { 119 @include iro.props-store((
112 @include iro.props-store(( 120 --colors: (
113 --colors: ( 121 --#{$theme}: (
114 --#{$theme}: ( 122 --bg: fn.global-color(--#{$theme}-static --900),
115 --bg: fn.global-color(--#{$theme} --900), 123 --label: fn.global-color(--#{$theme}-static --900-text),
116 --label: fn.global-color(--#{$theme} --900-text), 124 --outline-border: fn.global-color(--#{$theme} --900),
117 --outline-label: fn.global-color(--#{$theme} --1000), 125 --outline-label: fn.global-color(--#{$theme} --1000),
118 126
119 --hover: ( 127 --hover: (
120 --bg: fn.global-color(--#{$theme} --1000), 128 --bg: fn.global-color(--#{$theme}-static --1000),
121 --label: fn.global-color(--#{$theme} --1000-text), 129 --label: fn.global-color(--#{$theme}-static --1000-text),
122 ), 130 ),
123 --active: ( 131 --active: (
124 --bg: fn.global-color(--#{$theme} --1100), 132 --bg: fn.global-color(--#{$theme}-static --1100),
125 --label: fn.global-color(--#{$theme} --1100-text), 133 --label: fn.global-color(--#{$theme}-static --1100-text),
126 ),
127 ), 134 ),
128 ), 135 ),
129 )); 136 ),
130 } 137 ));
131 } 138 }
132 139
133 @include iro.bem-object(iro.props-namespace()) { 140 @include iro.bem-object(iro.props-namespace()) {
@@ -151,6 +158,7 @@ $themes: primary accent positive negative warning;
151 } 158 }
152 159
153 @include iro.bem-modifier('outline') { 160 @include iro.bem-modifier('outline') {
161 border-color: fn.color(--disabled --outline-border);
154 background-color: transparent; 162 background-color: transparent;
155 box-shadow: none; 163 box-shadow: none;
156 } 164 }
@@ -164,6 +172,10 @@ $themes: primary accent positive negative warning;
164 } 172 }
165 173
166 @include button-variant(); 174 @include button-variant();
175
176 @include iro.bem-modifier('primary') {
177 @include button-variant('primary');
178 }
167 179
168 @each $theme in $themes { 180 @each $theme in $themes {
169 @include iro.bem-modifier($theme) { 181 @include iro.bem-modifier($theme) {
@@ -177,7 +189,7 @@ $themes: primary accent positive negative warning;
177 &:focus-visible { 189 &:focus-visible {
178 border-color: fn.color(--key-focus --border); 190 border-color: fn.color(--key-focus --border);
179 background-color: fn.color(--key-focus --bg); 191 background-color: fn.color(--key-focus --bg);
180 box-shadow: 0 0 0 calc(fn.global-dim(--border --thick) - fn.dim(--border)) fn.color(--key-focus --border); 192 box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) - fn.dim(--border)) fn.color(--key-focus --border);
181 color: fn.color(--key-focus --label); 193 color: fn.color(--key-focus --label);
182 } 194 }
183 } 195 }