From 036550a79dc44aedf1ff1e8c7a58a7994a901820 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 23 Nov 2024 14:06:13 +0100 Subject: o-tabs -> o-tabbar --- src/_iro-design.scss | 2 +- src/objects/_tabbar.scss | 114 ++++++++++++++++++++++++++++++++++++++++++ src/objects/_tabbar.vars.scss | 25 +++++++++ src/objects/_tabs.scss | 114 ------------------------------------------ src/objects/_tabs.vars.scss | 25 --------- src_demo/index.scss | 2 +- 6 files changed, 141 insertions(+), 141 deletions(-) create mode 100644 src/objects/_tabbar.scss create mode 100644 src/objects/_tabbar.vars.scss delete mode 100644 src/objects/_tabs.scss delete mode 100644 src/objects/_tabs.vars.scss diff --git a/src/_iro-design.scss b/src/_iro-design.scss index 204e889..2010a2d 100644 --- a/src/_iro-design.scss +++ b/src/_iro-design.scss @@ -66,7 +66,7 @@ $breakpoints: ( @forward 'objects/status-indicator' as o-status-indicator--*; @forward 'objects/switch' as o-switch--*; @forward 'objects/table' as o-table--*; -@forward 'objects/tabs' as o-tabs--*; +@forward 'objects/tabbar' as o-tabbar--*; @forward 'objects/text-field' as o-text-field--*; @forward 'objects/thumbnail' as o-thumbnail--*; diff --git a/src/objects/_tabbar.scss b/src/objects/_tabbar.scss new file mode 100644 index 0000000..80fac0b --- /dev/null +++ b/src/objects/_tabbar.scss @@ -0,0 +1,114 @@ +@use 'sass:map'; +@use 'sass:meta'; +@use 'sass:string'; +@use 'iro-sass/src/bem'; +@use 'iro-sass/src/props'; +@use '../props' as *; + +@forward 'tabs.vars'; +@use 'tabs.vars' as vars; + +@mixin styles { + @include materialize-at-root(meta.module-variables('vars')); + + @include bem.object('tabs') { + position: relative; + display: flex; + gap: props.get(vars.$spacing); + min-inline-size: 0; + block-size: props.get(vars.$block-size); + overflow-inline: auto; + box-shadow: 0 calc(-1 * props.get(vars.$indicator--width)) 0 0 props.get(vars.$railing--bg-color) inset; + + @include bem.modifier('quiet') { + box-shadow: none; + } + + @include bem.modifier('adapt') { + block-size: 100%; + } + + @include bem.elem('tab') { + position: relative; + display: flex; + align-items: center; + color: props.get(vars.$tab--text-color); + white-space: nowrap; + border-block: props.get(vars.$indicator--width) solid transparent; + + &::before { + position: absolute; + inset-block-start: 50%; + inset-inline: calc(-1 * props.get(vars.$tab--pad-i)); + z-index: -10; + block-size: 1.5em; + content: ''; + border-radius: props.get(vars.$rounding); + transform: translateY(-50%); + } + + &:link, + &:visited { + &:hover, + &:active, + &:focus-visible { + color: props.get(vars.$tab--selected--text-color); + } + + &:focus-visible { + &::before { + color: props.get(vars.$key-focus--text-color); + text-decoration: none; + outline: props.get(vars.$key-focus--border-color) 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(vars.$key-focus--outline-color); + } + } + } + + @include bem.is('selected') { + color: props.get(vars.$tab--selected--text-color); + border-block-end-color: props.get(vars.$tab--selected--text-color); + } + } + + @include bem.elem('caret') { + display: none; + } + + @include bem.modifier('accent') { + @include bem.elem('tab') { + @include bem.is('selected') { + color: props.get(vars.$tab--accent--text-color); + border-block-end-color: props.get(vars.$tab--accent--text-color); + } + } + } + + @include bem.is('collapsed') { + @include bem.elem('tab') { + display: none; + + @include bem.is('selected') { + display: flex; + color: props.get(vars.$tab--text-color); + border-block-end-color: transparent; + + &:link, + &:visited { + &:hover, + &:active, + &:focus-visible { + color: props.get(vars.$tab--selected--text-color); + } + } + } + } + + @include bem.elem('caret') { + display: block; + } + } + } +} diff --git a/src/objects/_tabbar.vars.scss b/src/objects/_tabbar.vars.scss new file mode 100644 index 0000000..f4486d6 --- /dev/null +++ b/src/objects/_tabbar.vars.scss @@ -0,0 +1,25 @@ +@use 'sass:map'; +@use 'sass:string'; +@use 'iro-sass/src/props'; +@use '../core.vars' as core; + +$block-size: props.def(--o-tabbar--block-size, props.get(core.$size--700)) !default; +$rounding: props.def(--o-tabbar--rounding, props.get(core.$rounding)) !default; +$spacing: props.def(--o-tabbar--spacing, props.get(core.$size--400)) !default; +$tab--pad-i: props.def(--o-tabbar--tab--pad-i, props.get(core.$size--50)) !default; + +$indicator--width: props.def(--o-tabbar--indicator--width, props.get(core.$border-width--medium)) !default; + +$key-focus--border-width: props.def(--o-tabbar--key-focus--border-width, props.get(core.$key-focus--border-width)) !default; +$key-focus--border-offset: props.def(--o-tabbar--key-focus--border-offset, props.get(core.$key-focus--border-offset)) !default; +$key-focus--outline-width: props.def(--o-tabbar--key-focus--outline-width, props.get(core.$key-focus--outline-width)) !default; + +$tab--text-color: props.def(--o-tabbar--tab--text-color, props.get(core.$theme, --text-mute), 'color') !default; +$tab--selected--text-color: props.def(--o-tabbar--tab--selected--text-color, props.get(core.$theme, --heading), 'color') !default; +$tab--accent--text-color: props.def(--o-tabbar--tab--accent--text-color, props.get(core.$theme, --accent, --1100), 'color') !default; + +$railing--bg-color: props.def(--o-tabbar--railing--bg-color, props.get(core.$theme, --border-mute), 'color') !default; + +$key-focus--text-color: props.def(--o-tabbar--key-focus--text-color, props.get(core.$theme, --focus, --text), 'color') !default; +$key-focus--border-color: props.def(--o-tabbar--key-focus--border-color, props.get(core.$theme, --focus, --border), 'color') !default; +$key-focus--outline-color: props.def(--o-tabbar--key-focus--outline-color, props.get(core.$theme, --focus, --outline), 'color') !default; diff --git a/src/objects/_tabs.scss b/src/objects/_tabs.scss deleted file mode 100644 index 80fac0b..0000000 --- a/src/objects/_tabs.scss +++ /dev/null @@ -1,114 +0,0 @@ -@use 'sass:map'; -@use 'sass:meta'; -@use 'sass:string'; -@use 'iro-sass/src/bem'; -@use 'iro-sass/src/props'; -@use '../props' as *; - -@forward 'tabs.vars'; -@use 'tabs.vars' as vars; - -@mixin styles { - @include materialize-at-root(meta.module-variables('vars')); - - @include bem.object('tabs') { - position: relative; - display: flex; - gap: props.get(vars.$spacing); - min-inline-size: 0; - block-size: props.get(vars.$block-size); - overflow-inline: auto; - box-shadow: 0 calc(-1 * props.get(vars.$indicator--width)) 0 0 props.get(vars.$railing--bg-color) inset; - - @include bem.modifier('quiet') { - box-shadow: none; - } - - @include bem.modifier('adapt') { - block-size: 100%; - } - - @include bem.elem('tab') { - position: relative; - display: flex; - align-items: center; - color: props.get(vars.$tab--text-color); - white-space: nowrap; - border-block: props.get(vars.$indicator--width) solid transparent; - - &::before { - position: absolute; - inset-block-start: 50%; - inset-inline: calc(-1 * props.get(vars.$tab--pad-i)); - z-index: -10; - block-size: 1.5em; - content: ''; - border-radius: props.get(vars.$rounding); - transform: translateY(-50%); - } - - &:link, - &:visited { - &:hover, - &:active, - &:focus-visible { - color: props.get(vars.$tab--selected--text-color); - } - - &:focus-visible { - &::before { - color: props.get(vars.$key-focus--text-color); - text-decoration: none; - outline: props.get(vars.$key-focus--border-color) 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(vars.$key-focus--outline-color); - } - } - } - - @include bem.is('selected') { - color: props.get(vars.$tab--selected--text-color); - border-block-end-color: props.get(vars.$tab--selected--text-color); - } - } - - @include bem.elem('caret') { - display: none; - } - - @include bem.modifier('accent') { - @include bem.elem('tab') { - @include bem.is('selected') { - color: props.get(vars.$tab--accent--text-color); - border-block-end-color: props.get(vars.$tab--accent--text-color); - } - } - } - - @include bem.is('collapsed') { - @include bem.elem('tab') { - display: none; - - @include bem.is('selected') { - display: flex; - color: props.get(vars.$tab--text-color); - border-block-end-color: transparent; - - &:link, - &:visited { - &:hover, - &:active, - &:focus-visible { - color: props.get(vars.$tab--selected--text-color); - } - } - } - } - - @include bem.elem('caret') { - display: block; - } - } - } -} diff --git a/src/objects/_tabs.vars.scss b/src/objects/_tabs.vars.scss deleted file mode 100644 index 08b24cb..0000000 --- a/src/objects/_tabs.vars.scss +++ /dev/null @@ -1,25 +0,0 @@ -@use 'sass:map'; -@use 'sass:string'; -@use 'iro-sass/src/props'; -@use '../core.vars' as core; - -$block-size: props.def(--o-tabs--block-size, props.get(core.$size--700)) !default; -$rounding: props.def(--o-tabs--rounding, props.get(core.$rounding)) !default; -$spacing: props.def(--o-tabs--spacing, props.get(core.$size--400)) !default; -$tab--pad-i: props.def(--o-tabs--tab--pad-i, props.get(core.$size--50)) !default; - -$indicator--width: props.def(--o-tabs--indicator--width, props.get(core.$border-width--medium)) !default; - -$key-focus--border-width: props.def(--o-tabs--key-focus--border-width, props.get(core.$key-focus--border-width)) !default; -$key-focus--border-offset: props.def(--o-tabs--key-focus--border-offset, props.get(core.$key-focus--border-offset)) !default; -$key-focus--outline-width: props.def(--o-tabs--key-focus--outline-width, props.get(core.$key-focus--outline-width)) !default; - -$tab--text-color: props.def(--o-tabs--tab--text-color, props.get(core.$theme, --text-mute), 'color') !default; -$tab--selected--text-color: props.def(--o-tabs--tab--selected--text-color, props.get(core.$theme, --heading), 'color') !default; -$tab--accent--text-color: props.def(--o-tabs--tab--accent--text-color, props.get(core.$theme, --accent, --1100), 'color') !default; - -$railing--bg-color: props.def(--o-tabs--railing--bg-color, props.get(core.$theme, --border-mute), 'color') !default; - -$key-focus--text-color: props.def(--o-tabs--key-focus--text-color, props.get(core.$theme, --focus, --text), 'color') !default; -$key-focus--border-color: props.def(--o-tabs--key-focus--border-color, props.get(core.$theme, --focus, --border), 'color') !default; -$key-focus--outline-color: props.def(--o-tabs--key-focus--outline-color, props.get(core.$theme, --focus, --outline), 'color') !default; diff --git a/src_demo/index.scss b/src_demo/index.scss index c5d1eef..701f638 100644 --- a/src_demo/index.scss +++ b/src_demo/index.scss @@ -44,7 +44,7 @@ @include iro.o-status-indicator--styles; @include iro.o-switch--styles; @include iro.o-table--styles; -@include iro.o-tabs--styles; +@include iro.o-tabbar--styles; @include iro.o-text-field--styles; @include iro.o-thumbnail--styles; -- cgit v1.2.3-70-g09d2