ant-design/style/mixins/input.less

198 lines
3.8 KiB
Plaintext
Raw Normal View History

2015-07-07 11:32:08 +08:00
// size mixins for input
2015-06-15 11:43:18 +08:00
.input-lg() {
padding: @input-padding-lg;
2015-07-07 11:32:08 +08:00
height: @input-height-lg;
2015-06-15 11:43:18 +08:00
font-size: @input-font-size-lg;
}
.input-sm() {
padding: @input-padding-vertical-sm @input-padding-horizontal;
2015-07-07 11:32:08 +08:00
height: @input-height-sm;
2015-06-15 11:43:18 +08:00
font-size: @input-font-size-sm;
}
2015-06-11 09:57:37 +08:00
// Basic style for input
2015-06-09 19:45:18 +08:00
.input() {
position: relative;
2015-07-07 16:18:14 +08:00
display: inline-block;
2015-06-09 19:45:18 +08:00
padding: @input-padding-vertical-base @input-padding-horizontal;
width: 100%;
2015-07-07 11:32:08 +08:00
height: @input-height-base;
2015-07-08 20:12:49 +08:00
cursor: text;
2015-06-09 19:45:18 +08:00
font-size: @input-font-size;
line-height: @line-height-base;
color: @input-color;
background-color: @input-bg;
background-image: none;
border: 1px solid @input-border-color;
2015-07-07 11:32:08 +08:00
border-radius: @border-radius-base;
.placeholder(); // Reset placeholder
2015-07-07 11:43:07 +08:00
.transition(~"border .3s @{ease-in-out}, background .3s @{ease-in-out}, box-shadow .3s @{ease-in-out}");
2015-06-09 19:45:18 +08:00
2015-06-15 20:24:01 +08:00
&:hover {
2015-06-09 19:45:18 +08:00
border-color: @input-hover-border-color;
}
&:focus {
border-color: @input-focus-border-color;
outline: 0;
2015-07-07 11:32:08 +08:00
box-shadow: 0 0 3px tint(@input-focus-border-color, 20%);
2015-06-09 19:45:18 +08:00
}
&[disabled],
fieldset[disabled] & {
background-color: @input-disabled-bg;
2015-07-07 16:18:14 +08:00
opacity: 1;
2015-06-15 20:24:01 +08:00
&:hover {
border-color: @input-border-color;
}
2015-06-09 19:45:18 +08:00
}
&[disabled],
fieldset[disabled] & {
cursor: @cursor-disabled;
}
// Reset height for `textarea`s
textarea& {
height: auto;
}
// Size
&-lg {
2015-06-15 11:43:18 +08:00
.input-lg();
2015-06-09 19:45:18 +08:00
}
&-sm {
2015-06-15 11:43:18 +08:00
.input-sm();
}
}
// Input with icons, you can define @height if you wish to change the input size
.input-with-icon(@height: @input-height-base) {
position: relative;
.@{iconfont-css-prefix} {
position: absolute;
bottom: 0;
right: 0;
z-index: 2;
.square(@height);
font-size: 14px;
line-height: @height;
text-align: center;
pointer-events: none;
}
}
2015-07-08 20:12:49 +08:00
// label input
.input-group(@inputClass; @btnclass) {
2015-06-15 11:43:18 +08:00
position: relative;
display: table;
border-collapse: separate;
// Undo padding and float of grid classes
&[class*="col-"] {
float: none;
padding-left: 0;
padding-right: 0;
}
2015-07-09 13:48:24 +08:00
> [class*="col-"] {
padding-right: 8px;
}
&-addon,
&-btn,
> .@{inputClass} {
2015-06-15 11:43:18 +08:00
display: table-cell;
&:not(:first-child):not(:last-child) {
border-radius: 0;
}
2015-06-09 19:45:18 +08:00
}
2015-06-15 11:43:18 +08:00
2015-07-09 13:48:24 +08:00
&-addon,
&-btn {
2015-06-15 11:43:18 +08:00
width: 1%;
white-space: nowrap;
vertical-align: middle;
}
.@{inputClass} {
position: relative;
z-index: 2;
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: 1px solid @input-border-color;
2015-07-07 11:32:08 +08:00
border-radius: @border-radius-base;
2015-06-15 11:43:18 +08:00
}
2015-07-08 20:12:49 +08:00
.@{btnclass} {
border-radius: @border-radius-base;
2015-06-15 11:43:18 +08:00
.button-variant(@input-color; #eee; @input-border-color);
2015-07-08 20:12:49 +08:00
margin-left: -1px;
2015-06-15 11:43:18 +08:00
2015-07-07 11:32:08 +08:00
&:hover {
2015-07-08 20:12:49 +08:00
.button-color(@input-color; tint(#eee, 20%); @input-border-color);
2015-07-07 11:32:08 +08:00
}
2015-07-08 20:12:49 +08:00
&:active, &.active {
.button-color(@input-color; shade(#eee, 5%); @input-border-color);
2015-07-07 11:32:08 +08:00
}
2015-06-15 11:43:18 +08:00
.@{iconfont-css-prefix} {
2015-06-15 20:24:01 +08:00
line-height: 1;
2015-06-15 11:43:18 +08:00
margin-left: 8px;
}
}
// Reset rounded corners
2015-07-09 13:48:24 +08:00
> .@{inputClass}:first-child,
&-addon:first-child {
2015-06-15 11:43:18 +08:00
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
2015-07-07 16:18:14 +08:00
2015-06-15 11:43:18 +08:00
&-addon:first-child {
border-right: 0;
}
2015-07-08 20:12:49 +08:00
&-addon:last-child {
border-left: 0;
}
2015-07-07 16:18:14 +08:00
2015-07-09 13:48:24 +08:00
> .@{inputClass}:last-child,
2015-06-15 11:43:18 +08:00
&-addon:last-child,
2015-07-08 20:12:49 +08:00
&-btn .@{btnclass}{
2015-06-15 11:43:18 +08:00
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
2015-07-07 16:18:14 +08:00
2015-06-15 11:43:18 +08:00
// Sizing options
2015-07-09 13:48:24 +08:00
&-lg .@{inputClass},
2015-06-15 11:43:18 +08:00
&-lg > &-addon,
2015-07-08 20:12:49 +08:00
&-lg > &-btn .@{btnclass} {
2015-06-15 11:43:18 +08:00
.input-lg();
}
2015-07-09 13:48:24 +08:00
&-sm .@{inputClass},
2015-06-15 11:43:18 +08:00
&-sm > &-addon,
2015-07-08 20:12:49 +08:00
&-sm > &-btn .@{btnclass} {
2015-06-15 11:43:18 +08:00
.input-sm();
}
2015-07-08 20:12:49 +08:00
&-sm > &-btn .@{btnclass} {
2015-07-07 11:32:08 +08:00
margin-top: ~"-2px \9";
}
2015-06-12 18:37:03 +08:00
}