@calendrix/angular 0.0.0-stage → 0.1.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.
@@ -0,0 +1,2190 @@
1
+ import { NgTemplateOutlet, DOCUMENT } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { input, inject, ElementRef, Renderer2, effect, DestroyRef, Directive, model, output, booleanAttribute, signal, computed, afterEveryRender, forwardRef, ChangeDetectionStrategy, Component, afterNextRender, viewChild, Injector, untracked } from '@angular/core';
4
+ import { normalizeAttributes, createCalendar, toSystem, isEmptySelection, pickerLabelsFor, convertDate, formatDate, formatDateRange, registerCalendar, formatSelection, parseDateRange, parseDate, isRangeSelectable, isDateSelectable, createTimeField, formatDateTimeRange, formatDateTime, parseDateTimeRange, parseDateTime, isTimeSelectable, stickEndToStart } from '@calendrix/core';
5
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
6
+ import { computePosition, offset, flip, shift, size, autoUpdate } from '@floating-ui/dom';
7
+
8
+ /**
9
+ * Applies what a prop getter of the core returns (`{ attrs, handlers }`) to an element:
10
+ * the attributes, and the handlers as event listeners. Set `calendrixHandlers` to false to apply
11
+ * only the attributes, when the component handles the events itself.
12
+ */
13
+ class CalendrixPropsDirective {
14
+ props = input(undefined, { ...(ngDevMode ? { debugName: "props" } : /* istanbul ignore next */ {}), alias: 'calendrixProps' });
15
+ handlers = input(true, { ...(ngDevMode ? { debugName: "handlers" } : /* istanbul ignore next */ {}), alias: 'calendrixHandlers' });
16
+ element = inject(ElementRef).nativeElement;
17
+ renderer = inject(Renderer2);
18
+ applied = new Set();
19
+ latest = {};
20
+ listeners = new Map();
21
+ constructor() {
22
+ effect(() => {
23
+ const props = this.props();
24
+ this.applyAttributes(props?.attrs ?? {});
25
+ // A listener is added once per event; it calls the newest handler.
26
+ this.latest = this.handlers()
27
+ ? (props?.handlers ?? {})
28
+ : {};
29
+ for (const name of Object.keys(this.latest)) {
30
+ if (this.listeners.has(name))
31
+ continue;
32
+ this.listeners.set(name, this.renderer.listen(this.element, name, (event) => this.latest[name]?.(event)));
33
+ }
34
+ });
35
+ inject(DestroyRef).onDestroy(() => {
36
+ for (const stop of this.listeners.values())
37
+ stop();
38
+ });
39
+ }
40
+ applyAttributes(attrs) {
41
+ const text = normalizeAttributes(attrs);
42
+ for (const [name, value] of Object.entries(text)) {
43
+ this.renderer.setAttribute(this.element, name, value);
44
+ }
45
+ for (const name of this.applied) {
46
+ if (!(name in text))
47
+ this.renderer.removeAttribute(this.element, name);
48
+ }
49
+ this.applied = new Set(Object.keys(text));
50
+ }
51
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixPropsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
52
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.26", type: CalendrixPropsDirective, isStandalone: true, selector: "[calendrixProps]", inputs: { props: { classPropertyName: "props", publicName: "calendrixProps", isSignal: true, isRequired: false, transformFunction: null }, handlers: { classPropertyName: "handlers", publicName: "calendrixHandlers", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
53
+ }
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixPropsDirective, decorators: [{
55
+ type: Directive,
56
+ args: [{ selector: '[calendrixProps]' }]
57
+ }], ctorParameters: () => [], propDecorators: { props: [{ type: i0.Input, args: [{ isSignal: true, alias: "calendrixProps", required: false }] }], handlers: [{ type: i0.Input, args: [{ isSignal: true, alias: "calendrixHandlers", required: false }] }] } });
58
+
59
+ const COLUMNS = 3;
60
+ const cellKey = (date) => `${date.year}-${date.month}-${date.day}`;
61
+ function chunk(items, size) {
62
+ const rows = [];
63
+ for (let i = 0; i < items.length; i += size)
64
+ rows.push(items.slice(i, i + size));
65
+ return rows;
66
+ }
67
+ /**
68
+ * A month calendar with the ARIA grid pattern. The month and the year in the header are buttons:
69
+ * they open a grid of months and a page of years. `visibleMonths` shows up to three months side
70
+ * by side, and `selection` picks one day, a range or many days. It has no styles of its own: use
71
+ * the `calendrix-*` classes and the `data-*` attributes. Use `[(value)]` to read and set the value.
72
+ */
73
+ class CalendrixCalendar {
74
+ /** One day (default), a range with a start and an end, or any number of separate days. */
75
+ selection = input('single', ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
76
+ /** The selection. Use `[(value)]`. The type follows `selection`. */
77
+ value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
78
+ defaultValue = input(...(ngDevMode ? [undefined, { debugName: "defaultValue" }] : /* istanbul ignore next */ []));
79
+ system = input(...(ngDevMode ? [undefined, { debugName: "system" }] : /* istanbul ignore next */ []));
80
+ locale = input(...(ngDevMode ? [undefined, { debugName: "locale" }] : /* istanbul ignore next */ []));
81
+ direction = input(...(ngDevMode ? [undefined, { debugName: "direction" }] : /* istanbul ignore next */ []));
82
+ weekStart = input(...(ngDevMode ? [undefined, { debugName: "weekStart" }] : /* istanbul ignore next */ []));
83
+ plugins = input(...(ngDevMode ? [undefined, { debugName: "plugins" }] : /* istanbul ignore next */ []));
84
+ focusedDate = input(...(ngDevMode ? [undefined, { debugName: "focusedDate" }] : /* istanbul ignore next */ []));
85
+ focusedDateChange = output();
86
+ /** How many months are shown at once: 1 (default), 2 or 3. */
87
+ visibleMonths = input(...(ngDevMode ? [undefined, { debugName: "visibleMonths" }] : /* istanbul ignore next */ []));
88
+ allowUnavailableInRange = input(...(ngDevMode ? [undefined, { debugName: "allowUnavailableInRange" }] : /* istanbul ignore next */ []));
89
+ maxSelected = input(...(ngDevMode ? [undefined, { debugName: "maxSelected" }] : /* istanbul ignore next */ []));
90
+ minDate = input(...(ngDevMode ? [undefined, { debugName: "minDate" }] : /* istanbul ignore next */ []));
91
+ maxDate = input(...(ngDevMode ? [undefined, { debugName: "maxDate" }] : /* istanbul ignore next */ []));
92
+ isDateUnavailable = input(...(ngDevMode ? [undefined, { debugName: "isDateUnavailable" }] : /* istanbul ignore next */ []));
93
+ labels = input(...(ngDevMode ? [undefined, { debugName: "labels" }] : /* istanbul ignore next */ []));
94
+ timeZone = input(...(ngDevMode ? [undefined, { debugName: "timeZone" }] : /* istanbul ignore next */ []));
95
+ now = input(...(ngDevMode ? [undefined, { debugName: "now" }] : /* istanbul ignore next */ []));
96
+ /** The user cannot change anything (ADR 0022). A form can also disable the calendar. */
97
+ disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
98
+ /**
99
+ * Created again in `ngOnInit`, when the inputs are known: the core reads some options (`now`,
100
+ * `timeZone`, `defaultValue`, `focusedDate`) only when it is created.
101
+ */
102
+ calendar = createCalendar({});
103
+ /** The snapshot of the core: the same object until something changes. */
104
+ state = signal(this.calendar.getState(), ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
105
+ unsubscribe = () => undefined;
106
+ host = inject(ElementRef);
107
+ /** The last `focusRequest` of the core that this component has seen (see `CalendarState`). */
108
+ seenFocusRequest = 0;
109
+ handleChange = (next) => {
110
+ this.value.set(next);
111
+ this.onChangeFn(next);
112
+ };
113
+ handleFocusedDate = (date) => this.focusedDateChange.emit(date);
114
+ options = computed(() => ({
115
+ selection: this.selection(),
116
+ value: this.value(),
117
+ defaultValue: this.defaultValue(),
118
+ system: this.system(),
119
+ locale: this.locale(),
120
+ direction: this.direction(),
121
+ weekStart: this.weekStart(),
122
+ plugins: this.plugins(),
123
+ focusedDate: this.focusedDate(),
124
+ visibleMonths: this.visibleMonths(),
125
+ allowUnavailableInRange: this.allowUnavailableInRange(),
126
+ maxSelected: this.maxSelected(),
127
+ minDate: this.minDate(),
128
+ maxDate: this.maxDate(),
129
+ isDateUnavailable: this.isDateUnavailable(),
130
+ labels: this.labels(),
131
+ timeZone: this.timeZone(),
132
+ now: this.now(),
133
+ disabled: this.disabled(),
134
+ onChange: this.handleChange,
135
+ onFocusedDateChange: this.handleFocusedDate,
136
+ }), ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
137
+ /** Everything the template needs, computed once for each state. */
138
+ view = computed(() => {
139
+ const state = this.state();
140
+ const calendar = this.calendar;
141
+ const multi = state.view === 'days' && state.visibleMonths > 1;
142
+ const lastIndex = state.grids.length - 1;
143
+ return {
144
+ state,
145
+ multi,
146
+ root: calendar.getRootProps(),
147
+ gridProps: calendar.getGridProps(),
148
+ prev: calendar.getPrevButtonProps(),
149
+ next: calendar.getNextButtonProps(),
150
+ monthButton: calendar.getMonthButtonProps(),
151
+ yearButton: calendar.getYearButtonProps(),
152
+ grids: state.grids.map((grid, index) => ({
153
+ grid,
154
+ index,
155
+ key: `${grid.year}-${grid.month}`,
156
+ props: calendar.getGridProps(index),
157
+ isLast: state.view !== 'days' || index === lastIndex,
158
+ weeks: grid.weeks.map((week) => week.map((cell) => ({
159
+ cell,
160
+ key: cellKey(cell.date),
161
+ // `null` marks a day of another month, left empty when several months are shown.
162
+ props: multi && cell.isOutsideMonth ? null : calendar.getDayProps(cell.date),
163
+ }))),
164
+ })),
165
+ monthRows: chunk(state.months.map((cell) => ({ cell, props: calendar.getMonthProps(cell.month) })), COLUMNS),
166
+ yearRows: chunk(state.years.map((cell) => ({ cell, props: calendar.getYearProps(cell.year) })), COLUMNS),
167
+ };
168
+ }, ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
169
+ constructor() {
170
+ inject(DestroyRef).onDestroy(() => {
171
+ this.unsubscribe();
172
+ this.calendar.destroy();
173
+ });
174
+ effect(() => this.calendar.setOptions(this.options()));
175
+ afterEveryRender(() => {
176
+ const request = this.state().focusRequest;
177
+ if (request === this.seenFocusRequest)
178
+ return;
179
+ this.seenFocusRequest = request;
180
+ this.focusFocusedCell();
181
+ });
182
+ }
183
+ ngOnInit() {
184
+ this.calendar.destroy();
185
+ this.calendar = createCalendar(this.options());
186
+ this.unsubscribe = this.calendar.subscribe(() => this.state.set(this.calendar.getState()));
187
+ this.state.set(this.calendar.getState());
188
+ }
189
+ // ControlValueAccessor: a form writes the value in and hears about changes made by the user.
190
+ onChangeFn = () => undefined;
191
+ onTouchedFn = () => undefined;
192
+ formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
193
+ /** Disabled by the `disabled` input or by the form. */
194
+ disabled = computed(() => this.disabledInput() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
195
+ writeValue(value) {
196
+ // null or undefined from a form (a reset, a new control) means empty.
197
+ this.value.set((value ?? (this.selection() === 'multiple' ? [] : null)));
198
+ }
199
+ registerOnChange(fn) {
200
+ this.onChangeFn = fn;
201
+ }
202
+ registerOnTouched(fn) {
203
+ this.onTouchedFn = fn;
204
+ }
205
+ setDisabledState(isDisabled) {
206
+ this.formDisabled.set(isDisabled);
207
+ }
208
+ /** The control is touched when the focus leaves the whole calendar, not between its cells. */
209
+ onFocusOut(event) {
210
+ if (!this.host.nativeElement.contains(event.relatedTarget))
211
+ this.onTouchedFn();
212
+ }
213
+ focusFocusedCell() {
214
+ this.host.nativeElement.querySelector('[role="grid"] [tabindex="0"]')?.focus();
215
+ }
216
+ onGridKeydown(event) {
217
+ // A handled key gives a new `focusRequest`; the hook in the constructor moves the focus.
218
+ this.calendar.handleKeyDown(event);
219
+ }
220
+ /** Escape leaves the months or the years from anywhere in the calendar, also from a button. */
221
+ onRootKeydown(event) {
222
+ if (event.key !== 'Escape' ||
223
+ event.defaultPrevented ||
224
+ this.calendar.getState().view === 'days') {
225
+ return;
226
+ }
227
+ event.preventDefault();
228
+ this.calendar.setView('days');
229
+ }
230
+ /** Buttons and cells that change the view: the core asks for the focus to move to the grid. */
231
+ switchView(props) {
232
+ props.handlers.click();
233
+ }
234
+ onPointerLeave() {
235
+ this.calendar.previewTo(null);
236
+ }
237
+ /** With several months a week of only other months' days has no cell: it is hidden from assistive technology. */
238
+ isEmptyWeek(week) {
239
+ return week.every((day) => !day.props);
240
+ }
241
+ onGridPointerLeave() {
242
+ if (!this.view().multi)
243
+ this.calendar.previewTo(null);
244
+ }
245
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component });
246
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: CalendrixCalendar, isStandalone: true, selector: "calendrix-calendar", inputs: { selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, system: { classPropertyName: "system", publicName: "system", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, weekStart: { classPropertyName: "weekStart", publicName: "weekStart", isSignal: true, isRequired: false, transformFunction: null }, plugins: { classPropertyName: "plugins", publicName: "plugins", isSignal: true, isRequired: false, transformFunction: null }, focusedDate: { classPropertyName: "focusedDate", publicName: "focusedDate", isSignal: true, isRequired: false, transformFunction: null }, visibleMonths: { classPropertyName: "visibleMonths", publicName: "visibleMonths", isSignal: true, isRequired: false, transformFunction: null }, allowUnavailableInRange: { classPropertyName: "allowUnavailableInRange", publicName: "allowUnavailableInRange", isSignal: true, isRequired: false, transformFunction: null }, maxSelected: { classPropertyName: "maxSelected", publicName: "maxSelected", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, isDateUnavailable: { classPropertyName: "isDateUnavailable", publicName: "isDateUnavailable", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null }, now: { classPropertyName: "now", publicName: "now", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", focusedDateChange: "focusedDateChange" }, providers: [
247
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CalendrixCalendar), multi: true },
248
+ ], ngImport: i0, template: `
249
+ <div
250
+ class="calendrix-calendar"
251
+ [calendrixProps]="view().root"
252
+ [calendrixHandlers]="false"
253
+ [attr.data-view]="view().state.view"
254
+ [attr.data-months]="view().multi ? view().state.visibleMonths : null"
255
+ (keydown)="onRootKeydown($event)"
256
+ (focusout)="onFocusOut($event)"
257
+ >
258
+ @if (view().multi) {
259
+ <div class="calendrix-panels" (pointerleave)="onPointerLeave()">
260
+ @for (g of view().grids; track g.key) {
261
+ <div class="calendrix-panel">
262
+ <ng-container
263
+ [ngTemplateOutlet]="header"
264
+ [ngTemplateOutletContext]="{ $implicit: g }"
265
+ ></ng-container>
266
+ <ng-container
267
+ [ngTemplateOutlet]="dayGrid"
268
+ [ngTemplateOutletContext]="{ $implicit: g }"
269
+ ></ng-container>
270
+ </div>
271
+ }
272
+ </div>
273
+ } @else {
274
+ @if (view().grids[0]; as g) {
275
+ <ng-container
276
+ [ngTemplateOutlet]="header"
277
+ [ngTemplateOutletContext]="{ $implicit: g }"
278
+ ></ng-container>
279
+
280
+ @if (view().state.view === 'days') {
281
+ <ng-container
282
+ [ngTemplateOutlet]="dayGrid"
283
+ [ngTemplateOutletContext]="{ $implicit: g }"
284
+ ></ng-container>
285
+ } @else {
286
+ <div
287
+ class="calendrix-grid"
288
+ [attr.data-view]="view().state.view"
289
+ [calendrixProps]="view().gridProps"
290
+ [calendrixHandlers]="false"
291
+ (keydown)="onGridKeydown($event)"
292
+ >
293
+ @if (view().state.view === 'months') {
294
+ @for (row of view().monthRows; track $index) {
295
+ <div role="row" class="calendrix-row">
296
+ @for (item of row; track item.cell.month) {
297
+ <div
298
+ class="calendrix-month"
299
+ [calendrixProps]="item.props"
300
+ [calendrixHandlers]="false"
301
+ (click)="switchView(item.props)"
302
+ >
303
+ {{ item.cell.label }}
304
+ </div>
305
+ }
306
+ </div>
307
+ }
308
+ } @else {
309
+ @for (row of view().yearRows; track $index) {
310
+ <div role="row" class="calendrix-row">
311
+ @for (item of row; track item.cell.year) {
312
+ <div
313
+ class="calendrix-year"
314
+ [calendrixProps]="item.props"
315
+ [calendrixHandlers]="false"
316
+ (click)="switchView(item.props)"
317
+ >
318
+ {{ item.cell.label }}
319
+ </div>
320
+ }
321
+ </div>
322
+ }
323
+ }
324
+ </div>
325
+ }
326
+ }
327
+ }
328
+ </div>
329
+
330
+ <ng-template #header let-g>
331
+ <div class="calendrix-header">
332
+ @if (g.index === 0) {
333
+ <button type="button" class="calendrix-nav calendrix-prev" [calendrixProps]="view().prev">
334
+ <svg
335
+ class="calendrix-chevron"
336
+ aria-hidden="true"
337
+ focusable="false"
338
+ width="16"
339
+ height="16"
340
+ viewBox="0 0 16 16"
341
+ >
342
+ <path
343
+ d="M10 3 5 8l5 5"
344
+ fill="none"
345
+ stroke="currentColor"
346
+ stroke-width="1.5"
347
+ stroke-linecap="round"
348
+ stroke-linejoin="round"
349
+ />
350
+ </svg>
351
+ </button>
352
+
353
+ <div class="calendrix-title" aria-live="polite">
354
+ @if (view().state.view !== 'years') {
355
+ <button
356
+ type="button"
357
+ class="calendrix-title-button calendrix-month-button"
358
+ [calendrixProps]="view().monthButton"
359
+ [calendrixHandlers]="false"
360
+ (click)="switchView(view().monthButton)"
361
+ >
362
+ {{ view().state.monthName }}
363
+ </button>
364
+ }
365
+ <button
366
+ type="button"
367
+ class="calendrix-title-button calendrix-year-button"
368
+ [calendrixProps]="view().yearButton"
369
+ [calendrixHandlers]="false"
370
+ (click)="switchView(view().yearButton)"
371
+ >
372
+ {{ view().state.view === 'years' ? view().state.yearsLabel : view().state.yearLabel }}
373
+ </button>
374
+ </div>
375
+ } @else {
376
+ <span class="calendrix-nav-spacer" aria-hidden="true"></span>
377
+ <div class="calendrix-title">
378
+ <span class="calendrix-title-text">{{ g.grid.monthName }}</span>
379
+ <span class="calendrix-title-text">{{ g.grid.yearLabel }}</span>
380
+ </div>
381
+ }
382
+
383
+ @if (g.isLast) {
384
+ <button type="button" class="calendrix-nav calendrix-next" [calendrixProps]="view().next">
385
+ <svg
386
+ class="calendrix-chevron"
387
+ aria-hidden="true"
388
+ focusable="false"
389
+ width="16"
390
+ height="16"
391
+ viewBox="0 0 16 16"
392
+ >
393
+ <path
394
+ d="M6 3l5 5-5 5"
395
+ fill="none"
396
+ stroke="currentColor"
397
+ stroke-width="1.5"
398
+ stroke-linecap="round"
399
+ stroke-linejoin="round"
400
+ />
401
+ </svg>
402
+ </button>
403
+ } @else {
404
+ <span class="calendrix-nav-spacer" aria-hidden="true"></span>
405
+ }
406
+ </div>
407
+ </ng-template>
408
+
409
+ <ng-template #dayGrid let-g>
410
+ <div
411
+ class="calendrix-grid"
412
+ data-view="days"
413
+ [calendrixProps]="g.props"
414
+ [calendrixHandlers]="false"
415
+ (keydown)="onGridKeydown($event)"
416
+ (pointerleave)="onGridPointerLeave()"
417
+ >
418
+ <div role="row" class="calendrix-weekdays">
419
+ @for (label of view().state.weekdayLabels; track label.long) {
420
+ <div role="columnheader" class="calendrix-weekday" [attr.aria-label]="label.long">
421
+ {{ label.short }}
422
+ </div>
423
+ }
424
+ </div>
425
+ @for (week of g.weeks; track $index) {
426
+ <div
427
+ role="row"
428
+ class="calendrix-week"
429
+ [attr.aria-hidden]="isEmptyWeek(week) ? 'true' : null"
430
+ >
431
+ @for (day of week; track day.key) {
432
+ @if (day.props) {
433
+ <div
434
+ class="calendrix-day"
435
+ [calendrixProps]="day.props"
436
+ (pointerenter)="calendar.previewTo(day.cell.date)"
437
+ >
438
+ {{ day.cell.label }}
439
+ </div>
440
+ } @else {
441
+ <!-- With several months every day shows once: the days of the other months stay empty. -->
442
+ <div role="presentation" class="calendrix-day-empty"></div>
443
+ }
444
+ }
445
+ </div>
446
+ }
447
+ </div>
448
+ </ng-template>
449
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CalendrixPropsDirective, selector: "[calendrixProps]", inputs: ["calendrixProps", "calendrixHandlers"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
450
+ }
451
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixCalendar, decorators: [{
452
+ type: Component,
453
+ args: [{
454
+ selector: 'calendrix-calendar',
455
+ imports: [NgTemplateOutlet, CalendrixPropsDirective],
456
+ providers: [
457
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CalendrixCalendar), multi: true },
458
+ ],
459
+ changeDetection: ChangeDetectionStrategy.OnPush,
460
+ template: `
461
+ <div
462
+ class="calendrix-calendar"
463
+ [calendrixProps]="view().root"
464
+ [calendrixHandlers]="false"
465
+ [attr.data-view]="view().state.view"
466
+ [attr.data-months]="view().multi ? view().state.visibleMonths : null"
467
+ (keydown)="onRootKeydown($event)"
468
+ (focusout)="onFocusOut($event)"
469
+ >
470
+ @if (view().multi) {
471
+ <div class="calendrix-panels" (pointerleave)="onPointerLeave()">
472
+ @for (g of view().grids; track g.key) {
473
+ <div class="calendrix-panel">
474
+ <ng-container
475
+ [ngTemplateOutlet]="header"
476
+ [ngTemplateOutletContext]="{ $implicit: g }"
477
+ ></ng-container>
478
+ <ng-container
479
+ [ngTemplateOutlet]="dayGrid"
480
+ [ngTemplateOutletContext]="{ $implicit: g }"
481
+ ></ng-container>
482
+ </div>
483
+ }
484
+ </div>
485
+ } @else {
486
+ @if (view().grids[0]; as g) {
487
+ <ng-container
488
+ [ngTemplateOutlet]="header"
489
+ [ngTemplateOutletContext]="{ $implicit: g }"
490
+ ></ng-container>
491
+
492
+ @if (view().state.view === 'days') {
493
+ <ng-container
494
+ [ngTemplateOutlet]="dayGrid"
495
+ [ngTemplateOutletContext]="{ $implicit: g }"
496
+ ></ng-container>
497
+ } @else {
498
+ <div
499
+ class="calendrix-grid"
500
+ [attr.data-view]="view().state.view"
501
+ [calendrixProps]="view().gridProps"
502
+ [calendrixHandlers]="false"
503
+ (keydown)="onGridKeydown($event)"
504
+ >
505
+ @if (view().state.view === 'months') {
506
+ @for (row of view().monthRows; track $index) {
507
+ <div role="row" class="calendrix-row">
508
+ @for (item of row; track item.cell.month) {
509
+ <div
510
+ class="calendrix-month"
511
+ [calendrixProps]="item.props"
512
+ [calendrixHandlers]="false"
513
+ (click)="switchView(item.props)"
514
+ >
515
+ {{ item.cell.label }}
516
+ </div>
517
+ }
518
+ </div>
519
+ }
520
+ } @else {
521
+ @for (row of view().yearRows; track $index) {
522
+ <div role="row" class="calendrix-row">
523
+ @for (item of row; track item.cell.year) {
524
+ <div
525
+ class="calendrix-year"
526
+ [calendrixProps]="item.props"
527
+ [calendrixHandlers]="false"
528
+ (click)="switchView(item.props)"
529
+ >
530
+ {{ item.cell.label }}
531
+ </div>
532
+ }
533
+ </div>
534
+ }
535
+ }
536
+ </div>
537
+ }
538
+ }
539
+ }
540
+ </div>
541
+
542
+ <ng-template #header let-g>
543
+ <div class="calendrix-header">
544
+ @if (g.index === 0) {
545
+ <button type="button" class="calendrix-nav calendrix-prev" [calendrixProps]="view().prev">
546
+ <svg
547
+ class="calendrix-chevron"
548
+ aria-hidden="true"
549
+ focusable="false"
550
+ width="16"
551
+ height="16"
552
+ viewBox="0 0 16 16"
553
+ >
554
+ <path
555
+ d="M10 3 5 8l5 5"
556
+ fill="none"
557
+ stroke="currentColor"
558
+ stroke-width="1.5"
559
+ stroke-linecap="round"
560
+ stroke-linejoin="round"
561
+ />
562
+ </svg>
563
+ </button>
564
+
565
+ <div class="calendrix-title" aria-live="polite">
566
+ @if (view().state.view !== 'years') {
567
+ <button
568
+ type="button"
569
+ class="calendrix-title-button calendrix-month-button"
570
+ [calendrixProps]="view().monthButton"
571
+ [calendrixHandlers]="false"
572
+ (click)="switchView(view().monthButton)"
573
+ >
574
+ {{ view().state.monthName }}
575
+ </button>
576
+ }
577
+ <button
578
+ type="button"
579
+ class="calendrix-title-button calendrix-year-button"
580
+ [calendrixProps]="view().yearButton"
581
+ [calendrixHandlers]="false"
582
+ (click)="switchView(view().yearButton)"
583
+ >
584
+ {{ view().state.view === 'years' ? view().state.yearsLabel : view().state.yearLabel }}
585
+ </button>
586
+ </div>
587
+ } @else {
588
+ <span class="calendrix-nav-spacer" aria-hidden="true"></span>
589
+ <div class="calendrix-title">
590
+ <span class="calendrix-title-text">{{ g.grid.monthName }}</span>
591
+ <span class="calendrix-title-text">{{ g.grid.yearLabel }}</span>
592
+ </div>
593
+ }
594
+
595
+ @if (g.isLast) {
596
+ <button type="button" class="calendrix-nav calendrix-next" [calendrixProps]="view().next">
597
+ <svg
598
+ class="calendrix-chevron"
599
+ aria-hidden="true"
600
+ focusable="false"
601
+ width="16"
602
+ height="16"
603
+ viewBox="0 0 16 16"
604
+ >
605
+ <path
606
+ d="M6 3l5 5-5 5"
607
+ fill="none"
608
+ stroke="currentColor"
609
+ stroke-width="1.5"
610
+ stroke-linecap="round"
611
+ stroke-linejoin="round"
612
+ />
613
+ </svg>
614
+ </button>
615
+ } @else {
616
+ <span class="calendrix-nav-spacer" aria-hidden="true"></span>
617
+ }
618
+ </div>
619
+ </ng-template>
620
+
621
+ <ng-template #dayGrid let-g>
622
+ <div
623
+ class="calendrix-grid"
624
+ data-view="days"
625
+ [calendrixProps]="g.props"
626
+ [calendrixHandlers]="false"
627
+ (keydown)="onGridKeydown($event)"
628
+ (pointerleave)="onGridPointerLeave()"
629
+ >
630
+ <div role="row" class="calendrix-weekdays">
631
+ @for (label of view().state.weekdayLabels; track label.long) {
632
+ <div role="columnheader" class="calendrix-weekday" [attr.aria-label]="label.long">
633
+ {{ label.short }}
634
+ </div>
635
+ }
636
+ </div>
637
+ @for (week of g.weeks; track $index) {
638
+ <div
639
+ role="row"
640
+ class="calendrix-week"
641
+ [attr.aria-hidden]="isEmptyWeek(week) ? 'true' : null"
642
+ >
643
+ @for (day of week; track day.key) {
644
+ @if (day.props) {
645
+ <div
646
+ class="calendrix-day"
647
+ [calendrixProps]="day.props"
648
+ (pointerenter)="calendar.previewTo(day.cell.date)"
649
+ >
650
+ {{ day.cell.label }}
651
+ </div>
652
+ } @else {
653
+ <!-- With several months every day shows once: the days of the other months stay empty. -->
654
+ <div role="presentation" class="calendrix-day-empty"></div>
655
+ }
656
+ }
657
+ </div>
658
+ }
659
+ </div>
660
+ </ng-template>
661
+ `,
662
+ }]
663
+ }], ctorParameters: () => [], propDecorators: { selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", required: false }] }], system: [{ type: i0.Input, args: [{ isSignal: true, alias: "system", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], weekStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStart", required: false }] }], plugins: [{ type: i0.Input, args: [{ isSignal: true, alias: "plugins", required: false }] }], focusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusedDate", required: false }] }], focusedDateChange: [{ type: i0.Output, args: ["focusedDateChange"] }], visibleMonths: [{ type: i0.Input, args: [{ isSignal: true, alias: "visibleMonths", required: false }] }], allowUnavailableInRange: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowUnavailableInRange", required: false }] }], maxSelected: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSelected", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], isDateUnavailable: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDateUnavailable", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], timeZone: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeZone", required: false }] }], now: [{ type: i0.Input, args: [{ isSignal: true, alias: "now", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
664
+
665
+ const TABBABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
666
+ /**
667
+ * Turns an element into a popover anchored to another element:
668
+ * `<div [calendrixPopover]="anchorElement" (dismiss)="close()">…</div>`.
669
+ *
670
+ * It moves the element to the end of `<body>` (unless `[portal]="false"`), keeps it next to the
671
+ * anchor (flip, shift, size, auto update), keeps Tab inside it, moves the focus into it when it
672
+ * opens, and emits `dismiss` for a press outside and for Escape. It never closes by itself and
673
+ * never returns the focus: the owner does both (see ADR 0013).
674
+ */
675
+ class CalendrixPopover {
676
+ /** The element the popover is placed next to. A press inside it is not an outside press. */
677
+ anchor = input.required({ ...(ngDevMode ? { debugName: "anchor" } : /* istanbul ignore next */ {}), alias: 'calendrixPopover' });
678
+ /** Move the popover to `<body>`. Default: true. */
679
+ portal = input(true, ...(ngDevMode ? [{ debugName: "portal" }] : /* istanbul ignore next */ []));
680
+ placement = input('bottom-start', ...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
681
+ dismiss = output();
682
+ element = inject(ElementRef).nativeElement;
683
+ document = inject(DOCUMENT);
684
+ destroyRef = inject(DestroyRef);
685
+ constructor() {
686
+ afterNextRender(() => {
687
+ const target = this.element.querySelector('[role="grid"] [tabindex="0"]') ?? this.element;
688
+ target.focus();
689
+ });
690
+ }
691
+ ngOnInit() {
692
+ const element = this.element;
693
+ const portaled = this.portal();
694
+ if (portaled) {
695
+ // The theme of an ancestor does not reach a popover in the body (ADR 0026).
696
+ const theme = this.anchor().closest('[data-theme]')?.getAttribute('data-theme');
697
+ if (theme)
698
+ element.setAttribute('data-theme', theme);
699
+ this.document.body.appendChild(element);
700
+ }
701
+ // Fixed positioning, so a scrolling ancestor of the anchor cannot clip or offset the popover.
702
+ element.style.position = 'fixed';
703
+ element.style.left = '0px';
704
+ element.style.top = '0px';
705
+ const anchor = this.anchor();
706
+ const update = () => {
707
+ void computePosition(anchor, element, {
708
+ strategy: 'fixed',
709
+ placement: this.placement(),
710
+ middleware: [
711
+ offset(4),
712
+ flip(),
713
+ shift({ padding: 8 }),
714
+ size({
715
+ padding: 8,
716
+ apply: ({ availableHeight }) => {
717
+ element.style.maxHeight = `${Math.max(120, Math.floor(availableHeight))}px`;
718
+ element.style.overflowY = 'auto';
719
+ },
720
+ }),
721
+ ],
722
+ }).then(({ x, y }) => {
723
+ element.style.left = `${Math.round(x)}px`;
724
+ element.style.top = `${Math.round(y)}px`;
725
+ });
726
+ };
727
+ const stopAutoUpdate = autoUpdate(anchor, element, update);
728
+ const onPointerDown = (event) => {
729
+ const target = event.target;
730
+ if (!target || element.contains(target) || anchor.contains(target))
731
+ return;
732
+ this.dismiss.emit('outside');
733
+ };
734
+ this.document.addEventListener('pointerdown', onPointerDown, true);
735
+ // Escape closes the popover from anywhere, even when a click left the focus on the page. A
736
+ // layer inside that used the key first (the month or year view of the calendar) has already
737
+ // called `preventDefault`.
738
+ const onKeyDown = (event) => {
739
+ if (event.key !== 'Escape' || event.defaultPrevented)
740
+ return;
741
+ event.preventDefault();
742
+ this.dismiss.emit('escape');
743
+ };
744
+ this.document.addEventListener('keydown', onKeyDown);
745
+ this.destroyRef.onDestroy(() => {
746
+ stopAutoUpdate();
747
+ this.document.removeEventListener('pointerdown', onPointerDown, true);
748
+ this.document.removeEventListener('keydown', onKeyDown);
749
+ // Angular only removes the nodes it still finds in the host view, not an element we moved.
750
+ if (portaled)
751
+ element.remove();
752
+ });
753
+ }
754
+ onKeydown(event) {
755
+ if (event.key !== 'Tab')
756
+ return;
757
+ const items = Array.from(this.element.querySelectorAll(TABBABLE));
758
+ if (items.length === 0) {
759
+ event.preventDefault();
760
+ this.element.focus();
761
+ return;
762
+ }
763
+ const first = items[0];
764
+ const last = items[items.length - 1];
765
+ const active = this.document.activeElement;
766
+ if (event.shiftKey && (active === first || active === this.element)) {
767
+ event.preventDefault();
768
+ last.focus();
769
+ }
770
+ else if (!event.shiftKey && active === last) {
771
+ event.preventDefault();
772
+ first.focus();
773
+ }
774
+ }
775
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixPopover, deps: [], target: i0.ɵɵFactoryTarget.Directive });
776
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.26", type: CalendrixPopover, isStandalone: true, selector: "[calendrixPopover]", inputs: { anchor: { classPropertyName: "anchor", publicName: "calendrixPopover", isSignal: true, isRequired: true, transformFunction: null }, portal: { classPropertyName: "portal", publicName: "portal", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dismiss: "dismiss" }, host: { attributes: { "tabindex": "-1" }, listeners: { "keydown": "onKeydown($event)" }, classAttribute: "calendrix-popover" }, ngImport: i0 });
777
+ }
778
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixPopover, decorators: [{
779
+ type: Directive,
780
+ args: [{
781
+ selector: '[calendrixPopover]',
782
+ host: {
783
+ class: 'calendrix-popover',
784
+ tabindex: '-1',
785
+ '(keydown)': 'onKeydown($event)',
786
+ },
787
+ }]
788
+ }], ctorParameters: () => [], propDecorators: { anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "calendrixPopover", required: true }] }], portal: [{ type: i0.Input, args: [{ isSignal: true, alias: "portal", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], dismiss: [{ type: i0.Output, args: ["dismiss"] }] } });
789
+
790
+ let nextDialogId$1 = 0;
791
+ /**
792
+ * A text input and a popover with a calendar, for one day, a range or many days (no time: see
793
+ * `DateTimePicker`). A day or a range can be typed or picked; a list of days is picked, and the
794
+ * input shows it as text. It has no styles of its own, see the `calendrix-*` classes.
795
+ *
796
+ * Use `[(value)]`, or `[defaultValue]` and `(valueChange)`. The type of the value follows
797
+ * `selection`.
798
+ */
799
+ class CalendrixDatePicker {
800
+ /** One day (default), a range with a start and an end, or any number of separate days. */
801
+ selection = input('single', ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
802
+ /** The selection. Use `[(value)]`. The type follows `selection`. */
803
+ value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
804
+ defaultValue = input(...(ngDevMode ? [undefined, { debugName: "defaultValue" }] : /* istanbul ignore next */ []));
805
+ /** Calendar system shown and understood when typing. Default: 'gregory'. */
806
+ system = input('gregory', ...(ngDevMode ? [{ debugName: "system" }] : /* istanbul ignore next */ []));
807
+ /** BCP 47 locale for names, numerals and the order of a typed date. Default: 'en-US'. */
808
+ locale = input('en-US', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
809
+ /** Plugins register calendar systems, for example `persianPlugin`. */
810
+ plugins = input(...(ngDevMode ? [undefined, { debugName: "plugins" }] : /* istanbul ignore next */ []));
811
+ minDate = input(...(ngDevMode ? [undefined, { debugName: "minDate" }] : /* istanbul ignore next */ []));
812
+ maxDate = input(...(ngDevMode ? [undefined, { debugName: "maxDate" }] : /* istanbul ignore next */ []));
813
+ isDateUnavailable = input(...(ngDevMode ? [undefined, { debugName: "isDateUnavailable" }] : /* istanbul ignore next */ []));
814
+ /** First day of the week, 0 is Sunday. Default: from the locale. */
815
+ weekStart = input(...(ngDevMode ? [undefined, { debugName: "weekStart" }] : /* istanbul ignore next */ []));
816
+ /** Default: from the locale. */
817
+ direction = input(...(ngDevMode ? [undefined, { debugName: "direction" }] : /* istanbul ignore next */ []));
818
+ timeZone = input(...(ngDevMode ? [undefined, { debugName: "timeZone" }] : /* istanbul ignore next */ []));
819
+ now = input(...(ngDevMode ? [undefined, { debugName: "now" }] : /* istanbul ignore next */ []));
820
+ /** How many months the calendar shows. Default: 2 for `range`, 1 otherwise. */
821
+ visibleMonths = input(...(ngDevMode ? [undefined, { debugName: "visibleMonths" }] : /* istanbul ignore next */ []));
822
+ /** Range: allow a range that contains unavailable days. Default: true. */
823
+ allowUnavailableInRange = input(...(ngDevMode ? [undefined, { debugName: "allowUnavailableInRange" }] : /* istanbul ignore next */ []));
824
+ /** Multiple: the most days that can be selected. Default: no limit. */
825
+ maxSelected = input(...(ngDevMode ? [undefined, { debugName: "maxSelected" }] : /* istanbul ignore next */ []));
826
+ /**
827
+ * Close the popover when the selection is complete: a picked day, or the second day of a range.
828
+ * Default: true, except for `multiple`.
829
+ */
830
+ closeOnSelect = input(...(ngDevMode ? [undefined, { debugName: "closeOnSelect" }] : /* istanbul ignore next */ []));
831
+ labels = input(...(ngDevMode ? [undefined, { debugName: "labels" }] : /* istanbul ignore next */ []));
832
+ placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
833
+ disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
834
+ /** The `id` of the text input, for a `<label for>`. */
835
+ inputId = input(...(ngDevMode ? [undefined, { debugName: "inputId" }] : /* istanbul ignore next */ []));
836
+ /** Render the popover in `<body>` (default). Use `[portal]="false"` to render it next to the input. */
837
+ portal = input(true, { ...(ngDevMode ? { debugName: "portal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
838
+ open = signal(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
839
+ text = signal('', ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
840
+ touched = signal(false, ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
841
+ dialogId = `calendrix-dialog-${nextDialogId$1++}`;
842
+ inputElement = viewChild.required('input');
843
+ injector = inject(Injector);
844
+ /** True while the value is changing because the user typed it: the text must stay as typed. */
845
+ typing = false;
846
+ empty = computed(() => (this.selection() === 'multiple' ? [] : null), ...(ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []));
847
+ /** The value as the parent gave it, or the default (and the empty value) until a first change. */
848
+ current = computed(() => {
849
+ const value = this.value();
850
+ return (value !== undefined ? value : (this.defaultValue() ?? this.empty()));
851
+ }, ...(ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []));
852
+ /** The selection in the calendar system on screen. */
853
+ shown = computed(() => {
854
+ this.registerPlugins();
855
+ return toSystem(this.current(), this.system());
856
+ }, ...(ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []));
857
+ valueKey = computed(() => this.format(this.shown()), ...(ngDevMode ? [{ debugName: "valueKey" }] : /* istanbul ignore next */ []));
858
+ isEmpty = computed(() => isEmptySelection(this.current()), ...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
859
+ texts = computed(() => pickerLabelsFor(this.locale(), this.labels(), 'date'), ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
860
+ invalid = computed(() => this.selection() !== 'multiple' &&
861
+ this.touched() &&
862
+ this.text().trim() !== '' &&
863
+ this.parse(this.text()) === null, ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
864
+ samplePlaceholder = computed(() => {
865
+ this.registerPlugins();
866
+ const system = this.system();
867
+ const locale = this.locale();
868
+ const sample = convertDate({ system: 'gregory', year: 2026, month: 10, day: 14 }, system);
869
+ const sampleEnd = convertDate({ system: 'gregory', year: 2026, month: 10, day: 21 }, system);
870
+ switch (this.selection()) {
871
+ case 'range':
872
+ return formatDateRange({ start: sample, end: sampleEnd }, locale);
873
+ case 'multiple':
874
+ return '';
875
+ default:
876
+ return formatDate(sample, locale);
877
+ }
878
+ }, ...(ngDevMode ? [{ debugName: "samplePlaceholder" }] : /* istanbul ignore next */ []));
879
+ constructor() {
880
+ // A change that did not come from typing (the parent, a pick in the calendar, Clear) rewrites the text.
881
+ effect(() => {
882
+ const key = this.valueKey();
883
+ untracked(() => {
884
+ if (this.typing) {
885
+ this.typing = false;
886
+ return;
887
+ }
888
+ this.text.set(key);
889
+ });
890
+ });
891
+ }
892
+ ngOnInit() {
893
+ this.text.set(this.valueKey());
894
+ }
895
+ // ControlValueAccessor: a form writes the value in and hears about changes made by the user.
896
+ onChangeFn = () => undefined;
897
+ onTouchedFn = () => undefined;
898
+ formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
899
+ /** Disabled by the `disabled` input or by the form. */
900
+ disabled = computed(() => this.disabledInput() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
901
+ writeValue(value) {
902
+ // null or undefined from a form (a reset, a new control) means empty.
903
+ this.value.set((value ?? this.empty()));
904
+ }
905
+ registerOnChange(fn) {
906
+ this.onChangeFn = fn;
907
+ }
908
+ registerOnTouched(fn) {
909
+ this.onTouchedFn = fn;
910
+ }
911
+ setDisabledState(isDisabled) {
912
+ this.formDisabled.set(isDisabled);
913
+ }
914
+ /** Typing a date in a calendar from a plugin works before the popover has ever been opened. */
915
+ registerPlugins() {
916
+ for (const plugin of this.plugins() ?? []) {
917
+ for (const calendar of plugin.calendars ?? [])
918
+ registerCalendar(calendar);
919
+ }
920
+ }
921
+ format(selection) {
922
+ return formatSelection(selection, this.locale(), this.labels()?.datesSelected);
923
+ }
924
+ /** A typed text: one date, or a range. A list of days is not typed. */
925
+ parse(text) {
926
+ this.registerPlugins();
927
+ const options = { locale: this.locale(), system: this.system() };
928
+ const parsed = this.selection() === 'range' ? parseDateRange(text, options) : parseDate(text, options);
929
+ if (parsed === null)
930
+ return null;
931
+ // A date the user could not pick in the calendar is not a value either (ADR 0025).
932
+ const limits = {
933
+ minDate: this.minDate(),
934
+ maxDate: this.maxDate(),
935
+ isDateUnavailable: this.isDateUnavailable(),
936
+ plugins: this.plugins(),
937
+ locale: options.locale,
938
+ system: options.system,
939
+ allowUnavailableInRange: this.allowUnavailableInRange(),
940
+ };
941
+ if (Array.isArray(parsed))
942
+ return parsed;
943
+ if ('start' in parsed)
944
+ return isRangeSelectable(parsed, limits) ? parsed : null;
945
+ return isDateSelectable(parsed, limits) ? parsed : null;
946
+ }
947
+ commit(next) {
948
+ this.value.set(next);
949
+ this.onChangeFn(next);
950
+ }
951
+ /** The flag only covers the render caused by typing. A later change from the parent updates the text. */
952
+ markTyping() {
953
+ this.typing = true;
954
+ afterNextRender(() => {
955
+ this.typing = false;
956
+ }, { injector: this.injector });
957
+ }
958
+ onInput(event) {
959
+ this.handleText(event.target.value);
960
+ }
961
+ handleText(next) {
962
+ this.text.set(next);
963
+ if (next.trim() === '') {
964
+ if (!this.isEmpty()) {
965
+ this.markTyping();
966
+ this.commit(this.empty());
967
+ }
968
+ return;
969
+ }
970
+ const parsed = this.parse(next);
971
+ if (!parsed)
972
+ return;
973
+ if (this.format(parsed) !== this.valueKey())
974
+ this.markTyping();
975
+ this.commit(parsed);
976
+ }
977
+ handleBlur() {
978
+ this.touched.set(true);
979
+ if (!this.open())
980
+ this.onTouchedFn();
981
+ // A valid text is written the standard way once the user is done typing.
982
+ const text = this.text();
983
+ if (this.selection() !== 'multiple' && text.trim() !== '' && this.parse(text)) {
984
+ this.text.set(this.valueKey());
985
+ }
986
+ }
987
+ onInputKeydown(event) {
988
+ if (event.key === 'ArrowDown') {
989
+ event.preventDefault();
990
+ this.open.set(true);
991
+ }
992
+ else if (this.selection() === 'multiple' &&
993
+ (event.key === 'Delete' || event.key === 'Backspace')) {
994
+ event.preventDefault();
995
+ this.resetValue();
996
+ }
997
+ }
998
+ resetValue() {
999
+ this.commit(this.empty());
1000
+ this.text.set('');
1001
+ }
1002
+ clearAndFocus() {
1003
+ this.resetValue();
1004
+ this.inputElement().nativeElement.focus();
1005
+ }
1006
+ /** Close the popover, and give the focus back to the input when `returnFocus` is true. */
1007
+ close(returnFocus) {
1008
+ this.open.set(false);
1009
+ this.onTouchedFn();
1010
+ if (returnFocus)
1011
+ this.inputElement().nativeElement.focus();
1012
+ }
1013
+ onDismiss(reason) {
1014
+ if (reason === 'escape') {
1015
+ this.close(true);
1016
+ }
1017
+ else {
1018
+ this.open.set(false);
1019
+ this.onTouchedFn();
1020
+ }
1021
+ }
1022
+ onCalendarChange(next) {
1023
+ if (next === undefined)
1024
+ return;
1025
+ this.commit(next);
1026
+ const closes = this.closeOnSelect() ?? this.selection() !== 'multiple';
1027
+ if (closes && !isEmptySelection(next))
1028
+ this.close(true);
1029
+ }
1030
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixDatePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
1031
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: CalendrixDatePicker, isStandalone: true, selector: "calendrix-date-picker", inputs: { selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, system: { classPropertyName: "system", publicName: "system", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, plugins: { classPropertyName: "plugins", publicName: "plugins", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, isDateUnavailable: { classPropertyName: "isDateUnavailable", publicName: "isDateUnavailable", isSignal: true, isRequired: false, transformFunction: null }, weekStart: { classPropertyName: "weekStart", publicName: "weekStart", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null }, now: { classPropertyName: "now", publicName: "now", isSignal: true, isRequired: false, transformFunction: null }, visibleMonths: { classPropertyName: "visibleMonths", publicName: "visibleMonths", isSignal: true, isRequired: false, transformFunction: null }, allowUnavailableInRange: { classPropertyName: "allowUnavailableInRange", publicName: "allowUnavailableInRange", isSignal: true, isRequired: false, transformFunction: null }, maxSelected: { classPropertyName: "maxSelected", publicName: "maxSelected", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, portal: { classPropertyName: "portal", publicName: "portal", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [
1032
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CalendrixDatePicker), multi: true },
1033
+ ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: `
1034
+ <div class="calendrix-picker" #wrapper>
1035
+ <div class="calendrix-picker-field">
1036
+ <input
1037
+ #input
1038
+ class="calendrix-input"
1039
+ type="text"
1040
+ dir="ltr"
1041
+ autocomplete="off"
1042
+ [attr.id]="inputId()"
1043
+ [value]="text()"
1044
+ [readOnly]="selection() === 'multiple'"
1045
+ [placeholder]="placeholder() ?? samplePlaceholder()"
1046
+ [disabled]="disabled()"
1047
+ [attr.aria-invalid]="invalid() ? 'true' : null"
1048
+ (input)="onInput($event)"
1049
+ (blur)="handleBlur()"
1050
+ (keydown)="onInputKeydown($event)"
1051
+ />
1052
+ @if (!disabled() && (!isEmpty() || text().trim() !== '')) {
1053
+ <button
1054
+ type="button"
1055
+ class="calendrix-toggle calendrix-clear"
1056
+ [attr.aria-label]="texts().clear"
1057
+ (click)="clearAndFocus()"
1058
+ >
1059
+ <svg aria-hidden="true" focusable="false" width="14" height="14" viewBox="0 0 14 14">
1060
+ <path
1061
+ d="M3 3l8 8M11 3l-8 8"
1062
+ fill="none"
1063
+ stroke="currentColor"
1064
+ stroke-width="1.5"
1065
+ stroke-linecap="round"
1066
+ />
1067
+ </svg>
1068
+ </button>
1069
+ }
1070
+ <button
1071
+ type="button"
1072
+ class="calendrix-toggle"
1073
+ aria-haspopup="dialog"
1074
+ [attr.aria-label]="texts().openCalendar"
1075
+ [attr.aria-expanded]="open()"
1076
+ [attr.aria-controls]="open() ? dialogId : null"
1077
+ [disabled]="disabled()"
1078
+ (click)="open.set(!open())"
1079
+ >
1080
+ <svg aria-hidden="true" focusable="false" width="18" height="18" viewBox="0 0 18 18">
1081
+ <rect
1082
+ x="2.5"
1083
+ y="3.5"
1084
+ width="13"
1085
+ height="12"
1086
+ rx="2"
1087
+ fill="none"
1088
+ stroke="currentColor"
1089
+ stroke-width="1.5"
1090
+ />
1091
+ <path
1092
+ d="M2.5 7.5h13M6 2v3M12 2v3"
1093
+ fill="none"
1094
+ stroke="currentColor"
1095
+ stroke-width="1.5"
1096
+ stroke-linecap="round"
1097
+ />
1098
+ </svg>
1099
+ </button>
1100
+ </div>
1101
+
1102
+ @if (open()) {
1103
+ <div
1104
+ role="dialog"
1105
+ [id]="dialogId"
1106
+ [attr.aria-label]="texts().dialog"
1107
+ [calendrixPopover]="wrapper"
1108
+ [portal]="portal()"
1109
+ (dismiss)="onDismiss($event)"
1110
+ >
1111
+ <calendrix-calendar
1112
+ [selection]="selection()"
1113
+ [system]="system()"
1114
+ [locale]="locale()"
1115
+ [plugins]="plugins()"
1116
+ [value]="shown()"
1117
+ (valueChange)="onCalendarChange($event)"
1118
+ [minDate]="minDate()"
1119
+ [maxDate]="maxDate()"
1120
+ [isDateUnavailable]="isDateUnavailable()"
1121
+ [weekStart]="weekStart()"
1122
+ [direction]="direction()"
1123
+ [timeZone]="timeZone()"
1124
+ [now]="now()"
1125
+ [visibleMonths]="visibleMonths() ?? (selection() === 'range' ? 2 : 1)"
1126
+ [allowUnavailableInRange]="allowUnavailableInRange()"
1127
+ [maxSelected]="maxSelected()"
1128
+ />
1129
+ <div class="calendrix-popover-footer" data-actions-only="">
1130
+ <div class="calendrix-actions">
1131
+ <button type="button" class="calendrix-action" (click)="resetValue()">
1132
+ {{ texts().clear }}
1133
+ </button>
1134
+ <button
1135
+ type="button"
1136
+ class="calendrix-action calendrix-action-primary"
1137
+ (click)="close(true)"
1138
+ >
1139
+ {{ texts().done }}
1140
+ </button>
1141
+ </div>
1142
+ </div>
1143
+ </div>
1144
+ }
1145
+ </div>
1146
+ `, isInline: true, dependencies: [{ kind: "component", type: CalendrixCalendar, selector: "calendrix-calendar", inputs: ["selection", "value", "defaultValue", "system", "locale", "direction", "weekStart", "plugins", "focusedDate", "visibleMonths", "allowUnavailableInRange", "maxSelected", "minDate", "maxDate", "isDateUnavailable", "labels", "timeZone", "now", "disabled"], outputs: ["valueChange", "focusedDateChange"] }, { kind: "directive", type: CalendrixPopover, selector: "[calendrixPopover]", inputs: ["calendrixPopover", "portal", "placement"], outputs: ["dismiss"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1147
+ }
1148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixDatePicker, decorators: [{
1149
+ type: Component,
1150
+ args: [{
1151
+ selector: 'calendrix-date-picker',
1152
+ imports: [CalendrixCalendar, CalendrixPopover],
1153
+ providers: [
1154
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CalendrixDatePicker), multi: true },
1155
+ ],
1156
+ changeDetection: ChangeDetectionStrategy.OnPush,
1157
+ template: `
1158
+ <div class="calendrix-picker" #wrapper>
1159
+ <div class="calendrix-picker-field">
1160
+ <input
1161
+ #input
1162
+ class="calendrix-input"
1163
+ type="text"
1164
+ dir="ltr"
1165
+ autocomplete="off"
1166
+ [attr.id]="inputId()"
1167
+ [value]="text()"
1168
+ [readOnly]="selection() === 'multiple'"
1169
+ [placeholder]="placeholder() ?? samplePlaceholder()"
1170
+ [disabled]="disabled()"
1171
+ [attr.aria-invalid]="invalid() ? 'true' : null"
1172
+ (input)="onInput($event)"
1173
+ (blur)="handleBlur()"
1174
+ (keydown)="onInputKeydown($event)"
1175
+ />
1176
+ @if (!disabled() && (!isEmpty() || text().trim() !== '')) {
1177
+ <button
1178
+ type="button"
1179
+ class="calendrix-toggle calendrix-clear"
1180
+ [attr.aria-label]="texts().clear"
1181
+ (click)="clearAndFocus()"
1182
+ >
1183
+ <svg aria-hidden="true" focusable="false" width="14" height="14" viewBox="0 0 14 14">
1184
+ <path
1185
+ d="M3 3l8 8M11 3l-8 8"
1186
+ fill="none"
1187
+ stroke="currentColor"
1188
+ stroke-width="1.5"
1189
+ stroke-linecap="round"
1190
+ />
1191
+ </svg>
1192
+ </button>
1193
+ }
1194
+ <button
1195
+ type="button"
1196
+ class="calendrix-toggle"
1197
+ aria-haspopup="dialog"
1198
+ [attr.aria-label]="texts().openCalendar"
1199
+ [attr.aria-expanded]="open()"
1200
+ [attr.aria-controls]="open() ? dialogId : null"
1201
+ [disabled]="disabled()"
1202
+ (click)="open.set(!open())"
1203
+ >
1204
+ <svg aria-hidden="true" focusable="false" width="18" height="18" viewBox="0 0 18 18">
1205
+ <rect
1206
+ x="2.5"
1207
+ y="3.5"
1208
+ width="13"
1209
+ height="12"
1210
+ rx="2"
1211
+ fill="none"
1212
+ stroke="currentColor"
1213
+ stroke-width="1.5"
1214
+ />
1215
+ <path
1216
+ d="M2.5 7.5h13M6 2v3M12 2v3"
1217
+ fill="none"
1218
+ stroke="currentColor"
1219
+ stroke-width="1.5"
1220
+ stroke-linecap="round"
1221
+ />
1222
+ </svg>
1223
+ </button>
1224
+ </div>
1225
+
1226
+ @if (open()) {
1227
+ <div
1228
+ role="dialog"
1229
+ [id]="dialogId"
1230
+ [attr.aria-label]="texts().dialog"
1231
+ [calendrixPopover]="wrapper"
1232
+ [portal]="portal()"
1233
+ (dismiss)="onDismiss($event)"
1234
+ >
1235
+ <calendrix-calendar
1236
+ [selection]="selection()"
1237
+ [system]="system()"
1238
+ [locale]="locale()"
1239
+ [plugins]="plugins()"
1240
+ [value]="shown()"
1241
+ (valueChange)="onCalendarChange($event)"
1242
+ [minDate]="minDate()"
1243
+ [maxDate]="maxDate()"
1244
+ [isDateUnavailable]="isDateUnavailable()"
1245
+ [weekStart]="weekStart()"
1246
+ [direction]="direction()"
1247
+ [timeZone]="timeZone()"
1248
+ [now]="now()"
1249
+ [visibleMonths]="visibleMonths() ?? (selection() === 'range' ? 2 : 1)"
1250
+ [allowUnavailableInRange]="allowUnavailableInRange()"
1251
+ [maxSelected]="maxSelected()"
1252
+ />
1253
+ <div class="calendrix-popover-footer" data-actions-only="">
1254
+ <div class="calendrix-actions">
1255
+ <button type="button" class="calendrix-action" (click)="resetValue()">
1256
+ {{ texts().clear }}
1257
+ </button>
1258
+ <button
1259
+ type="button"
1260
+ class="calendrix-action calendrix-action-primary"
1261
+ (click)="close(true)"
1262
+ >
1263
+ {{ texts().done }}
1264
+ </button>
1265
+ </div>
1266
+ </div>
1267
+ </div>
1268
+ }
1269
+ </div>
1270
+ `,
1271
+ }]
1272
+ }], ctorParameters: () => [], propDecorators: { selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", required: false }] }], system: [{ type: i0.Input, args: [{ isSignal: true, alias: "system", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], plugins: [{ type: i0.Input, args: [{ isSignal: true, alias: "plugins", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], isDateUnavailable: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDateUnavailable", required: false }] }], weekStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStart", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], timeZone: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeZone", required: false }] }], now: [{ type: i0.Input, args: [{ isSignal: true, alias: "now", required: false }] }], visibleMonths: [{ type: i0.Input, args: [{ isSignal: true, alias: "visibleMonths", required: false }] }], allowUnavailableInRange: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowUnavailableInRange", required: false }] }], maxSelected: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSelected", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], portal: [{ type: i0.Input, args: [{ isSignal: true, alias: "portal", required: false }] }], inputElement: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }] } });
1273
+
1274
+ /**
1275
+ * A time input made of segments (hour, minute, optional seconds, AM/PM). Each segment is a
1276
+ * spinbutton: type digits, or use the up and down arrow keys. It has no styles of its own: use the
1277
+ * `calendrix-*` classes. Use `[(value)]` to read and set the time.
1278
+ */
1279
+ class CalendrixTimeField {
1280
+ /** The time. Use `[(value)]`. `null` means an empty field. */
1281
+ value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
1282
+ defaultValue = input(...(ngDevMode ? [undefined, { debugName: "defaultValue" }] : /* istanbul ignore next */ []));
1283
+ /** BCP 47 locale for numerals and the AM/PM text. Default: 'en-US'. */
1284
+ locale = input(...(ngDevMode ? [undefined, { debugName: "locale" }] : /* istanbul ignore next */ []));
1285
+ /** 12 or 24. Default: the locale's own habit. */
1286
+ hourCycle = input(...(ngDevMode ? [undefined, { debugName: "hourCycle" }] : /* istanbul ignore next */ []));
1287
+ /** Show a seconds segment. Default: false. */
1288
+ showSeconds = input(...(ngDevMode ? [undefined, { debugName: "showSeconds" }] : /* istanbul ignore next */ []));
1289
+ /** Step of the up and down arrows. Default: 1. */
1290
+ hourStep = input(...(ngDevMode ? [undefined, { debugName: "hourStep" }] : /* istanbul ignore next */ []));
1291
+ minuteStep = input(...(ngDevMode ? [undefined, { debugName: "minuteStep" }] : /* istanbul ignore next */ []));
1292
+ secondStep = input(...(ngDevMode ? [undefined, { debugName: "secondStep" }] : /* istanbul ignore next */ []));
1293
+ /** Values outside this range are rejected. */
1294
+ minTime = input(...(ngDevMode ? [undefined, { debugName: "minTime" }] : /* istanbul ignore next */ []));
1295
+ maxTime = input(...(ngDevMode ? [undefined, { debugName: "maxTime" }] : /* istanbul ignore next */ []));
1296
+ labels = input(...(ngDevMode ? [undefined, { debugName: "labels" }] : /* istanbul ignore next */ []));
1297
+ /** The user cannot change anything (ADR 0022). A form can also disable the field. */
1298
+ disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
1299
+ /** Created again in `ngOnInit`: the core reads some options only when it is created. */
1300
+ field = createTimeField({});
1301
+ state = signal(this.field.getState(), ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
1302
+ unsubscribe = () => undefined;
1303
+ host = inject(ElementRef);
1304
+ /** The last `focusRequest` of the core that this component has seen (see `TimeFieldState`). */
1305
+ seenFocusRequest = 0;
1306
+ handleChange = (next) => {
1307
+ this.value.set(next);
1308
+ this.onChangeFn(next);
1309
+ };
1310
+ options = computed(() => ({
1311
+ value: this.value(),
1312
+ defaultValue: this.defaultValue(),
1313
+ locale: this.locale(),
1314
+ hourCycle: this.hourCycle(),
1315
+ showSeconds: this.showSeconds(),
1316
+ hourStep: this.hourStep(),
1317
+ minuteStep: this.minuteStep(),
1318
+ secondStep: this.secondStep(),
1319
+ minTime: this.minTime(),
1320
+ maxTime: this.maxTime(),
1321
+ labels: this.labels(),
1322
+ disabled: this.disabled(),
1323
+ onChange: this.handleChange,
1324
+ }), ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
1325
+ view = computed(() => {
1326
+ const state = this.state();
1327
+ return {
1328
+ root: this.field.getRootProps(),
1329
+ segments: state.segments.map((segment) => ({
1330
+ segment,
1331
+ props: this.field.getSegmentProps(segment.type),
1332
+ separator: segment.type === 'minute' || segment.type === 'second',
1333
+ })),
1334
+ };
1335
+ }, ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
1336
+ constructor() {
1337
+ inject(DestroyRef).onDestroy(() => {
1338
+ this.unsubscribe();
1339
+ this.field.destroy();
1340
+ });
1341
+ effect(() => this.field.setOptions(this.options()));
1342
+ afterEveryRender(() => {
1343
+ const request = this.state().focusRequest;
1344
+ if (request === this.seenFocusRequest)
1345
+ return;
1346
+ this.seenFocusRequest = request;
1347
+ const type = this.state().activeSegment;
1348
+ if (!type)
1349
+ return;
1350
+ this.host.nativeElement.querySelector(`[data-segment="${type}"]`)?.focus();
1351
+ });
1352
+ }
1353
+ ngOnInit() {
1354
+ this.field.destroy();
1355
+ this.field = createTimeField(this.options());
1356
+ this.unsubscribe = this.field.subscribe(() => this.state.set(this.field.getState()));
1357
+ this.state.set(this.field.getState());
1358
+ }
1359
+ // ControlValueAccessor: a form writes the time in and hears about changes made by the user.
1360
+ onChangeFn = () => undefined;
1361
+ onTouchedFn = () => undefined;
1362
+ formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
1363
+ /** Disabled by the `disabled` input or by the form. */
1364
+ disabled = computed(() => this.disabledInput() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1365
+ writeValue(value) {
1366
+ // null or undefined from a form (a reset, a new control) means an empty field.
1367
+ this.value.set((value ?? null));
1368
+ }
1369
+ registerOnChange(fn) {
1370
+ this.onChangeFn = fn;
1371
+ }
1372
+ registerOnTouched(fn) {
1373
+ this.onTouchedFn = fn;
1374
+ }
1375
+ setDisabledState(isDisabled) {
1376
+ this.formDisabled.set(isDisabled);
1377
+ }
1378
+ /** The control is touched when the focus leaves the whole field, not between its segments. */
1379
+ onFocusOut(event) {
1380
+ if (!this.host.nativeElement.contains(event.relatedTarget))
1381
+ this.onTouchedFn();
1382
+ }
1383
+ onKeydown(type, event) {
1384
+ // Typing that completes a segment gives a new `focusRequest`; the hook above moves the focus.
1385
+ this.field.handleKeyDown(type, event);
1386
+ }
1387
+ /** Text from an on-screen keyboard (ADR 0024). */
1388
+ onBeforeInput(type, event) {
1389
+ this.field.handleBeforeInput(type, event);
1390
+ }
1391
+ /**
1392
+ * A composition cannot be cancelled: the browser has written into the segment. Write the text of
1393
+ * the state back into the same text node (Angular keeps that node).
1394
+ */
1395
+ onInput(type, event) {
1396
+ if (!event.isComposing)
1397
+ return;
1398
+ const text = this.state().segments.find((segment) => segment.type === type)?.text;
1399
+ const node = event.currentTarget.firstChild;
1400
+ if (text !== undefined && node?.nodeType === Node.TEXT_NODE)
1401
+ node.data = text;
1402
+ }
1403
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixTimeField, deps: [], target: i0.ɵɵFactoryTarget.Component });
1404
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: CalendrixTimeField, isStandalone: true, selector: "calendrix-time-field", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, hourCycle: { classPropertyName: "hourCycle", publicName: "hourCycle", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, hourStep: { classPropertyName: "hourStep", publicName: "hourStep", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, secondStep: { classPropertyName: "secondStep", publicName: "secondStep", isSignal: true, isRequired: false, transformFunction: null }, minTime: { classPropertyName: "minTime", publicName: "minTime", isSignal: true, isRequired: false, transformFunction: null }, maxTime: { classPropertyName: "maxTime", publicName: "maxTime", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [
1405
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CalendrixTimeField), multi: true },
1406
+ ], ngImport: i0, template: `
1407
+ <div
1408
+ class="calendrix-time-field"
1409
+ [calendrixProps]="view().root"
1410
+ [calendrixHandlers]="false"
1411
+ (focusout)="onFocusOut($event)"
1412
+ >
1413
+ @for (item of view().segments; track item.segment.type) {
1414
+ @if (item.separator) {
1415
+ <span class="calendrix-separator" aria-hidden="true">:</span>
1416
+ }
1417
+ <span
1418
+ class="calendrix-segment"
1419
+ [calendrixProps]="item.props"
1420
+ [calendrixHandlers]="false"
1421
+ (keydown)="onKeydown(item.segment.type, $event)"
1422
+ (beforeinput)="onBeforeInput(item.segment.type, $event)"
1423
+ (input)="onInput(item.segment.type, $event)"
1424
+ (focus)="field.focusSegment(item.segment.type)"
1425
+ >{{ item.segment.text }}</span
1426
+ >
1427
+ }
1428
+ </div>
1429
+ `, isInline: true, dependencies: [{ kind: "directive", type: CalendrixPropsDirective, selector: "[calendrixProps]", inputs: ["calendrixProps", "calendrixHandlers"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1430
+ }
1431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixTimeField, decorators: [{
1432
+ type: Component,
1433
+ args: [{
1434
+ selector: 'calendrix-time-field',
1435
+ imports: [CalendrixPropsDirective],
1436
+ providers: [
1437
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CalendrixTimeField), multi: true },
1438
+ ],
1439
+ changeDetection: ChangeDetectionStrategy.OnPush,
1440
+ template: `
1441
+ <div
1442
+ class="calendrix-time-field"
1443
+ [calendrixProps]="view().root"
1444
+ [calendrixHandlers]="false"
1445
+ (focusout)="onFocusOut($event)"
1446
+ >
1447
+ @for (item of view().segments; track item.segment.type) {
1448
+ @if (item.separator) {
1449
+ <span class="calendrix-separator" aria-hidden="true">:</span>
1450
+ }
1451
+ <span
1452
+ class="calendrix-segment"
1453
+ [calendrixProps]="item.props"
1454
+ [calendrixHandlers]="false"
1455
+ (keydown)="onKeydown(item.segment.type, $event)"
1456
+ (beforeinput)="onBeforeInput(item.segment.type, $event)"
1457
+ (input)="onInput(item.segment.type, $event)"
1458
+ (focus)="field.focusSegment(item.segment.type)"
1459
+ >{{ item.segment.text }}</span
1460
+ >
1461
+ }
1462
+ </div>
1463
+ `,
1464
+ }]
1465
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], hourCycle: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourCycle", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], hourStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourStep", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], secondStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondStep", required: false }] }], minTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "minTime", required: false }] }], maxTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxTime", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
1466
+
1467
+ const MIDNIGHT = { hour: 0, minute: 0, second: 0 };
1468
+ const isRange = (value) => value !== null && 'start' in value;
1469
+ let nextDialogId = 0;
1470
+ /**
1471
+ * A text input and a popover with a calendar and a time field. The user can type a date and a
1472
+ * time or pick them; the value is the same `{ date, time }` the core uses (no time zone: see
1473
+ * `toInstant`). With `selection="range"` the value is `{ start, end }`, each with a date and a
1474
+ * time, and the popover has two time fields (ADR 0023). It has no styles of its own, see the
1475
+ * `calendrix-*` classes.
1476
+ *
1477
+ * Use `[(value)]`, or `[defaultValue]` and `(valueChange)`. The type of the value follows
1478
+ * `selection`.
1479
+ */
1480
+ class CalendrixDateTimePicker {
1481
+ /** One date and time (default), or a range with a start and an end, each with a time. */
1482
+ selection = input('single', ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
1483
+ /** The picked value. Use `[(value)]`. The type follows `selection`. `null` means nothing. */
1484
+ value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
1485
+ defaultValue = input(...(ngDevMode ? [undefined, { debugName: "defaultValue" }] : /* istanbul ignore next */ []));
1486
+ /** Calendar system shown and understood when typing. Default: 'gregory'. */
1487
+ system = input('gregory', ...(ngDevMode ? [{ debugName: "system" }] : /* istanbul ignore next */ []));
1488
+ /** BCP 47 locale for names, numerals and the order of a typed date. Default: 'en-US'. */
1489
+ locale = input('en-US', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
1490
+ /** 12 or 24. Default: the locale's own habit. */
1491
+ hourCycle = input(...(ngDevMode ? [undefined, { debugName: "hourCycle" }] : /* istanbul ignore next */ []));
1492
+ showSeconds = input(...(ngDevMode ? [undefined, { debugName: "showSeconds" }] : /* istanbul ignore next */ []));
1493
+ /** Step of the up and down arrows in the time field. Default: 1. */
1494
+ hourStep = input(...(ngDevMode ? [undefined, { debugName: "hourStep" }] : /* istanbul ignore next */ []));
1495
+ minuteStep = input(...(ngDevMode ? [undefined, { debugName: "minuteStep" }] : /* istanbul ignore next */ []));
1496
+ secondStep = input(...(ngDevMode ? [undefined, { debugName: "secondStep" }] : /* istanbul ignore next */ []));
1497
+ /** Times outside this range are rejected. A picked date starts at `minTime`. */
1498
+ minTime = input(...(ngDevMode ? [undefined, { debugName: "minTime" }] : /* istanbul ignore next */ []));
1499
+ maxTime = input(...(ngDevMode ? [undefined, { debugName: "maxTime" }] : /* istanbul ignore next */ []));
1500
+ minDate = input(...(ngDevMode ? [undefined, { debugName: "minDate" }] : /* istanbul ignore next */ []));
1501
+ maxDate = input(...(ngDevMode ? [undefined, { debugName: "maxDate" }] : /* istanbul ignore next */ []));
1502
+ /** First day of the week, 0 is Sunday. Default: from the locale. */
1503
+ weekStart = input(...(ngDevMode ? [undefined, { debugName: "weekStart" }] : /* istanbul ignore next */ []));
1504
+ /** Default: from the locale. */
1505
+ direction = input(...(ngDevMode ? [undefined, { debugName: "direction" }] : /* istanbul ignore next */ []));
1506
+ /** How many months the calendar shows: 1 (default; 2 for `range`), 2 or 3. */
1507
+ visibleMonths = input(...(ngDevMode ? [undefined, { debugName: "visibleMonths" }] : /* istanbul ignore next */ []));
1508
+ isDateUnavailable = input(...(ngDevMode ? [undefined, { debugName: "isDateUnavailable" }] : /* istanbul ignore next */ []));
1509
+ /** Plugins register calendar systems, for example `persianPlugin`. */
1510
+ plugins = input(...(ngDevMode ? [undefined, { debugName: "plugins" }] : /* istanbul ignore next */ []));
1511
+ timeZone = input(...(ngDevMode ? [undefined, { debugName: "timeZone" }] : /* istanbul ignore next */ []));
1512
+ now = input(...(ngDevMode ? [undefined, { debugName: "now" }] : /* istanbul ignore next */ []));
1513
+ labels = input(...(ngDevMode ? [undefined, { debugName: "labels" }] : /* istanbul ignore next */ []));
1514
+ placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
1515
+ disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
1516
+ /** The `id` of the text input, for a `<label for>`. */
1517
+ inputId = input(...(ngDevMode ? [undefined, { debugName: "inputId" }] : /* istanbul ignore next */ []));
1518
+ /**
1519
+ * Render the popover in `<body>` (default). Use `[portal]="false"` to render it next to the
1520
+ * input instead. The `data-theme` of an ancestor does not reach a portaled popover.
1521
+ */
1522
+ portal = input(true, { ...(ngDevMode ? { debugName: "portal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1523
+ open = signal(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
1524
+ text = signal('', ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
1525
+ /**
1526
+ * A time chosen before any date. It becomes part of the value when a date is picked. In
1527
+ * `single` mode `draftStart` is the only one; in `range` mode there is one for each end.
1528
+ */
1529
+ draftStart = signal(null, ...(ngDevMode ? [{ debugName: "draftStart" }] : /* istanbul ignore next */ []));
1530
+ draftEnd = signal(null, ...(ngDevMode ? [{ debugName: "draftEnd" }] : /* istanbul ignore next */ []));
1531
+ touched = signal(false, ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
1532
+ dialogId = `calendrix-dialog-${nextDialogId++}`;
1533
+ inputElement = viewChild.required('input');
1534
+ injector = inject(Injector);
1535
+ /** True while the value is changing because the user typed it: the text must stay as typed. */
1536
+ typing = false;
1537
+ isRangeMode = computed(() => this.selection() === 'range', ...(ngDevMode ? [{ debugName: "isRangeMode" }] : /* istanbul ignore next */ []));
1538
+ /** The value as the parent gave it, or the default until a first change. */
1539
+ current = computed(() => {
1540
+ const value = this.value();
1541
+ return value !== undefined ? value : (this.defaultValue() ?? null);
1542
+ }, ...(ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []));
1543
+ inSystem(point) {
1544
+ return { date: convertDate(point.date, this.system()), time: point.time };
1545
+ }
1546
+ /** The value in the calendar system on screen. */
1547
+ shown = computed(() => {
1548
+ this.registerPlugins();
1549
+ const value = this.current();
1550
+ if (value === null)
1551
+ return null;
1552
+ return isRange(value)
1553
+ ? { start: this.inSystem(value.start), end: this.inSystem(value.end) }
1554
+ : this.inSystem(value);
1555
+ }, ...(ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []));
1556
+ shownPoint = computed(() => {
1557
+ const shown = this.shown();
1558
+ return shown !== null && !isRange(shown) ? shown : null;
1559
+ }, ...(ngDevMode ? [{ debugName: "shownPoint" }] : /* istanbul ignore next */ []));
1560
+ shownRange = computed(() => {
1561
+ const shown = this.shown();
1562
+ return shown !== null && isRange(shown) ? shown : null;
1563
+ }, ...(ngDevMode ? [{ debugName: "shownRange" }] : /* istanbul ignore next */ []));
1564
+ /** The dates of a complete range, for the calendar. */
1565
+ calendarRange = computed(() => {
1566
+ const range = this.shownRange();
1567
+ return range ? { start: range.start.date, end: range.end.date } : null;
1568
+ }, ...(ngDevMode ? [{ debugName: "calendarRange" }] : /* istanbul ignore next */ []));
1569
+ valueKey = computed(() => this.format(this.shown()), ...(ngDevMode ? [{ debugName: "valueKey" }] : /* istanbul ignore next */ []));
1570
+ texts = computed(() => pickerLabelsFor(this.locale(), this.labels()), ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
1571
+ startLabels = computed(() => ({ time: this.texts().startTime }), ...(ngDevMode ? [{ debugName: "startLabels" }] : /* istanbul ignore next */ []));
1572
+ endLabels = computed(() => ({ time: this.texts().endTime }), ...(ngDevMode ? [{ debugName: "endLabels" }] : /* istanbul ignore next */ []));
1573
+ hasValue = computed(() => this.current() !== null, ...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
1574
+ invalid = computed(() => this.touched() && this.text().trim() !== '' && this.parse(this.text()) === null, ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
1575
+ samplePlaceholder = computed(() => {
1576
+ this.registerPlugins();
1577
+ const start = {
1578
+ date: convertDate({ system: 'gregory', year: 2026, month: 10, day: 14 }, this.system()),
1579
+ time: { hour: 9, minute: 30, second: 0 },
1580
+ };
1581
+ const end = {
1582
+ date: convertDate({ system: 'gregory', year: 2026, month: 10, day: 21 }, this.system()),
1583
+ time: { hour: 17, minute: 0, second: 0 },
1584
+ };
1585
+ return this.format(this.isRangeMode() ? { start, end } : start);
1586
+ }, ...(ngDevMode ? [{ debugName: "samplePlaceholder" }] : /* istanbul ignore next */ []));
1587
+ constructor() {
1588
+ // A change that did not come from typing (the parent, a pick in the calendar, Clear) rewrites the text.
1589
+ effect(() => {
1590
+ const key = this.valueKey();
1591
+ untracked(() => {
1592
+ if (this.typing) {
1593
+ this.typing = false;
1594
+ return;
1595
+ }
1596
+ this.text.set(key);
1597
+ });
1598
+ });
1599
+ }
1600
+ ngOnInit() {
1601
+ this.text.set(this.valueKey());
1602
+ }
1603
+ // ControlValueAccessor: a form writes the value in and hears about changes made by the user.
1604
+ onChangeFn = () => undefined;
1605
+ onTouchedFn = () => undefined;
1606
+ formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
1607
+ /** Disabled by the `disabled` input or by the form. */
1608
+ disabled = computed(() => this.disabledInput() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1609
+ writeValue(value) {
1610
+ // null or undefined from a form (a reset, a new control) means empty.
1611
+ this.value.set((value ?? null));
1612
+ }
1613
+ registerOnChange(fn) {
1614
+ this.onChangeFn = fn;
1615
+ }
1616
+ registerOnTouched(fn) {
1617
+ this.onTouchedFn = fn;
1618
+ }
1619
+ setDisabledState(isDisabled) {
1620
+ this.formDisabled.set(isDisabled);
1621
+ }
1622
+ /** Typing a date in a calendar from a plugin works before the popover has ever been opened. */
1623
+ registerPlugins() {
1624
+ for (const plugin of this.plugins() ?? []) {
1625
+ for (const calendar of plugin.calendars ?? [])
1626
+ registerCalendar(calendar);
1627
+ }
1628
+ }
1629
+ format(next) {
1630
+ if (next === null)
1631
+ return '';
1632
+ const options = {
1633
+ locale: this.locale(),
1634
+ hourCycle: this.hourCycle(),
1635
+ seconds: this.showSeconds(),
1636
+ };
1637
+ return isRange(next) ? formatDateTimeRange(next, options) : formatDateTime(next, options);
1638
+ }
1639
+ parse(text) {
1640
+ this.registerPlugins();
1641
+ const options = { locale: this.locale(), system: this.system() };
1642
+ const parsed = this.isRangeMode()
1643
+ ? parseDateTimeRange(text, options)
1644
+ : parseDateTime(text, options);
1645
+ if (parsed === null)
1646
+ return null;
1647
+ // A date or a time that the user could not pick is not a value either (ADR 0025).
1648
+ const limits = {
1649
+ minDate: this.minDate(),
1650
+ maxDate: this.maxDate(),
1651
+ isDateUnavailable: this.isDateUnavailable(),
1652
+ plugins: this.plugins(),
1653
+ locale: options.locale,
1654
+ system: options.system,
1655
+ minTime: this.minTime(),
1656
+ maxTime: this.maxTime(),
1657
+ };
1658
+ if (isRange(parsed)) {
1659
+ const dates = { start: parsed.start.date, end: parsed.end.date };
1660
+ return isRangeSelectable(dates, limits) &&
1661
+ isTimeSelectable(parsed.start.time, limits) &&
1662
+ isTimeSelectable(parsed.end.time, limits)
1663
+ ? parsed
1664
+ : null;
1665
+ }
1666
+ return isDateSelectable(parsed.date, limits) && isTimeSelectable(parsed.time, limits)
1667
+ ? parsed
1668
+ : null;
1669
+ }
1670
+ commit(next) {
1671
+ this.value.set(next);
1672
+ this.onChangeFn(next);
1673
+ }
1674
+ /** The flag only covers the render caused by typing. A later change from the parent updates the text. */
1675
+ markTyping() {
1676
+ this.typing = true;
1677
+ afterNextRender(() => {
1678
+ this.typing = false;
1679
+ }, { injector: this.injector });
1680
+ }
1681
+ onInput(event) {
1682
+ this.handleText(event.target.value);
1683
+ }
1684
+ handleText(next) {
1685
+ this.text.set(next);
1686
+ if (next.trim() === '') {
1687
+ if (this.current() !== null) {
1688
+ this.markTyping();
1689
+ this.commit(null);
1690
+ }
1691
+ return;
1692
+ }
1693
+ const parsed = this.parse(next);
1694
+ if (!parsed)
1695
+ return;
1696
+ if (this.format(parsed) !== this.valueKey())
1697
+ this.markTyping();
1698
+ this.commit(parsed);
1699
+ }
1700
+ handleBlur() {
1701
+ this.touched.set(true);
1702
+ if (!this.open())
1703
+ this.onTouchedFn();
1704
+ // A valid text is written the standard way once the user is done typing.
1705
+ const text = this.text();
1706
+ if (text.trim() !== '' && this.parse(text))
1707
+ this.text.set(this.valueKey());
1708
+ }
1709
+ onInputKeydown(event) {
1710
+ if (event.key === 'ArrowDown') {
1711
+ event.preventDefault();
1712
+ this.open.set(true);
1713
+ }
1714
+ }
1715
+ defaultTime() {
1716
+ return this.minTime() ?? MIDNIGHT;
1717
+ }
1718
+ pickDate(date) {
1719
+ if (date === undefined)
1720
+ return;
1721
+ if (date === null) {
1722
+ this.commit(null);
1723
+ return;
1724
+ }
1725
+ const time = this.shownPoint()?.time ?? this.draftStart() ?? this.defaultTime();
1726
+ this.commit({ date, time });
1727
+ }
1728
+ /** The second day of a range: the times are the ones already chosen, or the default. */
1729
+ pickRange(range) {
1730
+ if (range === undefined)
1731
+ return;
1732
+ if (range === null) {
1733
+ this.commit(null);
1734
+ return;
1735
+ }
1736
+ const shown = this.shownRange();
1737
+ this.commit(stickEndToStart({
1738
+ start: {
1739
+ date: range.start,
1740
+ time: shown?.start.time ?? this.draftStart() ?? this.defaultTime(),
1741
+ },
1742
+ end: {
1743
+ date: range.end,
1744
+ time: shown?.end.time ?? this.draftEnd() ?? this.defaultTime(),
1745
+ },
1746
+ }));
1747
+ }
1748
+ pickTime(which, time) {
1749
+ if (time === undefined)
1750
+ return;
1751
+ // Clearing the time of a picked date puts it back to the start of the day.
1752
+ const next = time ?? this.defaultTime();
1753
+ const range = this.shownRange();
1754
+ const point = this.shownPoint();
1755
+ if (range) {
1756
+ this.commit(stickEndToStart({
1757
+ start: which === 'start' ? { ...range.start, time: next } : range.start,
1758
+ end: which === 'end' ? { ...range.end, time: next } : range.end,
1759
+ }));
1760
+ }
1761
+ else if (point) {
1762
+ this.commit({ date: point.date, time: next });
1763
+ }
1764
+ else if (which === 'start') {
1765
+ this.draftStart.set(time);
1766
+ }
1767
+ else {
1768
+ this.draftEnd.set(time);
1769
+ }
1770
+ }
1771
+ clear() {
1772
+ this.draftStart.set(null);
1773
+ this.draftEnd.set(null);
1774
+ this.commit(null);
1775
+ this.text.set('');
1776
+ }
1777
+ clearAndFocus() {
1778
+ this.clear();
1779
+ this.inputElement().nativeElement.focus();
1780
+ }
1781
+ /** Close the popover, and give the focus back to the input when `returnFocus` is true. */
1782
+ close(returnFocus) {
1783
+ this.open.set(false);
1784
+ this.onTouchedFn();
1785
+ if (returnFocus)
1786
+ this.inputElement().nativeElement.focus();
1787
+ }
1788
+ onDismiss(reason) {
1789
+ if (reason === 'escape') {
1790
+ this.close(true);
1791
+ }
1792
+ else {
1793
+ this.open.set(false);
1794
+ this.onTouchedFn();
1795
+ }
1796
+ }
1797
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixDateTimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
1798
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: CalendrixDateTimePicker, isStandalone: true, selector: "calendrix-date-time-picker", inputs: { selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, system: { classPropertyName: "system", publicName: "system", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, hourCycle: { classPropertyName: "hourCycle", publicName: "hourCycle", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, hourStep: { classPropertyName: "hourStep", publicName: "hourStep", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, secondStep: { classPropertyName: "secondStep", publicName: "secondStep", isSignal: true, isRequired: false, transformFunction: null }, minTime: { classPropertyName: "minTime", publicName: "minTime", isSignal: true, isRequired: false, transformFunction: null }, maxTime: { classPropertyName: "maxTime", publicName: "maxTime", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, weekStart: { classPropertyName: "weekStart", publicName: "weekStart", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, visibleMonths: { classPropertyName: "visibleMonths", publicName: "visibleMonths", isSignal: true, isRequired: false, transformFunction: null }, isDateUnavailable: { classPropertyName: "isDateUnavailable", publicName: "isDateUnavailable", isSignal: true, isRequired: false, transformFunction: null }, plugins: { classPropertyName: "plugins", publicName: "plugins", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null }, now: { classPropertyName: "now", publicName: "now", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, portal: { classPropertyName: "portal", publicName: "portal", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [
1799
+ {
1800
+ provide: NG_VALUE_ACCESSOR,
1801
+ useExisting: forwardRef(() => CalendrixDateTimePicker),
1802
+ multi: true,
1803
+ },
1804
+ ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: `
1805
+ <div class="calendrix-picker" #wrapper>
1806
+ <div class="calendrix-picker-field">
1807
+ <input
1808
+ #input
1809
+ class="calendrix-input"
1810
+ type="text"
1811
+ dir="ltr"
1812
+ autocomplete="off"
1813
+ [attr.id]="inputId()"
1814
+ [value]="text()"
1815
+ [placeholder]="placeholder() ?? samplePlaceholder()"
1816
+ [disabled]="disabled()"
1817
+ [attr.aria-invalid]="invalid() ? 'true' : null"
1818
+ (input)="onInput($event)"
1819
+ (blur)="handleBlur()"
1820
+ (keydown)="onInputKeydown($event)"
1821
+ />
1822
+ @if (!disabled() && (hasValue() || text().trim() !== '')) {
1823
+ <button
1824
+ type="button"
1825
+ class="calendrix-toggle calendrix-clear"
1826
+ [attr.aria-label]="texts().clear"
1827
+ (click)="clearAndFocus()"
1828
+ >
1829
+ <svg aria-hidden="true" focusable="false" width="14" height="14" viewBox="0 0 14 14">
1830
+ <path
1831
+ d="M3 3l8 8M11 3l-8 8"
1832
+ fill="none"
1833
+ stroke="currentColor"
1834
+ stroke-width="1.5"
1835
+ stroke-linecap="round"
1836
+ />
1837
+ </svg>
1838
+ </button>
1839
+ }
1840
+ <button
1841
+ type="button"
1842
+ class="calendrix-toggle"
1843
+ aria-haspopup="dialog"
1844
+ [attr.aria-label]="texts().openCalendar"
1845
+ [attr.aria-expanded]="open()"
1846
+ [attr.aria-controls]="open() ? dialogId : null"
1847
+ [disabled]="disabled()"
1848
+ (click)="open.set(!open())"
1849
+ >
1850
+ <svg aria-hidden="true" focusable="false" width="18" height="18" viewBox="0 0 18 18">
1851
+ <rect
1852
+ x="2.5"
1853
+ y="3.5"
1854
+ width="13"
1855
+ height="12"
1856
+ rx="2"
1857
+ fill="none"
1858
+ stroke="currentColor"
1859
+ stroke-width="1.5"
1860
+ />
1861
+ <path
1862
+ d="M2.5 7.5h13M6 2v3M12 2v3"
1863
+ fill="none"
1864
+ stroke="currentColor"
1865
+ stroke-width="1.5"
1866
+ stroke-linecap="round"
1867
+ />
1868
+ </svg>
1869
+ </button>
1870
+ </div>
1871
+
1872
+ @if (open()) {
1873
+ <div
1874
+ role="dialog"
1875
+ [id]="dialogId"
1876
+ [attr.aria-label]="texts().dialog"
1877
+ [calendrixPopover]="wrapper"
1878
+ [portal]="portal()"
1879
+ (dismiss)="onDismiss($event)"
1880
+ >
1881
+ @if (isRangeMode()) {
1882
+ <calendrix-calendar
1883
+ [selection]="'range'"
1884
+ [system]="system()"
1885
+ [locale]="locale()"
1886
+ [plugins]="plugins()"
1887
+ [value]="calendarRange()"
1888
+ (valueChange)="pickRange($event)"
1889
+ [minDate]="minDate()"
1890
+ [maxDate]="maxDate()"
1891
+ [isDateUnavailable]="isDateUnavailable()"
1892
+ [weekStart]="weekStart()"
1893
+ [direction]="direction()"
1894
+ [visibleMonths]="visibleMonths() ?? 2"
1895
+ [timeZone]="timeZone()"
1896
+ [now]="now()"
1897
+ />
1898
+ } @else {
1899
+ <calendrix-calendar
1900
+ [system]="system()"
1901
+ [locale]="locale()"
1902
+ [plugins]="plugins()"
1903
+ [value]="shownPoint()?.date ?? null"
1904
+ (valueChange)="pickDate($event)"
1905
+ [minDate]="minDate()"
1906
+ [maxDate]="maxDate()"
1907
+ [isDateUnavailable]="isDateUnavailable()"
1908
+ [weekStart]="weekStart()"
1909
+ [direction]="direction()"
1910
+ [visibleMonths]="visibleMonths()"
1911
+ [timeZone]="timeZone()"
1912
+ [now]="now()"
1913
+ />
1914
+ }
1915
+ <div class="calendrix-popover-footer">
1916
+ @if (isRangeMode()) {
1917
+ <div class="calendrix-time-range">
1918
+ <div class="calendrix-time-row">
1919
+ <span class="calendrix-time-label" aria-hidden="true">{{
1920
+ texts().startTime
1921
+ }}</span>
1922
+ <calendrix-time-field
1923
+ [locale]="locale()"
1924
+ [hourCycle]="hourCycle()"
1925
+ [showSeconds]="showSeconds()"
1926
+ [hourStep]="hourStep()"
1927
+ [minuteStep]="minuteStep()"
1928
+ [secondStep]="secondStep()"
1929
+ [minTime]="minTime()"
1930
+ [maxTime]="maxTime()"
1931
+ [labels]="startLabels()"
1932
+ [value]="shownRange() ? shownRange()!.start.time : draftStart()"
1933
+ (valueChange)="pickTime('start', $event)"
1934
+ />
1935
+ </div>
1936
+ <div class="calendrix-time-row">
1937
+ <span class="calendrix-time-label" aria-hidden="true">{{ texts().endTime }}</span>
1938
+ <calendrix-time-field
1939
+ [locale]="locale()"
1940
+ [hourCycle]="hourCycle()"
1941
+ [showSeconds]="showSeconds()"
1942
+ [hourStep]="hourStep()"
1943
+ [minuteStep]="minuteStep()"
1944
+ [secondStep]="secondStep()"
1945
+ [minTime]="minTime()"
1946
+ [maxTime]="maxTime()"
1947
+ [labels]="endLabels()"
1948
+ [value]="shownRange() ? shownRange()!.end.time : draftEnd()"
1949
+ (valueChange)="pickTime('end', $event)"
1950
+ />
1951
+ </div>
1952
+ </div>
1953
+ } @else {
1954
+ <calendrix-time-field
1955
+ [locale]="locale()"
1956
+ [hourCycle]="hourCycle()"
1957
+ [showSeconds]="showSeconds()"
1958
+ [hourStep]="hourStep()"
1959
+ [minuteStep]="minuteStep()"
1960
+ [secondStep]="secondStep()"
1961
+ [minTime]="minTime()"
1962
+ [maxTime]="maxTime()"
1963
+ [value]="shownPoint() ? shownPoint()!.time : draftStart()"
1964
+ (valueChange)="pickTime('start', $event)"
1965
+ />
1966
+ }
1967
+ <div class="calendrix-actions">
1968
+ <button type="button" class="calendrix-action" (click)="clear()">
1969
+ {{ texts().clear }}
1970
+ </button>
1971
+ <button
1972
+ type="button"
1973
+ class="calendrix-action calendrix-action-primary"
1974
+ (click)="close(true)"
1975
+ >
1976
+ {{ texts().done }}
1977
+ </button>
1978
+ </div>
1979
+ </div>
1980
+ </div>
1981
+ }
1982
+ </div>
1983
+ `, isInline: true, dependencies: [{ kind: "component", type: CalendrixCalendar, selector: "calendrix-calendar", inputs: ["selection", "value", "defaultValue", "system", "locale", "direction", "weekStart", "plugins", "focusedDate", "visibleMonths", "allowUnavailableInRange", "maxSelected", "minDate", "maxDate", "isDateUnavailable", "labels", "timeZone", "now", "disabled"], outputs: ["valueChange", "focusedDateChange"] }, { kind: "component", type: CalendrixTimeField, selector: "calendrix-time-field", inputs: ["value", "defaultValue", "locale", "hourCycle", "showSeconds", "hourStep", "minuteStep", "secondStep", "minTime", "maxTime", "labels", "disabled"], outputs: ["valueChange"] }, { kind: "directive", type: CalendrixPopover, selector: "[calendrixPopover]", inputs: ["calendrixPopover", "portal", "placement"], outputs: ["dismiss"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1984
+ }
1985
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CalendrixDateTimePicker, decorators: [{
1986
+ type: Component,
1987
+ args: [{
1988
+ selector: 'calendrix-date-time-picker',
1989
+ imports: [CalendrixCalendar, CalendrixTimeField, CalendrixPopover],
1990
+ providers: [
1991
+ {
1992
+ provide: NG_VALUE_ACCESSOR,
1993
+ useExisting: forwardRef(() => CalendrixDateTimePicker),
1994
+ multi: true,
1995
+ },
1996
+ ],
1997
+ changeDetection: ChangeDetectionStrategy.OnPush,
1998
+ template: `
1999
+ <div class="calendrix-picker" #wrapper>
2000
+ <div class="calendrix-picker-field">
2001
+ <input
2002
+ #input
2003
+ class="calendrix-input"
2004
+ type="text"
2005
+ dir="ltr"
2006
+ autocomplete="off"
2007
+ [attr.id]="inputId()"
2008
+ [value]="text()"
2009
+ [placeholder]="placeholder() ?? samplePlaceholder()"
2010
+ [disabled]="disabled()"
2011
+ [attr.aria-invalid]="invalid() ? 'true' : null"
2012
+ (input)="onInput($event)"
2013
+ (blur)="handleBlur()"
2014
+ (keydown)="onInputKeydown($event)"
2015
+ />
2016
+ @if (!disabled() && (hasValue() || text().trim() !== '')) {
2017
+ <button
2018
+ type="button"
2019
+ class="calendrix-toggle calendrix-clear"
2020
+ [attr.aria-label]="texts().clear"
2021
+ (click)="clearAndFocus()"
2022
+ >
2023
+ <svg aria-hidden="true" focusable="false" width="14" height="14" viewBox="0 0 14 14">
2024
+ <path
2025
+ d="M3 3l8 8M11 3l-8 8"
2026
+ fill="none"
2027
+ stroke="currentColor"
2028
+ stroke-width="1.5"
2029
+ stroke-linecap="round"
2030
+ />
2031
+ </svg>
2032
+ </button>
2033
+ }
2034
+ <button
2035
+ type="button"
2036
+ class="calendrix-toggle"
2037
+ aria-haspopup="dialog"
2038
+ [attr.aria-label]="texts().openCalendar"
2039
+ [attr.aria-expanded]="open()"
2040
+ [attr.aria-controls]="open() ? dialogId : null"
2041
+ [disabled]="disabled()"
2042
+ (click)="open.set(!open())"
2043
+ >
2044
+ <svg aria-hidden="true" focusable="false" width="18" height="18" viewBox="0 0 18 18">
2045
+ <rect
2046
+ x="2.5"
2047
+ y="3.5"
2048
+ width="13"
2049
+ height="12"
2050
+ rx="2"
2051
+ fill="none"
2052
+ stroke="currentColor"
2053
+ stroke-width="1.5"
2054
+ />
2055
+ <path
2056
+ d="M2.5 7.5h13M6 2v3M12 2v3"
2057
+ fill="none"
2058
+ stroke="currentColor"
2059
+ stroke-width="1.5"
2060
+ stroke-linecap="round"
2061
+ />
2062
+ </svg>
2063
+ </button>
2064
+ </div>
2065
+
2066
+ @if (open()) {
2067
+ <div
2068
+ role="dialog"
2069
+ [id]="dialogId"
2070
+ [attr.aria-label]="texts().dialog"
2071
+ [calendrixPopover]="wrapper"
2072
+ [portal]="portal()"
2073
+ (dismiss)="onDismiss($event)"
2074
+ >
2075
+ @if (isRangeMode()) {
2076
+ <calendrix-calendar
2077
+ [selection]="'range'"
2078
+ [system]="system()"
2079
+ [locale]="locale()"
2080
+ [plugins]="plugins()"
2081
+ [value]="calendarRange()"
2082
+ (valueChange)="pickRange($event)"
2083
+ [minDate]="minDate()"
2084
+ [maxDate]="maxDate()"
2085
+ [isDateUnavailable]="isDateUnavailable()"
2086
+ [weekStart]="weekStart()"
2087
+ [direction]="direction()"
2088
+ [visibleMonths]="visibleMonths() ?? 2"
2089
+ [timeZone]="timeZone()"
2090
+ [now]="now()"
2091
+ />
2092
+ } @else {
2093
+ <calendrix-calendar
2094
+ [system]="system()"
2095
+ [locale]="locale()"
2096
+ [plugins]="plugins()"
2097
+ [value]="shownPoint()?.date ?? null"
2098
+ (valueChange)="pickDate($event)"
2099
+ [minDate]="minDate()"
2100
+ [maxDate]="maxDate()"
2101
+ [isDateUnavailable]="isDateUnavailable()"
2102
+ [weekStart]="weekStart()"
2103
+ [direction]="direction()"
2104
+ [visibleMonths]="visibleMonths()"
2105
+ [timeZone]="timeZone()"
2106
+ [now]="now()"
2107
+ />
2108
+ }
2109
+ <div class="calendrix-popover-footer">
2110
+ @if (isRangeMode()) {
2111
+ <div class="calendrix-time-range">
2112
+ <div class="calendrix-time-row">
2113
+ <span class="calendrix-time-label" aria-hidden="true">{{
2114
+ texts().startTime
2115
+ }}</span>
2116
+ <calendrix-time-field
2117
+ [locale]="locale()"
2118
+ [hourCycle]="hourCycle()"
2119
+ [showSeconds]="showSeconds()"
2120
+ [hourStep]="hourStep()"
2121
+ [minuteStep]="minuteStep()"
2122
+ [secondStep]="secondStep()"
2123
+ [minTime]="minTime()"
2124
+ [maxTime]="maxTime()"
2125
+ [labels]="startLabels()"
2126
+ [value]="shownRange() ? shownRange()!.start.time : draftStart()"
2127
+ (valueChange)="pickTime('start', $event)"
2128
+ />
2129
+ </div>
2130
+ <div class="calendrix-time-row">
2131
+ <span class="calendrix-time-label" aria-hidden="true">{{ texts().endTime }}</span>
2132
+ <calendrix-time-field
2133
+ [locale]="locale()"
2134
+ [hourCycle]="hourCycle()"
2135
+ [showSeconds]="showSeconds()"
2136
+ [hourStep]="hourStep()"
2137
+ [minuteStep]="minuteStep()"
2138
+ [secondStep]="secondStep()"
2139
+ [minTime]="minTime()"
2140
+ [maxTime]="maxTime()"
2141
+ [labels]="endLabels()"
2142
+ [value]="shownRange() ? shownRange()!.end.time : draftEnd()"
2143
+ (valueChange)="pickTime('end', $event)"
2144
+ />
2145
+ </div>
2146
+ </div>
2147
+ } @else {
2148
+ <calendrix-time-field
2149
+ [locale]="locale()"
2150
+ [hourCycle]="hourCycle()"
2151
+ [showSeconds]="showSeconds()"
2152
+ [hourStep]="hourStep()"
2153
+ [minuteStep]="minuteStep()"
2154
+ [secondStep]="secondStep()"
2155
+ [minTime]="minTime()"
2156
+ [maxTime]="maxTime()"
2157
+ [value]="shownPoint() ? shownPoint()!.time : draftStart()"
2158
+ (valueChange)="pickTime('start', $event)"
2159
+ />
2160
+ }
2161
+ <div class="calendrix-actions">
2162
+ <button type="button" class="calendrix-action" (click)="clear()">
2163
+ {{ texts().clear }}
2164
+ </button>
2165
+ <button
2166
+ type="button"
2167
+ class="calendrix-action calendrix-action-primary"
2168
+ (click)="close(true)"
2169
+ >
2170
+ {{ texts().done }}
2171
+ </button>
2172
+ </div>
2173
+ </div>
2174
+ </div>
2175
+ }
2176
+ </div>
2177
+ `,
2178
+ }]
2179
+ }], ctorParameters: () => [], propDecorators: { selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", required: false }] }], system: [{ type: i0.Input, args: [{ isSignal: true, alias: "system", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], hourCycle: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourCycle", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], hourStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourStep", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], secondStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondStep", required: false }] }], minTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "minTime", required: false }] }], maxTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxTime", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], weekStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStart", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], visibleMonths: [{ type: i0.Input, args: [{ isSignal: true, alias: "visibleMonths", required: false }] }], isDateUnavailable: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDateUnavailable", required: false }] }], plugins: [{ type: i0.Input, args: [{ isSignal: true, alias: "plugins", required: false }] }], timeZone: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeZone", required: false }] }], now: [{ type: i0.Input, args: [{ isSignal: true, alias: "now", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], portal: [{ type: i0.Input, args: [{ isSignal: true, alias: "portal", required: false }] }], inputElement: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }] } });
2180
+
2181
+ /*
2182
+ * Public API Surface of @calendrix/angular
2183
+ */
2184
+
2185
+ /**
2186
+ * Generated bundle index. Do not edit.
2187
+ */
2188
+
2189
+ export { CalendrixCalendar, CalendrixDatePicker, CalendrixDateTimePicker, CalendrixPopover, CalendrixPropsDirective, CalendrixTimeField };
2190
+ //# sourceMappingURL=calendrix-angular.mjs.map