From 50f6acc739f24bfa2ca080d08e90d82f8fa83543 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 17 Oct 2024 16:45:00 +0200 Subject: Revamped variable management --- src/objects/_action-button.scss | 343 ------------------------------------- src/objects/_alert.scss | 43 ----- src/objects/_avatar.scss | 167 ------------------ src/objects/_backdrop.scss | 26 --- src/objects/_badge.scss | 300 -------------------------------- src/objects/_button.scss | 301 -------------------------------- src/objects/_card.scss | 170 ------------------ src/objects/_checkbox.scss | 261 ---------------------------- src/objects/_divider.scss | 203 ---------------------- src/objects/_emoji.scss | 73 -------- src/objects/_field-label.scss | 86 ---------- src/objects/_heading.scss | 118 ------------- src/objects/_icon.scss | 26 --- src/objects/_lightbox.scss | 313 --------------------------------- src/objects/_menu.scss | 137 --------------- src/objects/_palette.scss | 62 ------- src/objects/_popover.scss | 51 ------ src/objects/_radio.scss | 185 -------------------- src/objects/_side-nav.scss | 122 ------------- src/objects/_status-indicator.scss | 39 ----- src/objects/_switch.scss | 222 ------------------------ src/objects/_table.scss | 168 ------------------ src/objects/_text-field.scss | 213 ----------------------- 23 files changed, 3629 deletions(-) delete mode 100644 src/objects/_action-button.scss delete mode 100644 src/objects/_alert.scss delete mode 100644 src/objects/_avatar.scss delete mode 100644 src/objects/_backdrop.scss delete mode 100644 src/objects/_badge.scss delete mode 100644 src/objects/_button.scss delete mode 100644 src/objects/_card.scss delete mode 100644 src/objects/_checkbox.scss delete mode 100644 src/objects/_divider.scss delete mode 100644 src/objects/_emoji.scss delete mode 100644 src/objects/_field-label.scss delete mode 100644 src/objects/_heading.scss delete mode 100644 src/objects/_icon.scss delete mode 100644 src/objects/_lightbox.scss delete mode 100644 src/objects/_menu.scss delete mode 100644 src/objects/_palette.scss delete mode 100644 src/objects/_popover.scss delete mode 100644 src/objects/_radio.scss delete mode 100644 src/objects/_side-nav.scss delete mode 100644 src/objects/_status-indicator.scss delete mode 100644 src/objects/_switch.scss delete mode 100644 src/objects/_table.scss delete mode 100644 src/objects/_text-field.scss (limited to 'src/objects') diff --git a/src/objects/_action-button.scss b/src/objects/_action-button.scss deleted file mode 100644 index 7fe9d44..0000000 --- a/src/objects/_action-button.scss +++ /dev/null @@ -1,343 +0,0 @@ -@use 'sass:list'; -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -$sizes: 'sm' 'lg' 'xl' !default; -$static-themes: 'black' 'white' !default; - -@mixin static-theme($theme: ()) { - border-color: fn.color(list.join($theme, --disabled --border)); - background-color: fn.color(list.join($theme, --disabled --bg)); - color: fn.color(list.join($theme, --disabled --label)); - - &::after { - outline-color: fn.color(list.join($theme, --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)); - } - - &:link, - &:visited, - &:enabled { - border-color: fn.color(list.join($theme, --border)); - background-color: fn.color(list.join($theme, --bg)); - color: fn.color(list.join($theme, --label)); - - &:hover, - &:focus-visible { - border-color: fn.color(list.join($theme, --hover --border)); - background-color: fn.color(list.join($theme, --hover --bg)); - color: fn.color(list.join($theme, --hover --label)); - } - - &:active { - border-color: fn.color(list.join($theme, --active --border)); - background-color: fn.color(list.join($theme, --active --bg)); - color: fn.color(list.join($theme, --active --label)); - } - } - - @include iro.bem-modifier('quiet') { - border-color: transparent; - background-color: transparent; - color: fn.color(list.join($theme, --quiet --disabled --label)); - - &:link, - &:visited, - &:enabled { - border-color: transparent; - background-color: transparent; - color: fn.color(list.join($theme, --quiet --label)); - - &:hover, - &:focus-visible { - border-color: transparent; - background-color: fn.color(list.join($theme, --quiet --hover --bg)); - color: fn.color(list.join($theme, --quiet --hover --label)); - } - - &:active { - border-color: transparent; - background-color: fn.color(list.join($theme, --quiet --active --bg)); - color: fn.color(list.join($theme, --quiet --active --label)); - } - } - } - - @include iro.bem-is('selected') { - border-color: fn.color(list.join($theme, --selected --disabled --border)); - background-color: fn.color(list.join($theme, --selected --disabled --bg)); - color: fn.color(list.join($theme, --selected --disabled --label)); - - &:link, - &:visited, - &:enabled { - border-color: fn.color(list.join($theme, --selected --border)); - background-color: fn.color(list.join($theme, --selected --bg)); - color: fn.color(list.join($theme, --selected --label)); - - &:hover, - &:focus-visible { - border-color: fn.color(list.join($theme, --selected --hover --border)); - background-color: fn.color(list.join($theme, --selected --hover --bg)); - color: fn.color(list.join($theme, --selected --hover --label)); - } - - &:active { - border-color: fn.color(list.join($theme, --selected --active --border)); - background-color: fn.color(list.join($theme, --selected --active --bg)); - color: fn.color(list.join($theme, --selected --active --label)); - } - } - } -} - -@include iro.props-namespace('action-button') { - @include iro.props-store(( - --dims: ( - --line-height: 1.4, - --pad-i: fn.global-dim(--size --150), - --pad-i-pill: fn.global-dim(--size --200), - --pad-b: fn.global-dim(--size --85), - --border: fn.global-dim(--border --thin), - --rounding: fn.global-dim(--rounding), - --font-size: fn.global-dim(--font-size --100), - - --sm: ( - --pad-i: fn.global-dim(--size --100), - --pad-i-pill: fn.global-dim(--size --150), - --pad-b: fn.global-dim(--size --40), - --font-size: fn.global-dim(--font-size --75), - ), - --lg: ( - --pad-i: fn.global-dim(--size --175), - --pad-i-pill: fn.global-dim(--size --225), - --pad-b: fn.global-dim(--size --115), - --font-size: fn.global-dim(--font-size --150), - ), - --xl: ( - --pad-i: fn.global-dim(--size --225), - --pad-i-pill: fn.global-dim(--size --300), - --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(--base --75), - --label: fn.global-color(--text), - --border: fn.global-color(--border-strong), - - --hover: ( - --bg: fn.global-color(--border-mute), - --label: fn.global-color(--heading), - --border: fn.global-color(--text-mute-more), - ), - --active: ( - --bg: fn.global-color(--border), - --label: fn.global-color(--heading), - --border: fn.global-color(--text-mute), - ), - --disabled: ( - --bg: fn.global-color(--bg-l1), - --label: fn.global-color(--border-strong), - --border: fn.global-color(--border), - ), - --key-focus: ( - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - - --selected: ( - --bg: fn.global-color(--text-mute), - --label: fn.global-color(--base --50), - --border: fn.global-color(--text-mute), - - --hover: ( - --bg: fn.global-color(--text), - --label: fn.global-color(--base --50), - --border: fn.global-color(--text), - ), - --active: ( - --bg: fn.global-color(--heading), - --label: fn.global-color(--base --50), - --border: fn.global-color(--heading), - ), - --disabled: ( - --bg: fn.global-color(--border-mute), - --label: fn.global-color(--border-strong), - --border: fn.global-color(--border-mute), - ), - ), - - --quiet: ( - --label: fn.global-color(--text), - - --hover: ( - --bg: fn.global-color(--border-mute), - --label: fn.global-color(--heading), - ), - --active: ( - --bg: fn.global-color(--border), - --label: fn.global-color(--heading), - ), - --disabled: ( - --label: fn.global-color(--border-strong), - ), - ), - ), - )); - - @each $theme in $static-themes { - @include iro.props-store(( - --colors: ( - --static-#{$theme}: ( - --bg: fn.global-color(--#{$theme}-transparent --100), - --label: fn.global-color(--#{$theme}-transparent --900), - --border: fn.global-color(--#{$theme}-transparent --400), - - --hover: ( - --bg: fn.global-color(--#{$theme}-transparent --300), - --label: fn.global-color(--#{$theme}-transparent --900), - --border: fn.global-color(--#{$theme}-transparent --500), - ), - --active: ( - --bg: fn.global-color(--#{$theme}-transparent --400), - --label: fn.global-color(--#{$theme}-transparent --900), - --border: fn.global-color(--#{$theme}-transparent --600), - ), - --disabled: ( - --bg: fn.global-color(--#{$theme}-transparent --100), - --label: fn.global-color(--#{$theme}-transparent --500), - --border: fn.global-color(--#{$theme}-transparent --300), - ), - --key-focus: ( - --border: fn.global-color(--#{$theme}-transparent --900), - --outline: fn.global-color(--#{$theme}-transparent --300), - ), - - --selected: ( - --bg: fn.global-color(--#{$theme}-transparent --800), - --label: fn.global-color(--#{$theme}-transparent --text), - --border: fn.global-color(--#{$theme}-transparent --100), - - --hover: ( - --bg: fn.global-color(--#{$theme}-transparent --900), - --label: fn.global-color(--#{$theme}-transparent --text), - --border: fn.global-color(--#{$theme}-transparent --100), - ), - --active: ( - --bg: fn.global-color(--#{$theme}-transparent --900), - --label: fn.global-color(--#{$theme}-transparent --text), - --border: fn.global-color(--#{$theme}-transparent --100), - ), - --disabled: ( - --bg: fn.global-color(--#{$theme}-transparent --200), - --label: fn.global-color(--#{$theme}-transparent --500), - --border: fn.global-color(--#{$theme}-transparent --100), - ), - ), - - --quiet: ( - --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: ( - --label: fn.global-color(--#{$theme}-transparent --500), - ), - ), - ), - ) - )); - } - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - position: relative; - padding-block: fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - border: fn.dim(--border) solid fn.color(--disabled --border); - border-radius: fn.dim(--rounding); - background-color: fn.color(--disabled --bg); - color: fn.color(--disabled --label); - line-height: fn.dim(--line-height); - text-align: center; - text-decoration: none; - text-overflow: ellipsis; - white-space: nowrap; - - &::after { - content: ''; - display: none; - position: absolute; - z-index: 1; - inset: calc(-1 * fn.dim(--border) - fn.dim(--key-focus --border-offset)); - 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); - pointer-events: none; - } - - &:link, - &:visited, - &:enabled { - &:focus-visible { - &::after { - display: block; - } - } - } - - @include static-theme; - - @each $theme in $static-themes { - @include iro.bem-modifier(static-#{$theme}) { - @include static-theme(--static-#{$theme}); - } - } - - @include iro.bem-modifier('pill') { - padding-inline: fn.dim(--pad-i-pill); - border-radius: 100em; - - &::after { - border-radius: 100em; - } - } - - @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); - - @include iro.bem-modifier('pill') { - padding-inline: fn.dim(--#{$size} --pad-i-pill); - } - } - } - - @include iro.bem-modifier('icon') { - inline-size: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-b)); - padding-inline: 0; - - @each $size in $sizes { - @include iro.bem-modifier($size) { - inline-size: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--#{$size} --pad-b)); - padding-inline: 0; - } - } - } - } -} diff --git a/src/objects/_alert.scss b/src/objects/_alert.scss deleted file mode 100644 index 067c00c..0000000 --- a/src/objects/_alert.scss +++ /dev/null @@ -1,43 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -$themes: 'accent' 'positive' 'negative' 'warning' !default; - -@include iro.props-namespace('alert') { - @include iro.props-store(( - --dims: ( - --border: fn.global-dim(--border --medium), - --pad-i: fn.global-dim(--size --250), - --pad-b: fn.global-dim(--size --200), - --rounding: fn.global-dim(--rounding), - ), - --colors: ( - --bg: fn.global-color(--bg-l2), - --border: fn.global-color(--text-mute-more), - ), - )); - - @each $theme in $themes { - @include iro.props-store(( - --colors: ( - --#{$theme}: ( - --border: fn.global-color(--#{$theme} --700), - ), - ), - )); - } - - @include iro.bem-object(iro.props-namespace()) { - padding-block: fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - border: fn.dim(--border) solid fn.color(--border); - border-radius: fn.dim(--rounding); - background-color: fn.color(--bg); - - @each $theme in $themes { - @include iro.bem-modifier($theme) { - border-color: fn.color(--#{$theme} --border); - } - } - } -} diff --git a/src/objects/_avatar.scss b/src/objects/_avatar.scss deleted file mode 100644 index 19bff10..0000000 --- a/src/objects/_avatar.scss +++ /dev/null @@ -1,167 +0,0 @@ -@use 'sass:list'; -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -$sizes: 'xs' 'sm' 'lg' 'xl' 'xxl' 'xxxl'; - -@mixin status($size: ()) { - @include iro.bem-elem('status') { - inline-size: fn.dim(list.join($size, --indicator-size)); - block-size: fn.dim(list.join($size, --indicator-size)); - - @include iro.bem-next-elem('content') { - mask-image: radial-gradient( - circle calc(.5 * fn.dim(list.join($size, --indicator-size)) + fn.dim(--indicator-spacing)) at - calc(100% - .5 * fn.dim(list.join($size, --indicator-size))) - calc(100% - .5 * fn.dim(list.join($size, --indicator-size))), - transparent 95%, - #fff - ); - } - } -} - -@include iro.props-namespace('avatar') { - @include iro.props-store(( - --dims: ( - --size: fn.global-dim(--size --500), - --font-size: fn.global-dim(--font-size --100), - --indicator-size: fn.global-dim(--size --150), - --indicator-spacing: fn.global-dim(--size --40), - --rounding: 25%, - - --xxxl: ( - --size: fn.global-dim(--size --1600), - --font-size: fn.global-dim(--font-size --800), - --indicator-size: fn.global-dim(--size --400), - ), - --xxl: ( - --size: fn.global-dim(--size --1200), - --font-size: fn.global-dim(--font-size --600), - --indicator-size: fn.global-dim(--size --300), - ), - --xl: ( - --size: fn.global-dim(--size --800), - --font-size: fn.global-dim(--font-size --300), - --indicator-size: fn.global-dim(--size --225), - ), - --lg: ( - --size: fn.global-dim(--size --650), - --font-size: fn.global-dim(--font-size --200), - --indicator-size: fn.global-dim(--size --175), - ), - --sm: ( - --size: fn.global-dim(--size --375), - --font-size: fn.global-dim(--font-size --75), - --indicator-size: fn.global-dim(--size --125), - ), - --xs: ( - --size: fn.global-dim(--size --250), - --font-size: fn.global-dim(--font-size --50), - --indicator-size: fn.global-dim(--size --100), - ), - - --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: ( - --h: 354, - --s: 44%, - --l: 45%, - - --key-focus: ( - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - position: relative; - border-radius: fn.dim(--rounding); - font-size: fn.dim(--font-size); - font-style: normal; - vertical-align: .05em; - - &::after { - content: ''; - display: none; - position: absolute; - z-index: 1; - inset: calc(-1 * fn.dim(--key-focus --border-offset)); - border: fn.dim(--key-focus --border-offset) solid transparent; - border-radius: fn.dim(--rounding); - 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); - pointer-events: none; - } - - @include iro.bem-elem('status') { - position: absolute; - inset-inline-end: 0; - inset-block-end: 0; - } - - @include status; - - @include iro.bem-elem('content') { - display: block; - inline-size: fn.dim(--size); - block-size: fn.dim(--size); - border-radius: fn.dim(--rounding); - line-height: fn.dim(--size); - text-align: center; - object-fit: cover; - object-position: center center; - } - - @include iro.bem-modifier('circle') { - border-radius: 100%; - - &::after { - border-radius: 100%; - } - - @include iro.bem-elem('content') { - border-radius: 100%; - } - } - - @include iro.bem-modifier('placeholder') { - @include iro.bem-elem('content') { - background-color: hsl(0, 0%, fn.color(--l)); - } - } - - @include iro.bem-modifier('colored') { - @include iro.bem-elem('content') { - background-color: hsl(fn.color(--h), fn.color(--s), fn.color(--l)); - color: #fff; - } - } - - @each $size in $sizes { - @include iro.bem-modifier($size) { - font-size: fn.dim(--#{$size} --font-size); - - @include status(--#{$size}); - - @include iro.bem-elem('content') { - inline-size: fn.dim(--#{$size} --size); - block-size: fn.dim(--#{$size} --size); - line-height: fn.dim(--#{$size} --size); - } - } - } - - &:focus-visible { - &::after { - display: block; - } - } - } -} diff --git a/src/objects/_backdrop.scss b/src/objects/_backdrop.scss deleted file mode 100644 index d0eaf52..0000000 --- a/src/objects/_backdrop.scss +++ /dev/null @@ -1,26 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('backdrop') { - @include iro.props-store(( - --dims: ( - --z-index: 10000, - --blur: 2em, - ), - --colors: ( - --bg: rgba(#000, .75), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - display: flex; - position: fixed; - z-index: fn.dim(--z-index); - inset: 0; - box-sizing: border-box; - flex-direction: column; - overflow: auto; - background-color: fn.color(--bg); - backdrop-filter: blur(fn.dim(--blur)); - } -} diff --git a/src/objects/_badge.scss b/src/objects/_badge.scss deleted file mode 100644 index 4e1662f..0000000 --- a/src/objects/_badge.scss +++ /dev/null @@ -1,300 +0,0 @@ -@use 'sass:string'; -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -$sizes: 'sm' 'lg' 'xl' !default; -$themes: 'accent' 'positive' 'negative' 'warning' !default; -$static-themes: 'black' 'white' !default; - -@mixin theme($theme) { - background-color: fn.color(--#{$theme} --bg); - color: fn.color(--#{$theme} --label); - - &:link, - &:visited, - &:enabled { - &:hover, - &:focus-visible { - background-color: fn.color(--#{$theme} --hover --bg); - color: fn.color(--#{$theme} --hover --label); - } - - &:active { - background-color: fn.color(--#{$theme} --active --bg); - color: fn.color(--#{$theme} --active --label); - } - } - - @include iro.bem-modifier('quiet') { - background-color: fn.color(--#{$theme}-quiet --bg); - color: fn.color(--#{$theme}-quiet --label); - - &:link, - &:visited, - &:enabled { - &:hover, - &:focus-visible { - background-color: fn.color(--#{$theme}-quiet --hover --bg); - color: fn.color(--#{$theme}-quiet --hover --label); - } - - &:active { - background-color: fn.color(--#{$theme}-quiet --active --bg); - color: fn.color(--#{$theme}-quiet --active --label); - } - } - } - - @if string.slice($theme, 1, 7) == 'static-' { - &::after { - outline: fn.color(--#{$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(--#{$theme} --key-focus --outline); - } - } -} - -@include iro.props-namespace('badge') { - @include iro.props-store(( - --dims: ( - --pad-b: fn.global-dim(--size --50), - --pad-i: fn.global-dim(--size --100), - --pad-i-pill: fn.global-dim(--size --150), - --pad-i-label: fn.global-dim(--size --50), - --rounding: fn.global-dim(--rounding), - --font-size: fn.global-dim(--font-size --75), - - --sm: ( - --pad-b: fn.global-dim(--size --25), - --pad-i: fn.global-dim(--size --75), - --pad-i-pill: fn.global-dim(--size --125), - --pad-i-label: fn.global-dim(--size --25), - --font-size: fn.global-dim(--font-size --50), - ), - --lg: ( - --pad-b: fn.global-dim(--size --75), - --pad-i: fn.global-dim(--size --125), - --pad-i-pill: fn.global-dim(--size --175), - --pad-i-label: fn.global-dim(--size --50), - --font-size: fn.global-dim(--font-size --100), - ), - --xl: ( - --pad-b: fn.global-dim(--size --100), - --pad-i: fn.global-dim(--size --150), - --pad-i-pill: fn.global-dim(--size --225), - --pad-i-label: fn.global-dim(--size --75), - --font-size: fn.global-dim(--font-size --150), - ), - - --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(--text-mute), - --label: fn.global-color(--bg-l2), - --hover: ( - --bg: fn.global-color(--text), - ), - --active: ( - --bg: fn.global-color(--heading), - ), - --key-focus: ( - --label: fn.global-color(--focus --text), - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - - --quiet: ( - --bg: fn.global-color(--border-mute), - --label: fn.global-color(--heading), - --hover: ( - --bg: fn.global-color(--border), - ), - --active: ( - --bg: fn.global-color(--border-strong), - ), - ), - ), - )); - - @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), - --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 --1000-text), - ), - ), - - --#{$theme}-quiet: ( - --bg: fn.global-color(--#{$theme} --200), - --label: fn.global-color(--#{$theme} --1100), - --hover: ( - --bg: fn.global-color(--#{$theme} --300), - --label: fn.global-color(--#{$theme} --1200), - ), - --active: ( - --bg: fn.global-color(--#{$theme} --400), - --label: fn.global-color(--#{$theme} --1300), - ), - ) - ), - )); - } - - @each $theme in $static-themes { - @include iro.props-store(( - --colors: ( - --static-#{$theme}: ( - --bg: fn.global-color(--#{$theme}-transparent --800), - --label: fn.global-color(--#{$theme}-transparent --text), - --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), - ), - --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), - ), - ), - - --static-#{$theme}-quiet: ( - --bg: fn.global-color(--#{$theme}-transparent --200), - --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), - ), - ) - ) - )); - } - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - position: relative; - padding-block: fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - border-radius: fn.dim(--rounding); - background-color: fn.color(--bg); - background-clip: padding-box; - color: fn.color(--label); - font-size: fn.dim(--font-size); - line-height: fn.global-dim(--font --standard --line-height); - text-align: center; - text-decoration: none; - - &::after { - content: ''; - display: none; - position: absolute; - z-index: 1; - inset: calc(-1 * fn.dim(--key-focus --border-offset)); - 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); - pointer-events: none; - } - - &:link, - &:visited, - &:enabled { - &:hover, - &:focus-visible { - background-color: fn.color(--hover --bg); - } - - &:active { - background-color: fn.color(--active --bg); - } - } - - @include iro.bem-elem('label') { - margin-inline: fn.dim(--pad-i-label); - } - - @include iro.bem-modifier('quiet') { - background-color: fn.color(--quiet --bg); - color: fn.color(--quiet --label); - - &:link, - &:visited, - &:enabled { - &:hover, - &:focus-visible { - background-color: fn.color(--quiet --hover --bg); - } - - &:active { - background-color: fn.color(--quiet --active --bg); - } - } - } - - @each $theme in $themes { - @include iro.bem-modifier($theme) { - @include theme($theme); - } - } - - &:link, - &:visited, - &:enabled { - &:focus-visible { - &::after { - display: block; - } - } - } - - @each $theme in $static-themes { - @include iro.bem-modifier(static-#{$theme}) { - @include theme(static-#{$theme}); - } - } - - @include iro.bem-modifier('pill') { - padding-inline: fn.dim(--pad-i-pill); - border-radius: 10em; - - &::after { - border-radius: 10em; - } - } - - @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); - - @include iro.bem-elem('label') { - margin-inline: fn.dim(--#{$size} --pad-i-label); - } - - @include iro.bem-modifier('pill') { - padding-inline: fn.dim(--#{$size} --pad-i-pill); - } - } - } - } -} diff --git a/src/objects/_button.scss b/src/objects/_button.scss deleted file mode 100644 index 3ef4813..0000000 --- a/src/objects/_button.scss +++ /dev/null @@ -1,301 +0,0 @@ -@use 'sass:list'; -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -$sizes: 'sm' 'lg' 'xl' !default; -$themes: 'accent' 'negative' !default; -$static-themes: 'black' 'white' !default; - -@mixin theme($theme: ()) { - &:link, - &:visited, - &:enabled { - border-color: transparent; - background-color: fn.color(list.join($theme, --bg)); - color: fn.color(list.join($theme, --label)); - } - - @include iro.bem-modifier('outline') { - &:link, - &:visited, - &:enabled { - border-color: fn.color(list.join($theme, --outline-border)); - background-color: transparent; - color: fn.color(list.join($theme, --outline-label)); - } - } - - &:link, - &:visited, - &:enabled { - &:hover, - &:focus-visible { - border-color: transparent; - background-color: fn.color(list.join($theme, --hover --bg)); - color: fn.color(list.join($theme, --hover --label)); - } - - &:active { - border-color: transparent; - background-color: fn.color(list.join($theme, --active --bg)); - color: fn.color(list.join($theme, --active --label)); - } - } -} - -@mixin static-theme($theme: ()) { - border-color: transparent; - background-color: fn.color(list.join($theme, --disabled --bg)); - color: fn.color(list.join($theme, --disabled --label)); - - &::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)); - } - - @include iro.bem-modifier('outline') { - border-color: fn.color(list.join($theme, --disabled --outline-border)); - background-color: transparent; - } - - @include theme($theme); - - @include iro.bem-modifier('primary') { - @include theme(list.join($theme, --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), - - --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()) { - display: inline-block; - position: relative; - padding-block: fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - border: fn.dim(--border) solid transparent; - border-radius: fn.dim(--rounding); - border-color: fn.color(--disabled --bg); - background-color: fn.color(--disabled --bg); - color: fn.color(--disabled --label); - font-size: fn.dim(--font-size); - font-weight: 500; - line-height: fn.dim(--line-height); - text-align: center; - text-decoration: none; - - &::after { - content: ''; - display: none; - position: absolute; - z-index: 1; - inset: calc(-1 * fn.dim(--border) - fn.dim(--key-focus --border-offset)); - 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); - pointer-events: none; - } - - &:link, - &:visited, - &:enabled { - &:focus-visible { - &::after { - display: block; - } - } - } - - @include iro.bem-elem('label') { - margin-inline: fn.dim(--pad-i-label); - } - - @include iro.bem-modifier('block') { - display: block; - } - - @include iro.bem-modifier('outline') { - border-color: fn.color(--disabled --outline-border); - background-color: transparent; - } - - @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); - - @include iro.bem-elem('label') { - margin-inline: fn.dim(--#{$size} --pad-i-label); - } - } - } - - @include static-theme; - - @each $theme in $themes { - @include iro.bem-modifier($theme) { - @include theme(--#{$theme}); - } - } - - @each $theme in $static-themes { - @include iro.bem-modifier(static-#{$theme}) { - @include static-theme(--static-#{$theme}); - } - } - - @include iro.bem-modifier('round') { - inline-size: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-b)); - padding-inline: 0; - border-radius: 100em; - } - } -} diff --git a/src/objects/_card.scss b/src/objects/_card.scss deleted file mode 100644 index 650ec3f..0000000 --- a/src/objects/_card.scss +++ /dev/null @@ -1,170 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('card') { - @include iro.props-store(( - --dims: ( - --divider: fn.global-dim(--border --thin), - --pad-i: fn.global-dim(--size --300), - --pad-b: fn.global-dim(--size --250), - --spacing: fn.global-dim(--size --200), - --rounding: fn.global-dim(--rounding), - - --hover: ( - --offset-b: calc(-1 * fn.global-dim(--size --65)), - ), - - --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(--bg-l2), - --divider: fn.global-color(--border-mute), - - --key-focus: ( - --label: fn.global-color(--focus --text), - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - - --quiet: ( - --image: fn.global-color(--bg-base), - - --hover: ( - --image: fn.global-color(--border), - ), - ) - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - display: block; - margin: calc(-1 * fn.dim(--key-focus --border)); - transition: transform .2s; - border: fn.dim(--key-focus --border-offset) solid transparent; - border-radius: calc(fn.dim(--rounding) + fn.dim(--key-focus --border-offset)); - background-color: fn.color(--bg); - background-clip: content-box; - - @include iro.bem-multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') { - &:hover, - &:active, - &:focus-visible { - transform: translateY(fn.dim(--hover --offset-b)); - } - - &:focus-visible { - 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); - } - } - - @include iro.bem-elem('avatar') { - margin-block-start: fn.dim(--pad-b); - margin-inline-start: fn.dim(--pad-i); - } - - @include iro.bem-elem('image') { - display: block; - inline-size: 100%; - object-fit: cover; - transition: transform .2s, opacity .2s; - - &:first-child { - border-start-start-radius: fn.dim(--rounding); - border-start-end-radius: fn.dim(--rounding); - } - - &:last-child { - border-end-start-radius: fn.dim(--rounding); - border-end-end-radius: fn.dim(--rounding); - } - - @include iro.bem-next-elem('avatar') { - margin-block-start: calc(-.7 * fn.foreign-dim(--avatar, --xl --size)); - } - } - - @include iro.bem-elem('body') { - padding-block: fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - - &::before { - content: ''; - display: block; - margin-block: -100em 100em; - } - } - - @include iro.bem-elem('content') { - margin-block-start: fn.dim(--spacing); - } - - @include iro.bem-elem('footer') { - padding-block: 0 fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - margin-block-start: calc(-1 * fn.dim(--pad-b)); - - &::before { - content: ''; - display: block; - block-size: fn.dim(--divider); - margin-block: fn.dim(--spacing); - background-color: fn.color(--divider); - } - } - - @include iro.bem-modifier('quiet') { - position: relative; - border: 0; - background-color: transparent; - - @include iro.bem-multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') { - &:hover, - &:active, - &:focus-visible { - transform: none; - - @include iro.bem-elem('image') { - transform: translateY(fn.dim(--hover --offset-b)); - opacity: .75; - background-color: fn.color(--quiet --hover --image); - } - } - - &:focus-visible { - outline: none; - box-shadow: none; - - @include iro.bem-elem('image') { - outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); - opacity: 1; - background-color: fn.color(--quiet --hover --image); - box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); - } - } - } - - @include iro.bem-elem('image') { - position: relative; - margin: calc(-1 * fn.dim(--key-focus --border)); - border: fn.dim(--key-focus --border-offset) solid transparent; - border-radius: calc(fn.dim(--rounding) + fn.dim(--key-focus --border-offset)); - background-color: fn.color(--quiet --image); - background-clip: padding-box; - } - - @include iro.bem-elem('body') { - padding: 0; - padding-block-start: fn.dim(--spacing); - } - - @include iro.bem-elem('footer') { - padding-inline: 0; - } - } - } -} diff --git a/src/objects/_checkbox.scss b/src/objects/_checkbox.scss deleted file mode 100644 index 8527948..0000000 --- a/src/objects/_checkbox.scss +++ /dev/null @@ -1,261 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('checkbox') { - @include iro.props-store(( - --dims: ( - --size: fn.global-dim(--size --175), - --label-gap: fn.global-dim(--size --125), - --border: fn.global-dim(--border --medium), - --pad-i: fn.global-dim(--size --65), - --pad-b: fn.global-dim(--size --65), - --rounding: fn.global-dim(--rounding), - --spacing-sibling: fn.global-dim(--size --300), - - --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: ( - --box-border: fn.global-color(--text-mute-more), - --box-bg: fn.global-color(--base --75), - - --hover: ( - --label: fn.global-color(--heading), - --box-border: fn.global-color(--text-mute), - ), - --accent: ( - --box-border: fn.global-color(--accent --900), - - --hover: ( - --box-border: fn.global-color(--accent --1000), - ), - ), - --disabled: ( - --label: fn.global-color(--text-disabled), - --box-border: fn.global-color(--border-strong), - --box-bg: fn.global-color(--base --75), - ), - --key-focus: ( - --label: fn.global-color(--focus --text), - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - position: relative; - margin-inline: - calc(-1 * fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)) - calc(fn.dim(--spacing-sibling) - fn.dim(--pad-b) - fn.dim(--key-focus --border-offset)); - padding-block: fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - - @include iro.bem-elem('box') { - display: inline-block; - position: relative; - flex: 0 0 auto; - inline-size: fn.dim(--size); - block-size: fn.dim(--size); - margin-block-start: calc(.5em * fn.global-dim(--font --standard --line-height) - .5 * fn.dim(--size) - fn.dim(--key-focus --border-offset)); - border: fn.dim(--key-focus --border-offset) solid transparent; - border-radius: calc(fn.dim(--border) + fn.dim(--key-focus --border-offset)); - background-color: fn.color(--box-border); - background-clip: padding-box; - vertical-align: top; - - &::before, - &::after { - content: ''; - display: block; - position: absolute; - } - - &::before { - z-index: 2; - inset-block-start: fn.dim(--border); - inset-inline-start: fn.dim(--border); - inline-size: calc(fn.dim(--size) - 2 * fn.dim(--border)); - block-size: calc(fn.dim(--size) - 2 * fn.dim(--border)); - transition: transform .2s ease; - background-color: fn.color(--box-bg); - } - - &::after { - z-index: 3; - inset-block-start: calc(.5 * fn.dim(--size) - 1px); - inset-inline-start: calc(1.5 * fn.dim(--border)); - box-sizing: border-box; - inline-size: calc(fn.dim(--size) - 3 * fn.dim(--border)); - block-size: 0; - transform: scale(0); - transition: transform .2s ease; - border-block-width: 0 2px; - border-inline-width: 0 2px; - border-style: solid; - border-radius: 2px; - border-color: fn.color(--box-bg); - } - } - - @include iro.bem-elem('check-icon') { - display: block; - position: absolute; - z-index: 2; - inset-block-start: calc(1 * fn.dim(--border)); - inset-inline-start: calc(1 * fn.dim(--border)); - inline-size: calc(100% - 2 * fn.dim(--border)); - block-size: calc(100% - 2 * fn.dim(--border)); - margin: 0; - transform: scale(0); - transform-origin: 40% 90%; - transition: transform .2s ease; - stroke-width: iro.fn-px-to-rem(3px); - color: fn.color(--box-bg); - } - - @include iro.bem-elem('label') { - margin-inline-start: calc(fn.dim(--label-gap) - fn.dim(--key-focus --border-offset)); - } - - @include iro.bem-elem('native') { - appearance: none; - position: absolute; - z-index: -1; - inset-block-start: 0; - inset-inline-start: 0; - inline-size: 100%; - block-size: 100%; - margin: 0; - padding: 0; - overflow: hidden; - border-radius: fn.dim(--rounding); - - &:hover, - &:focus-visible { - @include iro.bem-sibling-elem('label') { - color: fn.color(--hover --label); - } - - @include iro.bem-sibling-elem('box') { - background-color: fn.color(--hover --box-border); - } - } - - &:checked { - @include iro.bem-sibling-elem('box') { - &::before { - transform: scale(0); - } - - @include iro.bem-elem('check-icon') { - transform: scale(1); - } - } - } - - &:indeterminate { - @include iro.bem-sibling-elem('box') { - &::before { - transform: scale(0); - } - - &::after { - transform: scale(1); - } - - @include iro.bem-elem('check-icon') { - transform: scale(0); - } - } - } - - &:disabled { - @include iro.bem-sibling-elem('label') { - color: fn.color(--disabled --label); - } - - @include iro.bem-sibling-elem('box') { - background-color: fn.color(--disabled --box-border); - - &::before { - background-color: fn.color(--disabled --box-bg); - } - } - } - - &:focus-visible { - @include iro.bem-sibling-elem('label') { - color: fn.color(--key-focus --label); - } - - @include iro.bem-sibling-elem('box') { - 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); - } - } - } - - @include iro.bem-modifier('standalone') { - @include iro.bem-elem('box') { - margin-block-start: 0; - } - } - - @include iro.bem-modifier('accent') { - @include iro.bem-elem('native') { - &:checked { - @include iro.bem-sibling-elem('box') { - background-color: fn.color(--accent --box-border); - } - - &:hover, - &:focus-visible { - @include iro.bem-sibling-elem('box') { - background-color: fn.color(--accent --hover --box-border); - } - } - } - - &:indeterminate { - @include iro.bem-sibling-elem('box') { - background-color: fn.color(--accent --box-border); - } - - &:hover, - &:focus-visible { - @include iro.bem-sibling-elem('box') { - background-color: fn.color(--accent --hover --box-border); - } - } - } - - &:disabled { - @include iro.bem-sibling-elem('box') { - background-color: fn.color(--disabled --box-border); - - &::before { - background-color: fn.color(--disabled --box-bg); - } - } - - &:checked { - @include iro.bem-sibling-elem('box') { - background-color: fn.color(--disabled --box-border); - } - } - - &:indeterminate { - @include iro.bem-sibling-elem('box') { - background-color: fn.color(--disabled --box-border); - } - } - } - } - } - } -} diff --git a/src/objects/_divider.scss b/src/objects/_divider.scss deleted file mode 100644 index d1e2897..0000000 --- a/src/objects/_divider.scss +++ /dev/null @@ -1,203 +0,0 @@ -@use 'sass:map'; -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; -@use '../config'; - -$static-themes: 'black' 'white' !default; - -@include iro.props-namespace('divider') { - @include iro.props-store(( - --dims: ( - --margin-b: fn.global-dim(--size --85), - - --strong: ( - --border: fn.global-dim(--border --thick), - --label-font-size: fn.global-dim(--font-size --100), - ), - --medium: ( - --border: fn.global-dim(--border --medium), - --label-font-size: fn.global-dim(--font-size --75), - ), - --faint: ( - --border: fn.global-dim(--border --thin), - --label-font-size: fn.global-dim(--font-size --50), - ), - ), - --colors: ( - --strong: ( - --bg: fn.global-color(--text), - --label: fn.global-color(--text), - ), - --medium: ( - --bg: fn.global-color(--border), - --label: fn.global-color(--text-mute), - ), - --faint: ( - --bg: fn.global-color(--border), - --label: fn.global-color(--text-mute-more), - ), - ), - )); - - @each $color in map.keys(map.get(config.$themes, config.$theme-default, --palettes)) { - @if $color != '--base' { - @include iro.props-store(( - --colors: ( - $color: ( - --bg: fn.global-color($color --800), - --label: fn.global-color($color --1000), - ) - ), - )); - } - } - - @each $theme in $static-themes { - @include iro.props-store(( - --colors: ( - --static-#{$theme}: ( - --strong: ( - --bg: fn.global-color(--#{$theme}-transparent --800), - --label: fn.global-color(--#{$theme}-transparent --900), - ), - --medium: ( - --bg: fn.global-color(--#{$theme}-transparent --300), - --label: fn.global-color(--#{$theme}-transparent --500), - ), - --faint: ( - --bg: fn.global-color(--#{$theme}-transparent --300), - --label: fn.global-color(--#{$theme}-transparent --500), - ), - ) - ), - )); - } - - @include iro.bem-object(iro.props-namespace()) { - display: flex; - flex: 0 0 auto; - flex-direction: row; - align-items: center; - block-size: 1em; - margin-block: fn.dim(--margin-b); - color: fn.color(--strong --label); - font-size: fn.dim(--strong --label-font-size); - font-weight: 700; - letter-spacing: .5px; - line-height: 1; - text-transform: uppercase; - - &::before, - &::after { - content: ''; - flex: 1 1 auto; - inline-size: 100%; - block-size: fn.dim(--strong --border); - background-color: fn.color(--strong --bg); - } - - &::before { - display: block; - } - - @include iro.bem-elem('label') { - flex: 0 0 auto; - } - - @include iro.bem-modifier('vertical') { - align-self: stretch; - inline-size: 1px; - block-size: auto; - margin-block: 0; - background-color: fn.color(--faint --bg); - - &::before, - &::after { - display: none; - } - } - - @include iro.bem-modifier('medium') { - color: fn.color(--medium --label); - font-size: fn.dim(--medium --label-font-size); - font-weight: 500; - - &::before, - &::after { - block-size: fn.dim(--medium --border); - background-color: fn.color(--medium --bg); - } - } - - @include iro.bem-modifier('faint') { - color: fn.color(--faint --label); - font-size: fn.dim(--faint --label-font-size); - font-weight: 500; - - &::before, - &::after { - block-size: fn.dim(--faint --border); - background-color: fn.color(--faint --bg); - } - } - - @include iro.bem-modifier('labelled') { - &::before { - margin-inline-end: 1em; - } - - &::after { - display: block; - margin-inline-start: 1em; - } - } - - @each $color in 'blue' 'purple' 'red' 'green' 'yellow' { - @include iro.bem-modifier($color) { - &::before, - &::after { - background-color: fn.color(--#{$color} --bg); - } - - @include iro.bem-elem('label') { - color: fn.color(--#{$color} --label); - } - } - } - - @each $theme in $static-themes { - @include iro.bem-modifier(static-#{$theme}) { - &::before, - &::after { - background-color: fn.color(--static-#{$theme} --strong --bg); - } - - @include iro.bem-elem('label') { - color: fn.color(--static-#{$theme} --strong --label); - } - - @include iro.bem-modifier('medium') { - &::before, - &::after { - background-color: fn.color(--static-#{$theme} --medium --bg); - } - - @include iro.bem-elem('label') { - color: fn.color(--static-#{$theme} --medium --label); - } - } - - @include iro.bem-modifier('faint') { - &::before, - &::after { - background-color: fn.color(--static-#{$theme} --faint --bg); - } - - @include iro.bem-elem('label') { - color: fn.color(--static-#{$theme} --faint --label); - } - } - } - } - } -} diff --git a/src/objects/_emoji.scss b/src/objects/_emoji.scss deleted file mode 100644 index d8d1289..0000000 --- a/src/objects/_emoji.scss +++ /dev/null @@ -1,73 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; -@use 'sass:math'; - -@use 'icon'; - -@include iro.props-namespace('emoji') { - @include iro.props-store(( - --dims: ( - --size: calc(1 / 14 * 18em), - --pad: .3em, - --rounding: fn.global-dim(--rounding), - --zoom: 3, - --valign: -.25em, - - --125: ( - --size: calc(1 / 14 * 23em), - --valign: -.45em, - ), - - --150: ( - --size: calc(1 / 14 * 28em), - --valign: -.65em, - ), - - --200: ( - --size: calc(1 / 14 * 38em), - --valign: -1em, - ) - ), - --colors: ( - --bg: fn.global-color(--border-mute), - ) - )); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - position: relative; - inline-size: calc(fn.dim(--size)); - block-size: calc(fn.dim(--size)); - margin: calc(-1 * fn.dim(--pad)); - padding: calc(fn.dim(--pad)); - vertical-align: fn.dim(--valign); - object-fit: contain; - - @include iro.bem-modifier('icon') { - margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--size) - fn.foreign-dim(--icon, --size))); - vertical-align: fn.foreign-dim(--icon, --valign); - } - - @each $size in '125' '150' '200' { - @include iro.bem-modifier($size) { - inline-size: fn.dim(--#{$size} --size); - block-size: fn.dim(--#{$size} --size); - vertical-align: fn.dim(--#{$size} --valign); - - @include iro.bem-modifier('icon') { - margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--#{$size} --size) - fn.foreign-dim(--icon, --size))); - } - } - } - - @include iro.bem-modifier('zoomable') { - transition: transform .2s ease, background-color .2s ease; - border-radius: calc(fn.dim(--rounding) / fn.dim(--zoom)); - - &:hover { - transform: scale(fn.dim(--zoom)); - background-color: fn.color(--bg); - } - } - } -} diff --git a/src/objects/_field-label.scss b/src/objects/_field-label.scss deleted file mode 100644 index 1518ea6..0000000 --- a/src/objects/_field-label.scss +++ /dev/null @@ -1,86 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('field-label') { - @include iro.props-store(( - --dims: ( - --spacing-i: fn.global-dim(--size --150), - --spacing-b: fn.global-dim(--size --85), - --label-font-size: fn.global-dim(--font-size --75), - --hint-font-size: fn.global-dim(--font-size --75), - ), - --colors: ( - --label: fn.global-color(--text-mute), - --hint: fn.global-color(--text-mute), - --error-hint: fn.global-color(--negative --900), - --disabled: fn.global-color(--text-disabled), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - display: block; - - @include iro.bem-elem('label') { - display: block; - flex: 0 0 auto; - padding-inline-end: fn.dim(--spacing-i); - color: fn.color(--label); - font-size: fn.dim(--label-font-size); - font-weight: 400; - line-height: 1.3; - - @include iro.bem-next-elem('content') { - margin-block-start: fn.dim(--spacing-b); - } - } - - @include iro.bem-elem('content') { - display: block; - flex: 1 1 auto; - } - - @include iro.bem-elem('hint') { - display: block; - margin-block-start: fn.dim(--spacing-b); - color: fn.color(--hint); - font-size: fn.dim(--hint-font-size); - } - - @include iro.bem-is('invalid') { - @include iro.bem-elem('hint') { - color: fn.color(--error-hint); - } - } - - @include iro.bem-is('disabled') { - @include iro.bem-elem('label', 'hint') { - color: fn.color(--disabled); - } - } - - @include iro.bem-modifier('align-start', 'align-end') { - display: flex; - align-items: baseline; - - @include iro.bem-elem('label') { - display: inline-block; - - @include iro.bem-next-elem('content') { - margin-block-start: 0; - } - } - } - - @include iro.bem-modifier('align-start') { - @include iro.bem-elem('label') { - text-align: start; - } - } - - @include iro.bem-modifier('align-end') { - @include iro.bem-elem('label') { - text-align: end; - } - } - } -} diff --git a/src/objects/_heading.scss b/src/objects/_heading.scss deleted file mode 100644 index 7990a6b..0000000 --- a/src/objects/_heading.scss +++ /dev/null @@ -1,118 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; -@use '../mixins' as mx; -@use '../config'; -@use 'include-media/dist/include-media' as media; - -$sizes: 'xxl' 'xl' 'lg' 'md' 'sm' 'xs'; - -@include iro.props-namespace('heading') { - @include iro.props-store(( - --dims: ( - --offset: -.02em, - ), - --colors: ( - --bg: fn.global-color(--base --50), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - @include mx.set-font(--headline); - - display: block; - margin-block-start: fn.global-dim(--heading --margin-bs); - transform: translateX(fn.dim(--offset)); - letter-spacing: normal; - text-transform: none; - - & + & { - margin-block-start: fn.global-dim(--heading --margin-bs-sibling); - } - - @include iro.bem-elem('highlight') { - background-image: linear-gradient( - to top, - transparent .05em, - fn.color(--bg) .05em, - fn.color(--bg) .5em, - transparent .5em - ); - } - - @include iro.bem-modifier('xxl') { - @include mx.heading-strong(--xxl); - } - - @include iro.bem-modifier('xl') { - @include mx.heading-strong(--xl); - } - - @include iro.bem-modifier('lg') { - @include mx.heading-medium(--lg); - } - - @include iro.bem-modifier('md') { - @include mx.heading-medium(--md); - } - - @include iro.bem-modifier('sm') { - @include mx.heading-faint(--sm); - } - - @include iro.bem-modifier('xs') { - @include mx.heading-faint(--xs); - } - - @include iro.bem-modifier('display') { - @include mx.set-font(--headline); - - @include iro.bem-modifier('xxl') { - @include mx.heading-strong(--display --xxl); - - @include media.media('<=md') { - @include mx.heading-strong(--display-sm --xxl); - } - } - - @include iro.bem-modifier('xl') { - @include mx.heading-strong(--display --xl); - - @include media.media('<=md') { - @include mx.heading-strong(--display-sm --xl); - } - } - - @include iro.bem-modifier('lg') { - @include mx.heading-strong(--display --lg); - - @include media.media('<=md') { - @include mx.heading-strong(--display-sm --lg); - } - } - - @include iro.bem-modifier('md') { - @include mx.heading-strong(--display --md); - - @include media.media('<=md') { - @include mx.heading-strong(--display-sm --md); - } - } - - @include iro.bem-modifier('sm') { - @include mx.heading-medium(--display --sm); - - @include media.media('<=md') { - @include mx.heading-medium(--display-sm --sm); - } - } - - @include iro.bem-modifier('xs') { - @include mx.heading-faint(--display --xs); - - @include media.media('<=md') { - @include mx.heading-faint(--display-sm --xs); - } - } - } - } -} diff --git a/src/objects/_icon.scss b/src/objects/_icon.scss deleted file mode 100644 index 1491dd9..0000000 --- a/src/objects/_icon.scss +++ /dev/null @@ -1,26 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('icon') { - @include iro.props-store(( - --dims: ( - --stroke: 1.5px, - --size: calc(1 / 14 * 16em), - --valign: -.2em, - ) - )); - - @include iro.bem-object(iro.props-namespace()) { - display: inline; - inline-size: fn.dim(--size); - block-size: fn.dim(--size); - stroke-width: fn.dim(--stroke); - stroke-linecap: round; - stroke-linejoin: round; - vertical-align: fn.dim(--valign); - - @include iro.bem-modifier('block') { - display: block; - } - } -} diff --git a/src/objects/_lightbox.scss b/src/objects/_lightbox.scss deleted file mode 100644 index 8ad8584..0000000 --- a/src/objects/_lightbox.scss +++ /dev/null @@ -1,313 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@use 'action-button'; - -$static-themes: 'black' 'white' !default; - -@include iro.props-namespace('lightbox') { - @include iro.props-store(( - --dims: ( - --pad: fn.global-dim(--size --150), - - --thumbnail: ( - --size: fn.global-dim(--size --700), - --rounding: fn.global-dim(--rounding), - --spacing: fn.global-dim(--size --100), - --border: fn.global-dim(--border --thin), - - --selected: ( - --border: 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 --outline), - ), - ), - - --close-button: ( - --font-size: fn.global-dim(--font-size --200), - ), - - --nav-button: ( - --width: fn.global-dim(--size --2000), - --height: fn.global-dim(--size --3800), - --font-size: fn.global-dim(--font-size --200), - ), - ), - --colors: ( - --thumbnail: ( - --border: fn.global-color(--border-strong), - - --hover: ( - --border: fn.global-color(--text-mute-more), - ), - - --selected: ( - --border: fn.global-color(--heading), - ), - - --key-focus: ( - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - ), - ), - )); - - @each $theme in $static-themes { - @include iro.props-store(( - --colors: ( - --static-#{$theme}: ( - --text: fn.global-color(--white-transparent --800), - --thumbnail: ( - --border: fn.global-color(--white-transparent --400), - - --hover: ( - --border: fn.global-color(--white-transparent --500), - ), - - --selected: ( - --border: fn.global-color(--white-transparent --900), - ), - - --key-focus: ( - --border: fn.global-color(--#{$theme}-transparent --900), - --outline: fn.global-color(--#{$theme}-transparent --300), - ), - ), - ) - ) - )); - } - - @include iro.props-store(( - --dims: ( - --thumbnail: ( - --size: fn.global-dim(--size --600), - ), - --nav-button: ( - --width: fn.global-dim(--size --2500), - --height: fn.global-dim(--size --2500), - ), - ), - ), 'md'); - - @include iro.bem-object(iro.props-namespace()) { - display: grid; - grid-template-rows: auto minmax(0, 1fr) auto auto; - grid-template-columns: auto minmax(0, 1fr) auto; - grid-template-areas: - 'header header header' - 'prev content next' - 'thumbnails thumbnails thumbnails' - 'footer footer footer'; - box-sizing: border-box; - min-block-size: 0; - flex: 1 1 auto; - - @include iro.bem-elem('header') { - grid-area: header; - display: flex; - align-items: flex-start; - padding-block-start: fn.dim(--pad); - padding-inline: fn.dim(--pad); - } - - @include iro.bem-elem('img') { - display: none; - box-sizing: border-box; - grid-area: content; - max-inline-size: 100%; - max-block-size: 100%; - place-self: center; - padding: fn.dim(--pad); - - @include iro.bem-sibling-elem('img') { - @include iro.bem-modifier('default') { - display: block; - - @include iro.bem-next-elem('nav-btn') { - display: block; - - @include iro.bem-next-elem('nav-btn') { - display: block; - } - } - } - } - - @include iro.bem-multi('&:target', 'is' 'visible') { - display: block; - - @include iro.bem-next-elem('nav-btn') { - display: block; - - @include iro.bem-next-elem('nav-btn') { - display: block; - } - } - - @include iro.bem-sibling-elem('img') { - @include iro.bem-modifier('default') { - display: none; - - @include iro.bem-next-elem('nav-btn') { - display: none; - - @include iro.bem-next-elem('nav-btn') { - display: none; - } - } - } - } - } - } - - @include iro.bem-elem('thumbnails') { - grid-area: thumbnails; - display: flex; - gap: fn.dim(--thumbnail --spacing); - padding: fn.dim(--pad); - margin-block-start: calc(-1 * fn.dim(--pad)); - overflow: auto; - } - - @include iro.bem-elem('footer') { - grid-area: footer; - display: flex; - align-items: flex-start; - padding-block: 0 fn.dim(--pad); - padding-inline: fn.dim(--pad); - } - - @include iro.bem-elem('thumbnail') { - position: relative; - flex: 0 0 auto; - inline-size: fn.dim(--thumbnail --size); - block-size: fn.dim(--thumbnail --size); - overflow: hidden; - border-radius: fn.dim(--thumbnail --rounding); - outline: fn.dim(--thumbnail --border) solid fn.color(--thumbnail --border); - outline-offset: calc(-1 * fn.dim(--thumbnail --border)); - opacity: .75; - - &:hover, - &:active, - &:focus-visible { - outline-color: fn.color(--thumbnail --hover --border); - opacity: 1; - } - - @include iro.bem-is('selected') { - $focus-border-offset: calc(-1 * fn.dim(--thumbnail --selected --border)); - - margin: $focus-border-offset; - border: fn.dim(--thumbnail --selected --border) solid fn.color(--thumbnail --selected --border); - border-radius: calc(fn.dim(--thumbnail --rounding) - $focus-border-offset); - outline: none; - opacity: 1; - } - - &:focus-visible { - $focus-border-offset: calc(-1 * fn.dim(--thumbnail --key-focus --border-offset)); - - margin: $focus-border-offset; - border: fn.dim(--thumbnail --key-focus --border-offset) solid transparent; - border-radius: calc(fn.dim(--thumbnail --rounding) - $focus-border-offset); - outline: fn.dim(--thumbnail --key-focus --border) solid fn.color(--thumbnail --key-focus --border); - outline-offset: 0; - box-shadow: 0 0 0 calc(fn.dim(--thumbnail --key-focus --outline) + fn.dim(--thumbnail --key-focus --border)) fn.color(--thumbnail --key-focus --outline); - } - } - - @include iro.bem-elem('thumbnail-img') { - display: block; - position: absolute; - inset-block-start: 0; - inset-inline-start: 0; - inline-size: 100%; - block-size: 100%; - object-fit: cover; - object-position: center center; - } - - @include iro.bem-elem('thumbnail-icon') { - position: absolute; - inset-block-start: 50%; - inset-inline-start: 50%; - transform: translate(-50%, -50%); - } - - @include iro.bem-elem('close-btn') { - flex: 0 0 auto; - margin-block-start: calc(-.5 * fn.dim(--pad)); - margin-inline: auto calc(-.5 * fn.dim(--pad)); - font-size: fn.dim(--close-button --font-size); - } - - @include iro.bem-elem('nav-btn') { - display: none; - position: relative; - align-self: center; - overflow: visible; - font-size: fn.dim(--nav-button --font-size); - - &::before { - content: ''; - display: block; - position: absolute; - inset-block-start: 50%; - inline-size: fn.dim(--nav-button --width); - block-size: fn.dim(--nav-button --height); - transform: translateY(-50%); - } - - @include iro.bem-modifier('prev') { - grid-area: prev; - margin-inline: calc(.5 * fn.dim(--pad)) calc(-1 * fn.dim(--pad)); - - &::before { - inset-inline-start: 0; - } - } - - @include iro.bem-modifier('next') { - grid-area: next; - margin-inline: calc(-1 * fn.dim(--pad)) calc(.5 * fn.dim(--pad)); - - &::before { - inset-inline-end: 0; - } - } - } - - @each $theme in $static-themes { - @include iro.bem-modifier(static-#{$theme}) { - color: fn.color(--static-#{$theme} --text); - - @include iro.bem-elem('thumbnail') { - outline-color: fn.color(--static-#{$theme} --thumbnail --border); - - &:hover, - &:active, - &:focus-visible { - outline-color: fn.color(--static-#{$theme} --thumbnail --hover --border); - } - - @include iro.bem-is('selected') { - border-color: fn.color(--static-#{$theme} --thumbnail --selected --border); - } - - &:focus-visible { - border-color: transparent; - outline-color: fn.color(--static-#{$theme} --thumbnail --key-focus --border); - box-shadow: 0 0 0 calc(fn.dim(--thumbnail --key-focus --outline) + fn.dim(--thumbnail --key-focus --border)) fn.color(--static-#{$theme} --thumbnail --key-focus --outline); - } - } - } - } - } -} diff --git a/src/objects/_menu.scss b/src/objects/_menu.scss deleted file mode 100644 index 0f691a2..0000000 --- a/src/objects/_menu.scss +++ /dev/null @@ -1,137 +0,0 @@ -/* stylelint-disable length-zero-no-unit */ - -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@use './icon'; - -@include iro.props-namespace('menu') { - @include iro.props-store(( - --dims: ( - --spacing: 0em, - --header: ( - --font-size: fn.global-dim(--font-size --50), - ), - --separator: fn.global-dim(--size --100), - --item: ( - --pad-i: fn.global-dim(--size --150), - --pad-b: fn.global-dim(--size --100), - --rounding: 0em, - - --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: ( - --separator: fn.global-color(--border), - --header: ( - --label: fn.global-color(--heading), - ), - --item: ( - --hover: ( - --bg: fn.global-color(--border-mute), - --label: fn.global-color(--heading), - ), - --active: ( - --bg: fn.global-color(--border), - --label: fn.global-color(--heading), - ), - --disabled: ( - --label: fn.global-color(--text-disabled), - ), - --key-focus: ( - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - ), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - display: flex; - flex-direction: column; - gap: fn.dim(--spacing); - - @include iro.bem-elem('header') { - padding-block: fn.dim(--item --pad-b); - padding-inline: fn.dim(--item --pad-i); - color: fn.color(--header --label); - font-size: fn.dim(--header --font-size); - font-weight: 500; - letter-spacing: .5px; - text-transform: uppercase; - - @include iro.bem-next-twin-elem { - margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing)); - } - } - - @include iro.bem-elem('item') { - padding-block: fn.dim(--item --pad-b); - padding-inline: fn.dim(--item --pad-i); - margin: calc(-1 * fn.dim(--item --key-focus --outline)); - border: fn.dim(--item --key-focus --outline) solid transparent; - border-radius: calc(fn.dim(--item --rounding) + fn.dim(--item --key-focus --outline)); - color: fn.color(--item --disabled --label); - background-clip: padding-box; - - &:link, - &:visited, - &:enabled { - color: currentColor; - - @include iro.bem-multi('&:hover, &:focus-visible', 'is' 'selected') { - background-color: fn.color(--item --hover --bg); - color: fn.color(--item --hover --label); - } - - &:active { - background-color: fn.color(--item --active --bg); - color: fn.color(--item --active --label); - } - - &:focus-visible { - outline: fn.color(--item --key-focus --border) solid fn.dim(--item --key-focus --border); - box-shadow: 0 0 0 calc(fn.dim(--item --key-focus --border) + fn.dim(--item --key-focus --outline)) fn.color(--item --key-focus --outline); - } - } - - @include iro.bem-next-elem('header') { - margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing)); - } - } - - @include iro.bem-elem('header') { - &:link, - &:visited, - &:enabled { - color: fn.color(--header --label); - } - } - - @include iro.bem-elem('separator') { - block-size: 1px; - margin-block: fn.dim(--separator); - margin-inline: fn.dim(--item --pad-i); - background-color: fn.color(--separator); - } - - @include iro.bem-elem('slot') { - padding-block: fn.dim(--item --pad-b); - padding-inline: fn.dim(--item --pad-i); - } - - @include iro.bem-elem('icon-slot') { - display: flex; - justify-content: center; - inline-size: fn.foreign-dim(--icon, --size); - } - - @include iro.bem-modifier('pull') { - margin: calc(-1 * fn.dim(--item --pad-i)); - } - } -} diff --git a/src/objects/_palette.scss b/src/objects/_palette.scss deleted file mode 100644 index 19f282f..0000000 --- a/src/objects/_palette.scss +++ /dev/null @@ -1,62 +0,0 @@ -@use 'sass:map'; -@use 'sass:list'; -@use 'sass:string'; -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; -@use '../config'; - -@include iro.props-namespace('palette') { - @include iro.bem-object(iro.props-namespace()) { - display: flex; - block-size: 3em; - - @include iro.bem-elem('item') { - flex: 1 1 auto; - - $palette: map.get(config.$themes, config.$theme-default, --palettes, --base); - $contrasts: map.get(config.$themes, config.$theme-default, --contrasts, list.nth($palette, 2)); - - @for $i from 1 through list.length($contrasts) { - $key: list.nth(map.keys($contrasts), $i); - - &:nth-child(#{$i}) { - background-color: fn.global-color(--base $key); - } - } - } - - @each $palette-name, $palette in map.get(config.$themes, config.$theme-default, --palettes) { - $contrasts: map.get(config.$themes, config.$theme-default, --contrasts, list.nth($palette, 2)); - - @include iro.bem-modifier(string.slice($palette-name, 3)) { - @include iro.bem-elem('item') { - @for $i from 1 through list.length($contrasts) { - $key: list.nth(map.keys($contrasts), $i); - - &:nth-child(#{$i}) { - background-color: fn.global-color($palette-name $key); - } - } - } - } - } - - @include iro.bem-modifier('static') { - @each $palette-name, $palette in map.get(config.$static-colors, --palettes) { - $contrasts: map.get(config.$static-colors, --contrasts); - - @include iro.bem-modifier(string.slice($palette-name, 3)) { - @include iro.bem-elem('item') { - @for $i from 1 through list.length($contrasts) { - $key: list.nth(map.keys($contrasts), $i); - - &:nth-child(#{$i}) { - background-color: fn.global-color(#{$palette-name}-static $key); - } - } - } - } - } - } - } -} diff --git a/src/objects/_popover.scss b/src/objects/_popover.scss deleted file mode 100644 index 5ad58ec..0000000 --- a/src/objects/_popover.scss +++ /dev/null @@ -1,51 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('popover') { - @include iro.props-store(( - --dims: ( - --z-index: 10000, - --pad-i: 0, - --pad-b: fn.global-dim(--size --85), - --separator: fn.global-dim(--size --85), - --rounding: fn.global-dim(--rounding), - --border: fn.global-dim(--border --thin), - ), - --colors: ( - --bg: fn.global-color(--bg-l2), - --border: fn.global-color(--border), - --filter: drop-shadow( - fn.global-dim(--shadow --x) - fn.global-dim(--shadow --y) - fn.global-dim(--shadow --blur) - fn.global-color(--shadow) - ), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - position: absolute; - z-index: fn.dim(--z-index); - inset-block-start: 0; - inset-inline-start: 0; - padding-block: fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - transform: translate(var(--x), var(--y)); - border: fn.dim(--border) solid fn.color(--border); - border-radius: fn.dim(--rounding); - background-color: fn.color(--bg); - filter: fn.color(--filter); - - @include iro.bem-modifier('up-left') { - transform: translate(var(--x), calc(var(--y) - 100%)); - } - - @include iro.bem-modifier('up-right') { - transform: translate(calc(var(--x) - 100%), calc(var(--y) - 100%)); - } - - @include iro.bem-modifier('down-right') { - transform: translate(calc(var(--x) - 100%), var(--y)); - } - } -} diff --git a/src/objects/_radio.scss b/src/objects/_radio.scss deleted file mode 100644 index 9fa937d..0000000 --- a/src/objects/_radio.scss +++ /dev/null @@ -1,185 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('radio') { - @include iro.props-store(( - --dims: ( - --diameter: fn.global-dim(--size --200), - --label-gap: fn.global-dim(--size --125), - --border: fn.global-dim(--border --medium), - --pad-i: fn.global-dim(--size --65), - --pad-b: fn.global-dim(--size --65), - --rounding: fn.global-dim(--rounding), - --spacing-sibling: fn.global-dim(--size --300), - - --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: ( - --circle-border: fn.global-color(--text-mute-more), - --circle-bg: fn.global-color(--base --75), - - --hover: ( - --label: fn.global-color(--heading), - --circle-border: fn.global-color(--text-mute), - ), - --accent: ( - --circle-border: fn.global-color(--accent --900), - - --hover: ( - --circle-border: fn.global-color(--accent --1000), - ), - ), - --disabled: ( - --label: fn.global-color(--text-disabled), - --circle-border: fn.global-color(--border-strong), - --circle-bg: fn.global-color(--base --75), - ), - --key-focus: ( - --label: fn.global-color(--focus --text), - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - position: relative; - margin-inline: - calc(-1 * fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)) - calc(fn.dim(--spacing-sibling) - fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)); - padding-block: fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - - @include iro.bem-elem('circle') { - display: inline-block; - flex: 0 0 auto; - inline-size: fn.dim(--diameter); - block-size: fn.dim(--diameter); - margin-block-start: calc(.5em * fn.global-dim(--font --standard --line-height) - .5 * fn.dim(--diameter) - fn.dim(--key-focus --border-offset)); - border: fn.dim(--key-focus --border-offset) solid transparent; - border-radius: 2em; - background-color: fn.color(--circle-border); - background-clip: padding-box; - vertical-align: top; - - &::after { - content: ''; - display: block; - position: relative; - inset-block-start: fn.dim(--border); - inset-inline-start: fn.dim(--border); - inline-size: calc(fn.dim(--diameter) - 2 * fn.dim(--border)); - block-size: calc(fn.dim(--diameter) - 2 * fn.dim(--border)); - transition: transform .2s ease; - border-radius: fn.dim(--diameter); - background-color: fn.color(--circle-bg); - } - } - - @include iro.bem-elem('label') { - margin-inline-start: calc(fn.dim(--label-gap) - fn.dim(--key-focus --border-offset)); - } - - @include iro.bem-elem('native') { - appearance: none; - position: absolute; - z-index: -1; - inset-block-start: 0; - inset-inline-start: 0; - inline-size: 100%; - block-size: 100%; - margin: 0; - padding: 0; - overflow: hidden; - border-radius: fn.dim(--rounding); - - &:hover, - &:focus-visible { - @include iro.bem-sibling-elem('label') { - color: fn.color(--hover --label); - } - - @include iro.bem-sibling-elem('circle') { - background-color: fn.color(--hover --circle-border); - } - } - - &:checked { - @include iro.bem-sibling-elem('circle') { - &::after { - transform: scale(.44); - } - } - } - - &:disabled { - @include iro.bem-sibling-elem('label') { - color: fn.color(--disabled --label); - } - - @include iro.bem-sibling-elem('circle') { - background-color: fn.color(--disabled --circle-border); - - &::after { - background-color: fn.color(--disabled --circle-bg); - } - } - } - - &:focus-visible { - @include iro.bem-sibling-elem('label') { - color: fn.color(--key-focus --label); - } - - @include iro.bem-sibling-elem('circle') { - 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); - } - } - } - - @include iro.bem-modifier('standalone') { - @include iro.bem-elem('circle') { - margin-block-start: 0; - } - } - - @include iro.bem-modifier('accent') { - @include iro.bem-elem('native') { - &:checked { - @include iro.bem-sibling-elem('circle') { - background-color: fn.color(--accent --circle-border); - } - - &:hover, - &:focus-visible { - @include iro.bem-sibling-elem('circle') { - background-color: fn.color(--accent --hover --circle-border); - } - } - } - - &:disabled { - @include iro.bem-sibling-elem('circle') { - background-color: fn.color(--disabled --circle-border); - - &::after { - background-color: fn.color(--disabled --circle-bg); - } - } - - &:checked { - @include iro.bem-sibling-elem('circle') { - background-color: fn.color(--disabled --circle-border); - } - } - } - } - } - } -} diff --git a/src/objects/_side-nav.scss b/src/objects/_side-nav.scss deleted file mode 100644 index 8e4e131..0000000 --- a/src/objects/_side-nav.scss +++ /dev/null @@ -1,122 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@use './icon'; - -@include iro.props-namespace('side-nav') { - @include iro.props-store(( - --dims: ( - --spacing: fn.global-dim(--size --50), - --header: ( - --font-size: fn.global-dim(--font-size --50), - ), - --separator: fn.global-dim(--size --200), - --item: ( - --pad-i: fn.global-dim(--size --150), - --pad-b: fn.global-dim(--size --100), - --rounding: fn.global-dim(--rounding), - - --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: ( - --header: ( - --label: fn.global-color(--text-mute-more), - ), - --item: ( - --hover: ( - --bg: fn.global-color(--border-mute), - --label: fn.global-color(--heading), - ), - --active: ( - --bg: fn.global-color(--border), - --label: fn.global-color(--heading), - ), - --disabled: ( - --label: fn.global-color(--text-disabled), - ), - --key-focus: ( - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - ), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - display: flex; - flex-direction: column; - gap: fn.dim(--spacing); - - @include iro.bem-elem('header') { - padding-block: fn.dim(--item --pad-b); - padding-inline: fn.dim(--item --pad-i); - color: fn.color(--header --label); - font-size: fn.dim(--header --font-size); - font-weight: 500; - letter-spacing: .5px; - text-transform: uppercase; - - @include iro.bem-next-twin-elem { - margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing)); - } - } - - @include iro.bem-elem('item') { - padding-block: fn.dim(--item --pad-b); - padding-inline: fn.dim(--item --pad-i); - margin: calc(-1 * fn.dim(--item --key-focus --border-offset)); - border: fn.dim(--item --key-focus --border-offset) solid transparent; - border-radius: calc(fn.dim(--item --rounding) + fn.dim(--item --key-focus --border-offset)); - color: fn.color(--item --disabled --label); - background-clip: padding-box; - - &:link, - &:visited, - &:enabled { - color: currentColor; - - @include iro.bem-multi('&:hover, &:focus-visible', 'is' 'selected') { - background-color: fn.color(--item --hover --bg); - color: fn.color(--item --hover --label); - } - - &:active { - background-color: fn.color(--item --active --bg); - color: fn.color(--item --active --label); - } - - &:focus-visible { - outline: fn.color(--item --key-focus --border) solid fn.dim(--item --key-focus --border); - box-shadow: 0 0 0 calc(fn.dim(--item --key-focus --border) + fn.dim(--item --key-focus --outline)) fn.color(--item --key-focus --outline); - } - } - - @include iro.bem-next-elem('header') { - margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing)); - } - } - - @include iro.bem-elem('header') { - &:link, - &:visited, - &:enabled { - color: fn.color(--header --label); - } - } - - @include iro.bem-elem('separator') { - block-size: fn.dim(--separator); - } - - @include iro.bem-elem('icon-slot') { - display: flex; - justify-content: center; - inline-size: fn.foreign-dim(--icon, --size); - } - } -} diff --git a/src/objects/_status-indicator.scss b/src/objects/_status-indicator.scss deleted file mode 100644 index 416e65e..0000000 --- a/src/objects/_status-indicator.scss +++ /dev/null @@ -1,39 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -$themes: 'accent' 'positive' 'negative' 'warning' !default; - -@include iro.props-namespace('status-indicator') { - @include iro.props-store(( - --dims: ( - --size: fn.global-dim(--size --125), - ), - --colors: ( - --default: fn.global-color(--border-strong), - --primary: fn.global-color(--text), - ), - )); - - @each $theme in $themes { - @include iro.props-store(( - --colors: ( - --#{$theme}: fn.global-color(--#{$theme} --700), - ), - )); - } - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - inline-size: fn.dim(--size); - block-size: fn.dim(--size); - border-radius: 10em; - background-color: fn.color(--default); - vertical-align: middle; - - @each $theme in $themes { - @include iro.bem-is($theme) { - background-color: fn.color(--#{$theme}); - } - } - } -} diff --git a/src/objects/_switch.scss b/src/objects/_switch.scss deleted file mode 100644 index e1f1132..0000000 --- a/src/objects/_switch.scss +++ /dev/null @@ -1,222 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('switch') { - @include iro.props-store(( - --dims: ( - --width: fn.global-dim(--size --350), - --height: fn.global-dim(--size --200), - --label-gap: fn.global-dim(--size --125), - --border: fn.global-dim(--border --medium), - --pad-i: fn.global-dim(--size --65), - --pad-b: fn.global-dim(--size --65), - --rounding: fn.global-dim(--rounding), - --spacing-sibling: fn.global-dim(--size --300), - - --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: ( - --track-bg: fn.global-color(--border), - --handle-border: fn.global-color(--text-mute-more), - --handle-bg: fn.global-color(--base --50), - - --hover: ( - --label: fn.global-color(--heading), - --handle-border: fn.global-color(--text-mute), - ), - --accent: ( - --handle-border: fn.global-color(--accent --900), - - --hover: ( - --handle-border: fn.global-color(--accent --1000), - ), - ), - --disabled: ( - --label: fn.global-color(--text-disabled), - --track-bg: fn.global-color(--border), - --handle-border: fn.global-color(--border-strong), - --handle-bg: fn.global-color(--base --50), - ), - --key-focus: ( - --label: fn.global-color(--focus --text), - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - position: relative; - margin-inline: - calc(-1 * fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)) - calc(fn.dim(--spacing-sibling) - fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)); - padding-inline: fn.dim(--pad-i); - padding-block: fn.dim(--pad-b); - - @include iro.bem-elem('indicator') { - display: inline-block; - flex: 0 0 auto; - inline-size: fn.dim(--width); - block-size: fn.dim(--height); - margin-block-start: calc(.5em * fn.global-dim(--font --standard --line-height) - .5 * fn.dim(--height) - fn.dim(--key-focus --border-offset)); - transition: background-color .2s ease; - border: fn.dim(--key-focus --border-offset) solid transparent; - border-radius: 2em; - background-color: fn.color(--track-bg); - background-clip: padding-box; - vertical-align: top; - - &::after { - content: ''; - display: block; - inline-size: calc(fn.dim(--height) - 2 * fn.dim(--border)); - block-size: calc(fn.dim(--height) - 2 * fn.dim(--border)); - transition: transform .2s ease; - border: fn.dim(--border) solid fn.color(--handle-border); - border-radius: fn.dim(--width); - background-color: fn.color(--handle-bg); - } - } - - @include iro.bem-elem('label') { - margin-inline-start: fn.dim(--label-gap); - } - - @include iro.bem-elem('native') { - appearance: none; - position: absolute; - z-index: -1; - inset-block-start: 0; - inset-inline-start: 0; - inline-size: 100%; - block-size: 100%; - margin: 0; - padding: 0; - overflow: hidden; - border-radius: fn.dim(--rounding); - - &:hover, - &:focus-visible { - @include iro.bem-sibling-elem('label') { - color: fn.color(--hover --label); - } - - @include iro.bem-sibling-elem('indicator') { - &::after { - border-color: fn.color(--hover --handle-border); - } - } - } - - &:checked { - @include iro.bem-sibling-elem('indicator') { - background-color: fn.color(--handle-border); - - &::after { - transform: translate(calc(fn.dim(--width) - fn.dim(--height) + .5px), 0); - border-color: fn.color(--handle-border); - } - } - - &:hover, - &:focus-visible { - @include iro.bem-sibling-elem('indicator') { - background-color: fn.color(--hover --handle-border); - - &::after { - border-color: fn.color(--hover --handle-border); - } - } - } - } - - &:disabled { - @include iro.bem-sibling-elem('label') { - color: fn.color(--disabled --label); - } - - @include iro.bem-sibling-elem('indicator') { - background-color: fn.color(--disabled --track-bg); - - &::after { - border-color: fn.color(--disabled --handle-border); - background-color: fn.color(--disabled --handle-bg); - } - } - - &:checked { - @include iro.bem-sibling-elem('indicator') { - background-color: fn.color(--disabled --handle-border); - - &::after { - border-color: fn.color(--disabled --handle-border); - } - } - } - } - - &:focus-visible { - @include iro.bem-sibling-elem('label') { - color: fn.color(--key-focus --label); - } - - @include iro.bem-sibling-elem('indicator') { - 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); - } - } - } - - @include iro.bem-modifier('standalone') { - @include iro.bem-elem('indicator') { - margin-block-start: 0; - } - } - - @include iro.bem-modifier('accent') { - @include iro.bem-elem('native') { - &:checked { - @include iro.bem-sibling-elem('indicator') { - background-color: fn.color(--accent --handle-border); - - &::after { - border-color: fn.color(--accent --handle-border); - } - } - - &:hover, - &:focus-visible { - @include iro.bem-sibling-elem('indicator') { - background-color: fn.color(--accent --hover --handle-border); - - &::after { - border-color: fn.color(--accent --hover --handle-border); - } - } - } - } - - &:disabled { - @include iro.bem-sibling-elem('label') { - color: fn.color(--disabled --label); - } - - &:checked { - @include iro.bem-sibling-elem('indicator') { - background-color: fn.color(--disabled --handle-border); - - &::after { - border-color: fn.color(--disabled --handle-border); - } - } - } - } - } - } - } -} diff --git a/src/objects/_table.scss b/src/objects/_table.scss deleted file mode 100644 index 2c9f65b..0000000 --- a/src/objects/_table.scss +++ /dev/null @@ -1,168 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; -@use '../mixins' as mx; - -@include iro.props-namespace('table') { - @include iro.props-store(( - --dims: ( - --pad-i: fn.global-dim(--size --175), - --pad-b: fn.global-dim(--size --125), - --rounding: fn.global-dim(--rounding), - --border: fn.global-dim(--border --thin), - - --sm: ( - --pad-b: fn.global-dim(--size --75), - ) - ), - --colors: ( - --border: fn.global-color(--border), - --heading: fn.global-color(--heading), - --hover: fn.global-color(--border-mute), - --active: fn.global-color(--border), - --box: ( - --bg: fn.global-color(--base --50), - --hover: fn.global-color(--bg-base), - --active: fn.global-color(--border-mute), - ) - ) - )); - - @include iro.bem-object(iro.props-namespace()) { - border-spacing: 0; - border-collapse: separate; - - @include iro.bem-modifier('fixed') { - table-layout: fixed; - } - - @include iro.bem-elem('head-cell') { - @include mx.set-font(--standard, ( - --line-height: null, - --size: fn.global-dim(--font-size --50), - --weight: bold, - --transform: uppercase, - --spacing: .5px - )); - - padding-inline: fn.dim(--pad-i); - padding-block: fn.dim(--pad-b); - color: fn.color(--heading); - text-align: start; - } - - @include iro.bem-elem('cell') { - padding-inline: fn.dim(--pad-i); - padding-block: fn.dim(--pad-b); - border-width: 0; - border-block-start-width: fn.dim(--border); - border-style: solid; - border-color: fn.color(--border); - - @include iro.bem-modifier('divider') { - border-inline-end-width: fn.dim(--border); - } - } - - @include iro.bem-elem('row') { - &:last-child { - @include iro.bem-elem('cell') { - border-block-end-width: fn.dim(--border); - } - } - } - - @include iro.bem-modifier('flush') { - @include iro.bem-elem('head-cell', 'cell') { - &:first-child { - padding-inline-start: 0; - } - - &:last-child { - padding-inline-end: 0; - } - } - } - - @include iro.bem-modifier('box') { - @include iro.bem-elem('cell') { - background-color: fn.color(--box --bg); - - &:first-child { - border-inline-start-width: fn.dim(--border); - } - - &:last-child { - border-inline-end-width: fn.dim(--border); - } - } - - @include iro.bem-elem('row') { - &:first-child { - @include iro.bem-elem('cell') { - &:first-child { - border-start-start-radius: fn.dim(--rounding); - } - - &:last-child { - border-start-end-radius: fn.dim(--rounding); - } - } - } - - &:last-child { - @include iro.bem-elem('cell') { - &:first-child { - border-end-start-radius: fn.dim(--rounding); - } - - &:last-child { - border-end-end-radius: fn.dim(--rounding); - } - } - } - } - } - - @include iro.bem-modifier('interactive') { - @include iro.bem-elem('row') { - @include iro.bem-elem('cell') { - cursor: pointer; - } - - &:hover { - @include iro.bem-elem('cell') { - background-color: fn.color(--hover); - } - } - - &:active { - @include iro.bem-elem('cell') { - background-color: fn.color(--active); - } - } - } - - @include iro.bem-modifier('box') { - @include iro.bem-elem('row') { - &:hover { - @include iro.bem-elem('cell') { - background-color: fn.color(--box --hover); - } - } - - &:active { - @include iro.bem-elem('cell') { - background-color: fn.color(--box --active); - } - } - } - } - } - - @include iro.bem-modifier('sm') { - @include iro.bem-elem('head-cell', 'cell') { - padding-block: fn.dim(--sm --pad-b); - } - } - } -} diff --git a/src/objects/_text-field.scss b/src/objects/_text-field.scss deleted file mode 100644 index 6611ea6..0000000 --- a/src/objects/_text-field.scss +++ /dev/null @@ -1,213 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@mixin invalid { - $focus-border-offset: calc(fn.dim(--border) - fn.dim(--focus --border)); - - @include iro.bem-sibling-elem('bg') { - inset-block: $focus-border-offset; - inset-inline: $focus-border-offset; - border: fn.dim(--focus --border) solid fn.color(--error --border); - border-radius: calc(fn.dim(--rounding) - $focus-border-offset); - } - - &:hover { - @include iro.bem-sibling-elem('bg') { - border-color: fn.color(--error --hover --border); - } - } - - &:focus { - @include iro.bem-sibling-elem('bg') { - border-color: fn.color(--error --focus --border); - } - } -} - -@mixin keyboard-focus { - @include iro.bem-sibling-elem('bg') { - border-color: fn.color(--key-focus --border); - outline: fn.color(--key-focus --outline) solid fn.dim(--key-focus --border); - //outline-offset: fn.dim(--focus --border); - } -} - -@include iro.props-namespace('text-field') { - @include iro.props-store(( - --dims: ( - --line-height: 1.4, - --pad-i: fn.global-dim(--size --125), - --pad-b: fn.global-dim(--size --125), - --border: fn.global-dim(--border --thin), - --rounding: fn.global-dim(--rounding), - - --extended: ( - --pad: fn.global-dim(--size --50), - ), - - --focus: ( - --border: fn.global-dim(--border --medium), - ), - - --key-focus: ( - --border: fn.global-dim(--key-focus --outline), - ), - ), - --colors: ( - --bg: fn.global-color(--base --50), - --placeholder: fn.global-color(--text-mute-more), - --text: fn.global-color(--text), - --border: fn.global-color(--border-strong), - - --hover: ( - --border: fn.global-color(--text-mute-more), - ), - --focus: ( - --border: fn.global-color(--focus --border), - ), - --key-focus: ( - --border: fn.global-color(--focus --border), - --outline: fn.global-color(--focus --outline), - ), - --error: ( - --border: fn.global-color(--negative --700), - - --hover: ( - --border: fn.global-color(--negative --900), - ), - --focus: ( - --border: fn.global-color(--negative --900), - ), - ), - --disabled: ( - --bg: fn.global-color(--border-mute), - --placeholder: fn.global-color(--text-disabled), - --text: fn.global-color(--text-disabled), - --border: fn.global-color(--border-mute), - ), - ), - )); - - @include iro.bem-object(iro.props-namespace()) { - $focus-border-offset: calc(fn.dim(--border) - fn.dim(--focus --border)); - - position: relative; - min-inline-size: 0; - border-radius: fn.dim(--rounding); - background-color: fn.color(--bg); - - @include iro.bem-elem('bg') { - display: block; - position: absolute; - inset-block: 0; - inset-inline: 0; - border: fn.dim(--border) solid fn.color(--border); - border-radius: fn.dim(--rounding); - pointer-events: none; - } - - @include iro.bem-elem('native') { - box-sizing: border-box; - inline-size: 100%; - padding-block: calc(fn.dim(--pad-b) - .5em * (fn.dim(--line-height) - 1)); - padding-inline: fn.dim(--pad-i); - border: 1px solid transparent; - background-color: transparent; - color: fn.color(--text); - font: inherit; - line-height: fn.dim(--line-height); - resize: none; - appearance: none; - - &::placeholder { - opacity: 1; - color: fn.color(--placeholder); - font-style: italic; - } - - &:hover { - @include iro.bem-sibling-elem('bg') { - border-color: fn.color(--hover --border); - } - } - - &:focus { - outline: 0; - - @include iro.bem-sibling-elem('bg') { - inset-block: $focus-border-offset; - inset-inline: $focus-border-offset; - border: fn.dim(--focus --border) solid fn.color(--focus --border); - border-radius: calc(fn.dim(--rounding) - $focus-border-offset); - } - } - - &:invalid { - @include invalid; - } - - &:focus-visible, - &:invalid:focus-visible { - @include keyboard-focus; - } - } - - @include iro.bem-modifier('extended') { - padding: fn.dim(--extended --pad); - - @include iro.bem-multi('&', 'elem' 'bg') { - border-radius: calc(fn.dim(--rounding) + fn.dim(--extended --pad)); - } - - @include iro.bem-elem('native') { - &:focus { - @include iro.bem-sibling-elem('bg') { - border-radius: calc(fn.dim(--rounding) + fn.dim(--extended --pad) - $focus-border-offset); - } - } - } - } - - @include iro.bem-is('invalid') { - @include iro.bem-elem('native') { - @include invalid; - - &:focus-visible { - @include keyboard-focus; - } - } - } - - @include iro.bem-is('disabled') { - background-color: fn.color(--disabled --bg); - - @include iro.bem-elem('native') { - color: fn.color(--disabled --text); - - &::placeholder { - color: fn.color(--disabled --placeholder); - } - } - - @include iro.bem-elem('bg') { - border-color: fn.color(--disabled --border); - } - - @include iro.bem-is('invalid') { - @include iro.bem-elem('native') { - @include iro.bem-sibling-elem('bg') { - border-color: fn.color(--disabled --border); - } - } - } - - @include iro.bem-elem('native') { - &:invalid { - @include iro.bem-sibling-elem('bg') { - border-color: fn.color(--disabled --border); - } - } - } - } - } -} -- cgit v1.2.3-70-g09d2