ant-design/style/mixins/input.less

258 lines
5.3 KiB
Plaintext
Raw Normal View History

2015-07-07 11:32:08 +08:00
// 待删除
2015-06-10 19:46:41 +08:00
.ant-input(){
2015-06-09 15:21:44 +08:00
position: relative;
display: inline-block;
margin: 0 0;
padding: 4px 10px;
border-radius: 6px 6px;
border: 1px solid #d9d9d9;
background-color: #ffffff;
color: #666;
line-height: 1.5;
-webkit-transform: border 0.3s cubic-bezier(0.35, 0, 0.25, 1), background 0.3s cubic-bezier(0.35, 0, 0.25, 1), box-shadow 0.3s cubic-bezier(0.35, 0, 0.25, 1);
transform: border 0.3s cubic-bezier(0.35, 0, 0.25, 1), background 0.3s cubic-bezier(0.35, 0, 0.25, 1), box-shadow 0.3s cubic-bezier(0.35, 0, 0.25, 1);
2015-06-12 18:37:03 +08:00
.transition(all .3s @ease-in-out);
2015-06-09 15:21:44 +08:00
&:hover {
border-color: #23c0fa;
}
&:focus {
border-color: #23c0fa;
box-shadow: 0 0 3px #23c0fa;
}
2015-06-10 19:46:41 +08:00
}
2015-06-09 19:45:18 +08:00
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;
display: block;
padding: @input-padding-vertical-base @input-padding-horizontal;
2015-07-07 11:32:08 +08:00
margin-right: 8px;
2015-06-09 19:45:18 +08:00
width: 100%;
2015-07-07 11:32:08 +08:00
height: @input-height-base;
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],
&[readonly],
fieldset[disabled] & {
background-color: @input-disabled-bg;
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;
}
}
// Input-group
.input-group(@inputClass) {
// define the button style for input-group
@inputBtn: input-btn;
position: relative;
display: table;
border-collapse: separate;
// Undo padding and float of grid classes
&[class*="col-"] {
float: none;
padding-left: 0;
padding-right: 0;
}
&-addon,
&-btn,
&-btn-vertical,
.@{inputClass} {
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
&-addon,
&-btn,
&-btn-vertical {
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
input[type="radio"],
input[type="checkbox"] {
margin-top: 0;
}
}
.@{inputBtn} {
.btn();
2015-07-07 11:32:08 +08:00
.button-size(@input-padding-vertical-base @input-padding-horizontal; @font-size-base; @border-radius-base);
2015-06-15 11:43:18 +08:00
.button-variant(@input-color; #eee; @input-border-color);
2015-07-07 11:32:08 +08:00
&:hover {
.button-color(lighten(@input-color, 30%, 'relative'); #eee; @input-border-color);
}
&:active,
&.active {
.button-color(lighten(@input-color, 20%, 'relative'); #eee; @input-border-color);
}
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;
}
}
&-btn {
position: relative;
> .@{inputBtn} {
position: relative;
+ .@{inputBtn} {
margin-left: -1px;
}
}
// Negative margin to only have a 1px border between the two
&:first-child {
> .@{inputBtn} {
margin-right: -1px;
}
}
&:last-child {
> .@{inputBtn} {
margin-left: -1px;
}
}
}
// Reset rounded corners
.@{inputClass}:first-child,
&-addon:first-child,
&-btn:first-child > .@{inputBtn},
&-btn:last-child > .@{inputBtn}:not(:last-child):not(.dropdown-toggle) {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
&-addon:first-child {
border-right: 0;
}
.@{inputClass}:last-child,
&-addon:last-child,
&-btn:last-child > .@{inputBtn},
&-btn:first-child > .@{inputBtn}:not(:first-child) {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
&-addon:last-child {
border-left: 0;
}
// Sizing options
&-lg > .@{inputClass},
&-lg > &-addon,
&-lg > &-btn > .@{inputBtn} {
.input-lg();
}
&-sm > .@{inputClass},
&-sm > &-addon,
&-sm > &-btn > .@{inputBtn} {
.input-sm();
}
2015-07-07 11:32:08 +08:00
&-sm > &-btn > .@{inputBtn} {
margin-top: ~"-2px \9";
}
2015-06-12 18:37:03 +08:00
}