From 4de75e0f305b2cb4a026073440f2bac7c34df817 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 25 Jun 2024 17:39:03 +0200 Subject: Focus indicator style --- src/scopes/_links.scss | 33 ++++++++------ src/scopes/_tables.scss | 115 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+), 13 deletions(-) create mode 100644 src/scopes/_tables.scss (limited to 'src/scopes') diff --git a/src/scopes/_links.scss b/src/scopes/_links.scss index 9e0b18a..552b02a 100644 --- a/src/scopes/_links.scss +++ b/src/scopes/_links.scss @@ -9,7 +9,13 @@ --hover: ( --underline: fn.global-dim(--border --medium), - ) + ), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --border), + ), ), --colors: ( --underline: fn.global-color(--text-mute-more), @@ -33,22 +39,24 @@ ), --key-focus: ( - --bg: fn.global-color(--focus-static --400), - --text: fn.global-color(--focus-static --400-text), - ) - ) + --text: fn.global-color(--focus --text), + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + ), )); @include iro.bem-scope(iro.props-namespace()) { :link, :visited { - margin: calc(-1 * fn.global-dim(--border --thick)); - padding: fn.global-dim(--border --thick); - border-radius: calc(fn.dim(--rounding) + fn.global-dim(--border --thick)); + margin: calc(-1 * fn.dim(--key-focus --border-offset)); + padding: fn.dim(--key-focus --border-offset); + border-radius: fn.dim(--rounding); color: currentColor; text-decoration: underline; text-decoration-color: fn.color(--underline); text-decoration-thickness: fn.dim(--underline); + box-decoration-break: clone; &:hover { text-decoration: underline; @@ -57,11 +65,10 @@ } &:focus-visible { - background-color: fn.color(--key-focus --bg); - color: fn.color(--key-focus --text); - text-decoration: underline; - text-decoration-thickness: fn.dim(--hover --underline); - text-decoration-skip-ink: none; + 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); + color: fn.color(--key-focus --text); + text-decoration: none; } } diff --git a/src/scopes/_tables.scss b/src/scopes/_tables.scss new file mode 100644 index 0000000..016ed31 --- /dev/null +++ b/src/scopes/_tables.scss @@ -0,0 +1,115 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use '../mixins' as mx; + +@include iro.props-namespace('tables') { + @include iro.props-store(( + --dims: ( + --pad-i: fn.foreign-dim(--table, --pad-i), + --pad-b: fn.foreign-dim(--table, --pad-b), + --rounding: fn.foreign-dim(--table, --rounding), + --border: fn.foreign-dim(--table, --border), + --margin-bs: fn.global-dim(--paragraph --margin-bs), + ), + --colors: ( + --border: fn.foreign-color(--table, --border), + --heading: fn.foreign-color(--table, --heading), + --box: ( + --bg: fn.foreign-color(--table, --box --bg), + ) + ) + )); + + @include iro.bem-scope(iro.props-namespace()) { + table { + margin-block-start: fn.dim(--margin-bs); + border-spacing: 0; + border-collapse: separate; + } + + th { + @include mx.set-font(--standard, ( + --line-height: null, + --size: fn.global-dim(--font-size --50), + --weight: bold, + --transform: uppercase, + --spacing: .5px + )); + + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + color: fn.color(--heading); + text-align: left; + } + + td { + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + border-width: 0; + border-block-start-width: fn.dim(--border); + border-style: solid; + border-color: fn.color(--border); + } + + tr { + &:last-child { + td { + border-block-end-width: fn.dim(--border); + } + } + } + + @include iro.bem-modifier('flush') { + th, + td { + &:first-child { + padding-inline-start: 0; + } + + &:last-child { + padding-inline-end: 0; + } + } + } + + @include iro.bem-modifier('box') { + td { + background-color: fn.color(--box --bg); + + &:first-child { + border-inline-start-width: fn.dim(--border); + } + + &:last-child { + border-inline-end-width: fn.dim(--border); + } + } + + tr { + &:first-child { + td { + &:first-child { + border-start-start-radius: fn.dim(--rounding); + } + + &:last-child { + border-start-end-radius: fn.dim(--rounding); + } + } + } + + &:last-child { + td { + &:first-child { + border-end-start-radius: fn.dim(--rounding); + } + + &:last-child { + border-end-end-radius: fn.dim(--rounding); + } + } + } + } + } + } +} -- cgit v1.2.3-54-g00ecf