From e0d5a1347649a2407d51cdac9d45ba494038be53 Mon Sep 17 00:00:00 2001 From: Leo Largillet Date: Thu, 5 Oct 2023 11:46:22 +0200 Subject: [PATCH] fix(datepicker): fix exports --- .../src/components/osds-datepicker/interfaces/events.ts | 1 + .../src/components/osds-datepicker/osds-datepicker.tsx | 2 +- .../datepicker/src/components/osds-datepicker/public-api.ts | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/components/datepicker/src/components/osds-datepicker/interfaces/events.ts b/packages/components/datepicker/src/components/osds-datepicker/interfaces/events.ts index 2419cbd644..cce45d4098 100644 --- a/packages/components/datepicker/src/components/osds-datepicker/interfaces/events.ts +++ b/packages/components/datepicker/src/components/osds-datepicker/interfaces/events.ts @@ -3,6 +3,7 @@ import type { EventEmitter } from '@stencil/core'; interface OdsDatepickerValueChangeEventDetail { value?: Date | null; oldValue?: Date | null; + formattedValue?: string; } type OdsDatepickerValueChangeEvent = CustomEvent; diff --git a/packages/components/datepicker/src/components/osds-datepicker/osds-datepicker.tsx b/packages/components/datepicker/src/components/osds-datepicker/osds-datepicker.tsx index 52a956c38e..44691d6eec 100644 --- a/packages/components/datepicker/src/components/osds-datepicker/osds-datepicker.tsx +++ b/packages/components/datepicker/src/components/osds-datepicker/osds-datepicker.tsx @@ -119,7 +119,7 @@ export class OsdsDatepicker implements OdsDatepickerAttribute, OdsDatepickerEven } emitDatepickerValueChange(newValue: Date | undefined | null, oldValue?: Date | undefined | null): void { - this.odsDatepickerValueChange.emit({ value: newValue, oldValue: oldValue }); + this.odsDatepickerValueChange.emit({ value: newValue, oldValue: oldValue, formattedValue: newValue && this.format ? Datepicker.formatDate(newValue, this.format) : undefined }); } onBlur(): void { diff --git a/packages/components/datepicker/src/components/osds-datepicker/public-api.ts b/packages/components/datepicker/src/components/osds-datepicker/public-api.ts index 41a1c270b6..5bea0ad13d 100644 --- a/packages/components/datepicker/src/components/osds-datepicker/public-api.ts +++ b/packages/components/datepicker/src/components/osds-datepicker/public-api.ts @@ -1,2 +1,4 @@ export type { OdsDatepickerAttribute } from './interfaces/attributes'; +export type { OdsDatepickerEvent, OdsDatepickerValueChangeEvent, OdsDatepickerValueChangeEventDetail } from './interfaces/events'; +export { ODS_DATEPICKER_DAY, ODS_DATEPICKER_DAYS } from './constants/datepicker-day'; export { OsdsDatepicker } from './osds-datepicker';