UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

280 lines (241 loc) 6.14 kB
@import '../../style/themes/default'; @import '../../style/mixins/index'; @badge-prefix-cls: ~'@{c7n-prefix}-badge'; @number-prefix-cls: ~'@{c7n-prefix}-scroll-number'; .@{badge-prefix-cls} { .reset-component; position: relative; display: inline-block; line-height: 1; vertical-align: middle; &-count { position: absolute; top: calc(-1 * @badge-height / 2); min-width: @badge-height; height: @badge-height; padding: 0 0.06rem; color: #fff; font-weight: @badge-font-weight; font-size: @badge-font-size; line-height: @badge-height; white-space: nowrap; text-align: center; background: @badge-corner-background; border-radius: calc(@badge-height / 2); box-shadow: @badge-corner-box-shadow; transform: translateX(-50%); transform-origin: -10% center; a, a:hover { color: #fff; } } &-count-sm { top: calc(-1 * @badge-height-sm / 2); min-width: @badge-height-sm; height: @badge-height-sm; padding: 0 0.03rem; font-size: @badge-font-size-sm; line-height: @badge-height-sm; border-radius: calc(@badge-height-sm / 2); } &-multiple-words { padding: 0 0.08rem; } &-dot { position: absolute; top: calc(-1 * @badge-dot-size / 2); z-index: 1; width: @badge-dot-size; min-width: @badge-dot-size; height: @badge-dot-size; background: @badge-corner-background; border-radius: 100%; box-shadow: @badge-corner-box-shadow; transform: translateX(-50%); transform-origin: 0 center; } // Tricky way to resolve https://github.com/ant-design/ant-design/issues/30088 &-dot.@{number-prefix-cls} { transition: background @animation-duration-slow; } .@{number-prefix-cls}-custom-component { position: absolute; top: 0; right: 0; font-size: inherit; line-height: 1; transform: translate(50%, -50%); transform-origin: 100% 0; } &-count, &-dot, .@{number-prefix-cls}-custom-component { &.@{iconfont-css-prefix}-spin { animation: c7nBadgeLoadingCircle 1s infinite linear; } } &-status { &-dot { position: relative; top: -0.01rem; display: inline-block; width: @badge-status-size; height: @badge-status-size; vertical-align: middle; border-radius: 50%; } &-success { background-color: @success-color; } &-processing { background-color: @badge-processing-color; &::after { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: @border-width-base @border-style-base @badge-processing-color; border-radius: 50%; animation: c7nStatusProcessing 1.2s infinite ease-in-out; content: ''; } } &-default { background-color: @normal-color; } &-error { background-color: @error-color; } &-warning { background-color: @warning-color; } // mixin to iterate over colors and create CSS class for each one .make-color-classes(@i: length(@preset-colors)) when (@i > 0) { .make-color-classes(@i - 1); @color: extract(@preset-colors, @i); @darkColor: '@{color}-6'; &-@{color} { background: @@darkColor; } } .make-color-classes(); &-text { margin-left: 0.08rem; color: @badge-text-color; font-size: @font-size-base; } } &-zoom-appear, &-zoom-enter { animation: c7nZoomBadgeIn @animation-duration-slow @ease-out-back; animation-fill-mode: both; } &-zoom-leave { animation: c7nZoomBadgeOut @animation-duration-slow @ease-in-back; animation-fill-mode: both; } &-not-a-wrapper { .@{badge-prefix-cls}-zoom-appear, .@{badge-prefix-cls}-zoom-enter { animation: c7nNoWrapperZoomBadgeIn @animation-duration-slow @ease-out-back; } .@{badge-prefix-cls}-zoom-leave { animation: c7nNoWrapperZoomBadgeOut @animation-duration-slow @ease-in-back; } &:not(.@{badge-prefix-cls}-status) { vertical-align: middle; } .@{number-prefix-cls}-custom-component, .@{badge-prefix-cls}-count { transform: none; } .@{number-prefix-cls}-custom-component, .@{number-prefix-cls} { position: relative; top: auto; display: block; transform-origin: 50% 50%; } } } @keyframes c7nStatusProcessing { 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; direction: ltr; &-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 c7nZoomBadgeIn { 0% { transform: scale(0) translateX(-50%); opacity: 0; } 100% { transform: scale(1) translateX(-50%); } } @keyframes c7nZoomBadgeOut { 0% { transform: scale(1) translateX(-50%); } 100% { transform: scale(0) translateX(-50%); opacity: 0; } } @keyframes c7nNoWrapperZoomBadgeIn { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); } } @keyframes c7nNoWrapperZoomBadgeOut { 0% { transform: scale(1); } 100% { transform: scale(0); opacity: 0; } } @keyframes c7nBadgeLoadingCircle { 0% { transform-origin: 50%; } 100% { transform: translate(50%, -50%) rotate(360deg); transform-origin: 50%; } }