UNPKG

chowa

Version:

UI component library based on React

141 lines (130 loc) 3.43 kB
/** * @license chowa v1.1.3 * * Copyright (c) Chowa Techonlogies Co.,Ltd.(http://www.chowa.cn). * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ @keyframes cw-rotating { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .cw-switch-wrapper { color: #616a6e; display: inline-block; margin: 0; padding: 0; height: 32px; line-height: 32px; font-size: 14px; outline: none; white-space: nowrap; } .cw-switch-wrapper:not(.cw-switch-disabled):hover .cw-switch { border-color: #7774e7; } .cw-switch-wrapper:not(.cw-switch-disabled):focus .cw-switch { box-shadow: 0 1px 2px 3px rgba(119, 116, 231, 0.15); border-color: #7774e7; } .cw-switch-wrapper.cw-has-error .cw-switch { border-color: #ed4014; } .cw-switch-wrapper + .cw-switch-wrapper { margin-left: 12px; } @keyframes cw-switch-btn-anim { 50% { width: 26px; } } .cw-switch { display: inline-block; position: relative; vertical-align: top; cursor: pointer; margin: 5px 0; padding: 0; height: 22px; min-width: 44px; border-radius: 11px; box-sizing: border-box; border: 1px solid #e6ecf5; background-color: #f8f8f8; transition: all 0.2s ease-in; } .cw-switch:focus-within .cw-switch-circle:before { animation-name: cw-switch-btn-anim; animation-duration: 0.2s; animation-timing-function: ease-in-out; } .cw-switch-circle { position: absolute; display: block; top: 1px; left: 0; padding: 0 1px; margin: 0; transition: all 0.2s ease-in; } .cw-switch-circle:before { margin: 0; padding: 0; width: 18px; height: 18px; content: ''; border-radius: 100%; background-color: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 4px 0 0 rgba(0, 0, 0, 0.04), 0 4px 9px rgba(0, 0, 0, 0.13), 0 3px 3px rgba(0, 0, 0, 0.05); display: block; cursor: pointer; z-index: 10; } .cw-switch-inner { display: block; margin: 0; padding: 0; box-sizing: border-box; color: #888da8; line-height: 22px; font-size: 12px; padding-right: 10px; padding-left: 22px; } .cw-switch-input { position: absolute; top: 0; left: 0; opacity: 0; } .cw-switch-label { padding: 0; margin: 0 0 0 6px; } .cw-switch-checked .cw-switch { background-color: #8c8aeb; border-color: #7774e7; } .cw-switch-checked .cw-switch .cw-switch-circle { left: 100%; transform: translateX(-100%); } .cw-switch-checked .cw-switch .cw-switch-inner { color: #fff; padding-left: 10px; padding-right: 22px; } .cw-switch-loading .cw-switch { cursor: not-allowed; } .cw-switch-loading .cw-switch .cw-switch-circle:before { cursor: not-allowed; } .cw-switch-loading .cw-switch .cw-switch-circle:after { content: ''; display: block; z-index: 15; position: absolute; top: 3px; left: 4px; right: 4px; bottom: 3px; margin: 0; padding: 0; box-sizing: border-box; cursor: not-allowed; border-top: 1px solid #7774e7; border-radius: 100%; animation-name: cw-rotating; animation-duration: 1s; animation-timing-function: linear; animation-iteration-count: infinite; } .cw-switch-disabled { color: #888da8; } .cw-switch-disabled .cw-switch, .cw-switch-disabled .cw-switch-circle:before { cursor: not-allowed; background-color: #e9ecef; }