@nanahoshi/mona-ui 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.
Files changed (134) hide show
  1. package/README.md +25 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
  8. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
  9. package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
  10. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
  11. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
  12. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
  13. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
  14. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
  15. package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
  16. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
  18. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
  19. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
  20. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
  21. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
  23. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
  28. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
  29. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
  30. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
  31. package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
  32. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
  33. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
  40. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
  41. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
  42. package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
  43. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
  44. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
  45. package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
  47. package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
  48. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
  49. package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
  50. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
  51. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
  52. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
  53. package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
  54. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
  55. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
  56. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
  57. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
  58. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
  59. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
  60. package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
  61. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
  62. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
  63. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
  64. package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
  65. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
  66. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
  67. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
  68. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
  69. package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
  70. package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
  71. package/package.json +289 -0
  72. package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
  73. package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
  74. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
  75. package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
  76. package/types/nanahoshi-mona-ui-button.d.ts +111 -0
  77. package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
  78. package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
  79. package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
  80. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
  81. package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
  82. package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
  83. package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
  84. package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
  85. package/types/nanahoshi-mona-ui-common.d.ts +386 -0
  86. package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
  87. package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
  88. package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
  89. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
  90. package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
  91. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
  92. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
  93. package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
  94. package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
  95. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
  96. package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
  97. package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
  98. package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
  99. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
  100. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
  101. package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
  102. package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
  103. package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
  104. package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
  105. package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
  106. package/types/nanahoshi-mona-ui-list.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
  108. package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
  109. package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
  110. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
  111. package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
  112. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
  113. package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
  114. package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
  115. package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
  116. package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
  117. package/types/nanahoshi-mona-ui-query.d.ts +89 -0
  118. package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
  119. package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
  120. package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
  121. package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
  122. package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
  123. package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
  124. package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
  125. package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
  126. package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
  127. package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
  128. package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
  129. package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
  130. package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
  131. package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
  132. package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
  133. package/types/nanahoshi-mona-ui-window.d.ts +295 -0
  134. package/types/nanahoshi-mona-ui.d.ts +2 -0
