ant-design-vue/components/input/style/mixin.less

387 lines
9.0 KiB
Plaintext
Raw Normal View History

2019-01-02 13:01:56 +00:00
@import '../../style/themes/default';
@import '../../style/mixins/index';
2017-12-06 10:54:20 +00:00
2018-01-15 10:54:26 +00:00
@input-affix-width: 19px;
2017-12-06 10:54:20 +00:00
// size mixins for input
.input-lg() {
padding: @input-padding-vertical-lg @input-padding-horizontal-lg;
height: @input-height-lg;
2018-01-15 10:54:26 +00:00
font-size: @font-size-lg;
2017-12-06 10:54:20 +00:00
}
.input-sm() {
padding: @input-padding-vertical-sm @input-padding-horizontal-sm;
height: @input-height-sm;
}
// input status
// == when focus or actived
.active(@color: @outline-color) {
2019-01-02 13:01:56 +00:00
border-color: ~`colorPalette('@{color}', 5) `;
2017-12-06 10:54:20 +00:00
outline: 0;
update to antd3.8.3 (#159) * refactor: align * feat: update align to 2.4.3 * feat: update trigger 2.5.4 * feat: update tooltip 3.7.2 * fix: align * feat: update vc-calendar to 9.6.2 * feat: update vc-checkbox to 2.1.5 * feat: update vc-dialog to 7.1.8 * feat: update vc-from to 2.2.1 * feat: update vc-notification to 3.1.1 * test: update snapshots * feat: update vc-tree to 1.12.6 * feat: update vc-table to 6.2.8 * feat: update vc-upload to 2.5.1 * feat: update vc-input-number to 4.0.12 * feat: update vc-tabs to 9.2.6 * refactor: vc-menu * refactor: update vc-menu to 7.0.5 * style: remove unused * feat: update pagination to 1.16.5 * feat: add vc-progress 2.2.5 tag * feat: add vc-rate 2.4.0 tag * feat: update vc-slider to 8.6.1 * fix: tooltip error * style: delete conosle * feat: update vc-steps to 3.1.1 * add vc-switch tag 1.6.0 * feat: update upload to 2.5.1 * fix: update vc-menu * fix: update store * fix: add ref dir * fix: trigger mock shouldComponentUpdate * fix: update vc-select * revert: trigger lazyrenderbox * fix: update vc-select * fix: update vc-select * fix: update vc-select * fix: update vc-menu * fix: update vc-slick ref * update style to 3.8.2 * test: update snapshots * update vc-select * update util & affix * feat: add drawer * fix: support title add slot mode * test: update affix test * update alert * update anchor * update snapshots * fix: doc and vc-drawer * update select & auto-complete * update back-top & grid * feractor: avatar * test: add drawer test * update badge * update button * update card * update divider * feat: update vc-tabs to 9.3.6 and tabs * add afterEnter callback * update form * fix: update drawer * test: update snapshots * update modal & notification * test: update snapshots * update message * update locale-provider * update dropdown * update layout popconfirm popover * update time-picker * update menu * update date-picker * docs: update input docs * update input * update snapshots * update table * update test snapshots * feat: update progress * update checkbox * feat: update spin * update radio * docs: slider steps timeline * update list * update transfer * update collapse * update cascader * update upload
2018-09-05 13:28:54 +00:00
box-shadow: @input-outline-offset @outline-blur-size @outline-width fade(@color, 20%);
2019-01-02 13:01:56 +00:00
border-right-width: @border-width-base !important;
2017-12-06 10:54:20 +00:00
}
// == when hoverd
.hover(@color: @input-hover-border-color) {
2019-01-02 13:01:56 +00:00
border-color: ~`colorPalette('@{color}', 5) `;
border-right-width: @border-width-base !important;
2017-12-06 10:54:20 +00:00
}
.disabled() {
background-color: @input-disabled-bg;
opacity: 1;
cursor: not-allowed;
color: @disabled-color;
&:hover {
.hover(@input-border-color);
}
}
// Basic style for input
.input() {
position: relative;
display: inline-block;
padding: @input-padding-vertical-base @input-padding-horizontal-base;
width: 100%;
height: @input-height-base;
font-size: @font-size-base;
line-height: @line-height-base;
color: @input-color;
background-color: @input-bg;
background-image: none;
border: @border-width-base @border-style-base @input-border-color;
border-radius: @border-radius-base;
.placeholder(); // Reset placeholder
2019-01-02 13:01:56 +00:00
transition: all 0.3s;
2017-12-06 10:54:20 +00:00
&:hover {
.hover();
}
&:focus {
.active();
}
&-disabled {
.disabled();
}
// Reset height for `textarea`s
textarea& {
max-width: 100%; // prevent textearea resize from coming out of its container
height: auto;
vertical-align: bottom;
2019-01-02 13:01:56 +00:00
transition: all 0.3s, height 0s;
2018-01-15 10:54:26 +00:00
min-height: @input-height-base;
2017-12-06 10:54:20 +00:00
}
// Size
&-lg {
.input-lg();
}
&-sm {
.input-sm();
}
}
// label input
.input-group(@inputClass) {
position: relative;
display: table;
border-collapse: separate;
border-spacing: 0;
width: 100%;
// Undo padding and float of grid classes
2019-01-02 13:01:56 +00:00
&[class*='col-'] {
2017-12-06 10:54:20 +00:00
float: none;
padding-left: 0;
padding-right: 0;
}
2019-01-02 13:01:56 +00:00
> [class*='col-'] {
2017-12-06 10:54:20 +00:00
padding-right: 8px;
&:last-child {
padding-right: 0;
}
}
&-addon,
&-wrap,
> .@{inputClass} {
display: table-cell;
&:not(:first-child):not(:last-child) {
border-radius: 0;
}
}
&-addon,
&-wrap {
width: 1px; // To make addon/wrap as small as possible
white-space: nowrap;
vertical-align: middle;
}
&-wrap > * {
display: block !important;
}
.@{inputClass} {
float: left;
width: 100%;
margin-bottom: 0;
&:focus {
z-index: 1; // Fix https://gw.alipayobjects.com/zos/rmsportal/DHNpoqfMXSfrSnlZvhsJ.png
update to antd3.8.3 (#159) * refactor: align * feat: update align to 2.4.3 * feat: update trigger 2.5.4 * feat: update tooltip 3.7.2 * fix: align * feat: update vc-calendar to 9.6.2 * feat: update vc-checkbox to 2.1.5 * feat: update vc-dialog to 7.1.8 * feat: update vc-from to 2.2.1 * feat: update vc-notification to 3.1.1 * test: update snapshots * feat: update vc-tree to 1.12.6 * feat: update vc-table to 6.2.8 * feat: update vc-upload to 2.5.1 * feat: update vc-input-number to 4.0.12 * feat: update vc-tabs to 9.2.6 * refactor: vc-menu * refactor: update vc-menu to 7.0.5 * style: remove unused * feat: update pagination to 1.16.5 * feat: add vc-progress 2.2.5 tag * feat: add vc-rate 2.4.0 tag * feat: update vc-slider to 8.6.1 * fix: tooltip error * style: delete conosle * feat: update vc-steps to 3.1.1 * add vc-switch tag 1.6.0 * feat: update upload to 2.5.1 * fix: update vc-menu * fix: update store * fix: add ref dir * fix: trigger mock shouldComponentUpdate * fix: update vc-select * revert: trigger lazyrenderbox * fix: update vc-select * fix: update vc-select * fix: update vc-select * fix: update vc-menu * fix: update vc-slick ref * update style to 3.8.2 * test: update snapshots * update vc-select * update util & affix * feat: add drawer * fix: support title add slot mode * test: update affix test * update alert * update anchor * update snapshots * fix: doc and vc-drawer * update select & auto-complete * update back-top & grid * feractor: avatar * test: add drawer test * update badge * update button * update card * update divider * feat: update vc-tabs to 9.3.6 and tabs * add afterEnter callback * update form * fix: update drawer * test: update snapshots * update modal & notification * test: update snapshots * update message * update locale-provider * update dropdown * update layout popconfirm popover * update time-picker * update menu * update date-picker * docs: update input docs * update input * update snapshots * update table * update test snapshots * feat: update progress * update checkbox * feat: update spin * update radio * docs: slider steps timeline * update list * update transfer * update collapse * update cascader * update upload
2018-09-05 13:28:54 +00:00
border-right-width: 1px;
}
&:hover {
z-index: 1;
border-right-width: 1px;
2017-12-06 10:54:20 +00:00
}
}
&-addon {
2018-01-15 10:54:26 +00:00
padding: 0 @input-padding-horizontal-base;
2017-12-06 10:54:20 +00:00
font-size: @font-size-base;
font-weight: normal;
line-height: 1;
color: @input-color;
text-align: center;
background-color: @input-addon-bg;
border: @border-width-base @border-style-base @input-border-color;
border-radius: @border-radius-base;
position: relative;
2019-01-02 13:01:56 +00:00
transition: all 0.3s;
2017-12-06 10:54:20 +00:00
// Reset Select's style in addon
.@{ant-prefix}-select {
2018-12-09 11:30:35 +00:00
margin: -(@input-padding-vertical-base + 1px) (-@input-padding-horizontal-base);
2017-12-06 10:54:20 +00:00
.@{ant-prefix}-select-selection {
background-color: inherit;
margin: -1px;
border: @border-width-base @border-style-base transparent;
box-shadow: none;
}
&-open,
&-focused {
.@{ant-prefix}-select-selection {
color: @primary-color;
}
}
}
// Expand addon icon click area
// https://github.com/ant-design/ant-design/issues/3714
> i:only-child:after {
position: absolute;
2019-01-02 13:01:56 +00:00
content: '';
2017-12-06 10:54:20 +00:00
top: 0;
left: 0;
right: 0;
bottom: 0;
}
}
// Reset rounded corners
> .@{inputClass}:first-child,
&-addon:first-child {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
// Reset Select's style in addon
.@{ant-prefix}-select .@{ant-prefix}-select-selection {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
}
> .@{inputClass}-affix-wrapper {
&:not(:first-child) .@{inputClass} {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
&:not(:last-child) .@{inputClass} {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
}
&-addon:first-child {
border-right: 0;
}
&-addon:last-child {
border-left: 0;
}
> .@{inputClass}:last-child,
&-addon:last-child {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
// Reset Select's style in addon
.@{ant-prefix}-select .@{ant-prefix}-select-selection {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
}
// Sizing options
&-lg .@{inputClass},
&-lg > &-addon {
.input-lg();
}
&-sm .@{inputClass},
&-sm > &-addon {
.input-sm();
}
// Fix https://github.com/ant-design/ant-design/issues/5754
&-lg .@{ant-prefix}-select-selection--single {
height: @input-height-lg;
}
&-sm .@{ant-prefix}-select-selection--single {
height: @input-height-sm;
}
.@{inputClass}-affix-wrapper {
display: table-cell;
width: 100%;
float: left;
}
&&-compact {
display: block;
.clearfix;
2018-11-14 13:33:56 +00:00
&-addon,
&-wrap,
> .@{inputClass} {
&:not(:first-child):not(:last-child) {
2019-01-02 13:01:56 +00:00
border-right-width: @border-width-base;
2018-11-14 13:33:56 +00:00
&:hover {
2019-01-02 13:01:56 +00:00
z-index: 1;
2018-11-14 13:33:56 +00:00
}
&:focus {
2019-01-02 13:01:56 +00:00
z-index: 1;
2018-11-14 13:33:56 +00:00
}
}
}
2017-12-06 10:54:20 +00:00
& > * {
border-radius: 0;
2018-01-15 10:54:26 +00:00
vertical-align: top; // https://github.com/ant-design/ant-design-pro/issues/139
2017-12-06 10:54:20 +00:00
float: none;
display: inline-block;
}
2019-01-02 13:01:56 +00:00
& > *:not(:last-child) {
border-right-width: @border-width-base;
margin-right: -@border-width-base;
2018-09-16 13:36:22 +00:00
}
2017-12-06 10:54:20 +00:00
// Undo float for .ant-input-group .ant-input
.@{inputClass} {
float: none;
}
// reset border for Select, DatePicker, AutoComplete, Cascader, Mention, TimePicker
& > .@{ant-prefix}-select > .@{ant-prefix}-select-selection,
& > .@{ant-prefix}-calendar-picker .@{ant-prefix}-input,
& > .@{ant-prefix}-select-auto-complete .@{ant-prefix}-input,
& > .@{ant-prefix}-cascader-picker .@{ant-prefix}-input,
& > .@{ant-prefix}-mention-wrapper .@{ant-prefix}-mention-editor,
& > .@{ant-prefix}-time-picker .@{ant-prefix}-time-picker-input {
border-radius: 0;
2019-01-02 13:01:56 +00:00
border-right-width: @border-width-base;
2018-11-14 13:33:56 +00:00
&:hover {
2019-01-02 13:01:56 +00:00
z-index: 1;
2018-11-14 13:33:56 +00:00
}
&:focus {
2019-01-02 13:01:56 +00:00
z-index: 1;
2018-11-14 13:33:56 +00:00
}
2017-12-06 10:54:20 +00:00
}
& > *:first-child,
& > .@{ant-prefix}-select:first-child > .@{ant-prefix}-select-selection,
& > .@{ant-prefix}-calendar-picker:first-child .@{ant-prefix}-input,
& > .@{ant-prefix}-select-auto-complete:first-child .@{ant-prefix}-input,
& > .@{ant-prefix}-cascader-picker:first-child .@{ant-prefix}-input,
& > .@{ant-prefix}-mention-wrapper:first-child .@{ant-prefix}-mention-editor,
& > .@{ant-prefix}-time-picker:first-child .@{ant-prefix}-time-picker-input {
border-top-left-radius: @border-radius-base;
border-bottom-left-radius: @border-radius-base;
}
& > *:last-child,
& > .@{ant-prefix}-select:last-child > .@{ant-prefix}-select-selection,
& > .@{ant-prefix}-calendar-picker:last-child .@{ant-prefix}-input,
& > .@{ant-prefix}-select-auto-complete:last-child .@{ant-prefix}-input,
& > .@{ant-prefix}-cascader-picker:last-child .@{ant-prefix}-input,
2018-11-14 13:33:56 +00:00
& > .@{ant-prefix}-cascader-picker-focused:last-child .@{ant-prefix}-input,
2017-12-06 10:54:20 +00:00
& > .@{ant-prefix}-mention-wrapper:last-child .@{ant-prefix}-mention-editor,
& > .@{ant-prefix}-time-picker:last-child .@{ant-prefix}-time-picker-input {
border-top-right-radius: @border-radius-base;
border-bottom-right-radius: @border-radius-base;
2019-01-02 13:01:56 +00:00
border-right-width: @border-width-base;
2018-11-14 13:33:56 +00:00
}
// https://github.com/ant-design/ant-design/issues/12493
& > .@{ant-prefix}-select-auto-complete .@{ant-prefix}-input {
vertical-align: top;
2017-12-06 10:54:20 +00:00
}
}
}
.input-affix-wrapper(@inputClass) {
position: relative;
display: inline-block;
width: 100%;
&:hover .@{inputClass}:not(.@{inputClass}-disabled) {
.hover();
}
update to antd3.8.3 (#159) * refactor: align * feat: update align to 2.4.3 * feat: update trigger 2.5.4 * feat: update tooltip 3.7.2 * fix: align * feat: update vc-calendar to 9.6.2 * feat: update vc-checkbox to 2.1.5 * feat: update vc-dialog to 7.1.8 * feat: update vc-from to 2.2.1 * feat: update vc-notification to 3.1.1 * test: update snapshots * feat: update vc-tree to 1.12.6 * feat: update vc-table to 6.2.8 * feat: update vc-upload to 2.5.1 * feat: update vc-input-number to 4.0.12 * feat: update vc-tabs to 9.2.6 * refactor: vc-menu * refactor: update vc-menu to 7.0.5 * style: remove unused * feat: update pagination to 1.16.5 * feat: add vc-progress 2.2.5 tag * feat: add vc-rate 2.4.0 tag * feat: update vc-slider to 8.6.1 * fix: tooltip error * style: delete conosle * feat: update vc-steps to 3.1.1 * add vc-switch tag 1.6.0 * feat: update upload to 2.5.1 * fix: update vc-menu * fix: update store * fix: add ref dir * fix: trigger mock shouldComponentUpdate * fix: update vc-select * revert: trigger lazyrenderbox * fix: update vc-select * fix: update vc-select * fix: update vc-select * fix: update vc-menu * fix: update vc-slick ref * update style to 3.8.2 * test: update snapshots * update vc-select * update util & affix * feat: add drawer * fix: support title add slot mode * test: update affix test * update alert * update anchor * update snapshots * fix: doc and vc-drawer * update select & auto-complete * update back-top & grid * feractor: avatar * test: add drawer test * update badge * update button * update card * update divider * feat: update vc-tabs to 9.3.6 and tabs * add afterEnter callback * update form * fix: update drawer * test: update snapshots * update modal & notification * test: update snapshots * update message * update locale-provider * update dropdown * update layout popconfirm popover * update time-picker * update menu * update date-picker * docs: update input docs * update input * update snapshots * update table * update test snapshots * feat: update progress * update checkbox * feat: update spin * update radio * docs: slider steps timeline * update list * update transfer * update collapse * update cascader * update upload
2018-09-05 13:28:54 +00:00
.@{inputClass} {
2019-01-02 13:01:56 +00:00
position: relative;
update to antd3.8.3 (#159) * refactor: align * feat: update align to 2.4.3 * feat: update trigger 2.5.4 * feat: update tooltip 3.7.2 * fix: align * feat: update vc-calendar to 9.6.2 * feat: update vc-checkbox to 2.1.5 * feat: update vc-dialog to 7.1.8 * feat: update vc-from to 2.2.1 * feat: update vc-notification to 3.1.1 * test: update snapshots * feat: update vc-tree to 1.12.6 * feat: update vc-table to 6.2.8 * feat: update vc-upload to 2.5.1 * feat: update vc-input-number to 4.0.12 * feat: update vc-tabs to 9.2.6 * refactor: vc-menu * refactor: update vc-menu to 7.0.5 * style: remove unused * feat: update pagination to 1.16.5 * feat: add vc-progress 2.2.5 tag * feat: add vc-rate 2.4.0 tag * feat: update vc-slider to 8.6.1 * fix: tooltip error * style: delete conosle * feat: update vc-steps to 3.1.1 * add vc-switch tag 1.6.0 * feat: update upload to 2.5.1 * fix: update vc-menu * fix: update store * fix: add ref dir * fix: trigger mock shouldComponentUpdate * fix: update vc-select * revert: trigger lazyrenderbox * fix: update vc-select * fix: update vc-select * fix: update vc-select * fix: update vc-menu * fix: update vc-slick ref * update style to 3.8.2 * test: update snapshots * update vc-select * update util & affix * feat: add drawer * fix: support title add slot mode * test: update affix test * update alert * update anchor * update snapshots * fix: doc and vc-drawer * update select & auto-complete * update back-top & grid * feractor: avatar * test: add drawer test * update badge * update button * update card * update divider * feat: update vc-tabs to 9.3.6 and tabs * add afterEnter callback * update form * fix: update drawer * test: update snapshots * update modal & notification * test: update snapshots * update message * update locale-provider * update dropdown * update layout popconfirm popover * update time-picker * update menu * update date-picker * docs: update input docs * update input * update snapshots * update table * update test snapshots * feat: update progress * update checkbox * feat: update spin * update radio * docs: slider steps timeline * update list * update transfer * update collapse * update cascader * update upload
2018-09-05 13:28:54 +00:00
}
2017-12-06 10:54:20 +00:00
.@{inputClass}-prefix,
.@{inputClass}-suffix {
position: absolute;
top: 50%;
2019-01-02 13:01:56 +00:00
z-index: 2;
2017-12-06 10:54:20 +00:00
transform: translateY(-50%);
line-height: 0;
color: @input-color;
2018-04-07 06:29:59 +00:00
:not(.anticon) {
line-height: @line-height-base;
}
2017-12-06 10:54:20 +00:00
}
.@{inputClass}-prefix {
2018-01-15 10:54:26 +00:00
left: @input-padding-horizontal-base + 1px;
2017-12-06 10:54:20 +00:00
}
.@{inputClass}-suffix {
2018-01-15 10:54:26 +00:00
right: @input-padding-horizontal-base + 1px;
2017-12-06 10:54:20 +00:00
}
.@{inputClass}:not(:first-child) {
padding-left: @input-padding-horizontal-base + @input-affix-width;
}
.@{inputClass}:not(:last-child) {
padding-right: @input-padding-horizontal-base + @input-affix-width;
}
}