@nanahoshi/mona-ui 0.27.2 → 0.29.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 (213) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/locales.md +8 -0
  3. package/docs/api/popup.md +1 -1
  4. package/docs/api/theme.md +2 -2
  5. package/docs/chart.md +14 -0
  6. package/docs/editor.md +2 -0
  7. package/docs/installation.md +147 -15
  8. package/docs/introduction.md +37 -15
  9. package/docs/theming-built-in-themes.md +67 -0
  10. package/docs/theming-custom-colors.md +274 -0
  11. package/docs/theming-custom-themes.md +168 -0
  12. package/docs/theming.md +164 -248
  13. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  14. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  15. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  16. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  17. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  18. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2071 -1573
  19. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  20. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  21. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  22. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  23. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  24. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  25. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  26. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  27. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  28. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  29. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  30. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  31. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  32. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  33. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  34. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  35. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  37. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  38. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  39. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  40. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  41. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  42. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  49. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  50. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  51. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  52. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  53. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  54. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  55. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  56. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  57. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  58. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  59. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  60. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  61. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  62. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  63. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  65. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  66. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  67. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  68. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  70. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +599 -0
  71. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  72. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  73. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  74. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  75. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  76. package/fesm2022/nanahoshi-mona-ui-locales.mjs +61 -77
  77. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  78. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  79. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  80. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  81. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  82. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  83. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  84. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  85. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  86. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  87. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  88. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  89. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  90. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  91. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  92. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  93. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  94. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  95. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  96. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  97. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  98. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  99. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  100. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  101. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  102. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  103. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  104. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  105. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  106. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  107. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  108. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  109. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  110. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  111. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  112. package/llms.txt +7 -3
  113. package/locales/pl-pl/package.json +4 -0
  114. package/locales/pl-pl/pl-pl.messages.json +536 -0
  115. package/package.json +66 -23
  116. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  117. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  118. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  119. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  120. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  121. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  122. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  123. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  124. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  125. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  126. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  127. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  128. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  129. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  130. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  131. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  132. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  133. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  134. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  135. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  136. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  137. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  138. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  139. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  140. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  141. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  142. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  143. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  144. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  145. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  146. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  147. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  148. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  149. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  150. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  151. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  152. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  153. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  154. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  155. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  156. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  157. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  158. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  159. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +540 -0
  168. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  169. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  170. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  171. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  172. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  173. package/types/nanahoshi-mona-ui-locales.d.ts +18 -19
  174. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  175. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  176. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  177. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  178. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  179. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  180. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  181. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  182. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  183. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  184. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  185. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  186. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  187. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  188. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  189. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  190. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  191. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  192. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  193. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  194. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  195. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  196. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  197. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  198. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  199. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  200. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  201. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  202. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  203. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  204. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  205. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  206. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  207. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  208. package/types/nanahoshi-mona-ui.d.ts +1 -2
  209. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  210. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  211. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  212. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  213. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,36 +1,32 @@
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, contentChild, linkedSignal, viewChild, TemplateRef, input, output, booleanAttribute, model, effect, untracked, afterNextRender, forwardRef, Component } from '@angular/core';
5
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
- import { LucideCalendar } from '@lucide/angular';
7
- import { ButtonDirective } from '@nanahoshi/mona-ui/button';
8
- import { CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective, CalendarComponent } from '@nanahoshi/mona-ui/calendar';
9
- import { CalendarService, TimeSelectorService, getLocaleHourFormat, datePopupThemeVariants, DateInputPrefixTemplateDirective, createTypedDateInput } from '@nanahoshi/mona-ui/date-input';
10
- import * as i1 from '@nanahoshi/mona-ui/dropdowns';
11
- import { DropdownService, DROPDOWN_POPUP_INPUT_TOKEN, DropdownPopupHandlerDirective } from '@nanahoshi/mona-ui/dropdowns';
12
- import { injectComponentDirection, MonaI18nService, getLocaleDateTimeInputFormat } from '@nanahoshi/mona-ui/i18n';
13
- import { themeControlSurfaceClasses, createElementControlId, injectEffectiveDisabled } from '@nanahoshi/mona-ui/internal';
14
- import { TextBoxComponent, TextBoxSuffixTemplateDirective, TextBoxPrefixTemplateDirective } from '@nanahoshi/mona-ui/text-box';
15
- import { TimeSelectorComponent } from '@nanahoshi/mona-ui/time-selector';
16
- import { DateTime } from 'luxon';
17
- import { mergeWith } from 'rxjs';
18
- import { twMerge } from 'tailwind-merge';
19
- import { cva } from 'class-variance-authority';
20
-
21
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
22
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
1
+ import { CdkTrapFocus } from "@angular/cdk/a11y";
2
+ import { NgTemplateOutlet } from "@angular/common";
3
+ import * as i0 from "@angular/core";
4
+ import { Component, DestroyRef, ElementRef, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, linkedSignal, model, output, signal, untracked, viewChild } from "@angular/core";
5
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
6
+ import { LucideCalendar } from "@lucide/angular";
7
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
8
+ import { CalendarComponent, CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective } from "@nanahoshi/mona-ui/calendar";
9
+ import { CalendarService, DateInputPrefixTemplateDirective, TimeSelectorService, createTypedDateInput, datePopupThemeVariants, getLocaleHourFormat } from "@nanahoshi/mona-ui/date-input";
10
+ import * as i1 from "@nanahoshi/mona-ui/dropdowns";
11
+ import { DROPDOWN_POPUP_INPUT_TOKEN, DropdownPopupHandlerDirective, DropdownService } from "@nanahoshi/mona-ui/dropdowns";
12
+ import { MonaI18nService, getLocaleDateTimeInputFormat, injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
13
+ import { createElementControlId, injectEffectiveDisabled, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
14
+ import { TextBoxComponent, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective } from "@nanahoshi/mona-ui/text-box";
15
+ import { TimeSelectorComponent } from "@nanahoshi/mona-ui/time-selector";
16
+ import { DateTime } from "luxon";
17
+ import { mergeWith } from "rxjs";
18
+ import { twMerge } from "tailwind-merge";
19
+ import { cva } from "class-variance-authority";
23
20
  const DATETIME_PICKER_DEFAULT_MESSAGES = {
24
- calendar: "Calendar",
25
- cancel: "Cancel",
26
- date: "Date",
27
- dateTimePicker: "Date and time picker",
28
- openDateTimePicker: "Open date and time picker",
29
- set: "Set",
30
- time: "Time",
31
- timePicker: "Time picker"
21
+ calendar: "Calendar",
22
+ cancel: "Cancel",
23
+ date: "Date",
24
+ dateTimePicker: "Date and time picker",
25
+ openDateTimePicker: "Open date and time picker",
26
+ set: "Set",
27
+ time: "Time",
28
+ timePicker: "Time picker"
32
29
  };
33
-
34
30
  const dateTimePickerBaseThemeVariants = cva(`
35
31
  flex items-center
36
32
  ${themeControlSurfaceClasses} text-foreground
@@ -59,30 +55,28 @@ const dateTimePickerBaseThemeVariants = cva(`
59
55
  [&_mona-text-box]:focus-within:ring-0
60
56
  [&_mona-text-box[data-invalid='true']]:ring-0
61
57
  `, {
62
- variants: {
63
- focused: {
64
- true: "border-focus-indicator ring-2 ring-focus-indicator/35",
65
- false: ""
66
- },
67
- rounded: {
68
- full: "rounded-full",
69
- large: "rounded-lg",
70
- medium: "rounded-md",
71
- none: "rounded-none",
72
- small: "rounded-sm"
73
- },
74
- size: {
75
- large: "h-10 text-base",
76
- medium: "h-9 text-sm",
77
- small: "h-8 text-xs"
78
- }
79
- },
80
- compoundVariants: [
81
- {
82
- focused: true,
83
- class: "data-[invalid='true']:border-error data-[invalid='true']:ring-error/35"
84
- }
85
- ]
58
+ variants: {
59
+ focused: {
60
+ true: "border-focus-indicator ring-2 ring-focus-indicator/35",
61
+ false: ""
62
+ },
63
+ rounded: {
64
+ full: "rounded-full",
65
+ large: "rounded-lg",
66
+ medium: "rounded-md",
67
+ none: "rounded-none",
68
+ small: "rounded-sm"
69
+ },
70
+ size: {
71
+ large: "h-10 text-base",
72
+ medium: "h-9 text-sm",
73
+ small: "h-8 text-xs"
74
+ }
75
+ },
76
+ compoundVariants: [{
77
+ focused: true,
78
+ class: "data-[invalid='true']:border-error data-[invalid='true']:ring-error/35"
79
+ }]
86
80
  });
87
81
  const dateTimePickerHeaderThemeVariants = cva(`
88
82
  flex items-center p-2
@@ -97,607 +91,1158 @@ const dateTimePickerFooterThemeVariants = cva(`
97
91
  border-t border-border-subtle
98
92
  [&>[monaButton]]:flex-1
99
93
  `);
100
-
101
- class DateTimePickerComponent {
102
- #calendarService;
103
- #destroyRef;
104
- #direction;
105
- #dropdownService;
106
- #hostElementRef;
107
- #i18n;
108
- #timeSelectorService;
109
- constructor() {
110
- this.#calendarService = inject(CalendarService);
111
- this.#destroyRef = inject(DestroyRef);
112
- this.#direction = injectComponentDirection();
113
- this.#dropdownService = inject(DropdownService);
114
- this.#hostElementRef = inject(ElementRef);
115
- this.#i18n = inject(MonaI18nService);
116
- this.#timeSelectorService = inject(TimeSelectorService);
117
- this.activeView = signal("date", /* @ts-ignore */
118
- ...(ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []));
119
- this.baseClass = computed(() => {
120
- const focused = this.#dropdownService.popupRef() != null;
121
- const rounded = this.rounded();
122
- const size = this.size();
123
- const variantClass = dateTimePickerBaseThemeVariants({ focused, rounded, size });
124
- const userClass = this.userClass();
125
- return twMerge(variantClass, userClass);
126
- }, /* @ts-ignore */
127
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
128
- this.dateTabId = createElementControlId();
129
- this.decadeCellTemplate = contentChild(CalendarDecadeCellTemplateDirective, /* @ts-ignore */
130
- ...(ngDevMode ? [{ debugName: "decadeCellTemplate" }] : /* istanbul ignore next */ []));
131
- this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
132
- this.effectiveFormat = computed(() => {
133
- return (this.format() ??
134
- getLocaleDateTimeInputFormat(this.#i18n.localeId(), {
135
- hourFormat: this.effectiveHourFormat(),
136
- showSeconds: this.showSeconds()
137
- }));
138
- }, /* @ts-ignore */
139
- ...(ngDevMode ? [{ debugName: "effectiveFormat" }] : /* istanbul ignore next */ []));
140
- this.effectiveHourFormat = computed(() => this.hourFormat() ?? getLocaleHourFormat(this.#i18n.localeId()), /* @ts-ignore */
141
- ...(ngDevMode ? [{ debugName: "effectiveHourFormat" }] : /* istanbul ignore next */ []));
142
- this.expanded = computed(() => this.#dropdownService.popupRef() !== null, /* @ts-ignore */
143
- ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
144
- /** Whether the view shown next takes focus: yes after picking a day, no when a tab is chosen. */
145
- this.focusViewOnMount = signal(true, /* @ts-ignore */
146
- ...(ngDevMode ? [{ debugName: "focusViewOnMount" }] : /* istanbul ignore next */ []));
147
- this.footerClass = computed(() => {
148
- return dateTimePickerFooterThemeVariants();
149
- }, /* @ts-ignore */
150
- ...(ngDevMode ? [{ debugName: "footerClass" }] : /* istanbul ignore next */ []));
151
- this.headerClass = computed(() => {
152
- return dateTimePickerHeaderThemeVariants();
153
- }, /* @ts-ignore */
154
- ...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
155
- this.inputAttributes = computed(() => {
156
- return {
157
- "aria-autocomplete": "none",
158
- "aria-controls": this.popupId,
159
- // The binder drops `false`, and a combobox must always say whether it's expanded.
160
- "aria-expanded": this.expanded() ? "true" : "false",
161
- "aria-haspopup": "dialog",
162
- // The text box hides its clear button when read-only, so typing is blocked here instead.
163
- readonly: this.readonly() || this.readonlyInput(),
164
- role: "combobox"
165
- };
166
- }, /* @ts-ignore */
167
- ...(ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []));
168
- this.invalidState = computed(() => this.typedInput.errors().length > 0 ||
169
- (this.touched() && (this.invalid() || (this.required() && !this.value()))), /* @ts-ignore */
170
- ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
171
- this.isRtl = computed(() => this.#direction() === "rtl", /* @ts-ignore */
172
- ...(ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []));
173
- this.messages = this.#i18n.componentMessages("dateTimePicker", DATETIME_PICKER_DEFAULT_MESSAGES);
174
- this.monthCellTemplate = contentChild(CalendarMonthCellTemplateDirective, /* @ts-ignore */
175
- ...(ngDevMode ? [{ debugName: "monthCellTemplate" }] : /* istanbul ignore next */ []));
176
- this.navigatedDate = linkedSignal(() => this.value() ?? new Date(), /* @ts-ignore */
177
- ...(ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []));
178
- this.panelId = createElementControlId();
179
- this.pickerPopupClass = computed(() => {
180
- const rounded = this.rounded();
181
- const size = this.size();
182
- const userClass = this.popupClass();
183
- const variantClass = datePopupThemeVariants({ rounded, size });
184
- return twMerge(variantClass, userClass);
185
- }, /* @ts-ignore */
186
- ...(ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []));
187
- this.popupId = createElementControlId();
188
- this.popupTemplate = viewChild.required("datePopupTemplate", /* @ts-ignore */
189
- ...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
190
- this.prefixTemplate = contentChild(DateInputPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
191
- this.timePickerMax = computed(() => {
192
- const maxDate = this.max();
193
- const navigatedDate = this.navigatedDate();
194
- if (!maxDate) {
195
- return null;
196
- }
197
- const max = DateTime.fromJSDate(maxDate);
198
- const date = DateTime.fromJSDate(navigatedDate);
199
- if (max.year === date.year && max.month === date.month && max.day === date.day) {
200
- return maxDate;
201
- }
202
- return null;
203
- }, /* @ts-ignore */
204
- ...(ngDevMode ? [{ debugName: "timePickerMax" }] : /* istanbul ignore next */ []));
205
- this.timePickerMin = computed(() => {
206
- const minDate = this.min();
207
- const navigatedDate = this.navigatedDate();
208
- if (!minDate) {
209
- return null;
210
- }
211
- const min = DateTime.fromJSDate(minDate);
212
- const date = DateTime.fromJSDate(navigatedDate);
213
- if (min.year === date.year && min.month === date.month && min.day === date.day) {
214
- return minDate;
215
- }
216
- return null;
217
- }, /* @ts-ignore */
218
- ...(ngDevMode ? [{ debugName: "timePickerMin" }] : /* istanbul ignore next */ []));
219
- this.timeTabId = createElementControlId();
220
- this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, /* @ts-ignore */
221
- ...(ngDevMode ? [{ debugName: "yearCellTemplate" }] : /* istanbul ignore next */ []));
222
- /**
223
- * @description Id of an element that describes the input, such as a hint or an error message.
224
- * @default ""
225
- */
226
- this.ariaDescribedBy = input("", { ...(ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {}), alias: "aria-describedby" });
227
- /**
228
- * @description Accessible name of the input. Prefer a visible label, linked through {@link inputId} or
229
- * `aria-labelledby`; the placeholder is not a label.
230
- * @default ""
231
- */
232
- this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
233
- /**
234
- * @description Id of the element that labels the input.
235
- * @default ""
236
- */
237
- this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
238
- /**
239
- * @description Emits when the popup is about to close. This event is preventable.
240
- */
241
- // eslint-disable-next-line @angular-eslint/no-output-native
242
- this.close = output();
243
- /**
244
- * @description Emits after the popup is closed.
245
- */
246
- this.closed = output();
247
- /**
248
- * @description Sets the disabled state of the date time picker.
249
- * @default false
250
- */
251
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
252
- /**
253
- * @description Sets the disabled dates of the date time picker.
254
- * Accepts either an iterable of Date objects or a predicate function. Typing a disabled date is reported as a
255
- * `disabledDate` error instead of setting the value.
256
- */
257
- this.disabledDates = input(/* @ts-ignore */
258
- ...(ngDevMode ? [undefined, { debugName: "disabledDates" }] : /* istanbul ignore next */ []));
259
- /**
260
- * @description Sets the first day of the week. If not specified, derives from the active locale.
261
- * @default null
262
- */
263
- this.firstDay = input(null, /* @ts-ignore */
264
- ...(ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []));
265
- /**
266
- * @description Sets the date format of the date time picker. If not specified, derives from the active locale,
267
- * hourFormat, and showSeconds. Typed text is also accepted with one-digit parts and a two-digit year.
268
- * @default null
269
- */
270
- this.format = input(null, /* @ts-ignore */
271
- ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
272
- /**
273
- * @description Sets the hour format of the date time picker. When null, the active locale's clock is used: 12-hour
274
- * for en-US, 24-hour for de-DE.
275
- * @default null
276
- */
277
- this.hourFormat = input(null, /* @ts-ignore */
278
- ...(ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []));
279
- /**
280
- * @description Sets the hour step of the time picker.
281
- * @default 1
282
- */
283
- this.hourStep = input(1, /* @ts-ignore */
284
- ...(ngDevMode ? [{ debugName: "hourStep" }] : /* istanbul ignore next */ []));
285
- /**
286
- * @description Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the
287
- * date time picker. A unique id is generated when it isn't set.
288
- * @default generated
289
- */
290
- this.inputId = input(createElementControlId(), /* @ts-ignore */
291
- ...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
292
- /**
293
- * @description Marks the date time picker as invalid. When bound to a signal form field via `[formField]`,
294
- * this is written by the `FormField` directive.
295
- * @default false
296
- */
297
- this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
298
- /**
299
- * @description Sets the maximum date of the date time picker. A later typed date is reported as a `maxDate` error.
300
- */
301
- this.max = input(undefined, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: value => (value instanceof Date ? value : undefined) });
302
- /**
303
- * @description Sets the minimum date of the date time picker. An earlier typed date is reported as a `minDate`
304
- * error.
305
- */
306
- this.min = input(undefined, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: value => (value instanceof Date ? value : undefined) });
307
- /**
308
- * @description Sets the minute step of the time picker.
309
- * @default 1
310
- */
311
- this.minuteStep = input(1, /* @ts-ignore */
312
- ...(ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []));
313
- /**
314
- * @description Emits when the popup is about to open. This event is preventable.
315
- */
316
- this.open = output();
317
- /**
318
- * @description Emits after the popup is opened.
319
- */
320
- this.opened = output();
321
- /**
322
- * @description Sets the placeholder of the date time picker.
323
- */
324
- this.placeholder = input("", /* @ts-ignore */
325
- ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
326
- /**
327
- * @description Sets the class of the popup element.
328
- * @default ""
329
- */
330
- this.popupClass = input("", /* @ts-ignore */
331
- ...(ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []));
332
- /**
333
- * @description Sets the height of the popup element. When not set, the popup fits its content.
334
- * @default undefined
335
- */
336
- this.popupHeight = input(/* @ts-ignore */
337
- ...(ngDevMode ? [undefined, { debugName: "popupHeight" }] : /* istanbul ignore next */ []));
338
- /**
339
- * @description Sets the width of the popup element. When not set, the popup is at least as wide as the input.
340
- * @default undefined
341
- */
342
- this.popupWidth = input(/* @ts-ignore */
343
- ...(ngDevMode ? [undefined, { debugName: "popupWidth" }] : /* istanbul ignore next */ []));
344
- /**
345
- * @description Sets the readonly state of the date time picker.
346
- * @default false
347
- */
348
- this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
349
- /**
350
- * @description When true, the input is readonly but the popup button remains enabled.
351
- * @default false
352
- */
353
- this.readonlyInput = input(false, { ...(ngDevMode ? { debugName: "readonlyInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
354
- /**
355
- * @description Sets the required state of the date time picker.
356
- * When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
357
- * @default false
358
- */
359
- this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
360
- /**
361
- * @description Sets the border radius of the date time picker.
362
- */
363
- this.rounded = input("medium", /* @ts-ignore */
364
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
365
- /**
366
- * @description Sets the second step of the time picker.
367
- * @default 1
368
- */
369
- this.secondStep = input(1, /* @ts-ignore */
370
- ...(ngDevMode ? [{ debugName: "secondStep" }] : /* istanbul ignore next */ []));
371
- /**
372
- * @description Sets the visibility of the clear button. Clearing empties the value at once.
373
- * @default false
374
- */
375
- this.showClearButton = input(false, { ...(ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
376
- /**
377
- * @description Sets the visibility of the second selector.
378
- * @default false
379
- */
380
- this.showSeconds = input(false, { ...(ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
381
- /**
382
- * @description Sets the size of the date time picker.
383
- */
384
- this.size = input("medium", /* @ts-ignore */
385
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
386
- /**
387
- * @description Emitted when focus leaves the date time picker and its popup.
388
- * The `FormField` directive listens to this to mark the field as touched.
389
- */
390
- this.touch = output();
391
- /**
392
- * @description Sets the touched state of the date time picker. When bound to a signal form field via `[formField]`,
393
- * this is written by the `FormField` directive.
394
- * @default false
395
- */
396
- this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
397
- /** @description Extra classes for the input's container. */
398
- this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
399
- /**
400
- * @description Two-way bindable current date time value. Typed text is written on Enter and when the input loses
401
- * focus; text that isn't a valid date and time keeps the previous value and marks the field invalid.
402
- * @default null
403
- */
404
- this.value = model(null, /* @ts-ignore */
405
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
406
- /**
407
- * @description Enables the display of week numbers in the calendar.
408
- * @default false
409
- */
410
- this.weekNumber = input(false, { ...(ngDevMode ? { debugName: "weekNumber" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
411
- this.typedInput = createTypedDateInput({
412
- constraints: () => ({
413
- disabledDates: this.disabledDates(),
414
- max: this.max(),
415
- min: this.min(),
416
- unit: "datetime"
417
- }),
418
- format: () => this.effectiveFormat(),
419
- localeId: () => this.#i18n.localeId(),
420
- value: this.value
421
- });
422
- effect(() => {
423
- const popupTemplate = this.popupTemplate();
424
- untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
425
- });
426
- afterNextRender({
427
- read: () => {
428
- this.setPopupKeyboardSubscription();
429
- this.setPopupCloseSubscription();
430
- }
431
- });
432
- }
433
- /**
434
- * Focuses the input and places the caret after the text. Read-only pickers take focus too.
435
- * @param options Options passed to the native `focus()` call, such as `preventScroll`.
436
- */
437
- focus(options) {
438
- const input = this.#hostElementRef.nativeElement.querySelector("input");
439
- if (input) {
440
- input.focus(options);
441
- input.setSelectionRange(input.value.length, input.value.length);
442
- }
443
- }
444
- onCalendarValueChange(date) {
445
- const singleDate = Array.isArray(date) ? null : date;
446
- if (singleDate) {
447
- // The calendar gives midnight; keep the time already chosen.
448
- const current = this.navigatedDate();
449
- const withTime = new Date(singleDate);
450
- withTime.setHours(current.getHours(), current.getMinutes(), current.getSeconds(), 0);
451
- this.navigatedDate.set(this.updateDateIfNotInRange(withTime));
452
- }
453
- this.focusViewOnMount.set(true);
454
- this.activeView.set("time");
455
- }
456
- onCancelClick() {
457
- this.navigatedDate.set(this.value() ?? new Date());
458
- this.closePopup();
459
- }
460
- onDateInputButtonClick() {
461
- if (this.effectiveDisabled() || this.readonly()) {
462
- return;
463
- }
464
- if (this.#dropdownService.popupRef()) {
465
- this.closePopup();
466
- }
467
- else {
468
- this.openPopup();
469
- }
470
- }
471
- onFocusIn(event) {
472
- // The host is focusable only to pass focus on; focus inside it, such as a click in the text, stays put.
473
- if (event.target === this.#hostElementRef.nativeElement) {
474
- this.focus();
475
- }
476
- }
477
- onFocusOut(event) {
478
- // Removing a focused picker from the page fires focusout after it is destroyed.
479
- if (this.#destroyRef.destroyed) {
480
- return;
481
- }
482
- const nextTarget = event.relatedTarget;
483
- if (nextTarget instanceof Node) {
484
- const popupElement = this.#dropdownService.popupRef()?.overlayRef.overlayElement;
485
- if (this.#hostElementRef.nativeElement.contains(nextTarget) || popupElement?.contains(nextTarget)) {
486
- return;
487
- }
488
- }
489
- this.touch.emit();
490
- }
491
- onInputBlur() {
492
- this.typedInput.commit();
493
- }
494
- onKeydown(event) {
495
- if (this.effectiveDisabled() || this.readonly()) {
496
- return;
497
- }
498
- const popupOpen = this.expanded();
499
- if (event.altKey && event.key === "ArrowDown") {
500
- event.preventDefault();
501
- this.openPopup();
502
- }
503
- else if (event.altKey && event.key === "ArrowUp") {
504
- if (popupOpen) {
505
- event.preventDefault();
506
- this.closePopup();
507
- }
508
- }
509
- else if (event.key === "Escape") {
510
- if (popupOpen) {
511
- event.preventDefault();
512
- this.onCancelClick();
513
- }
514
- }
515
- else if (event.altKey && (event.key === "ArrowRight" || event.key === "ArrowLeft")) {
516
- if (popupOpen) {
517
- event.preventDefault();
518
- const towardsTime = (event.key === "ArrowRight") !== this.isRtl();
519
- this.activeView.set(towardsTime ? "time" : "date");
520
- }
521
- }
522
- else if (event.key === "Enter" && event.target instanceof HTMLInputElement) {
523
- // Committed before a surrounding form submits; an IME uses Enter to confirm its text.
524
- if (!event.isComposing && event.keyCode !== 229) {
525
- this.typedInput.commit();
526
- }
527
- }
528
- }
529
- onSetDateClick() {
530
- this.value.set(this.navigatedDate());
531
- this.closePopup();
532
- }
533
- /** Arrow keys, Home and End move between the Date and Time tabs, as in the APG tabs pattern. */
534
- onTabKeydown(event) {
535
- if (event.altKey) {
536
- return;
537
- }
538
- const forward = this.isRtl() ? "ArrowLeft" : "ArrowRight";
539
- const backward = this.isRtl() ? "ArrowRight" : "ArrowLeft";
540
- let view = null;
541
- if (event.key === "Home" || event.key === backward) {
542
- view = "date";
543
- }
544
- else if (event.key === "End" || event.key === forward) {
545
- view = "time";
546
- }
547
- if (!view) {
548
- return;
549
- }
550
- event.preventDefault();
551
- this.selectTab(view);
552
- const tabId = view === "date" ? this.dateTabId : this.timeTabId;
553
- const tablist = event.currentTarget;
554
- tablist.querySelector(`[id="${tabId}"]`)?.focus();
555
- }
556
- onTimeSelectorValueChange(date) {
557
- if (date) {
558
- const inRangeDate = this.updateDateIfNotInRange(date);
559
- this.navigatedDate.set(inRangeDate);
560
- }
561
- }
562
- /** Shows a view from its tab; focus stays on the tab, as in the APG tabs pattern. */
563
- selectTab(view) {
564
- this.focusViewOnMount.set(false);
565
- this.activeView.set(view);
566
- }
567
- closePopup() {
568
- this.#dropdownService.popupRef()?.close();
569
- }
570
- openPopup() {
571
- if (!this.#dropdownService.popupRef()) {
572
- this.#dropdownService.triggerPopupOpen$.next({
573
- minWidth: this.popupWidth() || this.#hostElementRef.nativeElement.getBoundingClientRect().width,
574
- width: this.popupWidth() || "fit-content",
575
- height: this.popupHeight() || "fit-content",
576
- closeOnScroll: false,
577
- withScrollTracking: true
578
- });
579
- }
580
- }
581
- setPopupCloseSubscription() {
582
- this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
583
- if (this.#dropdownService.focusCanReturn()) {
584
- this.focus();
585
- }
586
- else if (!this.#destroyRef.destroyed) {
587
- // Focus left from inside the popup, which the host's focusout doesn't see.
588
- this.touch.emit();
589
- }
590
- this.activeView.set("date");
591
- this.focusViewOnMount.set(true);
592
- this.navigatedDate.set(this.value() ?? new Date());
593
- });
594
- }
595
- setPopupKeyboardSubscription() {
596
- this.#calendarService.keydown$
597
- .pipe(mergeWith(this.#timeSelectorService.keydown$), takeUntilDestroyed(this.#destroyRef))
598
- .subscribe(e => {
599
- const keyboardEvent = e.originalEvent;
600
- if (!keyboardEvent) {
601
- return;
602
- }
603
- if (keyboardEvent.key === "Escape") {
604
- keyboardEvent.preventDefault();
605
- this.onCancelClick();
606
- }
607
- else if (keyboardEvent.altKey && keyboardEvent.key === "ArrowUp") {
608
- keyboardEvent.preventDefault();
609
- this.closePopup();
610
- }
611
- else if (keyboardEvent.altKey && keyboardEvent.key === "ArrowRight") {
612
- keyboardEvent.preventDefault();
613
- this.activeView.set(this.isRtl() ? "date" : "time");
614
- }
615
- else if (keyboardEvent.altKey && keyboardEvent.key === "ArrowLeft") {
616
- keyboardEvent.preventDefault();
617
- this.activeView.set(this.isRtl() ? "time" : "date");
618
- }
619
- else if (keyboardEvent.key === "Enter" && this.activeView() === "time") {
620
- const target = keyboardEvent.target;
621
- if (target.tagName === "BUTTON" || target.closest("button")) {
622
- return;
623
- }
624
- keyboardEvent.preventDefault();
625
- this.onSetDateClick();
626
- }
627
- });
628
- }
629
- updateDateIfNotInRange(date) {
630
- const maxDate = this.max();
631
- const minDate = this.min();
632
- if (minDate && date < minDate) {
633
- return minDate;
634
- }
635
- if (maxDate && date > maxDate) {
636
- return maxDate;
637
- }
638
- return date;
639
- }
640
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DateTimePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
641
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: DateTimePickerComponent, isStandalone: true, selector: "mona-datetime-picker", inputs: { ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, 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 }, inputId: { classPropertyName: "inputId", publicName: "inputId", 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: { "focusin": "onFocusIn($event)", "focusout": "onFocusOut($event)", "keydown": "onKeydown($event)" }, properties: { "attr.aria-describedby": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.tabindex": "effectiveDisabled() ? null : -1", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.data-disabled": "effectiveDisabled() || null", "attr.data-expanded": "expanded()", "attr.data-invalid": "invalidState() || null", "attr.data-readonly": "readonly() || null", "class": "baseClass()" } }, providers: [
642
- CalendarService,
643
- DropdownService,
644
- TimeSelectorService,
645
- {
646
- provide: DROPDOWN_POPUP_INPUT_TOKEN,
647
- useExisting: forwardRef(() => DateTimePickerComponent),
648
- multi: false
649
- }
650
- ], 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\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [clearButton]=\"showClearButton()\"\n [disabled]=\"effectiveDisabled()\"\n [inputAttributes]=\"inputAttributes()\"\n [inputId]=\"inputId()\"\n [invalid]=\"invalidState()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\"\n [value]=\"typedInput.text()\">\n @if (prefixTemplate()) {\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </ng-template>\n }\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openDateTimePicker\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n (click)=\"onDateInputButtonClick()\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #datePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n class=\"flex h-68 flex-col\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().dateTimePicker\"\n cdkTrapFocus>\n <div [class]=\"headerClass()\">\n <div class=\"flex w-full gap-1\" role=\"tablist\" (keydown)=\"onTabKeydown($event)\">\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"dateTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'date'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'date'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'date' ? 0 : -1\"\n (click)=\"selectTab('date')\">\n {{ messages().date }}\n </button>\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"timeTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'time'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'time'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'time' ? 0 : -1\"\n (click)=\"selectTab('time')\">\n {{ messages().time }}\n </button>\n </div>\n </div>\n <div\n class=\"overflow-hidden\"\n role=\"tabpanel\"\n [id]=\"panelId\"\n [attr.aria-labelledby]=\"activeView() === 'date' ? dateTabId : timeTabId\">\n @if (activeView() === \"date\") {\n <div class=\"flex h-full items-center justify-center\">\n <mona-calendar\n [focusOnMount]=\"focusViewOnMount()\"\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [firstDay]=\"firstDay()\"\n [weekNumber]=\"weekNumber()\"\n [value]=\"navigatedDate()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n (valueChange)=\"onCalendarValueChange($event)\"\n class=\"flex-1 border-none shadow-none\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n }\n @if (activeView() === \"time\") {\n <div class=\"flex h-full max-h-64 items-center justify-center\">\n <mona-time-selector\n [focusOnMount]=\"focusViewOnMount()\"\n [value]=\"navigatedDate()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [max]=\"timePickerMax()\"\n [min]=\"timePickerMin()\"\n [footer]=\"false\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [hourFormat]=\"effectiveHourFormat()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n }\n </div>\n <div [class]=\"footerClass()\">\n <button\n monaButton\n look=\"primary\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onSetDateClick()\">\n {{ messages().set }}\n </button>\n <button\n monaButton\n look=\"default\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onCancelClick()\">\n {{ messages().cancel }}\n </button>\n </div>\n </div>\n</ng-template>\n", dependencies: [{ kind: "component", type: LucideCalendar, selector: "svg[lucideCalendar]" }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class", "value"], outputs: ["lookChange", "selectedChange"] }, { kind: "component", type: CalendarComponent, selector: "mona-calendar", inputs: ["disabled", "disabledDates", "firstDay", "focusOnMount", "invalid", "maxDate", "minDate", "readonly", "required", "rounded", "selection", "touched", "class", "value", "weekNumber"], outputs: ["touch", "valueChange"] }, { kind: "component", type: TimeSelectorComponent, selector: "mona-time-selector", inputs: ["aria-label", "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: ["aria-describedby", "aria-label", "aria-labelledby", "clearButton", "disabled", "inputAttributes", "inputClass", "inputId", "inputStyle", "invalid", "maxLength", "minLength", "name", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "ng-template[monaTextBoxSuffixTemplate]" }, { 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]" }] }); }
651
- }
652
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DateTimePickerComponent, decorators: [{
653
- type: Component,
654
- args: [{ selector: "mona-datetime-picker", providers: [
655
- CalendarService,
656
- DropdownService,
657
- TimeSelectorService,
658
- {
659
- provide: DROPDOWN_POPUP_INPUT_TOKEN,
660
- useExisting: forwardRef(() => DateTimePickerComponent),
661
- multi: false
662
- }
663
- ], imports: [
664
- LucideCalendar,
665
- ButtonDirective,
666
- CalendarComponent,
667
- TimeSelectorComponent,
668
- TextBoxComponent,
669
- TextBoxSuffixTemplateDirective,
670
- CdkTrapFocus,
671
- CalendarDecadeCellTemplateDirective,
672
- CalendarMonthCellTemplateDirective,
673
- CalendarYearCellTemplateDirective,
674
- NgTemplateOutlet,
675
- TextBoxPrefixTemplateDirective
676
- ], hostDirectives: [DropdownPopupHandlerDirective], host: {
677
- // The ARIA inputs below are applied to the inner input, so the host must not keep the static attributes.
678
- "[attr.aria-describedby]": "null",
679
- "[attr.aria-label]": "null",
680
- "[attr.aria-labelledby]": "null",
681
- "[attr.tabindex]": "effectiveDisabled() ? null : -1",
682
- "[attr.aria-invalid]": "invalidState() ? 'true' : null",
683
- "[attr.data-disabled]": "effectiveDisabled() || null",
684
- "[attr.data-expanded]": "expanded()",
685
- "[attr.data-invalid]": "invalidState() || null",
686
- "[attr.data-readonly]": "readonly() || null",
687
- "[class]": "baseClass()",
688
- "(focusin)": "onFocusIn($event)",
689
- "(focusout)": "onFocusOut($event)",
690
- "(keydown)": "onKeydown($event)"
691
- }, template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [clearButton]=\"showClearButton()\"\n [disabled]=\"effectiveDisabled()\"\n [inputAttributes]=\"inputAttributes()\"\n [inputId]=\"inputId()\"\n [invalid]=\"invalidState()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\"\n [value]=\"typedInput.text()\">\n @if (prefixTemplate()) {\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </ng-template>\n }\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openDateTimePicker\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n (click)=\"onDateInputButtonClick()\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #datePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n class=\"flex h-68 flex-col\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().dateTimePicker\"\n cdkTrapFocus>\n <div [class]=\"headerClass()\">\n <div class=\"flex w-full gap-1\" role=\"tablist\" (keydown)=\"onTabKeydown($event)\">\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"dateTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'date'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'date'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'date' ? 0 : -1\"\n (click)=\"selectTab('date')\">\n {{ messages().date }}\n </button>\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"timeTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'time'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'time'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'time' ? 0 : -1\"\n (click)=\"selectTab('time')\">\n {{ messages().time }}\n </button>\n </div>\n </div>\n <div\n class=\"overflow-hidden\"\n role=\"tabpanel\"\n [id]=\"panelId\"\n [attr.aria-labelledby]=\"activeView() === 'date' ? dateTabId : timeTabId\">\n @if (activeView() === \"date\") {\n <div class=\"flex h-full items-center justify-center\">\n <mona-calendar\n [focusOnMount]=\"focusViewOnMount()\"\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [firstDay]=\"firstDay()\"\n [weekNumber]=\"weekNumber()\"\n [value]=\"navigatedDate()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n (valueChange)=\"onCalendarValueChange($event)\"\n class=\"flex-1 border-none shadow-none\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n }\n @if (activeView() === \"time\") {\n <div class=\"flex h-full max-h-64 items-center justify-center\">\n <mona-time-selector\n [focusOnMount]=\"focusViewOnMount()\"\n [value]=\"navigatedDate()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [max]=\"timePickerMax()\"\n [min]=\"timePickerMin()\"\n [footer]=\"false\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [hourFormat]=\"effectiveHourFormat()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n }\n </div>\n <div [class]=\"footerClass()\">\n <button\n monaButton\n look=\"primary\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onSetDateClick()\">\n {{ messages().set }}\n </button>\n <button\n monaButton\n look=\"default\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onCancelClick()\">\n {{ messages().cancel }}\n </button>\n </div>\n </div>\n</ng-template>\n" }]
692
- }], 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 }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], 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 }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", 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 }] }] } });
693
-
694
- /*
695
- * Public API Surface of @nanahoshi/mona-ui/datetime-picker
696
- */
697
-
698
- /**
699
- * Generated bundle index. Do not edit.
700
- */
701
-
94
+ var DateTimePickerComponent = class DateTimePickerComponent {
95
+ #calendarService;
96
+ #destroyRef;
97
+ #direction;
98
+ #dropdownService;
99
+ #hostElementRef;
100
+ #i18n;
101
+ #timeSelectorService;
102
+ constructor() {
103
+ this.#calendarService = inject(CalendarService);
104
+ this.#destroyRef = inject(DestroyRef);
105
+ this.#direction = injectComponentDirection();
106
+ this.#dropdownService = inject(DropdownService);
107
+ this.#hostElementRef = inject(ElementRef);
108
+ this.#i18n = inject(MonaI18nService);
109
+ this.#timeSelectorService = inject(TimeSelectorService);
110
+ this.activeView = signal("date", ...ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []);
111
+ this.baseClass = computed(() => {
112
+ const focused = this.#dropdownService.popupRef() != null;
113
+ const rounded = this.rounded();
114
+ const size = this.size();
115
+ const variantClass = dateTimePickerBaseThemeVariants({
116
+ focused,
117
+ rounded,
118
+ size
119
+ });
120
+ const userClass = this.userClass();
121
+ return twMerge(variantClass, userClass);
122
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
123
+ this.dateTabId = createElementControlId();
124
+ this.decadeCellTemplate = contentChild(CalendarDecadeCellTemplateDirective, ...ngDevMode ? [{ debugName: "decadeCellTemplate" }] : /* istanbul ignore next */ []);
125
+ this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
126
+ this.effectiveFormat = computed(() => {
127
+ return this.format() ?? getLocaleDateTimeInputFormat(this.#i18n.localeId(), {
128
+ hourFormat: this.effectiveHourFormat(),
129
+ showSeconds: this.showSeconds()
130
+ });
131
+ }, ...ngDevMode ? [{ debugName: "effectiveFormat" }] : /* istanbul ignore next */ []);
132
+ this.effectiveHourFormat = computed(() => this.hourFormat() ?? getLocaleHourFormat(this.#i18n.localeId()), ...ngDevMode ? [{ debugName: "effectiveHourFormat" }] : /* istanbul ignore next */ []);
133
+ this.expanded = computed(() => this.#dropdownService.popupRef() !== null, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
134
+ this.focusViewOnMount = signal(true, ...ngDevMode ? [{ debugName: "focusViewOnMount" }] : /* istanbul ignore next */ []);
135
+ this.footerClass = computed(() => {
136
+ return dateTimePickerFooterThemeVariants();
137
+ }, ...ngDevMode ? [{ debugName: "footerClass" }] : /* istanbul ignore next */ []);
138
+ this.headerClass = computed(() => {
139
+ return dateTimePickerHeaderThemeVariants();
140
+ }, ...ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []);
141
+ this.inputAttributes = computed(() => {
142
+ return {
143
+ "aria-autocomplete": "none",
144
+ "aria-controls": this.popupId,
145
+ "aria-expanded": this.expanded() ? "true" : "false",
146
+ "aria-haspopup": "dialog",
147
+ readonly: this.readonly() || this.readonlyInput(),
148
+ role: "combobox"
149
+ };
150
+ }, ...ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []);
151
+ this.invalidState = computed(() => this.typedInput.errors().length > 0 || this.touched() && (this.invalid() || this.required() && !this.value()), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
152
+ this.isRtl = computed(() => this.#direction() === "rtl", ...ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []);
153
+ this.messages = this.#i18n.componentMessages("dateTimePicker", DATETIME_PICKER_DEFAULT_MESSAGES);
154
+ this.monthCellTemplate = contentChild(CalendarMonthCellTemplateDirective, ...ngDevMode ? [{ debugName: "monthCellTemplate" }] : /* istanbul ignore next */ []);
155
+ this.navigatedDate = linkedSignal(() => this.value() ?? /* @__PURE__ */ new Date(), ...ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []);
156
+ this.panelId = createElementControlId();
157
+ this.pickerPopupClass = computed(() => {
158
+ const rounded = this.rounded();
159
+ const size = this.size();
160
+ const userClass = this.popupClass();
161
+ const variantClass = datePopupThemeVariants({
162
+ rounded,
163
+ size
164
+ });
165
+ return twMerge(variantClass, userClass);
166
+ }, ...ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []);
167
+ this.popupId = createElementControlId();
168
+ this.popupTemplate = viewChild.required("datePopupTemplate", ...ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []);
169
+ this.prefixTemplate = contentChild(DateInputPrefixTemplateDirective, {
170
+ ...ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {},
171
+ read: TemplateRef
172
+ });
173
+ this.timePickerMax = computed(() => {
174
+ const maxDate = this.max();
175
+ const navigatedDate = this.navigatedDate();
176
+ if (!maxDate) return null;
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) return maxDate;
180
+ return null;
181
+ }, ...ngDevMode ? [{ debugName: "timePickerMax" }] : /* istanbul ignore next */ []);
182
+ this.timePickerMin = computed(() => {
183
+ const minDate = this.min();
184
+ const navigatedDate = this.navigatedDate();
185
+ if (!minDate) return null;
186
+ const min = DateTime.fromJSDate(minDate);
187
+ const date = DateTime.fromJSDate(navigatedDate);
188
+ if (min.year === date.year && min.month === date.month && min.day === date.day) return minDate;
189
+ return null;
190
+ }, ...ngDevMode ? [{ debugName: "timePickerMin" }] : /* istanbul ignore next */ []);
191
+ this.timeTabId = createElementControlId();
192
+ this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, ...ngDevMode ? [{ debugName: "yearCellTemplate" }] : /* istanbul ignore next */ []);
193
+ this.ariaDescribedBy = input("", {
194
+ ...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
195
+ alias: "aria-describedby"
196
+ });
197
+ this.ariaLabel = input("", {
198
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
199
+ alias: "aria-label"
200
+ });
201
+ this.ariaLabelledBy = input("", {
202
+ ...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
203
+ alias: "aria-labelledby"
204
+ });
205
+ this.close = output();
206
+ this.closed = output();
207
+ this.disabled = input(false, {
208
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
209
+ transform: booleanAttribute
210
+ });
211
+ this.disabledDates = input(...ngDevMode ? [void 0, { debugName: "disabledDates" }] : /* istanbul ignore next */ []);
212
+ this.firstDay = input(null, ...ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []);
213
+ this.format = input(null, ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
214
+ this.hourFormat = input(null, ...ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []);
215
+ this.hourStep = input(1, ...ngDevMode ? [{ debugName: "hourStep" }] : /* istanbul ignore next */ []);
216
+ this.inputId = input(createElementControlId(), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
217
+ this.invalid = input(false, {
218
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
219
+ transform: booleanAttribute
220
+ });
221
+ this.max = input(void 0, {
222
+ ...ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {},
223
+ transform: (value) => value instanceof Date ? value : void 0
224
+ });
225
+ this.min = input(void 0, {
226
+ ...ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {},
227
+ transform: (value) => value instanceof Date ? value : void 0
228
+ });
229
+ this.minuteStep = input(1, ...ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []);
230
+ this.open = output();
231
+ this.opened = output();
232
+ this.placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
233
+ this.popupClass = input("", ...ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []);
234
+ this.popupHeight = input(...ngDevMode ? [void 0, { debugName: "popupHeight" }] : /* istanbul ignore next */ []);
235
+ this.popupWidth = input(...ngDevMode ? [void 0, { debugName: "popupWidth" }] : /* istanbul ignore next */ []);
236
+ this.readonly = input(false, {
237
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
238
+ transform: booleanAttribute
239
+ });
240
+ this.readonlyInput = input(false, {
241
+ ...ngDevMode ? { debugName: "readonlyInput" } : /* istanbul ignore next */ {},
242
+ transform: booleanAttribute
243
+ });
244
+ this.required = input(false, {
245
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
246
+ transform: booleanAttribute
247
+ });
248
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
249
+ this.secondStep = input(1, ...ngDevMode ? [{ debugName: "secondStep" }] : /* istanbul ignore next */ []);
250
+ this.showClearButton = input(false, {
251
+ ...ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {},
252
+ transform: booleanAttribute
253
+ });
254
+ this.showSeconds = input(false, {
255
+ ...ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {},
256
+ transform: booleanAttribute
257
+ });
258
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
259
+ this.touch = output();
260
+ this.touched = input(false, {
261
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
262
+ transform: booleanAttribute
263
+ });
264
+ this.userClass = input("", {
265
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
266
+ alias: "class"
267
+ });
268
+ this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
269
+ this.weekNumber = input(false, {
270
+ ...ngDevMode ? { debugName: "weekNumber" } : /* istanbul ignore next */ {},
271
+ transform: booleanAttribute
272
+ });
273
+ this.typedInput = createTypedDateInput({
274
+ constraints: () => ({
275
+ disabledDates: this.disabledDates(),
276
+ max: this.max(),
277
+ min: this.min(),
278
+ unit: "datetime"
279
+ }),
280
+ format: () => this.effectiveFormat(),
281
+ localeId: () => this.#i18n.localeId(),
282
+ value: this.value
283
+ });
284
+ effect(() => {
285
+ const popupTemplate = this.popupTemplate();
286
+ untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
287
+ });
288
+ afterNextRender({ read: () => {
289
+ this.setPopupKeyboardSubscription();
290
+ this.setPopupCloseSubscription();
291
+ } });
292
+ }
293
+ focus(options) {
294
+ const input = this.#hostElementRef.nativeElement.querySelector("input");
295
+ if (input) {
296
+ input.focus(options);
297
+ input.setSelectionRange(input.value.length, input.value.length);
298
+ }
299
+ }
300
+ onCalendarValueChange(date) {
301
+ const singleDate = Array.isArray(date) ? null : date;
302
+ if (singleDate) {
303
+ const current = this.navigatedDate();
304
+ const withTime = new Date(singleDate);
305
+ withTime.setHours(current.getHours(), current.getMinutes(), current.getSeconds(), 0);
306
+ this.navigatedDate.set(this.updateDateIfNotInRange(withTime));
307
+ }
308
+ this.focusViewOnMount.set(true);
309
+ this.activeView.set("time");
310
+ }
311
+ onCancelClick() {
312
+ this.navigatedDate.set(this.value() ?? /* @__PURE__ */ new Date());
313
+ this.closePopup();
314
+ }
315
+ onDateInputButtonClick() {
316
+ if (this.effectiveDisabled() || this.readonly()) return;
317
+ if (this.#dropdownService.popupRef()) this.closePopup();
318
+ else this.openPopup();
319
+ }
320
+ onFocusIn(event) {
321
+ if (event.target === this.#hostElementRef.nativeElement) this.focus();
322
+ }
323
+ onFocusOut(event) {
324
+ if (this.#destroyRef.destroyed) return;
325
+ const nextTarget = event.relatedTarget;
326
+ if (nextTarget instanceof Node) {
327
+ const popupElement = this.#dropdownService.popupRef()?.overlayRef.overlayElement;
328
+ if (this.#hostElementRef.nativeElement.contains(nextTarget) || popupElement?.contains(nextTarget)) return;
329
+ }
330
+ this.touch.emit();
331
+ }
332
+ onInputBlur() {
333
+ this.typedInput.commit();
334
+ }
335
+ onKeydown(event) {
336
+ if (this.effectiveDisabled() || this.readonly()) return;
337
+ const popupOpen = this.expanded();
338
+ if (event.altKey && event.key === "ArrowDown") {
339
+ event.preventDefault();
340
+ this.openPopup();
341
+ } else if (event.altKey && event.key === "ArrowUp") {
342
+ if (popupOpen) {
343
+ event.preventDefault();
344
+ this.closePopup();
345
+ }
346
+ } else if (event.key === "Escape") {
347
+ if (popupOpen) {
348
+ event.preventDefault();
349
+ this.onCancelClick();
350
+ }
351
+ } else if (event.altKey && (event.key === "ArrowRight" || event.key === "ArrowLeft")) {
352
+ if (popupOpen) {
353
+ event.preventDefault();
354
+ const towardsTime = event.key === "ArrowRight" !== this.isRtl();
355
+ this.activeView.set(towardsTime ? "time" : "date");
356
+ }
357
+ } else if (event.key === "Enter" && event.target instanceof HTMLInputElement) {
358
+ if (!event.isComposing && event.keyCode !== 229) this.typedInput.commit();
359
+ }
360
+ }
361
+ onSetDateClick() {
362
+ this.value.set(this.navigatedDate());
363
+ this.closePopup();
364
+ }
365
+ onTabKeydown(event) {
366
+ if (event.altKey) return;
367
+ const forward = this.isRtl() ? "ArrowLeft" : "ArrowRight";
368
+ const backward = this.isRtl() ? "ArrowRight" : "ArrowLeft";
369
+ let view = null;
370
+ if (event.key === "Home" || event.key === backward) view = "date";
371
+ else if (event.key === "End" || event.key === forward) view = "time";
372
+ if (!view) return;
373
+ event.preventDefault();
374
+ this.selectTab(view);
375
+ const tabId = view === "date" ? this.dateTabId : this.timeTabId;
376
+ event.currentTarget.querySelector(`[id="${tabId}"]`)?.focus();
377
+ }
378
+ onTimeSelectorValueChange(date) {
379
+ if (date) {
380
+ const inRangeDate = this.updateDateIfNotInRange(date);
381
+ this.navigatedDate.set(inRangeDate);
382
+ }
383
+ }
384
+ selectTab(view) {
385
+ this.focusViewOnMount.set(false);
386
+ this.activeView.set(view);
387
+ }
388
+ closePopup() {
389
+ this.#dropdownService.popupRef()?.close();
390
+ }
391
+ openPopup() {
392
+ if (!this.#dropdownService.popupRef()) this.#dropdownService.triggerPopupOpen$.next({
393
+ minWidth: this.popupWidth() || this.#hostElementRef.nativeElement.getBoundingClientRect().width,
394
+ width: this.popupWidth() || "fit-content",
395
+ height: this.popupHeight() || "fit-content",
396
+ closeOnScroll: false,
397
+ withScrollTracking: true
398
+ });
399
+ }
400
+ setPopupCloseSubscription() {
401
+ this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
402
+ if (this.#dropdownService.focusCanReturn()) this.focus();
403
+ else if (!this.#destroyRef.destroyed) this.touch.emit();
404
+ this.activeView.set("date");
405
+ this.focusViewOnMount.set(true);
406
+ this.navigatedDate.set(this.value() ?? /* @__PURE__ */ new Date());
407
+ });
408
+ }
409
+ setPopupKeyboardSubscription() {
410
+ this.#calendarService.keydown$.pipe(mergeWith(this.#timeSelectorService.keydown$), takeUntilDestroyed(this.#destroyRef)).subscribe((e) => {
411
+ const keyboardEvent = e.originalEvent;
412
+ if (!keyboardEvent) return;
413
+ if (keyboardEvent.key === "Escape") {
414
+ keyboardEvent.preventDefault();
415
+ this.onCancelClick();
416
+ } else if (keyboardEvent.altKey && keyboardEvent.key === "ArrowUp") {
417
+ keyboardEvent.preventDefault();
418
+ this.closePopup();
419
+ } else if (keyboardEvent.altKey && keyboardEvent.key === "ArrowRight") {
420
+ keyboardEvent.preventDefault();
421
+ this.activeView.set(this.isRtl() ? "date" : "time");
422
+ } else if (keyboardEvent.altKey && keyboardEvent.key === "ArrowLeft") {
423
+ keyboardEvent.preventDefault();
424
+ this.activeView.set(this.isRtl() ? "time" : "date");
425
+ } else if (keyboardEvent.key === "Enter" && this.activeView() === "time") {
426
+ const target = keyboardEvent.target;
427
+ if (target.tagName === "BUTTON" || target.closest("button")) return;
428
+ keyboardEvent.preventDefault();
429
+ this.onSetDateClick();
430
+ }
431
+ });
432
+ }
433
+ updateDateIfNotInRange(date) {
434
+ const maxDate = this.max();
435
+ const minDate = this.min();
436
+ if (minDate && date < minDate) return minDate;
437
+ if (maxDate && date > maxDate) return maxDate;
438
+ return date;
439
+ }
440
+ static {
441
+ this.ɵfac = i0.ɵɵngDeclareFactory({
442
+ minVersion: "12.0.0",
443
+ version: "22.2.6",
444
+ ngImport: i0,
445
+ type: DateTimePickerComponent,
446
+ deps: [],
447
+ target: i0.ɵɵFactoryTarget.Component
448
+ });
449
+ }
450
+ static {
451
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
452
+ minVersion: "17.0.0",
453
+ version: "22.2.6",
454
+ type: DateTimePickerComponent,
455
+ isStandalone: true,
456
+ selector: "mona-datetime-picker",
457
+ inputs: {
458
+ ariaDescribedBy: {
459
+ classPropertyName: "ariaDescribedBy",
460
+ publicName: "aria-describedby",
461
+ isSignal: true,
462
+ isRequired: false,
463
+ transformFunction: null
464
+ },
465
+ ariaLabel: {
466
+ classPropertyName: "ariaLabel",
467
+ publicName: "aria-label",
468
+ isSignal: true,
469
+ isRequired: false,
470
+ transformFunction: null
471
+ },
472
+ ariaLabelledBy: {
473
+ classPropertyName: "ariaLabelledBy",
474
+ publicName: "aria-labelledby",
475
+ isSignal: true,
476
+ isRequired: false,
477
+ transformFunction: null
478
+ },
479
+ disabled: {
480
+ classPropertyName: "disabled",
481
+ publicName: "disabled",
482
+ isSignal: true,
483
+ isRequired: false,
484
+ transformFunction: null
485
+ },
486
+ disabledDates: {
487
+ classPropertyName: "disabledDates",
488
+ publicName: "disabledDates",
489
+ isSignal: true,
490
+ isRequired: false,
491
+ transformFunction: null
492
+ },
493
+ firstDay: {
494
+ classPropertyName: "firstDay",
495
+ publicName: "firstDay",
496
+ isSignal: true,
497
+ isRequired: false,
498
+ transformFunction: null
499
+ },
500
+ format: {
501
+ classPropertyName: "format",
502
+ publicName: "format",
503
+ isSignal: true,
504
+ isRequired: false,
505
+ transformFunction: null
506
+ },
507
+ hourFormat: {
508
+ classPropertyName: "hourFormat",
509
+ publicName: "hourFormat",
510
+ isSignal: true,
511
+ isRequired: false,
512
+ transformFunction: null
513
+ },
514
+ hourStep: {
515
+ classPropertyName: "hourStep",
516
+ publicName: "hourStep",
517
+ isSignal: true,
518
+ isRequired: false,
519
+ transformFunction: null
520
+ },
521
+ inputId: {
522
+ classPropertyName: "inputId",
523
+ publicName: "inputId",
524
+ isSignal: true,
525
+ isRequired: false,
526
+ transformFunction: null
527
+ },
528
+ invalid: {
529
+ classPropertyName: "invalid",
530
+ publicName: "invalid",
531
+ isSignal: true,
532
+ isRequired: false,
533
+ transformFunction: null
534
+ },
535
+ max: {
536
+ classPropertyName: "max",
537
+ publicName: "max",
538
+ isSignal: true,
539
+ isRequired: false,
540
+ transformFunction: null
541
+ },
542
+ min: {
543
+ classPropertyName: "min",
544
+ publicName: "min",
545
+ isSignal: true,
546
+ isRequired: false,
547
+ transformFunction: null
548
+ },
549
+ minuteStep: {
550
+ classPropertyName: "minuteStep",
551
+ publicName: "minuteStep",
552
+ isSignal: true,
553
+ isRequired: false,
554
+ transformFunction: null
555
+ },
556
+ placeholder: {
557
+ classPropertyName: "placeholder",
558
+ publicName: "placeholder",
559
+ isSignal: true,
560
+ isRequired: false,
561
+ transformFunction: null
562
+ },
563
+ popupClass: {
564
+ classPropertyName: "popupClass",
565
+ publicName: "popupClass",
566
+ isSignal: true,
567
+ isRequired: false,
568
+ transformFunction: null
569
+ },
570
+ popupHeight: {
571
+ classPropertyName: "popupHeight",
572
+ publicName: "popupHeight",
573
+ isSignal: true,
574
+ isRequired: false,
575
+ transformFunction: null
576
+ },
577
+ popupWidth: {
578
+ classPropertyName: "popupWidth",
579
+ publicName: "popupWidth",
580
+ isSignal: true,
581
+ isRequired: false,
582
+ transformFunction: null
583
+ },
584
+ readonly: {
585
+ classPropertyName: "readonly",
586
+ publicName: "readonly",
587
+ isSignal: true,
588
+ isRequired: false,
589
+ transformFunction: null
590
+ },
591
+ readonlyInput: {
592
+ classPropertyName: "readonlyInput",
593
+ publicName: "readonlyInput",
594
+ isSignal: true,
595
+ isRequired: false,
596
+ transformFunction: null
597
+ },
598
+ required: {
599
+ classPropertyName: "required",
600
+ publicName: "required",
601
+ isSignal: true,
602
+ isRequired: false,
603
+ transformFunction: null
604
+ },
605
+ rounded: {
606
+ classPropertyName: "rounded",
607
+ publicName: "rounded",
608
+ isSignal: true,
609
+ isRequired: false,
610
+ transformFunction: null
611
+ },
612
+ secondStep: {
613
+ classPropertyName: "secondStep",
614
+ publicName: "secondStep",
615
+ isSignal: true,
616
+ isRequired: false,
617
+ transformFunction: null
618
+ },
619
+ showClearButton: {
620
+ classPropertyName: "showClearButton",
621
+ publicName: "showClearButton",
622
+ isSignal: true,
623
+ isRequired: false,
624
+ transformFunction: null
625
+ },
626
+ showSeconds: {
627
+ classPropertyName: "showSeconds",
628
+ publicName: "showSeconds",
629
+ isSignal: true,
630
+ isRequired: false,
631
+ transformFunction: null
632
+ },
633
+ size: {
634
+ classPropertyName: "size",
635
+ publicName: "size",
636
+ isSignal: true,
637
+ isRequired: false,
638
+ transformFunction: null
639
+ },
640
+ touched: {
641
+ classPropertyName: "touched",
642
+ publicName: "touched",
643
+ isSignal: true,
644
+ isRequired: false,
645
+ transformFunction: null
646
+ },
647
+ userClass: {
648
+ classPropertyName: "userClass",
649
+ publicName: "class",
650
+ isSignal: true,
651
+ isRequired: false,
652
+ transformFunction: null
653
+ },
654
+ value: {
655
+ classPropertyName: "value",
656
+ publicName: "value",
657
+ isSignal: true,
658
+ isRequired: false,
659
+ transformFunction: null
660
+ },
661
+ weekNumber: {
662
+ classPropertyName: "weekNumber",
663
+ publicName: "weekNumber",
664
+ isSignal: true,
665
+ isRequired: false,
666
+ transformFunction: null
667
+ }
668
+ },
669
+ outputs: {
670
+ close: "close",
671
+ closed: "closed",
672
+ open: "open",
673
+ opened: "opened",
674
+ touch: "touch",
675
+ value: "valueChange"
676
+ },
677
+ host: {
678
+ listeners: {
679
+ "focusin": "onFocusIn($event)",
680
+ "focusout": "onFocusOut($event)",
681
+ "keydown": "onKeydown($event)"
682
+ },
683
+ properties: {
684
+ "attr.aria-describedby": "null",
685
+ "attr.aria-label": "null",
686
+ "attr.aria-labelledby": "null",
687
+ "attr.tabindex": "effectiveDisabled() ? null : -1",
688
+ "attr.aria-invalid": "invalidState() ? 'true' : null",
689
+ "attr.data-disabled": "effectiveDisabled() || null",
690
+ "attr.data-expanded": "expanded()",
691
+ "attr.data-invalid": "invalidState() || null",
692
+ "attr.data-readonly": "readonly() || null",
693
+ "class": "baseClass()"
694
+ }
695
+ },
696
+ providers: [
697
+ CalendarService,
698
+ DropdownService,
699
+ TimeSelectorService,
700
+ {
701
+ provide: DROPDOWN_POPUP_INPUT_TOKEN,
702
+ useExisting: forwardRef(() => DateTimePickerComponent),
703
+ multi: false
704
+ }
705
+ ],
706
+ queries: [
707
+ {
708
+ propertyName: "decadeCellTemplate",
709
+ first: true,
710
+ predicate: CalendarDecadeCellTemplateDirective,
711
+ descendants: true,
712
+ isSignal: true
713
+ },
714
+ {
715
+ propertyName: "monthCellTemplate",
716
+ first: true,
717
+ predicate: CalendarMonthCellTemplateDirective,
718
+ descendants: true,
719
+ isSignal: true
720
+ },
721
+ {
722
+ propertyName: "prefixTemplate",
723
+ first: true,
724
+ predicate: DateInputPrefixTemplateDirective,
725
+ descendants: true,
726
+ read: TemplateRef,
727
+ isSignal: true
728
+ },
729
+ {
730
+ propertyName: "yearCellTemplate",
731
+ first: true,
732
+ predicate: CalendarYearCellTemplateDirective,
733
+ descendants: true,
734
+ isSignal: true
735
+ }
736
+ ],
737
+ viewQueries: [{
738
+ propertyName: "popupTemplate",
739
+ first: true,
740
+ predicate: ["datePopupTemplate"],
741
+ descendants: true,
742
+ isSignal: true
743
+ }],
744
+ hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }],
745
+ ngImport: i0,
746
+ template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [clearButton]=\"showClearButton()\"\n [disabled]=\"effectiveDisabled()\"\n [inputAttributes]=\"inputAttributes()\"\n [inputId]=\"inputId()\"\n [invalid]=\"invalidState()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\"\n [value]=\"typedInput.text()\">\n @if (prefixTemplate()) {\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </ng-template>\n }\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openDateTimePicker\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n (click)=\"onDateInputButtonClick()\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #datePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n class=\"flex h-68 flex-col\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().dateTimePicker\"\n cdkTrapFocus>\n <div [class]=\"headerClass()\">\n <div class=\"flex w-full gap-1\" role=\"tablist\" (keydown)=\"onTabKeydown($event)\">\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"dateTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'date'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'date'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'date' ? 0 : -1\"\n (click)=\"selectTab('date')\">\n {{ messages().date }}\n </button>\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"timeTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'time'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'time'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'time' ? 0 : -1\"\n (click)=\"selectTab('time')\">\n {{ messages().time }}\n </button>\n </div>\n </div>\n <div\n class=\"overflow-hidden\"\n role=\"tabpanel\"\n [id]=\"panelId\"\n [attr.aria-labelledby]=\"activeView() === 'date' ? dateTabId : timeTabId\">\n @if (activeView() === \"date\") {\n <div class=\"flex h-full items-center justify-center\">\n <mona-calendar\n [focusOnMount]=\"focusViewOnMount()\"\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [firstDay]=\"firstDay()\"\n [weekNumber]=\"weekNumber()\"\n [value]=\"navigatedDate()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n (valueChange)=\"onCalendarValueChange($event)\"\n class=\"flex-1 border-none shadow-none\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n }\n @if (activeView() === \"time\") {\n <div class=\"flex h-full max-h-64 items-center justify-center\">\n <mona-time-selector\n [focusOnMount]=\"focusViewOnMount()\"\n [value]=\"navigatedDate()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [max]=\"timePickerMax()\"\n [min]=\"timePickerMin()\"\n [footer]=\"false\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [hourFormat]=\"effectiveHourFormat()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n }\n </div>\n <div [class]=\"footerClass()\">\n <button\n monaButton\n look=\"primary\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onSetDateClick()\">\n {{ messages().set }}\n </button>\n <button\n monaButton\n look=\"default\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onCancelClick()\">\n {{ messages().cancel }}\n </button>\n </div>\n </div>\n</ng-template>\n",
747
+ dependencies: [
748
+ {
749
+ kind: "component",
750
+ type: LucideCalendar,
751
+ selector: "svg[lucideCalendar]"
752
+ },
753
+ {
754
+ kind: "directive",
755
+ type: ButtonDirective,
756
+ selector: "button[monaButton]",
757
+ inputs: [
758
+ "aria-haspopup",
759
+ "disabled",
760
+ "iconOnly",
761
+ "loading",
762
+ "look",
763
+ "rounded",
764
+ "selected",
765
+ "size",
766
+ "tabindex",
767
+ "toggleable",
768
+ "type",
769
+ "class",
770
+ "value"
771
+ ],
772
+ outputs: ["lookChange", "selectedChange"]
773
+ },
774
+ {
775
+ kind: "component",
776
+ type: CalendarComponent,
777
+ selector: "mona-calendar",
778
+ inputs: [
779
+ "disabled",
780
+ "disabledDates",
781
+ "firstDay",
782
+ "focusOnMount",
783
+ "invalid",
784
+ "maxDate",
785
+ "minDate",
786
+ "readonly",
787
+ "required",
788
+ "rounded",
789
+ "selection",
790
+ "touched",
791
+ "class",
792
+ "value",
793
+ "weekNumber"
794
+ ],
795
+ outputs: ["touch", "valueChange"]
796
+ },
797
+ {
798
+ kind: "component",
799
+ type: TimeSelectorComponent,
800
+ selector: "mona-time-selector",
801
+ inputs: [
802
+ "aria-label",
803
+ "disabled",
804
+ "focusOnMount",
805
+ "footer",
806
+ "hourFormat",
807
+ "hourStep",
808
+ "invalid",
809
+ "max",
810
+ "min",
811
+ "minuteStep",
812
+ "readonly",
813
+ "required",
814
+ "rounded",
815
+ "secondStep",
816
+ "showSeconds",
817
+ "size",
818
+ "touched",
819
+ "value"
820
+ ],
821
+ outputs: ["touch", "valueChange"]
822
+ },
823
+ {
824
+ kind: "component",
825
+ type: TextBoxComponent,
826
+ selector: "mona-text-box",
827
+ inputs: [
828
+ "aria-describedby",
829
+ "aria-label",
830
+ "aria-labelledby",
831
+ "clearButton",
832
+ "disabled",
833
+ "inputAttributes",
834
+ "inputClass",
835
+ "inputId",
836
+ "inputStyle",
837
+ "invalid",
838
+ "maxLength",
839
+ "minLength",
840
+ "name",
841
+ "placeholder",
842
+ "readonly",
843
+ "required",
844
+ "rounded",
845
+ "size",
846
+ "touched",
847
+ "type",
848
+ "class",
849
+ "value"
850
+ ],
851
+ outputs: [
852
+ "inputBlur",
853
+ "inputFocus",
854
+ "touch",
855
+ "valueChange"
856
+ ]
857
+ },
858
+ {
859
+ kind: "directive",
860
+ type: TextBoxSuffixTemplateDirective,
861
+ selector: "ng-template[monaTextBoxSuffixTemplate]"
862
+ },
863
+ {
864
+ kind: "directive",
865
+ type: CdkTrapFocus,
866
+ selector: "[cdkTrapFocus]",
867
+ inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"],
868
+ exportAs: ["cdkTrapFocus"]
869
+ },
870
+ {
871
+ kind: "directive",
872
+ type: CalendarDecadeCellTemplateDirective,
873
+ selector: "ng-template[monaCalendarDecadeCellTemplate]"
874
+ },
875
+ {
876
+ kind: "directive",
877
+ type: CalendarMonthCellTemplateDirective,
878
+ selector: "ng-template[monaCalendarMonthCellTemplate]"
879
+ },
880
+ {
881
+ kind: "directive",
882
+ type: CalendarYearCellTemplateDirective,
883
+ selector: "ng-template[monaCalendarYearCellTemplate]"
884
+ },
885
+ {
886
+ kind: "directive",
887
+ type: NgTemplateOutlet,
888
+ selector: "[ngTemplateOutlet]",
889
+ inputs: [
890
+ "ngTemplateOutletContext",
891
+ "ngTemplateOutlet",
892
+ "ngTemplateOutletInjector"
893
+ ]
894
+ },
895
+ {
896
+ kind: "directive",
897
+ type: TextBoxPrefixTemplateDirective,
898
+ selector: "ng-template[monaTextBoxPrefixTemplate]"
899
+ }
900
+ ]
901
+ });
902
+ }
903
+ };
904
+ i0.ɵɵngDeclareClassMetadata({
905
+ minVersion: "12.0.0",
906
+ version: "22.2.6",
907
+ ngImport: i0,
908
+ type: DateTimePickerComponent,
909
+ decorators: [{
910
+ type: Component,
911
+ args: [{
912
+ selector: "mona-datetime-picker",
913
+ providers: [
914
+ CalendarService,
915
+ DropdownService,
916
+ TimeSelectorService,
917
+ {
918
+ provide: DROPDOWN_POPUP_INPUT_TOKEN,
919
+ useExisting: forwardRef(() => DateTimePickerComponent),
920
+ multi: false
921
+ }
922
+ ],
923
+ imports: [
924
+ LucideCalendar,
925
+ ButtonDirective,
926
+ CalendarComponent,
927
+ TimeSelectorComponent,
928
+ TextBoxComponent,
929
+ TextBoxSuffixTemplateDirective,
930
+ CdkTrapFocus,
931
+ CalendarDecadeCellTemplateDirective,
932
+ CalendarMonthCellTemplateDirective,
933
+ CalendarYearCellTemplateDirective,
934
+ NgTemplateOutlet,
935
+ TextBoxPrefixTemplateDirective
936
+ ],
937
+ hostDirectives: [DropdownPopupHandlerDirective],
938
+ host: {
939
+ "[attr.aria-describedby]": "null",
940
+ "[attr.aria-label]": "null",
941
+ "[attr.aria-labelledby]": "null",
942
+ "[attr.tabindex]": "effectiveDisabled() ? null : -1",
943
+ "[attr.aria-invalid]": "invalidState() ? 'true' : null",
944
+ "[attr.data-disabled]": "effectiveDisabled() || null",
945
+ "[attr.data-expanded]": "expanded()",
946
+ "[attr.data-invalid]": "invalidState() || null",
947
+ "[attr.data-readonly]": "readonly() || null",
948
+ "[class]": "baseClass()",
949
+ "(focusin)": "onFocusIn($event)",
950
+ "(focusout)": "onFocusOut($event)",
951
+ "(keydown)": "onKeydown($event)"
952
+ },
953
+ template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [clearButton]=\"showClearButton()\"\n [disabled]=\"effectiveDisabled()\"\n [inputAttributes]=\"inputAttributes()\"\n [inputId]=\"inputId()\"\n [invalid]=\"invalidState()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\"\n [value]=\"typedInput.text()\">\n @if (prefixTemplate()) {\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </ng-template>\n }\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openDateTimePicker\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n (click)=\"onDateInputButtonClick()\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #datePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n class=\"flex h-68 flex-col\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().dateTimePicker\"\n cdkTrapFocus>\n <div [class]=\"headerClass()\">\n <div class=\"flex w-full gap-1\" role=\"tablist\" (keydown)=\"onTabKeydown($event)\">\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"dateTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'date'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'date'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'date' ? 0 : -1\"\n (click)=\"selectTab('date')\">\n {{ messages().date }}\n </button>\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"timeTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'time'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'time'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'time' ? 0 : -1\"\n (click)=\"selectTab('time')\">\n {{ messages().time }}\n </button>\n </div>\n </div>\n <div\n class=\"overflow-hidden\"\n role=\"tabpanel\"\n [id]=\"panelId\"\n [attr.aria-labelledby]=\"activeView() === 'date' ? dateTabId : timeTabId\">\n @if (activeView() === \"date\") {\n <div class=\"flex h-full items-center justify-center\">\n <mona-calendar\n [focusOnMount]=\"focusViewOnMount()\"\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [firstDay]=\"firstDay()\"\n [weekNumber]=\"weekNumber()\"\n [value]=\"navigatedDate()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n (valueChange)=\"onCalendarValueChange($event)\"\n class=\"flex-1 border-none shadow-none\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n }\n @if (activeView() === \"time\") {\n <div class=\"flex h-full max-h-64 items-center justify-center\">\n <mona-time-selector\n [focusOnMount]=\"focusViewOnMount()\"\n [value]=\"navigatedDate()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [max]=\"timePickerMax()\"\n [min]=\"timePickerMin()\"\n [footer]=\"false\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [hourFormat]=\"effectiveHourFormat()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n }\n </div>\n <div [class]=\"footerClass()\">\n <button\n monaButton\n look=\"primary\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onSetDateClick()\">\n {{ messages().set }}\n </button>\n <button\n monaButton\n look=\"default\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onCancelClick()\">\n {{ messages().cancel }}\n </button>\n </div>\n </div>\n</ng-template>\n"
954
+ }]
955
+ }],
956
+ ctorParameters: () => [],
957
+ propDecorators: {
958
+ decadeCellTemplate: [{
959
+ type: i0.ContentChild,
960
+ args: [i0.forwardRef(() => CalendarDecadeCellTemplateDirective), { isSignal: true }]
961
+ }],
962
+ monthCellTemplate: [{
963
+ type: i0.ContentChild,
964
+ args: [i0.forwardRef(() => CalendarMonthCellTemplateDirective), { isSignal: true }]
965
+ }],
966
+ popupTemplate: [{
967
+ type: i0.ViewChild,
968
+ args: ["datePopupTemplate", { isSignal: true }]
969
+ }],
970
+ prefixTemplate: [{
971
+ type: i0.ContentChild,
972
+ args: [i0.forwardRef(() => DateInputPrefixTemplateDirective), {
973
+ read: TemplateRef,
974
+ isSignal: true
975
+ }]
976
+ }],
977
+ yearCellTemplate: [{
978
+ type: i0.ContentChild,
979
+ args: [i0.forwardRef(() => CalendarYearCellTemplateDirective), { isSignal: true }]
980
+ }],
981
+ ariaDescribedBy: [{
982
+ type: i0.Input,
983
+ args: [{
984
+ isSignal: true,
985
+ alias: "aria-describedby",
986
+ required: false
987
+ }]
988
+ }],
989
+ ariaLabel: [{
990
+ type: i0.Input,
991
+ args: [{
992
+ isSignal: true,
993
+ alias: "aria-label",
994
+ required: false
995
+ }]
996
+ }],
997
+ ariaLabelledBy: [{
998
+ type: i0.Input,
999
+ args: [{
1000
+ isSignal: true,
1001
+ alias: "aria-labelledby",
1002
+ required: false
1003
+ }]
1004
+ }],
1005
+ close: [{
1006
+ type: i0.Output,
1007
+ args: ["close"]
1008
+ }],
1009
+ closed: [{
1010
+ type: i0.Output,
1011
+ args: ["closed"]
1012
+ }],
1013
+ disabled: [{
1014
+ type: i0.Input,
1015
+ args: [{
1016
+ isSignal: true,
1017
+ alias: "disabled",
1018
+ required: false
1019
+ }]
1020
+ }],
1021
+ disabledDates: [{
1022
+ type: i0.Input,
1023
+ args: [{
1024
+ isSignal: true,
1025
+ alias: "disabledDates",
1026
+ required: false
1027
+ }]
1028
+ }],
1029
+ firstDay: [{
1030
+ type: i0.Input,
1031
+ args: [{
1032
+ isSignal: true,
1033
+ alias: "firstDay",
1034
+ required: false
1035
+ }]
1036
+ }],
1037
+ format: [{
1038
+ type: i0.Input,
1039
+ args: [{
1040
+ isSignal: true,
1041
+ alias: "format",
1042
+ required: false
1043
+ }]
1044
+ }],
1045
+ hourFormat: [{
1046
+ type: i0.Input,
1047
+ args: [{
1048
+ isSignal: true,
1049
+ alias: "hourFormat",
1050
+ required: false
1051
+ }]
1052
+ }],
1053
+ hourStep: [{
1054
+ type: i0.Input,
1055
+ args: [{
1056
+ isSignal: true,
1057
+ alias: "hourStep",
1058
+ required: false
1059
+ }]
1060
+ }],
1061
+ inputId: [{
1062
+ type: i0.Input,
1063
+ args: [{
1064
+ isSignal: true,
1065
+ alias: "inputId",
1066
+ required: false
1067
+ }]
1068
+ }],
1069
+ invalid: [{
1070
+ type: i0.Input,
1071
+ args: [{
1072
+ isSignal: true,
1073
+ alias: "invalid",
1074
+ required: false
1075
+ }]
1076
+ }],
1077
+ max: [{
1078
+ type: i0.Input,
1079
+ args: [{
1080
+ isSignal: true,
1081
+ alias: "max",
1082
+ required: false
1083
+ }]
1084
+ }],
1085
+ min: [{
1086
+ type: i0.Input,
1087
+ args: [{
1088
+ isSignal: true,
1089
+ alias: "min",
1090
+ required: false
1091
+ }]
1092
+ }],
1093
+ minuteStep: [{
1094
+ type: i0.Input,
1095
+ args: [{
1096
+ isSignal: true,
1097
+ alias: "minuteStep",
1098
+ required: false
1099
+ }]
1100
+ }],
1101
+ open: [{
1102
+ type: i0.Output,
1103
+ args: ["open"]
1104
+ }],
1105
+ opened: [{
1106
+ type: i0.Output,
1107
+ args: ["opened"]
1108
+ }],
1109
+ placeholder: [{
1110
+ type: i0.Input,
1111
+ args: [{
1112
+ isSignal: true,
1113
+ alias: "placeholder",
1114
+ required: false
1115
+ }]
1116
+ }],
1117
+ popupClass: [{
1118
+ type: i0.Input,
1119
+ args: [{
1120
+ isSignal: true,
1121
+ alias: "popupClass",
1122
+ required: false
1123
+ }]
1124
+ }],
1125
+ popupHeight: [{
1126
+ type: i0.Input,
1127
+ args: [{
1128
+ isSignal: true,
1129
+ alias: "popupHeight",
1130
+ required: false
1131
+ }]
1132
+ }],
1133
+ popupWidth: [{
1134
+ type: i0.Input,
1135
+ args: [{
1136
+ isSignal: true,
1137
+ alias: "popupWidth",
1138
+ required: false
1139
+ }]
1140
+ }],
1141
+ readonly: [{
1142
+ type: i0.Input,
1143
+ args: [{
1144
+ isSignal: true,
1145
+ alias: "readonly",
1146
+ required: false
1147
+ }]
1148
+ }],
1149
+ readonlyInput: [{
1150
+ type: i0.Input,
1151
+ args: [{
1152
+ isSignal: true,
1153
+ alias: "readonlyInput",
1154
+ required: false
1155
+ }]
1156
+ }],
1157
+ required: [{
1158
+ type: i0.Input,
1159
+ args: [{
1160
+ isSignal: true,
1161
+ alias: "required",
1162
+ required: false
1163
+ }]
1164
+ }],
1165
+ rounded: [{
1166
+ type: i0.Input,
1167
+ args: [{
1168
+ isSignal: true,
1169
+ alias: "rounded",
1170
+ required: false
1171
+ }]
1172
+ }],
1173
+ secondStep: [{
1174
+ type: i0.Input,
1175
+ args: [{
1176
+ isSignal: true,
1177
+ alias: "secondStep",
1178
+ required: false
1179
+ }]
1180
+ }],
1181
+ showClearButton: [{
1182
+ type: i0.Input,
1183
+ args: [{
1184
+ isSignal: true,
1185
+ alias: "showClearButton",
1186
+ required: false
1187
+ }]
1188
+ }],
1189
+ showSeconds: [{
1190
+ type: i0.Input,
1191
+ args: [{
1192
+ isSignal: true,
1193
+ alias: "showSeconds",
1194
+ required: false
1195
+ }]
1196
+ }],
1197
+ size: [{
1198
+ type: i0.Input,
1199
+ args: [{
1200
+ isSignal: true,
1201
+ alias: "size",
1202
+ required: false
1203
+ }]
1204
+ }],
1205
+ touch: [{
1206
+ type: i0.Output,
1207
+ args: ["touch"]
1208
+ }],
1209
+ touched: [{
1210
+ type: i0.Input,
1211
+ args: [{
1212
+ isSignal: true,
1213
+ alias: "touched",
1214
+ required: false
1215
+ }]
1216
+ }],
1217
+ userClass: [{
1218
+ type: i0.Input,
1219
+ args: [{
1220
+ isSignal: true,
1221
+ alias: "class",
1222
+ required: false
1223
+ }]
1224
+ }],
1225
+ value: [{
1226
+ type: i0.Input,
1227
+ args: [{
1228
+ isSignal: true,
1229
+ alias: "value",
1230
+ required: false
1231
+ }]
1232
+ }, {
1233
+ type: i0.Output,
1234
+ args: ["valueChange"]
1235
+ }],
1236
+ weekNumber: [{
1237
+ type: i0.Input,
1238
+ args: [{
1239
+ isSignal: true,
1240
+ alias: "weekNumber",
1241
+ required: false
1242
+ }]
1243
+ }]
1244
+ }
1245
+ });
702
1246
  export { DATETIME_PICKER_DEFAULT_MESSAGES, DateTimePickerComponent };
703
- //# sourceMappingURL=nanahoshi-mona-ui-datetime-picker.mjs.map
1247
+
1248
+ //# sourceMappingURL=nanahoshi-mona-ui-datetime-picker.mjs.map