@import './mixins/mixins.scss'; @import './themes/vars.scss'; @keyframes n-badge-number-fade-up-in { from { transform: translateY(60%); opacity: 0; } to { transform: translateY(0); opacity: 1; } } @keyframes n-badge-number-fade-down-in { from { transform: translateY(-60%); opacity: 0; } to { transform: translateY(0); opacity: 1; } } @keyframes n-badge-number-fade-up-out { from { transform: translateY(0%); opacity: 1; } to { transform: translateY(-60%); opacity: 0; } } @keyframes n-badge-number-fade-down-out { from { transform: translateY(0%); opacity: 1; } to { transform: translateY(60%); opacity: 0; } } @mixin badge-type-mixin ($type) { @include m($type + '-type') { @include b(badge-sup) { background-color: map-get($map: $--badge-background-color, $key: $type); @include e(ripple-mask) { background-color: map-get($map: $--badge-background-color, $key: $type); } } @include m(processing) { @include b(badge-sup) { &::before { animation-duration: 2s, 2s; animation-timing-function: $fast-in-cubic-bezier, $default-cubic-bezier; animation-iteration-count: infinite, infinite; } } @include not-m(dot) { @include b(badge-sup) { &::before { animation-name: #{$theme}-#{$type}-badge-ripple--spread, #{$theme}-#{$type}-badge-ripple--opacity; } } } } @include m(processing) { @include m(dot) { @include b(badge-sup) { &::before { animation-name: #{$theme}-#{$type}-dot-badge-ripple--spread, #{$theme}-#{$type}-badge-ripple--opacity; } } } } } } @mixin badge-ripple-mixin($type) { @keyframes #{$theme}-#{$type}-badge-ripple--spread { 0% { background-color: map-get($map: $--badge-rippling-color, $key: $type); transform: scale(0); } 25% { background-color: map-get($map: $--badge-rippling-color, $key: $type); transform: scale(1); // box-shadow: 0 0 0 0px map-get($map: $--badge-rippling-color, $key: $type); } 100% { background-color: map-get($map: $--badge-rippling-color, $key: $type); transform: scale(1.25); // box-shadow: 0 0 0 4px map-get($map: $--badge-rippling-color, $key: $type); } } @keyframes #{$theme}-#{$type}-dot-badge-ripple--spread { 0% { background-color: map-get($map: $--badge-rippling-color, $key: $type); transform: scale(0); } 25% { background-color: map-get($map: $--badge-rippling-color, $key: $type); transform: scale(1); // box-shadow: 0 0 0 0px map-get($map: $--badge-rippling-color, $key: $type); } 100% { background-color: map-get($map: $--badge-rippling-color, $key: $type); transform: scale(1.75); // box-shadow: 0 0 0 4px map-get($map: $--badge-rippling-color, $key: $type); } } @keyframes #{$theme}-#{$type}-badge-ripple--opacity { 0% { opacity: 0; } 25% { opacity: $--badge-rippling-start-opacity; } 100% { opacity: 0; } } } @include themes-mixin { @include badge-ripple-mixin('default'); @include badge-ripple-mixin('info'); @include badge-ripple-mixin('success'); @include badge-ripple-mixin('warning'); @include badge-ripple-mixin('error'); @include b(badge) { @include once { display: inline-block; position: relative; vertical-align: middle; @include m(dot) { @include b(badge-sup) { height: 8px; width: 8px; padding: 0; min-width: 8px; left: calc(100% - 4px); bottom: calc(100% - 4px); @include e(ripple-mask) { border-radius: 4px; } &::before { border-radius: 4px; } } } } @include badge-type-mixin('default'); @include badge-type-mixin('info'); @include badge-type-mixin('success'); @include badge-type-mixin('warning'); @include badge-type-mixin('error'); } @include once { @include b(badge-sup) { @include fade-in-scale-up-transition(badge, left bottom); transition: background-color .3s $default-cubic-bezier, color .3s $default-cubic-bezier; color: white; position: absolute; height: 18px; line-height: 18px; border-radius: 9px; padding: 0 6px; text-align: center; font-size: 12px; left: calc(100% - 9px); bottom: calc(100% - 9px); font-weight: bold; @include e(ripple-mask) { position: absolute; top: 0; bottom: 0; left: 0; right: 0; border-radius: 9px; } &::before { opacity: 0; transform: scale(1); border-radius: 9px; content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: 0; } } @include b(scroll-numbers) { overflow: hidden; white-space: nowrap; display: inline-block; height: 18px; line-height: 18px; @include b(scroll-number) { @include fade-up-width-expand-transition($duration: .2s); @include fade-in-width-expand-transition($duration: .2s, $delay: 0s); display: inline-block; position: relative; height: 18px; @include b(scroll-number-old-number) { display: inline-block; opacity: 0; position: absolute; left: 0; @include m(top) { transform: translateY(-100%); } @include m(bottom) { transform: translateY(100%); } @include m(down-scroll) { animation: n-badge-number-fade-down-out .2s $fast-in-cubic-bezier; animation-iteration-count: 1 } @include m(up-scroll) { animation: n-badge-number-fade-up-out .2s $fast-in-cubic-bezier; animation-iteration-count: 1 } } @include b(scroll-number-current-number) { display: inline-block; position: absolute; left: 0; top: 0; bottom: 0; right: 0; opacity: 1; transform: translateY(0); @include m(down-scroll) { animation: n-badge-number-fade-down-in .2s $fast-in-cubic-bezier; animation-iteration-count: 1 } @include m(up-scroll) { animation: n-badge-number-fade-up-in .2s $fast-in-cubic-bezier; animation-iteration-count: 1 } @include e(inner) { display: inline-block; position: absolute; right: 0; top: 0; @include m(not-number) { right: unset; left: 0; } } } } } } }