UNPKG

acud

Version:

acg react 组件库

306 lines (265 loc) • 7.03 kB
@import '../../style/themes/index'; @import '../../style/mixins/index'; @badge-prefix-cls: ~'@{acud-prefix}-badge'; @number-prefix-cls: ~'@{acud-prefix}-scroll-number'; .@{badge-prefix-cls} { .reset-component(); position: relative; display: inline-block; line-height: 1; &-count { z-index: @zindex-badge; min-width: @badge-height; height: @badge-height; color: @badge-text-color; font-weight: @badge-font-weight; font-size: @badge-font-size; line-height: @badge-height - 2px; white-space: nowrap; text-align: center; background: @badge-color; border-radius: (@badge-height / 2); border: 1px solid @badge-text-color; a, a:hover { color: @badge-text-color; } } &-count-sm { min-width: @badge-height-sm; height: @badge-height-sm; padding: 0; font-size: @badge-font-size-sm; line-height: @badge-height-sm; border-radius: (@badge-height-sm / 2); } &-multiple-words { padding: 0 2 * @P; } &-dot { z-index: @zindex-badge; width: @badge-dot-size; min-width: @badge-dot-size; height: @badge-dot-size; background: @badge-highlight-color; border-radius: 100%; } &-count, &-dot, .@{number-prefix-cls}-custom-component { display: inline-block; vertical-align: top; transform: translate(-50%, -2.5 * @P); transform-origin: 100% 0%; &.@{iconfont-css-prefix}-spin { animation: acudBadgeLoadingCircle 1s infinite linear; } } &-dot { transform: translate(-4px, -4px); } &-text { padding: 0 2 * @P; } &-status { line-height: inherit; vertical-align: baseline; &-dot { position: relative; top: -1px; display: inline-block; width: @badge-status-size; height: @badge-status-size; vertical-align: middle; border-radius: 50%; } &-success { background-color: @badge-success-color; } &-processing { position: relative; background-color: @badge-processing-color; &::after { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 1px solid @badge-processing-color; border-radius: 50%; animation: acudStatusProcessing 1.2s infinite ease-in-out; content: ''; } } &-default { background-color: @badge-normal-color; } &-error { background-color: @badge-error-color; } &-warning { background-color: @badge-warning-color; } // mixin to iterate over colors and create CSS class for each one .make-color-classes(@i: length(@badge-preset-colors)) when (@i > 0) { .make-color-classes(@i - 1); @color: extract(@badge-preset-colors, @i); @darkColor: '@{color}-6'; &-@{color} { background: @@darkColor; } } .make-color-classes(); &-text { margin-left: 8px; color: @G2; font-size: @T3; } } &-zoom-appear, &-zoom-enter, &-zoom-leave { animation-duration: @animation-duration-slow; animation-fill-mode: both; transform-origin: 0 0; } &-zoom-appear, &-zoom-enter { animation-name: acudZoomBadgeIn; animation-timing-function: @ease-out-back; } &-zoom-leave { animation-name: acudZoomBadgeOut; animation-timing-function: @ease-in-back; } &-dot&-zoom-appear, &-dot&-zoom-enter { animation-name: acudZoomBadgeInDot; } &-dot&-zoom-leave { animation-name: acudZoomBadgeOutDot; } &-not-a-wrapper { .@{badge-prefix-cls}-zoom-appear, .@{badge-prefix-cls}-zoom-enter { animation: acudNoWrapperZoomBadgeIn @animation-duration-slow @ease-out-back; } .@{badge-prefix-cls}-zoom-leave { animation: acudNoWrapperZoomBadgeOut @animation-duration-slow @ease-in-back; } &:not(.@{badge-prefix-cls}-status) { vertical-align: middle; } .@{number-prefix-cls}-custom-component { transform: none; } .@{number-prefix-cls}-custom-component, .@{acud-prefix}-scroll-number { position: relative; top: auto; display: block; transform-origin: 50% 50%; } .@{badge-prefix-cls}-count { transform: none; } } } @keyframes acudStatusProcessing { 0% { transform: scale(0.8); opacity: 0.5; } 100% { transform: scale(2.4); opacity: 0; } } // Safari will blink with transform when inner element has absolute style. .safari-fix-motion() { -webkit-transform-style: preserve-3d; -webkit-backface-visibility: hidden; } .@{number-prefix-cls} { overflow: hidden; &-only { position: relative; display: inline-block; height: @badge-height; transition: all @animation-duration-slow @ease-in-out; .safari-fix-motion; > p.@{number-prefix-cls}-only-unit { height: @badge-height; margin: 0; .safari-fix-motion; } } &-symbol { vertical-align: top; } } @keyframes acudZoomBadgeIn { 0% { transform: scale(0) translate(-50%, -2.5 * @P); opacity: 0; } 100% { transform: scale(1) translate(-50%, -2.5 * @P); } } @keyframes acudZoomBadgeOut { 0% { transform: scale(1) translate(-50%, -2.5 * @P); } 100% { transform: scale(0) translate(-50%, -2.5 * @P); opacity: 0; } } @keyframes acudZoomBadgeInDot { 0% { transform: scale(0) translate(-4px, -4px); opacity: 0; } 100% { transform: scale(1) translate(-4px, -4px); } } @keyframes acudZoomBadgeOutDot { 0% { transform: scale(1) translate(-4px, -4px); } 100% { transform: scale(0) translate(-4px, -4px); opacity: 0; } } @keyframes acudNoWrapperZoomBadgeIn { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); } } @keyframes acudNoWrapperZoomBadgeOut { 0% { transform: scale(1); } 100% { transform: scale(0); opacity: 0; } } @keyframes acudBadgeLoadingCircle { 0% { transform-origin: 50%; } 100% { transform: translate(50%, -50%) rotate(360deg); transform-origin: 50%; } } @import './ribbon'; @import './rtl';