UNPKG

@nutui/nutui-react

Version:

京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序

96 lines 3.78 kB
/* #ifdef harmony */ /* #endif */ /* #ifndef harmony */ /* #endif */ .nut-switch { cursor: pointer; position: relative; display: inline-flex; flex-direction: row; align-items: center; min-width: var(--nutui-switch-width, 46px); height: var(--nutui-switch-height, 28px); line-height: var(--nutui-switch-line-height, 28px); background-color: var(--nutui-switch-active-background-color, var(--nutui-color-primary, #ff0f23)); border-radius: var(--nutui-switch-border-radius, 50px); background-size: 100% 100%; background-repeat: no-repeat; background-position: center center; flex: 0 0 auto; } .nut-switch-button { position: absolute; top: 50%; transform: translateY(-50%); display: flex; flex-direction: row; align-items: center; justify-content: center; height: calc(var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) * 2); width: calc(var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) * 2); border-radius: var(--nutui-switch-inside-border-radius, 50%); background: #ffffff; transition: left 0.3s linear; box-shadow: var(--nutui-switch-inside-box-shadow, 0px 2px 6px 0px rgba(0, 0, 0, 0.1)); } .nut-switch-button-open { left: calc(100% - var(--nutui-switch-height, 28px) + var(--nutui-switch-border-width, 2px)); } .nut-switch-button-open-rtl { left: var(--nutui-switch-border-width, 2px); } .nut-switch-button-close { left: var(--nutui-switch-border-width, 2px); } .nut-switch-button-close-rtl { left: calc(100% - var(--nutui-switch-height, 28px) + var(--nutui-switch-border-width, 2px)); } .nut-switch-button .nut-icon { width: calc((var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) * 2) / 2); height: calc((var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) * 2) / 2); color: var(--nutui-switch-active-disabled-background-color, var(--nutui-color-primary-disabled-special, #ffadbe)); } .nut-switch-close { background-color: var(--nutui-switch-inactive-background-color, var(--nutui-color-text-disabled, #c2c4cc)); } .nut-switch-close-line { width: calc((var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) * 2) / 2); height: 2px; background: var(--nutui-switch-inactive-line-background-color, #ffffff); border-radius: 2px; } .nut-switch-label { display: inline-flex; align-items: center; height: 100%; white-space: nowrap; color: var(--nutui-switch-label-text-color, #ffffff); font-size: var(--nutui-switch-label-font-size, var(--nutui-font-size-s, 12px)); } .nut-switch-label .nut-icon { color: var(--nutui-switch-label-text-color, #ffffff); } .nut-switch-label-open { margin: 0 calc(var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) + 3px) 0 7px; } .nut-switch-label-open-rtl { margin: 0 7px 0 calc(var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) + 3px); } .nut-switch-label-close { margin: 0 7px 0 calc(var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) + 3px); } .nut-switch-label-close-rtl { margin: 0 calc(var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) + 3px) 0 7px; } .nut-switch-label-close-disabled { color: var(--nutui-switch-inactive-disabled-label-text-color, var(--nutui-color-text-disabled, #c2c4cc)); } .nut-switch-label-close-disabled .nut-icon { color: var(--nutui-switch-inactive-disabled-label-text-color, var(--nutui-color-text-disabled, #c2c4cc)); } .nut-switch-disabled { background-color: var(--nutui-switch-active-disabled-background-color, var(--nutui-color-primary-disabled-special, #ffadbe)); } .nut-switch-disabled-close { background-color: var(--nutui-switch-inactive-disabled-background-color, var(--nutui-color-background, #f2f3f5)); }