ant-design/style/components/form.less

259 lines
5.3 KiB
Plaintext
Raw Normal View History

2015-06-15 11:43:18 +08:00
@import "../mixins/index";
2015-07-08 20:12:49 +08:00
@btnClass: ~"@{css-prefix}btn";
2015-06-15 11:43:18 +08:00
.reset-form();
2015-07-07 11:32:08 +08:00
label {
position: relative;
&[required]:before {
position: absolute;
display: inline-block;
left: ~"-5px \9"; // ie8-9
content: "*";
color: @label-required-color;
font-family: SimSun;
2015-07-08 12:02:57 +08:00
font-size: @font-size-base;
2015-07-07 11:32:08 +08:00
.translate3d(-10px; 0; 0);
}
> .@{iconfont-css-prefix} {
vertical-align: top;
2015-07-08 12:02:57 +08:00
font-size: @font-size-base;
2015-07-07 11:32:08 +08:00
}
2015-06-15 11:43:18 +08:00
}
2015-07-07 11:32:08 +08:00
// Form items
// You should wrap labels and controls in .@{css-prefix}form-item for optimum spacing
2015-06-15 11:43:18 +08:00
.@{css-prefix}form-item {
2015-07-07 11:32:08 +08:00
margin-bottom: @form-item-margin-bottom;
label {
color: @label-color;
text-align: right;
padding-right: 8px;
}
2015-06-15 11:43:18 +08:00
}
// Input styles
.@{css-prefix}input {
.input;
}
//== Input type: with extra icon
.has-feedback {
.input-with-icon();
}
2015-07-09 10:55:06 +08:00
//== Style for input-group: input with label, with button or dropdown...
2015-06-15 11:43:18 +08:00
.@{css-prefix}input-group {
2015-07-08 20:12:49 +08:00
.input-group(~"@{css-prefix}input"; @btnClass)
2015-06-15 11:43:18 +08:00
}
2015-07-07 11:32:08 +08:00
// 表单下的输入框尺寸唯一: 大尺寸
form {
.has-feedback {
.@{iconfont-css-prefix} {
.square(@input-height-lg);
line-height: @input-height-lg;
}
}
2015-07-08 20:12:49 +08:00
.@{css-prefix}input,
.@{css-prefix}input-group .@{css-prefix}input,
.@{css-prefix}input-group .@{css-prefix}input-group-addon,
.@{css-prefix}input-group .@{css-prefix}input-group-btn .@{btnClass} {
height: @input-height-lg;
font-size: @font-size-base;
padding: @input-padding-horizontal;
2015-07-07 11:32:08 +08:00
}
// input[type=file]
.@{css-prefix}upload {
2015-07-08 12:02:57 +08:00
padding-top: 7px;
padding-bottom: 7px;
max-height: 32px;
font-size: @font-size-base;
2015-07-08 13:17:14 +08:00
background: transparent;
2015-07-07 11:32:08 +08:00
}
}
2015-06-15 20:24:01 +08:00
// Radio & Checkbox
.@{css-prefix}radio,
.@{css-prefix}checkbox {
position: relative;
display: block;
margin-top: 10px;
margin-bottom: 10px;
2015-07-07 11:32:08 +08:00
height: @input-height-lg;
2015-06-15 20:24:01 +08:00
label {
min-height: @line-height-computed;
2015-07-07 11:32:08 +08:00
padding: 7px 0 7px 20px;
2015-06-15 20:24:01 +08:00
margin-bottom: 0;
font-weight: normal;
cursor: pointer;
}
}
.@{css-prefix}radio input[type="radio"],
.@{css-prefix}radio-inline input[type="radio"],
.@{css-prefix}checkbox input[type="checkbox"],
.@{css-prefix}checkbox-inline input[type="checkbox"] {
position: absolute;
margin-left: -20px;
margin-top: 4px \9;
}
.@{css-prefix}radio + .@{css-prefix}radio,
.@{css-prefix}checkbox + .@{css-prefix}checkbox {
2015-07-07 11:32:08 +08:00
margin-top: -5px;
2015-06-15 20:24:01 +08:00
}
// Radios and checkboxes on same line
.@{css-prefix}radio-inline,
.@{css-prefix}checkbox-inline {
position: relative;
display: inline-block;
2015-07-07 11:32:08 +08:00
padding: 7px 20px;
padding-right: 0!important;
2015-06-15 20:24:01 +08:00
margin-bottom: 0;
2015-07-07 11:32:08 +08:00
margin-right: 10px;
2015-06-15 20:24:01 +08:00
vertical-align: middle;
font-weight: normal;
cursor: pointer;
}
input[type="radio"],
input[type="checkbox"] {
&[disabled],
&.disabled,
fieldset[disabled] & {
cursor: @cursor-disabled;
}
}
// These classes are used directly on <label>s
.@{css-prefix}radio-inline,
.@{css-prefix}checkbox-inline {
&.disabled,
fieldset[disabled] & {
cursor: @cursor-disabled;
}
}
// These classes are used on elements with <label> descendants
.@{css-prefix}radio,
.@{css-prefix}checkbox {
&.disabled,
fieldset[disabled] & {
label {
cursor: @cursor-disabled;
}
}
}
2015-06-15 11:43:18 +08:00
// Form layout
//== Horizontal Form
.@{css-prefix}form-horizontal {
.@{css-prefix}form-item {
.make-row;
}
2015-06-15 20:24:01 +08:00
.@{css-prefix}radio,
.@{css-prefix}checkbox,
.@{css-prefix}radio-inline,
.@{css-prefix}checkbox-inline {
margin-top: 0;
margin-bottom: 0;
}
2015-07-07 11:32:08 +08:00
2015-06-15 20:24:01 +08:00
.@{css-prefix}radio,
.@{css-prefix}checkbox {
min-height: (@line-height-computed + (@input-padding-vertical-base + 1));
}
2015-06-15 11:43:18 +08:00
}
//== Inline Form
// Attention: Inline form does only apply to within viewports that are at least 768px wide
2015-07-09 13:48:24 +08:00
// TODO: 优化
2015-06-15 11:43:18 +08:00
.@{css-prefix}form-inline {
@media (min-width: @screen-sm-min) {
.@{css-prefix}form-item {
2015-07-09 13:48:24 +08:00
display: inline-block;
2015-06-15 11:43:18 +08:00
margin-bottom: 0;
vertical-align: middle;
2015-07-07 11:32:08 +08:00
margin-right: 10px;
label {
padding-right: 0;
}
2015-06-15 11:43:18 +08:00
}
.@{css-prefix}input {
display: inline-block;
2015-07-07 11:32:08 +08:00
width: auto;
2015-06-15 11:43:18 +08:00
vertical-align: middle;
}
2015-06-15 20:24:01 +08:00
.@{css-prefix}form-text {
display: inline-block;
}
2015-06-15 11:43:18 +08:00
.has-feedback {
display: inline-block;
}
2015-06-15 20:24:01 +08:00
.@{css-prefix}radio,
.@{css-prefix}checkbox {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
label {
padding-left: 0;
}
}
.@{css-prefix}radio input[type="radio"],
.@{css-prefix}checkbox input[type="checkbox"] {
position: relative;
margin-left: 0;
}
2015-07-07 11:32:08 +08:00
}
}
2015-06-15 20:24:01 +08:00
2015-07-07 11:32:08 +08:00
.@{css-prefix}form-horizontal, .@{css-prefix}form-inline {
label {
padding-top: 7px;
padding-bottom: 7px;
2015-06-15 20:24:01 +08:00
}
}
2015-07-07 11:32:08 +08:00
.@{css-prefix}form-text, .@{css-prefix}form-split {
2015-06-15 20:24:01 +08:00
// min-height: (@line-height-computed + @font-size-base);
margin: 0!important;
2015-07-07 11:32:08 +08:00
padding-top: 7px;
padding-bottom: 7px;
2015-07-08 12:02:57 +08:00
font-size: @font-size-base;
2015-07-07 11:32:08 +08:00
height: @input-height-lg;
}
2015-06-15 20:24:01 +08:00
2015-07-07 11:32:08 +08:00
.@{css-prefix}form-split {
text-align: center;
2015-06-15 11:43:18 +08:00
}
// Validation state
.has-success {
2015-07-07 11:32:08 +08:00
.form-control-validation(@success-color; @input-hover-border-color;);
.@{css-prefix}input {
border-color: @input-border-color;
}
2015-06-15 11:43:18 +08:00
}
.has-warning {
.form-control-validation(@warning-color; @warning-color;);
}
.has-error {
.form-control-validation(@error-color; @error-color;);
}
.@{css-prefix}form-explain {
display: block;
2015-07-08 12:02:57 +08:00
font-size: @font-size-base;
2015-06-15 11:43:18 +08:00
}
2015-07-07 11:32:08 +08:00