@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,26 +1,22 @@
1
- import { CdkTrapFocus } from '@angular/cdk/a11y';
2
- import * as i0 from '@angular/core';
3
- import { inject, DestroyRef, ElementRef, computed, viewChild, input, output, booleanAttribute, model, afterNextRender, effect, untracked, forwardRef, Component } from '@angular/core';
4
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
- import { LucideClock } from '@lucide/angular';
6
- import { ButtonDirective } from '@nanahoshi/mona-ui/button';
7
- import { getLocaleHourFormat, createTypedDateInput } from '@nanahoshi/mona-ui/date-input';
8
- import * as i1 from '@nanahoshi/mona-ui/dropdowns';
9
- import { DropdownService, dropdownPopupThemeVariants, DROPDOWN_POPUP_INPUT_TOKEN, DropdownPopupHandlerDirective } from '@nanahoshi/mona-ui/dropdowns';
10
- import { MonaI18nService, getLocaleTimeInputFormat } from '@nanahoshi/mona-ui/i18n';
11
- import { themeControlSurfaceClasses, injectEffectiveDisabled, createElementControlId } from '@nanahoshi/mona-ui/internal';
12
- import { TextBoxComponent, TextBoxSuffixTemplateDirective } from '@nanahoshi/mona-ui/text-box';
13
- import { TimeSelectorComponent } from '@nanahoshi/mona-ui/time-selector';
14
- import { twMerge } from 'tailwind-merge';
15
- import { cva } from 'class-variance-authority';
16
-
17
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
18
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
1
+ import { CdkTrapFocus } from "@angular/cdk/a11y";
2
+ import * as i0 from "@angular/core";
3
+ import { Component, DestroyRef, ElementRef, afterNextRender, booleanAttribute, computed, effect, forwardRef, inject, input, model, output, untracked, viewChild } from "@angular/core";
4
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
5
+ import { LucideClock } from "@lucide/angular";
6
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
7
+ import { createTypedDateInput, getLocaleHourFormat } from "@nanahoshi/mona-ui/date-input";
8
+ import * as i1 from "@nanahoshi/mona-ui/dropdowns";
9
+ import { DROPDOWN_POPUP_INPUT_TOKEN, DropdownPopupHandlerDirective, DropdownService, dropdownPopupThemeVariants } from "@nanahoshi/mona-ui/dropdowns";
10
+ import { MonaI18nService, getLocaleTimeInputFormat } from "@nanahoshi/mona-ui/i18n";
11
+ import { createElementControlId, injectEffectiveDisabled, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
12
+ import { TextBoxComponent, TextBoxSuffixTemplateDirective } from "@nanahoshi/mona-ui/text-box";
13
+ import { TimeSelectorComponent } from "@nanahoshi/mona-ui/time-selector";
14
+ import { twMerge } from "tailwind-merge";
15
+ import { cva } from "class-variance-authority";
19
16
  const TIME_PICKER_DEFAULT_MESSAGES = {
20
- openTimePicker: "Open time picker",
21
- timePicker: "Time picker"
17
+ openTimePicker: "Open time picker",
18
+ timePicker: "Time picker"
22
19
  };
23
-
24
20
  const timePickerBaseThemeVariants = cva(`
25
21
  flex w-full items-center
26
22
  ${themeControlSurfaceClasses} text-foreground
@@ -49,427 +45,885 @@ const timePickerBaseThemeVariants = cva(`
49
45
  [&_mona-text-box]:focus-within:ring-0
50
46
  [&_mona-text-box[data-invalid='true']]:ring-0
51
47
  `, {
52
- variants: {
53
- focused: {
54
- true: "border-focus-indicator ring-2 ring-focus-indicator/35",
55
- false: ""
56
- },
57
- rounded: {
58
- full: "rounded-full",
59
- large: "rounded-lg",
60
- medium: "rounded-md",
61
- none: "rounded-none",
62
- small: "rounded-sm"
63
- },
64
- size: {
65
- large: "h-10 text-base",
66
- medium: "h-9 text-sm",
67
- small: "h-8 text-xs"
68
- }
69
- },
70
- compoundVariants: [
71
- {
72
- focused: true,
73
- class: "data-[invalid='true']:border-error data-[invalid='true']:ring-error/35"
74
- }
75
- ]
48
+ variants: {
49
+ focused: {
50
+ true: "border-focus-indicator ring-2 ring-focus-indicator/35",
51
+ false: ""
52
+ },
53
+ rounded: {
54
+ full: "rounded-full",
55
+ large: "rounded-lg",
56
+ medium: "rounded-md",
57
+ none: "rounded-none",
58
+ small: "rounded-sm"
59
+ },
60
+ size: {
61
+ large: "h-10 text-base",
62
+ medium: "h-9 text-sm",
63
+ small: "h-8 text-xs"
64
+ }
65
+ },
66
+ compoundVariants: [{
67
+ focused: true,
68
+ class: "data-[invalid='true']:border-error data-[invalid='true']:ring-error/35"
69
+ }]
70
+ });
71
+ var TimePickerComponent = class TimePickerComponent {
72
+ #destroyRef;
73
+ #dropdownService;
74
+ #hostElementRef;
75
+ #i18n;
76
+ constructor() {
77
+ this.#destroyRef = inject(DestroyRef);
78
+ this.#dropdownService = inject(DropdownService);
79
+ this.#hostElementRef = inject(ElementRef);
80
+ this.#i18n = inject(MonaI18nService);
81
+ this.baseClass = computed(() => {
82
+ const focused = this.#dropdownService.popupRef() != null;
83
+ const rounded = this.rounded();
84
+ const size = this.size();
85
+ const variantClass = timePickerBaseThemeVariants({
86
+ focused,
87
+ rounded,
88
+ size
89
+ });
90
+ const userClass = this.userClass();
91
+ return twMerge(variantClass, userClass);
92
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
93
+ this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
94
+ this.effectiveFormat = computed(() => {
95
+ return this.format() ?? getLocaleTimeInputFormat(this.#i18n.localeId(), {
96
+ hourFormat: this.effectiveHourFormat(),
97
+ showSeconds: this.showSeconds()
98
+ });
99
+ }, ...ngDevMode ? [{ debugName: "effectiveFormat" }] : /* istanbul ignore next */ []);
100
+ this.effectiveHourFormat = computed(() => this.hourFormat() ?? getLocaleHourFormat(this.#i18n.localeId()), ...ngDevMode ? [{ debugName: "effectiveHourFormat" }] : /* istanbul ignore next */ []);
101
+ this.expanded = computed(() => this.#dropdownService.popupRef() != null, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
102
+ this.inputAttributes = computed(() => {
103
+ return {
104
+ "aria-autocomplete": "none",
105
+ "aria-controls": this.popupId,
106
+ "aria-expanded": this.expanded() ? "true" : "false",
107
+ "aria-haspopup": "dialog",
108
+ readonly: this.readonly() || this.readonlyInput(),
109
+ role: "combobox"
110
+ };
111
+ }, ...ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []);
112
+ this.invalidState = computed(() => this.typedInput.errors().length > 0 || this.touched() && (this.invalid() || this.required() && !this.value()), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
113
+ this.messages = this.#i18n.componentMessages("timePicker", TIME_PICKER_DEFAULT_MESSAGES);
114
+ this.pickerPopupClass = computed(() => {
115
+ const rounded = this.rounded();
116
+ const size = this.size();
117
+ const userClass = this.popupClass();
118
+ const variantClass = dropdownPopupThemeVariants({
119
+ rounded,
120
+ size
121
+ });
122
+ return twMerge(variantClass, userClass);
123
+ }, ...ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []);
124
+ this.popupId = createElementControlId();
125
+ this.timePopupTemplateRef = viewChild.required("timePopupTemplate", ...ngDevMode ? [{ debugName: "timePopupTemplateRef" }] : /* istanbul ignore next */ []);
126
+ this.ariaDescribedBy = input("", {
127
+ ...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
128
+ alias: "aria-describedby"
129
+ });
130
+ this.ariaLabel = input("", {
131
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
132
+ alias: "aria-label"
133
+ });
134
+ this.ariaLabelledBy = input("", {
135
+ ...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
136
+ alias: "aria-labelledby"
137
+ });
138
+ this.close = output();
139
+ this.closed = output();
140
+ this.disabled = input(false, {
141
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
142
+ transform: booleanAttribute
143
+ });
144
+ this.format = input(null, ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
145
+ this.hourFormat = input(null, ...ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []);
146
+ this.hourStep = input(1, ...ngDevMode ? [{ debugName: "hourStep" }] : /* istanbul ignore next */ []);
147
+ this.inputId = input(createElementControlId(), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
148
+ this.invalid = input(false, {
149
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
150
+ transform: booleanAttribute
151
+ });
152
+ this.max = input(void 0, {
153
+ ...ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {},
154
+ transform: (value) => value instanceof Date ? value : void 0
155
+ });
156
+ this.min = input(void 0, {
157
+ ...ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {},
158
+ transform: (value) => value instanceof Date ? value : void 0
159
+ });
160
+ this.minuteStep = input(1, ...ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []);
161
+ this.open = output();
162
+ this.opened = output();
163
+ this.placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
164
+ this.popupClass = input("", ...ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []);
165
+ this.popupHeight = input(...ngDevMode ? [void 0, { debugName: "popupHeight" }] : /* istanbul ignore next */ []);
166
+ this.popupWidth = input(...ngDevMode ? [void 0, { debugName: "popupWidth" }] : /* istanbul ignore next */ []);
167
+ this.readonly = input(false, {
168
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
169
+ transform: booleanAttribute
170
+ });
171
+ this.readonlyInput = input(false, {
172
+ ...ngDevMode ? { debugName: "readonlyInput" } : /* istanbul ignore next */ {},
173
+ transform: booleanAttribute
174
+ });
175
+ this.required = input(false, {
176
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
177
+ transform: booleanAttribute
178
+ });
179
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
180
+ this.secondStep = input(1, ...ngDevMode ? [{ debugName: "secondStep" }] : /* istanbul ignore next */ []);
181
+ this.showClearButton = input(false, {
182
+ ...ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {},
183
+ transform: booleanAttribute
184
+ });
185
+ this.showSeconds = input(false, {
186
+ ...ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {},
187
+ transform: booleanAttribute
188
+ });
189
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
190
+ this.touch = output();
191
+ this.touched = input(false, {
192
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
193
+ transform: booleanAttribute
194
+ });
195
+ this.userClass = input("", {
196
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
197
+ alias: "class"
198
+ });
199
+ this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
200
+ this.typedInput = createTypedDateInput({
201
+ constraints: () => ({
202
+ max: this.max(),
203
+ min: this.min(),
204
+ unit: "time"
205
+ }),
206
+ format: () => this.effectiveFormat(),
207
+ localeId: () => this.#i18n.localeId(),
208
+ resolve: (parsed, current) => {
209
+ const day = current ?? /* @__PURE__ */ new Date();
210
+ return parsed.set({
211
+ year: day.getFullYear(),
212
+ month: day.getMonth() + 1,
213
+ day: day.getDate()
214
+ }).toJSDate();
215
+ },
216
+ value: this.value
217
+ });
218
+ afterNextRender({ read: () => this.setPopupCloseSubscription() });
219
+ effect(() => {
220
+ const popupTemplate = this.timePopupTemplateRef();
221
+ untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
222
+ });
223
+ }
224
+ focus(options) {
225
+ const input = this.#hostElementRef.nativeElement.querySelector("input");
226
+ if (input) {
227
+ input.focus(options);
228
+ input.setSelectionRange(input.value.length, input.value.length);
229
+ }
230
+ }
231
+ onFocusIn(event) {
232
+ if (event.target === this.#hostElementRef.nativeElement) this.focus();
233
+ }
234
+ onFocusOut(event) {
235
+ if (this.#destroyRef.destroyed) return;
236
+ const nextTarget = event.relatedTarget;
237
+ if (nextTarget instanceof Node) {
238
+ const popupElement = this.#dropdownService.popupRef()?.overlayRef.overlayElement;
239
+ if (this.#hostElementRef.nativeElement.contains(nextTarget) || popupElement?.contains(nextTarget)) return;
240
+ }
241
+ this.touch.emit();
242
+ }
243
+ onInputBlur() {
244
+ this.typedInput.commit();
245
+ }
246
+ onKeydown(event) {
247
+ if (this.effectiveDisabled() || this.readonly()) return;
248
+ if (event.altKey && event.key === "ArrowDown") {
249
+ event.preventDefault();
250
+ this.openPopup();
251
+ } else if (event.altKey && event.key === "ArrowUp" || event.key === "Escape") {
252
+ if (this.expanded()) {
253
+ event.preventDefault();
254
+ this.#dropdownService.popupRef()?.close();
255
+ }
256
+ } else if (event.key === "Enter" && event.target instanceof HTMLInputElement) {
257
+ if (!event.isComposing && event.keyCode !== 229) this.typedInput.commit();
258
+ }
259
+ }
260
+ onTimeInputButtonClick() {
261
+ if (this.effectiveDisabled() || this.readonly()) return;
262
+ if (this.#dropdownService.popupRef()) {
263
+ this.#dropdownService.popupRef()?.close();
264
+ return;
265
+ }
266
+ this.openPopup();
267
+ }
268
+ onTimeSelectorValueChange(date) {
269
+ this.value.set(date);
270
+ this.#dropdownService.popupRef()?.close();
271
+ }
272
+ openPopup() {
273
+ if (this.#dropdownService.popupRef()) return;
274
+ this.#dropdownService.triggerPopupOpen$.next({
275
+ height: this.popupHeight() || "fit-content",
276
+ width: this.popupWidth() || "auto"
277
+ });
278
+ }
279
+ setPopupCloseSubscription() {
280
+ this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
281
+ if (this.#dropdownService.focusCanReturn()) this.focus();
282
+ else if (!this.#destroyRef.destroyed) this.touch.emit();
283
+ });
284
+ }
285
+ static {
286
+ this.ɵfac = i0.ɵɵngDeclareFactory({
287
+ minVersion: "12.0.0",
288
+ version: "22.2.6",
289
+ ngImport: i0,
290
+ type: TimePickerComponent,
291
+ deps: [],
292
+ target: i0.ɵɵFactoryTarget.Component
293
+ });
294
+ }
295
+ static {
296
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
297
+ minVersion: "17.2.0",
298
+ version: "22.2.6",
299
+ type: TimePickerComponent,
300
+ isStandalone: true,
301
+ selector: "mona-time-picker",
302
+ inputs: {
303
+ ariaDescribedBy: {
304
+ classPropertyName: "ariaDescribedBy",
305
+ publicName: "aria-describedby",
306
+ isSignal: true,
307
+ isRequired: false,
308
+ transformFunction: null
309
+ },
310
+ ariaLabel: {
311
+ classPropertyName: "ariaLabel",
312
+ publicName: "aria-label",
313
+ isSignal: true,
314
+ isRequired: false,
315
+ transformFunction: null
316
+ },
317
+ ariaLabelledBy: {
318
+ classPropertyName: "ariaLabelledBy",
319
+ publicName: "aria-labelledby",
320
+ isSignal: true,
321
+ isRequired: false,
322
+ transformFunction: null
323
+ },
324
+ disabled: {
325
+ classPropertyName: "disabled",
326
+ publicName: "disabled",
327
+ isSignal: true,
328
+ isRequired: false,
329
+ transformFunction: null
330
+ },
331
+ format: {
332
+ classPropertyName: "format",
333
+ publicName: "format",
334
+ isSignal: true,
335
+ isRequired: false,
336
+ transformFunction: null
337
+ },
338
+ hourFormat: {
339
+ classPropertyName: "hourFormat",
340
+ publicName: "hourFormat",
341
+ isSignal: true,
342
+ isRequired: false,
343
+ transformFunction: null
344
+ },
345
+ hourStep: {
346
+ classPropertyName: "hourStep",
347
+ publicName: "hourStep",
348
+ isSignal: true,
349
+ isRequired: false,
350
+ transformFunction: null
351
+ },
352
+ inputId: {
353
+ classPropertyName: "inputId",
354
+ publicName: "inputId",
355
+ isSignal: true,
356
+ isRequired: false,
357
+ transformFunction: null
358
+ },
359
+ invalid: {
360
+ classPropertyName: "invalid",
361
+ publicName: "invalid",
362
+ isSignal: true,
363
+ isRequired: false,
364
+ transformFunction: null
365
+ },
366
+ max: {
367
+ classPropertyName: "max",
368
+ publicName: "max",
369
+ isSignal: true,
370
+ isRequired: false,
371
+ transformFunction: null
372
+ },
373
+ min: {
374
+ classPropertyName: "min",
375
+ publicName: "min",
376
+ isSignal: true,
377
+ isRequired: false,
378
+ transformFunction: null
379
+ },
380
+ minuteStep: {
381
+ classPropertyName: "minuteStep",
382
+ publicName: "minuteStep",
383
+ isSignal: true,
384
+ isRequired: false,
385
+ transformFunction: null
386
+ },
387
+ placeholder: {
388
+ classPropertyName: "placeholder",
389
+ publicName: "placeholder",
390
+ isSignal: true,
391
+ isRequired: false,
392
+ transformFunction: null
393
+ },
394
+ popupClass: {
395
+ classPropertyName: "popupClass",
396
+ publicName: "popupClass",
397
+ isSignal: true,
398
+ isRequired: false,
399
+ transformFunction: null
400
+ },
401
+ popupHeight: {
402
+ classPropertyName: "popupHeight",
403
+ publicName: "popupHeight",
404
+ isSignal: true,
405
+ isRequired: false,
406
+ transformFunction: null
407
+ },
408
+ popupWidth: {
409
+ classPropertyName: "popupWidth",
410
+ publicName: "popupWidth",
411
+ isSignal: true,
412
+ isRequired: false,
413
+ transformFunction: null
414
+ },
415
+ readonly: {
416
+ classPropertyName: "readonly",
417
+ publicName: "readonly",
418
+ isSignal: true,
419
+ isRequired: false,
420
+ transformFunction: null
421
+ },
422
+ readonlyInput: {
423
+ classPropertyName: "readonlyInput",
424
+ publicName: "readonlyInput",
425
+ isSignal: true,
426
+ isRequired: false,
427
+ transformFunction: null
428
+ },
429
+ required: {
430
+ classPropertyName: "required",
431
+ publicName: "required",
432
+ isSignal: true,
433
+ isRequired: false,
434
+ transformFunction: null
435
+ },
436
+ rounded: {
437
+ classPropertyName: "rounded",
438
+ publicName: "rounded",
439
+ isSignal: true,
440
+ isRequired: false,
441
+ transformFunction: null
442
+ },
443
+ secondStep: {
444
+ classPropertyName: "secondStep",
445
+ publicName: "secondStep",
446
+ isSignal: true,
447
+ isRequired: false,
448
+ transformFunction: null
449
+ },
450
+ showClearButton: {
451
+ classPropertyName: "showClearButton",
452
+ publicName: "showClearButton",
453
+ isSignal: true,
454
+ isRequired: false,
455
+ transformFunction: null
456
+ },
457
+ showSeconds: {
458
+ classPropertyName: "showSeconds",
459
+ publicName: "showSeconds",
460
+ isSignal: true,
461
+ isRequired: false,
462
+ transformFunction: null
463
+ },
464
+ size: {
465
+ classPropertyName: "size",
466
+ publicName: "size",
467
+ isSignal: true,
468
+ isRequired: false,
469
+ transformFunction: null
470
+ },
471
+ touched: {
472
+ classPropertyName: "touched",
473
+ publicName: "touched",
474
+ isSignal: true,
475
+ isRequired: false,
476
+ transformFunction: null
477
+ },
478
+ userClass: {
479
+ classPropertyName: "userClass",
480
+ publicName: "class",
481
+ isSignal: true,
482
+ isRequired: false,
483
+ transformFunction: null
484
+ },
485
+ value: {
486
+ classPropertyName: "value",
487
+ publicName: "value",
488
+ isSignal: true,
489
+ isRequired: false,
490
+ transformFunction: null
491
+ }
492
+ },
493
+ outputs: {
494
+ close: "close",
495
+ closed: "closed",
496
+ open: "open",
497
+ opened: "opened",
498
+ touch: "touch",
499
+ value: "valueChange"
500
+ },
501
+ host: {
502
+ listeners: {
503
+ "focusin": "onFocusIn($event)",
504
+ "focusout": "onFocusOut($event)",
505
+ "keydown": "onKeydown($event)"
506
+ },
507
+ properties: {
508
+ "attr.aria-describedby": "null",
509
+ "attr.aria-label": "null",
510
+ "attr.aria-labelledby": "null",
511
+ "attr.tabindex": "effectiveDisabled() ? null : -1",
512
+ "attr.aria-invalid": "invalidState() ? 'true' : null",
513
+ "attr.data-disabled": "effectiveDisabled() || null",
514
+ "attr.data-expanded": "expanded()",
515
+ "attr.data-invalid": "invalidState() || null",
516
+ "attr.data-readonly": "readonly() || null",
517
+ "class": "baseClass()"
518
+ }
519
+ },
520
+ providers: [DropdownService, {
521
+ provide: DROPDOWN_POPUP_INPUT_TOKEN,
522
+ useExisting: forwardRef(() => TimePickerComponent),
523
+ multi: false
524
+ }],
525
+ viewQueries: [{
526
+ propertyName: "timePopupTemplateRef",
527
+ first: true,
528
+ predicate: ["timePopupTemplate"],
529
+ descendants: true,
530
+ isSignal: true
531
+ }],
532
+ hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }],
533
+ ngImport: i0,
534
+ template: "<mona-text-box\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [disabled]=\"effectiveDisabled()\"\n [inputId]=\"inputId()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"typedInput.text()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalidState()\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\"\n [clearButton]=\"showClearButton()\"\n (valueChange)=\"typedInput.edit($event)\"\n (inputBlur)=\"onInputBlur()\">\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n (click)=\"onTimeInputButtonClick()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openTimePicker\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\">\n <svg lucideClock [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #timePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().timePicker\"\n cdkTrapFocus>\n <mona-time-selector\n focusOnMount\n [value]=\"value()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [max]=\"max()\"\n [min]=\"min()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [hourFormat]=\"effectiveHourFormat()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n</ng-template>\n",
535
+ dependencies: [
536
+ {
537
+ kind: "component",
538
+ type: LucideClock,
539
+ selector: "svg[lucideClock]"
540
+ },
541
+ {
542
+ kind: "directive",
543
+ type: ButtonDirective,
544
+ selector: "button[monaButton]",
545
+ inputs: [
546
+ "aria-haspopup",
547
+ "disabled",
548
+ "iconOnly",
549
+ "loading",
550
+ "look",
551
+ "rounded",
552
+ "selected",
553
+ "size",
554
+ "tabindex",
555
+ "toggleable",
556
+ "type",
557
+ "class",
558
+ "value"
559
+ ],
560
+ outputs: ["lookChange", "selectedChange"]
561
+ },
562
+ {
563
+ kind: "component",
564
+ type: TimeSelectorComponent,
565
+ selector: "mona-time-selector",
566
+ inputs: [
567
+ "aria-label",
568
+ "disabled",
569
+ "focusOnMount",
570
+ "footer",
571
+ "hourFormat",
572
+ "hourStep",
573
+ "invalid",
574
+ "max",
575
+ "min",
576
+ "minuteStep",
577
+ "readonly",
578
+ "required",
579
+ "rounded",
580
+ "secondStep",
581
+ "showSeconds",
582
+ "size",
583
+ "touched",
584
+ "value"
585
+ ],
586
+ outputs: ["touch", "valueChange"]
587
+ },
588
+ {
589
+ kind: "component",
590
+ type: TextBoxComponent,
591
+ selector: "mona-text-box",
592
+ inputs: [
593
+ "aria-describedby",
594
+ "aria-label",
595
+ "aria-labelledby",
596
+ "clearButton",
597
+ "disabled",
598
+ "inputAttributes",
599
+ "inputClass",
600
+ "inputId",
601
+ "inputStyle",
602
+ "invalid",
603
+ "maxLength",
604
+ "minLength",
605
+ "name",
606
+ "placeholder",
607
+ "readonly",
608
+ "required",
609
+ "rounded",
610
+ "size",
611
+ "touched",
612
+ "type",
613
+ "class",
614
+ "value"
615
+ ],
616
+ outputs: [
617
+ "inputBlur",
618
+ "inputFocus",
619
+ "touch",
620
+ "valueChange"
621
+ ]
622
+ },
623
+ {
624
+ kind: "directive",
625
+ type: TextBoxSuffixTemplateDirective,
626
+ selector: "ng-template[monaTextBoxSuffixTemplate]"
627
+ },
628
+ {
629
+ kind: "directive",
630
+ type: CdkTrapFocus,
631
+ selector: "[cdkTrapFocus]",
632
+ inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"],
633
+ exportAs: ["cdkTrapFocus"]
634
+ }
635
+ ]
636
+ });
637
+ }
638
+ };
639
+ i0.ɵɵngDeclareClassMetadata({
640
+ minVersion: "12.0.0",
641
+ version: "22.2.6",
642
+ ngImport: i0,
643
+ type: TimePickerComponent,
644
+ decorators: [{
645
+ type: Component,
646
+ args: [{
647
+ selector: "mona-time-picker",
648
+ providers: [DropdownService, {
649
+ provide: DROPDOWN_POPUP_INPUT_TOKEN,
650
+ useExisting: forwardRef(() => TimePickerComponent),
651
+ multi: false
652
+ }],
653
+ imports: [
654
+ LucideClock,
655
+ ButtonDirective,
656
+ TimeSelectorComponent,
657
+ TextBoxComponent,
658
+ TextBoxSuffixTemplateDirective,
659
+ CdkTrapFocus
660
+ ],
661
+ hostDirectives: [DropdownPopupHandlerDirective],
662
+ host: {
663
+ "[attr.aria-describedby]": "null",
664
+ "[attr.aria-label]": "null",
665
+ "[attr.aria-labelledby]": "null",
666
+ "[attr.tabindex]": "effectiveDisabled() ? null : -1",
667
+ "[attr.aria-invalid]": "invalidState() ? 'true' : null",
668
+ "[attr.data-disabled]": "effectiveDisabled() || null",
669
+ "[attr.data-expanded]": "expanded()",
670
+ "[attr.data-invalid]": "invalidState() || null",
671
+ "[attr.data-readonly]": "readonly() || null",
672
+ "[class]": "baseClass()",
673
+ "(focusin)": "onFocusIn($event)",
674
+ "(focusout)": "onFocusOut($event)",
675
+ "(keydown)": "onKeydown($event)"
676
+ },
677
+ template: "<mona-text-box\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [disabled]=\"effectiveDisabled()\"\n [inputId]=\"inputId()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"typedInput.text()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalidState()\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\"\n [clearButton]=\"showClearButton()\"\n (valueChange)=\"typedInput.edit($event)\"\n (inputBlur)=\"onInputBlur()\">\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n (click)=\"onTimeInputButtonClick()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openTimePicker\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\">\n <svg lucideClock [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #timePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().timePicker\"\n cdkTrapFocus>\n <mona-time-selector\n focusOnMount\n [value]=\"value()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [max]=\"max()\"\n [min]=\"min()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [hourFormat]=\"effectiveHourFormat()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n</ng-template>\n"
678
+ }]
679
+ }],
680
+ ctorParameters: () => [],
681
+ propDecorators: {
682
+ timePopupTemplateRef: [{
683
+ type: i0.ViewChild,
684
+ args: ["timePopupTemplate", { isSignal: true }]
685
+ }],
686
+ ariaDescribedBy: [{
687
+ type: i0.Input,
688
+ args: [{
689
+ isSignal: true,
690
+ alias: "aria-describedby",
691
+ required: false
692
+ }]
693
+ }],
694
+ ariaLabel: [{
695
+ type: i0.Input,
696
+ args: [{
697
+ isSignal: true,
698
+ alias: "aria-label",
699
+ required: false
700
+ }]
701
+ }],
702
+ ariaLabelledBy: [{
703
+ type: i0.Input,
704
+ args: [{
705
+ isSignal: true,
706
+ alias: "aria-labelledby",
707
+ required: false
708
+ }]
709
+ }],
710
+ close: [{
711
+ type: i0.Output,
712
+ args: ["close"]
713
+ }],
714
+ closed: [{
715
+ type: i0.Output,
716
+ args: ["closed"]
717
+ }],
718
+ disabled: [{
719
+ type: i0.Input,
720
+ args: [{
721
+ isSignal: true,
722
+ alias: "disabled",
723
+ required: false
724
+ }]
725
+ }],
726
+ format: [{
727
+ type: i0.Input,
728
+ args: [{
729
+ isSignal: true,
730
+ alias: "format",
731
+ required: false
732
+ }]
733
+ }],
734
+ hourFormat: [{
735
+ type: i0.Input,
736
+ args: [{
737
+ isSignal: true,
738
+ alias: "hourFormat",
739
+ required: false
740
+ }]
741
+ }],
742
+ hourStep: [{
743
+ type: i0.Input,
744
+ args: [{
745
+ isSignal: true,
746
+ alias: "hourStep",
747
+ required: false
748
+ }]
749
+ }],
750
+ inputId: [{
751
+ type: i0.Input,
752
+ args: [{
753
+ isSignal: true,
754
+ alias: "inputId",
755
+ required: false
756
+ }]
757
+ }],
758
+ invalid: [{
759
+ type: i0.Input,
760
+ args: [{
761
+ isSignal: true,
762
+ alias: "invalid",
763
+ required: false
764
+ }]
765
+ }],
766
+ max: [{
767
+ type: i0.Input,
768
+ args: [{
769
+ isSignal: true,
770
+ alias: "max",
771
+ required: false
772
+ }]
773
+ }],
774
+ min: [{
775
+ type: i0.Input,
776
+ args: [{
777
+ isSignal: true,
778
+ alias: "min",
779
+ required: false
780
+ }]
781
+ }],
782
+ minuteStep: [{
783
+ type: i0.Input,
784
+ args: [{
785
+ isSignal: true,
786
+ alias: "minuteStep",
787
+ required: false
788
+ }]
789
+ }],
790
+ open: [{
791
+ type: i0.Output,
792
+ args: ["open"]
793
+ }],
794
+ opened: [{
795
+ type: i0.Output,
796
+ args: ["opened"]
797
+ }],
798
+ placeholder: [{
799
+ type: i0.Input,
800
+ args: [{
801
+ isSignal: true,
802
+ alias: "placeholder",
803
+ required: false
804
+ }]
805
+ }],
806
+ popupClass: [{
807
+ type: i0.Input,
808
+ args: [{
809
+ isSignal: true,
810
+ alias: "popupClass",
811
+ required: false
812
+ }]
813
+ }],
814
+ popupHeight: [{
815
+ type: i0.Input,
816
+ args: [{
817
+ isSignal: true,
818
+ alias: "popupHeight",
819
+ required: false
820
+ }]
821
+ }],
822
+ popupWidth: [{
823
+ type: i0.Input,
824
+ args: [{
825
+ isSignal: true,
826
+ alias: "popupWidth",
827
+ required: false
828
+ }]
829
+ }],
830
+ readonly: [{
831
+ type: i0.Input,
832
+ args: [{
833
+ isSignal: true,
834
+ alias: "readonly",
835
+ required: false
836
+ }]
837
+ }],
838
+ readonlyInput: [{
839
+ type: i0.Input,
840
+ args: [{
841
+ isSignal: true,
842
+ alias: "readonlyInput",
843
+ required: false
844
+ }]
845
+ }],
846
+ required: [{
847
+ type: i0.Input,
848
+ args: [{
849
+ isSignal: true,
850
+ alias: "required",
851
+ required: false
852
+ }]
853
+ }],
854
+ rounded: [{
855
+ type: i0.Input,
856
+ args: [{
857
+ isSignal: true,
858
+ alias: "rounded",
859
+ required: false
860
+ }]
861
+ }],
862
+ secondStep: [{
863
+ type: i0.Input,
864
+ args: [{
865
+ isSignal: true,
866
+ alias: "secondStep",
867
+ required: false
868
+ }]
869
+ }],
870
+ showClearButton: [{
871
+ type: i0.Input,
872
+ args: [{
873
+ isSignal: true,
874
+ alias: "showClearButton",
875
+ required: false
876
+ }]
877
+ }],
878
+ showSeconds: [{
879
+ type: i0.Input,
880
+ args: [{
881
+ isSignal: true,
882
+ alias: "showSeconds",
883
+ required: false
884
+ }]
885
+ }],
886
+ size: [{
887
+ type: i0.Input,
888
+ args: [{
889
+ isSignal: true,
890
+ alias: "size",
891
+ required: false
892
+ }]
893
+ }],
894
+ touch: [{
895
+ type: i0.Output,
896
+ args: ["touch"]
897
+ }],
898
+ touched: [{
899
+ type: i0.Input,
900
+ args: [{
901
+ isSignal: true,
902
+ alias: "touched",
903
+ required: false
904
+ }]
905
+ }],
906
+ userClass: [{
907
+ type: i0.Input,
908
+ args: [{
909
+ isSignal: true,
910
+ alias: "class",
911
+ required: false
912
+ }]
913
+ }],
914
+ value: [{
915
+ type: i0.Input,
916
+ args: [{
917
+ isSignal: true,
918
+ alias: "value",
919
+ required: false
920
+ }]
921
+ }, {
922
+ type: i0.Output,
923
+ args: ["valueChange"]
924
+ }]
925
+ }
76
926
  });
77
-
78
- class TimePickerComponent {
79
- #destroyRef;
80
- #dropdownService;
81
- #hostElementRef;
82
- #i18n;
83
- constructor() {
84
- this.#destroyRef = inject(DestroyRef);
85
- this.#dropdownService = inject(DropdownService);
86
- this.#hostElementRef = inject(ElementRef);
87
- this.#i18n = inject(MonaI18nService);
88
- this.baseClass = computed(() => {
89
- const focused = this.#dropdownService.popupRef() != null;
90
- const rounded = this.rounded();
91
- const size = this.size();
92
- const variantClass = timePickerBaseThemeVariants({ focused, rounded, size });
93
- const userClass = this.userClass();
94
- return twMerge(variantClass, userClass);
95
- }, /* @ts-ignore */
96
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
97
- this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
98
- this.effectiveFormat = computed(() => {
99
- return (this.format() ??
100
- getLocaleTimeInputFormat(this.#i18n.localeId(), {
101
- hourFormat: this.effectiveHourFormat(),
102
- showSeconds: this.showSeconds()
103
- }));
104
- }, /* @ts-ignore */
105
- ...(ngDevMode ? [{ debugName: "effectiveFormat" }] : /* istanbul ignore next */ []));
106
- this.effectiveHourFormat = computed(() => this.hourFormat() ?? getLocaleHourFormat(this.#i18n.localeId()), /* @ts-ignore */
107
- ...(ngDevMode ? [{ debugName: "effectiveHourFormat" }] : /* istanbul ignore next */ []));
108
- this.expanded = computed(() => this.#dropdownService.popupRef() != null, /* @ts-ignore */
109
- ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
110
- this.inputAttributes = computed(() => {
111
- return {
112
- "aria-autocomplete": "none",
113
- "aria-controls": this.popupId,
114
- // The binder drops `false`, and a combobox must always say whether it's expanded.
115
- "aria-expanded": this.expanded() ? "true" : "false",
116
- "aria-haspopup": "dialog",
117
- // The text box hides its clear button when read-only, so typing is blocked here instead.
118
- readonly: this.readonly() || this.readonlyInput(),
119
- role: "combobox"
120
- };
121
- }, /* @ts-ignore */
122
- ...(ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []));
123
- this.invalidState = computed(() => this.typedInput.errors().length > 0 ||
124
- (this.touched() && (this.invalid() || (this.required() && !this.value()))), /* @ts-ignore */
125
- ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
126
- this.messages = this.#i18n.componentMessages("timePicker", TIME_PICKER_DEFAULT_MESSAGES);
127
- this.pickerPopupClass = computed(() => {
128
- const rounded = this.rounded();
129
- const size = this.size();
130
- const userClass = this.popupClass();
131
- const variantClass = dropdownPopupThemeVariants({ rounded, size });
132
- return twMerge(variantClass, userClass);
133
- }, /* @ts-ignore */
134
- ...(ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []));
135
- this.popupId = createElementControlId();
136
- this.timePopupTemplateRef = viewChild.required("timePopupTemplate", /* @ts-ignore */
137
- ...(ngDevMode ? [{ debugName: "timePopupTemplateRef" }] : /* istanbul ignore next */ []));
138
- /**
139
- * @description Id of an element that describes the input, such as a hint or an error message.
140
- * @default ""
141
- */
142
- this.ariaDescribedBy = input("", { ...(ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {}), alias: "aria-describedby" });
143
- /**
144
- * @description Accessible name of the input. Prefer a visible label, linked through {@link inputId} or
145
- * `aria-labelledby`; the placeholder is not a label.
146
- * @default ""
147
- */
148
- this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
149
- /**
150
- * @description Id of the element that labels the input.
151
- * @default ""
152
- */
153
- this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
154
- /**
155
- * @description Emits when the popup is about to close. This event is preventable.
156
- */
157
- // eslint-disable-next-line @angular-eslint/no-output-native
158
- this.close = output();
159
- /**
160
- * @description Emits after the popup is closed.
161
- */
162
- this.closed = output();
163
- /**
164
- * @description Sets the disabled state of the time picker.
165
- * @default false
166
- */
167
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
168
- /**
169
- * @description Sets the format of the time picker. If not specified, derives from the active locale, hourFormat,
170
- * and showSeconds. Typed text is also accepted with one-digit hours, minutes and seconds.
171
- * @default null
172
- */
173
- this.format = input(null, /* @ts-ignore */
174
- ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
175
- /**
176
- * @description Sets the hour format of the time picker. When null, the active locale's clock is used: 12-hour for
177
- * en-US, 24-hour for de-DE.
178
- * @default null
179
- */
180
- this.hourFormat = input(null, /* @ts-ignore */
181
- ...(ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []));
182
- /**
183
- * @description Sets the hour step of the time picker.
184
- * @default 1
185
- */
186
- this.hourStep = input(1, /* @ts-ignore */
187
- ...(ngDevMode ? [{ debugName: "hourStep" }] : /* istanbul ignore next */ []));
188
- /**
189
- * @description Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the
190
- * time picker. A unique id is generated when it isn't set.
191
- * @default generated
192
- */
193
- this.inputId = input(createElementControlId(), /* @ts-ignore */
194
- ...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
195
- /**
196
- * @description Marks the time picker as invalid. When bound to a signal form field via `[formField]`,
197
- * this is written by the `FormField` directive.
198
- * @default false
199
- */
200
- this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
201
- /**
202
- * @description Sets the latest time of the time picker. Only the time of day is compared; a later typed time is
203
- * reported as a `maxDate` error.
204
- * @default undefined
205
- */
206
- this.max = input(undefined, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: value => (value instanceof Date ? value : undefined) });
207
- /**
208
- * @description Sets the earliest time of the time picker. Only the time of day is compared; an earlier typed time
209
- * is reported as a `minDate` error.
210
- * @default undefined
211
- */
212
- this.min = input(undefined, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: value => (value instanceof Date ? value : undefined) });
213
- /**
214
- * @description Sets the minute step of the time picker.
215
- * @default 1
216
- */
217
- this.minuteStep = input(1, /* @ts-ignore */
218
- ...(ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []));
219
- /**
220
- * @description Emits when the popup is about to open. This event is preventable.
221
- */
222
- this.open = output();
223
- /**
224
- * @description Emits after the popup is opened.
225
- */
226
- this.opened = output();
227
- /**
228
- * @description Sets the placeholder of the time picker.
229
- */
230
- this.placeholder = input("", /* @ts-ignore */
231
- ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
232
- /**
233
- * @description Sets the class of the popup element.
234
- * @default ""
235
- */
236
- this.popupClass = input("", /* @ts-ignore */
237
- ...(ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []));
238
- /**
239
- * @description Sets the height of the popup element. When not set, the popup fits the time selector.
240
- * @default undefined
241
- */
242
- this.popupHeight = input(/* @ts-ignore */
243
- ...(ngDevMode ? [undefined, { debugName: "popupHeight" }] : /* istanbul ignore next */ []));
244
- /**
245
- * @description Sets the width of the popup element. When not set, the popup fits the time selector.
246
- * @default undefined
247
- */
248
- this.popupWidth = input(/* @ts-ignore */
249
- ...(ngDevMode ? [undefined, { debugName: "popupWidth" }] : /* istanbul ignore next */ []));
250
- /**
251
- * @description Sets the readonly state of the time picker.
252
- * @default false
253
- */
254
- this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
255
- /**
256
- * @description When true, the input is readonly but the popup button remains enabled.
257
- * @default false
258
- */
259
- this.readonlyInput = input(false, { ...(ngDevMode ? { debugName: "readonlyInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
260
- /**
261
- * @description Sets the required state of the time picker.
262
- * When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
263
- * @default false
264
- */
265
- this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
266
- /**
267
- * @description Sets the border radius of the time picker.
268
- */
269
- this.rounded = input("medium", /* @ts-ignore */
270
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
271
- /**
272
- * @description Sets the second step of the time picker.
273
- * @default 1
274
- */
275
- this.secondStep = input(1, /* @ts-ignore */
276
- ...(ngDevMode ? [{ debugName: "secondStep" }] : /* istanbul ignore next */ []));
277
- /**
278
- * @description Sets the visibility of the clear button. Clearing empties the value at once.
279
- * @default false
280
- */
281
- this.showClearButton = input(false, { ...(ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
282
- /**
283
- * @description Sets the visibility of the second selector.
284
- * @default false
285
- */
286
- this.showSeconds = input(false, { ...(ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
287
- /**
288
- * @description Sets the size of the time picker.
289
- */
290
- this.size = input("medium", /* @ts-ignore */
291
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
292
- /**
293
- * @description Emitted when focus leaves the time picker and its popup.
294
- * The `FormField` directive listens to this to mark the field as touched.
295
- */
296
- this.touch = output();
297
- /**
298
- * @description Sets the touched state of the time picker. When bound to a signal form field via `[formField]`,
299
- * this is written by the `FormField` directive.
300
- * @default false
301
- */
302
- this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
303
- /** @description Extra classes for the input's container. */
304
- this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
305
- /**
306
- * @description Two-way bindable current time value. Typed text is written on Enter and when the input loses
307
- * focus, on the current value's day (today when empty); text that isn't a valid time keeps the previous value
308
- * and marks the field invalid.
309
- * @default null
310
- */
311
- this.value = model(null, /* @ts-ignore */
312
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
313
- this.typedInput = createTypedDateInput({
314
- constraints: () => ({ max: this.max(), min: this.min(), unit: "time" }),
315
- format: () => this.effectiveFormat(),
316
- localeId: () => this.#i18n.localeId(),
317
- resolve: (parsed, current) => {
318
- const day = current ?? new Date();
319
- return parsed
320
- .set({ year: day.getFullYear(), month: day.getMonth() + 1, day: day.getDate() })
321
- .toJSDate();
322
- },
323
- value: this.value
324
- });
325
- afterNextRender({
326
- read: () => this.setPopupCloseSubscription()
327
- });
328
- effect(() => {
329
- const popupTemplate = this.timePopupTemplateRef();
330
- untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
331
- });
332
- }
333
- /**
334
- * Focuses the input and places the caret after the text. Read-only pickers take focus too.
335
- * @param options Options passed to the native `focus()` call, such as `preventScroll`.
336
- */
337
- focus(options) {
338
- const input = this.#hostElementRef.nativeElement.querySelector("input");
339
- if (input) {
340
- input.focus(options);
341
- input.setSelectionRange(input.value.length, input.value.length);
342
- }
343
- }
344
- onFocusIn(event) {
345
- // The host is focusable only to pass focus on; focus inside it, such as a click in the text, stays put.
346
- if (event.target === this.#hostElementRef.nativeElement) {
347
- this.focus();
348
- }
349
- }
350
- onFocusOut(event) {
351
- // Removing a focused picker from the page fires focusout after it is destroyed.
352
- if (this.#destroyRef.destroyed) {
353
- return;
354
- }
355
- const nextTarget = event.relatedTarget;
356
- if (nextTarget instanceof Node) {
357
- const popupElement = this.#dropdownService.popupRef()?.overlayRef.overlayElement;
358
- if (this.#hostElementRef.nativeElement.contains(nextTarget) || popupElement?.contains(nextTarget)) {
359
- return;
360
- }
361
- }
362
- this.touch.emit();
363
- }
364
- onInputBlur() {
365
- this.typedInput.commit();
366
- }
367
- onKeydown(event) {
368
- if (this.effectiveDisabled() || this.readonly()) {
369
- return;
370
- }
371
- if (event.altKey && event.key === "ArrowDown") {
372
- event.preventDefault();
373
- this.openPopup();
374
- }
375
- else if ((event.altKey && event.key === "ArrowUp") || event.key === "Escape") {
376
- if (this.expanded()) {
377
- event.preventDefault();
378
- this.#dropdownService.popupRef()?.close();
379
- }
380
- }
381
- else if (event.key === "Enter" && event.target instanceof HTMLInputElement) {
382
- // Committed before a surrounding form submits; an IME uses Enter to confirm its text.
383
- if (!event.isComposing && event.keyCode !== 229) {
384
- this.typedInput.commit();
385
- }
386
- }
387
- }
388
- onTimeInputButtonClick() {
389
- if (this.effectiveDisabled() || this.readonly()) {
390
- return;
391
- }
392
- if (this.#dropdownService.popupRef()) {
393
- this.#dropdownService.popupRef()?.close();
394
- return;
395
- }
396
- this.openPopup();
397
- }
398
- onTimeSelectorValueChange(date) {
399
- this.value.set(date);
400
- this.#dropdownService.popupRef()?.close();
401
- }
402
- openPopup() {
403
- if (this.#dropdownService.popupRef()) {
404
- return;
405
- }
406
- this.#dropdownService.triggerPopupOpen$.next({
407
- height: this.popupHeight() || "fit-content",
408
- width: this.popupWidth() || "auto"
409
- });
410
- }
411
- setPopupCloseSubscription() {
412
- this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
413
- if (this.#dropdownService.focusCanReturn()) {
414
- this.focus();
415
- }
416
- else if (!this.#destroyRef.destroyed) {
417
- // Focus left from inside the popup, which the host's focusout doesn't see.
418
- this.touch.emit();
419
- }
420
- });
421
- }
422
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TimePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
423
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: TimePickerComponent, isStandalone: true, selector: "mona-time-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 }, 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 } }, 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: [
424
- DropdownService,
425
- {
426
- provide: DROPDOWN_POPUP_INPUT_TOKEN,
427
- useExisting: forwardRef(() => TimePickerComponent),
428
- multi: false
429
- }
430
- ], viewQueries: [{ propertyName: "timePopupTemplateRef", first: true, predicate: ["timePopupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }], ngImport: i0, template: "<mona-text-box\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [disabled]=\"effectiveDisabled()\"\n [inputId]=\"inputId()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"typedInput.text()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalidState()\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\"\n [clearButton]=\"showClearButton()\"\n (valueChange)=\"typedInput.edit($event)\"\n (inputBlur)=\"onInputBlur()\">\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n (click)=\"onTimeInputButtonClick()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openTimePicker\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\">\n <svg lucideClock [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #timePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().timePicker\"\n cdkTrapFocus>\n <mona-time-selector\n focusOnMount\n [value]=\"value()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [max]=\"max()\"\n [min]=\"min()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [hourFormat]=\"effectiveHourFormat()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n</ng-template>\n", dependencies: [{ kind: "component", type: LucideClock, selector: "svg[lucideClock]" }, { 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: 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"] }] }); }
431
- }
432
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TimePickerComponent, decorators: [{
433
- type: Component,
434
- args: [{ selector: "mona-time-picker", providers: [
435
- DropdownService,
436
- {
437
- provide: DROPDOWN_POPUP_INPUT_TOKEN,
438
- useExisting: forwardRef(() => TimePickerComponent),
439
- multi: false
440
- }
441
- ], imports: [
442
- LucideClock,
443
- ButtonDirective,
444
- TimeSelectorComponent,
445
- TextBoxComponent,
446
- TextBoxSuffixTemplateDirective,
447
- CdkTrapFocus
448
- ], hostDirectives: [DropdownPopupHandlerDirective], host: {
449
- // The ARIA inputs below are applied to the inner input, so the host must not keep the static attributes.
450
- "[attr.aria-describedby]": "null",
451
- "[attr.aria-label]": "null",
452
- "[attr.aria-labelledby]": "null",
453
- "[attr.tabindex]": "effectiveDisabled() ? null : -1",
454
- "[attr.aria-invalid]": "invalidState() ? 'true' : null",
455
- "[attr.data-disabled]": "effectiveDisabled() || null",
456
- "[attr.data-expanded]": "expanded()",
457
- "[attr.data-invalid]": "invalidState() || null",
458
- "[attr.data-readonly]": "readonly() || null",
459
- "[class]": "baseClass()",
460
- "(focusin)": "onFocusIn($event)",
461
- "(focusout)": "onFocusOut($event)",
462
- "(keydown)": "onKeydown($event)"
463
- }, template: "<mona-text-box\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [disabled]=\"effectiveDisabled()\"\n [inputId]=\"inputId()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"typedInput.text()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalidState()\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\"\n [clearButton]=\"showClearButton()\"\n (valueChange)=\"typedInput.edit($event)\"\n (inputBlur)=\"onInputBlur()\">\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n (click)=\"onTimeInputButtonClick()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openTimePicker\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\">\n <svg lucideClock [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #timePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().timePicker\"\n cdkTrapFocus>\n <mona-time-selector\n focusOnMount\n [value]=\"value()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [max]=\"max()\"\n [min]=\"min()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [hourFormat]=\"effectiveHourFormat()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n</ng-template>\n" }]
464
- }], ctorParameters: () => [], propDecorators: { timePopupTemplateRef: [{ type: i0.ViewChild, args: ["timePopupTemplate", { 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 }] }], 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"] }] } });
465
-
466
- /*
467
- * Public API Surface of @nanahoshi/mona-ui/time-picker
468
- */
469
-
470
- /**
471
- * Generated bundle index. Do not edit.
472
- */
473
-
474
927
  export { TIME_PICKER_DEFAULT_MESSAGES, TimePickerComponent };
475
- //# sourceMappingURL=nanahoshi-mona-ui-time-picker.mjs.map
928
+
929
+ //# sourceMappingURL=nanahoshi-mona-ui-time-picker.mjs.map