ant-design/style/components/form.less
2015-09-14 20:22:31 +08:00

367 lines
6.6 KiB
Plaintext

@import "../mixins/index";
.reset-form();
label {
position: relative;
&[required]:before {
display: inline-block;
margin-right: 4px;
content: "*";
font-family: SimSun;
font-size: @font-size-base;
color: @label-required-color;
}
> .@{iconfont-css-prefix} {
vertical-align: top;
font-size: @font-size-base;
}
}
// 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 {
.input-group(~"@{css-prefix}input");
}
// 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;
}
}
}
// Form items
// You should wrap labels and controls in .@{css-prefix}form-item for optimum spacing
.@{css-prefix}form-item {
font-size: @font-size-base;
margin-bottom: @form-item-margin-bottom;
color: #666;
> label {
color: @label-color;
text-align: right;
vertical-align: middle;
&:lang(en) {
padding-right: 8px;
}
}
.@{css-prefix}switch {
margin: 4px 0;
}
}
.@{css-prefix}form-text, .@{css-prefix}form-split {
margin: 0!important;
padding-top: 7px;
padding-bottom: 7px;
}
.@{css-prefix}form-text {
display: inline-block;
padding-right: 8px;
}
.@{css-prefix}form-split {
display: block;
text-align: center;
}
.@{css-prefix}form-explain {
position: absolute;
font-size: @font-size-base;
line-height: @line-height-base;
bottom: -@line-height-computed;
}
// 表单下的输入框尺寸唯一: 大尺寸
form {
.has-feedback {
.@{iconfont-css-prefix} {
.square(@input-height-lg);
line-height: @input-height-lg;
}
}
.@{css-prefix}input,
.@{css-prefix}input-group .@{css-prefix}input,
.@{css-prefix}input-group .@{css-prefix}input-group-addon {
.input-lg();
}
// Input combined with select
.@{css-prefix}input-group {
.@{select-prefix-cls}-selection {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
&:hover {
border-color: #d9d9d9;
}
}
.@{select-prefix-cls}-selection--single {
margin-left: -1px;
height: @input-height-lg;
background-color: #eee;
.@{select-prefix-cls}-selection__rendered {
padding-left: 8px;
padding-right: 25px;
line-height: 30px;
}
}
.@{select-prefix-cls}-open .@{select-prefix-cls}-selection {
border-color: #d9d9d9;
box-shadow: none;
}
}
// input[type=file]
.@{css-prefix}upload {
background: transparent;
}
input[type="radio"],
input[type="checkbox"] {
width: 14px;
height: 14px;
}
// Radios and checkboxes on same line
.@{css-prefix}radio-inline,
.@{css-prefix}checkbox-inline {
display: inline-block;
margin-right: 16px;
vertical-align: middle;
font-weight: normal;
cursor: pointer;
}
.@{css-prefix}checkbox-vertical,
.@{css-prefix}radio-vertical {
display: block;
margin-top: 16px;
&:first-child {
margin-top: 0;
}
}
.@{input-number-prefix-cls} {
margin-top: -1px;
margin-right: 8px;
}
.@{calendar-prefix-cls}-picker {
width: 100%;
}
}
// Form layout
//== Horizontal Form
.@{css-prefix}form-horizontal {
.@{css-prefix}form-item {
.make-row;
}
.@{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;
}
}
//== Inline Form
.@{css-prefix}form-inline {
.@{css-prefix}form-item {
display: inline-block;
margin-right: 10px;
}
.@{css-prefix}input {
display: inline-block;
width: auto;
vertical-align: middle;
}
.@{calendar-prefix-cls}-picker-input {
width: 100%!important;
}
.@{css-prefix}form-text {
display: inline-block;
}
.has-feedback {
display: inline-block;
}
}
.@{css-prefix}form-horizontal, .@{css-prefix}form-inline {
label {
padding-top: 7px;
padding-bottom: 7px;
> input[type="radio"],
> input[type="checkbox"] {
margin-right: 5px;
}
}
}
// Validation state
.has-success, .has-warning, .has-error, .is-validating {
&.has-feedback:after {
position: absolute;
bottom: 0;
right: 0;
font-family: "anticon" !important;
.square(@input-height-lg);
line-height: @input-height-lg;
text-align: center;
font-size: 14px;
.animation(zoomIn .3s @ease-out-back);
}
}
.has-error{
&.has-feedback:after {
animation-name: zoomIn2 !important;
}
}
.has-warning{
&.has-feedback:after {
animation-name: zoomIn3 !important;
}
}
.has-success {
.form-control-validation(@success-color; @input-hover-border-color;);
.@{css-prefix}input {
border-color: @input-border-color;
box-shadow: none;
}
&.has-feedback:after {
content: '\e614';
color: @success-color;
}
}
.has-warning {
.form-control-validation(@warning-color; @warning-color;);
&.has-feedback:after {
content: '\e628';
color: @warning-color;
}
// ant-select
.@{select-prefix-cls} {
&-selection {
border-color: @warning-color;
box-shadow: 0 0 0 2px tint(@warning-color, 80%);
}
&-arrow {
color: @warning-color;
}
}
// ant-datepicker
.@{calendar-prefix-cls}-picker-icon:after {
color: @warning-color;
}
}
.has-error {
.form-control-validation(@error-color; @error-color;);
&.has-feedback:after {
content: '\e628';
color: @error-color;
}
// ant-select
.@{select-prefix-cls} {
&-selection {
border-color: @error-color;
box-shadow: 0 0 0 2px tint(@error-color, 80%);
}
&-arrow {
color: @error-color;
}
}
// ant-datepicker
.@{calendar-prefix-cls}-picker-icon:after {
color: @error-color;
}
}
.is-validating {
&.has-feedback:after {
display: inline-block;
.animation(loadingCircle 1s infinite linear );
content:"\e610";
}
}
@keyframes zoomIn2 {
0%{
transform: scale(0);
}
100%{
transform: scale(1);
}
}
@keyframes zoomIn3 {
0%{
transform: scale(0);
}
100%{
transform: scale(1);
}
}