ant-design/components/form/style/index.less

470 lines
8.0 KiB
Plaintext
Raw Normal View History

@import "../../style/themes/default";
@import "../../style/mixins/index";
@import "../../input/style/mixin";
@import "../../button/style/mixin";
@import "../../layout/style/mixin";
@import "./mixin";
@form-prefix-cls: ant-form;
2015-06-15 11:43:18 +08:00
.reset-form();
2015-07-07 11:32:08 +08:00
label {
position: relative;
> .@{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
}
.@{form-prefix-cls}-item-required:before {
2016-02-02 20:47:52 +08:00
display: inline-block;
margin-right: 4px;
content: "*";
font-family: SimSun;
font-size: @font-size-base;
color: @label-required-color;
}
2015-07-17 15:05:12 +08:00
// Radio && Checkbox
input[type="radio"],
input[type="checkbox"] {
&[disabled],
&.disabled,
fieldset[disabled] & {
cursor: @cursor-disabled;
}
}
2015-07-17 15:05:12 +08:00
// These classes are used directly on <label>s
.ant-radio-inline,
.ant-radio-vertical,
.ant-checkbox-inline,
.ant-checkbox-vertical {
2015-07-17 15:05:12 +08:00
&.disabled,
fieldset[disabled] & {
cursor: @cursor-disabled;
}
}
2015-07-17 15:05:12 +08:00
// These classes are used on elements with <label> descendants
.ant-radio,
.ant-checkbox {
2015-07-17 15:05:12 +08:00
&.disabled,
fieldset[disabled] & {
label {
cursor: @cursor-disabled;
}
}
}
2015-07-07 11:32:08 +08:00
// Form items
// You should wrap labels and controls in .@{form-prefix-cls}-item for optimum spacing
.@{form-prefix-cls}-item {
2015-09-14 20:22:31 +08:00
font-size: @font-size-base;
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
2016-05-19 15:21:48 +08:00
// nested FormItem
2016-08-10 14:38:35 +08:00
& > &,
& :not(.@{form-prefix-cls}) > & {
2016-05-19 15:21:48 +08:00
margin-bottom: -@form-item-margin-bottom;
}
2016-01-22 14:56:35 +08:00
&-control {
line-height: 32px;
2016-05-17 15:46:21 +08:00
position: relative;
2016-05-19 15:21:48 +08:00
.clearfix;
2016-01-22 14:56:35 +08:00
}
2016-05-19 15:21:48 +08:00
&-with-help {
margin-bottom: @form-item-margin-bottom - @font-size-base * @line-height-base - 3;
}
2016-07-10 17:04:03 +08:00
&-label {
2015-07-07 11:32:08 +08:00
text-align: right;
2015-07-17 15:43:31 +08:00
vertical-align: middle;
padding: 7px 0;
display: inline-block;
2015-07-22 17:17:47 +08:00
label {
color: @label-color;
&:after {
content: ":";
margin: 0 8px 0 2px;
position: relative;
top: -0.5px;
}
2015-07-24 16:08:44 +08:00
}
2015-07-07 11:32:08 +08:00
}
2015-07-16 22:57:47 +08:00
.ant-switch {
2015-07-16 22:57:47 +08:00
margin: 4px 0;
}
2016-07-09 15:10:07 +08:00
2016-07-21 15:51:37 +08:00
&-no-colon &-label label:after {
2016-07-09 15:10:07 +08:00
content: " ";
}
2015-06-15 11:43:18 +08:00
}
.@{form-prefix-cls}-explain {
line-height: 1.5;
margin-top: 3px;
}
.@{form-prefix-cls}-explain,
.@{form-prefix-cls}-extra {
2016-04-25 16:25:57 +08:00
color: #999;
}
.@{form-prefix-cls}-text {
2015-07-20 19:25:34 +08:00
display: inline-block;
padding-right: 8px;
2015-07-20 19:25:34 +08:00
}
.@{form-prefix-cls}-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-07 11:32:08 +08:00
// 表单下的输入框尺寸唯一: 大尺寸
form {
.has-feedback {
.ant-input {
padding-right: 24px;
}
2015-07-07 11:32:08 +08:00
}
2015-07-21 14:54:49 +08:00
textarea.ant-input {
height: auto;
}
2015-07-07 11:32:08 +08:00
// input[type=file]
.ant-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
.ant-radio-inline,
.ant-checkbox-inline {
2015-07-15 17:22:58 +08:00
display: inline-block;
vertical-align: middle;
2015-06-15 20:24:01 +08:00
font-weight: normal;
cursor: pointer;
margin-left: 8px;
2015-12-16 17:39:10 +08:00
&:first-child {
margin-left: 0;
}
2015-06-15 20:24:01 +08:00
}
.ant-checkbox-vertical,
.ant-radio-vertical {
2015-07-17 15:05:12 +08:00
display: block;
2015-06-15 20:24:01 +08:00
}
2015-07-20 17:28:29 +08:00
2016-06-27 17:22:03 +08:00
.ant-checkbox-vertical + .ant-checkbox-vertical,
.ant-radio-vertical + .ant-radio-vertical {
margin-left: 0;
}
.ant-input-number {
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
.ant-select,
.ant-cascader-picker {
2015-07-20 19:25:34 +08:00
width: 100%;
}
2015-06-15 20:24:01 +08:00
}
2015-12-02 19:33:26 +08:00
// Input combined with select
.ant-input-group-wrap {
.ant-select-selection {
2015-12-02 19:33:26 +08:00
border-bottom-left-radius: 0;
border-top-left-radius: 0;
&:hover {
2016-03-04 17:06:39 +08:00
border-color: @border-color-base;
2015-12-02 19:33:26 +08:00
}
}
.ant-select-selection--single {
2015-12-02 19:33:26 +08:00
margin-left: -1px;
height: @input-height-lg;
background-color: #eee;
.ant-select-selection__rendered {
2015-12-02 19:33:26 +08:00
padding-left: 8px;
padding-right: 25px;
line-height: 30px;
}
}
.ant-select-open .ant-select-selection {
2016-03-04 17:06:39 +08:00
border-color: @border-color-base;
2015-12-02 19:33:26 +08:00
box-shadow: none;
}
}
2015-06-15 11:43:18 +08:00
// Form layout
//== Horizontal Form
.@{form-prefix-cls}-horizontal {
.@{form-prefix-cls}-item {
2015-06-15 11:43:18 +08:00
.make-row;
}
2015-07-17 15:05:12 +08:00
.ant-radio-inline,
2016-05-19 15:21:48 +08:00
.ant-checkbox-inline {
2016-04-12 14:55:02 +08:00
vertical-align: baseline;
2015-07-17 15:05:12 +08:00
}
2015-06-15 11:43:18 +08:00
}
2016-08-04 17:45:15 +08:00
// Form layout
//== Vertical Form
.@{form-prefix-cls}-vertical {
.@{form-prefix-cls}-item-label {
padding: 0 0 8px;
label:after {
content: '';
}
}
}
2015-06-15 11:43:18 +08:00
//== Inline Form
.@{form-prefix-cls}-inline {
.@{form-prefix-cls}-item {
display: inline-block;
margin-right: 10px;
margin-bottom: 0;
&-with-help {
margin-bottom: 24px;
}
2015-12-08 17:48:12 +08:00
> div {
display: inline-block;
}
}
2015-06-15 11:43:18 +08:00
.@{form-prefix-cls}-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
}
// Fix https://github.comdesigndesign/issues/1040
.@{form-prefix-cls}-explain {
position: absolute;
}
2015-07-07 11:32:08 +08:00
}
2015-06-15 20:24:01 +08:00
.@{form-prefix-cls}-horizontal,
.@{form-prefix-cls}-inline {
2015-07-07 11:32:08 +08:00
label {
2015-07-16 14:18:03 +08:00
> input[type="radio"],
2015-07-17 11:06:38 +08:00
> input[type="checkbox"] {
margin-right: 4px;
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-11-26 19:32:55 +08:00
.has-success,
.has-warning,
.has-error,
.is-validating {
2015-08-03 13:34:40 +08:00
&.has-feedback:after {
position: absolute;
top: 0;
2015-08-03 13:34:40 +08:00
right: 0;
2016-05-24 20:08:13 +08:00
visibility: visible;
2015-08-04 14:41:30 +08:00
.square(@input-height-lg);
2016-06-28 18:32:03 +08:00
line-height: @input-height-lg;
2015-08-03 13:34:40 +08:00
text-align: center;
font-size: 14px;
2016-04-19 15:15:54 +08:00
animation: zoomIn .3s @ease-out-back;
2016-07-25 14:03:56 +08:00
.iconfont-font("");
2015-08-20 14:58:09 +08:00
}
}
2015-11-18 15:41:30 +08:00
.has-success {
2015-08-20 18:09:28 +08:00
&.has-feedback:after {
2015-11-18 15:41:30 +08:00
animation-name: diffZoomIn1 !important;
2015-08-20 14:58:09 +08:00
}
}
2015-11-18 15:41:30 +08:00
.has-error {
2015-08-20 18:09:28 +08:00
&.has-feedback:after {
2015-11-18 15:41:30 +08:00
animation-name: diffZoomIn2 !important;
}
}
.has-warning {
&.has-feedback:after {
animation-name: diffZoomIn3 !important;
2015-08-03 13:34:40 +08:00
}
}
2015-06-15 11:43:18 +08:00
.has-success {
.ant-input {
2015-07-07 11:32:08 +08:00
border-color: @input-border-color;
2015-08-03 13:34:40 +08:00
box-shadow: none;
}
&.has-feedback:after {
2015-11-12 22:59:25 +08:00
content: '\e62f';
2015-08-03 13:34:40 +08:00
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 {
2015-11-12 22:59:25 +08:00
content: '\e634';
2015-08-03 13:34:40 +08:00
color: @warning-color;
}
//select
.ant-select {
2015-08-03 13:34:40 +08:00
&-selection {
border-color: @warning-color;
box-shadow: 0 0 0 2px fade(@warning-color, 20%);
2015-08-03 13:34:40 +08:00
}
&-arrow {
color: @warning-color;
}
}
//datepicker
.ant-calendar-picker-icon:after {
2015-08-03 13:34:40 +08:00
color: @warning-color;
}
//timepicker
.ant-time-picker-icon:after {
2015-11-19 14:11:34 +08:00
color: @warning-color;
}
//input-number
.ant-input-number {
border-color: @warning-color;
box-shadow: 0 0 0 2px fade(@warning-color, 20%);
2015-11-18 15:41:30 +08:00
&:not([disabled]):hover {
border-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 {
2016-04-16 17:38:30 +08:00
content: '\e631';
2015-08-03 13:34:40 +08:00
color: @error-color;
}
2015-08-20 14:58:09 +08:00
//select
.ant-select {
2015-08-03 13:34:40 +08:00
&-selection {
border-color: @error-color;
box-shadow: 0 0 0 2px fade(@error-color, 20%);
2015-08-03 13:34:40 +08:00
}
&-arrow {
color: @error-color;
}
}
//datepicker
.ant-calendar-picker-icon:after {
2015-08-03 13:34:40 +08:00
color: @error-color;
}
//timepicker
.ant-time-picker-picker-icon:after {
2015-11-19 14:11:34 +08:00
color: @error-color;
}
//input-number
.ant-input-number {
border-color: @error-color;
box-shadow: 0 0 0 2px fade(@error-color, 20%);
2015-11-18 15:41:30 +08:00
&:not([disabled]):hover {
border-color: @error-color;
}
}
.ant-mention-wrapper,
.ant-mention-wrapper.active {
.ant-mention-editor {
border-color: @error-color;
box-shadow: 0 0 0 2px fade(@error-color, 20%);
&:not([disabled]):hover,
&:not([disabled]):focus {
border-color: @error-color;
box-shadow: 0 0 0 2px fade(@error-color, 20%);
}
}
}
2015-08-03 13:34:40 +08:00
}
.is-validating {
&.has-feedback:after {
display: inline-block;
2016-04-19 15:15:54 +08:00
animation: loadingCircle 1s infinite linear;
2015-11-26 19:32:55 +08:00
content: "\e6a1";
2016-04-16 17:38:30 +08:00
color: #999;
2015-08-03 13:34:40 +08:00
}
2015-06-15 11:43:18 +08:00
}
2015-08-20 14:58:09 +08:00
.ant-advanced-search-form {
.@{form-prefix-cls}-item {
2016-04-12 14:55:02 +08:00
margin-bottom: 16px;
}
.ant-input,
.ant-input-group .ant-input,
.ant-input-group .ant-input-group-addon {
2016-04-12 14:55:02 +08:00
height: 28px;
}
}
2015-11-18 15:41:30 +08:00
// need there different zoom animation
// otherwise won't trigger anim
@keyframes diffZoomIn1 {
2015-11-26 19:32:55 +08:00
0% {
2015-08-20 14:58:09 +08:00
transform: scale(0);
}
2015-11-26 19:32:55 +08:00
100% {
2015-08-20 14:58:09 +08:00
transform: scale(1);
}
}
2015-11-18 15:41:30 +08:00
@keyframes diffZoomIn2 {
2015-11-26 19:32:55 +08:00
0% {
2015-11-18 15:41:30 +08:00
transform: scale(0);
}
2015-11-26 19:32:55 +08:00
100% {
2015-11-18 15:41:30 +08:00
transform: scale(1);
}
}
@keyframes diffZoomIn3 {
2015-11-26 19:32:55 +08:00
0% {
2015-08-20 14:58:09 +08:00
transform: scale(0);
}
2015-11-26 19:32:55 +08:00
100% {
2015-08-20 14:58:09 +08:00
transform: scale(1);
}
}