@nanahoshi/mona-ui 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/date-range-picker/package.json +4 -0
  2. package/docs/api/calendar.md +3 -2
  3. package/docs/api/common.md +1 -1
  4. package/docs/api/date-input.md +1 -1
  5. package/docs/api/date-range-picker.md +137 -0
  6. package/docs/api/i18n.md +53 -0
  7. package/docs/api/list.md +1 -1
  8. package/docs/api/locales.md +14 -14
  9. package/docs/api/popup.md +1 -1
  10. package/docs/calendar.md +47 -3
  11. package/docs/date-picker.md +1 -1
  12. package/docs/date-range-picker.md +420 -0
  13. package/docs/forms.md +1 -0
  14. package/docs/label.md +1 -0
  15. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +171 -59
  16. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +1 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-range-picker.mjs +1331 -0
  18. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1 -0
  19. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +19 -0
  20. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +7 -1
  21. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +23 -0
  22. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +19 -0
  23. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +19 -0
  24. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +19 -0
  25. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +16 -0
  26. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +19 -0
  27. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +16 -0
  28. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +16 -0
  29. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +21 -0
  30. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +19 -0
  31. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +21 -0
  32. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +19 -0
  33. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +16 -0
  34. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +16 -0
  35. package/i18n/catalogs/en-US.messages.json +16 -0
  36. package/llms.txt +3 -1
  37. package/locales/ar-sa/ar-sa.messages.json +16 -0
  38. package/locales/de-de/de-de.messages.json +16 -0
  39. package/locales/es-es/es-es.messages.json +16 -0
  40. package/locales/fr-fr/fr-fr.messages.json +16 -0
  41. package/locales/id-id/id-id.messages.json +16 -0
  42. package/locales/it-it/it-it.messages.json +16 -0
  43. package/locales/ja-jp/ja-jp.messages.json +16 -0
  44. package/locales/ko-kr/ko-kr.messages.json +16 -0
  45. package/locales/pl-pl/pl-pl.messages.json +16 -0
  46. package/locales/pt-br/pt-br.messages.json +16 -0
  47. package/locales/ru-ru/ru-ru.messages.json +16 -0
  48. package/locales/tr-tr/tr-tr.messages.json +16 -0
  49. package/locales/zh-cn/zh-cn.messages.json +16 -0
  50. package/locales/zh-tw/zh-tw.messages.json +16 -0
  51. package/package.json +5 -1
  52. package/types/nanahoshi-mona-ui-calendar.d.ts +66 -8
  53. package/types/nanahoshi-mona-ui-date-range-picker.d.ts +462 -0
  54. package/types/nanahoshi-mona-ui-i18n.d.ts +39 -0
  55. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +16 -0
  56. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +16 -0
  57. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +16 -0
  58. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +16 -0
  59. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +16 -0
  60. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +16 -0
  61. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +16 -0
  62. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +16 -0
  63. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +16 -0
  64. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +16 -0
  65. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +16 -0
  66. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +16 -0
  67. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +16 -0
  68. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +16 -0
