UNPKG

@fe6/water-pro

Version:

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

345 lines (293 loc) 6.64 kB
@select-prefix: ~'rc-select'; * { box-sizing: border-box; } .search-input-without-border() { .@{select-prefix}-selection-search-input { width: 100%; background: rgba(255, 0, 0, 0.2); border: none; outline: none; } } .@{select-prefix} { position: relative; display: inline-block; width: 100px; font-size: 12px; &-disabled { &, & input { cursor: not-allowed; } .@{select-prefix}-selector { opacity: 0.3; } } &-show-arrow&-loading { .@{select-prefix}-arrow { &-icon::after { box-sizing: border-box; width: 12px; height: 12px; margin-top: 4px; border: 2px solid #999; border-top-color: transparent; border-bottom-color: transparent; border-radius: 100%; transform: none; animation: rcSelectLoadingIcon 0.5s infinite; } } } // ============== Selector =============== .@{select-prefix}-selection-placeholder { opacity: 0.4; } // ============== Search =============== .@{select-prefix}-selection-search-input { appearance: none; &::-webkit-search-cancel-button { display: none; appearance: none; } } // --------------- Single ---------------- &-single { .@{select-prefix}-selector { position: relative; display: flex; .@{select-prefix}-selection-search { width: 100%; &-input { width: 100%; } } .@{select-prefix}-selection-item, .@{select-prefix}-selection-placeholder { position: absolute; top: 1px; left: 3px; pointer-events: none; } } // Not customize &:not(.@{select-prefix}-customize-input) { .@{select-prefix}-selector { padding: 1px; border: 1px solid #000; .search-input-without-border(); } } } // -------------- Multiple --------------- &-multiple .@{select-prefix}-selector { display: flex; flex-wrap: wrap; padding: 1px; border: 1px solid #000; .@{select-prefix}-selection-item { flex: none; margin-right: 2px; padding: 0 8px; background: #bbb; border-radius: 4px; &-disabled { cursor: not-allowed; opacity: 0.5; } } .@{select-prefix}-selection-search { position: relative; &-input, &-mirror { padding: 1px; font-family: system-ui; } &-mirror { position: absolute; position: none; top: 0; left: 0; z-index: 999; white-space: nowrap; visibility: hidden; } } .search-input-without-border(); } // ================ Icons ================ &-allow-clear { &.@{select-prefix}-multiple .@{select-prefix}-selector { padding-right: 20px; } .@{select-prefix}-clear { position: absolute; top: 0; right: 20px; } } &-show-arrow { &.@{select-prefix}-multiple .@{select-prefix}-selector { padding-right: 20px; } .@{select-prefix}-arrow { position: absolute; top: 0; right: 5px; pointer-events: none; &-icon::after { display: inline-block; width: 0; height: 0; border: 5px solid transparent; border-top-color: #999; transform: translateY(5px); content: ''; } } } // =============== Focused =============== &-focused { .@{select-prefix}-selector { border-color: blue !important; } } // ============== Dropdown =============== &-dropdown { position: absolute; min-height: 100px; background: #fff; border: 1px solid green; &-hidden { display: none; } } // =============== Option ================ &-item { padding: 4px 16px; font-size: 16px; line-height: 1.5; // >>> Group &-group { color: #999; font-weight: bold; font-size: 80%; } // >>> Option &-option { position: relative; &-grouped { padding-left: 24px; } .@{select-prefix}-item-option-state { position: absolute; top: 4px; right: 0; pointer-events: none; } // ------- Active ------- &-active { background: green; } // ------ Disabled ------ &-disabled { color: #999; } } // >>> Empty &-empty { color: #999; text-align: center; } } } .@{select-prefix}-selection__choice-zoom { transition: all 0.3s; } .@{select-prefix}-selection__choice-zoom-appear { transform: scale(0.5); opacity: 0; &&-active { transform: scale(1); opacity: 1; } } .@{select-prefix}-selection__choice-zoom-leave { transform: scale(1); opacity: 1; &&-active { transform: scale(0.5); opacity: 0; } } .effect() { transform-origin: 0 0; animation-duration: 0.3s; animation-fill-mode: both; } .@{select-prefix}-dropdown { &-slide-up-enter, &-slide-up-appear { .effect(); opacity: 0; animation-play-state: paused; animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1); } &-slide-up-leave { .effect(); opacity: 1; animation-play-state: paused; animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34); } &-slide-up-enter&-slide-up-enter-active&-placement-bottomLeft, &-slide-up-appear&-slide-up-appear-active&-placement-bottomLeft { animation-name: rcSelectDropdownSlideUpIn; animation-play-state: running; } &-slide-up-leave&-slide-up-leave-active&-placement-bottomLeft { animation-name: rcSelectDropdownSlideUpOut; animation-play-state: running; } &-slide-up-enter&-slide-up-enter-active&-placement-topLeft, &-slide-up-appear&-slide-up-appear-active&-placement-topLeft { animation-name: rcSelectDropdownSlideDownIn; animation-play-state: running; } &-slide-up-leave&-slide-up-leave-active&-placement-topLeft { animation-name: rcSelectDropdownSlideDownOut; animation-play-state: running; } } @keyframes rcSelectDropdownSlideUpIn { 0% { transform: scaleY(0); transform-origin: 0% 0%; opacity: 0; } 100% { transform: scaleY(1); transform-origin: 0% 0%; opacity: 1; } } @keyframes rcSelectDropdownSlideUpOut { 0% { transform: scaleY(1); transform-origin: 0% 0%; opacity: 1; } 100% { transform: scaleY(0); transform-origin: 0% 0%; opacity: 0; } } @keyframes rcSelectLoadingIcon { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }