diff options
Diffstat (limited to 'src/objects/_button.vars.scss')
-rw-r--r-- | src/objects/_button.vars.scss | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/src/objects/_button.vars.scss b/src/objects/_button.vars.scss new file mode 100644 index 0000000..80d9274 --- /dev/null +++ b/src/objects/_button.vars.scss | |||
@@ -0,0 +1,163 @@ | |||
1 | @use 'sass:map'; | ||
2 | @use '../props'; | ||
3 | @use '../core.vars' as core; | ||
4 | |||
5 | $line-height: props.def(--o-button--line-height, 1.4) !default; | ||
6 | $pad-i: props.def(--o-button--pad-i, props.get(core.$size--200)) !default; | ||
7 | $pad-i-label: props.def(--o-button--pad-i-label, props.get(core.$size--75)) !default; | ||
8 | $pad-b: props.def(--o-button--pad-b, props.get(core.$size--65)) !default; | ||
9 | $border-width: props.def(--o-button--border-width, props.get(core.$border-width--medium)) !default; | ||
10 | $rounding: props.def(--o-button--rounding, 10em) !default; | ||
11 | $font-size: props.def(--o-button--font-size, props.get(core.$font-size--100)) !default; | ||
12 | |||
13 | $pad-i--sm: props.def(--o-button--sm--pad-i, props.get(core.$size--150)) !default; | ||
14 | $pad-i-label--sm: props.def(--o-button--sm--pad-i-label, props.get(core.$size--50)) !default; | ||
15 | $pad-b--sm: props.def(--o-button--sm--pad-b, props.get(core.$size--25)) !default; | ||
16 | $font-size--sm: props.def(--o-button--sm--font-size, props.get(core.$font-size--75)) !default; | ||
17 | |||
18 | $pad-i--lg: props.def(--o-button--lg--pad-i, props.get(core.$size--250)) !default; | ||
19 | $pad-i-label--lg: props.def(--o-button--lg--pad-i-label, props.get(core.$size--100)) !default; | ||
20 | $pad-b--lg: props.def(--o-button--lg--pad-b, props.get(core.$size--100)) !default; | ||
21 | $font-size--lg: props.def(--o-button--lg--font-size, props.get(core.$font-size--150)) !default; | ||
22 | |||
23 | $pad-i--xl: props.def(--o-button--xl--pad-i, props.get(core.$size--300)) !default; | ||
24 | $pad-i-label--xl: props.def(--o-button--xl--pad-i-label, props.get(core.$size--150)) !default; | ||
25 | $pad-b--xl: props.def(--o-button--xl--pad-b, props.get(core.$size--150)) !default; | ||
26 | $font-size--xl: props.def(--o-button--xl--font-size, props.get(core.$font-size--200)) !default; | ||
27 | |||
28 | $key-focus--border-width: props.def(--o-button--key-focus--border-width, props.get(core.$key-focus--border-width)) !default; | ||
29 | $key-focus--border-offset: props.def(--o-button--key-focus--border-offset, props.get(core.$key-focus--border-offset)) !default; | ||
30 | $key-focus--outline-width: props.def(--o-button--key-focus--outline-width, props.get(core.$key-focus--outline-width)) !default; | ||
31 | |||
32 | $sizes: ( | ||
33 | 'sm' $pad-i--sm $pad-i-label--sm $pad-b--sm $font-size--sm, | ||
34 | 'lg' $pad-i--lg $pad-i-label--lg $pad-b--lg $font-size--lg, | ||
35 | 'xl' $pad-i--xl $pad-i-label--xl $pad-b--xl $font-size--xl, | ||
36 | ) !default; | ||
37 | |||
38 | $default-theme-override: () !default; | ||
39 | $default-theme: props.def(--o-button, ( | ||
40 | --default: ( | ||
41 | --bg: props.get(core.$theme, --border-mute), | ||
42 | --label: props.get(core.$theme, --text), | ||
43 | --outline-border: props.get(core.$theme, --border), | ||
44 | --outline-label: props.get(core.$theme, --text), | ||
45 | |||
46 | --hover: ( | ||
47 | --bg: props.get(core.$theme, --border), | ||
48 | --label: props.get(core.$theme, --heading), | ||
49 | ), | ||
50 | --active: ( | ||
51 | --bg: props.get(core.$theme, --border-strong), | ||
52 | --label: props.get(core.$theme, --heading), | ||
53 | ), | ||
54 | --disabled: ( | ||
55 | --bg: props.get(core.$theme, --border-mute), | ||
56 | --outline-border: props.get(core.$theme, --border), | ||
57 | --label: props.get(core.$theme, --text-disabled), | ||
58 | ), | ||
59 | --key-focus: ( | ||
60 | --label: props.get(core.$theme, --focus --text), | ||
61 | --border: props.get(core.$theme, --focus --border), | ||
62 | --outline: props.get(core.$theme, --focus --outline), | ||
63 | ), | ||
64 | ), | ||
65 | )); | ||
66 | $default-theme: props.merge($default-theme, $default-theme-override); | ||
67 | |||
68 | $static-themes: props.def(--o-button); | ||
69 | |||
70 | @each $theme in map.keys(props.get(core.$transparent-colors)) { | ||
71 | $button-theme: #{$theme}-static; | ||
72 | |||
73 | $static-themes: props.merge($static-themes, ( | ||
74 | $button-theme: ( | ||
75 | --bg: props.get(core.$transparent-colors, $theme, --200), | ||
76 | --label: props.get(core.$transparent-colors, $theme, --900), | ||
77 | --outline-border: props.get(core.$transparent-colors, $theme, --300), | ||
78 | --outline-label: props.get(core.$transparent-colors, $theme, --900), | ||
79 | |||
80 | --hover: ( | ||
81 | --bg: props.get(core.$transparent-colors, $theme, --300), | ||
82 | --label: props.get(core.$transparent-colors, $theme, --900), | ||
83 | ), | ||
84 | |||
85 | --active: ( | ||
86 | --bg: props.get(core.$transparent-colors, $theme, --400), | ||
87 | --label: props.get(core.$transparent-colors, $theme, --900), | ||
88 | ), | ||
89 | |||
90 | --disabled: ( | ||
91 | --bg: props.get(core.$transparent-colors, $theme, --200), | ||
92 | --outline-border: props.get(core.$transparent-colors, $theme, --300), | ||
93 | --label: props.get(core.$transparent-colors, $theme, --500), | ||
94 | ), | ||
95 | |||
96 | --key-focus: ( | ||
97 | --bg: props.get(core.$transparent-colors, $theme, --100), | ||
98 | --label: props.get(core.$transparent-colors, $theme, --900), | ||
99 | --border: props.get(core.$transparent-colors, $theme, --900), | ||
100 | --outline: props.get(core.$transparent-colors, $theme, --300), | ||
101 | ), | ||
102 | |||
103 | --primary: ( | ||
104 | --bg: props.get(core.$transparent-colors, $theme, --800), | ||
105 | --label: props.get(core.$transparent-colors, $theme, --text), | ||
106 | --outline-border: props.get(core.$transparent-colors, $theme, --800), | ||
107 | --outline-label: props.get(core.$transparent-colors, $theme, --900), | ||
108 | |||
109 | --hover: ( | ||
110 | --bg: props.get(core.$transparent-colors, $theme, --900), | ||
111 | --label: props.get(core.$transparent-colors, $theme, --text), | ||
112 | ), | ||
113 | |||
114 | --active: ( | ||
115 | --bg: props.get(core.$transparent-colors, $theme, --900), | ||
116 | --label: props.get(core.$transparent-colors, $theme, --text), | ||
117 | ), | ||
118 | ) | ||
119 | ) | ||
120 | )); | ||
121 | } | ||
122 | |||
123 | $themes-config: --accent --negative !default; | ||
124 | |||
125 | $themes: props.def(--o-button, ( | ||
126 | --primary: ( | ||
127 | --bg: props.get(core.$theme, --base, --800), | ||
128 | --label: props.get(core.$theme, --base, --800-text), | ||
129 | --outline-border: props.get(core.$theme, --base, --800), | ||
130 | --outline-label: props.get(core.$theme, --text), | ||
131 | |||
132 | --hover: ( | ||
133 | --bg: props.get(core.$theme, --base, --900), | ||
134 | --label: props.get(core.$theme, --base, --900-text), | ||
135 | ), | ||
136 | |||
137 | --active: ( | ||
138 | --bg: props.get(core.$theme, --base, --900), | ||
139 | --label: props.get(core.$theme, --base, --900-text), | ||
140 | ), | ||
141 | ), | ||
142 | )); | ||
143 | |||
144 | @each $theme in $themes-config { | ||
145 | $themes: props.merge($themes, ( | ||
146 | $theme: ( | ||
147 | --bg: props.get(core.$static-colors, $theme, --900), | ||
148 | --label: props.get(core.$static-colors, $theme, --900-text), | ||
149 | --outline-border: props.get(core.$theme, $theme, --900), | ||
150 | --outline-label: props.get(core.$theme, $theme, --1000), | ||
151 | |||
152 | --hover: ( | ||
153 | --bg: props.get(core.$static-colors, $theme, --1000), | ||
154 | --label: props.get(core.$static-colors, $theme, --1000-text), | ||
155 | ), | ||
156 | |||
157 | --active: ( | ||
158 | --bg: props.get(core.$static-colors, $theme, --1100), | ||
159 | --label: props.get(core.$static-colors, $theme, --1100-text), | ||
160 | ), | ||
161 | ) | ||
162 | )); | ||
163 | } | ||