mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-01 18:58:10 +08:00
fix(var): fix input/radio/checkbox used by other components (#2821)
This commit is contained in:
parent
42a00d3001
commit
57b1ccf85b
@ -0,0 +1,141 @@
|
||||
@use "sass:map";
|
||||
|
||||
@import 'common/var';
|
||||
@import 'mixins/mixins';
|
||||
@import 'mixins/var';
|
||||
|
||||
@include b(checkbox-button) {
|
||||
@include set-component-css-var('checkbox-button', $--checkbox-button);
|
||||
}
|
||||
|
||||
@include b(checkbox-button) {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
@include e(inner) {
|
||||
display: inline-block;
|
||||
line-height: 1;
|
||||
font-weight: var(--el-checkbox-font-weight);
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
background: var(
|
||||
--el-button-default-background-color,
|
||||
map.get($--button, 'default-background-color')
|
||||
);
|
||||
border: $--border-base;
|
||||
border-left: 0;
|
||||
color: var(
|
||||
--el-button-default-font-color,
|
||||
map.get($--button, 'default-font-color')
|
||||
);
|
||||
-webkit-appearance: none;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
outline: none;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
transition: var(--el-all-transition);
|
||||
@include utils-user-select(none);
|
||||
|
||||
@include button-size(
|
||||
map.get($--button-padding-vertical, 'default'),
|
||||
map.get($--button-padding-horizontal, 'default'),
|
||||
map.get($--button-font-size, 'default'),
|
||||
0
|
||||
);
|
||||
|
||||
&:hover {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
& [class*='#{$namespace}-icon-'] {
|
||||
line-height: 0.9;
|
||||
|
||||
& + span {
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@include e(original) {
|
||||
opacity: 0;
|
||||
outline: none;
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
&.is-checked {
|
||||
& .#{$namespace}-checkbox-button__inner {
|
||||
color: var(--el-checkbox-button-checked-font-color);
|
||||
background-color: var(--el-checkbox-button-checked-background-color);
|
||||
border-color: var(--el-checkbox-button-checked-border-color);
|
||||
box-shadow: -1px 0 0 0 var(--el-color-primary-light-4);
|
||||
}
|
||||
&:first-child .#{$namespace}-checkbox-button__inner {
|
||||
border-left-color: var(--el-checkbox-button-checked-border-color);
|
||||
}
|
||||
}
|
||||
|
||||
&.is-disabled {
|
||||
& .#{$namespace}-checkbox-button__inner {
|
||||
color: var(
|
||||
--el-button-disabled-font-color,
|
||||
map.get($--button, 'disabled-font-color')
|
||||
);
|
||||
cursor: not-allowed;
|
||||
background-image: none;
|
||||
background-color: var(
|
||||
--el-button-disabled-background-color,
|
||||
map.get($--button, 'disabled-background-color')
|
||||
);
|
||||
border-color: var(
|
||||
--el-button-disabled-border-color,
|
||||
map.get($--button, 'disabled-border-color')
|
||||
);
|
||||
box-shadow: none;
|
||||
}
|
||||
&:first-child .#{$namespace}-checkbox-button__inner {
|
||||
border-left-color: var(
|
||||
--el-button-disabled-border-color,
|
||||
map.get($--button, 'disabled-border-color')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
.#{$namespace}-checkbox-button__inner {
|
||||
border-left: $--border-base;
|
||||
border-radius: var(--el-border-radius-base) 0 0
|
||||
var(--el-border-radius-base);
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.is-focus {
|
||||
& .#{$namespace}-checkbox-button__inner {
|
||||
border-color: var(--el-checkbox-button-checked-border-color);
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
.#{$namespace}-checkbox-button__inner {
|
||||
border-radius: 0 var(--el-border-radius-base) var(--el-border-radius-base)
|
||||
0;
|
||||
}
|
||||
}
|
||||
|
||||
@each $size in (medium, small, mini) {
|
||||
@include m($size) {
|
||||
.#{$namespace}-checkbox-button__inner {
|
||||
@include button-size(
|
||||
map.get($--button-padding-vertical, $size),
|
||||
map.get($--button-padding-horizontal, $size),
|
||||
map.get($--button-font-size, $size),
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
@include b(checkbox-group) {
|
||||
font-size: 0;
|
||||
}
|
@ -56,7 +56,9 @@ $--checkbox-line-height: map.merge(
|
||||
|
||||
@include b(checkbox) {
|
||||
@include set-component-css-var('checkbox', $--checkbox);
|
||||
}
|
||||
|
||||
@include b(checkbox) {
|
||||
color: var(--el-checkbox-font-color);
|
||||
font-weight: var(--el-checkbox-font-weight);
|
||||
font-size: var(--el-font-size-base);
|
||||
@ -269,139 +271,3 @@ $--checkbox-line-height: map.merge(
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@include b(checkbox-button) {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
@include e(inner) {
|
||||
display: inline-block;
|
||||
line-height: 1;
|
||||
font-weight: var(--el-checkbox-font-weight);
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
background: var(
|
||||
--el-button-default-background-color,
|
||||
map.get($--button, 'default-background-color')
|
||||
);
|
||||
border: $--border-base;
|
||||
border-left: 0;
|
||||
color: var(
|
||||
--el-button-default-font-color,
|
||||
map.get($--button, 'default-font-color')
|
||||
);
|
||||
-webkit-appearance: none;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
outline: none;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
transition: var(--el-all-transition);
|
||||
@include utils-user-select(none);
|
||||
|
||||
@include button-size(
|
||||
map.get($--button-padding-vertical, 'default'),
|
||||
map.get($--button-padding-horizontal, 'default'),
|
||||
map.get($--button-font-size, 'default'),
|
||||
0
|
||||
);
|
||||
|
||||
&:hover {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
& [class*='#{$namespace}-icon-'] {
|
||||
line-height: 0.9;
|
||||
|
||||
& + span {
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@include e(original) {
|
||||
opacity: 0;
|
||||
outline: none;
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
&.is-checked {
|
||||
& .#{$namespace}-checkbox-button__inner {
|
||||
color: var(--el-checkbox-button-checked-font-color);
|
||||
background-color: var(--el-checkbox-button-checked-background-color);
|
||||
border-color: var(--el-checkbox-button-checked-border-color);
|
||||
box-shadow: -1px 0 0 0 var(--el-color-primary-light-4);
|
||||
}
|
||||
&:first-child .#{$namespace}-checkbox-button__inner {
|
||||
border-left-color: var(--el-checkbox-button-checked-border-color);
|
||||
}
|
||||
}
|
||||
|
||||
&.is-disabled {
|
||||
& .#{$namespace}-checkbox-button__inner {
|
||||
color: var(
|
||||
--el-button-disabled-font-color,
|
||||
map.get($--button, 'disabled-font-color')
|
||||
);
|
||||
cursor: not-allowed;
|
||||
background-image: none;
|
||||
background-color: var(
|
||||
--el-button-disabled-background-color,
|
||||
map.get($--button, 'disabled-background-color')
|
||||
);
|
||||
border-color: var(
|
||||
--el-button-disabled-border-color,
|
||||
map.get($--button, 'disabled-border-color')
|
||||
);
|
||||
box-shadow: none;
|
||||
}
|
||||
&:first-child .#{$namespace}-checkbox-button__inner {
|
||||
border-left-color: var(
|
||||
--el-button-disabled-border-color,
|
||||
map.get($--button, 'disabled-border-color')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
.#{$namespace}-checkbox-button__inner {
|
||||
border-left: $--border-base;
|
||||
border-radius: var(--el-border-radius-base) 0 0
|
||||
var(--el-border-radius-base);
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.is-focus {
|
||||
& .#{$namespace}-checkbox-button__inner {
|
||||
border-color: var(--el-checkbox-button-checked-border-color);
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
.#{$namespace}-checkbox-button__inner {
|
||||
border-radius: 0 var(--el-border-radius-base) var(--el-border-radius-base)
|
||||
0;
|
||||
}
|
||||
}
|
||||
|
||||
@each $size in (medium, small, mini) {
|
||||
@include m($size) {
|
||||
.#{$namespace}-checkbox-button__inner {
|
||||
@include button-size(
|
||||
map.get($--button-padding-vertical, $size),
|
||||
map.get($--button-padding-horizontal, $size),
|
||||
map.get($--button-font-size, $size),
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@include b(checkbox-group) {
|
||||
font-size: 0;
|
||||
}
|
||||
|
@ -203,13 +203,20 @@ $--checkbox: map.merge(
|
||||
'checked-background-color': var(--el-color-primary),
|
||||
'checked-icon-color': var(--el-fill-base),
|
||||
'input-border-color-hover': var(--el-color-primary),
|
||||
'button-checked-background-color': var(--el-color-primary),
|
||||
'button-checked-font-color': var(--el-color-white),
|
||||
'button-checked-border-color': var(--el-color-primary),
|
||||
),
|
||||
$--checkbox
|
||||
);
|
||||
|
||||
$--checkbox-button: () !default;
|
||||
$--checkbox-button: map.merge(
|
||||
(
|
||||
'checked-background-color': var(--el-color-primary),
|
||||
'checked-font-color': var(--el-color-white),
|
||||
'checked-border-color': var(--el-color-primary),
|
||||
),
|
||||
$--checkbox-button
|
||||
);
|
||||
|
||||
/* Radio
|
||||
-------------------------- */
|
||||
/// fontSize||Font|1
|
||||
@ -458,10 +465,16 @@ $--input: map.merge(
|
||||
$--input
|
||||
);
|
||||
|
||||
$--input-disabled-fill: var(--el-disabled-fill-base) !default;
|
||||
$--input-disabled-border: var(--el-disabled-border-base) !default;
|
||||
$--input-disabled-color: var(--el-disabled-color-base) !default;
|
||||
$--input-disabled-placeholder-color: var(--el-text-color-placeholder) !default;
|
||||
$--input-disabled: () !default;
|
||||
$--input-disabled: map.merge(
|
||||
(
|
||||
'fill': var(--el-disabled-fill-base),
|
||||
'border': var(--el-disabled-border-base),
|
||||
'color': var(--el-disabled-color-base),
|
||||
'placeholder-color': var(--el-text-color-placeholder),
|
||||
),
|
||||
$--input-disabled
|
||||
);
|
||||
|
||||
$--input-font-size: () !default;
|
||||
$--input-font-size: map.merge(
|
||||
|
@ -148,27 +148,27 @@
|
||||
}
|
||||
|
||||
@include when(disabled) {
|
||||
background-color: $--input-disabled-fill;
|
||||
border-color: $--input-disabled-border;
|
||||
color: $--input-disabled-color;
|
||||
background-color: map.get($--input-disabled, 'fill');
|
||||
border-color: map.get($--input-disabled, 'border');
|
||||
color: map.get($--input-disabled, 'color');
|
||||
cursor: not-allowed;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
border-color: $--input-disabled-border;
|
||||
border-color: map.get($--input-disabled, 'border');
|
||||
}
|
||||
|
||||
input {
|
||||
background-color: $--input-disabled-fill;
|
||||
color: $--input-disabled-color;
|
||||
background-color: map.get($--input-disabled, 'fill');
|
||||
color: map.get($--input-disabled, 'color');
|
||||
cursor: not-allowed;
|
||||
&::placeholder {
|
||||
color: $--input-disabled-placeholder-color;
|
||||
color: map.get($--input-disabled, 'placeholder-color');
|
||||
}
|
||||
}
|
||||
|
||||
.#{$namespace}-range-separator {
|
||||
color: $--input-disabled-color;
|
||||
color: map.get($--input-disabled, 'color');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,9 @@
|
||||
|
||||
@include b(textarea) {
|
||||
@include set-component-css-var('input', $--input);
|
||||
}
|
||||
|
||||
@include b(textarea) {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
@ -21,30 +23,45 @@
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
font-size: inherit;
|
||||
color: var(--el-input-font-color);
|
||||
background-color: var(--el-input-background-color);
|
||||
color: var(--el-input-font-color, map.get($--input, 'font-color'));
|
||||
background-color: var(
|
||||
--el-input-background-color,
|
||||
map.get($--input, 'background-color')
|
||||
);
|
||||
background-image: none;
|
||||
border: var(--el-input-border);
|
||||
border-radius: var(--el-input-border-radius);
|
||||
border: var(--el-input-border, map.get($--input, 'border'));
|
||||
border-radius: var(
|
||||
--el-input-border-radius,
|
||||
map.get($--input, 'border-radius')
|
||||
);
|
||||
transition: var(--el-border-transition-base);
|
||||
|
||||
&::placeholder {
|
||||
color: var(--el-input-placeholder-color);
|
||||
color: var(
|
||||
--el-input-placeholder-color,
|
||||
map.get($--input, 'placeholder-color')
|
||||
);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: var(--el-input-hover-border);
|
||||
border-color: var(
|
||||
--el-input-hover-border,
|
||||
map.get($--input, 'hover-color')
|
||||
);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: var(--el-input-focus-border);
|
||||
border-color: var(
|
||||
--el-input-focus-border,
|
||||
map.get($--input, 'focus-color')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
& .#{$namespace}-input__count {
|
||||
color: var(--el-color-info);
|
||||
background: $--color-white;
|
||||
background: var(--el-color-white);
|
||||
position: absolute;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
@ -54,13 +71,13 @@
|
||||
|
||||
@include when(disabled) {
|
||||
.#{$namespace}-textarea__inner {
|
||||
background-color: $--input-disabled-fill;
|
||||
border-color: $--input-disabled-border;
|
||||
color: $--input-disabled-color;
|
||||
background-color: map.get($--input-disabled, 'fill');
|
||||
border-color: map.get($--input-disabled, 'border');
|
||||
color: map.get($--input-disabled, 'color');
|
||||
cursor: not-allowed;
|
||||
|
||||
&::placeholder {
|
||||
color: $--input-disabled-placeholder-color;
|
||||
color: map.get($--input-disabled, 'placeholder-color');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -114,12 +131,18 @@
|
||||
|
||||
@include e(inner) {
|
||||
-webkit-appearance: none;
|
||||
background-color: var(--el-input-background-color);
|
||||
background-color: var(
|
||||
--el-input-background-color,
|
||||
map.get($--input, 'background-color')
|
||||
);
|
||||
background-image: none;
|
||||
border-radius: var(--el-input-border-radius);
|
||||
border: var(--el-input-border);
|
||||
border-radius: var(
|
||||
--el-input-border-radius,
|
||||
map.get($--input, 'border-radius')
|
||||
);
|
||||
border: var(--el-input-border, map.get($--input, 'border'));
|
||||
box-sizing: border-box;
|
||||
color: var(--el-input-font-color);
|
||||
color: var(--el-input-font-color, map.get($--input, 'font-color'));
|
||||
display: inline-block;
|
||||
font-size: inherit;
|
||||
height: map.get($--input-height, 'default');
|
||||
@ -130,16 +153,25 @@
|
||||
width: 100%;
|
||||
|
||||
&::placeholder {
|
||||
color: var(--el-input-placeholder-color);
|
||||
color: var(
|
||||
--el-input-placeholder-color,
|
||||
map.get($--input, 'placeholder-color')
|
||||
);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: var(--el-input-hover-border);
|
||||
border-color: var(
|
||||
--el-input-hover-border,
|
||||
map.get($--input, 'hover-border')
|
||||
);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: var(--el-input-focus-border);
|
||||
border-color: var(
|
||||
--el-input-focus-border,
|
||||
map.get($--input, 'focus-border')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +181,7 @@
|
||||
right: 5px;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
color: var(--el-input-icon-color);
|
||||
color: var(--el-input-icon-color, map.get($--input, 'icon-color'));
|
||||
transition: all var(--el-transition-duration);
|
||||
pointer-events: none;
|
||||
}
|
||||
@ -164,7 +196,7 @@
|
||||
left: 5px;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
color: var(--el-input-icon-color);
|
||||
color: var(--el-input-icon-color, map.get($--input, 'icon-color'));
|
||||
transition: all var(--el-transition-duration);
|
||||
}
|
||||
|
||||
@ -190,19 +222,22 @@
|
||||
@include when(active) {
|
||||
.#{$namespace}-input__inner {
|
||||
outline: none;
|
||||
border-color: var(--el-input-focus-border);
|
||||
border-color: var(
|
||||
--el-input-focus-border,
|
||||
map.get($--input, 'focus-color')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@include when(disabled) {
|
||||
.#{$namespace}-input__inner {
|
||||
background-color: $--input-disabled-fill;
|
||||
border-color: $--input-disabled-border;
|
||||
color: $--input-disabled-color;
|
||||
background-color: map.get($--input-disabled, 'fill');
|
||||
border-color: map.get($--input-disabled, 'border');
|
||||
color: map.get($--input-disabled, 'color');
|
||||
cursor: not-allowed;
|
||||
|
||||
&::placeholder {
|
||||
color: $--input-disabled-placeholder-color;
|
||||
color: map.get($--input-disabled, 'placeholder-color');
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,7 +306,7 @@
|
||||
}
|
||||
|
||||
@include e((append, prepend)) {
|
||||
background-color: $--background-color-base;
|
||||
background-color: var(--el-background-color-base);
|
||||
color: var(--el-color-info);
|
||||
vertical-align: middle;
|
||||
display: table-cell;
|
||||
|
@ -4,6 +4,10 @@
|
||||
@import 'mixins/_button';
|
||||
@import 'common/var';
|
||||
|
||||
@include b(radio-button) {
|
||||
@include set-component-css-var('radio-button', $--radio-button);
|
||||
}
|
||||
|
||||
@include b(radio-button) {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
@ -74,10 +78,23 @@
|
||||
|
||||
&:checked {
|
||||
& + .#{$namespace}-radio-button__inner {
|
||||
color: var(--el-radio-button-checked-font-color);
|
||||
background-color: var(--el-radio-button-checked-background-color);
|
||||
border-color: var(--el-radio-button-checked-border-color);
|
||||
box-shadow: -1px 0 0 0 var(--el-radio-button-checked-border-color);
|
||||
color: var(
|
||||
--el-radio-button-checked-font-color,
|
||||
map.get($--radio-button, 'checked-font-color')
|
||||
);
|
||||
background-color: var(
|
||||
--el-radio-button-checked-background-color,
|
||||
map.get($--radio-button, 'checked-background-color')
|
||||
);
|
||||
border-color: var(
|
||||
--el-radio-button-checked-border-color,
|
||||
map.get($--radio-button, 'checked-border-color')
|
||||
);
|
||||
box-shadow: -1px 0 0 0
|
||||
var(
|
||||
--el-radio-button-checked-border-color,
|
||||
map.get($--radio-button, 'checked-border-color')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
@include b(radio) {
|
||||
@include set-component-css-var('radio', $--radio);
|
||||
@include set-component-css-var('radio-button', $--radio-button);
|
||||
}
|
||||
|
||||
@include b(radio) {
|
||||
|
Loading…
Reference in New Issue
Block a user