Skip to content

Commit ecf4bce

Browse files
authored
refactor: update date-picker overlay content to use base styles (#10087)
1 parent d6c8ec4 commit ecf4bce

File tree

4 files changed

+12
-40
lines changed

4 files changed

+12
-40
lines changed

packages/date-picker/src/vaadin-date-picker-overlay-content.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ class DatePickerOverlayContent extends DatePickerOverlayContentMixin(
3333
return overlayContentStyles;
3434
}
3535

36+
static get lumoInjector() {
37+
return {
38+
includeBaseStyles: true,
39+
};
40+
}
41+
3642
/** @protected */
3743
render() {
3844
return html`
19 Bytes
Loading
7 Bytes
Loading

packages/vaadin-lumo-styles/src/components/date-picker-overlay-content.css

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
*/
66
@media lumo_components_date-picker-overlay-content {
77
:host {
8-
display: grid;
9-
grid-template-areas:
10-
'header header'
11-
'months years'
12-
'toolbar years';
13-
grid-template-columns: minmax(0, 1fr) 0;
14-
height: 100%;
15-
outline: none;
16-
position: relative;
178
/* Background for the year scroller, placed here as we are using a mask image on the actual years part */
189
background-image: linear-gradient(var(--lumo-shade-5pct), var(--lumo-shade-5pct));
1910
background-size: 57px 100%;
@@ -26,18 +17,6 @@
2617
background-position: top left;
2718
}
2819

29-
:host([desktop]) {
30-
grid-template-columns: minmax(0, 1fr) auto;
31-
}
32-
33-
:host([fullscreen][years-visible]) {
34-
grid-template-columns: minmax(0, 1fr) auto;
35-
}
36-
37-
[hidden] {
38-
display: none !important;
39-
}
40-
4120
::slotted([slot='months']) {
4221
/* Month calendar height:
4322
header height + margin-bottom
@@ -55,17 +34,15 @@
5534
);
5635
--vaadin-infinite-scroller-buffer-offset: 10%;
5736
mask-image: linear-gradient(transparent, #000 10%, #000 85%, transparent);
58-
position: relative;
5937
}
6038

6139
::slotted([slot='years']) {
6240
/* TODO get rid of fixed magic number */
6341
--vaadin-infinite-scroller-buffer-width: 57px;
6442
width: 57px;
65-
height: auto;
66-
top: 0;
67-
bottom: 0;
6843
font-size: var(--lumo-font-size-s);
44+
border: none;
45+
background: transparent;
6946
box-shadow: inset 2px 0 4px 0 var(--lumo-shade-5pct);
7047
mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
7148
cursor: var(--lumo-clickable-cursor);
@@ -79,43 +56,34 @@
7956
--_lumo-date-picker-year-opacity: 1;
8057
}
8158

82-
:host([desktop]) ::slotted([slot='years']),
83-
:host([years-visible]) ::slotted([slot='years']) {
84-
visibility: visible;
85-
}
86-
8759
/* Year scroller position indicator */
8860
::slotted([slot='years'])::before {
8961
border: none;
9062
width: 1em;
9163
height: 1em;
9264
background-color: var(--lumo-base-color);
9365
background-image: linear-gradient(var(--lumo-tint-5pct), var(--lumo-tint-5pct));
94-
transform: translate(-75%, -50%) rotate(45deg);
9566
border-top-right-radius: var(--lumo-border-radius-s);
9667
box-shadow: 2px -2px 6px 0 var(--lumo-shade-5pct);
97-
z-index: 1;
68+
translate: -75% -50%;
9869
}
9970

10071
:host([dir='rtl']) ::slotted([slot='years'])::before {
101-
right: 0;
102-
transform: translate(75%, -50%) rotate(45deg);
72+
border-bottom-left-radius: var(--lumo-border-radius-s);
73+
translate: 75% -50%;
10374
}
10475

10576
[part='toolbar'] {
106-
display: flex;
107-
grid-area: toolbar;
108-
justify-content: space-between;
10977
padding: var(--lumo-space-s);
11078
border-bottom-left-radius: var(--lumo-border-radius-l);
11179
}
11280

11381
/* Narrow viewport mode (fullscreen) */
11482

11583
:host([fullscreen]) [part='toolbar'] {
116-
grid-area: header;
11784
margin-inline-end: 57px;
11885
background-color: var(--lumo-base-color);
86+
border: none;
11987
}
12088

12189
[part='toolbar'] ::slotted(vaadin-button) {
@@ -125,8 +93,6 @@
12593
/* Very narrow screen (year scroller initially hidden) */
12694

12795
[part='years-toggle-button'] {
128-
display: flex;
129-
align-items: center;
13096
height: var(--lumo-size-m);
13197
padding: 0 0.5em;
13298
border-radius: var(--lumo-border-radius-m);

0 commit comments

Comments
 (0)