ant-design/components/date-picker/style/index.less

287 lines
6.4 KiB
Plaintext

@import '../../style/themes/index';
@import '../../style/mixins/index';
@import '../../input/style/mixin';
@import './panel';
@picker-prefix-cls: ~'@{ant-prefix}-picker';
@picker-text-height: 40px;
.@{picker-prefix-cls} {
@vertical-fix-base: @input-height-base - ceil(@font-size-base * @line-height-base) - 2 *
@input-padding-vertical-base - 2 * @border-width-base;
@vertical-fix-lg: @input-height-lg - ceil(@font-size-lg * @line-height-base) - 2 *
@input-padding-vertical-lg - 2 * @border-width-base;
@vertical-fix-sm: @input-height-sm - ceil(@font-size-base * @line-height-base) - 2 *
@input-padding-vertical-sm - 2 * @border-width-base;
@arrow-size: 10px;
.reset-component;
display: inline-flex;
padding: @input-padding-vertical-base @input-padding-horizontal-base @input-padding-vertical-base +
@vertical-fix-base;
background: @component-background;
border: @border-width-base @border-style-base @select-border-color;
border-radius: @border-radius-base;
transition: border @animation-duration-slow, box-shadow @animation-duration-slow;
&:hover,
&-focused {
.hover();
}
&-focused {
.active();
}
&&-disabled {
background: @input-disabled-bg;
border-color: @select-border-color;
}
// ======================== Input =========================
&-input {
position: relative;
display: inline-flex;
width: 100%;
> input {
.input();
flex: auto;
// Fix Firefox flex not correct:
// https://github.com/ant-design/ant-design/pull/20023#issuecomment-564389553
min-width: 1px;
height: auto;
padding: 0;
background: transparent;
border: 0;
&:focus {
box-shadow: none;
}
&[disabled] {
background: transparent;
}
}
&:hover {
.@{picker-prefix-cls}-clear {
opacity: 1;
}
}
}
// Size
&-large {
padding: @input-padding-vertical-lg @input-padding-horizontal-lg @input-padding-vertical-lg +
@vertical-fix-lg;
.@{picker-prefix-cls}-input > input {
font-size: @font-size-lg;
}
}
&-small {
padding: @input-padding-vertical-sm @input-padding-horizontal-sm @input-padding-vertical-sm +
@vertical-fix-sm;
}
&-suffix {
align-self: center;
margin-left: @padding-xs / 2;
color: @disabled-color;
pointer-events: none;
}
&-clear {
position: absolute;
top: 50%;
right: 0;
color: @disabled-color;
background: @component-background;
transform: translateY(-50%);
cursor: pointer;
opacity: 0;
transition: opacity @animation-duration-slow, color @animation-duration-slow;
&:hover {
color: @text-color-secondary;
}
}
&-separator {
display: inline-block;
align-self: center;
width: 2em;
height: @font-size-lg;
color: @disabled-color;
font-size: @font-size-lg;
line-height: @font-size-lg;
text-align: center;
}
// ======================== Range =========================
&-range {
position: relative;
display: inline-flex;
// Clear
.@{picker-prefix-cls}-clear {
right: @input-padding-horizontal-base;
}
&:hover {
.@{picker-prefix-cls}-clear {
opacity: 1;
}
}
// Active bar
.@{picker-prefix-cls}-active-bar {
bottom: -@border-width-base;
height: 2px;
margin-left: @input-padding-horizontal-base;
background: @primary-color;
opacity: 0;
transition: all @animation-duration-slow ease-out;
pointer-events: none;
}
&.@{picker-prefix-cls}-focused {
.@{picker-prefix-cls}-active-bar {
opacity: 1;
}
}
}
// ======================= Dropdown =======================
&-dropdown {
.reset-component;
position: absolute;
z-index: @zindex-picker;
&-hidden {
display: none;
}
&-placement-bottomLeft {
.@{picker-prefix-cls}-range-arrow {
top: @arrow-size / 2 - @arrow-size / 3;
display: block;
transform: rotate(-45deg);
}
}
&-placement-topLeft {
.@{picker-prefix-cls}-range-arrow {
bottom: @arrow-size / 2 - @arrow-size / 3;
display: block;
transform: rotate(135deg);
}
}
}
&-dropdown-range {
padding: (@arrow-size * 2 / 3) 0;
&-hidden {
display: none;
}
}
// Time picker with additional style
&-dropdown &-panel > &-time-panel {
padding-top: @padding-xs / 2;
}
// ======================== Ranges ========================
&-ranges {
padding: @padding-xs / 2 @padding-sm;
overflow: hidden;
line-height: @picker-text-height - 2 * @border-width-base - @padding-xs / 2;
text-align: left;
list-style: none;
> li {
display: inline-block;
}
.@{picker-prefix-cls}-preset {
cursor: pointer;
}
.@{picker-prefix-cls}-ok {
float: right;
margin-left: @padding-xs;
}
}
&-range-wrapper {
display: flex;
}
&-range-arrow {
position: absolute;
z-index: 1;
display: none;
width: @arrow-size;
height: @arrow-size;
margin-left: @input-padding-horizontal-base * 1.5;
transition: left @animation-duration-slow ease-out;
// .@{picker-prefix-cls}-time-range-wrapper & {
// display: none !important;
// }
&::before,
&::after {
position: absolute;
content: '';
}
&::before {
top: 0;
right: 0;
width: @arrow-size;
height: @arrow-size;
border: @arrow-size / 2 solid @border-color-split;
border-color: @border-color-split @border-color-split transparent transparent;
}
&::after {
top: @border-width-base;
right: @border-width-base;
width: @arrow-size;
height: @arrow-size;
border: @arrow-size / 2 solid @border-color-split;
border-color: @calendar-bg @calendar-bg transparent transparent;
}
}
&-panel-container {
overflow: hidden;
vertical-align: top;
background: @calendar-bg;
border-radius: @border-radius-base;
box-shadow: @box-shadow-base;
transition: margin @animation-duration-slow;
.@{picker-prefix-cls}-panels {
display: inline-flex;
flex-wrap: nowrap;
}
.@{picker-prefix-cls}-panel {
vertical-align: top;
background: transparent;
border-width: 0 0 @border-width-base 0;
border-radius: 0;
&-focused {
border-color: @border-color-split;
}
}
}
}