diff --git a/components/divider/style/index.less b/components/divider/style/index.less index 0e495955bf2..d0f55017d6f 100644 --- a/components/divider/style/index.less +++ b/components/divider/style/index.less @@ -2,6 +2,7 @@ @import '../../style/mixins/index'; @divider-prefix-cls: ~'@{ant-prefix}-divider'; +@divider-text-padding: 1em; .@{divider-prefix-cls} { .reset-component; @@ -55,7 +56,7 @@ &-horizontal&-with-text-right { .@{divider-prefix-cls}-inner-text { display: inline-block; - padding: 0 10px; + padding: 0 @divider-text-padding; } } @@ -83,7 +84,7 @@ &-inner-text { display: inline-block; - padding: 0 24px; + padding: 0 @divider-text-padding; } &-dashed { diff --git a/components/form/style/index.less b/components/form/style/index.less index b8f0279e106..1ae5d3082e9 100644 --- a/components/form/style/index.less +++ b/components/form/style/index.less @@ -7,6 +7,7 @@ @import './inline'; @import './horizontal'; @import './vertical'; +@import './status'; @import './mixin'; @form-prefix-cls: ~'@{ant-prefix}-form'; @@ -25,6 +26,33 @@ &-rtl { direction: rtl; } + + // ================================================================ + // = Size = + // ================================================================ + .formSize(@input-height) { + .@{form-item-prefix-cls}-label > label { + height: @input-height; + } + + .@{form-item-prefix-cls}-control-input { + min-height: @input-height; + } + } + + &-small { + .formSize(@input-height-sm); + } + &-large { + .formSize(@input-height-lg); + } +} + +.explainAndExtraDistance(@num) when (@num>=0) { + padding-top: floor(@num); +} +.explainAndExtraDistance(@num) when (@num<0) { + margin-top: floor(@num); } // ================================================================ @@ -60,7 +88,7 @@ display: inline-flex; align-items: center; height: 100%; - max-height: @input-height-base; + height: @input-height-base; color: @label-color; font-size: @form-item-label-font-size; @@ -116,306 +144,25 @@ &-control-input { position: relative; - .clearfix; + display: flex; + align-items: center; + min-height: @input-height-base; + + &-content { + flex: auto; + } } &-explain, &-extra { clear: both; min-height: @form-item-margin-bottom; - padding-top: floor((@form-item-margin-bottom - @form-font-height) / 2); + .explainAndExtraDistance((@form-item-margin-bottom - @form-font-height) / 2); color: @text-color-secondary; font-size: @font-size-base; line-height: @line-height-base; transition: color 0.3s @ease-out; // sync input color transition } - - // ================================================================ - // = Status = - // ================================================================ - /* Some non-status related component style is in `components.less` */ - - &-has-feedback { - // ========================= Input ========================= - .@{ant-prefix}-input { - padding-right: 24px; - } - // https://github.com/ant-design/ant-design/issues/19884 - .@{ant-prefix}-input-affix-wrapper { - .@{ant-prefix}-input-suffix { - padding-right: 18px; - } - } - - // Fix issue: https://github.com/ant-design/ant-design/issues/7854 - .@{ant-prefix}-input-search:not(.@{ant-prefix}-input-search-enter-button) { - .@{ant-prefix}-input-suffix { - right: 28px; - - .@{form-prefix-cls}-rtl & { - right: auto; - left: 28px; - } - } - } - - .@{ant-prefix}-input-password-icon { - .@{form-prefix-cls}-rtl & { - margin-right: 0; - margin-left: 18px; - } - } - - // ======================== Switch ========================= - .@{ant-prefix}-switch { - margin: 2px 0 4px; - } - - // ======================== Select ========================= - // Fix overlapping between feedback icon and 's arrow. + // https://github.com/ant-design/ant-design/issues/4431 + > .@{ant-prefix}-select .@{ant-prefix}-select-arrow, + > .@{ant-prefix}-select .@{ant-prefix}-select-selection__clear, + :not(.@{ant-prefix}-input-group-addon) > .@{ant-prefix}-select .@{ant-prefix}-select-arrow, + :not(.@{ant-prefix}-input-group-addon) + > .@{ant-prefix}-select + .@{ant-prefix}-select-selection__clear { + right: 28px; + + .@{form-prefix-cls}-rtl & { + right: auto; + left: 28px; + } + } + > .@{ant-prefix}-select .@{ant-prefix}-select-selection-selected-value, + :not(.@{ant-prefix}-input-group-addon) + > .@{ant-prefix}-select + .@{ant-prefix}-select-selection-selected-value { + padding-right: 42px; + + .@{form-prefix-cls}-rtl & { + padding-right: 0; + padding-left: 42px; + } + } + + // ======================= Cascader ======================== + .@{ant-prefix}-cascader-picker { + &-arrow { + margin-right: 17px; + + .@{form-prefix-cls}-rtl & { + margin-right: 0; + margin-left: 17px; + } + } + &-clear { + right: 28px; + + .@{form-prefix-cls}-rtl & { + right: auto; + left: 28px; + } + } + } + + // ======================== Picker ========================= + // Fix issue: https://github.com/ant-design/ant-design/issues/4783 + .@{ant-prefix}-picker { + padding-right: @input-padding-horizontal-base + @font-size-base * 1.3; + + &-large { + padding-right: @input-padding-horizontal-lg + @font-size-base * 1.3; + } + + &-small { + padding-right: @input-padding-horizontal-sm + @font-size-base * 1.3; + } + } + + // ===================== Status Group ====================== + &.@{form-item-prefix-cls} { + &-has-success, + &-has-warning, + &-has-error, + &-is-validating { + // ====================== Icon ====================== + .@{form-item-prefix-cls}-children-icon { + position: absolute; + top: 50%; + right: 0; + z-index: 1; + width: @input-height-base; + height: 20px; + margin-top: -10px; + font-size: @font-size-base; + line-height: 20px; + text-align: center; + visibility: visible; + animation: zoomIn 0.3s @ease-out-back; + pointer-events: none; + + .@{form-prefix-cls}-rtl & { + right: auto; + left: 0; + } + + & svg { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + margin: auto; + } + } + } + } + } + + // ======================== Success ======================== + &-has-success { + &.@{form-item-prefix-cls}-has-feedback .@{form-item-prefix-cls}-children-icon { + color: @success-color; + animation-name: diffZoomIn1 !important; + } + } + + // ======================== Warning ======================== + &-has-warning { + .form-control-validation(@warning-color; @warning-color; @form-warning-input-bg); + + &.@{form-item-prefix-cls}-has-feedback .@{form-item-prefix-cls}-children-icon { + color: @warning-color; + animation-name: diffZoomIn3 !important; + } + + //select + .@{ant-prefix}-select { + .@{ant-prefix}-select-selector { + border-color: @warning-color !important; + } + &.@{ant-prefix}-select-open .@{ant-prefix}-select-selector, + &.@{ant-prefix}-select-focused .@{ant-prefix}-select-selector { + .active(@warning-color); + } + } + + //input-number, timepicker + .@{ant-prefix}-input-number, + .@{ant-prefix}-picker { + border-color: @warning-color; + &-focused, + &:focus { + .active(@warning-color); + } + &:not([disabled]):hover { + border-color: @warning-color; + } + } + + .@{ant-prefix}-cascader-picker:focus .@{ant-prefix}-cascader-input { + .active(@warning-color); + } + } + + // ========================= Error ========================= + &-has-error { + .form-control-validation(@error-color; @error-color; @form-error-input-bg); + + &.@{form-item-prefix-cls}-has-feedback .@{form-item-prefix-cls}-children-icon { + color: @error-color; + animation-name: diffZoomIn2 !important; + } + + //select + .@{ant-prefix}-select { + .@{ant-prefix}-select-selector { + border-color: @error-color !important; + } + &.@{ant-prefix}-select-open .@{ant-prefix}-select-selector, + &.@{ant-prefix}-select-focused .@{ant-prefix}-select-selector { + .active(@error-color); + } + } + + // fixes https://github.com/ant-design/ant-design/issues/20482 + .@{ant-prefix}-input-group-addon .@{ant-prefix}-select { + &.@{ant-prefix}-select-single:not(.@{ant-prefix}-select-customize-input) + .@{ant-prefix}-select-selector { + border: 0; + } + } + + .@{ant-prefix}-select.@{ant-prefix}-select-auto-complete { + .@{ant-prefix}-input:focus { + border-color: @error-color; + } + } + + //input-number, timepicker + .@{ant-prefix}-input-number, + .@{ant-prefix}-picker { + border-color: @error-color; + &-focused, + &:focus { + .active(@error-color); + } + &:not([disabled]):hover { + border-color: @error-color; + } + } + .@{ant-prefix}-mention-wrapper { + .@{ant-prefix}-mention-editor { + &, + &:not([disabled]):hover { + border-color: @error-color; + } + } + &.@{ant-prefix}-mention-active:not([disabled]) .@{ant-prefix}-mention-editor, + .@{ant-prefix}-mention-editor:not([disabled]):focus { + .active(@error-color); + } + } + + .@{ant-prefix}-cascader-picker:focus .@{ant-prefix}-cascader-input { + .active(@error-color); + } + + // transfer + .@{ant-prefix}-transfer { + &-list { + border-color: @error-color; + + &-search:not([disabled]) { + border-color: @input-border-color; + + &:hover { + .hover(); + } + + &:focus { + .active(); + } + } + } + } + } + + // Patch to keep error explain color + &-has-error-leave { + .@{form-item-prefix-cls}-explain { + color: @error-color; + } + } + + // ====================== Validating ======================= + &-is-validating { + &.@{form-item-prefix-cls}-has-feedback .@{form-item-prefix-cls}-children-icon { + display: inline-block; + color: @primary-color; + } + } +} diff --git a/components/style/themes/default.less b/components/style/themes/default.less index 93d1310a16e..1cc35581458 100644 --- a/components/style/themes/default.less +++ b/components/style/themes/default.less @@ -511,7 +511,7 @@ @table-border-radius-base: @border-radius-base; @table-footer-bg: @background-color-light; @table-footer-color: @heading-color; -@table-header-bg-sm: transparent; +@table-header-bg-sm: @table-bg; // Sorter // Legacy: `table-header-sort-active-bg` is used for hover not real active @table-header-sort-active-bg: darken(@table-header-bg, 3%); diff --git a/components/upload/style/index.less b/components/upload/style/index.less index 8a6090108e9..32b174389b3 100644 --- a/components/upload/style/index.less +++ b/components/upload/style/index.less @@ -212,7 +212,7 @@ opacity: 1; } .@{iconfont-css-prefix} { - padding-right: 5px; + padding-right: 6px; color: @upload-actions-color; .@{upload-prefix-cls}-list-rtl & { @@ -290,7 +290,6 @@ &-error &-card-actions { .@{iconfont-css-prefix} { - padding-right: 5px; color: @error-color; .@{upload-prefix-cls}-list-rtl & {