@import './mixins/mixins.scss'; @import './theme/default.scss'; @mixin size-mixin($size) { @include m($size + "-size") { $height: map-get($map: $button-height, $key: $size); $font-size: map-get($map: $button-font-size, $key: $size); font-size: $font-size; height: $height; padding: map-get($map: $button-padding, $key: $size); @include m(round) { padding: map-get($map: $round-button-padding, $key: $size); border-radius: $height / 2; } @include e(content) { line-height: $height; } @include e(icon) { $icon-size: map-get($map: $button-icon-size, $key: $size); height: $icon-size; width: $icon-size; max-width: $icon-size; .n-icon { font-size: $icon-size; display: block; } @include m(slot) { height: $icon-size; width: $icon-size; line-height: $icon-size; .n-icon-slot { height: $icon-size; width: $icon-size; font-size: $icon-size; } } } } } @mixin type-mixin ($type) { @include m($type + "-type") { border-radius: $button-border-radius; color: map-get($map: $button-color, $key: $type); background-color: map-get($map: $button-background-color, $key: $type); box-shadow: map-get($map: $button-box-shadow, $key: $type); @include not-m(disabled) { @include m(enter-pressed) { background-color: map-get($map: $button-background-color, $key: $type + '-active'); } @include m(rippling) { &::after { animation-name: #{$type}-button-ripple--spread, #{$type}-button-ripple--opacity; animation-duration: .6s; animation-timing-function: cubic-bezier(0, .4, .5, .9), cubic-bezier(.5, .2, .8, .5); } } &:not(:active):focus { @include not-m(enter-pressed) { background-color: map-get($map: $button-background-color, $key: $type + '-hover'); } } &:hover { background-color: map-get($map: $button-background-color, $key: $type + '-hover'); } &:active { background-color: map-get($map: $button-background-color, $key: $type + '-active'); } } @content } } @mixin ripple-mixin($type) { @keyframes #{$type}-button-ripple--spread { from { box-shadow: map-get($map: $button-box-shadow, $key: $type + '-focus-ripple-start'); } to { box-shadow: map-get($map: $button-box-shadow, $key: $type + '-focus-ripple-end'); } } @keyframes #{$type}-button-ripple--opacity { from { opacity: .4; } to { opacity: 0; } } } @include ripple-mixin('default'); @include ripple-mixin('primary'); @include b(button) { outline: none; position: relative; border: none; font-family: $button-font-family; display: inline-flex; align-items: center; justify-content: center; user-select: none; font-weight: 700; text-align: center; vertical-align: baseline; transition: background-color .3s $default-cubic-bezier, opacity .15s $default-cubic-bezier, box-shadow .3s $default-cubic-bezier; cursor: pointer; &::after { content: ""; border-radius: inherit; position: absolute; left: 0; top: 0; right: 0; bottom: 0; } @include e(icon) { @include fade-in-width-expand-transition(); margin-right: 6px; @include m(right) { margin-right: 0px; margin-left: 4px; } } @include e(content) { white-space: nowrap; } @include m(block) { display: block; } @include m(disabled) { cursor: not-allowed; opacity: .4; } @include m(loading) { cursor: default; opacity: .6; } @include size-mixin('tiny'); @include size-mixin('small'); @include size-mixin('medium'); @include size-mixin('large'); @include type-mixin('default'); @include type-mixin('primary'); &::-moz-focus-inner { border: 0; } }