Skip to content

Commit

Permalink
feat(datepicker): add css variables to wrapper class
Browse files Browse the repository at this point in the history
  • Loading branch information
dilandoogan committed Dec 2, 2024
1 parent c68d007 commit cb11c42
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/components/calendar/bl-calendar.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

.calendar-content {
display: flex;
padding: var(--bl-size-s);
padding: var(--bl-size-m);
flex-direction: column;
align-items: center;
gap: var(--bl-size-s);
gap: var(--bl-size-m);
border-radius: var(--bl-border-radius-s);
width: fit-content;
background: var(--bl-color-neutral-full);
Expand Down
12 changes: 6 additions & 6 deletions src/components/calendar/bl-calendar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,13 @@ describe("bl-calendar", () => {


it("should add range-start-day class to the start date element", async () => {
element._selectedDates = [new Date(2024, 10, 1),
new Date(2024, 10, 5)
element._selectedDates = [new Date(element.today.getFullYear(), element.today.getMonth(), 1),
new Date(element.today.getFullYear(), element.today.getMonth(), 5)
];

element.setHoverClass();

await new Promise((resolve) => setTimeout(resolve, 100));
await new Promise((resolve) => setTimeout(resolve, 200));
const startDateElement = element.shadowRoot?.getElementById(
`${element._selectedDates[0]?.getTime()}`
)?.parentElement;
Expand All @@ -418,12 +418,12 @@ describe("bl-calendar", () => {
});

it("should add range-end-day class to the end date element", async () => {
element._selectedDates = [new Date(2024, 10, 1),
new Date(2024, 10, 5)
element._selectedDates = [new Date(element.today.getFullYear(), element.today.getMonth(), 1),
new Date(element.today.getFullYear(), element.today.getMonth(), 5)
];

element.setHoverClass();
await new Promise((resolve) => setTimeout(resolve, 100));
await new Promise((resolve) => setTimeout(resolve, 200));

const endDateElement = element.shadowRoot?.getElementById(
`${element._selectedDates[1]?.getTime()}`
Expand Down
7 changes: 3 additions & 4 deletions src/components/datepicker/bl-datepicker.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
:host {
width: fit-content;
display: block;
}

.datepicker-content {
--bl-input-cursor: pointer;
--icon-size: var(--line-height);
--icon-color: var(--bl-color-neutral-light);
--datepicker-width: 314px;

display: block;
}

.datepicker-content {
display: flex;
flex-direction: column;
gap: var(--bl-size-2xs);
Expand Down
6 changes: 4 additions & 2 deletions src/components/datepicker/bl-datepicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ export default class BlDatepicker extends DatepickerCalendarMixin {
}

closePopoverWithTimeout() {
setTimeout(() => this.closePopover(), 200);
setTimeout(() => {
this.closePopover();
this._inputEl.blur();
}, 200);
}

setFloatingDates() {
Expand Down Expand Up @@ -140,7 +143,6 @@ export default class BlDatepicker extends DatepickerCalendarMixin {
this._selectedDates = [];
this._inputValue = "";
this._floatingDateCount = 0;
this._inputEl?.blur();
}

openPopover() {
Expand Down

0 comments on commit cb11c42

Please sign in to comment.