ant-design/style/components/form.less

275 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-17 15:05:12 +08:00
// Input styles
.@{css-prefix}input {
.input;
}
//== Input type: with extra icon
.has-feedback {
.input-with-icon();
}
//== Style for input-group: input with label, with button or dropdown...
.@{css-prefix}input-group {
2015-07-21 14:54:49 +08:00
.input-group(~"@{css-prefix}input");
2015-07-17 15:05:12 +08:00
}
// Radio && Checkbox
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}radio-vertical,
.@{css-prefix}checkbox-inline,
.@{css-prefix}checkbox-vertical {
&.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-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;
2015-07-22 17:17:47 +08:00
color: #666;
2015-07-07 11:32:08 +08:00
2015-07-16 14:18:03 +08:00
> label {
2015-07-07 11:32:08 +08:00
color: @label-color;
text-align: right;
2015-07-17 15:43:31 +08:00
vertical-align: middle;
2015-07-22 17:17:47 +08:00
&:lang(en) {
padding-right: 8px;
2015-07-24 16:08:44 +08:00
}
2015-07-07 11:32:08 +08:00
}
2015-07-16 22:57:47 +08:00
.@{css-prefix}switch {
margin: 4px 0;
}
2015-06-15 11:43:18 +08:00
}
2015-07-17 15:05:12 +08:00
.@{css-prefix}form-text, .@{css-prefix}form-split {
margin: 0!important;
padding-top: 7px;
padding-bottom: 7px;
2015-06-15 11:43:18 +08:00
}
2015-07-20 19:25:34 +08:00
.@{css-prefix}form-text {
display: inline-block;
padding-right: 8px;
2015-07-20 19:25:34 +08:00
}
2015-07-17 15:05:12 +08:00
.@{css-prefix}form-split {
2015-07-20 19:25:34 +08:00
display: block;
2015-07-17 15:05:12 +08:00
text-align: center;
2015-06-15 11:43:18 +08:00
}
2015-07-17 15:05:12 +08:00
.@{css-prefix}form-explain {
position: absolute;
font-size: @font-size-base;
line-height: @line-height-base;
bottom: - @line-height-computed;
2015-06-15 11:43:18 +08:00
}
2015-07-17 15:05:12 +08:00
2015-07-07 11:32:08 +08:00
// 表单下的输入框尺寸唯一: 大尺寸
form {
2015-07-17 15:05:12 +08:00
* {
font-size: @font-size-base;
line-height: @line-height-base;
}
2015-07-07 11:32:08 +08:00
.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,
2015-07-21 14:54:49 +08:00
.@{css-prefix}input-group .@{css-prefix}input-group-addon {
height: @input-height-lg;
font-size: @font-size-base;
2015-07-21 14:54:49 +08:00
padding: 6px 7px;
}
// Input combined with select
.@{css-prefix}input-group {
.@{selectPrefixCls}-selection {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
&:hover {
border-color: #d9d9d9;
}
}
.@{selectPrefixCls}-selection--single {
margin-left: -1px;
height: @input-height-lg;
background-color: #eee;
.@{selectPrefixCls}-selection__rendered {
padding-left: 8px;
padding-right: 25px;
line-height: 32px;
}
}
.@{selectPrefixCls}-open .@{selectPrefixCls}-selection {
border-color: #d9d9d9;
box-shadow: none;
}
2015-07-07 11:32:08 +08:00
}
2015-07-15 17:22:58 +08:00
2015-07-07 11:32:08 +08:00
// input[type=file]
.@{css-prefix}upload {
2015-07-08 13:17:14 +08:00
background: transparent;
2015-07-07 11:32:08 +08:00
}
2015-07-15 17:22:58 +08:00
2015-07-17 15:05:12 +08:00
input[type="radio"],
input[type="checkbox"] {
width: 14px;
height: 14px;
}
2015-07-15 17:22:58 +08:00
// Radios and checkboxes on same line
.@{css-prefix}radio-inline,
.@{css-prefix}checkbox-inline {
display: inline-block;
2015-07-16 14:18:03 +08:00
margin-right: 16px;
2015-07-15 17:22:58 +08:00
vertical-align: middle;
2015-06-15 20:24:01 +08:00
font-weight: normal;
cursor: pointer;
}
2015-07-17 15:05:12 +08:00
.@{css-prefix}checkbox-vertical,
.@{css-prefix}radio-vertical {
display: block;
margin-top: 16px;
&:first-child {
margin-top: 0;
2015-06-15 20:24:01 +08:00
}
}
2015-07-20 17:28:29 +08:00
.@{inputNumberPrefixCls} {
2015-07-20 17:43:01 +08:00
margin-top: -1px;
margin-right: 8px;
2015-07-20 17:28:29 +08:00
}
2015-07-20 19:25:34 +08:00
.@{prefixCalendarClass}-picker {
width: 100%;
}
2015-06-15 20:24:01 +08:00
}
2015-06-15 11:43:18 +08:00
// Form layout
//== Horizontal Form
.@{css-prefix}form-horizontal {
.@{css-prefix}form-item {
.make-row;
}
2015-07-17 15:05:12 +08:00
.@{css-prefix}form-item-compact {
label,
.@{css-prefix}form-text,
.@{css-prefix}form-split {
padding-top: 0;
padding-bottom: 0;
}
}
.@{css-prefix}radio-inline,
.@{css-prefix}checkbox-inline {
vertical-align: top;
}
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-07-07 11:32:08 +08:00
margin-right: 10px;
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-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-07-16 14:18:03 +08:00
> input[type="radio"],
2015-07-17 11:06:38 +08:00
> input[type="checkbox"] {
margin-right: 5px;
2015-07-16 14:18:03 +08:00
}
2015-06-15 20:24:01 +08:00
}
}
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;);
}