You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

314 lines
6.5 KiB

@import "../../style/themes/default";
@import "../../style/mixins/index";
@input-presuffix-width: 17;
// size mixins for input
10 years ago
.input-lg() {
padding: @input-padding-vertical-lg @input-padding-horizontal;
height: @input-height-lg;
10 years ago
}
.input-sm() {
padding: @input-padding-vertical-sm @input-padding-horizontal;
height: @input-height-sm;
10 years ago
}
// input status
// == when focus or actived
.active(@color: @outline-color) {
border-color: ~`colorPalette("@{color}", 5)`;
outline: 0;
box-shadow: 0 0 @outline-blur-size @outline-width fade(@color, 20%);
}
// == when hoverd
.hover(@color: @input-hover-border-color) {
border-color: ~`colorPalette("@{color}", 5)`;
}
.disabled() {
background-color: @input-disabled-bg;
opacity: 1;
cursor: not-allowed;
color: @disabled-color;
&:hover {
.hover(@input-border-color);
}
}
// Basic style for input
.input() {
position: relative;
display: inline-block;
padding: @input-padding-vertical-base @input-padding-horizontal;
width: 100%;
height: @input-height-base;
cursor: text;
font-size: @font-size-base;
line-height: @line-height-base;
color: @input-color;
background-color: @input-bg;
background-image: none;
border: @border-width-base @border-style-base @input-border-color;
border-radius: @border-radius-base;
.placeholder(); // Reset placeholder
transition: all .3s;
10 years ago
&:hover {
.hover();
}
&:focus {
.active();
}
&[disabled] {
.disabled();
}
// Reset height for `textarea`s
textarea& {
max-width: 100%; // prevent textearea resize from coming out of its container
height: auto;
vertical-align: bottom;
}
// Size
&-lg {
10 years ago
.input-lg();
}
&-sm {
10 years ago
.input-sm();
}
}
// label input
.input-group(@inputClass) {
10 years ago
position: relative;
display: table;
border-collapse: separate;
border-spacing: 0;
width: 100%;
10 years ago
// Undo padding and float of grid classes
&[class*="col-"] {
float: none;
padding-left: 0;
padding-right: 0;
}
> [class*="col-"] {
padding-right: 8px;
}
&-addon,
&-wrap,
> .@{inputClass} {
10 years ago
display: table-cell;
&:not(:first-child):not(:last-child) {
border-radius: 0;
}
}
10 years ago
&-addon,
&-wrap {
width: 1px; // To make addon/wrap as small as possible
10 years ago
white-space: nowrap;
vertical-align: middle;
}
&-wrap > * {
display: block !important;
}
10 years ago
.@{inputClass} {
float: left;
width: 100%;
margin-bottom: 0;
}
&-addon {
padding: @input-padding-vertical-base @input-padding-horizontal;
font-size: @font-size-base;
font-weight: normal;
line-height: 1;
color: @input-color;
text-align: center;
background-color: #eee;
border: @border-width-base @border-style-base @input-border-color;
border-radius: @border-radius-base;
position: relative;
transition: all .3s;
// Reset Select's style in addon
.@{ant-prefix}-select {
8 years ago
margin: -(@input-padding-vertical-base + 1) (-@input-padding-horizontal); // lesshint spaceAroundOperator: false
.@{ant-prefix}-select-selection {
background-color: inherit;
margin: -1px;
border: @border-width-base @border-style-base transparent;
box-shadow: none;
}
&-open,
&-focused {
.@{ant-prefix}-select-selection {
color: @primary-color;
}
}
}
// Expand addon icon click area
// https://github.com/ant-design/ant-design/issues/3714
> i:only-child:after {
position: absolute;
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
}
10 years ago
}
// Reset rounded corners
> span > .@{inputClass}:first-child,
> .@{inputClass}:first-child,
&-addon:first-child {
10 years ago
border-bottom-right-radius: 0;
border-top-right-radius: 0;
// Reset Select's style in addon
.@{ant-prefix}-select .@{ant-prefix}-select-selection {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
10 years ago
}
> .@{inputClass}-preSuffix-wrapper {
&:not(:first-child) .@{inputClass} {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
&:not(:last-child) .@{inputClass} {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
}
10 years ago
&-addon:first-child {
border-right: 0;
}
&-addon:last-child {
border-left: 0;
}
> .@{inputClass}:last-child,
&-addon:last-child {
10 years ago
border-bottom-left-radius: 0;
border-top-left-radius: 0;
// Reset Select's style in addon
.@{ant-prefix}-select .@{ant-prefix}-select-selection {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
10 years ago
}
10 years ago
// Sizing options
&-lg .@{inputClass},
&-lg > &-addon {
10 years ago
.input-lg();
}
&-sm .@{inputClass},
&-sm > &-addon {
10 years ago
.input-sm();
}
.@{inputClass}-preSuffix-wrapper {
display: table-cell;
width: 100%;
float: left;
}
&&-compact {
& > * {
border-radius: 0;
border-right-width: 0;
vertical-align: middle;
}
// Undo float for .ant-input-group .ant-input
.@{inputClass} {
float: none;
z-index: auto;
}
// reset border for Select, datePicker
& > .@{ant-prefix}-select > .@{ant-prefix}-select-selection,
& > .@{ant-prefix}-calendar-picker .@{ant-prefix}-input {
border-radius: 0;
border-right-width: 0;
}
& > *:first-child,
& > .@{ant-prefix}-select:first-child > .@{ant-prefix}-select-selection,
& > .@{ant-prefix}-calendar-picker:first-child .@{ant-prefix}-input {
border-top-left-radius: @border-radius-base;
border-bottom-left-radius: @border-radius-base;
}
& > *:last-child,
& > .@{ant-prefix}-select:last-child > .@{ant-prefix}-select-selection,
& > .@{ant-prefix}-calendar-picker:last-child .@{ant-prefix}-input {
border-top-right-radius: @border-radius-base;
border-bottom-right-radius: @border-radius-base;
border-right-width: 1px;
}
}
}
.input-preSuffix-wrapper(@inputClass) {
position: relative;
display: inline-block;
width: 100%;
.@{inputClass} {
z-index: 1;
}
&:hover .@{inputClass} {
.hover();
}
.@{inputClass}-prefix,
.@{inputClass}-suffix {
position: absolute;
top: 50%;
transform: translateY(-50%);
z-index: 2;
line-height: 0;
}
.@{inputClass}-prefix {
left: @input-padding-horizontal;
}
.@{inputClass}-suffix {
right: @input-padding-horizontal;
}
.@{inputClass}:not(:first-child) {
padding-left: @input-padding-horizontal + @input-presuffix-width;
}
.@{inputClass}:not(:last-child) {
padding-right: @input-padding-horizontal + @input-presuffix-width;
}
}