@use 'iro-sass/src/index' as iro; @include iro.props-namespace('radio') { @include iro.props-store(( --dims: ( --diameter: iro.fn-px-to-rem(15px), --label-gap: .6rem, --border-width: iro.props-get(--dims --border-width --medium, $global: true), --padding-x: .3rem, --padding-y: .3rem, --margin-right: iro.props-get(--dims --spacing --x --md, $global: true), ), --colors: ( --circle-border: iro.props-get(--colors --fg-hi, $global: true), --circle-bg: iro.props-get(--colors --bg-hi, $global: true), --hover: ( --label: iro.props-get(--colors --fg-lo, $global: true), --circle-border: iro.props-get(--colors --fg, $global: true), ), --accent: ( --circle-border: iro.props-get(--colors --accent --primary, $global: true), --hover: ( --circle-border: iro.props-get(--colors --accent --primary-lo, $global: true), ), ), --key-focus: ( --label: iro.props-get(--colors --focus --text, $global: true), --circle-border: iro.props-get(--colors --focus --fill, $global: true), --shadow: iro.props-get(--colors --focus --shadow, $global: true), ), --disabled: ( --label: iro.props-get(--colors --fg-hi3, $global: true), --circle-border: iro.props-get(--colors --obj-lo, $global: true), --circle-bg: iro.props-get(--colors --bg-hi, $global: true), ) ), )); @include iro.bem-object(iro.props-namespace()) { display: inline-flex; position: relative; align-items: flex-start; margin-right: calc(-1 * iro.props-get(--dims --padding-x) + iro.props-get(--dims --margin-right)); margin-left: calc(-1 * iro.props-get(--dims --padding-x)); padding: iro.props-get(--dims --padding-y) iro.props-get(--dims --padding-x); @include iro.bem-elem('circle') { display: block; position: relative; box-sizing: border-box; flex: 0 0 auto; width: iro.props-get(--dims --diameter); height: iro.props-get(--dims --diameter); margin-top: calc(.5 * (#{$line-height * 1em} - #{iro.props-get(--dims --diameter)})); border-radius: 2em; background-color: iro.props-get(--colors --circle-border); &::after { content: ''; display: block; position: absolute; z-index: 10; top: 50%; left: iro.props-get(--dims --border-width); width: calc(iro.props-get(--dims --diameter) - 2 * iro.props-get(--dims --border-width)); height: calc(iro.props-get(--dims --diameter) - 2 * iro.props-get(--dims --border-width)); transform: translateY(-50%); transition: transform .2s ease; border-radius: iro.props-get(--dims --diameter); background-color: iro.props-get(--colors --circle-bg); } } @include iro.bem-elem('label') { align-self: baseline; margin-left: iro.props-get(--dims --label-gap); } @include iro.bem-elem('native') { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; opacity: .0001; &:hover { @include iro.bem-sibling-elem('label') { color: iro.props-get(--colors --hover --label); } @include iro.bem-sibling-elem('circle') { background-color: iro.props-get(--colors --hover --circle-border); } } &:checked { @include iro.bem-sibling-elem('circle') { &::after { transform: translateY(-50%) scale(.44); } } } &:disabled { @include iro.bem-sibling-elem('label') { color: iro.props-get(--colors --disabled --label); } @include iro.bem-sibling-elem('circle') { background-color: iro.props-get(--colors --disabled --circle-border); &::after { background-color: iro.props-get(--colors --disabled --circle-bg); } } } @include iro.bem-at-theme('keyboard') { &:focus { @include iro.bem-sibling-elem('label') { color: iro.props-get(--colors --key-focus --label); } @include iro.bem-sibling-elem('circle') { background-color: iro.props-get(--colors --key-focus --circle-border); box-shadow: iro.props-get(--colors --key-focus --shadow); } } } } @include iro.bem-modifier('accent') { @include iro.bem-elem('native') { &:checked { @include iro.bem-sibling-elem('circle') { background-color: iro.props-get(--colors --accent --circle-border); } &:hover { @include iro.bem-sibling-elem('circle') { background-color: iro.props-get(--colors --accent --hover --circle-border); } } } &:disabled { @include iro.bem-sibling-elem('circle') { background-color: iro.props-get(--colors --disabled --circle-border); &::after { background-color: iro.props-get(--colors --disabled --circle-bg); } } &:checked { @include iro.bem-sibling-elem('circle') { background-color: iro.props-get(--colors --disabled --circle-border); } } } } } } }