@@ -0,0 +1,659 @@
1
+ import { CdkTrapFocus } from '@angular/cdk/a11y';
2
+ import { NgTemplateOutlet } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, DestroyRef, ElementRef, signal, computed, linkedSignal, contentChild, viewChild, TemplateRef, output, input, model, effect, untracked, afterNextRender, forwardRef, Component } from '@angular/core';
5
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
+ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
7
+ import { ButtonDirective } from '@nanahoshi/mona-ui/button';
8
+ import { ButtonGroupComponent } from '@nanahoshi/mona-ui/button-group';
9
+ import { CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective, CalendarComponent } from '@nanahoshi/mona-ui/calendar';
10
+ import { CalendarService, TimeSelectorService, datePopupThemeVariants, DateInputPrefixTemplateDirective } from '@nanahoshi/mona-ui/date-input';
11
+ import * as i1 from '@nanahoshi/mona-ui/dropdowns';
12
+ import { DropdownService, DropdownPopupInputToken, DropdownPopupHandlerDirective } from '@nanahoshi/mona-ui/dropdowns';
13
+ import { createElementControlId } from '@nanahoshi/mona-ui/internal';
14
+ import { TextBoxComponent, TextBoxSuffixTemplateDirective, TextBoxPrefixTemplateDirective } from '@nanahoshi/mona-ui/text-box';
15
+ import { ThemeService } from '@nanahoshi/mona-ui/theme';
16
+ import { TimeSelectorComponent } from '@nanahoshi/mona-ui/time-selector';
17
+ import { any } from '@mirei/ts-collections';
18
+ import { DateTime } from 'luxon';
19
+ import { fromEvent, mergeWith } from 'rxjs';
20
+ import { twMerge } from 'tailwind-merge';
21
+ import { cva } from 'class-variance-authority';
22
+
23
+ const dateTimePickerBaseVariants = cva(`
24
+ flex items-center w-full
25
+ border border-border
26
+ focus-within:ring-2 focus-within:ring-primary/40 focus-within:border-primary
27
+ data-[invalid='true']:border-error
28
+ data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/40
29
+ [&_mona-text-box]:h-full
30
+ [&_mona-text-box]:border-none
31
+ `, {
32
+ variants: {
33
+ focused: {
34
+ true: `ring-2 ring-primary/40 border-primary`
35
+ },
36
+ rounded: {
37
+ full: "rounded-full",
38
+ large: "rounded-lg",
39
+ medium: "rounded-md",
40
+ none: "rounded-none",
41
+ small: "rounded-sm"
42
+ },
43
+ size: {
44
+ large: "h-10 text-md",
45
+ medium: "h-9 text-sm",
46
+ small: "h-8 text-xs"
47
+ }
48
+ }
49
+ });
50
+ const dateTimePickerHeaderVariants = cva(`
51
+ p-2 bg-accent/20 border-b border-border flex items-center
52
+ [&>mona-button-group]:w-full
53
+ [&>mona-button-group>[monaButton]]:flex-1
54
+ `);
55
+ const dateTimePickerFooterVariants = cva(`
56
+ p-2 bg-accent/20 border-t border-border flex items-center justify-between gap-2
57
+ [&>[monaButton]]:flex-1
58
+ `);
59
+
60
+ const dateTimePickerBaseThemeVariants = (theme) => {
61
+ switch (theme) {
62
+ case "mona":
63
+ return dateTimePickerBaseVariants;
64
+ default:
65
+ return dateTimePickerBaseVariants;
66
+ }
67
+ };
68
+ const dateTimePickerHeaderThemeVariants = (theme) => {
69
+ switch (theme) {
70
+ case "mona":
71
+ return dateTimePickerHeaderVariants;
72
+ default:
73
+ return dateTimePickerHeaderVariants;
74
+ }
75
+ };
76
+ const dateTimePickerFooterThemeVariants = (theme) => {
77
+ switch (theme) {
78
+ case "mona":
79
+ return dateTimePickerFooterVariants;
80
+ default:
81
+ return dateTimePickerFooterVariants;
82
+ }
83
+ };
84
+
85
+ class DateTimePickerComponent {
86
+ #calendarService;
87
+ #destroyRef;
88
+ #dropdownService;
89
+ #hostElementRef;
90
+ #id;
91
+ #themeService;
92
+ #timeSelectorService;
93
+ constructor() {
94
+ this.#calendarService = inject(CalendarService);
95
+ this.#destroyRef = inject(DestroyRef);
96
+ this.#dropdownService = inject(DropdownService);
97
+ this.#hostElementRef = inject(ElementRef);
98
+ this.#id = createElementControlId();
99
+ this.#themeService = inject(ThemeService);
100
+ this.#timeSelectorService = inject(TimeSelectorService);
101
+ this.activeView = signal("date", /* @ts-ignore */
102
+ ...(ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []));
103
+ this.baseClass = computed(() => {
104
+ const theme = this.#themeService.theme();
105
+ const focused = this.#dropdownService.popupRef() != null;
106
+ const rounded = this.rounded();
107
+ const size = this.size();
108
+ const variantClass = dateTimePickerBaseThemeVariants(theme)({ focused, rounded, size });
109
+ const userClass = this.userClass();
110
+ return twMerge(variantClass, userClass);
111
+ }, /* @ts-ignore */
112
+ ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
113
+ this.currentDateString = linkedSignal(() => {
114
+ const value = this.value();
115
+ const format = this.format();
116
+ if (!value) {
117
+ return "";
118
+ }
119
+ return DateTime.fromJSDate(value).toFormat(format);
120
+ }, /* @ts-ignore */
121
+ ...(ngDevMode ? [{ debugName: "currentDateString" }] : /* istanbul ignore next */ []));
122
+ this.decadeCellTemplate = contentChild(CalendarDecadeCellTemplateDirective, /* @ts-ignore */
123
+ ...(ngDevMode ? [{ debugName: "decadeCellTemplate" }] : /* istanbul ignore next */ []));
124
+ this.expanded = computed(() => this.#dropdownService.popupRef() !== null, /* @ts-ignore */
125
+ ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
126
+ this.footerClass = computed(() => {
127
+ const theme = this.#themeService.theme();
128
+ return dateTimePickerFooterThemeVariants(theme)();
129
+ }, /* @ts-ignore */
130
+ ...(ngDevMode ? [{ debugName: "footerClass" }] : /* istanbul ignore next */ []));
131
+ this.headerClass = computed(() => {
132
+ const theme = this.#themeService.theme();
133
+ return dateTimePickerHeaderThemeVariants(theme)();
134
+ }, /* @ts-ignore */
135
+ ...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
136
+ this.inputAttributes = computed(() => {
137
+ const controls = this.popupId;
138
+ const expanded = this.#dropdownService.popupRef() != null;
139
+ const hasPopup = "dialog";
140
+ const invalid = this.invalid();
141
+ return {
142
+ "aria-autocomplete": "none",
143
+ "aria-controls": controls,
144
+ "aria-expanded": expanded,
145
+ "aria-haspopup": hasPopup,
146
+ "aria-invalid": invalid,
147
+ id: this.#id,
148
+ role: "group"
149
+ };
150
+ }, /* @ts-ignore */
151
+ ...(ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []));
152
+ this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && !this.value()), /* @ts-ignore */
153
+ ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
154
+ this.monthCellTemplate = contentChild(CalendarMonthCellTemplateDirective, /* @ts-ignore */
155
+ ...(ngDevMode ? [{ debugName: "monthCellTemplate" }] : /* istanbul ignore next */ []));
156
+ this.navigatedDate = linkedSignal(() => this.value() ?? new Date(), /* @ts-ignore */
157
+ ...(ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []));
158
+ this.pickerPopupClass = computed(() => {
159
+ const theme = this.#themeService.theme();
160
+ const rounded = this.rounded();
161
+ const size = this.size();
162
+ const userClass = this.popupClass();
163
+ const variantClass = datePopupThemeVariants(theme)({ rounded, size });
164
+ return twMerge(variantClass, userClass);
165
+ }, /* @ts-ignore */
166
+ ...(ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []));
167
+ this.popupId = createElementControlId();
168
+ this.popupTemplate = viewChild.required("datePopupTemplate", /* @ts-ignore */
169
+ ...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
170
+ this.prefixTemplate = contentChild(DateInputPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
171
+ this.timePickerMax = computed(() => {
172
+ const maxDate = this.max();
173
+ const navigatedDate = this.navigatedDate();
174
+ if (!maxDate) {
175
+ return null;
176
+ }
177
+ const max = DateTime.fromJSDate(maxDate);
178
+ const date = DateTime.fromJSDate(navigatedDate);
179
+ if (max.year === date.year && max.month === date.month && max.day === date.day) {
180
+ return maxDate;
181
+ }
182
+ return null;
183
+ }, /* @ts-ignore */
184
+ ...(ngDevMode ? [{ debugName: "timePickerMax" }] : /* istanbul ignore next */ []));
185
+ this.timePickerMin = computed(() => {
186
+ const minDate = this.min();
187
+ const navigatedDate = this.navigatedDate();
188
+ if (!minDate) {
189
+ return null;
190
+ }
191
+ const min = DateTime.fromJSDate(minDate);
192
+ const date = DateTime.fromJSDate(navigatedDate);
193
+ if (min.year === date.year && min.month === date.month && min.day === date.day) {
194
+ return minDate;
195
+ }
196
+ return null;
197
+ }, /* @ts-ignore */
198
+ ...(ngDevMode ? [{ debugName: "timePickerMin" }] : /* istanbul ignore next */ []));
199
+ this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, /* @ts-ignore */
200
+ ...(ngDevMode ? [{ debugName: "yearCellTemplate" }] : /* istanbul ignore next */ []));
201
+ /**
202
+ * @description Emits when the popup is about to close. This event is preventable.
203
+ */
204
+ this.close = output();
205
+ /**
206
+ * @description Emits after the popup is closed.
207
+ */
208
+ this.closed = output();
209
+ /**
210
+ * @description Sets the disabled state of the date time picker.
211
+ */
212
+ this.disabled = input(false, /* @ts-ignore */
213
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
214
+ /**
215
+ * @description Sets the disabled dates of the date time picker.
216
+ * Accepts either an iterable of Date objects or a predicate function.
217
+ */
218
+ this.disabledDates = input(/* @ts-ignore */
219
+ ...(ngDevMode ? [undefined, { debugName: "disabledDates" }] : /* istanbul ignore next */ []));
220
+ /**
221
+ * @description Sets the first day of the week.
222
+ */
223
+ this.firstDay = input("monday", /* @ts-ignore */
224
+ ...(ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []));
225
+ /**
226
+ * @description Sets the date format of the date time picker.
227
+ */
228
+ this.format = input("dd/MM/yyyy HH:mm", /* @ts-ignore */
229
+ ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
230
+ /**
231
+ * @description Sets the hour format of the time picker.
232
+ * @default 24
233
+ */
234
+ this.hourFormat = input("24", /* @ts-ignore */
235
+ ...(ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []));
236
+ /**
237
+ * @description Sets the hour step of the time picker.
238
+ * @default 1
239
+ */
240
+ this.hourStep = input(1, /* @ts-ignore */
241
+ ...(ngDevMode ? [{ debugName: "hourStep" }] : /* istanbul ignore next */ []));
242
+ /**
243
+ * @description Marks the date time picker as invalid. When bound to a signal form field via `[formField]`,
244
+ * this is written by the `FormField` directive.
245
+ * @default false
246
+ */
247
+ this.invalid = input(false, /* @ts-ignore */
248
+ ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
249
+ /**
250
+ * @description Sets the maximum date of the date time picker.
251
+ */
252
+ this.max = input(undefined, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: value => (value instanceof Date ? value : undefined) });
253
+ /**
254
+ * @description Sets the minimum date of the date time picker.
255
+ */
256
+ this.min = input(undefined, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: value => (value instanceof Date ? value : undefined) });
257
+ /**
258
+ * @description Sets the minute step of the time picker.
259
+ * @default 1
260
+ */
261
+ this.minuteStep = input(1, /* @ts-ignore */
262
+ ...(ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []));
263
+ /**
264
+ * @description Emits when the popup is about to open. This event is preventable.
265
+ */
266
+ this.open = output();
267
+ /**
268
+ * @description Emits after the popup is opened.
269
+ */
270
+ this.opened = output();
271
+ /**
272
+ * @description Sets the placeholder of the date time picker.
273
+ */
274
+ this.placeholder = input("", /* @ts-ignore */
275
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
276
+ /**
277
+ * @description Sets the class of the popup element.
278
+ * @default ""
279
+ */
280
+ this.popupClass = input("", /* @ts-ignore */
281
+ ...(ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []));
282
+ /**
283
+ * @description Sets the height of the popup element.
284
+ * @default 200
285
+ */
286
+ this.popupHeight = input(/* @ts-ignore */
287
+ ...(ngDevMode ? [undefined, { debugName: "popupHeight" }] : /* istanbul ignore next */ []));
288
+ /**
289
+ * @description Sets the width of the popup element.
290
+ * @default null
291
+ */
292
+ this.popupWidth = input(/* @ts-ignore */
293
+ ...(ngDevMode ? [undefined, { debugName: "popupWidth" }] : /* istanbul ignore next */ []));
294
+ /**
295
+ * @description Sets the readonly state of the date time picker.
296
+ */
297
+ this.readonly = input(false, /* @ts-ignore */
298
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
299
+ /**
300
+ * @description When true, the input is readonly but the popup button remains enabled.
301
+ * @default false
302
+ */
303
+ this.readonlyInput = input(false, /* @ts-ignore */
304
+ ...(ngDevMode ? [{ debugName: "readonlyInput" }] : /* istanbul ignore next */ []));
305
+ /**
306
+ * @description Sets the required state of the date time picker.
307
+ * When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
308
+ * @default false
309
+ */
310
+ this.required = input(false, /* @ts-ignore */
311
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
312
+ /**
313
+ * @description Sets the border radius of the date time picker.
314
+ */
315
+ this.rounded = input("medium", /* @ts-ignore */
316
+ ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
317
+ /**
318
+ * @description Sets the second step of the time picker.
319
+ * @default 1
320
+ */
321
+ this.secondStep = input(1, /* @ts-ignore */
322
+ ...(ngDevMode ? [{ debugName: "secondStep" }] : /* istanbul ignore next */ []));
323
+ /**
324
+ * @description Sets the visibility of the clear button.
325
+ */
326
+ this.showClearButton = input(false, /* @ts-ignore */
327
+ ...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
328
+ /**
329
+ * @description Sets the visibility of the second selector.
330
+ */
331
+ this.showSeconds = input(false, /* @ts-ignore */
332
+ ...(ngDevMode ? [{ debugName: "showSeconds" }] : /* istanbul ignore next */ []));
333
+ /**
334
+ * @description Sets the size of the date time picker.
335
+ */
336
+ this.size = input("medium", /* @ts-ignore */
337
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
338
+ /**
339
+ * @description Emitted when the date time picker is interacted with via blur, selection, or clear.
340
+ * The `FormField` directive listens to this to mark the field as touched.
341
+ */
342
+ this.touch = output();
343
+ /**
344
+ * @description Sets the touched state of the date time picker. When bound to a signal form field via `[formField]`,
345
+ * this is written by the `FormField` directive.
346
+ * @default false
347
+ */
348
+ this.touched = input(false, /* @ts-ignore */
349
+ ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
350
+ this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
351
+ /**
352
+ * @description Two-way bindable current date time value.
353
+ * @default null
354
+ */
355
+ this.value = model(null, /* @ts-ignore */
356
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
357
+ /**
358
+ * @description Enables the display of week numbers in the calendar.
359
+ * @default false
360
+ */
361
+ this.weekNumber = input(false, /* @ts-ignore */
362
+ ...(ngDevMode ? [{ debugName: "weekNumber" }] : /* istanbul ignore next */ []));
363
+ effect(() => {
364
+ const popupTemplate = this.popupTemplate();
365
+ untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
366
+ });
367
+ afterNextRender({
368
+ read: () => {
369
+ this.setSubscriptions();
370
+ this.setPopupCloseSubscriptions();
371
+ }
372
+ });
373
+ }
374
+ onCancelClick() {
375
+ this.navigatedDate.set(this.value() ?? new Date());
376
+ this.#dropdownService.popupRef()?.close();
377
+ this.touch.emit();
378
+ }
379
+ onCalendarValueChange(date) {
380
+ const singleDate = Array.isArray(date) ? null : date;
381
+ if (singleDate) {
382
+ const inRangeDate = this.updateDateIfNotInRange(singleDate);
383
+ this.navigatedDate.set(inRangeDate);
384
+ }
385
+ this.activeView.set("time");
386
+ }
387
+ onDateInputBlur() {
388
+ if (this.#dropdownService.popupRef()) {
389
+ this.touch.emit();
390
+ return;
391
+ }
392
+ if (!this.currentDateString() && this.value()) {
393
+ this.setCurrentDate(null);
394
+ this.touch.emit();
395
+ return;
396
+ }
397
+ const dateTime = DateTime.fromFormat(this.currentDateString(), this.format());
398
+ if (this.dateStringEquals(this.value(), dateTime.toJSDate())) {
399
+ this.touch.emit();
400
+ return;
401
+ }
402
+ if (dateTime.isValid) {
403
+ const value = this.value();
404
+ if (value && DateTime.fromJSDate(value).equals(dateTime)) {
405
+ this.touch.emit();
406
+ return;
407
+ }
408
+ this.setCurrentDate(dateTime.toJSDate());
409
+ }
410
+ else {
411
+ this.setCurrentDate(null);
412
+ this.currentDateString.set("");
413
+ }
414
+ this.touch.emit();
415
+ }
416
+ onDateInputButtonClick() {
417
+ if (this.disabled() || this.readonly()) {
418
+ return;
419
+ }
420
+ if (this.#dropdownService.popupRef()) {
421
+ this.closePopup();
422
+ }
423
+ else {
424
+ this.openPopup();
425
+ }
426
+ }
427
+ onDateStringEdit(dateString) {
428
+ this.currentDateString.set(dateString);
429
+ }
430
+ onSetDateClick() {
431
+ this.value.set(this.navigatedDate());
432
+ this.#dropdownService.popupRef()?.close();
433
+ this.touch.emit();
434
+ }
435
+ onTimeSelectorValueChange(date) {
436
+ if (date) {
437
+ const inRangeDate = this.updateDateIfNotInRange(date);
438
+ this.navigatedDate.set(inRangeDate);
439
+ }
440
+ }
441
+ compareDatesEqual(date1, date2) {
442
+ return (date1.getFullYear() === date2.getFullYear() &&
443
+ date1.getMonth() === date2.getMonth() &&
444
+ date1.getDate() === date2.getDate());
445
+ }
446
+ dateStringEquals(date1, date2) {
447
+ if (date1 && date2) {
448
+ return (DateTime.fromJSDate(date1).toFormat(this.format()) ===
449
+ DateTime.fromJSDate(date2).toFormat(this.format()));
450
+ }
451
+ return date1 === date2;
452
+ }
453
+ focus() {
454
+ const input = this.#hostElementRef.nativeElement.querySelector("input");
455
+ if (input && !this.readonly()) {
456
+ input.focus();
457
+ input.setSelectionRange(input.value.length, input.value.length);
458
+ }
459
+ }
460
+ isDateDisabledByInput(date, disabledDates) {
461
+ if (typeof disabledDates === "function") {
462
+ return disabledDates(date);
463
+ }
464
+ else if (disabledDates) {
465
+ return any(disabledDates, d => this.compareDatesEqual(date, d));
466
+ }
467
+ return false;
468
+ }
469
+ setCurrentDate(date) {
470
+ this.value.set(date);
471
+ this.updateCurrentDateString(date, this.format());
472
+ this.touch.emit();
473
+ }
474
+ closePopup() {
475
+ this.#dropdownService.popupRef()?.close();
476
+ }
477
+ handleKeydown(event) {
478
+ if (this.disabled() || this.readonly()) {
479
+ return;
480
+ }
481
+ const popupOpen = this.#dropdownService.popupRef() !== null;
482
+ if (event.altKey && event.key === "ArrowDown") {
483
+ event.preventDefault();
484
+ this.openPopup();
485
+ return;
486
+ }
487
+ if (event.altKey && event.key === "ArrowUp") {
488
+ event.preventDefault();
489
+ console.warn("ArrowUp is not supported yet");
490
+ this.closePopup();
491
+ return;
492
+ }
493
+ if (event.key === "Escape" && popupOpen) {
494
+ event.preventDefault();
495
+ this.onCancelClick();
496
+ return;
497
+ }
498
+ if (event.altKey && event.key === "ArrowRight" && popupOpen) {
499
+ event.preventDefault();
500
+ this.activeView.set("time");
501
+ return;
502
+ }
503
+ if (event.altKey && event.key === "ArrowLeft" && popupOpen) {
504
+ event.preventDefault();
505
+ this.activeView.set("date");
506
+ return;
507
+ }
508
+ if (event.key === "Enter" && popupOpen) {
509
+ const target = event.target;
510
+ if (target.tagName === "BUTTON" || target.closest("button")) {
511
+ return;
512
+ }
513
+ event.preventDefault();
514
+ if (this.activeView() === "date") {
515
+ this.activeView.set("time");
516
+ }
517
+ else {
518
+ this.onSetDateClick();
519
+ }
520
+ return;
521
+ }
522
+ }
523
+ openPopup() {
524
+ if (!this.#dropdownService.popupRef()) {
525
+ this.#dropdownService.triggerPopupOpen$.next({
526
+ minWidth: this.popupWidth() || this.#hostElementRef.nativeElement.getBoundingClientRect().width,
527
+ width: this.popupWidth() || "fit-content",
528
+ height: this.popupHeight() || "fit-content",
529
+ closeOnScroll: false,
530
+ withScrollTracking: true
531
+ });
532
+ }
533
+ }
534
+ setKeyboardSubscriptions() {
535
+ fromEvent(this.#hostElementRef.nativeElement, "keydown")
536
+ .pipe(takeUntilDestroyed(this.#destroyRef))
537
+ .subscribe(event => this.handleKeydown(event));
538
+ this.#calendarService.keydown$
539
+ .pipe(mergeWith(this.#timeSelectorService.keydown$), takeUntilDestroyed(this.#destroyRef))
540
+ .subscribe(e => {
541
+ const keyboardEvent = e.originalEvent;
542
+ if (!keyboardEvent) {
543
+ return;
544
+ }
545
+ if (keyboardEvent.key === "Escape") {
546
+ keyboardEvent.preventDefault();
547
+ this.onCancelClick();
548
+ }
549
+ else if (keyboardEvent.altKey && keyboardEvent.key === "ArrowUp") {
550
+ keyboardEvent.preventDefault();
551
+ this.closePopup();
552
+ }
553
+ else if (keyboardEvent.altKey && keyboardEvent.key === "ArrowRight" && this.activeView() === "date") {
554
+ keyboardEvent.preventDefault();
555
+ this.activeView.set("time");
556
+ }
557
+ else if (keyboardEvent.altKey && keyboardEvent.key === "ArrowLeft" && this.activeView() === "time") {
558
+ keyboardEvent.preventDefault();
559
+ this.activeView.set("date");
560
+ }
561
+ else if (keyboardEvent.key === "Enter" && this.activeView() === "time") {
562
+ const target = keyboardEvent.target;
563
+ if (target.tagName === "BUTTON" || target.closest("button")) {
564
+ return;
565
+ }
566
+ keyboardEvent.preventDefault();
567
+ this.onSetDateClick();
568
+ }
569
+ });
570
+ }
571
+ setPopupCloseSubscriptions() {
572
+ this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
573
+ this.focus();
574
+ this.activeView.set("date");
575
+ this.navigatedDate.set(this.value() ?? new Date());
576
+ });
577
+ }
578
+ setSubscriptions() {
579
+ fromEvent(this.#hostElementRef.nativeElement, "focusin")
580
+ .pipe(takeUntilDestroyed(this.#destroyRef))
581
+ .subscribe(() => this.focus());
582
+ this.setKeyboardSubscriptions();
583
+ }
584
+ updateDateIfNotInRange(date) {
585
+ const maxDate = this.max();
586
+ const minDate = this.min();
587
+ if (minDate && date < minDate) {
588
+ return minDate;
589
+ }
590
+ if (maxDate && date > maxDate) {
591
+ return maxDate;
592
+ }
593
+ return date;
594
+ }
595
+ updateCurrentDateString(date, format) {
596
+ if (!date) {
597
+ this.currentDateString.set("");
598
+ return;
599
+ }
600
+ const dateString = DateTime.fromJSDate(date).toFormat(format);
601
+ this.currentDateString.set(dateString);
602
+ }
603
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DateTimePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
604
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: DateTimePickerComponent, isStandalone: true, selector: "mona-datetime-picker", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, firstDay: { classPropertyName: "firstDay", publicName: "firstDay", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, hourFormat: { classPropertyName: "hourFormat", publicName: "hourFormat", isSignal: true, isRequired: false, transformFunction: null }, hourStep: { classPropertyName: "hourStep", publicName: "hourStep", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, popupClass: { classPropertyName: "popupClass", publicName: "popupClass", isSignal: true, isRequired: false, transformFunction: null }, popupHeight: { classPropertyName: "popupHeight", publicName: "popupHeight", isSignal: true, isRequired: false, transformFunction: null }, popupWidth: { classPropertyName: "popupWidth", publicName: "popupWidth", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, readonlyInput: { classPropertyName: "readonlyInput", publicName: "readonlyInput", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, secondStep: { classPropertyName: "secondStep", publicName: "secondStep", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, weekNumber: { classPropertyName: "weekNumber", publicName: "weekNumber", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed", open: "open", opened: "opened", touch: "touch", value: "valueChange" }, host: { listeners: { "blur": "onDateInputBlur()" }, properties: { "attr.tabindex": "disabled() ? null : -1", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.data-expanded": "expanded()", "attr.data-invalid": "invalidState() || null", "class": "baseClass()" } }, providers: [
605
+ CalendarService,
606
+ DropdownService,
607
+ TimeSelectorService,
608
+ {
609
+ provide: DropdownPopupInputToken,
610
+ useExisting: forwardRef(() => DateTimePickerComponent),
611
+ multi: false
612
+ }
613
+ ], queries: [{ propertyName: "decadeCellTemplate", first: true, predicate: CalendarDecadeCellTemplateDirective, descendants: true, isSignal: true }, { propertyName: "monthCellTemplate", first: true, predicate: CalendarMonthCellTemplateDirective, descendants: true, isSignal: true }, { propertyName: "prefixTemplate", first: true, predicate: DateInputPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "yearCellTemplate", first: true, predicate: CalendarYearCellTemplateDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["datePopupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }], ngImport: i0, template: "<mona-text-box\r\n (inputBlur)=\"onDateInputBlur()\"\r\n (valueChange)=\"onDateStringEdit($event)\"\r\n [clearButton]=\"showClearButton()\"\r\n [disabled]=\"disabled()\"\r\n [inputAttributes]=\"inputAttributes()\"\r\n [invalid]=\"invalid()\"\r\n [placeholder]=\"placeholder()\"\r\n [readonly]=\"readonly() || readonlyInput()\"\r\n [required]=\"required()\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n [touched]=\"touched()\"\r\n [value]=\"currentDateString()\">\r\n @if (prefixTemplate()) {\r\n <ng-template monaTextBoxPrefixTemplate>\r\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n <ng-template monaTextBoxSuffixTemplate>\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n [iconOnly]=\"true\"\r\n [size]=\"size()\"\r\n [rounded]=\"'none'\"\r\n class=\"h-full w-auto aspect-square\"\r\n [attr.aria-label]=\"'Open date and time picker'\"\r\n [attr.aria-expanded]=\"expanded()\"\r\n [attr.aria-controls]=\"popupId\"\r\n (click)=\"onDateInputButtonClick()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [tabindex]=\"-1\">\r\n <i class=\"ri-calendar-line\"></i>\r\n </button>\r\n </ng-template>\r\n</mona-text-box>\r\n\r\n<ng-template #datePopupTemplate>\r\n <div\r\n [class]=\"pickerPopupClass()\"\r\n [id]=\"popupId\"\r\n class=\"flex flex-col h-68\"\r\n aria-modal=\"true\"\r\n role=\"dialog\"\r\n cdkTrapFocus>\r\n <div [class]=\"headerClass()\">\r\n <mona-button-group\r\n selection=\"single\"\r\n [allowEmpty]=\"false\"\r\n class=\"w-full\"\r\n [disabled]=\"disabled()\"\r\n [size]=\"size()\"\r\n [rounded]=\"rounded()\"\r\n role=\"tablist\">\r\n <button monaButton [selected]=\"activeView() === 'date'\" (click)=\"activeView.set('date')\" role=\"tab\">\r\n Date\r\n </button>\r\n <button monaButton [selected]=\"activeView() === 'time'\" (click)=\"activeView.set('time')\" role=\"tab\">\r\n Time\r\n </button>\r\n </mona-button-group>\r\n </div>\r\n <div class=\"overflow-hidden\">\r\n @if (activeView() === \"date\") {\r\n <div class=\"h-full flex items-center justify-center\" aria-label=\"Calendar\">\r\n <mona-calendar\r\n [disabledDates]=\"disabledDates()\"\r\n [minDate]=\"min()\"\r\n [maxDate]=\"max()\"\r\n [firstDay]=\"firstDay()\"\r\n [weekNumber]=\"weekNumber()\"\r\n [value]=\"navigatedDate()\"\r\n [disabled]=\"disabled()\"\r\n [readonly]=\"readonly()\"\r\n [rounded]=\"rounded()\"\r\n (valueChange)=\"onCalendarValueChange($event)\"\r\n class=\"shadow-none border-none flex-1\">\r\n @if (decadeCellTemplate()) {\r\n <ng-template monaCalendarDecadeCellTemplate let-year>\r\n <ng-container\r\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (monthCellTemplate()) {\r\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (yearCellTemplate()) {\r\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\r\n </ng-template>\r\n }\r\n </mona-calendar>\r\n </div>\r\n }\r\n @if (activeView() === \"time\") {\r\n <div class=\"h-full flex items-center justify-center max-h-64\" aria-label=\"Time picker\">\r\n <mona-time-selector\r\n [value]=\"navigatedDate()\"\r\n (valueChange)=\"onTimeSelectorValueChange($event)\"\r\n [disabled]=\"disabled()\"\r\n [readonly]=\"readonly()\"\r\n [max]=\"timePickerMax()\"\r\n [min]=\"timePickerMin()\"\r\n [footer]=\"false\"\r\n [size]=\"size()\"\r\n [rounded]=\"rounded()\"\r\n [hourStep]=\"hourStep()\"\r\n [minuteStep]=\"minuteStep()\"\r\n [secondStep]=\"secondStep()\"\r\n [hourFormat]=\"hourFormat()\"\r\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\r\n </div>\r\n }\r\n </div>\r\n <div [class]=\"footerClass()\">\r\n <button\r\n monaButton\r\n look=\"primary\"\r\n [disabled]=\"disabled()\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n (click)=\"onSetDateClick()\">\r\n Set\r\n </button>\r\n <button\r\n monaButton\r\n look=\"default\"\r\n [disabled]=\"disabled()\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n (click)=\"onCancelClick()\">\r\n Cancel\r\n </button>\r\n </div>\r\n </div>\r\n</ng-template>\r\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "ngmodule", type: FontAwesomeModule }, { kind: "component", type: CalendarComponent, selector: "mona-calendar", inputs: ["disabled", "disabledDates", "firstDay", "invalid", "maxDate", "minDate", "readonly", "rounded", "selection", "required", "touched", "class", "value", "weekNumber"], outputs: ["disabledChange", "touch", "valueChange"] }, { kind: "component", type: TimeSelectorComponent, selector: "mona-time-selector", inputs: ["ariaLabel", "disabled", "focusOnMount", "footer", "hourFormat", "hourStep", "invalid", "max", "min", "minuteStep", "readonly", "required", "rounded", "secondStep", "showSeconds", "size", "touched", "value"], outputs: ["touch", "valueChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["clearButton", "disabled", "inputAttributes", "inputClass", "inputStyle", "invalid", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "ng-template[monaTextBoxSuffixTemplate]" }, { kind: "component", type: ButtonGroupComponent, selector: "mona-button-group", inputs: ["allowEmpty", "aria-label", "disabled", "look", "rounded", "selection", "size", "class"], outputs: ["buttonClick", "disabledChange", "selectionChange"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: CalendarDecadeCellTemplateDirective, selector: "ng-template[monaCalendarDecadeCellTemplate]" }, { kind: "directive", type: CalendarMonthCellTemplateDirective, selector: "ng-template[monaCalendarMonthCellTemplate]" }, { kind: "directive", type: CalendarYearCellTemplateDirective, selector: "ng-template[monaCalendarYearCellTemplate]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TextBoxPrefixTemplateDirective, selector: "ng-template[monaTextBoxPrefixTemplate]" }] }); }
614
+ }
615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DateTimePickerComponent, decorators: [{
616
+ type: Component,
617
+ args: [{ selector: "mona-datetime-picker", providers: [
618
+ CalendarService,
619
+ DropdownService,
620
+ TimeSelectorService,
621
+ {
622
+ provide: DropdownPopupInputToken,
623
+ useExisting: forwardRef(() => DateTimePickerComponent),
624
+ multi: false
625
+ }
626
+ ], imports: [
627
+ ButtonDirective,
628
+ FontAwesomeModule,
629
+ CalendarComponent,
630
+ TimeSelectorComponent,
631
+ TextBoxComponent,
632
+ TextBoxSuffixTemplateDirective,
633
+ ButtonGroupComponent,
634
+ CdkTrapFocus,
635
+ CalendarDecadeCellTemplateDirective,
636
+ CalendarMonthCellTemplateDirective,
637
+ CalendarYearCellTemplateDirective,
638
+ NgTemplateOutlet,
639
+ TextBoxPrefixTemplateDirective
640
+ ], hostDirectives: [DropdownPopupHandlerDirective], host: {
641
+ "[attr.tabindex]": "disabled() ? null : -1",
642
+ "[attr.aria-invalid]": "invalidState() ? 'true' : null",
643
+ "[attr.data-expanded]": "expanded()",
644
+ "[attr.data-invalid]": "invalidState() || null",
645
+ "[class]": "baseClass()",
646
+ "(blur)": "onDateInputBlur()"
647
+ }, template: "<mona-text-box\r\n (inputBlur)=\"onDateInputBlur()\"\r\n (valueChange)=\"onDateStringEdit($event)\"\r\n [clearButton]=\"showClearButton()\"\r\n [disabled]=\"disabled()\"\r\n [inputAttributes]=\"inputAttributes()\"\r\n [invalid]=\"invalid()\"\r\n [placeholder]=\"placeholder()\"\r\n [readonly]=\"readonly() || readonlyInput()\"\r\n [required]=\"required()\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n [touched]=\"touched()\"\r\n [value]=\"currentDateString()\">\r\n @if (prefixTemplate()) {\r\n <ng-template monaTextBoxPrefixTemplate>\r\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n <ng-template monaTextBoxSuffixTemplate>\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n [iconOnly]=\"true\"\r\n [size]=\"size()\"\r\n [rounded]=\"'none'\"\r\n class=\"h-full w-auto aspect-square\"\r\n [attr.aria-label]=\"'Open date and time picker'\"\r\n [attr.aria-expanded]=\"expanded()\"\r\n [attr.aria-controls]=\"popupId\"\r\n (click)=\"onDateInputButtonClick()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [tabindex]=\"-1\">\r\n <i class=\"ri-calendar-line\"></i>\r\n </button>\r\n </ng-template>\r\n</mona-text-box>\r\n\r\n<ng-template #datePopupTemplate>\r\n <div\r\n [class]=\"pickerPopupClass()\"\r\n [id]=\"popupId\"\r\n class=\"flex flex-col h-68\"\r\n aria-modal=\"true\"\r\n role=\"dialog\"\r\n cdkTrapFocus>\r\n <div [class]=\"headerClass()\">\r\n <mona-button-group\r\n selection=\"single\"\r\n [allowEmpty]=\"false\"\r\n class=\"w-full\"\r\n [disabled]=\"disabled()\"\r\n [size]=\"size()\"\r\n [rounded]=\"rounded()\"\r\n role=\"tablist\">\r\n <button monaButton [selected]=\"activeView() === 'date'\" (click)=\"activeView.set('date')\" role=\"tab\">\r\n Date\r\n </button>\r\n <button monaButton [selected]=\"activeView() === 'time'\" (click)=\"activeView.set('time')\" role=\"tab\">\r\n Time\r\n </button>\r\n </mona-button-group>\r\n </div>\r\n <div class=\"overflow-hidden\">\r\n @if (activeView() === \"date\") {\r\n <div class=\"h-full flex items-center justify-center\" aria-label=\"Calendar\">\r\n <mona-calendar\r\n [disabledDates]=\"disabledDates()\"\r\n [minDate]=\"min()\"\r\n [maxDate]=\"max()\"\r\n [firstDay]=\"firstDay()\"\r\n [weekNumber]=\"weekNumber()\"\r\n [value]=\"navigatedDate()\"\r\n [disabled]=\"disabled()\"\r\n [readonly]=\"readonly()\"\r\n [rounded]=\"rounded()\"\r\n (valueChange)=\"onCalendarValueChange($event)\"\r\n class=\"shadow-none border-none flex-1\">\r\n @if (decadeCellTemplate()) {\r\n <ng-template monaCalendarDecadeCellTemplate let-year>\r\n <ng-container\r\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (monthCellTemplate()) {\r\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (yearCellTemplate()) {\r\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\r\n </ng-template>\r\n }\r\n </mona-calendar>\r\n </div>\r\n }\r\n @if (activeView() === \"time\") {\r\n <div class=\"h-full flex items-center justify-center max-h-64\" aria-label=\"Time picker\">\r\n <mona-time-selector\r\n [value]=\"navigatedDate()\"\r\n (valueChange)=\"onTimeSelectorValueChange($event)\"\r\n [disabled]=\"disabled()\"\r\n [readonly]=\"readonly()\"\r\n [max]=\"timePickerMax()\"\r\n [min]=\"timePickerMin()\"\r\n [footer]=\"false\"\r\n [size]=\"size()\"\r\n [rounded]=\"rounded()\"\r\n [hourStep]=\"hourStep()\"\r\n [minuteStep]=\"minuteStep()\"\r\n [secondStep]=\"secondStep()\"\r\n [hourFormat]=\"hourFormat()\"\r\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\r\n </div>\r\n }\r\n </div>\r\n <div [class]=\"footerClass()\">\r\n <button\r\n monaButton\r\n look=\"primary\"\r\n [disabled]=\"disabled()\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n (click)=\"onSetDateClick()\">\r\n Set\r\n </button>\r\n <button\r\n monaButton\r\n look=\"default\"\r\n [disabled]=\"disabled()\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n (click)=\"onCancelClick()\">\r\n Cancel\r\n </button>\r\n </div>\r\n </div>\r\n</ng-template>\r\n" }]
648
+ }], ctorParameters: () => [], propDecorators: { decadeCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarDecadeCellTemplateDirective), { isSignal: true }] }], monthCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarMonthCellTemplateDirective), { isSignal: true }] }], popupTemplate: [{ type: i0.ViewChild, args: ["datePopupTemplate", { isSignal: true }] }], prefixTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DateInputPrefixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], yearCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarYearCellTemplateDirective), { isSignal: true }] }], close: [{ type: i0.Output, args: ["close"] }], closed: [{ type: i0.Output, args: ["closed"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], firstDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDay", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], hourFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourFormat", required: false }] }], hourStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourStep", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], open: [{ type: i0.Output, args: ["open"] }], opened: [{ type: i0.Output, args: ["opened"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], popupClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupClass", required: false }] }], popupHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupHeight", required: false }] }], popupWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupWidth", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], readonlyInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonlyInput", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], secondStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondStep", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], weekNumber: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekNumber", required: false }] }] } });
649
+
650
+ /*
651
+ * Public API Surface of @nanahoshi/mona-ui/datetime-picker
652
+ */
653
+
654
+ /**
655
+ * Generated bundle index. Do not edit.
656
+ */
657
+
658
+ export { DateTimePickerComponent };
659
+ //# sourceMappingURL=nanahoshi-mona-ui-datetime-picker.mjs.map