diff --git a/__snapshots__/calendar.md b/__snapshots__/calendar.md
index c18dbf179..545f63aee 100644
--- a/__snapshots__/calendar.md
+++ b/__snapshots__/calendar.md
@@ -12,11 +12,11 @@
role="columnheader"
tabindex="-1"
>
-
+
+
-
-
-
-
-
- 27
-
-
- dom.
-
-
-
-
-
-
-
-
- 28
-
-
- seg.
-
-
-
-
-
-
-
-
- 29
-
-
- ter.
-
-
-
-
-
-
-
-
- 30
-
-
- qua.
-
-
-
-
-
-
-
-
- 31
-
-
- qui.
-
-
-
-
-
-
-
-
- 01
-
-
- sex.
-
-
-
-
-
-
-
-
- 02
-
-
- sáb.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-```
-
#### `should match snapshot of 24h timekeeping system`
```html
@@ -1638,11 +1232,11 @@
role="columnheader"
tabindex="-1"
>
- em {
- position: absolute;
font: inherit;
- @supports (inset: 0) {
- inset-inline-start: 0;
- }
- @supports not (inset: 0) {
- left: 0;
- }
+ justify-self: flex-start;
+
}
+
> small {
@include typography.typography-cat-shorthand('caption');
text-transform: uppercase;
}
}
}
-}
+}
.calendar-row {
display: contents;
}
@@ -128,11 +148,7 @@ ol {
position: relative;
grid-column: var(--column);
grid-row: 1 / #{calendar-variables.$total-rows + 1};
- @for $i from 1 through calendar-variables.$total-columns {
- &:nth-child(#{$i}) {
- --column: #{$i};
- }
- }
+
&:not(:first-child)::after {
position: absolute;
block-size: 100%;
@@ -140,6 +156,11 @@ ol {
content: '';
margin-inline-start: -1px;
}
+ @for $i from 1 through calendar-variables.$total-columns {
+ &:nth-child(#{$i}) {
+ --column: #{$i};
+ }
+ }
}
}
diff --git a/components/calendar/src/vwc-calendar.ts b/components/calendar/src/vwc-calendar.ts
index d5b99ad80..1e9a1a736 100644
--- a/components/calendar/src/vwc-calendar.ts
+++ b/components/calendar/src/vwc-calendar.ts
@@ -112,8 +112,16 @@ export class VWCCalendar extends LitElement {
getEventContext = getEventContext.bind(this);
+ @property({
+ reflect: true,
+ type: Boolean
+ }) stickyHeader?: boolean;
+
+
private getDaysArr(dateArr: Date[]): Date[] {
- if (dateArr.length == this.#daysLength) { return dateArr; }
+ if (dateArr.length == this.#daysLength) {
+ return dateArr;
+ }
const lastDate = new Date(dateArr[dateArr.length - 1]);
lastDate.setDate(lastDate.getDate() + 1);
const concatenatedDateArr = [...dateArr, lastDate];
@@ -158,6 +166,7 @@ export class VWCCalendar extends LitElement {
el?.focus();
}
+
private onKeydown(event: KeyboardEvent) {
const isArrow = [ARROW_UP, ARROW_RIGHT, ARROW_DOWN, ARROW_LEFT].includes(event.key);
isArrow && this.arrowKeysInteractions(event);
@@ -168,7 +177,8 @@ export class VWCCalendar extends LitElement {
return repeat(
Array.from({ length }),
- () => html`
`
+ () => html`
+
`
);
}
@@ -192,20 +202,25 @@ export class VWCCalendar extends LitElement {
protected renderDays(): TemplateResult {
return html`
- ${this.getDaysArr([getFirstDateOfTheWeek(this.datetime)]).map(date => html`
-
-
-
-
-
- ${new Intl.DateTimeFormat(this.locales, { day: '2-digit' }).format(date)}
-
-
- ${new Intl.DateTimeFormat(this.locales, { weekday: 'short' }).format(date)}
-
-
-
-
`)}
+ ${this.getDaysArr([getFirstDateOfTheWeek(this.datetime)])
+ .map(date => html`
+
+
+
+
+
+ ${new Intl.DateTimeFormat(this.locales, { day: '2-digit' }).format(date)}
+
+
+ ${new Intl.DateTimeFormat(this.locales, { weekday: 'short' }).format(date)}
+
+
+
+ `)}
`;
}
@@ -217,13 +232,21 @@ export class VWCCalendar extends LitElement {
return html`
`;
}
+
/**
* the html markup
* @internal
@@ -232,7 +255,7 @@ export class VWCCalendar extends LitElement {
return html`
${this.renderDays()}
-
+
${this.renderHours()}
diff --git a/components/calendar/test/calendar.test.js b/components/calendar/test/calendar.test.js
index aba06be85..c796bbc2b 100644
--- a/components/calendar/test/calendar.test.js
+++ b/components/calendar/test/calendar.test.js
@@ -226,11 +226,10 @@ describe('calendar', () => {
let context;
el.addEventListener('click', e => context = el.getEventContext(e));
-
gridCell.dispatchEvent(new MouseEvent('click', { composed: true, clientX: 20, clientY: 54 }));
expect(context.day).to.equal(2);
- expect(context.hour).to.equal(0.53);
+ expect(context.hour).to.equal(0.2);
});
it('should return day and hour from keyboard \'space\'', async () => {
diff --git a/ui-tests/snapshots/vwc-calendar.png b/ui-tests/snapshots/vwc-calendar.png
index 644874b7d..3ae801306 100644
Binary files a/ui-tests/snapshots/vwc-calendar.png and b/ui-tests/snapshots/vwc-calendar.png differ