From dc2a4ea99b535b97bfbf5b6b8d69ec8dab023b10 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 18 Oct 2024 23:40:20 +0200 Subject: Update --- src/objects/_button.vars.scss | 163 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 src/objects/_button.vars.scss (limited to 'src/objects/_button.vars.scss') 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 @@ +@use 'sass:map'; +@use '../props'; +@use '../core.vars' as core; + +$line-height: props.def(--o-button--line-height, 1.4) !default; +$pad-i: props.def(--o-button--pad-i, props.get(core.$size--200)) !default; +$pad-i-label: props.def(--o-button--pad-i-label, props.get(core.$size--75)) !default; +$pad-b: props.def(--o-button--pad-b, props.get(core.$size--65)) !default; +$border-width: props.def(--o-button--border-width, props.get(core.$border-width--medium)) !default; +$rounding: props.def(--o-button--rounding, 10em) !default; +$font-size: props.def(--o-button--font-size, props.get(core.$font-size--100)) !default; + +$pad-i--sm: props.def(--o-button--sm--pad-i, props.get(core.$size--150)) !default; +$pad-i-label--sm: props.def(--o-button--sm--pad-i-label, props.get(core.$size--50)) !default; +$pad-b--sm: props.def(--o-button--sm--pad-b, props.get(core.$size--25)) !default; +$font-size--sm: props.def(--o-button--sm--font-size, props.get(core.$font-size--75)) !default; + +$pad-i--lg: props.def(--o-button--lg--pad-i, props.get(core.$size--250)) !default; +$pad-i-label--lg: props.def(--o-button--lg--pad-i-label, props.get(core.$size--100)) !default; +$pad-b--lg: props.def(--o-button--lg--pad-b, props.get(core.$size--100)) !default; +$font-size--lg: props.def(--o-button--lg--font-size, props.get(core.$font-size--150)) !default; + +$pad-i--xl: props.def(--o-button--xl--pad-i, props.get(core.$size--300)) !default; +$pad-i-label--xl: props.def(--o-button--xl--pad-i-label, props.get(core.$size--150)) !default; +$pad-b--xl: props.def(--o-button--xl--pad-b, props.get(core.$size--150)) !default; +$font-size--xl: props.def(--o-button--xl--font-size, props.get(core.$font-size--200)) !default; + +$key-focus--border-width: props.def(--o-button--key-focus--border-width, props.get(core.$key-focus--border-width)) !default; +$key-focus--border-offset: props.def(--o-button--key-focus--border-offset, props.get(core.$key-focus--border-offset)) !default; +$key-focus--outline-width: props.def(--o-button--key-focus--outline-width, props.get(core.$key-focus--outline-width)) !default; + +$sizes: ( + 'sm' $pad-i--sm $pad-i-label--sm $pad-b--sm $font-size--sm, + 'lg' $pad-i--lg $pad-i-label--lg $pad-b--lg $font-size--lg, + 'xl' $pad-i--xl $pad-i-label--xl $pad-b--xl $font-size--xl, +) !default; + +$default-theme-override: () !default; +$default-theme: props.def(--o-button, ( + --default: ( + --bg: props.get(core.$theme, --border-mute), + --label: props.get(core.$theme, --text), + --outline-border: props.get(core.$theme, --border), + --outline-label: props.get(core.$theme, --text), + + --hover: ( + --bg: props.get(core.$theme, --border), + --label: props.get(core.$theme, --heading), + ), + --active: ( + --bg: props.get(core.$theme, --border-strong), + --label: props.get(core.$theme, --heading), + ), + --disabled: ( + --bg: props.get(core.$theme, --border-mute), + --outline-border: props.get(core.$theme, --border), + --label: props.get(core.$theme, --text-disabled), + ), + --key-focus: ( + --label: props.get(core.$theme, --focus --text), + --border: props.get(core.$theme, --focus --border), + --outline: props.get(core.$theme, --focus --outline), + ), + ), +)); +$default-theme: props.merge($default-theme, $default-theme-override); + +$static-themes: props.def(--o-button); + +@each $theme in map.keys(props.get(core.$transparent-colors)) { + $button-theme: #{$theme}-static; + + $static-themes: props.merge($static-themes, ( + $button-theme: ( + --bg: props.get(core.$transparent-colors, $theme, --200), + --label: props.get(core.$transparent-colors, $theme, --900), + --outline-border: props.get(core.$transparent-colors, $theme, --300), + --outline-label: props.get(core.$transparent-colors, $theme, --900), + + --hover: ( + --bg: props.get(core.$transparent-colors, $theme, --300), + --label: props.get(core.$transparent-colors, $theme, --900), + ), + + --active: ( + --bg: props.get(core.$transparent-colors, $theme, --400), + --label: props.get(core.$transparent-colors, $theme, --900), + ), + + --disabled: ( + --bg: props.get(core.$transparent-colors, $theme, --200), + --outline-border: props.get(core.$transparent-colors, $theme, --300), + --label: props.get(core.$transparent-colors, $theme, --500), + ), + + --key-focus: ( + --bg: props.get(core.$transparent-colors, $theme, --100), + --label: props.get(core.$transparent-colors, $theme, --900), + --border: props.get(core.$transparent-colors, $theme, --900), + --outline: props.get(core.$transparent-colors, $theme, --300), + ), + + --primary: ( + --bg: props.get(core.$transparent-colors, $theme, --800), + --label: props.get(core.$transparent-colors, $theme, --text), + --outline-border: props.get(core.$transparent-colors, $theme, --800), + --outline-label: props.get(core.$transparent-colors, $theme, --900), + + --hover: ( + --bg: props.get(core.$transparent-colors, $theme, --900), + --label: props.get(core.$transparent-colors, $theme, --text), + ), + + --active: ( + --bg: props.get(core.$transparent-colors, $theme, --900), + --label: props.get(core.$transparent-colors, $theme, --text), + ), + ) + ) + )); +} + +$themes-config: --accent --negative !default; + +$themes: props.def(--o-button, ( + --primary: ( + --bg: props.get(core.$theme, --base, --800), + --label: props.get(core.$theme, --base, --800-text), + --outline-border: props.get(core.$theme, --base, --800), + --outline-label: props.get(core.$theme, --text), + + --hover: ( + --bg: props.get(core.$theme, --base, --900), + --label: props.get(core.$theme, --base, --900-text), + ), + + --active: ( + --bg: props.get(core.$theme, --base, --900), + --label: props.get(core.$theme, --base, --900-text), + ), + ), +)); + +@each $theme in $themes-config { + $themes: props.merge($themes, ( + $theme: ( + --bg: props.get(core.$static-colors, $theme, --900), + --label: props.get(core.$static-colors, $theme, --900-text), + --outline-border: props.get(core.$theme, $theme, --900), + --outline-label: props.get(core.$theme, $theme, --1000), + + --hover: ( + --bg: props.get(core.$static-colors, $theme, --1000), + --label: props.get(core.$static-colors, $theme, --1000-text), + ), + + --active: ( + --bg: props.get(core.$static-colors, $theme, --1100), + --label: props.get(core.$static-colors, $theme, --1100-text), + ), + ) + )); +} -- cgit v1.2.3-70-g09d2