@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
419 lines (418 loc) • 14.5 kB
CSS
/*
* DatePicker component
*
*/
/*
* Utilities
*/
.dnb-date-picker {
--date-picker-input-height: 2rem;
--date-picker-day-width: 2rem;
--date-picker-day-horizontal-spacing: 4px;
display: inline-flex;
align-items: center;
column-gap: var(--spacing-small);
font-size: var(--font-size-small);
line-height: var(--line-height-basis);
}
.dnb-date-picker__inner {
display: inline-flex;
flex-direction: column;
line-height: var(--date-picker-input-height);
}
.dnb-date-picker__row {
display: inline-flex;
}
.dnb-date-picker__shell {
position: relative;
top: 0;
display: inline-flex;
flex-direction: column;
}
.dnb-date-picker__input__wrapper {
display: inline-flex;
white-space: nowrap;
height: inherit;
}
.dnb-date-picker__triangle {
pointer-events: none;
position: absolute;
top: calc(2px - var(--date-picker-input-height) / 2);
left: 0;
right: auto;
margin: 0 1.5rem;
width: calc(var(--date-picker-input-height) / 2);
height: calc(var(--date-picker-input-height) / 2);
overflow: hidden;
}
.dnb-date-picker__triangle::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: calc(var(--date-picker-input-height) / 2);
height: calc(var(--date-picker-input-height) / 2);
transform: translateY(60%) rotate(45deg);
border: 1px solid var(--color-black-border);
background-color: var(--color-white);
}
.dnb-date-picker__container {
width: -webkit-min-content;
width: min-content;
position: relative;
top: auto;
}
.dnb-date-picker__container table {
position: relative;
z-index: 1;
margin: 0;
}
.dnb-date-picker__container table.dnb-no-focus:focus {
outline: none;
}
html[data-whatinput=keyboard] .dnb-date-picker__container table.dnb-no-focus:focus {
--border-color: var(--focus-ring-color);
--border-width: var(--focus-ring-width);
box-shadow: 0 0 0 var(--border-width) var(--border-color);
border-color: transparent;
}
.dnb-date-picker__container:not(.dnb-date-picker__container--show-footer) .dnb-date-picker__calendar::after {
content: none;
}
.dnb-date-picker__input,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input, .dnb-core-style .dnb-date-picker__input {
display: inline-block;
width: auto;
margin: 0;
padding: 0 0.125rem;
transform: translateY(0);
outline: none;
font-family: var(--font-family-monospace);
text-align: center;
border: none;
background: transparent;
overflow: visible;
white-space: nowrap;
}
@supports (-webkit-appearance: none) and (not (overflow: -webkit-marquee)) and (not (-ms-ime-align: auto)) and (not (-moz-appearance: none)) {
.dnb-date-picker__input,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input, .dnb-core-style .dnb-date-picker__input {
margin: 0 -4px;
}
}
@supports (-ms-ime-align: auto) {
.dnb-date-picker__input,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input, .dnb-core-style .dnb-date-picker__input {
margin: 0 -5px;
}
}
@supports (-webkit-touch-callout: none) {
.dnb-date-picker__input:not(*:root),
.dnb-date-picker .dnb-input__input.dnb-date-picker__input:not(*:root), .dnb-core-style .dnb-date-picker__input:not(*:root) {
margin: 0;
}
.dnb-date-picker__input,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input, .dnb-core-style .dnb-date-picker__input {
text-indent: -2px;
}
}
@supports (-webkit-appearance: none) and (stroke-color: transparent) and (not (-webkit-touch-callout: none)) {
.dnb-date-picker__input:not(*:root),
.dnb-date-picker .dnb-input__input.dnb-date-picker__input:not(*:root), .dnb-core-style .dnb-date-picker__input:not(*:root) {
margin: 0 -4px;
}
.dnb-date-picker__input:first-of-type:not(*:root),
.dnb-date-picker .dnb-input__input.dnb-date-picker__input:first-of-type:not(*:root), .dnb-core-style .dnb-date-picker__input:first-of-type:not(*:root) {
margin-left: 0.8rem;
}
.dnb-date-picker__input:last-of-type:not(*:root),
.dnb-date-picker .dnb-input__input.dnb-date-picker__input:last-of-type:not(*:root), .dnb-core-style .dnb-date-picker__input:last-of-type:not(*:root) {
margin-right: 2.2rem;
}
}
.dnb-date-picker__input--small.dnb-date-picker__input--small, .dnb-date-picker__input--small .dnb-date-picker .dnb-input__input.dnb-date-picker__input--small, .dnb-core-style .dnb-date-picker__input--small--has-submit-element .dnb-date-picker__input--small__input,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input--small.dnb-date-picker__input--small,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input--small .dnb-date-picker .dnb-input__input.dnb-date-picker__input--small,
.dnb-core-style .dnb-date-picker__input--small--has-submit-element .dnb-date-picker .dnb-input__input.dnb-date-picker__input--small__input, .dnb-core-style .dnb-date-picker__input--small.dnb-date-picker__input--small, .dnb-core-style .dnb-date-picker__input--small .dnb-date-picker .dnb-input__input.dnb-date-picker__input--small, .dnb-core-style .dnb-date-picker__input--small--has-submit-element .dnb-core-style .dnb-date-picker__input--small__input {
padding-right: 0.125rem;
}
.dnb-date-picker__input--small:last-of-type:not(*:root),
.dnb-date-picker .dnb-input__input.dnb-date-picker__input--small:last-of-type:not(*:root), .dnb-core-style .dnb-date-picker__input--small:last-of-type:not(*:root) {
margin-right: 2.2rem;
}
.dnb-date-picker__input--medium.dnb-date-picker__input--medium, .dnb-date-picker__input--medium .dnb-date-picker .dnb-input__input.dnb-date-picker__input--medium, .dnb-core-style .dnb-date-picker__input--medium--has-submit-element .dnb-date-picker__input--medium__input,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input--medium.dnb-date-picker__input--medium,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input--medium .dnb-date-picker .dnb-input__input.dnb-date-picker__input--medium,
.dnb-core-style .dnb-date-picker__input--medium--has-submit-element .dnb-date-picker .dnb-input__input.dnb-date-picker__input--medium__input, .dnb-core-style .dnb-date-picker__input--medium.dnb-date-picker__input--medium, .dnb-core-style .dnb-date-picker__input--medium .dnb-date-picker .dnb-input__input.dnb-date-picker__input--medium, .dnb-core-style .dnb-date-picker__input--medium--has-submit-element .dnb-core-style .dnb-date-picker__input--medium__input {
padding-right: 0.125rem;
}
.dnb-date-picker__input--medium:last-of-type:not(*:root),
.dnb-date-picker .dnb-input__input.dnb-date-picker__input--medium:last-of-type:not(*:root), .dnb-core-style .dnb-date-picker__input--medium:last-of-type:not(*:root) {
margin-right: 3.2rem;
}
.dnb-date-picker__input--large.dnb-date-picker__input--large, .dnb-date-picker__input--large .dnb-date-picker .dnb-input__input.dnb-date-picker__input--large, .dnb-core-style .dnb-date-picker__input--large--has-submit-element .dnb-date-picker__input--large__input,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input--large.dnb-date-picker__input--large,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input--large .dnb-date-picker .dnb-input__input.dnb-date-picker__input--large,
.dnb-core-style .dnb-date-picker__input--large--has-submit-element .dnb-date-picker .dnb-input__input.dnb-date-picker__input--large__input, .dnb-core-style .dnb-date-picker__input--large.dnb-date-picker__input--large, .dnb-core-style .dnb-date-picker__input--large .dnb-date-picker .dnb-input__input.dnb-date-picker__input--large, .dnb-core-style .dnb-date-picker__input--large--has-submit-element .dnb-core-style .dnb-date-picker__input--large__input {
padding-right: 0.125rem;
}
.dnb-date-picker__input--large:last-of-type:not(*:root),
.dnb-date-picker .dnb-input__input.dnb-date-picker__input--large:last-of-type:not(*:root), .dnb-core-style .dnb-date-picker__input--large:last-of-type:not(*:root) {
margin-right: 4rem;
}
.dnb-date-picker__input--label-alignment-right,
.dnb-date-picker .dnb-input__input.dnb-date-picker__input--label-alignment-right, .dnb-core-style .dnb-date-picker__input--label-alignment-right {
flex-flow: row-reverse;
width: -webkit-fit-content;
width: fit-content;
}
.dnb-date-picker .dnb-input__input.dnb-date-picker__input:first-of-type, .dnb-date-picker__input:first-of-type {
margin-left: 0.8rem;
}
.dnb-date-picker .dnb-input__input.dnb-date-picker__input:last-of-type, .dnb-date-picker__input:last-of-type {
margin-right: 2.2rem;
}
.dnb-date-picker .dnb-input__shell {
display: none;
}
.dnb-date-picker--show-input .dnb-input__shell {
display: flex;
}
.dnb-date-picker:not(.dnb-date-picker--show-input) .dnb-input__status--error .dnb-input__shell {
box-shadow: none;
}
.dnb-input__submit-button button:focus ~ .dnb-date-picker__input__wrapper {
display: block;
}
.dnb-date-picker:not(.dnb-date-picker--show-input) .dnb-input__submit-element, .dnb-input__submit-element > .dnb-date-picker .dnb-input__submit-element {
margin-left: 0;
}
.dnb-date-picker__views {
display: flex;
-webkit-user-select: none;
user-select: none;
}
@media screen and (max-width: 60em) {
.dnb-date-picker__views {
flex-direction: column;
}
}
.dnb-date-picker__calendar {
position: relative;
padding: 1rem;
}
.dnb-date-picker__calendar::after {
content: "";
position: absolute;
bottom: 0;
width: calc(100% - 2rem);
height: 1px;
}
.dnb-date-picker__header {
min-height: 2.5rem;
line-height: var(--line-height-basis);
-webkit-user-select: text;
user-select: text;
}
.dnb-date-picker__addon, .dnb-date-picker__header {
position: relative;
display: flex;
justify-content: space-between;
padding-bottom: 1rem;
}
.dnb-date-picker__addon::after, .dnb-date-picker__header::after {
content: "";
position: absolute;
bottom: 0;
width: 100%;
height: 1px;
}
.dnb-date-picker__addon {
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
gap: 1rem;
padding: 1rem;
}
.dnb-date-picker__addon::after {
left: 1rem;
width: calc(100% - 2rem);
}
.dnb-date-picker__footer {
position: relative;
display: flex;
justify-content: space-between;
padding: 1rem;
}
.dnb-date-picker__labels__day {
padding-top: 1.5rem;
padding-bottom: 0.5rem;
}
.dnb-date-picker__labels, .dnb-date-picker__days {
min-width: 18rem;
max-width: 18rem;
display: flex;
flex-wrap: wrap;
margin: 0;
padding: 0;
list-style: none;
}
.dnb-date-picker__day, .dnb-date-picker__labels__day {
display: flex;
flex-basis: 14.2857142857%;
justify-content: center;
}
.dnb-date-picker__day {
position: relative;
width: var(--date-picker-day-width);
height: var(--date-picker-day-width);
margin: var(--date-picker-day-horizontal-spacing) 0;
}
.dnb-date-picker__day .dnb-button {
position: absolute;
top: 0;
width: var(--date-picker-day-width);
height: var(--date-picker-day-width);
white-space: nowrap;
box-shadow: none;
}
.dnb-date-picker__day .dnb-button__bounding {
border-radius: 0;
transform: scale(1.28);
}
.dnb-date-picker__day .dnb-button__text {
transform: translateY(0);
}
.dnb-date-picker__day--selectable:hover {
z-index: 2;
}
.dnb-date-picker__day--start-date .dnb-button, .dnb-date-picker__day--end-date .dnb-button {
z-index: 1;
}
.dnb-date-picker__day--start-date, .dnb-date-picker__day--end-date {
position: relative;
}
.dnb-date-picker__day--start-date::after, .dnb-date-picker__day--end-date::after {
content: "";
position: absolute;
top: 0;
width: calc(var(--date-picker-day-width) / 2);
height: 100%;
}
.dnb-date-picker__day--start-date::after {
left: auto;
right: 0;
}
.dnb-date-picker__day--end-date::after {
left: 0;
right: auto;
}
.dnb-date-picker__day--start-date.dnb-date-picker__day--end-date::after {
content: none;
}
.dnb-date-picker .rtl {
direction: rtl;
}
.dnb-date-picker .rtl .dnb-date-picker__prev::before {
transform: scaleX(-1);
}
.dnb-date-picker .rtl .dnb-date-picker__next::before {
transform: scaleX(-1);
}
.dnb-date-picker__inner > .dnb-form-status {
order: 2;
margin-top: 0.5rem;
}
.dnb-date-picker--vertical {
display: flex;
align-items: flex-start;
flex-direction: column;
}
.dnb-date-picker > .dnb-form-label {
line-height: var(--line-height-basis);
margin-right: 0;
}
@media screen and (max-width: 40em) {
.dnb-date-picker {
flex-wrap: wrap;
}
.dnb-date-picker > .dnb-form-label {
margin-bottom: 0.5rem;
margin-top: 0.5rem;
}
}
.dnb-date-picker--stretch {
display: flex;
flex-grow: 1;
}
.dnb-date-picker--stretch .dnb-date-picker__inner, .dnb-date-picker--stretch .dnb-date-picker__shell {
width: 100%;
}
.dnb-form-row--horizontal .dnb-date-picker--stretch {
width: 100%;
}
.dnb-date-picker:not(.dnb-date-picker--vertical)[class*=__status] {
align-items: flex-start;
}
.dnb-date-picker:not(.dnb-date-picker--vertical)[class*=__status] > .dnb-form-label {
margin-top: 0.25rem;
}
.dnb-date-picker:not(.dnb-date-picker--show-input) .dnb-input__submit-button .dnb-button {
border-radius: 50%;
}
@media screen and (max-width: 40em) {
.dnb-responsive-component .dnb-date-picker {
display: flex;
flex-direction: column;
align-items: flex-start;
margin-bottom: 0.5rem;
}
.dnb-responsive-component .dnb-date-picker > .dnb-form-label {
margin-bottom: 0.5rem;
}
.dnb-responsive-component .dnb-date-picker__helper {
display: none;
}
}
.dnb-date-picker .dnb-input__submit-button .dnb-button.dnb-skeleton {
visibility: hidden;
}
.dnb-date-picker__fieldset:not([class*=space__top]), .dnb-core-style .dnb-date-picker__fieldset:not([class*=space__top]) {
margin-top: 0;
}
.dnb-date-picker__fieldset:not([class*=space__bottom]), .dnb-core-style .dnb-date-picker__fieldset:not([class*=space__bottom]) {
margin-bottom: 0;
}
.dnb-date-picker__fieldset:not([class*=space__left]), .dnb-core-style .dnb-date-picker__fieldset:not([class*=space__left]) {
margin-left: 0;
}
.dnb-date-picker__fieldset:not([class*=space__right]), .dnb-core-style .dnb-date-picker__fieldset:not([class*=space__right]) {
margin-right: 0;
}
.dnb-date-picker__fieldset, .dnb-core-style .dnb-date-picker__fieldset {
padding: 0;
border: none;
}
.dnb-date-picker__portal {
--date-picker-input-height: 2rem;
--date-picker-day-width: 2rem;
--date-picker-day-horizontal-spacing: 4px;
--popover-z-index: calc(var(--modal-z-index) + 10);
line-height: var(--date-picker-input-height);
}
@keyframes date-picker-slide-down {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes date-picker-slide-up {
from {
opacity: 1;
}
to {
opacity: 0;
}
}