ant-design/style/components/form.less

370 lines
6.7 KiB
Plaintext
Raw Normal View History

2015-06-15 11:43:18 +08:00
@import "../mixins/index";
.reset-form();
2015-07-07 11:32:08 +08:00
label {
position: relative;
&[required]:before {
display: inline-block;
margin-right: 4px;
2015-07-07 11:32:08 +08:00
content: "*";
font-family: SimSun;
2015-07-08 12:02:57 +08:00
font-size: @font-size-base;
color: @label-required-color;
2015-07-07 11:32:08 +08:00
}
> .@{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;
2015-08-27 12:48:38 +08:00
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 {
2015-08-04 14:41:30 +08:00
.input-lg();
2015-07-21 14:54:49 +08:00
}
// Input combined with select
.@{css-prefix}input-group {
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-selection {
2015-07-21 14:54:49 +08:00
border-bottom-left-radius: 0;
border-top-left-radius: 0;
&:hover {
border-color: #d9d9d9;
}
}
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-selection--single {
2015-07-21 14:54:49 +08:00
margin-left: -1px;
height: @input-height-lg;
background-color: #eee;
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-selection__rendered {
2015-07-21 14:54:49 +08:00
padding-left: 8px;
padding-right: 25px;
2015-07-24 16:24:23 +08:00
line-height: 30px;
2015-07-21 14:54:49 +08:00
}
}
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-open .@{select-prefix-cls}-selection {
2015-07-21 14:54:49 +08:00
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
2015-08-20 16:55:42 +08:00
.@{input-number-prefix-cls} {
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
2015-08-20 16:55:42 +08:00
.@{calendar-prefix-cls}-picker {
2015-07-20 19:25:34 +08:00
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
.@{css-prefix}form-inline {
.@{css-prefix}form-item {
display: inline-block;
margin-right: 10px;
}
2015-06-15 11:43:18 +08:00
.@{css-prefix}input {
display: inline-block;
width: auto;
vertical-align: middle;
}
2015-06-15 11:43:18 +08:00
2015-08-20 17:01:57 +08:00
.@{calendar-prefix-cls}-picker-input {
width: 100%!important;
}
.@{css-prefix}form-text {
display: inline-block;
}
2015-06-15 20:24:01 +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
2015-08-03 13:34:40 +08:00
.has-success, .has-warning, .has-error, .is-validating {
&.has-feedback:after {
position: absolute;
bottom: 0;
right: 0;
font-family: "anticon" !important;
2015-08-04 14:41:30 +08:00
.square(@input-height-lg);
line-height: @input-height-lg;
2015-08-03 13:34:40 +08:00
text-align: center;
font-size: 14px;
2015-08-20 14:58:09 +08:00
.animation(zoomIn .3s @ease-out-back);
}
}
.has-error{
2015-08-20 18:09:28 +08:00
&.has-feedback:after {
2015-08-20 14:58:09 +08:00
animation-name: zoomIn2 !important;
}
}
.has-warning{
2015-08-20 18:09:28 +08:00
&.has-feedback:after {
2015-08-20 14:58:09 +08:00
animation-name: zoomIn3 !important;
2015-08-03 13:34:40 +08:00
}
}
2015-06-15 11:43:18 +08:00
.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-08-03 13:34:40 +08:00
box-shadow: none;
}
&.has-feedback:after {
content: '\e614';
color: @success-color;
2015-07-07 11:32:08 +08:00
}
2015-06-15 11:43:18 +08:00
}
2015-08-03 13:34:40 +08:00
2015-06-15 11:43:18 +08:00
.has-warning {
.form-control-validation(@warning-color; @warning-color;);
2015-08-03 13:34:40 +08:00
&.has-feedback:after {
content: '\e628';
color: @warning-color;
}
// ant-select
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls} {
2015-08-03 13:34:40 +08:00
&-selection {
border-color: @warning-color;
box-shadow: 0 0 0 2px tint(@warning-color, 80%);
}
&-arrow {
color: @warning-color;
}
}
// ant-datepicker
2015-08-20 16:55:42 +08:00
.@{calendar-prefix-cls}-picker-icon:after {
2015-08-03 13:34:40 +08:00
color: @warning-color;
}
2015-06-15 11:43:18 +08:00
}
2015-08-03 13:34:40 +08:00
2015-06-15 11:43:18 +08:00
.has-error {
.form-control-validation(@error-color; @error-color;);
2015-08-03 13:34:40 +08:00
&.has-feedback:after {
content: '\e628';
color: @error-color;
}
2015-08-20 14:58:09 +08:00
2015-08-03 13:34:40 +08:00
// ant-select
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls} {
2015-08-03 13:34:40 +08:00
&-selection {
border-color: @error-color;
box-shadow: 0 0 0 2px tint(@error-color, 80%);
}
&-arrow {
color: @error-color;
}
}
// ant-datepicker
2015-08-20 16:55:42 +08:00
.@{calendar-prefix-cls}-picker-icon:after {
2015-08-03 13:34:40 +08:00
color: @error-color;
}
}
.is-validating {
&.has-feedback:after {
display: inline-block;
2015-08-20 14:58:09 +08:00
.animation(loadingCircle 1s infinite linear );
2015-08-03 13:34:40 +08:00
content:"\e610";
}
2015-06-15 11:43:18 +08:00
}
2015-08-20 14:58:09 +08:00
@keyframes zoomIn2 {
0%{
transform: scale(0);
}
100%{
transform: scale(1);
}
}
@keyframes zoomIn3 {
0%{
transform: scale(0);
}
100%{
transform: scale(1);
}
}