ant-design/components/input/style/mixin.less
afc163 0ca6a1c24a css modularize (#1448)
* css modularize

* Add alert style

* Move more component style

* Move iconfont to common style

* Move layout style

* Move more component style

* Move all components

* Fix lots of mixin deps

* remove css-prefix from less

* fix a button icon style bug

* restructure

* fix index

* add dist

* fix jest

* fix some components style

* clean webpack config

* check more components style

* update tabs

* update scripts

* update scripts

* fix form style

* fix more style

* Fix select width

* Fix form and tabs style
2016-04-27 20:44:36 +08:00

195 lines
3.6 KiB
Plaintext

@import "../../style/mixins/index";
@import "../../style/mixins/index";
// size mixins for input
.input-lg() {
padding: @input-padding-vertical-lg @input-padding-horizontal;
height: @input-height-lg;
}
.input-sm() {
padding: @input-padding-vertical-sm @input-padding-horizontal;
height: @input-height-sm;
border-radius: @border-radius-sm;
}
// input status
// == when focus or actived
.active(@color: @input-hover-border-color) {
border-color: tint(@color, 20%);
outline: 0;
box-shadow: 0 0 0 2px fade(@color, 20%);
}
// == when hoverd
.hover(@color: @input-hover-border-color) {
border-color: tint(@color, 20%);
}
.disabled() {
background-color: @input-disabled-bg;
opacity: 1;
cursor: @cursor-disabled;
color: #ccc;
&:hover {
.hover(@input-border-color);
}
}
// Basic style for input
.input() {
position: relative;
display: inline-block;
vertical-align: middle;
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: 1px solid @input-border-color;
border-radius: @border-radius-base;
.placeholder(); // Reset placeholder
transition: border .2s @ease-in-out, background .2s @ease-in-out, box-shadow .2s @ease-in-out;
&:hover {
.hover();
}
&:focus {
.active();
}
&[disabled],
fieldset[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 {
.input-lg();
}
&-sm {
.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;
}
}
// label input
.input-group(@inputClass) {
position: relative;
display: table;
border-collapse: separate;
// 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} {
display: table-cell;
&:not(:first-child):not(:last-child) {
border-radius: 0;
}
}
&-addon,
&-wrap {
width: 1%;
white-space: nowrap;
vertical-align: middle;
}
&-wrap > * {
display: block;
}
.@{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;
border-radius: @border-radius-base;
}
// Reset rounded corners
> span > .@{inputClass}:first-child,
> .@{inputClass}:first-child,
&-addon:first-child {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
&-addon:first-child {
border-right: 0;
}
&-addon:last-child {
border-left: 0;
}
> .@{inputClass}:last-child,
&-addon:last-child {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
// Sizing options
&-lg .@{inputClass},
&-lg > &-addon {
.input-lg();
}
&-sm .@{inputClass},
&-sm > &-addon {
.input-sm();
}
}