@@ -0,0 +1,1331 @@
1
+ import { CdkTrapFocus } from "@angular/cdk/a11y";
2
+ import { NgTemplateOutlet } from "@angular/common";
3
+ import * as i0 from "@angular/core";
4
+ import { Component, DestroyRef, ElementRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, linkedSignal, model, numberAttribute, output, signal, untracked, viewChild } from "@angular/core";
5
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
6
+ import { LucideCalendar } from "@lucide/angular";
7
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
8
+ import { CalendarComponent, CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective } from "@nanahoshi/mona-ui/calendar";
9
+ import { CalendarService, checkTypedDate, datePopupThemeVariants, isDateDisabled, parseTypedDate, typedDateParseError } from "@nanahoshi/mona-ui/date-input";
10
+ import * as i1 from "@nanahoshi/mona-ui/dropdowns";
11
+ import { DROPDOWN_POPUP_INPUT_TOKEN, DropdownPopupHandlerDirective, DropdownService } from "@nanahoshi/mona-ui/dropdowns";
12
+ import { MonaI18nService, formatNumber, getLocaleDateInputFormat, getLocaleFirstDayOfWeek, gregorianDateTime } from "@nanahoshi/mona-ui/i18n";
13
+ import { FIELD_ASSOCIATION_BOUNDARY, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
14
+ import { TextBoxComponent } from "@nanahoshi/mona-ui/text-box";
15
+ import { twMerge } from "tailwind-merge";
16
+ import { cva } from "class-variance-authority";
17
+ import { maxDateError, minDateError, transformedValue } from "@angular/forms/signals";
18
+ function localizeNumber(value, options) {
19
+ return formatNumber(value, "en-US", options);
20
+ }
21
+ const PLURAL_RULES = new Intl.PluralRules("en-US");
22
+ function plural(category, forms) {
23
+ return (forms[category] ?? forms.other)();
24
+ }
25
+ const DATE_RANGE_PICKER_DEFAULT_MESSAGES = {
26
+ dateRangePicker: "Date range picker",
27
+ end: "End date",
28
+ lastDays: (count) => `Last ${plural(PLURAL_RULES.select(count), {
29
+ one: () => `${localizeNumber(count)} day`,
30
+ other: () => `${localizeNumber(count)} days`
31
+ })}`,
32
+ lastMonth: "Last month",
33
+ lastWeek: "Last week",
34
+ lastYear: "Last year",
35
+ openCalendar: "Open calendar",
36
+ presets: "Quick ranges",
37
+ start: "Start date",
38
+ thisMonth: "This month",
39
+ thisWeek: "This week",
40
+ thisYear: "This year",
41
+ today: "Today",
42
+ yesterday: "Yesterday"
43
+ };
44
+ const dateRangePickerBaseThemeVariants = cva(`
45
+ flex w-fit max-w-full items-center
46
+ overflow-hidden
47
+ ${themeControlSurfaceClasses} text-foreground
48
+ border border-input-border shadow-(--shadow-control)
49
+ outline-none focus-visible:outline-hidden
50
+
51
+ data-[disabled='true']:pointer-events-none
52
+ data-[disabled='true']:cursor-not-allowed
53
+ data-[disabled='true']:border-disabled-border
54
+ data-[disabled='true']:bg-disabled-background
55
+ data-[disabled='true']:text-disabled-foreground
56
+ data-[disabled='true']:shadow-none
57
+ data-[readonly='true']:cursor-default
58
+
59
+ focus-within:border-focus-indicator
60
+ focus-within:ring-2 focus-within:ring-focus-indicator/35
61
+
62
+ data-[invalid='true']:border-error
63
+ data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
64
+ data-[invalid='true']:focus-within:border-error
65
+ data-[invalid='true']:focus-within:ring-error/35
66
+
67
+ [&_mona-text-box]:h-full
68
+ [&_mona-text-box]:min-w-0
69
+ [&_mona-text-box]:border-none
70
+ [&_mona-text-box]:shadow-none
71
+ [&_mona-text-box]:focus-within:ring-0
72
+ [&_mona-text-box[data-invalid='true']]:ring-0
73
+ [&_mona-text-box[data-invalid='true']_input]:text-error
74
+ `, {
75
+ variants: {
76
+ focused: {
77
+ true: "border-focus-indicator ring-2 ring-focus-indicator/35",
78
+ false: ""
79
+ },
80
+ rounded: {
81
+ full: "rounded-full",
82
+ large: "rounded-lg",
83
+ medium: "rounded-md",
84
+ none: "rounded-none",
85
+ small: "rounded-sm"
86
+ },
87
+ size: {
88
+ large: "h-10 text-base",
89
+ medium: "h-9 text-sm",
90
+ small: "h-8 text-xs"
91
+ }
92
+ },
93
+ compoundVariants: [{
94
+ focused: true,
95
+ class: "data-[invalid='true']:border-error data-[invalid='true']:ring-error/35"
96
+ }]
97
+ });
98
+ const dateRangePickerPopupThemeVariants = cva(`flex max-w-[calc(100dvw-1rem)] max-sm:flex-col`);
99
+ const dateRangePickerFieldThemeVariants = cva(`inline-grid h-full min-w-0 [&>*]:col-start-1 [&>*]:row-start-1`);
100
+ const dateRangePickerSizerThemeVariants = cva(`invisible h-0 overflow-hidden whitespace-pre ps-2 tabular-nums`, { variants: { clearButton: {
101
+ false: "pe-2",
102
+ true: "pe-9"
103
+ } } });
104
+ const dateRangePickerPresetListThemeVariants = cva(`
105
+ flex shrink-0 flex-col gap-0.5 border-border p-2
106
+ sm:border-e
107
+ max-sm:flex-row max-sm:flex-wrap max-sm:border-b
108
+ `);
109
+ const dateRangePickerPresetThemeVariants = cva(`justify-start font-normal whitespace-nowrap`, { variants: { size: {
110
+ large: "h-9 text-base",
111
+ medium: "h-8 text-sm",
112
+ small: "h-7 text-xs"
113
+ } } });
114
+ const dateRangePickerButtonThemeVariants = cva(`ms-auto h-full shrink-0`, { variants: { size: {
115
+ large: "w-[calc(--spacing(10)-2px)]",
116
+ medium: "w-[calc(--spacing(9)-2px)]",
117
+ small: "w-[calc(--spacing(8)-2px)]"
118
+ } } });
119
+ const dateRangePickerSeparatorThemeVariants = cva(`shrink-0 select-none px-1 text-muted-foreground`);
120
+ const DAY_INDEX = {
121
+ friday: 5,
122
+ monday: 1,
123
+ saturday: 6,
124
+ sunday: 0,
125
+ thursday: 4,
126
+ tuesday: 2,
127
+ wednesday: 3
128
+ };
129
+ function addDays(date, days) {
130
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);
131
+ }
132
+ function startOfDay(date) {
133
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
134
+ }
135
+ function sameDay(first, second) {
136
+ return startOfDay(first).getTime() === startOfDay(second).getTime();
137
+ }
138
+ function builtInLabel(key, messages) {
139
+ switch (key) {
140
+ case "last30Days": return messages.lastDays(30);
141
+ case "last7Days": return messages.lastDays(7);
142
+ default: return messages[key];
143
+ }
144
+ }
145
+ function builtInPresetRange(key, today, firstDay) {
146
+ const year = today.getFullYear();
147
+ const month = today.getMonth();
148
+ const weekStart = addDays(today, -((today.getDay() - DAY_INDEX[firstDay] + 7) % 7));
149
+ switch (key) {
150
+ case "last30Days": return {
151
+ end: today,
152
+ start: addDays(today, -29)
153
+ };
154
+ case "last7Days": return {
155
+ end: today,
156
+ start: addDays(today, -6)
157
+ };
158
+ case "lastMonth": return {
159
+ end: new Date(year, month, 0),
160
+ start: new Date(year, month - 1, 1)
161
+ };
162
+ case "lastWeek": return {
163
+ end: addDays(weekStart, -1),
164
+ start: addDays(weekStart, -7)
165
+ };
166
+ case "lastYear": return {
167
+ end: new Date(year - 1, 11, 31),
168
+ start: new Date(year - 1, 0, 1)
169
+ };
170
+ case "thisMonth": return {
171
+ end: new Date(year, month + 1, 0),
172
+ start: new Date(year, month, 1)
173
+ };
174
+ case "thisWeek": return {
175
+ end: addDays(weekStart, 6),
176
+ start: weekStart
177
+ };
178
+ case "thisYear": return {
179
+ end: new Date(year, 11, 31),
180
+ start: new Date(year, 0, 1)
181
+ };
182
+ case "today": return {
183
+ end: today,
184
+ start: today
185
+ };
186
+ case "yesterday": return {
187
+ end: addDays(today, -1),
188
+ start: addDays(today, -1)
189
+ };
190
+ }
191
+ }
192
+ function limitRange(range, min, max) {
193
+ let start = startOfDay(range.start);
194
+ let end = startOfDay(range.end);
195
+ if (end < start) [start, end] = [end, start];
196
+ if (min && start < startOfDay(min)) start = startOfDay(min);
197
+ if (max && end > startOfDay(max)) end = startOfDay(max);
198
+ return start <= end ? {
199
+ end,
200
+ start
201
+ } : null;
202
+ }
203
+ function resolveDateRangePresets(presets, context) {
204
+ const { disabledDates, firstDay, max, messages, min, today, value } = context;
205
+ return presets.map((preset) => {
206
+ const label = typeof preset === "string" ? builtInLabel(preset, messages) : preset.label;
207
+ const range = limitRange(typeof preset === "string" ? builtInPresetRange(preset, today, firstDay) : preset.range(today), min, max);
208
+ return {
209
+ disabled: range == null || disabledDates != null && (isDateDisabled(range.start, disabledDates) || isDateDisabled(range.end, disabledDates)),
210
+ label,
211
+ range,
212
+ selected: range != null && value?.start != null && value.end != null && sameDay(value.start, range.start) && sameDay(value.end, range.end)
213
+ };
214
+ });
215
+ }
216
+ function dayOf(date) {
217
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
218
+ }
219
+ function createTypedDateRangeInput(options) {
220
+ const { constraints, format, localeId, value } = options;
221
+ const errorParts = /* @__PURE__ */ new WeakMap();
222
+ let committedPart = "start";
223
+ const formatDate = (date) => date ? gregorianDateTime(date, localeId()).toFormat(format()) : "";
224
+ const committed = transformedValue(value, {
225
+ format: (range) => ({
226
+ end: formatDate(range?.end),
227
+ start: formatDate(range?.start)
228
+ }),
229
+ parse: (raw) => {
230
+ const current = untracked(value);
231
+ const limits = untracked(constraints);
232
+ const errors = [];
233
+ const report = (part, error) => {
234
+ errorParts.set(error, part);
235
+ errors.push(error);
236
+ };
237
+ const read = (part) => {
238
+ const text = raw[part].trim();
239
+ if (!text) return null;
240
+ const parsed = untracked(() => parseTypedDate(text, format(), localeId()));
241
+ if (!parsed) {
242
+ report(part, typedDateParseError());
243
+ return;
244
+ }
245
+ const date = parsed.toJSDate();
246
+ const error = checkTypedDate(date, {
247
+ ...limits,
248
+ unit: "date"
249
+ });
250
+ if (error) {
251
+ report(part, error);
252
+ return;
253
+ }
254
+ const previous = current?.[part];
255
+ return previous && dayOf(previous) === dayOf(date) ? previous : date;
256
+ };
257
+ const start = read("start");
258
+ const end = read("end");
259
+ if (start && end && dayOf(start) > dayOf(end)) {
260
+ if (committedPart === "start") report("start", maxDateError(end));
261
+ else report("end", minDateError(start));
262
+ }
263
+ if (errors.length > 0 || start === void 0 || end === void 0) return { error: errors };
264
+ const next = start || end ? {
265
+ end,
266
+ start
267
+ } : null;
268
+ return (current?.start ?? null) === start && (current?.end ?? null) === end && next === null === (current === null) ? {} : { value: next };
269
+ }
270
+ });
271
+ const text = {
272
+ end: linkedSignal(() => committed().end),
273
+ start: linkedSignal(() => committed().start)
274
+ };
275
+ const commit = (part) => {
276
+ committedPart = part;
277
+ committed.set({
278
+ end: untracked(text.end),
279
+ start: untracked(text.start)
280
+ });
281
+ if (untracked(committed.parseErrors).length === 0) {
282
+ const range = untracked(value);
283
+ text.start.set(untracked(() => formatDate(range?.start)));
284
+ text.end.set(untracked(() => formatDate(range?.end)));
285
+ }
286
+ };
287
+ return {
288
+ commit,
289
+ edit: (part, typed) => {
290
+ text[part].set(typed);
291
+ if (typed === "") commit(part);
292
+ },
293
+ errors: committed.parseErrors,
294
+ partErrors: computed(() => {
295
+ const errors = committed.parseErrors();
296
+ return {
297
+ end: errors.filter((error) => errorParts.get(error) === "end"),
298
+ start: errors.filter((error) => errorParts.get(error) === "start")
299
+ };
300
+ }),
301
+ text: {
302
+ end: text.end.asReadonly(),
303
+ start: text.start.asReadonly()
304
+ }
305
+ };
306
+ }
307
+ function startOfToday() {
308
+ const now = /* @__PURE__ */ new Date();
309
+ return new Date(now.getFullYear(), now.getMonth(), now.getDate());
310
+ }
311
+ function sizerTexts(samples, placeholder) {
312
+ return placeholder ? [...samples, placeholder] : [...samples];
313
+ }
314
+ var DateRangePickerComponent = class DateRangePickerComponent {
315
+ #activePart;
316
+ #calendarService;
317
+ #destroyRef;
318
+ #dropdownService;
319
+ #hostElementRef;
320
+ #i18n;
321
+ #label;
322
+ #sampleTexts;
323
+ #today;
324
+ constructor() {
325
+ this.#activePart = signal("start", ...ngDevMode ? [{ debugName: "#activePart" }] : /* istanbul ignore next */ []);
326
+ this.#calendarService = inject(CalendarService);
327
+ this.#destroyRef = inject(DestroyRef);
328
+ this.#dropdownService = inject(DropdownService);
329
+ this.#hostElementRef = inject(ElementRef);
330
+ this.#i18n = inject(MonaI18nService);
331
+ this.#label = injectLabelAssociation({
332
+ ariaDescribedBy: () => this.ariaDescribedBy(),
333
+ ariaLabel: () => this.ariaLabel(),
334
+ ariaLabelledBy: () => this.ariaLabelledBy(),
335
+ focus: () => this.focus()
336
+ });
337
+ this.#sampleTexts = computed(() => {
338
+ const format = this.effectiveFormat();
339
+ const localeId = this.#i18n.localeId();
340
+ const texts = /* @__PURE__ */ new Set();
341
+ const dates = [...Array.from({ length: 12 }, (_, month) => new Date(2e3, month, 28)), ...Array.from({ length: 7 }, (_, offset) => new Date(2e3, 0, 22 + offset))];
342
+ for (const date of dates) texts.add(gregorianDateTime(date, localeId).toFormat(format).replace(/[0-9]/g, "0"));
343
+ return [...texts];
344
+ }, ...ngDevMode ? [{ debugName: "#sampleTexts" }] : /* istanbul ignore next */ []);
345
+ this.#today = signal(startOfToday(), ...ngDevMode ? [{ debugName: "#today" }] : /* istanbul ignore next */ []);
346
+ this.baseClass = computed(() => {
347
+ const focused = this.#dropdownService.popupRef() != null;
348
+ const rounded = this.rounded();
349
+ const size = this.size();
350
+ const variantClass = dateRangePickerBaseThemeVariants({
351
+ focused,
352
+ rounded,
353
+ size
354
+ });
355
+ return twMerge(variantClass, this.userClass());
356
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
357
+ this.buttonClass = computed(() => dateRangePickerButtonThemeVariants({ size: this.size() }), ...ngDevMode ? [{ debugName: "buttonClass" }] : /* istanbul ignore next */ []);
358
+ this.calendarValue = computed(() => {
359
+ const range = this.value();
360
+ const ends = [range?.start, range?.end].filter((date) => date != null);
361
+ return ends.length > 0 ? ends : null;
362
+ }, ...ngDevMode ? [{ debugName: "calendarValue" }] : /* istanbul ignore next */ []);
363
+ this.decadeCellTemplate = contentChild(CalendarDecadeCellTemplateDirective, ...ngDevMode ? [{ debugName: "decadeCellTemplate" }] : /* istanbul ignore next */ []);
364
+ this.describedBy = this.#label.describedBy;
365
+ this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
366
+ this.effectiveFormat = computed(() => this.format() ?? getLocaleDateInputFormat(this.#i18n.localeId()), ...ngDevMode ? [{ debugName: "effectiveFormat" }] : /* istanbul ignore next */ []);
367
+ this.endInputId = createElementControlId();
368
+ this.endInvalid = computed(() => this.typedInput.partErrors().end.length > 0 || this.fieldInvalid(), ...ngDevMode ? [{ debugName: "endInvalid" }] : /* istanbul ignore next */ []);
369
+ this.endSizerTexts = computed(() => sizerTexts(this.#sampleTexts(), this.endPlaceholder()), ...ngDevMode ? [{ debugName: "endSizerTexts" }] : /* istanbul ignore next */ []);
370
+ this.expanded = computed(() => this.#dropdownService.popupRef() !== null, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
371
+ this.fieldClass = dateRangePickerFieldThemeVariants();
372
+ this.fieldInvalid = computed(() => this.touched() && (this.invalid() || this.required() && this.value() == null), ...ngDevMode ? [{ debugName: "fieldInvalid" }] : /* istanbul ignore next */ []);
373
+ this.inputAttributes = computed(() => ({
374
+ "aria-autocomplete": "none",
375
+ "aria-controls": this.popupId,
376
+ "aria-expanded": this.expanded() ? "true" : "false",
377
+ "aria-haspopup": "dialog",
378
+ readonly: this.readonly() || this.readonlyInput(),
379
+ role: "combobox"
380
+ }), ...ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []);
381
+ this.inputClass = "tabular-nums";
382
+ this.inputStyle = "flex: 1 1 0%; min-width: 0; width: 0";
383
+ this.invalidState = computed(() => this.startInvalid() || this.endInvalid(), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
384
+ this.labelledBy = this.#label.labelledBy;
385
+ this.messages = this.#i18n.componentMessages("dateRangePicker", DATE_RANGE_PICKER_DEFAULT_MESSAGES);
386
+ this.monthCellTemplate = contentChild(CalendarMonthCellTemplateDirective, ...ngDevMode ? [{ debugName: "monthCellTemplate" }] : /* istanbul ignore next */ []);
387
+ this.pickerPopupClass = computed(() => {
388
+ const variantClass = datePopupThemeVariants({
389
+ rounded: this.rounded(),
390
+ size: this.size()
391
+ });
392
+ return twMerge(variantClass, dateRangePickerPopupThemeVariants(), this.popupClass());
393
+ }, ...ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []);
394
+ this.popupId = createElementControlId();
395
+ this.popupTemplate = viewChild.required("popupTemplate", ...ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []);
396
+ this.presetClass = computed(() => dateRangePickerPresetThemeVariants({ size: this.size() }), ...ngDevMode ? [{ debugName: "presetClass" }] : /* istanbul ignore next */ []);
397
+ this.presetItems = computed(() => {
398
+ const presets = this.presets();
399
+ if (presets.length === 0) return [];
400
+ return resolveDateRangePresets(presets, {
401
+ disabledDates: this.disabledDates(),
402
+ firstDay: this.firstDay() ?? getLocaleFirstDayOfWeek(this.#i18n.localeId()),
403
+ max: this.maxDate(),
404
+ messages: this.messages(),
405
+ min: this.minDate(),
406
+ today: this.#today(),
407
+ value: this.value()
408
+ });
409
+ }, ...ngDevMode ? [{ debugName: "presetItems" }] : /* istanbul ignore next */ []);
410
+ this.presetListClass = dateRangePickerPresetListThemeVariants();
411
+ this.separatorClass = dateRangePickerSeparatorThemeVariants();
412
+ this.sizerClass = computed(() => dateRangePickerSizerThemeVariants({ clearButton: this.showClearButton() }), ...ngDevMode ? [{ debugName: "sizerClass" }] : /* istanbul ignore next */ []);
413
+ this.startInputId = createElementControlId();
414
+ this.startInvalid = computed(() => this.typedInput.partErrors().start.length > 0 || this.fieldInvalid(), ...ngDevMode ? [{ debugName: "startInvalid" }] : /* istanbul ignore next */ []);
415
+ this.startSizerTexts = computed(() => sizerTexts(this.#sampleTexts(), this.startPlaceholder()), ...ngDevMode ? [{ debugName: "startSizerTexts" }] : /* istanbul ignore next */ []);
416
+ this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, ...ngDevMode ? [{ debugName: "yearCellTemplate" }] : /* istanbul ignore next */ []);
417
+ this.ariaDescribedBy = input("", {
418
+ ...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
419
+ alias: "aria-describedby"
420
+ });
421
+ this.ariaLabel = input("", {
422
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
423
+ alias: "aria-label"
424
+ });
425
+ this.ariaLabelledBy = input("", {
426
+ ...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
427
+ alias: "aria-labelledby"
428
+ });
429
+ this.close = output();
430
+ this.closed = output();
431
+ this.disabled = input(false, {
432
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
433
+ transform: booleanAttribute
434
+ });
435
+ this.disabledDates = input(...ngDevMode ? [void 0, { debugName: "disabledDates" }] : /* istanbul ignore next */ []);
436
+ this.endPlaceholder = input("", ...ngDevMode ? [{ debugName: "endPlaceholder" }] : /* istanbul ignore next */ []);
437
+ this.firstDay = input(null, ...ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []);
438
+ this.format = input(null, ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
439
+ this.invalid = input(false, {
440
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
441
+ transform: booleanAttribute
442
+ });
443
+ this.maxDate = input(void 0, {
444
+ ...ngDevMode ? { debugName: "maxDate" } : /* istanbul ignore next */ {},
445
+ transform: (value) => value instanceof Date ? value : void 0
446
+ });
447
+ this.minDate = input(void 0, {
448
+ ...ngDevMode ? { debugName: "minDate" } : /* istanbul ignore next */ {},
449
+ transform: (value) => value instanceof Date ? value : void 0
450
+ });
451
+ this.months = input(2, {
452
+ ...ngDevMode ? { debugName: "months" } : /* istanbul ignore next */ {},
453
+ transform: (value) => numberAttribute(value, 2)
454
+ });
455
+ this.open = output();
456
+ this.opened = output();
457
+ this.popupClass = input("", ...ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []);
458
+ this.popupHeight = input("", ...ngDevMode ? [{ debugName: "popupHeight" }] : /* istanbul ignore next */ []);
459
+ this.popupWidth = input("", ...ngDevMode ? [{ debugName: "popupWidth" }] : /* istanbul ignore next */ []);
460
+ this.presets = input([], ...ngDevMode ? [{ debugName: "presets" }] : /* istanbul ignore next */ []);
461
+ this.readonly = input(false, {
462
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
463
+ transform: booleanAttribute
464
+ });
465
+ this.readonlyInput = input(false, {
466
+ ...ngDevMode ? { debugName: "readonlyInput" } : /* istanbul ignore next */ {},
467
+ transform: booleanAttribute
468
+ });
469
+ this.required = input(false, {
470
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
471
+ transform: booleanAttribute
472
+ });
473
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
474
+ this.showClearButton = input(false, {
475
+ ...ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {},
476
+ transform: booleanAttribute
477
+ });
478
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
479
+ this.startPlaceholder = input("", ...ngDevMode ? [{ debugName: "startPlaceholder" }] : /* istanbul ignore next */ []);
480
+ this.touch = output();
481
+ this.touched = input(false, {
482
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
483
+ transform: booleanAttribute
484
+ });
485
+ this.userClass = input("", {
486
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
487
+ alias: "class"
488
+ });
489
+ this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
490
+ this.weekNumber = input(false, {
491
+ ...ngDevMode ? { debugName: "weekNumber" } : /* istanbul ignore next */ {},
492
+ transform: booleanAttribute
493
+ });
494
+ this.typedInput = createTypedDateRangeInput({
495
+ constraints: () => ({
496
+ disabledDates: this.disabledDates(),
497
+ max: this.maxDate(),
498
+ min: this.minDate()
499
+ }),
500
+ format: () => this.effectiveFormat(),
501
+ localeId: () => this.#i18n.localeId(),
502
+ value: this.value
503
+ });
504
+ effect(() => {
505
+ const popupTemplate = this.popupTemplate();
506
+ untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
507
+ });
508
+ afterNextRender({ read: () => {
509
+ this.setCalendarKeyboardSubscription();
510
+ this.setPopupCloseSubscription();
511
+ } });
512
+ }
513
+ focus(options) {
514
+ this.focusPart("start", options);
515
+ }
516
+ onCalendarButtonClick() {
517
+ if (this.effectiveDisabled() || this.readonly()) return;
518
+ if (this.expanded()) {
519
+ this.closePopup();
520
+ return;
521
+ }
522
+ this.openPopup();
523
+ }
524
+ onCalendarValueChange(dates) {
525
+ if (!Array.isArray(dates) || dates.length < 2) return;
526
+ this.value.set({
527
+ end: new Date(dates[dates.length - 1]),
528
+ start: new Date(dates[0])
529
+ });
530
+ this.#activePart.set("end");
531
+ this.closePopup();
532
+ }
533
+ onFocusIn(event) {
534
+ if (event.target === this.#hostElementRef.nativeElement) this.focus();
535
+ }
536
+ onFocusOut(event) {
537
+ if (this.#destroyRef.destroyed) return;
538
+ const nextTarget = event.relatedTarget;
539
+ if (nextTarget instanceof Node) {
540
+ const popupElement = this.#dropdownService.popupRef()?.overlayRef.overlayElement;
541
+ if (this.#hostElementRef.nativeElement.contains(nextTarget) || popupElement?.contains(nextTarget)) return;
542
+ }
543
+ this.touch.emit();
544
+ }
545
+ onInputBlur(part) {
546
+ this.typedInput.commit(part);
547
+ }
548
+ onInputFocus(part) {
549
+ this.#activePart.set(part);
550
+ }
551
+ onKeydown(event) {
552
+ if (this.effectiveDisabled() || this.readonly()) return;
553
+ if (event.altKey && event.key === "ArrowDown") {
554
+ event.preventDefault();
555
+ this.openPopup();
556
+ } else if (event.altKey && event.key === "ArrowUp" || event.key === "Escape") {
557
+ if (this.expanded()) {
558
+ event.preventDefault();
559
+ this.closePopup();
560
+ }
561
+ } else if (event.key === "Enter" && event.target instanceof HTMLInputElement) {
562
+ if (!event.isComposing && event.keyCode !== 229) this.typedInput.commit(event.target.id === this.endInputId ? "end" : "start");
563
+ }
564
+ }
565
+ onPresetClick(item) {
566
+ if (item.disabled || !item.range) return;
567
+ this.value.set({
568
+ end: new Date(item.range.end),
569
+ start: new Date(item.range.start)
570
+ });
571
+ this.#activePart.set("end");
572
+ this.closePopup();
573
+ }
574
+ onPresetKeydown(event) {
575
+ if (event.key === "Escape" || event.altKey && event.key === "ArrowUp") {
576
+ event.preventDefault();
577
+ this.closePopup();
578
+ }
579
+ }
580
+ closePopup() {
581
+ this.#dropdownService.popupRef()?.close();
582
+ }
583
+ focusPart(part, options) {
584
+ const id = part === "start" ? this.startInputId : this.endInputId;
585
+ const input = this.#hostElementRef.nativeElement.querySelector(`#${CSS.escape(id)}`);
586
+ if (input) {
587
+ input.focus(options);
588
+ input.setSelectionRange(input.value.length, input.value.length);
589
+ }
590
+ }
591
+ openPopup() {
592
+ if (!this.#dropdownService.popupRef()) {
593
+ this.#today.set(startOfToday());
594
+ this.#dropdownService.triggerPopupOpen$.next({
595
+ height: this.popupHeight() || "auto",
596
+ maxHeight: "auto",
597
+ width: this.popupWidth() || "auto",
598
+ closeOnScroll: false,
599
+ withPush: true,
600
+ withScrollTracking: true
601
+ });
602
+ }
603
+ }
604
+ setCalendarKeyboardSubscription() {
605
+ this.#calendarService.keydown$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => {
606
+ const keyboardEvent = event.originalEvent;
607
+ if (keyboardEvent && (keyboardEvent.key === "Escape" || keyboardEvent.altKey && keyboardEvent.key === "ArrowUp")) {
608
+ keyboardEvent.preventDefault();
609
+ this.closePopup();
610
+ }
611
+ });
612
+ }
613
+ setPopupCloseSubscription() {
614
+ this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
615
+ if (this.#dropdownService.focusCanReturn()) this.focusPart(this.#activePart());
616
+ else if (!this.#destroyRef.destroyed) this.touch.emit();
617
+ });
618
+ }
619
+ static {
620
+ this.ɵfac = i0.ɵɵngDeclareFactory({
621
+ minVersion: "12.0.0",
622
+ version: "22.2.6",
623
+ ngImport: i0,
624
+ type: DateRangePickerComponent,
625
+ deps: [],
626
+ target: i0.ɵɵFactoryTarget.Component
627
+ });
628
+ }
629
+ static {
630
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
631
+ minVersion: "17.0.0",
632
+ version: "22.2.6",
633
+ type: DateRangePickerComponent,
634
+ isStandalone: true,
635
+ selector: "mona-date-range-picker",
636
+ inputs: {
637
+ ariaDescribedBy: {
638
+ classPropertyName: "ariaDescribedBy",
639
+ publicName: "aria-describedby",
640
+ isSignal: true,
641
+ isRequired: false,
642
+ transformFunction: null
643
+ },
644
+ ariaLabel: {
645
+ classPropertyName: "ariaLabel",
646
+ publicName: "aria-label",
647
+ isSignal: true,
648
+ isRequired: false,
649
+ transformFunction: null
650
+ },
651
+ ariaLabelledBy: {
652
+ classPropertyName: "ariaLabelledBy",
653
+ publicName: "aria-labelledby",
654
+ isSignal: true,
655
+ isRequired: false,
656
+ transformFunction: null
657
+ },
658
+ disabled: {
659
+ classPropertyName: "disabled",
660
+ publicName: "disabled",
661
+ isSignal: true,
662
+ isRequired: false,
663
+ transformFunction: null
664
+ },
665
+ disabledDates: {
666
+ classPropertyName: "disabledDates",
667
+ publicName: "disabledDates",
668
+ isSignal: true,
669
+ isRequired: false,
670
+ transformFunction: null
671
+ },
672
+ endPlaceholder: {
673
+ classPropertyName: "endPlaceholder",
674
+ publicName: "endPlaceholder",
675
+ isSignal: true,
676
+ isRequired: false,
677
+ transformFunction: null
678
+ },
679
+ firstDay: {
680
+ classPropertyName: "firstDay",
681
+ publicName: "firstDay",
682
+ isSignal: true,
683
+ isRequired: false,
684
+ transformFunction: null
685
+ },
686
+ format: {
687
+ classPropertyName: "format",
688
+ publicName: "format",
689
+ isSignal: true,
690
+ isRequired: false,
691
+ transformFunction: null
692
+ },
693
+ invalid: {
694
+ classPropertyName: "invalid",
695
+ publicName: "invalid",
696
+ isSignal: true,
697
+ isRequired: false,
698
+ transformFunction: null
699
+ },
700
+ maxDate: {
701
+ classPropertyName: "maxDate",
702
+ publicName: "maxDate",
703
+ isSignal: true,
704
+ isRequired: false,
705
+ transformFunction: null
706
+ },
707
+ minDate: {
708
+ classPropertyName: "minDate",
709
+ publicName: "minDate",
710
+ isSignal: true,
711
+ isRequired: false,
712
+ transformFunction: null
713
+ },
714
+ months: {
715
+ classPropertyName: "months",
716
+ publicName: "months",
717
+ isSignal: true,
718
+ isRequired: false,
719
+ transformFunction: null
720
+ },
721
+ popupClass: {
722
+ classPropertyName: "popupClass",
723
+ publicName: "popupClass",
724
+ isSignal: true,
725
+ isRequired: false,
726
+ transformFunction: null
727
+ },
728
+ popupHeight: {
729
+ classPropertyName: "popupHeight",
730
+ publicName: "popupHeight",
731
+ isSignal: true,
732
+ isRequired: false,
733
+ transformFunction: null
734
+ },
735
+ popupWidth: {
736
+ classPropertyName: "popupWidth",
737
+ publicName: "popupWidth",
738
+ isSignal: true,
739
+ isRequired: false,
740
+ transformFunction: null
741
+ },
742
+ presets: {
743
+ classPropertyName: "presets",
744
+ publicName: "presets",
745
+ isSignal: true,
746
+ isRequired: false,
747
+ transformFunction: null
748
+ },
749
+ readonly: {
750
+ classPropertyName: "readonly",
751
+ publicName: "readonly",
752
+ isSignal: true,
753
+ isRequired: false,
754
+ transformFunction: null
755
+ },
756
+ readonlyInput: {
757
+ classPropertyName: "readonlyInput",
758
+ publicName: "readonlyInput",
759
+ isSignal: true,
760
+ isRequired: false,
761
+ transformFunction: null
762
+ },
763
+ required: {
764
+ classPropertyName: "required",
765
+ publicName: "required",
766
+ isSignal: true,
767
+ isRequired: false,
768
+ transformFunction: null
769
+ },
770
+ rounded: {
771
+ classPropertyName: "rounded",
772
+ publicName: "rounded",
773
+ isSignal: true,
774
+ isRequired: false,
775
+ transformFunction: null
776
+ },
777
+ showClearButton: {
778
+ classPropertyName: "showClearButton",
779
+ publicName: "showClearButton",
780
+ isSignal: true,
781
+ isRequired: false,
782
+ transformFunction: null
783
+ },
784
+ size: {
785
+ classPropertyName: "size",
786
+ publicName: "size",
787
+ isSignal: true,
788
+ isRequired: false,
789
+ transformFunction: null
790
+ },
791
+ startPlaceholder: {
792
+ classPropertyName: "startPlaceholder",
793
+ publicName: "startPlaceholder",
794
+ isSignal: true,
795
+ isRequired: false,
796
+ transformFunction: null
797
+ },
798
+ touched: {
799
+ classPropertyName: "touched",
800
+ publicName: "touched",
801
+ isSignal: true,
802
+ isRequired: false,
803
+ transformFunction: null
804
+ },
805
+ userClass: {
806
+ classPropertyName: "userClass",
807
+ publicName: "class",
808
+ isSignal: true,
809
+ isRequired: false,
810
+ transformFunction: null
811
+ },
812
+ value: {
813
+ classPropertyName: "value",
814
+ publicName: "value",
815
+ isSignal: true,
816
+ isRequired: false,
817
+ transformFunction: null
818
+ },
819
+ weekNumber: {
820
+ classPropertyName: "weekNumber",
821
+ publicName: "weekNumber",
822
+ isSignal: true,
823
+ isRequired: false,
824
+ transformFunction: null
825
+ }
826
+ },
827
+ outputs: {
828
+ close: "close",
829
+ closed: "closed",
830
+ open: "open",
831
+ opened: "opened",
832
+ touch: "touch",
833
+ value: "valueChange"
834
+ },
835
+ host: {
836
+ attributes: { "role": "group" },
837
+ listeners: {
838
+ "focusin": "onFocusIn($event)",
839
+ "focusout": "onFocusOut($event)",
840
+ "keydown": "onKeydown($event)"
841
+ },
842
+ properties: {
843
+ "attr.aria-describedby": "null",
844
+ "attr.aria-disabled": "effectiveDisabled() || null",
845
+ "attr.aria-label": "ariaLabel() || null",
846
+ "attr.aria-labelledby": "labelledBy()",
847
+ "attr.tabindex": "effectiveDisabled() ? null : -1",
848
+ "attr.data-disabled": "effectiveDisabled() || null",
849
+ "attr.data-expanded": "expanded()",
850
+ "attr.data-invalid": "invalidState() || null",
851
+ "attr.data-readonly": "readonly() || null",
852
+ "class": "baseClass()"
853
+ }
854
+ },
855
+ providers: [
856
+ DropdownService,
857
+ CalendarService,
858
+ {
859
+ provide: DROPDOWN_POPUP_INPUT_TOKEN,
860
+ useExisting: forwardRef(() => DateRangePickerComponent),
861
+ multi: false
862
+ }
863
+ ],
864
+ queries: [
865
+ {
866
+ propertyName: "decadeCellTemplate",
867
+ first: true,
868
+ predicate: CalendarDecadeCellTemplateDirective,
869
+ descendants: true,
870
+ isSignal: true
871
+ },
872
+ {
873
+ propertyName: "monthCellTemplate",
874
+ first: true,
875
+ predicate: CalendarMonthCellTemplateDirective,
876
+ descendants: true,
877
+ isSignal: true
878
+ },
879
+ {
880
+ propertyName: "yearCellTemplate",
881
+ first: true,
882
+ predicate: CalendarYearCellTemplateDirective,
883
+ descendants: true,
884
+ isSignal: true
885
+ }
886
+ ],
887
+ viewQueries: [{
888
+ propertyName: "popupTemplate",
889
+ first: true,
890
+ predicate: ["popupTemplate"],
891
+ descendants: true,
892
+ isSignal: true
893
+ }],
894
+ hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }],
895
+ ngImport: i0,
896
+ template: "<span [class]=\"fieldClass\">\n <span aria-hidden=\"true\" [class]=\"sizerClass()\">\n @for (text of startSizerTexts(); track $index) {\n <span class=\"block\">{{ text }}</span>\n }\n </span>\n <mona-text-box\n (inputBlur)=\"onInputBlur('start')\"\n (inputFocus)=\"onInputFocus('start')\"\n (valueChange)=\"typedInput.edit('start', $event)\"\n [aria-describedby]=\"describedBy() ?? ''\"\n [aria-label]=\"messages().start\"\n [clearButton]=\"showClearButton()\"\n [disabled]=\"effectiveDisabled()\"\n [inputAttributes]=\"inputAttributes()\"\n [inputClass]=\"inputClass\"\n [inputId]=\"startInputId\"\n [inputStyle]=\"inputStyle\"\n [invalid]=\"startInvalid()\"\n [placeholder]=\"startPlaceholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"startInvalid() || touched()\"\n [value]=\"typedInput.text.start()\" />\n</span>\n<span aria-hidden=\"true\" [class]=\"separatorClass\">–</span>\n<span [class]=\"fieldClass\">\n <span aria-hidden=\"true\" [class]=\"sizerClass()\">\n @for (text of endSizerTexts(); track $index) {\n <span class=\"block\">{{ text }}</span>\n }\n </span>\n <mona-text-box\n (inputBlur)=\"onInputBlur('end')\"\n (inputFocus)=\"onInputFocus('end')\"\n (valueChange)=\"typedInput.edit('end', $event)\"\n [aria-describedby]=\"describedBy() ?? ''\"\n [aria-label]=\"messages().end\"\n [clearButton]=\"showClearButton()\"\n [disabled]=\"effectiveDisabled()\"\n [inputAttributes]=\"inputAttributes()\"\n [inputClass]=\"inputClass\"\n [inputId]=\"endInputId\"\n [inputStyle]=\"inputStyle\"\n [invalid]=\"endInvalid()\"\n [placeholder]=\"endPlaceholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"endInvalid() || touched()\"\n [value]=\"typedInput.text.end()\" />\n</span>\n<button\n monaButton\n look=\"ghost\"\n [class]=\"buttonClass()\"\n [attr.aria-controls]=\"popupId\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-label]=\"messages().openCalendar\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [iconOnly]=\"true\"\n [rounded]=\"'none'\"\n [size]=\"size()\"\n [tabindex]=\"-1\"\n (click)=\"onCalendarButtonClick()\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n</button>\n\n<ng-template #popupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().dateRangePicker\"\n cdkTrapFocus>\n @if (presetItems().length > 0) {\n <div role=\"group\" [attr.aria-label]=\"messages().presets\" [class]=\"presetListClass\" (keydown)=\"onPresetKeydown($event)\">\n @for (item of presetItems(); track $index) {\n <button\n monaButton\n look=\"ghost\"\n type=\"button\"\n [class]=\"presetClass()\"\n [disabled]=\"item.disabled\"\n [rounded]=\"rounded()\"\n [selected]=\"item.selected\"\n size=\"small\"\n [toggleable]=\"true\"\n (click)=\"onPresetClick(item)\">\n {{ item.label }}\n </button>\n }\n </div>\n }\n <mona-calendar\n focusOnMount\n selection=\"range\"\n [disabledDates]=\"disabledDates()\"\n [firstDay]=\"firstDay()\"\n [maxDate]=\"maxDate()\"\n [minDate]=\"minDate()\"\n [months]=\"months()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n [value]=\"calendarValue()\"\n [weekNumber]=\"weekNumber()\"\n (valueChange)=\"onCalendarValueChange($event)\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n</ng-template>\n",
897
+ dependencies: [
898
+ {
899
+ kind: "directive",
900
+ type: ButtonDirective,
901
+ selector: "button[monaButton]",
902
+ inputs: [
903
+ "aria-haspopup",
904
+ "disabled",
905
+ "iconOnly",
906
+ "loading",
907
+ "look",
908
+ "rounded",
909
+ "selected",
910
+ "size",
911
+ "tabindex",
912
+ "toggleable",
913
+ "type",
914
+ "class",
915
+ "value"
916
+ ],
917
+ outputs: ["lookChange", "selectedChange"]
918
+ },
919
+ {
920
+ kind: "component",
921
+ type: CalendarComponent,
922
+ selector: "mona-calendar",
923
+ inputs: [
924
+ "disabled",
925
+ "disabledDates",
926
+ "firstDay",
927
+ "focusOnMount",
928
+ "invalid",
929
+ "maxDate",
930
+ "minDate",
931
+ "months",
932
+ "readonly",
933
+ "required",
934
+ "rounded",
935
+ "selection",
936
+ "touched",
937
+ "class",
938
+ "value",
939
+ "weekNumber"
940
+ ],
941
+ outputs: ["touch", "valueChange"]
942
+ },
943
+ {
944
+ kind: "directive",
945
+ type: CalendarDecadeCellTemplateDirective,
946
+ selector: "ng-template[monaCalendarDecadeCellTemplate]"
947
+ },
948
+ {
949
+ kind: "directive",
950
+ type: CalendarMonthCellTemplateDirective,
951
+ selector: "ng-template[monaCalendarMonthCellTemplate]"
952
+ },
953
+ {
954
+ kind: "directive",
955
+ type: CalendarYearCellTemplateDirective,
956
+ selector: "ng-template[monaCalendarYearCellTemplate]"
957
+ },
958
+ {
959
+ kind: "directive",
960
+ type: CdkTrapFocus,
961
+ selector: "[cdkTrapFocus]",
962
+ inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"],
963
+ exportAs: ["cdkTrapFocus"]
964
+ },
965
+ {
966
+ kind: "component",
967
+ type: LucideCalendar,
968
+ selector: "svg[lucideCalendar]"
969
+ },
970
+ {
971
+ kind: "directive",
972
+ type: NgTemplateOutlet,
973
+ selector: "[ngTemplateOutlet]",
974
+ inputs: [
975
+ "ngTemplateOutletContext",
976
+ "ngTemplateOutlet",
977
+ "ngTemplateOutletInjector"
978
+ ]
979
+ },
980
+ {
981
+ kind: "component",
982
+ type: TextBoxComponent,
983
+ selector: "mona-text-box",
984
+ inputs: [
985
+ "aria-describedby",
986
+ "aria-label",
987
+ "aria-labelledby",
988
+ "clearButton",
989
+ "disabled",
990
+ "inputAttributes",
991
+ "inputClass",
992
+ "inputId",
993
+ "inputStyle",
994
+ "invalid",
995
+ "maxLength",
996
+ "minLength",
997
+ "name",
998
+ "placeholder",
999
+ "readonly",
1000
+ "required",
1001
+ "rounded",
1002
+ "size",
1003
+ "touched",
1004
+ "type",
1005
+ "class",
1006
+ "value"
1007
+ ],
1008
+ outputs: [
1009
+ "inputBlur",
1010
+ "inputFocus",
1011
+ "touch",
1012
+ "valueChange"
1013
+ ]
1014
+ }
1015
+ ],
1016
+ viewProviders: [...FIELD_ASSOCIATION_BOUNDARY]
1017
+ });
1018
+ }
1019
+ };
1020
+ i0.ɵɵngDeclareClassMetadata({
1021
+ minVersion: "12.0.0",
1022
+ version: "22.2.6",
1023
+ ngImport: i0,
1024
+ type: DateRangePickerComponent,
1025
+ decorators: [{
1026
+ type: Component,
1027
+ args: [{
1028
+ selector: "mona-date-range-picker",
1029
+ providers: [
1030
+ DropdownService,
1031
+ CalendarService,
1032
+ {
1033
+ provide: DROPDOWN_POPUP_INPUT_TOKEN,
1034
+ useExisting: forwardRef(() => DateRangePickerComponent),
1035
+ multi: false
1036
+ }
1037
+ ],
1038
+ imports: [
1039
+ ButtonDirective,
1040
+ CalendarComponent,
1041
+ CalendarDecadeCellTemplateDirective,
1042
+ CalendarMonthCellTemplateDirective,
1043
+ CalendarYearCellTemplateDirective,
1044
+ CdkTrapFocus,
1045
+ LucideCalendar,
1046
+ NgTemplateOutlet,
1047
+ TextBoxComponent
1048
+ ],
1049
+ hostDirectives: [DropdownPopupHandlerDirective],
1050
+ viewProviders: [...FIELD_ASSOCIATION_BOUNDARY],
1051
+ host: {
1052
+ role: "group",
1053
+ "[attr.aria-describedby]": "null",
1054
+ "[attr.aria-disabled]": "effectiveDisabled() || null",
1055
+ "[attr.aria-label]": "ariaLabel() || null",
1056
+ "[attr.aria-labelledby]": "labelledBy()",
1057
+ "[attr.tabindex]": "effectiveDisabled() ? null : -1",
1058
+ "[attr.data-disabled]": "effectiveDisabled() || null",
1059
+ "[attr.data-expanded]": "expanded()",
1060
+ "[attr.data-invalid]": "invalidState() || null",
1061
+ "[attr.data-readonly]": "readonly() || null",
1062
+ "[class]": "baseClass()",
1063
+ "(focusin)": "onFocusIn($event)",
1064
+ "(focusout)": "onFocusOut($event)",
1065
+ "(keydown)": "onKeydown($event)"
1066
+ },
1067
+ template: "<span [class]=\"fieldClass\">\n <span aria-hidden=\"true\" [class]=\"sizerClass()\">\n @for (text of startSizerTexts(); track $index) {\n <span class=\"block\">{{ text }}</span>\n }\n </span>\n <mona-text-box\n (inputBlur)=\"onInputBlur('start')\"\n (inputFocus)=\"onInputFocus('start')\"\n (valueChange)=\"typedInput.edit('start', $event)\"\n [aria-describedby]=\"describedBy() ?? ''\"\n [aria-label]=\"messages().start\"\n [clearButton]=\"showClearButton()\"\n [disabled]=\"effectiveDisabled()\"\n [inputAttributes]=\"inputAttributes()\"\n [inputClass]=\"inputClass\"\n [inputId]=\"startInputId\"\n [inputStyle]=\"inputStyle\"\n [invalid]=\"startInvalid()\"\n [placeholder]=\"startPlaceholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"startInvalid() || touched()\"\n [value]=\"typedInput.text.start()\" />\n</span>\n<span aria-hidden=\"true\" [class]=\"separatorClass\">–</span>\n<span [class]=\"fieldClass\">\n <span aria-hidden=\"true\" [class]=\"sizerClass()\">\n @for (text of endSizerTexts(); track $index) {\n <span class=\"block\">{{ text }}</span>\n }\n </span>\n <mona-text-box\n (inputBlur)=\"onInputBlur('end')\"\n (inputFocus)=\"onInputFocus('end')\"\n (valueChange)=\"typedInput.edit('end', $event)\"\n [aria-describedby]=\"describedBy() ?? ''\"\n [aria-label]=\"messages().end\"\n [clearButton]=\"showClearButton()\"\n [disabled]=\"effectiveDisabled()\"\n [inputAttributes]=\"inputAttributes()\"\n [inputClass]=\"inputClass\"\n [inputId]=\"endInputId\"\n [inputStyle]=\"inputStyle\"\n [invalid]=\"endInvalid()\"\n [placeholder]=\"endPlaceholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"endInvalid() || touched()\"\n [value]=\"typedInput.text.end()\" />\n</span>\n<button\n monaButton\n look=\"ghost\"\n [class]=\"buttonClass()\"\n [attr.aria-controls]=\"popupId\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-label]=\"messages().openCalendar\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [iconOnly]=\"true\"\n [rounded]=\"'none'\"\n [size]=\"size()\"\n [tabindex]=\"-1\"\n (click)=\"onCalendarButtonClick()\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n</button>\n\n<ng-template #popupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().dateRangePicker\"\n cdkTrapFocus>\n @if (presetItems().length > 0) {\n <div role=\"group\" [attr.aria-label]=\"messages().presets\" [class]=\"presetListClass\" (keydown)=\"onPresetKeydown($event)\">\n @for (item of presetItems(); track $index) {\n <button\n monaButton\n look=\"ghost\"\n type=\"button\"\n [class]=\"presetClass()\"\n [disabled]=\"item.disabled\"\n [rounded]=\"rounded()\"\n [selected]=\"item.selected\"\n size=\"small\"\n [toggleable]=\"true\"\n (click)=\"onPresetClick(item)\">\n {{ item.label }}\n </button>\n }\n </div>\n }\n <mona-calendar\n focusOnMount\n selection=\"range\"\n [disabledDates]=\"disabledDates()\"\n [firstDay]=\"firstDay()\"\n [maxDate]=\"maxDate()\"\n [minDate]=\"minDate()\"\n [months]=\"months()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n [value]=\"calendarValue()\"\n [weekNumber]=\"weekNumber()\"\n (valueChange)=\"onCalendarValueChange($event)\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n</ng-template>\n"
1068
+ }]
1069
+ }],
1070
+ ctorParameters: () => [],
1071
+ propDecorators: {
1072
+ decadeCellTemplate: [{
1073
+ type: i0.ContentChild,
1074
+ args: [i0.forwardRef(() => CalendarDecadeCellTemplateDirective), { isSignal: true }]
1075
+ }],
1076
+ monthCellTemplate: [{
1077
+ type: i0.ContentChild,
1078
+ args: [i0.forwardRef(() => CalendarMonthCellTemplateDirective), { isSignal: true }]
1079
+ }],
1080
+ popupTemplate: [{
1081
+ type: i0.ViewChild,
1082
+ args: ["popupTemplate", { isSignal: true }]
1083
+ }],
1084
+ yearCellTemplate: [{
1085
+ type: i0.ContentChild,
1086
+ args: [i0.forwardRef(() => CalendarYearCellTemplateDirective), { isSignal: true }]
1087
+ }],
1088
+ ariaDescribedBy: [{
1089
+ type: i0.Input,
1090
+ args: [{
1091
+ isSignal: true,
1092
+ alias: "aria-describedby",
1093
+ required: false
1094
+ }]
1095
+ }],
1096
+ ariaLabel: [{
1097
+ type: i0.Input,
1098
+ args: [{
1099
+ isSignal: true,
1100
+ alias: "aria-label",
1101
+ required: false
1102
+ }]
1103
+ }],
1104
+ ariaLabelledBy: [{
1105
+ type: i0.Input,
1106
+ args: [{
1107
+ isSignal: true,
1108
+ alias: "aria-labelledby",
1109
+ required: false
1110
+ }]
1111
+ }],
1112
+ close: [{
1113
+ type: i0.Output,
1114
+ args: ["close"]
1115
+ }],
1116
+ closed: [{
1117
+ type: i0.Output,
1118
+ args: ["closed"]
1119
+ }],
1120
+ disabled: [{
1121
+ type: i0.Input,
1122
+ args: [{
1123
+ isSignal: true,
1124
+ alias: "disabled",
1125
+ required: false
1126
+ }]
1127
+ }],
1128
+ disabledDates: [{
1129
+ type: i0.Input,
1130
+ args: [{
1131
+ isSignal: true,
1132
+ alias: "disabledDates",
1133
+ required: false
1134
+ }]
1135
+ }],
1136
+ endPlaceholder: [{
1137
+ type: i0.Input,
1138
+ args: [{
1139
+ isSignal: true,
1140
+ alias: "endPlaceholder",
1141
+ required: false
1142
+ }]
1143
+ }],
1144
+ firstDay: [{
1145
+ type: i0.Input,
1146
+ args: [{
1147
+ isSignal: true,
1148
+ alias: "firstDay",
1149
+ required: false
1150
+ }]
1151
+ }],
1152
+ format: [{
1153
+ type: i0.Input,
1154
+ args: [{
1155
+ isSignal: true,
1156
+ alias: "format",
1157
+ required: false
1158
+ }]
1159
+ }],
1160
+ invalid: [{
1161
+ type: i0.Input,
1162
+ args: [{
1163
+ isSignal: true,
1164
+ alias: "invalid",
1165
+ required: false
1166
+ }]
1167
+ }],
1168
+ maxDate: [{
1169
+ type: i0.Input,
1170
+ args: [{
1171
+ isSignal: true,
1172
+ alias: "maxDate",
1173
+ required: false
1174
+ }]
1175
+ }],
1176
+ minDate: [{
1177
+ type: i0.Input,
1178
+ args: [{
1179
+ isSignal: true,
1180
+ alias: "minDate",
1181
+ required: false
1182
+ }]
1183
+ }],
1184
+ months: [{
1185
+ type: i0.Input,
1186
+ args: [{
1187
+ isSignal: true,
1188
+ alias: "months",
1189
+ required: false
1190
+ }]
1191
+ }],
1192
+ open: [{
1193
+ type: i0.Output,
1194
+ args: ["open"]
1195
+ }],
1196
+ opened: [{
1197
+ type: i0.Output,
1198
+ args: ["opened"]
1199
+ }],
1200
+ popupClass: [{
1201
+ type: i0.Input,
1202
+ args: [{
1203
+ isSignal: true,
1204
+ alias: "popupClass",
1205
+ required: false
1206
+ }]
1207
+ }],
1208
+ popupHeight: [{
1209
+ type: i0.Input,
1210
+ args: [{
1211
+ isSignal: true,
1212
+ alias: "popupHeight",
1213
+ required: false
1214
+ }]
1215
+ }],
1216
+ popupWidth: [{
1217
+ type: i0.Input,
1218
+ args: [{
1219
+ isSignal: true,
1220
+ alias: "popupWidth",
1221
+ required: false
1222
+ }]
1223
+ }],
1224
+ presets: [{
1225
+ type: i0.Input,
1226
+ args: [{
1227
+ isSignal: true,
1228
+ alias: "presets",
1229
+ required: false
1230
+ }]
1231
+ }],
1232
+ readonly: [{
1233
+ type: i0.Input,
1234
+ args: [{
1235
+ isSignal: true,
1236
+ alias: "readonly",
1237
+ required: false
1238
+ }]
1239
+ }],
1240
+ readonlyInput: [{
1241
+ type: i0.Input,
1242
+ args: [{
1243
+ isSignal: true,
1244
+ alias: "readonlyInput",
1245
+ required: false
1246
+ }]
1247
+ }],
1248
+ required: [{
1249
+ type: i0.Input,
1250
+ args: [{
1251
+ isSignal: true,
1252
+ alias: "required",
1253
+ required: false
1254
+ }]
1255
+ }],
1256
+ rounded: [{
1257
+ type: i0.Input,
1258
+ args: [{
1259
+ isSignal: true,
1260
+ alias: "rounded",
1261
+ required: false
1262
+ }]
1263
+ }],
1264
+ showClearButton: [{
1265
+ type: i0.Input,
1266
+ args: [{
1267
+ isSignal: true,
1268
+ alias: "showClearButton",
1269
+ required: false
1270
+ }]
1271
+ }],
1272
+ size: [{
1273
+ type: i0.Input,
1274
+ args: [{
1275
+ isSignal: true,
1276
+ alias: "size",
1277
+ required: false
1278
+ }]
1279
+ }],
1280
+ startPlaceholder: [{
1281
+ type: i0.Input,
1282
+ args: [{
1283
+ isSignal: true,
1284
+ alias: "startPlaceholder",
1285
+ required: false
1286
+ }]
1287
+ }],
1288
+ touch: [{
1289
+ type: i0.Output,
1290
+ args: ["touch"]
1291
+ }],
1292
+ touched: [{
1293
+ type: i0.Input,
1294
+ args: [{
1295
+ isSignal: true,
1296
+ alias: "touched",
1297
+ required: false
1298
+ }]
1299
+ }],
1300
+ userClass: [{
1301
+ type: i0.Input,
1302
+ args: [{
1303
+ isSignal: true,
1304
+ alias: "class",
1305
+ required: false
1306
+ }]
1307
+ }],
1308
+ value: [{
1309
+ type: i0.Input,
1310
+ args: [{
1311
+ isSignal: true,
1312
+ alias: "value",
1313
+ required: false
1314
+ }]
1315
+ }, {
1316
+ type: i0.Output,
1317
+ args: ["valueChange"]
1318
+ }],
1319
+ weekNumber: [{
1320
+ type: i0.Input,
1321
+ args: [{
1322
+ isSignal: true,
1323
+ alias: "weekNumber",
1324
+ required: false
1325
+ }]
1326
+ }]
1327
+ }
1328
+ });
1329
+ export { DATE_RANGE_PICKER_DEFAULT_MESSAGES, DateRangePickerComponent };
1330
+
1331
+ //# sourceMappingURL=nanahoshi-mona-ui-date-range-picker.mjs.map