From dc2a4ea99b535b97bfbf5b6b8d69ec8dab023b10 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 18 Oct 2024 23:40:20 +0200 Subject: Update --- src/_iro-design.scss | 1 + src/_themes.scss | 2 +- src/objects/_action-button.scss | 3 +- src/objects/_badge.scss | 5 +- src/objects/_badge.vars.scss | 61 +++++----- src/objects/_button.scss | 260 +++++++++------------------------------- src/objects/_button.vars.scss | 163 +++++++++++++++++++++++++ src/scopes/_links.scss | 3 +- src_demo/index.scss | 1 + 9 files changed, 259 insertions(+), 240 deletions(-) create mode 100644 src/objects/_button.vars.scss diff --git a/src/_iro-design.scss b/src/_iro-design.scss index 31be892..b8e8246 100644 --- a/src/_iro-design.scss +++ b/src/_iro-design.scss @@ -42,3 +42,4 @@ $breakpoints: ( @forward 'objects/avatar' as o-avatar--*; @forward 'objects/backdrop' as o-backdrop--*; @forward 'objects/badge' as o-badge--*; +@forward 'objects/button' as o-button--*; diff --git a/src/_themes.scss b/src/_themes.scss index a90d049..ced2aa5 100644 --- a/src/_themes.scss +++ b/src/_themes.scss @@ -205,7 +205,7 @@ $theme-dark: map.deep-merge(( $themes-override: () !default; $themes: map.deep-merge(( - main: ( + --main: ( light: $theme-light, dark: $theme-dark, ) diff --git a/src/objects/_action-button.scss b/src/objects/_action-button.scss index 129e681..48149b1 100644 --- a/src/objects/_action-button.scss +++ b/src/objects/_action-button.scss @@ -1,6 +1,7 @@ @use 'sass:list'; @use 'sass:map'; @use 'sass:meta'; +@use 'sass:string'; @use 'iro-sass/src/iro-sass' as iro; @use '../props'; @@ -138,7 +139,7 @@ @include -apply-theme(vars.$default-theme); @each $theme in map.keys(props.get(vars.$themes)) { - @include iro.bem-modifier($theme) { + @include iro.bem-modifier(string.slice($theme, 3)) { @include -apply-theme(vars.$themes, $theme); } } diff --git a/src/objects/_badge.scss b/src/objects/_badge.scss index 3f68873..5a07630 100644 --- a/src/objects/_badge.scss +++ b/src/objects/_badge.scss @@ -1,6 +1,7 @@ @use 'sass:list'; @use 'sass:map'; @use 'sass:meta'; +@use 'sass:string'; @use 'iro-sass/src/iro-sass' as iro; @use '../props'; @use '../core.vars' as core; @@ -103,13 +104,13 @@ @include -apply-theme(vars.$default-theme); @each $theme in map.keys(props.get(vars.$themes)) { - @include iro.bem-modifier($theme) { + @include iro.bem-modifier(string.slice($theme, 3)) { @include -apply-theme(vars.$themes, $theme); } } @each $theme in map.keys(props.get(vars.$static-themes)) { - @include iro.bem-modifier($theme) { + @include iro.bem-modifier(string.slice($theme, 3)) { @include -apply-theme(vars.$static-themes, $theme, true); } } diff --git a/src/objects/_badge.vars.scss b/src/objects/_badge.vars.scss index 6a3dd15..c49474b 100644 --- a/src/objects/_badge.vars.scss +++ b/src/objects/_badge.vars.scss @@ -43,35 +43,35 @@ $key-focus--outline-color: props.def(--o-avatar--key-focus--outline-color, props $default-theme-override: () !default; $default-theme: props.def(--o-badge, ( - --bg: props.def(--o-badge--bg-color, props.get(core.$theme, --text-mute)), - --label: props.def(--o-badge--label-color, props.get(core.$theme, --bg-l2)), + --bg: props.get(core.$theme, --text-mute), + --label: props.get(core.$theme, --bg-l2), --hover: ( - --bg: props.def(--o-badge--hover--bg-color, props.get(core.$theme, --text)), - --label: props.def(--o-badge--label-color, props.get(core.$theme, --bg-l2)), + --bg: props.get(core.$theme, --text), + --label: props.get(core.$theme, --bg-l2), ), --active: ( - --bg: props.def(--o-badge--active--bg-color, props.get(core.$theme, --heading)), - --label: props.def(--o-badge--label-color, props.get(core.$theme, --bg-l2)), + --bg: props.get(core.$theme, --heading), + --label: props.get(core.$theme, --bg-l2), ), --quiet: ( - --bg: props.def(--o-badge--quiet--bg-color, props.get(core.$theme, --border-mute)), - --label: props.def(--o-badge--quiet--label-color, props.get(core.$theme, --heading)), + --bg: props.get(core.$theme, --border-mute), + --label: props.get(core.$theme, --heading), --hover: ( - --bg: props.def(--o-badge--quiet--hover--bg-color, props.get(core.$theme, --border)), - --label: props.def(--o-badge--quiet--label-color, props.get(core.$theme, --heading)), + --bg: props.get(core.$theme, --border), + --label: props.get(core.$theme, --heading), ), --active: ( - --bg: props.def(--o-badge--quiet--active--bg-color, props.get(core.$theme, --border-strong)), - --label: props.def(--o-badge--quiet--label-color, props.get(core.$theme, --heading)), + --bg: props.get(core.$theme, --border-strong), + --label: props.get(core.$theme, --heading), ), ) )); -$default-theme: props.merge(--o-badge, $default-theme-override); +$default-theme: props.merge($default-theme, $default-theme-override); $static-themes: props.def(--o-badge); @@ -116,41 +116,36 @@ $static-themes: props.def(--o-badge); )); } -$themes-config: ( - accent: --accent, - positive: --positive, - negative: --negative, - warning: --warning, -) !default; +$themes-config: --accent --positive --negative --warning !default; $themes: props.def(--o-badge); -@each $theme, $key in $themes-config { +@each $theme in $themes-config { $themes: props.merge($themes, ( - $key: ( - --bg: props.get(core.$static-colors, $key, --900), - --label: props.get(core.$static-colors, $key, --900-text), + $theme: ( + --bg: props.get(core.$static-colors, $theme, --900), + --label: props.get(core.$static-colors, $theme, --900-text), --hover: ( - --bg: props.get(core.$static-colors, $key, --1000), - --label: props.get(core.$static-colors, $key, --1000-text), + --bg: props.get(core.$static-colors, $theme, --1000), + --label: props.get(core.$static-colors, $theme, --1000-text), ), --active: ( - --bg: props.get(core.$static-colors, $key, --1100), - --label: props.get(core.$static-colors, $key, --1000-text), + --bg: props.get(core.$static-colors, $theme, --1100), + --label: props.get(core.$static-colors, $theme, --1000-text), ), --quiet: ( - --bg: props.get(core.$theme, $key, --200), - --label: props.get(core.$theme, $key, --1100), + --bg: props.get(core.$theme, $theme, --200), + --label: props.get(core.$theme, $theme, --1100), --hover: ( - --bg: props.get(core.$theme, $key, --300), - --label: props.get(core.$theme, $key, --1200), + --bg: props.get(core.$theme, $theme, --300), + --label: props.get(core.$theme, $theme, --1200), ), --active: ( - --bg: props.get(core.$theme, $key, --400), - --label: props.get(core.$theme, $key, --1300), + --bg: props.get(core.$theme, $theme, --400), + --label: props.get(core.$theme, $theme, --1300), ), ) ) diff --git a/src/objects/_button.scss b/src/objects/_button.scss index 097bc21..854e1e3 100644 --- a/src/objects/_button.scss +++ b/src/objects/_button.scss @@ -1,17 +1,20 @@ @use 'sass:list'; +@use 'sass:map'; +@use 'sass:meta'; +@use 'sass:string'; @use 'iro-sass/src/iro-sass' as iro; -@use '../functions' as fn; +@use '../props'; +@use '../core.vars' as core; -$sizes: 'sm' 'lg' 'xl' !default; -$themes: 'accent' 'negative' !default; -$static-themes: 'black' 'white' !default; +@forward 'button.vars'; +@use 'button.vars' as vars; -@mixin theme($theme: ()) { +@mixin -apply-theme($theme, $key: ()) { &:link, &:visited, &:enabled { - color: fn.color(list.join($theme, --label)); - background-color: fn.color(list.join($theme, --bg)); + color: props.get($theme, list.join($key, --label)...); + background-color: props.get($theme, list.join($key, --bg)...); border-color: transparent; } @@ -19,9 +22,9 @@ $static-themes: 'black' 'white' !default; &:link, &:visited, &:enabled { - color: fn.color(list.join($theme, --outline-label)); + color: props.get($theme, list.join($key, --outline-label)); background-color: transparent; - border-color: fn.color(list.join($theme, --outline-border)); + border-color: props.get($theme, list.join($key, --outline-border)); } } @@ -30,217 +33,71 @@ $static-themes: 'black' 'white' !default; &:enabled { &:hover, &:focus-visible { - color: fn.color(list.join($theme, --hover --label)); - background-color: fn.color(list.join($theme, --hover --bg)); + color: props.get($theme, list.join($key, --hover --label)); + background-color: props.get($theme, list.join($key, --hover --bg)); border-color: transparent; } &:active { - color: fn.color(list.join($theme, --active --label)); - background-color: fn.color(list.join($theme, --active --bg)); + color: props.get($theme, list.join($key, --active --label)); + background-color: props.get($theme, list.join($key, --active --bg)); border-color: transparent; } } } -@mixin static-theme($theme: ()) { - color: fn.color(list.join($theme, --disabled --label)); - background-color: fn.color(list.join($theme, --disabled --bg)); +@mixin -apply-static-theme($theme, $key: ()) { + color: props.get($theme, list.join($key, --disabled --label)); + background-color: props.get($theme, list.join($key, --disabled --bg)); border-color: transparent; &::after { - outline: fn.color(list.join($theme, --key-focus --border)) solid fn.dim(--key-focus --border); - box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(list.join($theme, --key-focus --outline)); + outline: props.get($theme, list.join($key, --key-focus --border)) solid props.get(vars.$key-focus--border-width); + box-shadow: + 0 + 0 + 0 + calc(props.get(vars.$key-focus--border-width) + props.get(vars.$key-focus--outline-width)) + props.get($theme, list.join($key, --key-focus --outline)); } @include iro.bem-modifier('outline') { background-color: transparent; - border-color: fn.color(list.join($theme, --disabled --outline-border)); + border-color: props.get($theme, list.join($key, --disabled --outline-border)); } - @include theme($theme); + @include -apply-theme($theme, $key); @include iro.bem-modifier('primary') { - @include theme(list.join($theme, --primary)); + @include -apply-theme($theme, list.join($key, --primary)); } } -@include iro.props-namespace('button') { - @include iro.props-store(( - --dims: ( - --line-height: 1.4, - --pad-i: fn.global-dim(--size --200), - --pad-i-label: fn.global-dim(--size --75), - --pad-b: fn.global-dim(--size --65), - --border: fn.global-dim(--border --medium), - --rounding: 10em, - --font-size: fn.global-dim(--font-size --100), +@mixin styles { + @include props.materialize(meta.module-variables('vars')); - --sm: ( - --pad-i: fn.global-dim(--size --150), - --pad-i-label: fn.global-dim(--size --50), - --pad-b: fn.global-dim(--size --25), - --font-size: fn.global-dim(--font-size --75), - ), - --lg: ( - --pad-i: fn.global-dim(--size --250), - --pad-i-label: fn.global-dim(--size --100), - --pad-b: fn.global-dim(--size --100), - --font-size: fn.global-dim(--font-size --150), - ), - --xl: ( - --pad-i: fn.global-dim(--size --300), - --pad-i-label: fn.global-dim(--size --150), - --pad-b: fn.global-dim(--size --150), - --font-size: fn.global-dim(--font-size --200), - ), - - --key-focus: ( - --border: fn.global-dim(--key-focus --border), - --border-offset: fn.global-dim(--key-focus --border-offset), - --outline: fn.global-dim(--key-focus --outline), - ), - ), - --colors: ( - --bg: fn.global-color(--border-mute), - --label: fn.global-color(--text), - --outline-border: fn.global-color(--border), - --outline-label: fn.global-color(--text), - - --hover: ( - --bg: fn.global-color(--border), - --label: fn.global-color(--heading), - ), - --active: ( - --bg: fn.global-color(--border-strong), - --label: fn.global-color(--heading), - ), - --disabled: ( - --bg: fn.global-color(--border-mute), - --outline-border: fn.global-color(--border), - --label: fn.global-color(--text-disabled), - ), - --key-focus: ( - --label: fn.global-color(--focus --text), - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - - --primary: ( - --bg: fn.global-color(--base --800), - --label: fn.global-color(--base --800-text), - --outline-border: fn.global-color(--base --800), - --outline-label: fn.global-color(--text), - - --hover: ( - --bg: fn.global-color(--base --900), - --label: fn.global-color(--base --900-text), - ), - --active: ( - --bg: fn.global-color(--base --900), - --label: fn.global-color(--base --900-text), - ), - ), - ), - )); - - @each $theme in $themes { - @include iro.props-store(( - --colors: ( - --#{$theme}: ( - --bg: fn.global-color(--#{$theme}-static --900), - --label: fn.global-color(--#{$theme}-static --900-text), - --outline-border: fn.global-color(--#{$theme} --900), - --outline-label: fn.global-color(--#{$theme} --1000), - - --hover: ( - --bg: fn.global-color(--#{$theme}-static --1000), - --label: fn.global-color(--#{$theme}-static --1000-text), - ), - --active: ( - --bg: fn.global-color(--#{$theme}-static --1100), - --label: fn.global-color(--#{$theme}-static --1100-text), - ), - ), - ), - )); - } - - @each $theme in $static-themes { - @include iro.props-store(( - --colors: ( - --static-#{$theme}: ( - --bg: fn.global-color(--#{$theme}-transparent --200), - --label: fn.global-color(--#{$theme}-transparent --900), - --outline-border: fn.global-color(--#{$theme}-transparent --300), - --outline-label: fn.global-color(--#{$theme}-transparent --900), - - --hover: ( - --bg: fn.global-color(--#{$theme}-transparent --300), - --label: fn.global-color(--#{$theme}-transparent --900), - ), - --active: ( - --bg: fn.global-color(--#{$theme}-transparent --400), - --label: fn.global-color(--#{$theme}-transparent --900), - ), - --disabled: ( - --bg: fn.global-color(--#{$theme}-transparent --200), - --outline-border: fn.global-color(--#{$theme}-transparent --300), - --label: fn.global-color(--#{$theme}-transparent --500), - ), - --key-focus: ( - --bg: fn.global-color(--#{$theme}-transparent --100), - --label: fn.global-color(--#{$theme}-transparent --900), - --border: fn.global-color(--#{$theme}-transparent --900), - --outline: fn.global-color(--#{$theme}-transparent --300), - ), - - --primary: ( - --bg: fn.global-color(--#{$theme}-transparent --800), - --label: fn.global-color(--#{$theme}-transparent --text), - --outline-border: fn.global-color(--#{$theme}-transparent --800), - --outline-label: fn.global-color(--#{$theme}-transparent --900), - - --hover: ( - --bg: fn.global-color(--#{$theme}-transparent --900), - --label: fn.global-color(--#{$theme}-transparent --text), - ), - --active: ( - --bg: fn.global-color(--#{$theme}-transparent --900), - --label: fn.global-color(--#{$theme}-transparent --text), - ), - ), - ), - ), - )); - } - - @include iro.bem-object(iro.props-namespace()) { + @include iro.bem-object('button') { position: relative; display: inline-block; - padding-block: fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - font-size: fn.dim(--font-size); + padding-block: props.get(vars.$pad-b); + padding-inline: props.get(vars.$pad-i); + font-size: props.get(vars.$font-size); font-weight: 500; - line-height: fn.dim(--line-height); - color: fn.color(--disabled --label); + line-height: props.get(vars.$line-height); text-align: center; text-decoration: none; - background-color: fn.color(--disabled --bg); - border: fn.dim(--border) solid transparent; - border-color: fn.color(--disabled --bg); - border-radius: fn.dim(--rounding); + border: props.get(vars.$border-width) solid transparent; + border-radius: props.get(vars.$rounding); &::after { position: absolute; - inset: calc(-1 * fn.dim(--border) - fn.dim(--key-focus --border-offset)); + inset: calc(-1 * props.get(vars.$border-width) - props.get(vars.$key-focus--border-offset)); z-index: 1; display: none; pointer-events: none; content: ''; - border-radius: calc(fn.dim(--rounding) + fn.dim(--key-focus --border-offset)); - outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); - box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + border-radius: calc(props.get(vars.$rounding) + props.get(vars.$key-focus--border-offset)); + outline: transparent solid props.get(vars.$key-focus--border-width); } &:link, @@ -254,7 +111,7 @@ $static-themes: 'black' 'white' !default; } @include iro.bem-elem('label') { - margin-inline: fn.dim(--pad-i-label); + margin-inline: props.get(vars.$pad-i-label); } @include iro.bem-modifier('block') { @@ -263,37 +120,36 @@ $static-themes: 'black' 'white' !default; @include iro.bem-modifier('outline') { background-color: transparent; - border-color: fn.color(--disabled --outline-border); } - @each $size in $sizes { - @include iro.bem-modifier($size) { - padding-block: fn.dim(--#{$size} --pad-b); - padding-inline: fn.dim(--#{$size} --pad-i); - font-size: fn.dim(--#{$size} --font-size); + @each $mod, $pad-i, $pad-i-label, $pad-b, $font-size in vars.$sizes { + @include iro.bem-modifier($mod) { + padding-block: props.get($pad-b); + padding-inline: props.get($pad-i); + font-size: props.get($font-size); @include iro.bem-elem('label') { - margin-inline: fn.dim(--#{$size} --pad-i-label); + margin-inline: props.get($pad-i-label); } } } - @include static-theme; - - @each $theme in $themes { - @include iro.bem-modifier($theme) { - @include theme(--#{$theme}); + @include -apply-static-theme(vars.$default-theme); + + @each $theme in map.keys(props.get(vars.$themes)) { + @include iro.bem-modifier(string.slice($theme, 3)) { + @include -apply-theme(vars.$themes, $theme); } } - - @each $theme in $static-themes { - @include iro.bem-modifier(static-#{$theme}) { - @include static-theme(--static-#{$theme}); + + @each $theme in map.keys(props.get(vars.$static-themes)) { + @include iro.bem-modifier(string.slice($theme, 3)) { + @include -apply-static-theme(vars.$static-themes, $theme); } } @include iro.bem-modifier('round') { - inline-size: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-b)); + inline-size: calc(1em * props.get(vars.$line-height) + 2 * props.get(vars.$pad-b)); padding-inline: 0; border-radius: 100em; } 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), + ), + ) + )); +} diff --git a/src/scopes/_links.scss b/src/scopes/_links.scss index 69793b2..81412aa 100644 --- a/src/scopes/_links.scss +++ b/src/scopes/_links.scss @@ -1,5 +1,6 @@ @use 'sass:map'; @use 'sass:meta'; +@use 'sass:string'; @use 'iro-sass/src/iro-sass' as iro; @use '../props'; @@ -66,7 +67,7 @@ } @each $theme in map.keys(props.get(vars.$static-themes)) { - @include iro.bem-modifier($theme) { + @include iro.bem-modifier(string.slice($theme, 3)) { :link, :visited { color: props.get(vars.$static-themes, $theme, --text-color); diff --git a/src_demo/index.scss b/src_demo/index.scss index 5e102a1..4e5c8dd 100644 --- a/src_demo/index.scss +++ b/src_demo/index.scss @@ -21,3 +21,4 @@ @include iro.o-avatar--styles; @include iro.o-backdrop--styles; @include iro.o-badge--styles; +@include iro.o-button--styles; -- cgit v1.2.3-70-g09d2