@4sh/ui-kit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +7 -0
  3. package/README.md +229 -0
  4. package/fesm2022/4sh-ui-kit-forms.mjs +501 -0
  5. package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -0
  6. package/fesm2022/4sh-ui-kit-motion.mjs +155 -0
  7. package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -0
  8. package/fesm2022/4sh-ui-kit-overlay.mjs +61 -0
  9. package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -0
  10. package/fesm2022/4sh-ui-kit-theming.mjs +120 -0
  11. package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -0
  12. package/fesm2022/4sh-ui-kit-types.mjs +12 -0
  13. package/fesm2022/4sh-ui-kit-types.mjs.map +1 -0
  14. package/fesm2022/4sh-ui-kit-ui-accordion.mjs +244 -0
  15. package/fesm2022/4sh-ui-kit-ui-accordion.mjs.map +1 -0
  16. package/fesm2022/4sh-ui-kit-ui-alert.mjs +160 -0
  17. package/fesm2022/4sh-ui-kit-ui-alert.mjs.map +1 -0
  18. package/fesm2022/4sh-ui-kit-ui-autocomplete.mjs +926 -0
  19. package/fesm2022/4sh-ui-kit-ui-autocomplete.mjs.map +1 -0
  20. package/fesm2022/4sh-ui-kit-ui-avatar-group.mjs +34 -0
  21. package/fesm2022/4sh-ui-kit-ui-avatar-group.mjs.map +1 -0
  22. package/fesm2022/4sh-ui-kit-ui-avatar.mjs +122 -0
  23. package/fesm2022/4sh-ui-kit-ui-avatar.mjs.map +1 -0
  24. package/fesm2022/4sh-ui-kit-ui-badge.mjs +95 -0
  25. package/fesm2022/4sh-ui-kit-ui-badge.mjs.map +1 -0
  26. package/fesm2022/4sh-ui-kit-ui-breadcrumb.mjs +190 -0
  27. package/fesm2022/4sh-ui-kit-ui-breadcrumb.mjs.map +1 -0
  28. package/fesm2022/4sh-ui-kit-ui-button-split.mjs +151 -0
  29. package/fesm2022/4sh-ui-kit-ui-button-split.mjs.map +1 -0
  30. package/fesm2022/4sh-ui-kit-ui-button.mjs +222 -0
  31. package/fesm2022/4sh-ui-kit-ui-button.mjs.map +1 -0
  32. package/fesm2022/4sh-ui-kit-ui-card.mjs +164 -0
  33. package/fesm2022/4sh-ui-kit-ui-card.mjs.map +1 -0
  34. package/fesm2022/4sh-ui-kit-ui-checkbox.mjs +118 -0
  35. package/fesm2022/4sh-ui-kit-ui-checkbox.mjs.map +1 -0
  36. package/fesm2022/4sh-ui-kit-ui-chip.mjs +205 -0
  37. package/fesm2022/4sh-ui-kit-ui-chip.mjs.map +1 -0
  38. package/fesm2022/4sh-ui-kit-ui-context-menu.mjs +219 -0
  39. package/fesm2022/4sh-ui-kit-ui-context-menu.mjs.map +1 -0
  40. package/fesm2022/4sh-ui-kit-ui-datepicker.mjs +1508 -0
  41. package/fesm2022/4sh-ui-kit-ui-datepicker.mjs.map +1 -0
  42. package/fesm2022/4sh-ui-kit-ui-drawer.mjs +300 -0
  43. package/fesm2022/4sh-ui-kit-ui-drawer.mjs.map +1 -0
  44. package/fesm2022/4sh-ui-kit-ui-empty-state.mjs +148 -0
  45. package/fesm2022/4sh-ui-kit-ui-empty-state.mjs.map +1 -0
  46. package/fesm2022/4sh-ui-kit-ui-field.mjs +102 -0
  47. package/fesm2022/4sh-ui-kit-ui-field.mjs.map +1 -0
  48. package/fesm2022/4sh-ui-kit-ui-file-upload.mjs +568 -0
  49. package/fesm2022/4sh-ui-kit-ui-file-upload.mjs.map +1 -0
  50. package/fesm2022/4sh-ui-kit-ui-helper.mjs +85 -0
  51. package/fesm2022/4sh-ui-kit-ui-helper.mjs.map +1 -0
  52. package/fesm2022/4sh-ui-kit-ui-icon.mjs +98 -0
  53. package/fesm2022/4sh-ui-kit-ui-icon.mjs.map +1 -0
  54. package/fesm2022/4sh-ui-kit-ui-image.mjs +201 -0
  55. package/fesm2022/4sh-ui-kit-ui-image.mjs.map +1 -0
  56. package/fesm2022/4sh-ui-kit-ui-input-group.mjs +119 -0
  57. package/fesm2022/4sh-ui-kit-ui-input-group.mjs.map +1 -0
  58. package/fesm2022/4sh-ui-kit-ui-input-mask.mjs +125 -0
  59. package/fesm2022/4sh-ui-kit-ui-input-mask.mjs.map +1 -0
  60. package/fesm2022/4sh-ui-kit-ui-input-number.mjs +234 -0
  61. package/fesm2022/4sh-ui-kit-ui-input-number.mjs.map +1 -0
  62. package/fesm2022/4sh-ui-kit-ui-input-otp.mjs +288 -0
  63. package/fesm2022/4sh-ui-kit-ui-input-otp.mjs.map +1 -0
  64. package/fesm2022/4sh-ui-kit-ui-input-tags.mjs +679 -0
  65. package/fesm2022/4sh-ui-kit-ui-input-tags.mjs.map +1 -0
  66. package/fesm2022/4sh-ui-kit-ui-input.mjs +121 -0
  67. package/fesm2022/4sh-ui-kit-ui-input.mjs.map +1 -0
  68. package/fesm2022/4sh-ui-kit-ui-label.mjs +61 -0
  69. package/fesm2022/4sh-ui-kit-ui-label.mjs.map +1 -0
  70. package/fesm2022/4sh-ui-kit-ui-link.mjs +147 -0
  71. package/fesm2022/4sh-ui-kit-ui-link.mjs.map +1 -0
  72. package/fesm2022/4sh-ui-kit-ui-menu.mjs +484 -0
  73. package/fesm2022/4sh-ui-kit-ui-menu.mjs.map +1 -0
  74. package/fesm2022/4sh-ui-kit-ui-modal.mjs +555 -0
  75. package/fesm2022/4sh-ui-kit-ui-modal.mjs.map +1 -0
  76. package/fesm2022/4sh-ui-kit-ui-nudger.mjs +168 -0
  77. package/fesm2022/4sh-ui-kit-ui-nudger.mjs.map +1 -0
  78. package/fesm2022/4sh-ui-kit-ui-paginator.mjs +245 -0
  79. package/fesm2022/4sh-ui-kit-ui-paginator.mjs.map +1 -0
  80. package/fesm2022/4sh-ui-kit-ui-popover.mjs +296 -0
  81. package/fesm2022/4sh-ui-kit-ui-popover.mjs.map +1 -0
  82. package/fesm2022/4sh-ui-kit-ui-progress-bar.mjs +124 -0
  83. package/fesm2022/4sh-ui-kit-ui-progress-bar.mjs.map +1 -0
  84. package/fesm2022/4sh-ui-kit-ui-radio.mjs +92 -0
  85. package/fesm2022/4sh-ui-kit-ui-radio.mjs.map +1 -0
  86. package/fesm2022/4sh-ui-kit-ui-rating.mjs +185 -0
  87. package/fesm2022/4sh-ui-kit-ui-rating.mjs.map +1 -0
  88. package/fesm2022/4sh-ui-kit-ui-read-only.mjs +146 -0
  89. package/fesm2022/4sh-ui-kit-ui-read-only.mjs.map +1 -0
  90. package/fesm2022/4sh-ui-kit-ui-segment-control.mjs +386 -0
  91. package/fesm2022/4sh-ui-kit-ui-segment-control.mjs.map +1 -0
  92. package/fesm2022/4sh-ui-kit-ui-select.mjs +868 -0
  93. package/fesm2022/4sh-ui-kit-ui-select.mjs.map +1 -0
  94. package/fesm2022/4sh-ui-kit-ui-separator.mjs +77 -0
  95. package/fesm2022/4sh-ui-kit-ui-separator.mjs.map +1 -0
  96. package/fesm2022/4sh-ui-kit-ui-sidebar.mjs +577 -0
  97. package/fesm2022/4sh-ui-kit-ui-sidebar.mjs.map +1 -0
  98. package/fesm2022/4sh-ui-kit-ui-skeleton.mjs +81 -0
  99. package/fesm2022/4sh-ui-kit-ui-skeleton.mjs.map +1 -0
  100. package/fesm2022/4sh-ui-kit-ui-slider.mjs +340 -0
  101. package/fesm2022/4sh-ui-kit-ui-slider.mjs.map +1 -0
  102. package/fesm2022/4sh-ui-kit-ui-spinner.mjs +132 -0
  103. package/fesm2022/4sh-ui-kit-ui-spinner.mjs.map +1 -0
  104. package/fesm2022/4sh-ui-kit-ui-stepper.mjs +389 -0
  105. package/fesm2022/4sh-ui-kit-ui-stepper.mjs.map +1 -0
  106. package/fesm2022/4sh-ui-kit-ui-table.mjs +1406 -0
  107. package/fesm2022/4sh-ui-kit-ui-table.mjs.map +1 -0
  108. package/fesm2022/4sh-ui-kit-ui-tabs.mjs +503 -0
  109. package/fesm2022/4sh-ui-kit-ui-tabs.mjs.map +1 -0
  110. package/fesm2022/4sh-ui-kit-ui-tag.mjs +84 -0
  111. package/fesm2022/4sh-ui-kit-ui-tag.mjs.map +1 -0
  112. package/fesm2022/4sh-ui-kit-ui-textarea.mjs +119 -0
  113. package/fesm2022/4sh-ui-kit-ui-textarea.mjs.map +1 -0
  114. package/fesm2022/4sh-ui-kit-ui-toast.mjs +424 -0
  115. package/fesm2022/4sh-ui-kit-ui-toast.mjs.map +1 -0
  116. package/fesm2022/4sh-ui-kit-ui-toggle.mjs +120 -0
  117. package/fesm2022/4sh-ui-kit-ui-toggle.mjs.map +1 -0
  118. package/fesm2022/4sh-ui-kit-ui-tooltip.mjs +445 -0
  119. package/fesm2022/4sh-ui-kit-ui-tooltip.mjs.map +1 -0
  120. package/fesm2022/4sh-ui-kit.mjs +16 -0
  121. package/fesm2022/4sh-ui-kit.mjs.map +1 -0
  122. package/package.json +287 -0
  123. package/styles/base/_base.scss +19 -0
  124. package/styles/base/_motion.scss +144 -0
  125. package/styles/base/_typography.scss +99 -0
  126. package/styles/generated/_tokens-breakpoint.scss +8 -0
  127. package/styles/generated/_tokens-metrics.scss +37 -0
  128. package/styles/generated/_tokens-primitives.scss +284 -0
  129. package/styles/generated/_tokens-responsive.scss +99 -0
  130. package/styles/generated/_tokens-semantics.scss +1274 -0
  131. package/styles/generated/_tokens-styles.scss +35 -0
  132. package/styles/generated/_tokens-transitions.scss +11 -0
  133. package/styles/generated/_tokens-typography.scss +14 -0
  134. package/styles/generated/_tokens.scss +10 -0
  135. package/styles/index.scss +25 -0
  136. package/styles/settings/_ui-config.scss +67 -0
  137. package/styles/utils/_functions.scss +67 -0
  138. package/styles/utils/_helpers.scss +129 -0
  139. package/styles/utils/_mixins.scss +186 -0
  140. package/styles/utils/_motion.scss +47 -0
  141. package/styles/utils/_overlay.scss +26 -0
  142. package/styles/utils.scss +15 -0
  143. package/styles.css +1 -0
  144. package/types/4sh-ui-kit-forms.d.ts +259 -0
  145. package/types/4sh-ui-kit-motion.d.ts +111 -0
  146. package/types/4sh-ui-kit-overlay.d.ts +31 -0
  147. package/types/4sh-ui-kit-theming.d.ts +54 -0
  148. package/types/4sh-ui-kit-types.d.ts +13 -0
  149. package/types/4sh-ui-kit-ui-accordion.d.ts +140 -0
  150. package/types/4sh-ui-kit-ui-alert.d.ts +89 -0
  151. package/types/4sh-ui-kit-ui-autocomplete.d.ts +411 -0
  152. package/types/4sh-ui-kit-ui-avatar-group.d.ts +17 -0
  153. package/types/4sh-ui-kit-ui-avatar.d.ts +55 -0
  154. package/types/4sh-ui-kit-ui-badge.d.ts +38 -0
  155. package/types/4sh-ui-kit-ui-breadcrumb.d.ts +131 -0
  156. package/types/4sh-ui-kit-ui-button-split.d.ts +102 -0
  157. package/types/4sh-ui-kit-ui-button.d.ts +91 -0
  158. package/types/4sh-ui-kit-ui-card.d.ts +102 -0
  159. package/types/4sh-ui-kit-ui-checkbox.d.ts +54 -0
  160. package/types/4sh-ui-kit-ui-chip.d.ts +114 -0
  161. package/types/4sh-ui-kit-ui-context-menu.d.ts +105 -0
  162. package/types/4sh-ui-kit-ui-datepicker.d.ts +539 -0
  163. package/types/4sh-ui-kit-ui-drawer.d.ts +147 -0
  164. package/types/4sh-ui-kit-ui-empty-state.d.ts +93 -0
  165. package/types/4sh-ui-kit-ui-field.d.ts +53 -0
  166. package/types/4sh-ui-kit-ui-file-upload.d.ts +268 -0
  167. package/types/4sh-ui-kit-ui-helper.d.ts +46 -0
  168. package/types/4sh-ui-kit-ui-icon.d.ts +69 -0
  169. package/types/4sh-ui-kit-ui-image.d.ts +88 -0
  170. package/types/4sh-ui-kit-ui-input-group.d.ts +54 -0
  171. package/types/4sh-ui-kit-ui-input-mask.d.ts +63 -0
  172. package/types/4sh-ui-kit-ui-input-number.d.ts +96 -0
  173. package/types/4sh-ui-kit-ui-input-otp.d.ts +130 -0
  174. package/types/4sh-ui-kit-ui-input-tags.d.ts +350 -0
  175. package/types/4sh-ui-kit-ui-input.d.ts +78 -0
  176. package/types/4sh-ui-kit-ui-label.d.ts +36 -0
  177. package/types/4sh-ui-kit-ui-link.d.ts +72 -0
  178. package/types/4sh-ui-kit-ui-menu.d.ts +235 -0
  179. package/types/4sh-ui-kit-ui-modal.d.ts +241 -0
  180. package/types/4sh-ui-kit-ui-nudger.d.ts +79 -0
  181. package/types/4sh-ui-kit-ui-paginator.d.ts +150 -0
  182. package/types/4sh-ui-kit-ui-popover.d.ts +125 -0
  183. package/types/4sh-ui-kit-ui-progress-bar.d.ts +82 -0
  184. package/types/4sh-ui-kit-ui-radio.d.ts +44 -0
  185. package/types/4sh-ui-kit-ui-rating.d.ts +90 -0
  186. package/types/4sh-ui-kit-ui-read-only.d.ts +70 -0
  187. package/types/4sh-ui-kit-ui-segment-control.d.ts +184 -0
  188. package/types/4sh-ui-kit-ui-select.d.ts +392 -0
  189. package/types/4sh-ui-kit-ui-separator.d.ts +43 -0
  190. package/types/4sh-ui-kit-ui-sidebar.d.ts +358 -0
  191. package/types/4sh-ui-kit-ui-skeleton.d.ts +52 -0
  192. package/types/4sh-ui-kit-ui-slider.d.ts +127 -0
  193. package/types/4sh-ui-kit-ui-spinner.d.ts +67 -0
  194. package/types/4sh-ui-kit-ui-stepper.d.ts +220 -0
  195. package/types/4sh-ui-kit-ui-table.d.ts +570 -0
  196. package/types/4sh-ui-kit-ui-tabs.d.ts +225 -0
  197. package/types/4sh-ui-kit-ui-tag.d.ts +46 -0
  198. package/types/4sh-ui-kit-ui-textarea.d.ts +61 -0
  199. package/types/4sh-ui-kit-ui-toast.d.ts +247 -0
  200. package/types/4sh-ui-kit-ui-toggle.d.ts +67 -0
  201. package/types/4sh-ui-kit-ui-tooltip.d.ts +167 -0
  202. package/types/4sh-ui-kit.d.ts +4 -0
@@ -0,0 +1,1508 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, booleanAttribute, numberAttribute, output, contentChild, inject, LOCALE_ID, viewChild, ElementRef, signal, linkedSignal, computed, effect, untracked, forwardRef, Component } from '@angular/core';
3
+ import { NgTemplateOutlet } from '@angular/common';
4
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import * as i1 from '@angular/cdk/overlay';
6
+ import { OverlayModule } from '@angular/cdk/overlay';
7
+ import { BaseFormField, dropdownOverlayPositions, buildMaskSlots, extractMaskData, autoFormatSegments, caretForMask } from '@4sh/ui-kit/forms';
8
+ import { CdkTrapFocus } from '@angular/cdk/a11y';
9
+ import { UiInput } from '@4sh/ui-kit/ui-input';
10
+ import { UiButton } from '@4sh/ui-kit/ui-button';
11
+ import { UiIcon } from '@4sh/ui-kit/ui-icon';
12
+ import { closeOnNavigation } from '@4sh/ui-kit/overlay';
13
+
14
+ // --- Pure date helpers (module-level, side-effect free) ----------------
15
+ function startOfDay(d) {
16
+ const x = new Date(d);
17
+ x.setHours(0, 0, 0, 0);
18
+ return x;
19
+ }
20
+ function firstOfMonth(d) {
21
+ return new Date(d.getFullYear(), d.getMonth(), 1);
22
+ }
23
+ function isSameDay(a, b) {
24
+ if (!a || !b)
25
+ return false;
26
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
27
+ }
28
+ function addDays(d, n) {
29
+ const x = new Date(d);
30
+ x.setDate(x.getDate() + n);
31
+ return x;
32
+ }
33
+ function addMonths(d, n) {
34
+ return new Date(d.getFullYear(), d.getMonth() + n, 1);
35
+ }
36
+ /** Build a Date and reject overflowed components (e.g. 31 Feb). */
37
+ function finalizeParsed(year, month, day, h, min) {
38
+ if (month < 0 || month > 11 || day < 1 || day > 31 || h > 23 || min > 59)
39
+ return null;
40
+ const d = new Date(year, month, day, h, min, 0, 0);
41
+ if (d.getFullYear() !== year || d.getMonth() !== month || d.getDate() !== day)
42
+ return null;
43
+ return d;
44
+ }
45
+ const ISO_DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
46
+ const ISO_DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
47
+ function pad2(n) {
48
+ return String(n).padStart(2, '0');
49
+ }
50
+ /** Serialize a `Date` to `"yyyy-MM-dd"` from its LOCAL components — never `toISOString()`
51
+ * (which converts to UTC and can shift the day by ±1 depending on the timezone). */
52
+ function toIsoDate(d) {
53
+ return `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
54
+ }
55
+ /** `"yyyy-MM-ddTHH:mm"` — date part built the same local, never-UTC way as {@link toIsoDate}. */
56
+ function toIsoDateTime(d) {
57
+ return `${toIsoDate(d)}T${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
58
+ }
59
+ /** Strict `"yyyy-MM-dd"` parser (rejects anything else, incl. overflowed dates via `finalizeParsed`). */
60
+ function parseIsoDate(s) {
61
+ const m = ISO_DATE_RE.exec(s);
62
+ if (!m)
63
+ return null;
64
+ return finalizeParsed(Number(m[1]), Number(m[2]) - 1, Number(m[3]), 0, 0);
65
+ }
66
+ /** Strict `"yyyy-MM-ddTHH:mm"` parser (`showTime`/`timeOnly` round-trip). */
67
+ function parseIsoDateTime(s) {
68
+ const m = ISO_DATETIME_RE.exec(s);
69
+ if (!m)
70
+ return null;
71
+ return finalizeParsed(Number(m[1]), Number(m[2]) - 1, Number(m[3]), Number(m[4]), Number(m[5]));
72
+ }
73
+ /** Accepts a `Date` as-is, or parses a `"yyyy-MM-dd"` string — used to let config inputs
74
+ * (`minDate`/`maxDate`/`disabledDates`) take either shape. Invalid strings degrade to `null`
75
+ * (no constraint) rather than throwing: a malformed config shouldn't crash the picker. */
76
+ function normalizeDateInput(v) {
77
+ if (!v)
78
+ return null;
79
+ return v instanceof Date ? v : parseIsoDate(v);
80
+ }
81
+ let nextPanelUid = 0;
82
+ /**
83
+ * ui-datepicker — headless date / month / year (and optional time) picker.
84
+ *
85
+ * A readonly {@link UiInput} trigger opens a token-styled panel in a CDK overlay
86
+ * (or renders inline). Supports single / multiple / range selection, drill-down
87
+ * views (day → month → year), `MonthPicker`/`YearPicker` modes (`view`), several
88
+ * months side-by-side (`numberOfMonths`), a time row, and roving keyboard focus.
89
+ *
90
+ * Value is `Date` or ISO `"yyyy-MM-dd"` string depending on the **required** `valueType` input (no
91
+ * default — the consumer must pick one), wired through `ControlValueAccessor` on
92
+ * {@link BaseFormField} (shared label / helper / level / validation / states). `writeValue`
93
+ * accepts either shape transparently; what gets **emitted** always follows `valueType` — see
94
+ * {@link DatepickerValueType}.
95
+ *
96
+ * Customisation: `panelStyleClass`, the `#date` cell template
97
+ * (`let-date let-selected="selected"`) and the `#buttonbar` template
98
+ * (`let-todayCallback let-clearCallback`), plus the local SCSS variables.
99
+ */
100
+ class UiDatepicker extends BaseFormField {
101
+ /** @ignore First selected date (for view seeding / time / display). */
102
+ firstSelectedFrom(value) {
103
+ if (!value)
104
+ return null;
105
+ const arr = Array.isArray(value) ? value : [value];
106
+ return arr.find((d) => d instanceof Date) ?? null;
107
+ }
108
+ /** @ignore Date → ISO string, date-only unless `showTime`/`timeOnly`. */
109
+ toIsoValue(d) {
110
+ return this.hasTimeComponent() ? toIsoDateTime(d) : toIsoDate(d);
111
+ }
112
+ /** @ignore ISO string → Date, `null` if malformed (never throws). */
113
+ fromIsoValue(s) {
114
+ return this.hasTimeComponent() ? parseIsoDateTime(s) : parseIsoDate(s);
115
+ }
116
+ /** @ignore Internal Date → the shape `valueType` commits to emitting: a fresh `Date`
117
+ * (normalized to midnight when no time is shown — never the original reference) in `'date'`
118
+ * mode, an ISO string in `'iso'` mode. The single point deciding the emitted type. */
119
+ serializeValue(d) {
120
+ if (this.valueType() === 'iso')
121
+ return this.toIsoValue(d);
122
+ return this.hasTimeComponent() ? new Date(d) : startOfDay(d);
123
+ }
124
+ /** @ignore A single incoming item, `Date` or ISO string, auto-detected — `writeValue` accepts
125
+ * either shape regardless of `valueType` (only the emitted side commits to one). Cloned when
126
+ * already a `Date` (never the caller's own reference) — symmetric with `serializeValue`,
127
+ * which never hands back the internal reference either; protects against the caller later
128
+ * mutating that `Date` in place and silently desyncing `internalValue`. */
129
+ parseValue(v) {
130
+ return v instanceof Date ? new Date(v) : this.fromIsoValue(v);
131
+ }
132
+ /** @ignore Internal Date(s) → public value, right before it reaches `modelValue`/the CVA.
133
+ * The cast is safe: `serializeValue` only branches on `valueType()`, constant across the
134
+ * `map`, so the array is always homogeneous (`Date[]` or `string[]`, never mixed). */
135
+ toExternalValue(value) {
136
+ if (!value)
137
+ return null;
138
+ if (Array.isArray(value))
139
+ return value.map((d) => this.serializeValue(d));
140
+ return this.serializeValue(value);
141
+ }
142
+ /** @ignore Public value → internal Date(s), right as it enters via `writeValue`. Invalid
143
+ * entries are dropped rather than failing the whole value (a malformed item in a
144
+ * `multiple`/`range` array shouldn't wipe out the rest). */
145
+ toInternalValue(value) {
146
+ if (!value)
147
+ return null;
148
+ if (Array.isArray(value)) {
149
+ const parsed = value.map((v) => this.parseValue(v)).filter((d) => d !== null);
150
+ return parsed.length ? parsed : null;
151
+ }
152
+ return this.parseValue(value);
153
+ }
154
+ // --- Display ---------------------------------------------------------
155
+ /** @ignore */
156
+ formatDate(date) {
157
+ const custom = this.dateFormat();
158
+ if (custom)
159
+ return custom(date);
160
+ // Typeable trigger → numeric format that round-trips with the default parser.
161
+ if (this.allowInput()) {
162
+ const opts = { day: '2-digit', month: '2-digit', year: 'numeric' };
163
+ if (this.showTime()) {
164
+ opts.hour = '2-digit';
165
+ opts.minute = '2-digit';
166
+ }
167
+ return new Intl.DateTimeFormat(this.resolvedLocale(), opts).format(date);
168
+ }
169
+ const options = this.showTime()
170
+ ? { dateStyle: 'medium', timeStyle: 'short' }
171
+ : { dateStyle: 'medium' };
172
+ return new Intl.DateTimeFormat(this.resolvedLocale(), options).format(date);
173
+ }
174
+ /** @ignore Month-view display (numeric + round-trippable when the trigger is typeable). */
175
+ formatMonth(date) {
176
+ if (this.allowInput() && !this.dateFormat()) {
177
+ const yearFirst = this.dateFieldOrder().filter((f) => f !== 'day')[0] === 'year';
178
+ const mm = this.pad(date.getMonth() + 1);
179
+ const yyyy = String(date.getFullYear());
180
+ return yearFirst ? `${yyyy}/${mm}` : `${mm}/${yyyy}`;
181
+ }
182
+ return this.capitalize(new Intl.DateTimeFormat(this.resolvedLocale(), { month: 'long', year: 'numeric' }).format(date));
183
+ }
184
+ constructor() {
185
+ super();
186
+ /** Placeholder shown in the trigger when nothing is selected. */
187
+ this.placeholder = input(/* @ts-ignore */
188
+ ...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
189
+ /** FontAwesome icon of the trigger's toggle button. */
190
+ this.icon = input('calendar', /* @ts-ignore */
191
+ ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
192
+ /** Show the trigger's calendar toggle button. */
193
+ this.showIcon = input(true, { ...(ngDevMode ? { debugName: "showIcon" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
194
+ /** Accessible name of the toggle button (a11y). */
195
+ this.iconAriaLabel = input('Ouvrir le calendrier', /* @ts-ignore */
196
+ ...(ngDevMode ? [{ debugName: "iconAriaLabel" }] : /* istanbul ignore next */ []));
197
+ /** Show a clear (×) button in the trigger when a value is set. */
198
+ this.showClear = input(false, { ...(ngDevMode ? { debugName: "showClear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
199
+ /**
200
+ * Shape of the emitted value: `'date'` (a plain `Date` — matches a DTO round-tripped through
201
+ * `class-transformer`) or `'iso'` (ISO `"yyyy-MM-dd"` string, for a value read/written directly
202
+ * against a backend `LocalDate`). `writeValue` always accepts either shape regardless of this
203
+ * setting — it only governs what `valueChange`/`dateSelect` emit. **Required, no default**: the
204
+ * consumer must pick the one matching its own model's type rather than inherit a silent default.
205
+ */
206
+ this.valueType = input.required(/* @ts-ignore */
207
+ ...(ngDevMode ? [{ debugName: "valueType" }] : /* istanbul ignore next */ []));
208
+ /** Selection quantity: `single` (default), `multiple` or `range`. */
209
+ this.selectionMode = input('single', /* @ts-ignore */
210
+ ...(ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []));
211
+ /** Base picking granularity: `date` (default), `month` (MonthPicker) or `year` (YearPicker). */
212
+ this.view = input('date', /* @ts-ignore */
213
+ ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
214
+ /** Number of month panels shown side-by-side (date view only). */
215
+ this.numberOfMonths = input(1, { ...(ngDevMode ? { debugName: "numberOfMonths" } : /* istanbul ignore next */ {}), transform: numberAttribute });
216
+ /** Earliest selectable date (inclusive). `Date` or ISO `"yyyy-MM-dd"`. */
217
+ this.minDate = input(null, /* @ts-ignore */
218
+ ...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
219
+ /** Latest selectable date (inclusive). `Date` or ISO `"yyyy-MM-dd"`. */
220
+ this.maxDate = input(null, /* @ts-ignore */
221
+ ...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
222
+ /** Individual dates to disable. `Date` or ISO `"yyyy-MM-dd"`, mixable. */
223
+ this.disabledDates = input([], /* @ts-ignore */
224
+ ...(ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []));
225
+ /** Week days to disable (0 = Sunday … 6 = Saturday). */
226
+ this.disabledDays = input([], /* @ts-ignore */
227
+ ...(ngDevMode ? [{ debugName: "disabledDays" }] : /* istanbul ignore next */ []));
228
+ /** First day of the week (0 = Sunday … 6 = Saturday). Defaults to Monday. */
229
+ this.firstDayOfWeek = input(1, { ...(ngDevMode ? { debugName: "firstDayOfWeek" } : /* istanbul ignore next */ {}), transform: numberAttribute });
230
+ /** BCP-47 locale for names and default formatting. Defaults to `LOCALE_ID`. */
231
+ this.locale = input(/* @ts-ignore */
232
+ ...(ngDevMode ? [undefined, { debugName: "locale" }] : /* istanbul ignore next */ []));
233
+ /** Custom display formatter for a single date (overrides the default `Intl` format). */
234
+ this.dateFormat = input(/* @ts-ignore */
235
+ ...(ngDevMode ? [undefined, { debugName: "dateFormat" }] : /* istanbul ignore next */ []));
236
+ /**
237
+ * Allow typing the date directly in the trigger (single selection only).
238
+ * The typed text is parsed on blur / `Enter`; an unparsable value reverts to
239
+ * the previously displayed one. When enabled (and no custom `dateFormat`), the
240
+ * value is displayed in a numeric locale format so it round-trips with typing.
241
+ * Has no effect in `timeOnly` mode: the trigger stays read-only there.
242
+ */
243
+ this.allowInput = input(false, { ...(ngDevMode ? { debugName: "allowInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
244
+ /**
245
+ * Custom parser for the typed text (symmetric with `dateFormat`). Return `null`
246
+ * to reject the input. When omitted, a locale-aware numeric parser is used.
247
+ */
248
+ this.parseDate = input(/* @ts-ignore */
249
+ ...(ngDevMode ? [undefined, { debugName: "parseDate" }] : /* istanbul ignore next */ []));
250
+ /** Enable the time selection row. */
251
+ this.showTime = input(false, { ...(ngDevMode ? { debugName: "showTime" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
252
+ /** Time-only mode: hide the calendar, keep the time row. */
253
+ this.timeOnly = input(false, { ...(ngDevMode ? { debugName: "timeOnly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
254
+ /** 12h (AM/PM) or 24h clock. */
255
+ this.hourFormat = input('24', /* @ts-ignore */
256
+ ...(ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []));
257
+ /** Minute increment of the time stepper (buttons / arrow keys — typing stays exact). */
258
+ this.stepMinute = input(1, { ...(ngDevMode ? { debugName: "stepMinute" } : /* istanbul ignore next */ {}), transform: numberAttribute });
259
+ /**
260
+ * Let the hours and minutes be typed directly in the time row (default).
261
+ */
262
+ this.editableTime = input(true, { ...(ngDevMode ? { debugName: "editableTime" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
263
+ /** Show the bottom button bar (Today / Clear) — or the `#buttonbar` template. */
264
+ this.showButtonBar = input(false, { ...(ngDevMode ? { debugName: "showButtonBar" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
265
+ /** Label of the default "Today" button. */
266
+ this.todayLabel = input("Aujourd'hui", /* @ts-ignore */
267
+ ...(ngDevMode ? [{ debugName: "todayLabel" }] : /* istanbul ignore next */ []));
268
+ /** Label of the default "Clear" button. */
269
+ this.clearLabel = input('Effacer', /* @ts-ignore */
270
+ ...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
271
+ /** Accessible name of the calendar panel (fallback when no `label`/`ariaLabel`). */
272
+ this.panelAriaLabel = input('Calendrier', /* @ts-ignore */
273
+ ...(ngDevMode ? [{ debugName: "panelAriaLabel" }] : /* istanbul ignore next */ []));
274
+ /** Accessible label of the previous-month/year navigation arrow. */
275
+ this.prevAriaLabel = input('Précédent', /* @ts-ignore */
276
+ ...(ngDevMode ? [{ debugName: "prevAriaLabel" }] : /* istanbul ignore next */ []));
277
+ /** Accessible label of the next-month/year navigation arrow. */
278
+ this.nextAriaLabel = input('Suivant', /* @ts-ignore */
279
+ ...(ngDevMode ? [{ debugName: "nextAriaLabel" }] : /* istanbul ignore next */ []));
280
+ /** Accessible name of the hours spinbutton. */
281
+ this.hoursAriaLabel = input('Heures', /* @ts-ignore */
282
+ ...(ngDevMode ? [{ debugName: "hoursAriaLabel" }] : /* istanbul ignore next */ []));
283
+ /** Accessible name of the minutes spinbutton. */
284
+ this.minutesAriaLabel = input('Minutes', /* @ts-ignore */
285
+ ...(ngDevMode ? [{ debugName: "minutesAriaLabel" }] : /* istanbul ignore next */ []));
286
+ /** Accessible name of the AM/PM spinbutton. */
287
+ this.meridiemAriaLabel = input('AM/PM', /* @ts-ignore */
288
+ ...(ngDevMode ? [{ debugName: "meridiemAriaLabel" }] : /* istanbul ignore next */ []));
289
+ /** Accessible label of the hours increment button. */
290
+ this.incrementHoursAriaLabel = input('Augmenter les heures', /* @ts-ignore */
291
+ ...(ngDevMode ? [{ debugName: "incrementHoursAriaLabel" }] : /* istanbul ignore next */ []));
292
+ /** Accessible label of the hours decrement button. */
293
+ this.decrementHoursAriaLabel = input('Diminuer les heures', /* @ts-ignore */
294
+ ...(ngDevMode ? [{ debugName: "decrementHoursAriaLabel" }] : /* istanbul ignore next */ []));
295
+ /** Accessible label of the minutes increment button. */
296
+ this.incrementMinutesAriaLabel = input('Augmenter les minutes', /* @ts-ignore */
297
+ ...(ngDevMode ? [{ debugName: "incrementMinutesAriaLabel" }] : /* istanbul ignore next */ []));
298
+ /** Accessible label of the minutes decrement button. */
299
+ this.decrementMinutesAriaLabel = input('Diminuer les minutes', /* @ts-ignore */
300
+ ...(ngDevMode ? [{ debugName: "decrementMinutesAriaLabel" }] : /* istanbul ignore next */ []));
301
+ /** Accessible label of the AM/PM toggle buttons. */
302
+ this.toggleMeridiemAriaLabel = input('Changer AM/PM', /* @ts-ignore */
303
+ ...(ngDevMode ? [{ debugName: "toggleMeridiemAriaLabel" }] : /* istanbul ignore next */ []));
304
+ /** Render the panel inline (no trigger, no overlay). */
305
+ this.inline = input(false, { ...(ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
306
+ /**
307
+ * Auto-flip the panel above the trigger when there isn't enough room below
308
+ * (default). Set `false` to lock it below the trigger regardless of space.
309
+ */
310
+ this.autoFlip = input(true, { ...(ngDevMode ? { debugName: "autoFlip" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
311
+ /** Close after a complete selection (ignored when `showTime`). */
312
+ this.closeOnSelect = input(true, { ...(ngDevMode ? { debugName: "closeOnSelect" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
313
+ /** Extra class(es) applied to the panel (scoped custom styling). */
314
+ this.panelStyleClass = input(/* @ts-ignore */
315
+ ...(ngDevMode ? [undefined, { debugName: "panelStyleClass" }] : /* istanbul ignore next */ []));
316
+ /** Emitted whenever the value changes (selection, time, clear). */
317
+ this.valueChange = output();
318
+ /** Emitted when a date/month/year is picked — always a single value (in `valueType`'s
319
+ * shape), even in `multiple`/`range` (it reports "which day was just clicked", not the model
320
+ * value, which is why it never becomes an array there). */
321
+ this.dateSelect = output();
322
+ /** Emitted when the displayed month changes. */
323
+ this.monthChange = output();
324
+ /** Emitted when the panel opens. */
325
+ this.opened = output();
326
+ /** Emitted when the panel closes. */
327
+ this.closed = output();
328
+ /** Emitted when the value is cleared. */
329
+ this.cleared = output();
330
+ /** Emitted when the trigger receives focus. */
331
+ this.inputFocus = output();
332
+ /** Emitted when the trigger loses focus. */
333
+ this.inputBlur = output();
334
+ /** Custom day-cell template: `<ng-template #date let-date let-selected="selected">`. */
335
+ this.dateTemplate = contentChild('date', /* @ts-ignore */
336
+ ...(ngDevMode ? [{ debugName: "dateTemplate" }] : /* istanbul ignore next */ []));
337
+ /** Custom button-bar template: `<ng-template #buttonbar let-todayCallback let-clearCallback>`. */
338
+ this.buttonBarTemplate = contentChild('buttonbar', /* @ts-ignore */
339
+ ...(ngDevMode ? [{ debugName: "buttonBarTemplate" }] : /* istanbul ignore next */ []));
340
+ /** @ignore */
341
+ this.localeId = inject(LOCALE_ID);
342
+ /** @ignore */
343
+ this.triggerInput = viewChild('trigger', /* @ts-ignore */
344
+ ...(ngDevMode ? [{ debugName: "triggerInput" }] : /* istanbul ignore next */ []));
345
+ /** @ignore Trigger host (to anchor the overlay on the input box, not the helper). */
346
+ this.triggerRef = viewChild('trigger', { ...(ngDevMode ? { debugName: "triggerRef" } : /* istanbul ignore next */ {}), read: ElementRef });
347
+ /** @ignore Panel root element (overlay or inline) — used for roving day focus. */
348
+ this.panelEl = viewChild('panel', /* @ts-ignore */
349
+ ...(ngDevMode ? [{ debugName: "panelEl" }] : /* istanbul ignore next */ []));
350
+ /** @ignore */
351
+ this.panelId = `ui-datepicker-panel-${nextPanelUid++}`;
352
+ /** @ignore */
353
+ this.panelOpen = signal(false, /* @ts-ignore */
354
+ ...(ngDevMode ? [{ debugName: "panelOpen" }] : /* istanbul ignore next */ []));
355
+ /** @ignore Element the overlay is anchored to (the input box). */
356
+ this.overlayOrigin = signal(null, /* @ts-ignore */
357
+ ...(ngDevMode ? [{ debugName: "overlayOrigin" }] : /* istanbul ignore next */ []));
358
+ /** @ignore Month currently displayed. */
359
+ this.viewDate = signal(startOfDay(new Date()), /* @ts-ignore */
360
+ ...(ngDevMode ? [{ debugName: "viewDate" }] : /* istanbul ignore next */ []));
361
+ /** @ignore Active drill-down level; resets to `view()` when it changes. */
362
+ this.currentView = linkedSignal(() => this.view(), /* @ts-ignore */
363
+ ...(ngDevMode ? [{ debugName: "currentView" }] : /* istanbul ignore next */ []));
364
+ /** @ignore Day cell owning the roving tabindex. */
365
+ this.focusedDate = signal(startOfDay(new Date()), /* @ts-ignore */
366
+ ...(ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []));
367
+ /** @ignore Month-picker cell (index 0–11) owning the roving tabindex. */
368
+ this.focusedMonthIndex = signal(new Date().getMonth(), /* @ts-ignore */
369
+ ...(ngDevMode ? [{ debugName: "focusedMonthIndex" }] : /* istanbul ignore next */ []));
370
+ /** @ignore Year-picker cell (absolute year) owning the roving tabindex. */
371
+ this.focusedYear = signal(new Date().getFullYear(), /* @ts-ignore */
372
+ ...(ngDevMode ? [{ debugName: "focusedYear" }] : /* istanbul ignore next */ []));
373
+ /** @ignore Time components. */
374
+ this.hours = signal(0, /* @ts-ignore */
375
+ ...(ngDevMode ? [{ debugName: "hours" }] : /* istanbul ignore next */ []));
376
+ this.minutes = signal(0, /* @ts-ignore */
377
+ ...(ngDevMode ? [{ debugName: "minutes" }] : /* istanbul ignore next */ []));
378
+ /** @ignore Raw text while the user edits the trigger (`allowInput`); `null` when not editing. */
379
+ this.typedValue = signal(null, /* @ts-ignore */
380
+ ...(ngDevMode ? [{ debugName: "typedValue" }] : /* istanbul ignore next */ []));
381
+ /** @ignore Date-based source of truth for all calendar/selection logic; `modelValue`
382
+ * (inherited) only ever carries the public value (`Date` or ISO string per `valueType`),
383
+ * written in lockstep. */
384
+ this.internalValue = signal(null, /* @ts-ignore */
385
+ ...(ngDevMode ? [{ debugName: "internalValue" }] : /* istanbul ignore next */ []));
386
+ /** @ignore Below the trigger, flipping above when `autoFlip` and space is lacking. */
387
+ this.overlayPositions = computed(() => dropdownOverlayPositions(this.autoFlip()), /* @ts-ignore */
388
+ ...(ngDevMode ? [{ debugName: "overlayPositions" }] : /* istanbul ignore next */ []));
389
+ /** @ignore Bound (stable) callbacks exposed to the `#buttonbar` template. */
390
+ this.todayCallback = (event) => {
391
+ event?.stopPropagation?.();
392
+ this.selectToday();
393
+ };
394
+ this.clearCallback = (event) => {
395
+ event?.stopPropagation?.();
396
+ this.clear();
397
+ };
398
+ /** @ignore */
399
+ this.resolvedLocale = computed(() => this.locale() ?? this.localeId, /* @ts-ignore */
400
+ ...(ngDevMode ? [{ debugName: "resolvedLocale" }] : /* istanbul ignore next */ []));
401
+ /** @ignore `minDate`/`maxDate`/`disabledDates` normalized to `Date` (accept ISO strings too). */
402
+ this.resolvedMinDate = computed(() => normalizeDateInput(this.minDate()), /* @ts-ignore */
403
+ ...(ngDevMode ? [{ debugName: "resolvedMinDate" }] : /* istanbul ignore next */ []));
404
+ this.resolvedMaxDate = computed(() => normalizeDateInput(this.maxDate()), /* @ts-ignore */
405
+ ...(ngDevMode ? [{ debugName: "resolvedMaxDate" }] : /* istanbul ignore next */ []));
406
+ this.resolvedDisabledDates = computed(() => (this.disabledDates() ?? []).map(normalizeDateInput).filter((d) => d !== null), /* @ts-ignore */
407
+ ...(ngDevMode ? [{ debugName: "resolvedDisabledDates" }] : /* istanbul ignore next */ []));
408
+ /**
409
+ * @ignore The trigger is not typeable: manual input off, not single, read-only, or
410
+ * `timeOnly` — free-form typing in time-only mode isn't implemented (no dedicated
411
+ * parser/formatter for a bare time string), so it's disabled outright here rather than
412
+ * silently mis-parsing.
413
+ */
414
+ this.triggerReadonly = computed(() => this.readonly() || !this.allowInput() || this.selectionMode() !== 'single' || this.timeOnly(), /* @ts-ignore */
415
+ ...(ngDevMode ? [{ debugName: "triggerReadonly" }] : /* istanbul ignore next */ []));
416
+ /**
417
+ * @ignore Placeholder shown in the typeable trigger. Falls back to a hint derived
418
+ * from the resolved locale's field order (e.g. `jj/mm/aaaa` in French, `mm/dd/yyyy`
419
+ * in en-US) so the field never advertises the wrong format.
420
+ */
421
+ this.resolvedPlaceholder = computed(() => {
422
+ const explicit = this.placeholder();
423
+ // Keep the consumer's placeholder, and don't auto-hint on a read-only trigger.
424
+ if (explicit || this.triggerReadonly())
425
+ return explicit;
426
+ const fr = this.resolvedLocale().toLowerCase().startsWith('fr');
427
+ const token = { day: fr ? 'jj' : 'dd', month: 'mm', year: fr ? 'aaaa' : 'yyyy' };
428
+ const view = this.view();
429
+ if (view === 'year')
430
+ return token.year;
431
+ const opts = view === 'month'
432
+ ? { month: '2-digit', year: 'numeric' }
433
+ : { day: '2-digit', month: '2-digit', year: 'numeric' };
434
+ return new Intl.DateTimeFormat(this.resolvedLocale(), opts)
435
+ .formatToParts(new Date(2023, 10, 22))
436
+ .map((p) => (p.type === 'day' ? token.day : p.type === 'month' ? token.month : p.type === 'year' ? token.year : p.value))
437
+ .join('');
438
+ }, /* @ts-ignore */
439
+ ...(ngDevMode ? [{ debugName: "resolvedPlaceholder" }] : /* istanbul ignore next */ []));
440
+ /** @ignore Order of day/month/year for the resolved locale (drives numeric parsing). */
441
+ this.dateFieldOrder = computed(() => {
442
+ const parts = new Intl.DateTimeFormat(this.resolvedLocale(), {
443
+ day: '2-digit',
444
+ month: '2-digit',
445
+ year: 'numeric',
446
+ }).formatToParts(new Date(2023, 10, 22));
447
+ const order = parts
448
+ .map((p) => p.type)
449
+ .filter((t) => t === 'day' || t === 'month' || t === 'year');
450
+ return order.length === 3 ? order : ['day', 'month', 'year'];
451
+ }, /* @ts-ignore */
452
+ ...(ngDevMode ? [{ debugName: "dateFieldOrder" }] : /* istanbul ignore next */ []));
453
+ /** @ignore `dateFieldOrder`, minus `day` in month view — the fields actually typed. */
454
+ this.activeFields = computed(() => this.dateFieldOrder().filter((f) => (this.view() === 'month' ? f !== 'day' : true)), /* @ts-ignore */
455
+ ...(ngDevMode ? [{ debugName: "activeFields" }] : /* istanbul ignore next */ []));
456
+ /**
457
+ * @ignore Dynamic mask (day/month/year widths in locale order, plus hour/minute — and AM/PM —
458
+ * widths when `showTime`) driving the auto-"/" (resp. ":") formatting of the typeable trigger.
459
+ * `null` disables it: `triggerReadonly` (covers `timeOnly` — see there), `view === 'year'`
460
+ * (free-form numeric field, out of scope), or a custom `parseDate` (a non-numeric format would
461
+ * make the auto-slash wrong). The `year` segment is deliberately left unbounded so the existing
462
+ * 2-digit shortcut (`normalizeYear`) keeps working — strict validation still happens at
463
+ * `finalizeParsed`. `defaultParse` already expects these trailing hour/minute digits (see its
464
+ * `nums.slice(fields.length)`) — this only keeps the auto-formatting mask in sync with it, so
465
+ * typed hour/minute digits aren't truncated by `autoFormatSegments` before they reach it.
466
+ */
467
+ this.typingSlots = computed(() => {
468
+ if (this.triggerReadonly() || this.view() === 'year' || this.parseDate())
469
+ return null;
470
+ const widths = { day: '99', month: '99', year: '9999' };
471
+ const bounds = {
472
+ day: { min: 1, max: 31 },
473
+ month: { min: 1, max: 12 },
474
+ year: null,
475
+ };
476
+ const fields = this.activeFields();
477
+ let mask = fields.map((f) => widths[f]).join('/');
478
+ const segmentBounds = fields.map((f) => bounds[f]);
479
+ if (this.showTime() && this.view() === 'date') {
480
+ mask += this.hourFormat() === '12' ? ' 99:99 aa' : ' 99:99';
481
+ segmentBounds.push(this.hourFormat() === '12' ? { min: 1, max: 12 } : { min: 0, max: 23 }, { min: 0, max: 59 });
482
+ }
483
+ return buildMaskSlots(mask, segmentBounds);
484
+ }, /* @ts-ignore */
485
+ ...(ngDevMode ? [{ debugName: "typingSlots" }] : /* istanbul ignore next */ []));
486
+ /** @ignore The panel is visible. */
487
+ this.showPanel = computed(() => this.inline() || this.panelOpen(), /* @ts-ignore */
488
+ ...(ngDevMode ? [{ debugName: "showPanel" }] : /* istanbul ignore next */ []));
489
+ /** @ignore Day grid shown (hidden in `timeOnly`). */
490
+ this.showCalendar = computed(() => !this.timeOnly(), /* @ts-ignore */
491
+ ...(ngDevMode ? [{ debugName: "showCalendar" }] : /* istanbul ignore next */ []));
492
+ /** @ignore Single-month layout enables the drill-down header + roving focus. */
493
+ this.singleMonth = computed(() => Math.max(1, this.numberOfMonths()) === 1, /* @ts-ignore */
494
+ ...(ngDevMode ? [{ debugName: "singleMonth" }] : /* istanbul ignore next */ []));
495
+ /** @ignore A value is currently set. */
496
+ this.hasValue = computed(() => this.selectedDates().length > 0, /* @ts-ignore */
497
+ ...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
498
+ /** @ignore The trigger's right action clears the value (instead of toggling the panel). */
499
+ this.showClearButton = computed(() => this.showClear() && this.hasValue() && !this.isDisabled() && !this.readonly(), /* @ts-ignore */
500
+ ...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
501
+ /** @ignore Right-side icon: clear (×) when clearable + set, else the calendar/clock toggle. */
502
+ this.triggerIcon = computed(() => {
503
+ if (this.showClearButton())
504
+ return 'xmark';
505
+ if (!this.showIcon())
506
+ return undefined;
507
+ // Default to a clock in time-only mode (unless a custom icon was provided).
508
+ return this.timeOnly() && this.icon() === 'calendar' ? 'clock' : this.icon();
509
+ }, /* @ts-ignore */
510
+ ...(ngDevMode ? [{ debugName: "triggerIcon" }] : /* istanbul ignore next */ []));
511
+ /** @ignore Accessible name of the right action. */
512
+ this.triggerIconAriaLabel = computed(() => this.showClearButton() ? this.clearLabel() : this.iconAriaLabel(), /* @ts-ignore */
513
+ ...(ngDevMode ? [{ debugName: "triggerIconAriaLabel" }] : /* istanbul ignore next */ []));
514
+ // --- Selection helpers ----------------------------------------------
515
+ /** @ignore Flatten the internal (Date-based) value to a list of selected dates. */
516
+ this.selectedDates = computed(() => {
517
+ const v = this.internalValue();
518
+ if (!v)
519
+ return [];
520
+ return (Array.isArray(v) ? v : [v]).filter((d) => d instanceof Date);
521
+ }, /* @ts-ignore */
522
+ ...(ngDevMode ? [{ debugName: "selectedDates" }] : /* istanbul ignore next */ []));
523
+ // --- Value conversion (the ONLY boundary between the public `Date`/ISO contract
524
+ // and the internal Date-based calendar logic) --------------------------------
525
+ /** @ignore Whether the value carries a time component (date+time ISO / non-midnight `Date`). */
526
+ this.hasTimeComponent = computed(() => this.showTime() || this.timeOnly(), /* @ts-ignore */
527
+ ...(ngDevMode ? [{ debugName: "hasTimeComponent" }] : /* istanbul ignore next */ []));
528
+ /** @ignore Value rendered in the trigger. */
529
+ this.displayValue = computed(() => {
530
+ // While editing, mirror the raw text so the input keeps what the user types.
531
+ const typed = this.typedValue();
532
+ if (typed !== null)
533
+ return typed;
534
+ const dates = this.selectedDates();
535
+ if (!dates.length)
536
+ return '';
537
+ const base = this.view();
538
+ if (base === 'month')
539
+ return this.formatMonth(dates[0]);
540
+ if (base === 'year')
541
+ return String(dates[0].getFullYear());
542
+ if (this.timeOnly()) {
543
+ return new Intl.DateTimeFormat(this.resolvedLocale(), { timeStyle: 'short' }).format(dates[0]);
544
+ }
545
+ const mode = this.selectionMode();
546
+ if (mode === 'multiple')
547
+ return dates.map((d) => this.formatDate(d)).join(', ');
548
+ if (mode === 'range')
549
+ return dates.map((d) => this.formatDate(d)).join(' – ');
550
+ return this.formatDate(dates[0]);
551
+ }, /* @ts-ignore */
552
+ ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
553
+ // --- Header ----------------------------------------------------------
554
+ /** @ignore Displayed decade start (year view). */
555
+ this.decadeStart = computed(() => Math.floor(this.viewDate().getFullYear() / 10) * 10, /* @ts-ignore */
556
+ ...(ngDevMode ? [{ debugName: "decadeStart" }] : /* istanbul ignore next */ []));
557
+ /** @ignore Header label depends on the active view. */
558
+ this.headerLabel = computed(() => {
559
+ const v = this.currentView();
560
+ if (v === 'year')
561
+ return `${this.decadeStart()} - ${this.decadeStart() + 9}`;
562
+ if (v === 'month')
563
+ return String(this.viewDate().getFullYear());
564
+ return this.capitalize(new Intl.DateTimeFormat(this.resolvedLocale(), { month: 'long', year: 'numeric' }).format(this.viewDate()));
565
+ }, /* @ts-ignore */
566
+ ...(ngDevMode ? [{ debugName: "headerLabel" }] : /* istanbul ignore next */ []));
567
+ // --- Weekday headers -------------------------------------------------
568
+ /** @ignore Short (visible) + full (aria-label) weekday names — without both, either the header
569
+ * stays `aria-hidden` or the short text alone leaves screen-reader users without column names. */
570
+ this.weekDayNames = computed(() => {
571
+ const shortFmt = new Intl.DateTimeFormat(this.resolvedLocale(), { weekday: 'short' });
572
+ const longFmt = new Intl.DateTimeFormat(this.resolvedLocale(), { weekday: 'long' });
573
+ const sunday = new Date(2023, 0, 1); // getDay() === 0
574
+ const first = this.firstDayOfWeek();
575
+ return Array.from({ length: 7 }, (_, k) => {
576
+ const d = addDays(sunday, (first + k) % 7);
577
+ return { short: this.capitalize(shortFmt.format(d)), full: this.capitalize(longFmt.format(d)) };
578
+ });
579
+ }, /* @ts-ignore */
580
+ ...(ngDevMode ? [{ debugName: "weekDayNames" }] : /* istanbul ignore next */ []));
581
+ /** @ignore Full-date `aria-label` formatter for day gridcells (e.g. "8 juillet 2026"). */
582
+ this.dayAriaFormatter = computed(() => new Intl.DateTimeFormat(this.resolvedLocale(), { day: 'numeric', month: 'long', year: 'numeric' }), /* @ts-ignore */
583
+ ...(ngDevMode ? [{ debugName: "dayAriaFormatter" }] : /* istanbul ignore next */ []));
584
+ // --- Grids -----------------------------------------------------------
585
+ /** @ignore Month panels (1 or more) for the date view. */
586
+ this.monthPanels = computed(() => {
587
+ const count = Math.max(1, this.numberOfMonths());
588
+ const start = firstOfMonth(this.viewDate());
589
+ const fmt = new Intl.DateTimeFormat(this.resolvedLocale(), { month: 'long', year: 'numeric' });
590
+ return Array.from({ length: count }, (_, i) => {
591
+ const monthDate = addMonths(start, i);
592
+ return {
593
+ monthDate,
594
+ label: this.capitalize(fmt.format(monthDate)),
595
+ weeks: this.buildMonthWeeks(monthDate),
596
+ showPrev: i === 0,
597
+ showNext: i === count - 1,
598
+ };
599
+ });
600
+ }, /* @ts-ignore */
601
+ ...(ngDevMode ? [{ debugName: "monthPanels" }] : /* istanbul ignore next */ []));
602
+ /** @ignore Month-picker grid (12 months of the displayed year). */
603
+ this.months = computed(() => {
604
+ const fmt = new Intl.DateTimeFormat(this.resolvedLocale(), { month: 'short' });
605
+ const year = this.viewDate().getFullYear();
606
+ const sel = this.selectedDates();
607
+ return Array.from({ length: 12 }, (_, i) => ({
608
+ index: i,
609
+ label: this.capitalize(fmt.format(new Date(year, i, 1))),
610
+ selected: sel.some((d) => d.getFullYear() === year && d.getMonth() === i),
611
+ disabled: this.isMonthDisabled(year, i),
612
+ }));
613
+ }, /* @ts-ignore */
614
+ ...(ngDevMode ? [{ debugName: "months" }] : /* istanbul ignore next */ []));
615
+ /** @ignore Year-picker grid (the displayed decade). */
616
+ this.years = computed(() => {
617
+ const start = this.decadeStart();
618
+ const sel = this.selectedDates();
619
+ return Array.from({ length: 10 }, (_, i) => {
620
+ const year = start + i;
621
+ return { year, selected: sel.some((d) => d.getFullYear() === year), disabled: this.isYearDisabled(year) };
622
+ });
623
+ }, /* @ts-ignore */
624
+ ...(ngDevMode ? [{ debugName: "years" }] : /* istanbul ignore next */ []));
625
+ /** @ignore Hours as shown in the 12h stepper (1–12). */
626
+ this.displayHours = computed(() => {
627
+ if (this.hourFormat() === '24')
628
+ return this.hours();
629
+ const h = this.hours() % 12;
630
+ return h === 0 ? 12 : h;
631
+ }, /* @ts-ignore */
632
+ ...(ngDevMode ? [{ debugName: "displayHours" }] : /* istanbul ignore next */ []));
633
+ /** @ignore */
634
+ this.meridiem = computed(() => (this.hours() < 12 ? 'AM' : 'PM'), /* @ts-ignore */
635
+ ...(ngDevMode ? [{ debugName: "meridiem" }] : /* istanbul ignore next */ []));
636
+ /** @ignore Zero-padded labels for the steppers. */
637
+ this.hoursLabel = computed(() => this.pad(this.hourFormat() === '12' ? this.displayHours() : this.hours()), /* @ts-ignore */
638
+ ...(ngDevMode ? [{ debugName: "hoursLabel" }] : /* istanbul ignore next */ []));
639
+ this.minutesLabel = computed(() => this.pad(this.minutes()), /* @ts-ignore */
640
+ ...(ngDevMode ? [{ debugName: "minutesLabel" }] : /* istanbul ignore next */ []));
641
+ /** @ignore Raw digits while a time field is being typed in; `null` when not editing. */
642
+ this.hoursDraft = signal(null, /* @ts-ignore */
643
+ ...(ngDevMode ? [{ debugName: "hoursDraft" }] : /* istanbul ignore next */ []));
644
+ this.minutesDraft = signal(null, /* @ts-ignore */
645
+ ...(ngDevMode ? [{ debugName: "minutesDraft" }] : /* istanbul ignore next */ []));
646
+ /** @ignore Text rendered in a time field: the draft while typing, the padded label otherwise. */
647
+ this.hoursValue = computed(() => this.hoursDraft() ?? this.hoursLabel(), /* @ts-ignore */
648
+ ...(ngDevMode ? [{ debugName: "hoursValue" }] : /* istanbul ignore next */ []));
649
+ this.minutesValue = computed(() => this.minutesDraft() ?? this.minutesLabel(), /* @ts-ignore */
650
+ ...(ngDevMode ? [{ debugName: "minutesValue" }] : /* istanbul ignore next */ []));
651
+ /** @ignore Accepted hours range (the 12h clock shows 1–12). */
652
+ this.hourBounds = computed(() => this.hourFormat() === '12' ? { min: 1, max: 12 } : { min: 0, max: 23 }, /* @ts-ignore */
653
+ ...(ngDevMode ? [{ debugName: "hourBounds" }] : /* istanbul ignore next */ []));
654
+ /** @ignore The hours/minutes fields accept typing. */
655
+ this.timeEditable = computed(() => this.editableTime() && !this.isDisabled() && !this.readonly(), /* @ts-ignore */
656
+ ...(ngDevMode ? [{ debugName: "timeEditable" }] : /* istanbul ignore next */ []));
657
+ /** @ignore The time steppers (chevrons + AM/PM toggle) accept interaction — unlike
658
+ * `timeEditable`, not gated on `editableTime` (the steppers stay usable in
659
+ * `StepperOnlyTime`-style configs; only `disabled`/`readonly` freeze them). */
660
+ this.timeControlsEnabled = computed(() => !this.isDisabled() && !this.readonly(), /* @ts-ignore */
661
+ ...(ngDevMode ? [{ debugName: "timeControlsEnabled" }] : /* istanbul ignore next */ []));
662
+ // Never carry an open panel over to the next page (the field can live in
663
+ // an app shell that survives the navigation).
664
+ closeOnNavigation(() => this.close(false));
665
+ // Keep time signals in sync with the (first) value.
666
+ effect(() => {
667
+ const first = this.firstSelectedFrom(this.internalValue() ?? null);
668
+ untracked(() => {
669
+ if (first) {
670
+ this.hours.set(first.getHours());
671
+ this.minutes.set(first.getMinutes());
672
+ }
673
+ });
674
+ });
675
+ }
676
+ writeValue(value) {
677
+ this.typedValue.set(null);
678
+ this.hoursDraft.set(null);
679
+ this.minutesDraft.set(null);
680
+ const internal = this.toInternalValue(value ?? null);
681
+ this.internalValue.set(internal);
682
+ this.modelValue.set(value ?? undefined);
683
+ const first = this.firstSelectedFrom(internal);
684
+ if (first) {
685
+ this.viewDate.set(firstOfMonth(first));
686
+ this.focusedDate.set(startOfDay(first));
687
+ this.focusedMonthIndex.set(first.getMonth());
688
+ this.focusedYear.set(first.getFullYear());
689
+ }
690
+ }
691
+ // --- Panel open/close ------------------------------------------------
692
+ open() {
693
+ if (this.inline() || this.isDisabled() || this.readonly() || this.panelOpen())
694
+ return;
695
+ const base = this.firstSelectedFrom(this.internalValue() ?? null) ?? startOfDay(new Date());
696
+ this.viewDate.set(firstOfMonth(base));
697
+ this.currentView.set(this.view());
698
+ this.focusedDate.set(this.clampToRange(startOfDay(base)));
699
+ this.focusedMonthIndex.set(base.getMonth());
700
+ this.focusedYear.set(base.getFullYear());
701
+ this.overlayOrigin.set(this.resolveOverlayOrigin());
702
+ this.panelOpen.set(true);
703
+ this.opened.emit();
704
+ // Keep focus in the input when it's typeable; otherwise rove into the (active) grid.
705
+ if (this.showCalendar() && this.triggerReadonly()) {
706
+ if (this.currentView() === 'date')
707
+ this.queueDayFocus();
708
+ else if (this.currentView() === 'month')
709
+ this.queueMonthFocus();
710
+ else
711
+ this.queueYearFocus();
712
+ }
713
+ }
714
+ close(focusTrigger = true) {
715
+ if (!this.panelOpen())
716
+ return;
717
+ this.panelOpen.set(false);
718
+ this.emitTouch();
719
+ this.closed.emit();
720
+ if (focusTrigger)
721
+ this.triggerInput()?.focus();
722
+ }
723
+ /** @ignore */
724
+ toggle() {
725
+ this.panelOpen() ? this.close() : this.open();
726
+ }
727
+ /** @ignore Right action: clear when clearable + set, otherwise toggle the panel.
728
+ * `stopPropagation` keeps the click from bubbling to the field (which opens it). */
729
+ onIconClick(event) {
730
+ event.stopPropagation();
731
+ if (this.showClearButton())
732
+ this.clear();
733
+ else
734
+ this.toggle();
735
+ }
736
+ /** @ignore */
737
+ onTriggerKeydown(event) {
738
+ // Typeable trigger: let printable keys through, only intercept nav/commit.
739
+ if (!this.triggerReadonly()) {
740
+ if (event.key === 'ArrowDown') {
741
+ event.preventDefault();
742
+ this.open();
743
+ this.queueDayFocus();
744
+ }
745
+ else if (event.key === 'Enter') {
746
+ event.preventDefault();
747
+ this.commitTyped();
748
+ if (this.panelOpen() && this.closeOnSelect() && !this.showTime())
749
+ this.close(false);
750
+ }
751
+ else if (event.key === 'Escape') {
752
+ this.close();
753
+ }
754
+ return;
755
+ }
756
+ if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {
757
+ event.preventDefault();
758
+ this.open();
759
+ }
760
+ else if (event.key === 'Escape') {
761
+ this.close();
762
+ }
763
+ }
764
+ /**
765
+ * @ignore Track the raw text as the user types; live-preview the open panel. When a typing
766
+ * mask applies (see `typingSlots`), auto-insert "/" as soon as a segment is complete (same
767
+ * pattern as a card-expiry field) and reposition the caret accordingly.
768
+ */
769
+ onTriggerInput(value) {
770
+ if (this.triggerReadonly())
771
+ return;
772
+ const slots = this.typingSlots();
773
+ if (!slots) {
774
+ this.typedValue.set(value);
775
+ if (this.panelOpen())
776
+ this.previewTyped();
777
+ return;
778
+ }
779
+ const el = this.triggerInput()?.nativeInputElement();
780
+ const caret = el?.selectionStart ?? value.length;
781
+ // Number of data characters located BEFORE the caret (stable anchor, same trick as ui-input-mask).
782
+ const dataBeforeCaret = extractMaskData(value.slice(0, caret)).length;
783
+ const { text, tokenIndices } = autoFormatSegments(slots, extractMaskData(value));
784
+ this.typedValue.set(text);
785
+ if (el) {
786
+ el.value = text;
787
+ const pos = caretForMask(tokenIndices, dataBeforeCaret, text.length);
788
+ el.setSelectionRange(pos, pos);
789
+ }
790
+ if (this.panelOpen())
791
+ this.previewTyped();
792
+ }
793
+ /**
794
+ * @ignore Reflect a fully-typed date in the open panel (navigate + highlight)
795
+ * without reformatting the field, so the caret stays put while typing.
796
+ */
797
+ previewTyped() {
798
+ const raw = this.typedValue();
799
+ if (raw === null || !raw.trim())
800
+ return;
801
+ const parsed = this.parseTyped(raw.trim(), true);
802
+ if (!parsed || this.isParsedDisabled(parsed))
803
+ return;
804
+ const picked = this.showTime() ? parsed : startOfDay(parsed);
805
+ // Update the model (drives the selected-day highlight + live value) but keep
806
+ // `typedValue` so `displayValue` still returns the raw text (no caret jump).
807
+ this.internalValue.set(picked);
808
+ const external = this.toExternalValue(picked);
809
+ this.modelValue.set(external ?? undefined);
810
+ this.emitChange(external);
811
+ this.valueChange.emit(external);
812
+ this.viewDate.set(firstOfMonth(picked));
813
+ this.focusedDate.set(startOfDay(picked));
814
+ }
815
+ /** @ignore Parse the typed text on blur, then forward the blur. */
816
+ onTriggerBlur(event) {
817
+ this.commitTyped();
818
+ const next = event.relatedTarget;
819
+ if (!next || !this.panelEl()?.nativeElement.contains(next))
820
+ this.emitTouch();
821
+ this.inputBlur.emit(event);
822
+ }
823
+ /** @ignore Parse and apply the typed text; revert to the previous value if invalid. */
824
+ commitTyped() {
825
+ if (this.triggerReadonly())
826
+ return;
827
+ const raw = this.typedValue();
828
+ if (raw === null)
829
+ return; // untouched
830
+ const text = raw.trim();
831
+ if (!text) {
832
+ this.typedValue.set(null);
833
+ if (this.hasValue())
834
+ this.clear();
835
+ return;
836
+ }
837
+ const parsed = this.parseTyped(text, true);
838
+ if (parsed && !this.isParsedDisabled(parsed)) {
839
+ const picked = this.showTime() ? parsed : startOfDay(parsed);
840
+ this.commit(picked); // single-only → clears typedValue and reformats
841
+ this.dateSelect.emit(this.serializeValue(picked));
842
+ this.viewDate.set(firstOfMonth(picked));
843
+ this.focusedDate.set(startOfDay(picked));
844
+ }
845
+ else {
846
+ this.typedValue.set(null); // revert: displayValue reformats the current value
847
+ }
848
+ }
849
+ /**
850
+ * @ignore Custom parser when provided, otherwise the locale-aware numeric parser.
851
+ * `requireComplete` gates the default parser to fully-typed dates (custom
852
+ * parsers decide completeness themselves).
853
+ */
854
+ parseTyped(text, requireComplete = false) {
855
+ const custom = this.parseDate();
856
+ return custom ? custom(text) : this.defaultParse(text, requireComplete);
857
+ }
858
+ /**
859
+ * @ignore Locale-aware numeric parser (day/month/year order from `dateFieldOrder`).
860
+ * With `requireComplete`, returns `null` unless every component is present
861
+ * (and the year has 2 or ≥4 digits) — used for live preview to avoid jumps.
862
+ */
863
+ defaultParse(text, requireComplete = false) {
864
+ const groups = text.match(/\d+/g) ?? [];
865
+ const nums = groups.map(Number);
866
+ if (!nums.length)
867
+ return null;
868
+ const view = this.view();
869
+ if (view === 'year') {
870
+ if (requireComplete && (groups[0]?.length ?? 0) < 4)
871
+ return null;
872
+ return finalizeParsed(this.normalizeYear(nums[0]), 0, 1, 0, 0);
873
+ }
874
+ const fields = this.activeFields();
875
+ if (requireComplete) {
876
+ if (groups.length < fields.length)
877
+ return null;
878
+ const yearLen = groups[fields.indexOf('year')]?.length ?? 0;
879
+ if (yearLen !== 2 && yearLen < 4)
880
+ return null;
881
+ }
882
+ let day = 1;
883
+ let month = 0;
884
+ let year = this.viewDate().getFullYear();
885
+ fields.forEach((field, i) => {
886
+ const n = nums[i];
887
+ if (n === undefined)
888
+ return;
889
+ if (field === 'day')
890
+ day = n;
891
+ else if (field === 'month')
892
+ month = n - 1;
893
+ else
894
+ year = this.normalizeYear(n);
895
+ });
896
+ let h = this.hours();
897
+ let min = this.minutes();
898
+ if (this.showTime() && view === 'date') {
899
+ const t = nums.slice(fields.length);
900
+ if (t.length >= 1)
901
+ h = t[0];
902
+ if (t.length >= 2)
903
+ min = t[1];
904
+ if (this.hourFormat() === '12') {
905
+ if (/p/i.test(text) && h < 12)
906
+ h += 12;
907
+ if (/a/i.test(text) && h === 12)
908
+ h = 0;
909
+ }
910
+ }
911
+ return finalizeParsed(year, month, view === 'month' ? 1 : day, h, min);
912
+ }
913
+ /** @ignore 2-digit years → 2000s. */
914
+ normalizeYear(y) {
915
+ return y < 100 ? 2000 + y : y;
916
+ }
917
+ /** @ignore Range/disabled check for a parsed value, granular to the base view. */
918
+ isParsedDisabled(date) {
919
+ const v = this.view();
920
+ if (v === 'year')
921
+ return this.isYearDisabled(date.getFullYear());
922
+ if (v === 'month')
923
+ return this.isMonthDisabled(date.getFullYear(), date.getMonth());
924
+ return this.isDateDisabled(startOfDay(date));
925
+ }
926
+ // --- Header interactions --------------------------------------------
927
+ /** @ignore Click the header title → drill up (date → month → year). Single-month only. */
928
+ onHeaderClick() {
929
+ if (!this.singleMonth())
930
+ return;
931
+ const v = this.currentView();
932
+ if (v === 'date') {
933
+ this.focusedMonthIndex.set(this.viewDate().getMonth());
934
+ this.currentView.set('month');
935
+ }
936
+ else if (v === 'month') {
937
+ this.focusedYear.set(this.viewDate().getFullYear());
938
+ this.currentView.set('year');
939
+ }
940
+ }
941
+ /** @ignore Prev/next arrow — steps month / year / decade depending on the view. */
942
+ onPrev() {
943
+ this.step(-1);
944
+ }
945
+ onNext() {
946
+ this.step(1);
947
+ }
948
+ /** @ignore */
949
+ step(dir) {
950
+ const v = this.currentView();
951
+ if (v === 'date')
952
+ this.changeMonth(dir);
953
+ else if (v === 'month')
954
+ this.viewDate.set(new Date(this.viewDate().getFullYear() + dir, this.viewDate().getMonth(), 1));
955
+ else
956
+ this.viewDate.set(new Date(this.viewDate().getFullYear() + dir * 10, this.viewDate().getMonth(), 1));
957
+ }
958
+ /** @ignore */
959
+ changeMonth(delta) {
960
+ const next = addMonths(this.viewDate(), delta);
961
+ this.viewDate.set(next);
962
+ this.monthChange.emit({ month: next.getMonth(), year: next.getFullYear() });
963
+ }
964
+ // --- Selection -------------------------------------------------------
965
+ /** @ignore Pick a day from the grid. */
966
+ selectDay(cell) {
967
+ if (cell.disabled || this.isDisabled() || this.readonly())
968
+ return;
969
+ const picked = new Date(cell.date);
970
+ if (this.showTime())
971
+ picked.setHours(this.hours(), this.minutes(), 0, 0);
972
+ const mode = this.selectionMode();
973
+ let value;
974
+ let complete = true;
975
+ if (mode === 'multiple') {
976
+ const arr = [...this.selectedDates()];
977
+ const idx = arr.findIndex((d) => isSameDay(d, picked));
978
+ if (idx >= 0)
979
+ arr.splice(idx, 1);
980
+ else
981
+ arr.push(picked);
982
+ value = arr;
983
+ complete = false; // multiple never auto-closes
984
+ }
985
+ else if (mode === 'range') {
986
+ const arr = this.selectedDates();
987
+ if (arr.length !== 1) {
988
+ value = [picked];
989
+ complete = false;
990
+ }
991
+ else {
992
+ value = picked < startOfDay(arr[0]) ? [picked] : [arr[0], picked];
993
+ complete = Array.isArray(value) && value.length === 2;
994
+ }
995
+ }
996
+ else {
997
+ value = picked;
998
+ }
999
+ this.commit(value);
1000
+ this.dateSelect.emit(this.serializeValue(picked));
1001
+ this.viewDate.set(firstOfMonth(picked));
1002
+ this.focusedDate.set(startOfDay(picked));
1003
+ if (this.closeOnSelect() && !this.showTime() && !this.inline() && complete)
1004
+ this.close();
1005
+ }
1006
+ /** @ignore Month-picker / drill-down month selection. */
1007
+ selectMonth(cell) {
1008
+ if (cell.disabled)
1009
+ return;
1010
+ const d = new Date(this.viewDate().getFullYear(), cell.index, 1);
1011
+ this.viewDate.set(d);
1012
+ if (this.view() === 'month') {
1013
+ this.commit(d);
1014
+ this.dateSelect.emit(this.serializeValue(d));
1015
+ if (this.closeOnSelect() && !this.showTime() && !this.inline())
1016
+ this.close();
1017
+ }
1018
+ else {
1019
+ this.currentView.set('date');
1020
+ this.focusedDate.set(this.clampToRange(startOfDay(d)));
1021
+ this.queueDayFocus();
1022
+ }
1023
+ }
1024
+ /** @ignore Year-picker / drill-down year selection. */
1025
+ selectYear(cell) {
1026
+ if (cell.disabled)
1027
+ return;
1028
+ const d = new Date(cell.year, this.view() === 'year' ? 0 : this.viewDate().getMonth(), 1);
1029
+ this.viewDate.set(d);
1030
+ if (this.view() === 'year') {
1031
+ this.commit(d);
1032
+ this.dateSelect.emit(this.serializeValue(d));
1033
+ if (this.closeOnSelect() && !this.showTime() && !this.inline())
1034
+ this.close();
1035
+ }
1036
+ else {
1037
+ this.currentView.set('month');
1038
+ this.focusedMonthIndex.set(d.getMonth());
1039
+ this.queueMonthFocus();
1040
+ }
1041
+ }
1042
+ /** @ignore Apply the time signals to the value (single selection only). */
1043
+ applyTime() {
1044
+ if (this.selectionMode() !== 'single')
1045
+ return;
1046
+ const base = this.firstSelectedFrom(this.internalValue() ?? null) ?? startOfDay(this.timeOnly() ? new Date() : this.viewDate());
1047
+ const next = new Date(base);
1048
+ next.setHours(this.hours(), this.minutes(), 0, 0);
1049
+ this.commit(next);
1050
+ }
1051
+ /** @ignore Step hours (wraps 0↔23; also flips meridiem across the 12h boundary). */
1052
+ stepHours(dir) {
1053
+ if (!this.timeControlsEnabled())
1054
+ return;
1055
+ this.hoursDraft.set(null);
1056
+ this.hours.set((((this.hours() + dir) % 24) + 24) % 24);
1057
+ this.applyTime();
1058
+ }
1059
+ /** @ignore Step minutes by `stepMinute` (wraps 0↔59). */
1060
+ stepMinutes(dir) {
1061
+ if (!this.timeControlsEnabled())
1062
+ return;
1063
+ this.minutesDraft.set(null);
1064
+ const step = Math.max(1, this.stepMinute());
1065
+ this.minutes.set((((this.minutes() + dir * step) % 60) + 60) % 60);
1066
+ this.applyTime();
1067
+ }
1068
+ /** @ignore */
1069
+ toggleMeridiem() {
1070
+ if (!this.timeControlsEnabled())
1071
+ return;
1072
+ this.hoursDraft.set(null);
1073
+ this.hours.set((this.hours() + 12) % 24);
1074
+ this.applyTime();
1075
+ }
1076
+ /**
1077
+ * @ignore Typing in the hours field. The digits are held as a draft (so `0` can
1078
+ * be the start of `09`) and committed as soon as they form a valid hour.
1079
+ */
1080
+ onHoursInput(event) {
1081
+ if (!this.timeEditable())
1082
+ return; // read-only fields never emit natively — belt and braces
1083
+ const { min, max } = this.hourBounds();
1084
+ const digits = this.acceptTimeDigits(event, this.hoursValue(), max);
1085
+ if (digits === null)
1086
+ return;
1087
+ this.hoursDraft.set(digits);
1088
+ const n = Number(digits);
1089
+ if (!digits || n < min || n > max)
1090
+ return; // not an hour yet (e.g. `0` on a 12h clock)
1091
+ this.hours.set(this.hourFormat() === '12' ? this.to24(n) : n);
1092
+ this.applyTime();
1093
+ }
1094
+ /** @ignore Typing in the minutes field — exact value (`stepMinute` only drives the steppers). */
1095
+ onMinutesInput(event) {
1096
+ if (!this.timeEditable())
1097
+ return;
1098
+ const digits = this.acceptTimeDigits(event, this.minutesValue(), 59);
1099
+ if (digits === null || !digits)
1100
+ return;
1101
+ this.minutesDraft.set(digits);
1102
+ this.minutes.set(Number(digits));
1103
+ this.applyTime();
1104
+ }
1105
+ /**
1106
+ * @ignore Keep a time field to at most 2 digits and reject what can never be in
1107
+ * range (`33`, or `13` on a 12h clock) — the field reverts to `current`, so the
1108
+ * keystroke is simply refused. Returns the accepted digits, or `null` if rejected.
1109
+ */
1110
+ acceptTimeDigits(event, current, max) {
1111
+ const el = event.target;
1112
+ const digits = el.value.replace(/\D/g, '').slice(0, 2);
1113
+ const accepted = !digits || Number(digits) <= max;
1114
+ const text = accepted ? digits : current;
1115
+ // `[value]` is a no-op whenever the bound text is unchanged → write the DOM here.
1116
+ if (el.value !== text) {
1117
+ el.value = text;
1118
+ el.setSelectionRange(text.length, text.length);
1119
+ }
1120
+ return accepted ? digits : null;
1121
+ }
1122
+ /** @ignore 12h display hour (1–12) + the current meridiem → 24h hour. */
1123
+ to24(displayed) {
1124
+ return (displayed % 12) + (this.meridiem() === 'PM' ? 12 : 0);
1125
+ }
1126
+ /** @ignore Focusing a time field selects it, so typing replaces the value. */
1127
+ onTimeFocus(event) {
1128
+ event.target.select();
1129
+ }
1130
+ /** @ignore Leaving a time field drops the draft: the zero-padded label comes back. */
1131
+ onHoursBlur() {
1132
+ this.hoursDraft.set(null);
1133
+ }
1134
+ /** @ignore */
1135
+ onMinutesBlur() {
1136
+ this.minutesDraft.set(null);
1137
+ }
1138
+ /** @ignore ARIA spinbutton keyboard: ↑/↓ step, PageUp/PageDown ±, Enter commits. */
1139
+ onHourKeydown(event) {
1140
+ if (event.key === 'ArrowUp' || event.key === 'PageUp') {
1141
+ event.preventDefault();
1142
+ this.stepHours(1);
1143
+ }
1144
+ else if (event.key === 'ArrowDown' || event.key === 'PageDown') {
1145
+ event.preventDefault();
1146
+ this.stepHours(-1);
1147
+ }
1148
+ else if (event.key === 'Enter') {
1149
+ event.preventDefault(); // commit in place, never submit the surrounding form
1150
+ this.hoursDraft.set(null);
1151
+ }
1152
+ }
1153
+ /** @ignore */
1154
+ onMinuteKeydown(event) {
1155
+ if (event.key === 'ArrowUp' || event.key === 'PageUp') {
1156
+ event.preventDefault();
1157
+ this.stepMinutes(1);
1158
+ }
1159
+ else if (event.key === 'ArrowDown' || event.key === 'PageDown') {
1160
+ event.preventDefault();
1161
+ this.stepMinutes(-1);
1162
+ }
1163
+ else if (event.key === 'Enter') {
1164
+ event.preventDefault();
1165
+ this.minutesDraft.set(null);
1166
+ }
1167
+ }
1168
+ /** @ignore */
1169
+ onMeridiemKeydown(event) {
1170
+ if (!this.timeControlsEnabled())
1171
+ return;
1172
+ if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
1173
+ event.preventDefault();
1174
+ this.toggleMeridiem();
1175
+ }
1176
+ }
1177
+ /** @ignore */
1178
+ pad(n) {
1179
+ return String(n).padStart(2, '0');
1180
+ }
1181
+ /** @ignore */
1182
+ selectToday() {
1183
+ const today = startOfDay(new Date());
1184
+ if (this.isDateDisabled(today))
1185
+ return;
1186
+ if (this.showTime())
1187
+ today.setHours(this.hours(), this.minutes(), 0, 0);
1188
+ this.commit(this.selectionMode() === 'single' ? today : [today]);
1189
+ this.dateSelect.emit(this.serializeValue(today));
1190
+ this.viewDate.set(firstOfMonth(today));
1191
+ this.focusedDate.set(today);
1192
+ if (this.closeOnSelect() && !this.showTime() && !this.inline() && this.selectionMode() !== 'multiple')
1193
+ this.close();
1194
+ }
1195
+ /** @ignore */
1196
+ clear() {
1197
+ this.commit(null);
1198
+ this.cleared.emit();
1199
+ }
1200
+ // --- Grid keyboard navigation (roving focus, date view) ---------------
1201
+ /** @ignore */
1202
+ onGridKeydown(event) {
1203
+ const current = this.focusedDate();
1204
+ let next = null;
1205
+ switch (event.key) {
1206
+ case 'ArrowLeft':
1207
+ next = addDays(current, -1);
1208
+ break;
1209
+ case 'ArrowRight':
1210
+ next = addDays(current, 1);
1211
+ break;
1212
+ case 'ArrowUp':
1213
+ next = addDays(current, -7);
1214
+ break;
1215
+ case 'ArrowDown':
1216
+ next = addDays(current, 7);
1217
+ break;
1218
+ case 'Home':
1219
+ next = addDays(current, -((current.getDay() - this.firstDayOfWeek() + 7) % 7));
1220
+ break;
1221
+ case 'End':
1222
+ next = addDays(current, 6 - ((current.getDay() - this.firstDayOfWeek() + 7) % 7));
1223
+ break;
1224
+ case 'PageUp':
1225
+ next = addMonths(current, event.shiftKey ? -12 : -1);
1226
+ break;
1227
+ case 'PageDown':
1228
+ next = addMonths(current, event.shiftKey ? 12 : 1);
1229
+ break;
1230
+ case 'Enter':
1231
+ case ' ':
1232
+ event.preventDefault();
1233
+ this.selectDay(this.buildDay(startOfDay(current), this.viewDate()));
1234
+ return;
1235
+ case 'Escape':
1236
+ if (!this.inline())
1237
+ this.close();
1238
+ return;
1239
+ default:
1240
+ return;
1241
+ }
1242
+ event.preventDefault();
1243
+ if (!next)
1244
+ return;
1245
+ this.focusedDate.set(startOfDay(next));
1246
+ this.ensureMonthVisible(next);
1247
+ this.queueDayFocus();
1248
+ }
1249
+ /** @ignore The roving-focus cell. `otherMonth` cells are excluded so a date
1250
+ * shown twice across adjacent panels (multi-month) yields a single tab stop. */
1251
+ isFocusableDay(cell) {
1252
+ return !cell.otherMonth && isSameDay(cell.date, this.focusedDate());
1253
+ }
1254
+ // --- Grid keyboard navigation (roving focus, month/year pickers) -------
1255
+ /**
1256
+ * @ignore Shared arrow/Home/End math for a fixed-size, `columns`-wide grid (the month picker's
1257
+ * 12 cells / 3 columns and the year picker's 10 cells / 2 columns) — the one piece of roving-
1258
+ * focus logic actually common to all three grids; `PageUp`/`PageDown`/`Enter`/`Escape` differ
1259
+ * per grid (paging semantics, selecting a month vs. a year) and stay in their own handler.
1260
+ * Returns `null` for a key it doesn't handle.
1261
+ */
1262
+ navigateGridIndex(key, current, columns, count) {
1263
+ switch (key) {
1264
+ case 'ArrowLeft':
1265
+ return Math.max(0, current - 1);
1266
+ case 'ArrowRight':
1267
+ return Math.min(count - 1, current + 1);
1268
+ case 'ArrowUp':
1269
+ return current - columns >= 0 ? current - columns : current;
1270
+ case 'ArrowDown':
1271
+ return current + columns < count ? current + columns : current;
1272
+ case 'Home':
1273
+ return Math.floor(current / columns) * columns;
1274
+ case 'End':
1275
+ return Math.min(count - 1, Math.floor(current / columns) * columns + columns - 1);
1276
+ default:
1277
+ return null;
1278
+ }
1279
+ }
1280
+ /** @ignore Month-picker grid: ←↑→↓/Home/End move within the 12 months (3 columns), PageUp/PageDown
1281
+ * step the displayed year (Shift = ×10), Enter/Space picks the focused month. */
1282
+ onMonthGridKeydown(event) {
1283
+ const current = this.focusedMonthIndex();
1284
+ if (event.key === 'Enter' || event.key === ' ') {
1285
+ event.preventDefault();
1286
+ this.selectMonth(this.months()[current]);
1287
+ return;
1288
+ }
1289
+ if (event.key === 'Escape') {
1290
+ if (!this.inline())
1291
+ this.close();
1292
+ return;
1293
+ }
1294
+ if (event.key === 'PageUp' || event.key === 'PageDown') {
1295
+ event.preventDefault();
1296
+ const dir = event.key === 'PageUp' ? -1 : 1;
1297
+ const years = event.shiftKey ? 10 : 1;
1298
+ this.viewDate.set(new Date(this.viewDate().getFullYear() + dir * years, this.viewDate().getMonth(), 1));
1299
+ this.queueMonthFocus();
1300
+ return;
1301
+ }
1302
+ const next = this.navigateGridIndex(event.key, current, 3, 12);
1303
+ if (next === null)
1304
+ return;
1305
+ event.preventDefault();
1306
+ this.focusedMonthIndex.set(next);
1307
+ this.queueMonthFocus();
1308
+ }
1309
+ /** @ignore Year-picker grid: ←↑→↓/Home/End move within the displayed decade (2 columns),
1310
+ * PageUp/PageDown step by a decade (Shift = ×10 decades), Enter/Space picks the focused year. */
1311
+ onYearGridKeydown(event) {
1312
+ const current = this.focusedYear();
1313
+ if (event.key === 'Enter' || event.key === ' ') {
1314
+ event.preventDefault();
1315
+ this.selectYear(this.years()[current - this.decadeStart()]);
1316
+ return;
1317
+ }
1318
+ if (event.key === 'Escape') {
1319
+ if (!this.inline())
1320
+ this.close();
1321
+ return;
1322
+ }
1323
+ if (event.key === 'PageUp' || event.key === 'PageDown') {
1324
+ event.preventDefault();
1325
+ const dir = event.key === 'PageUp' ? -1 : 1;
1326
+ const delta = (event.shiftKey ? 100 : 10) * dir;
1327
+ this.viewDate.set(new Date(this.viewDate().getFullYear() + delta, this.viewDate().getMonth(), 1));
1328
+ this.focusedYear.set(current + delta);
1329
+ this.queueYearFocus();
1330
+ return;
1331
+ }
1332
+ const idx = this.navigateGridIndex(event.key, current - this.decadeStart(), 2, 10);
1333
+ if (idx === null)
1334
+ return;
1335
+ event.preventDefault();
1336
+ this.focusedYear.set(this.decadeStart() + idx);
1337
+ this.queueYearFocus();
1338
+ }
1339
+ /** @ignore The month-picker roving-focus cell. */
1340
+ isFocusableMonth(cell) {
1341
+ return cell.index === this.focusedMonthIndex();
1342
+ }
1343
+ /** @ignore The year-picker roving-focus cell. */
1344
+ isFocusableYear(cell) {
1345
+ return cell.year === this.focusedYear();
1346
+ }
1347
+ /** @ignore Shift the visible month window just enough to contain `date`. */
1348
+ ensureMonthVisible(date) {
1349
+ const count = Math.max(1, this.numberOfMonths());
1350
+ const start = firstOfMonth(this.viewDate());
1351
+ const end = addMonths(start, count - 1);
1352
+ const month = firstOfMonth(date);
1353
+ if (month < start)
1354
+ this.viewDate.set(month);
1355
+ else if (month > end)
1356
+ this.viewDate.set(addMonths(month, 1 - count));
1357
+ }
1358
+ // --- Internals -------------------------------------------------------
1359
+ /** @ignore Sole "normal" write path: takes internal Date(s), serializes to the public ISO
1360
+ * string(s) right here, before it ever reaches `modelValue`/the CVA. Callers keep passing
1361
+ * `Date`/`Date[]`/`null` exactly as before — the ISO contract lives entirely in this method. */
1362
+ commit(value) {
1363
+ this.typedValue.set(null); // any committed value re-formats the trigger
1364
+ this.internalValue.set(value ?? null);
1365
+ const external = this.toExternalValue(value ?? null);
1366
+ this.modelValue.set(external ?? undefined);
1367
+ this.emitChange(external);
1368
+ this.valueChange.emit(external);
1369
+ }
1370
+ /** @ignore Build a day-cell descriptor with its selection/range flags. */
1371
+ buildDay(date, viewMonth) {
1372
+ const today = startOfDay(new Date());
1373
+ const mode = this.selectionMode();
1374
+ const sel = this.selectedDates();
1375
+ let selected = false;
1376
+ let rangeStart = false;
1377
+ let rangeEnd = false;
1378
+ let inRange = false;
1379
+ if (mode === 'range') {
1380
+ const [s, e] = sel;
1381
+ if (s && isSameDay(date, s)) {
1382
+ rangeStart = true;
1383
+ selected = true;
1384
+ }
1385
+ if (e && isSameDay(date, e)) {
1386
+ rangeEnd = true;
1387
+ selected = true;
1388
+ }
1389
+ if (s && e && date > startOfDay(s) && date < startOfDay(e))
1390
+ inRange = true;
1391
+ }
1392
+ else {
1393
+ selected = sel.some((d) => isSameDay(d, date));
1394
+ }
1395
+ return {
1396
+ date,
1397
+ day: date.getDate(),
1398
+ month: date.getMonth(),
1399
+ year: date.getFullYear(),
1400
+ otherMonth: date.getMonth() !== viewMonth.getMonth(),
1401
+ today: isSameDay(date, today),
1402
+ selected,
1403
+ disabled: this.isDateDisabled(date),
1404
+ ariaLabel: this.dayAriaFormatter().format(date),
1405
+ rangeStart,
1406
+ rangeEnd,
1407
+ inRange,
1408
+ ts: date.getTime(),
1409
+ };
1410
+ }
1411
+ /** @ignore 6×7 grid for a given month, incl. adjacent-month spill-over. */
1412
+ buildMonthWeeks(monthDate) {
1413
+ const first = firstOfMonth(monthDate);
1414
+ const offset = (first.getDay() - this.firstDayOfWeek() + 7) % 7;
1415
+ const gridStart = addDays(first, -offset);
1416
+ return Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, d) => this.buildDay(addDays(gridStart, w * 7 + d), monthDate)));
1417
+ }
1418
+ /** @ignore */
1419
+ resolveOverlayOrigin() {
1420
+ const host = this.triggerRef()?.nativeElement;
1421
+ // Anchor on the bordered input box so a helper message below doesn't push the panel down.
1422
+ return host?.querySelector('.ui-field-box') ?? host ?? null;
1423
+ }
1424
+ /** @ignore Focus the roving-tabindex cell matching `selector`, once the DOM reflects the
1425
+ * just-updated `focusedDate`/`focusedMonthIndex`/`focusedYear` signal. */
1426
+ queueCellFocus(selector) {
1427
+ if (typeof requestAnimationFrame === 'undefined')
1428
+ return;
1429
+ requestAnimationFrame(() => {
1430
+ this.panelEl()?.nativeElement.querySelector(selector)?.focus();
1431
+ });
1432
+ }
1433
+ /** @ignore */
1434
+ queueDayFocus() {
1435
+ this.queueCellFocus('.ui-datepicker-day._focusable');
1436
+ }
1437
+ /** @ignore */
1438
+ queueMonthFocus() {
1439
+ this.queueCellFocus('.ui-datepicker-picker._month .ui-datepicker-cell._focusable');
1440
+ }
1441
+ /** @ignore */
1442
+ queueYearFocus() {
1443
+ this.queueCellFocus('.ui-datepicker-picker._year .ui-datepicker-cell._focusable');
1444
+ }
1445
+ /** @ignore */
1446
+ clampToRange(date) {
1447
+ const min = this.resolvedMinDate();
1448
+ const max = this.resolvedMaxDate();
1449
+ if (min && date < startOfDay(min))
1450
+ return startOfDay(min);
1451
+ if (max && date > startOfDay(max))
1452
+ return startOfDay(max);
1453
+ return date;
1454
+ }
1455
+ /** @ignore */
1456
+ isDateDisabled(date) {
1457
+ const min = this.resolvedMinDate();
1458
+ const max = this.resolvedMaxDate();
1459
+ if (min && date < startOfDay(min))
1460
+ return true;
1461
+ if (max && date > startOfDay(max))
1462
+ return true;
1463
+ if ((this.disabledDays() ?? []).includes(date.getDay()))
1464
+ return true;
1465
+ return this.resolvedDisabledDates().some((d) => isSameDay(d, date));
1466
+ }
1467
+ /** @ignore Whole month out of [min, max]. */
1468
+ isMonthDisabled(year, month) {
1469
+ const min = this.resolvedMinDate();
1470
+ const max = this.resolvedMaxDate();
1471
+ if (min && new Date(year, month + 1, 0) < startOfDay(min))
1472
+ return true;
1473
+ if (max && new Date(year, month, 1) > startOfDay(max))
1474
+ return true;
1475
+ return false;
1476
+ }
1477
+ /** @ignore Whole year out of [min, max]. */
1478
+ isYearDisabled(year) {
1479
+ const min = this.resolvedMinDate();
1480
+ const max = this.resolvedMaxDate();
1481
+ if (min && year < min.getFullYear())
1482
+ return true;
1483
+ if (max && year > max.getFullYear())
1484
+ return true;
1485
+ return false;
1486
+ }
1487
+ /** @ignore */
1488
+ capitalize(s) {
1489
+ return s.charAt(0).toUpperCase() + s.slice(1);
1490
+ }
1491
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: UiDatepicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1492
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: UiDatepicker, isStandalone: true, selector: "ui-datepicker", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, showIcon: { classPropertyName: "showIcon", publicName: "showIcon", isSignal: true, isRequired: false, transformFunction: null }, iconAriaLabel: { classPropertyName: "iconAriaLabel", publicName: "iconAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, valueType: { classPropertyName: "valueType", publicName: "valueType", isSignal: true, isRequired: true, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, numberOfMonths: { classPropertyName: "numberOfMonths", publicName: "numberOfMonths", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, disabledDays: { classPropertyName: "disabledDays", publicName: "disabledDays", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "dateFormat", isSignal: true, isRequired: false, transformFunction: null }, allowInput: { classPropertyName: "allowInput", publicName: "allowInput", isSignal: true, isRequired: false, transformFunction: null }, parseDate: { classPropertyName: "parseDate", publicName: "parseDate", isSignal: true, isRequired: false, transformFunction: null }, showTime: { classPropertyName: "showTime", publicName: "showTime", isSignal: true, isRequired: false, transformFunction: null }, timeOnly: { classPropertyName: "timeOnly", publicName: "timeOnly", isSignal: true, isRequired: false, transformFunction: null }, hourFormat: { classPropertyName: "hourFormat", publicName: "hourFormat", isSignal: true, isRequired: false, transformFunction: null }, stepMinute: { classPropertyName: "stepMinute", publicName: "stepMinute", isSignal: true, isRequired: false, transformFunction: null }, editableTime: { classPropertyName: "editableTime", publicName: "editableTime", isSignal: true, isRequired: false, transformFunction: null }, showButtonBar: { classPropertyName: "showButtonBar", publicName: "showButtonBar", isSignal: true, isRequired: false, transformFunction: null }, todayLabel: { classPropertyName: "todayLabel", publicName: "todayLabel", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, panelAriaLabel: { classPropertyName: "panelAriaLabel", publicName: "panelAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, prevAriaLabel: { classPropertyName: "prevAriaLabel", publicName: "prevAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, nextAriaLabel: { classPropertyName: "nextAriaLabel", publicName: "nextAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, hoursAriaLabel: { classPropertyName: "hoursAriaLabel", publicName: "hoursAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, minutesAriaLabel: { classPropertyName: "minutesAriaLabel", publicName: "minutesAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, meridiemAriaLabel: { classPropertyName: "meridiemAriaLabel", publicName: "meridiemAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, incrementHoursAriaLabel: { classPropertyName: "incrementHoursAriaLabel", publicName: "incrementHoursAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, decrementHoursAriaLabel: { classPropertyName: "decrementHoursAriaLabel", publicName: "decrementHoursAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, incrementMinutesAriaLabel: { classPropertyName: "incrementMinutesAriaLabel", publicName: "incrementMinutesAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, decrementMinutesAriaLabel: { classPropertyName: "decrementMinutesAriaLabel", publicName: "decrementMinutesAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, toggleMeridiemAriaLabel: { classPropertyName: "toggleMeridiemAriaLabel", publicName: "toggleMeridiemAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null }, autoFlip: { classPropertyName: "autoFlip", publicName: "autoFlip", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, panelStyleClass: { classPropertyName: "panelStyleClass", publicName: "panelStyleClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", dateSelect: "dateSelect", monthChange: "monthChange", opened: "opened", closed: "closed", cleared: "cleared", inputFocus: "inputFocus", inputBlur: "inputBlur" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiDatepicker), multi: true }], queries: [{ propertyName: "dateTemplate", first: true, predicate: ["date"], descendants: true, isSignal: true }, { propertyName: "buttonBarTemplate", first: true, predicate: ["buttonbar"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "triggerInput", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "triggerRef", first: true, predicate: ["trigger"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "panelEl", first: true, predicate: ["panel"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<!-- Calendar panel: shared between inline render and the CDK overlay. -->\n<ng-template #calendarTpl>\n <div\n #panel\n class=\"ui-datepicker-panel\"\n [class]=\"panelStyleClass()\"\n [class._inline]=\"inline()\"\n [attr.id]=\"panelId\"\n role=\"dialog\"\n [attr.aria-modal]=\"inline() ? null : 'true'\"\n [cdkTrapFocus]=\"!inline()\"\n [attr.aria-label]=\"label() || ariaLabel() || panelAriaLabel()\"\n >\n @if (showCalendar()) {\n <!-- Shared header (single-month): prev / title (drill-up) / next.\n Multi-month puts the arrows + titles in each panel's own header. -->\n @if (singleMonth()) {\n <div class=\"ui-datepicker-header\">\n <button type=\"button\" class=\"ui-datepicker-nav\" [attr.aria-label]=\"prevAriaLabel()\" (click)=\"onPrev()\">\n <ui-icon name=\"chevron-left\" size=\"sm\" />\n </button>\n <button\n type=\"button\"\n class=\"ui-datepicker-title _button\"\n aria-live=\"polite\"\n [disabled]=\"currentView() === 'year'\"\n (click)=\"onHeaderClick()\"\n >\n {{ headerLabel() }}\n </button>\n <button type=\"button\" class=\"ui-datepicker-nav\" [attr.aria-label]=\"nextAriaLabel()\" (click)=\"onNext()\">\n <ui-icon name=\"chevron-right\" size=\"sm\" />\n </button>\n </div>\n }\n\n <!-- YEAR view -->\n @if (currentView() === 'year') {\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div class=\"ui-datepicker-picker _year\" role=\"grid\" (keydown)=\"onYearGridKeydown($event)\">\n @for (y of years(); track y.year) {\n <button\n type=\"button\"\n role=\"gridcell\"\n class=\"ui-datepicker-cell\"\n [class._selected]=\"y.selected\"\n [class._focusable]=\"isFocusableYear(y)\"\n [disabled]=\"y.disabled\"\n [attr.tabindex]=\"isFocusableYear(y) ? 0 : -1\"\n [attr.aria-selected]=\"y.selected\"\n (click)=\"selectYear(y)\"\n >\n {{ y.year }}\n </button>\n }\n </div>\n }\n\n <!-- MONTH view -->\n @else if (currentView() === 'month') {\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div class=\"ui-datepicker-picker _month\" role=\"grid\" (keydown)=\"onMonthGridKeydown($event)\">\n @for (m of months(); track m.index) {\n <button\n type=\"button\"\n role=\"gridcell\"\n class=\"ui-datepicker-cell\"\n [class._selected]=\"m.selected\"\n [class._focusable]=\"isFocusableMonth(m)\"\n [disabled]=\"m.disabled\"\n [attr.tabindex]=\"isFocusableMonth(m) ? 0 : -1\"\n [attr.aria-selected]=\"m.selected\"\n (click)=\"selectMonth(m)\"\n >\n {{ m.label }}\n </button>\n }\n </div>\n }\n\n <!-- DATE view (one or several month panels) -->\n @else {\n <!-- Calendar grid: keyboard delegated to the container, focus lives on\n the gridcell buttons (roving tabindex). -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div class=\"ui-datepicker-months\" (keydown)=\"onGridKeydown($event)\">\n @for (mp of monthPanels(); track mp.monthDate.getTime()) {\n <div class=\"ui-datepicker-month\">\n @if (!singleMonth()) {\n <!-- Per-panel header: prev on the first panel, next on the last, title centered. -->\n <div class=\"ui-datepicker-subheader\">\n @if (mp.showPrev) {\n <button type=\"button\" class=\"ui-datepicker-nav\" [attr.aria-label]=\"prevAriaLabel()\" (click)=\"onPrev()\">\n <ui-icon name=\"chevron-left\" size=\"sm\" />\n </button>\n } @else {\n <span class=\"ui-datepicker-nav-spacer\" aria-hidden=\"true\"></span>\n }\n <span class=\"ui-datepicker-title\" aria-live=\"polite\">{{ mp.label }}</span>\n @if (mp.showNext) {\n <button type=\"button\" class=\"ui-datepicker-nav\" [attr.aria-label]=\"nextAriaLabel()\" (click)=\"onNext()\">\n <ui-icon name=\"chevron-right\" size=\"sm\" />\n </button>\n } @else {\n <span class=\"ui-datepicker-nav-spacer\" aria-hidden=\"true\"></span>\n }\n </div>\n }\n\n <div class=\"ui-datepicker-grid\" role=\"grid\">\n <div class=\"ui-datepicker-weekdays\" role=\"row\">\n @for (wd of weekDayNames(); track $index) {\n <span class=\"ui-datepicker-weekday\" role=\"columnheader\" [attr.aria-label]=\"wd.full\">{{ wd.short }}</span>\n }\n </div>\n @for (week of mp.weeks; track $index) {\n <div class=\"ui-datepicker-week\" role=\"row\">\n @for (cell of week; track cell.ts) {\n <button\n type=\"button\"\n role=\"gridcell\"\n class=\"ui-datepicker-day\"\n [class._selected]=\"cell.selected\"\n [class._today]=\"cell.today && !cell.selected\"\n [class._other-month]=\"cell.otherMonth\"\n [class._range-start]=\"cell.rangeStart\"\n [class._range-end]=\"cell.rangeEnd\"\n [class._in-range]=\"cell.inRange\"\n [class._focusable]=\"isFocusableDay(cell)\"\n [disabled]=\"cell.disabled\"\n [attr.tabindex]=\"isFocusableDay(cell) ? 0 : -1\"\n [attr.aria-selected]=\"cell.selected\"\n [attr.aria-current]=\"cell.today ? 'date' : null\"\n [attr.aria-label]=\"cell.ariaLabel\"\n (click)=\"selectDay(cell)\"\n >\n @if (dateTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"{ $implicit: cell, selected: cell.selected }\" />\n } @else {\n {{ cell.day }}\n }\n </button>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n }\n\n <!-- Time selection \u2014 vertical steppers (ARIA spinbutton pattern) -->\n @if (showTime()) {\n <div class=\"ui-datepicker-time\">\n <!-- Hours -->\n <div class=\"ui-datepicker-time-unit\">\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"incrementHoursAriaLabel()\" (click)=\"stepHours(1)\">\n <ui-icon name=\"chevron-up\" size=\"sm\" />\n </button>\n <input\n class=\"ui-datepicker-time-value\"\n type=\"text\"\n inputmode=\"numeric\"\n autocomplete=\"off\"\n maxlength=\"2\"\n role=\"spinbutton\"\n [attr.aria-label]=\"hoursAriaLabel()\"\n [attr.aria-valuenow]=\"hourFormat() === '12' ? displayHours() : hours()\"\n [attr.aria-valuemin]=\"hourBounds().min\"\n [attr.aria-valuemax]=\"hourBounds().max\"\n [attr.aria-valuetext]=\"hoursLabel()\"\n [value]=\"hoursValue()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"!timeEditable()\"\n (input)=\"onHoursInput($event)\"\n (focus)=\"onTimeFocus($event)\"\n (blur)=\"onHoursBlur()\"\n (keydown)=\"onHourKeydown($event)\"\n />\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"decrementHoursAriaLabel()\" (click)=\"stepHours(-1)\">\n <ui-icon name=\"chevron-down\" size=\"sm\" />\n </button>\n </div>\n\n <span class=\"ui-datepicker-time-colon\" aria-hidden=\"true\">:</span>\n\n <!-- Minutes -->\n <div class=\"ui-datepicker-time-unit\">\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"incrementMinutesAriaLabel()\" (click)=\"stepMinutes(1)\">\n <ui-icon name=\"chevron-up\" size=\"sm\" />\n </button>\n <input\n class=\"ui-datepicker-time-value\"\n type=\"text\"\n inputmode=\"numeric\"\n autocomplete=\"off\"\n maxlength=\"2\"\n role=\"spinbutton\"\n [attr.aria-label]=\"minutesAriaLabel()\"\n [attr.aria-valuenow]=\"minutes()\"\n aria-valuemin=\"0\"\n aria-valuemax=\"59\"\n [attr.aria-valuetext]=\"minutesLabel()\"\n [value]=\"minutesValue()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"!timeEditable()\"\n (input)=\"onMinutesInput($event)\"\n (focus)=\"onTimeFocus($event)\"\n (blur)=\"onMinutesBlur()\"\n (keydown)=\"onMinuteKeydown($event)\"\n />\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"decrementMinutesAriaLabel()\" (click)=\"stepMinutes(-1)\">\n <ui-icon name=\"chevron-down\" size=\"sm\" />\n </button>\n </div>\n\n <!-- Meridiem (12h) -->\n @if (hourFormat() === '12') {\n <span class=\"ui-datepicker-time-colon\" aria-hidden=\"true\">:</span>\n <div class=\"ui-datepicker-time-unit\">\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"toggleMeridiemAriaLabel()\" (click)=\"toggleMeridiem()\">\n <ui-icon name=\"chevron-up\" size=\"sm\" />\n </button>\n <span\n class=\"ui-datepicker-time-value\"\n role=\"spinbutton\"\n [attr.tabindex]=\"timeControlsEnabled() ? 0 : -1\"\n [attr.aria-label]=\"meridiemAriaLabel()\"\n [attr.aria-valuetext]=\"meridiem()\"\n [attr.aria-disabled]=\"!timeControlsEnabled() || null\"\n (keydown)=\"onMeridiemKeydown($event)\"\n (click)=\"toggleMeridiem()\"\n >\n {{ meridiem() }}\n </span>\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"toggleMeridiemAriaLabel()\" (click)=\"toggleMeridiem()\">\n <ui-icon name=\"chevron-down\" size=\"sm\" />\n </button>\n </div>\n }\n </div>\n }\n\n <!-- Button bar (custom template or default) -->\n @if (showButtonBar() || buttonBarTemplate()) {\n <div class=\"ui-datepicker-buttonbar\">\n @if (buttonBarTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: todayCallback, todayCallback: todayCallback, clearCallback: clearCallback }\"\n />\n } @else {\n <ui-button size=\"small\" level=\"low\" [label]=\"todayLabel()\" (buttonClick)=\"selectToday()\" />\n <ui-button size=\"small\" level=\"low\" [label]=\"clearLabel()\" (buttonClick)=\"clear()\" />\n }\n </div>\n }\n </div>\n</ng-template>\n\n@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"calendarTpl\" />\n} @else {\n <!-- Trigger: readonly composed field. Clicking the field or the icon opens the panel. -->\n <!-- Convenience wrapper: focus and keyboard are carried by the inner ui-input. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div class=\"ui-datepicker-trigger\" (click)=\"open()\" (keydown)=\"onTriggerKeydown($event)\">\n <ui-input\n #trigger\n [label]=\"label()\"\n [helperText]=\"helperText()\"\n [errorText]=\"errorText()\"\n [placeholder]=\"resolvedPlaceholder()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"triggerReadonly()\"\n [invalid]=\"isInvalid()\"\n [name]=\"name() ?? ''\"\n [inputId]=\"resolvedId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [tabindex]=\"tabindex()\"\n [value]=\"displayValue()\"\n [iconRight]=\"triggerIcon()\"\n [iconRightAriaLabel]=\"triggerIconAriaLabel()\"\n ariaHasPopup=\"dialog\"\n [ariaExpanded]=\"panelOpen()\"\n [ariaControls]=\"panelOpen() ? panelId : undefined\"\n (iconRightClick)=\"onIconClick($event)\"\n (valueChange)=\"onTriggerInput($event)\"\n (inputFocus)=\"inputFocus.emit($event)\"\n (inputBlur)=\"onTriggerBlur($event)\"\n />\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin()!\"\n [cdkConnectedOverlayOpen]=\"panelOpen()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions()\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"close(false)\"\n (overlayOutsideClick)=\"close(false)\"\n (detach)=\"close(false)\"\n >\n <ng-container [ngTemplateOutlet]=\"calendarTpl\" />\n </ng-template>\n}\n", styles: [".ui-datepicker-trigger{display:block;cursor:pointer}.ui-datepicker-panel{display:flex;flex-direction:column;gap:var(--units-sm);box-sizing:border-box;width:max-content;max-width:calc(100vw - var(--units-lg));padding:var(--units-sm);border:var(--stroke-default) solid var(--form-high-stroke-default);border-radius:var(--radius-default);background-color:var(--form-high-surface-default);box-shadow:var(--shadow-default-md);font-family:var(--fontfamily-base)}.ui-datepicker-panel._inline{box-shadow:none}.ui-datepicker-header{display:flex;align-items:center;justify-content:space-between;gap:var(--units-sm)}.ui-datepicker-nav{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:var(--size-components-default);height:var(--size-components-default);padding:0;border:none;border-radius:var(--radius-full);background:none;color:var(--informative-defaultlow-content-default);cursor:pointer;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-datepicker-nav:hover{background-color:var(--informative-highlightlow-surface-hover);color:var(--informative-defaultlow-content-hover)}.ui-datepicker-nav:focus-visible{outline:none;box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-datepicker-title{flex:1 1 auto;text-align:center;font-size:var(--size-typography-title-md);font-weight:var(--weight-bold);color:var(--form-high-content-default)}.ui-datepicker-title._button{padding:var(--units-2xs) var(--units-sm);border:none;border-radius:var(--radius-sm);background:none;font-family:var(--fontfamily-base);cursor:pointer;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-datepicker-title._button:hover:not(:disabled){background-color:var(--informative-highlightlow-surface-hover)}.ui-datepicker-title._button:focus-visible{outline:none;box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-datepicker-title._button:disabled{cursor:default}.ui-datepicker-months{display:flex;gap:var(--units-lg)}.ui-datepicker-month{display:flex;flex-direction:column;gap:var(--units-sm);flex:0 0 auto;width:22.5rem}.ui-datepicker-month:not(:first-child){border-left:var(--stroke-default) solid var(--form-high-stroke-default);padding-left:var(--units-lg)}.ui-datepicker-subheader{display:flex;align-items:center;gap:var(--units-sm)}.ui-datepicker-nav-spacer{flex-shrink:0;width:var(--size-components-default);height:var(--size-components-default)}.ui-datepicker-picker{display:grid;gap:var(--units-xs);width:22.5rem}.ui-datepicker-picker._month{grid-template-columns:repeat(3,1fr)}.ui-datepicker-picker._year{grid-template-columns:repeat(2,1fr)}.ui-datepicker-cell{display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-height:var(--size-components-sm);padding:var(--units-sm) var(--units-md);border:var(--stroke-default) solid transparent;border-radius:var(--radius-sm);background-color:var(--actions-low-surface-default);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default);cursor:pointer;transition:background-color var(--transition-default) var(--transition-easeinout),border-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-datepicker-cell:hover:not(:disabled){background-color:var(--actions-low-surface-hover)}.ui-datepicker-cell:active:not(:disabled){background-color:var(--actions-low-surface-pressed)}.ui-datepicker-cell:focus-visible{outline:none;background-color:var(--actions-low-surface-focused);box-shadow:0 0 0 var(--units-2xs) rgb(from var(--actions-high-stroke-focused) r g b/50%)}.ui-datepicker-cell._selected{background-color:var(--actions-high-surface-default);color:var(--actions-high-content-default)}.ui-datepicker-cell._selected:hover:not(:disabled){background-color:var(--actions-high-surface-hover)}.ui-datepicker-cell:disabled{color:var(--form-high-content-disabled);cursor:not-allowed}.ui-datepicker-weekdays,.ui-datepicker-week{display:grid;grid-template-columns:repeat(7,1fr);justify-items:center;align-items:center}.ui-datepicker-weekday{padding:var(--units-xs) 0;font-size:var(--size-typography-text-md);font-weight:var(--weight-bold);color:var(--form-low-content-default);-webkit-user-select:none;user-select:none}.ui-datepicker-grid{display:flex;flex-direction:column;gap:var(--units-xs)}.ui-datepicker-day{position:relative;z-index:0;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:100%;height:var(--size-components-default);padding:0;border:none;background:transparent;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default);cursor:pointer;transition:color var(--transition-default) var(--transition-easeinout)}.ui-datepicker-day:before{content:\"\";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--size-components-default);height:var(--size-components-default);border:var(--stroke-default) solid transparent;border-radius:var(--radius-full);z-index:-1;transition:background-color var(--transition-default) var(--transition-easeinout),border-color var(--transition-default) var(--transition-easeinout),box-shadow var(--transition-default) var(--transition-easeinout)}.ui-datepicker-day:hover:not(:disabled):before{background-color:var(--actions-low-surface-hover)}.ui-datepicker-day:active:not(:disabled):before{background-color:var(--actions-low-surface-pressed)}.ui-datepicker-day:focus-visible{outline:none}.ui-datepicker-day:focus-visible:before{background-color:var(--actions-low-surface-focused);box-shadow:0 0 0 var(--units-2xs) rgb(from var(--actions-high-stroke-focused) r g b/50%)}.ui-datepicker-day._other-month{color:var(--form-low-content-default);opacity:.6}.ui-datepicker-day._today:before{border-color:var(--actions-high-stroke-default)}.ui-datepicker-day._today:hover:not(:disabled):before{border-color:var(--actions-high-stroke-hover)}.ui-datepicker-day._today:focus-visible:before{border-color:var(--actions-high-stroke-focused)}.ui-datepicker-day._selected{color:var(--actions-high-content-default)}.ui-datepicker-day._selected:before{background-color:var(--actions-high-surface-default)}.ui-datepicker-day._selected:hover:not(:disabled){color:var(--actions-high-content-hover)}.ui-datepicker-day._selected:hover:not(:disabled):before{background-color:var(--actions-high-surface-hover)}.ui-datepicker-day._selected:focus-visible{color:var(--actions-high-content-focused)}.ui-datepicker-day._selected:focus-visible:before{background-color:var(--actions-high-surface-focused)}.ui-datepicker-day._in-range,.ui-datepicker-day._range-start,.ui-datepicker-day._range-end{border-top:var(--stroke-default) solid var(--actions-high-stroke-default);border-bottom:var(--stroke-default) solid var(--actions-high-stroke-default)}.ui-datepicker-day._in-range{background-color:var(--informative-highlightlow-surface-hover)}.ui-datepicker-day._range-start{background:linear-gradient(to right,transparent 50%,var(--informative-highlightlow-surface-hover) 50%)}.ui-datepicker-day._range-end{background:linear-gradient(to left,transparent 50%,var(--informative-highlightlow-surface-hover) 50%)}.ui-datepicker-day._range-start._range-end{background:transparent}.ui-datepicker-day:disabled{color:var(--form-high-content-disabled);opacity:.45;cursor:not-allowed}.ui-datepicker-time{display:flex;align-items:center;justify-content:center;gap:var(--units-sm);padding-top:var(--units-sm);border-top:var(--stroke-default) solid var(--form-high-stroke-default)}.ui-datepicker-time:first-child{padding-top:0;border-top:none}.ui-datepicker-time-unit{display:flex;flex-direction:column;align-items:center;gap:var(--units-2xs)}.ui-datepicker-time-value{box-sizing:border-box;display:inline-block;width:3rem;padding:var(--units-2xs) var(--units-sm);border:none;border-radius:var(--radius-sm);background:none;font-family:var(--fontfamily-base);font-size:var(--size-typography-title-md);font-weight:var(--weight-bold);font-variant-numeric:tabular-nums;color:var(--form-high-content-default);text-align:center;cursor:text;appearance:none;transition:background-color var(--transition-default) var(--transition-easeinout),box-shadow var(--transition-default) var(--transition-easeinout)}.ui-datepicker-time-value:read-only{cursor:pointer}.ui-datepicker-time-value:hover:not(:disabled):not([aria-disabled=true]){background-color:var(--informative-highlightlow-surface-hover)}.ui-datepicker-time-value:focus-visible{outline:none;box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-datepicker-time-value:disabled,.ui-datepicker-time-value[aria-disabled=true]{color:var(--form-high-content-disabled);cursor:not-allowed}.ui-datepicker-time-btn{display:flex;align-items:center;justify-content:center;width:var(--size-components-xs);height:var(--size-components-2xs);padding:0;border:none;border-radius:var(--radius-sm);background:none;color:var(--form-low-content-default);cursor:pointer;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-datepicker-time-btn:hover:not(:disabled){background-color:var(--informative-highlightlow-surface-hover);color:var(--form-high-content-hover)}.ui-datepicker-time-btn:disabled{color:var(--form-high-content-disabled);cursor:not-allowed}.ui-datepicker-time-colon{font-size:var(--size-typography-title-md);font-weight:var(--weight-bold);color:var(--form-high-content-default)}.ui-datepicker-buttonbar{display:flex;align-items:center;justify-content:space-between;gap:var(--units-sm);padding-top:var(--units-sm);border-top:var(--stroke-default) solid var(--form-high-stroke-default)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: UiInput, selector: "ui-input", inputs: ["type", "value", "ariaHasPopup", "ariaExpanded", "ariaControls", "placeholder", "unit", "iconLeft", "iconRight", "iconRightAriaLabel", "autocomplete", "maxlength"], outputs: ["valueChange", "iconRightClick", "inputFocus", "inputBlur"] }, { kind: "component", type: UiButton, selector: "ui-button", inputs: ["label", "ariaLabel", "type", "level", "variant", "onColor", "size", "icon", "iconPos", "iconOnly", "loading", "loadingIcon", "expanded", "rounded", "disabled", "tabindex", "buttonProps", "iconTemplate", "loadingIconTemplate", "href", "routerLink", "target", "rel"], outputs: ["buttonClick", "buttonFocus", "buttonBlur"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }] }); }
1493
+ }
1494
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: UiDatepicker, decorators: [{
1495
+ type: Component,
1496
+ args: [{ selector: 'ui-datepicker', imports: [NgTemplateOutlet, OverlayModule, CdkTrapFocus, UiInput, UiButton, UiIcon], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiDatepicker), multi: true }], template: "<!-- Calendar panel: shared between inline render and the CDK overlay. -->\n<ng-template #calendarTpl>\n <div\n #panel\n class=\"ui-datepicker-panel\"\n [class]=\"panelStyleClass()\"\n [class._inline]=\"inline()\"\n [attr.id]=\"panelId\"\n role=\"dialog\"\n [attr.aria-modal]=\"inline() ? null : 'true'\"\n [cdkTrapFocus]=\"!inline()\"\n [attr.aria-label]=\"label() || ariaLabel() || panelAriaLabel()\"\n >\n @if (showCalendar()) {\n <!-- Shared header (single-month): prev / title (drill-up) / next.\n Multi-month puts the arrows + titles in each panel's own header. -->\n @if (singleMonth()) {\n <div class=\"ui-datepicker-header\">\n <button type=\"button\" class=\"ui-datepicker-nav\" [attr.aria-label]=\"prevAriaLabel()\" (click)=\"onPrev()\">\n <ui-icon name=\"chevron-left\" size=\"sm\" />\n </button>\n <button\n type=\"button\"\n class=\"ui-datepicker-title _button\"\n aria-live=\"polite\"\n [disabled]=\"currentView() === 'year'\"\n (click)=\"onHeaderClick()\"\n >\n {{ headerLabel() }}\n </button>\n <button type=\"button\" class=\"ui-datepicker-nav\" [attr.aria-label]=\"nextAriaLabel()\" (click)=\"onNext()\">\n <ui-icon name=\"chevron-right\" size=\"sm\" />\n </button>\n </div>\n }\n\n <!-- YEAR view -->\n @if (currentView() === 'year') {\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div class=\"ui-datepicker-picker _year\" role=\"grid\" (keydown)=\"onYearGridKeydown($event)\">\n @for (y of years(); track y.year) {\n <button\n type=\"button\"\n role=\"gridcell\"\n class=\"ui-datepicker-cell\"\n [class._selected]=\"y.selected\"\n [class._focusable]=\"isFocusableYear(y)\"\n [disabled]=\"y.disabled\"\n [attr.tabindex]=\"isFocusableYear(y) ? 0 : -1\"\n [attr.aria-selected]=\"y.selected\"\n (click)=\"selectYear(y)\"\n >\n {{ y.year }}\n </button>\n }\n </div>\n }\n\n <!-- MONTH view -->\n @else if (currentView() === 'month') {\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div class=\"ui-datepicker-picker _month\" role=\"grid\" (keydown)=\"onMonthGridKeydown($event)\">\n @for (m of months(); track m.index) {\n <button\n type=\"button\"\n role=\"gridcell\"\n class=\"ui-datepicker-cell\"\n [class._selected]=\"m.selected\"\n [class._focusable]=\"isFocusableMonth(m)\"\n [disabled]=\"m.disabled\"\n [attr.tabindex]=\"isFocusableMonth(m) ? 0 : -1\"\n [attr.aria-selected]=\"m.selected\"\n (click)=\"selectMonth(m)\"\n >\n {{ m.label }}\n </button>\n }\n </div>\n }\n\n <!-- DATE view (one or several month panels) -->\n @else {\n <!-- Calendar grid: keyboard delegated to the container, focus lives on\n the gridcell buttons (roving tabindex). -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div class=\"ui-datepicker-months\" (keydown)=\"onGridKeydown($event)\">\n @for (mp of monthPanels(); track mp.monthDate.getTime()) {\n <div class=\"ui-datepicker-month\">\n @if (!singleMonth()) {\n <!-- Per-panel header: prev on the first panel, next on the last, title centered. -->\n <div class=\"ui-datepicker-subheader\">\n @if (mp.showPrev) {\n <button type=\"button\" class=\"ui-datepicker-nav\" [attr.aria-label]=\"prevAriaLabel()\" (click)=\"onPrev()\">\n <ui-icon name=\"chevron-left\" size=\"sm\" />\n </button>\n } @else {\n <span class=\"ui-datepicker-nav-spacer\" aria-hidden=\"true\"></span>\n }\n <span class=\"ui-datepicker-title\" aria-live=\"polite\">{{ mp.label }}</span>\n @if (mp.showNext) {\n <button type=\"button\" class=\"ui-datepicker-nav\" [attr.aria-label]=\"nextAriaLabel()\" (click)=\"onNext()\">\n <ui-icon name=\"chevron-right\" size=\"sm\" />\n </button>\n } @else {\n <span class=\"ui-datepicker-nav-spacer\" aria-hidden=\"true\"></span>\n }\n </div>\n }\n\n <div class=\"ui-datepicker-grid\" role=\"grid\">\n <div class=\"ui-datepicker-weekdays\" role=\"row\">\n @for (wd of weekDayNames(); track $index) {\n <span class=\"ui-datepicker-weekday\" role=\"columnheader\" [attr.aria-label]=\"wd.full\">{{ wd.short }}</span>\n }\n </div>\n @for (week of mp.weeks; track $index) {\n <div class=\"ui-datepicker-week\" role=\"row\">\n @for (cell of week; track cell.ts) {\n <button\n type=\"button\"\n role=\"gridcell\"\n class=\"ui-datepicker-day\"\n [class._selected]=\"cell.selected\"\n [class._today]=\"cell.today && !cell.selected\"\n [class._other-month]=\"cell.otherMonth\"\n [class._range-start]=\"cell.rangeStart\"\n [class._range-end]=\"cell.rangeEnd\"\n [class._in-range]=\"cell.inRange\"\n [class._focusable]=\"isFocusableDay(cell)\"\n [disabled]=\"cell.disabled\"\n [attr.tabindex]=\"isFocusableDay(cell) ? 0 : -1\"\n [attr.aria-selected]=\"cell.selected\"\n [attr.aria-current]=\"cell.today ? 'date' : null\"\n [attr.aria-label]=\"cell.ariaLabel\"\n (click)=\"selectDay(cell)\"\n >\n @if (dateTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"{ $implicit: cell, selected: cell.selected }\" />\n } @else {\n {{ cell.day }}\n }\n </button>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n }\n\n <!-- Time selection \u2014 vertical steppers (ARIA spinbutton pattern) -->\n @if (showTime()) {\n <div class=\"ui-datepicker-time\">\n <!-- Hours -->\n <div class=\"ui-datepicker-time-unit\">\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"incrementHoursAriaLabel()\" (click)=\"stepHours(1)\">\n <ui-icon name=\"chevron-up\" size=\"sm\" />\n </button>\n <input\n class=\"ui-datepicker-time-value\"\n type=\"text\"\n inputmode=\"numeric\"\n autocomplete=\"off\"\n maxlength=\"2\"\n role=\"spinbutton\"\n [attr.aria-label]=\"hoursAriaLabel()\"\n [attr.aria-valuenow]=\"hourFormat() === '12' ? displayHours() : hours()\"\n [attr.aria-valuemin]=\"hourBounds().min\"\n [attr.aria-valuemax]=\"hourBounds().max\"\n [attr.aria-valuetext]=\"hoursLabel()\"\n [value]=\"hoursValue()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"!timeEditable()\"\n (input)=\"onHoursInput($event)\"\n (focus)=\"onTimeFocus($event)\"\n (blur)=\"onHoursBlur()\"\n (keydown)=\"onHourKeydown($event)\"\n />\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"decrementHoursAriaLabel()\" (click)=\"stepHours(-1)\">\n <ui-icon name=\"chevron-down\" size=\"sm\" />\n </button>\n </div>\n\n <span class=\"ui-datepicker-time-colon\" aria-hidden=\"true\">:</span>\n\n <!-- Minutes -->\n <div class=\"ui-datepicker-time-unit\">\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"incrementMinutesAriaLabel()\" (click)=\"stepMinutes(1)\">\n <ui-icon name=\"chevron-up\" size=\"sm\" />\n </button>\n <input\n class=\"ui-datepicker-time-value\"\n type=\"text\"\n inputmode=\"numeric\"\n autocomplete=\"off\"\n maxlength=\"2\"\n role=\"spinbutton\"\n [attr.aria-label]=\"minutesAriaLabel()\"\n [attr.aria-valuenow]=\"minutes()\"\n aria-valuemin=\"0\"\n aria-valuemax=\"59\"\n [attr.aria-valuetext]=\"minutesLabel()\"\n [value]=\"minutesValue()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"!timeEditable()\"\n (input)=\"onMinutesInput($event)\"\n (focus)=\"onTimeFocus($event)\"\n (blur)=\"onMinutesBlur()\"\n (keydown)=\"onMinuteKeydown($event)\"\n />\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"decrementMinutesAriaLabel()\" (click)=\"stepMinutes(-1)\">\n <ui-icon name=\"chevron-down\" size=\"sm\" />\n </button>\n </div>\n\n <!-- Meridiem (12h) -->\n @if (hourFormat() === '12') {\n <span class=\"ui-datepicker-time-colon\" aria-hidden=\"true\">:</span>\n <div class=\"ui-datepicker-time-unit\">\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"toggleMeridiemAriaLabel()\" (click)=\"toggleMeridiem()\">\n <ui-icon name=\"chevron-up\" size=\"sm\" />\n </button>\n <span\n class=\"ui-datepicker-time-value\"\n role=\"spinbutton\"\n [attr.tabindex]=\"timeControlsEnabled() ? 0 : -1\"\n [attr.aria-label]=\"meridiemAriaLabel()\"\n [attr.aria-valuetext]=\"meridiem()\"\n [attr.aria-disabled]=\"!timeControlsEnabled() || null\"\n (keydown)=\"onMeridiemKeydown($event)\"\n (click)=\"toggleMeridiem()\"\n >\n {{ meridiem() }}\n </span>\n <button type=\"button\" class=\"ui-datepicker-time-btn\" tabindex=\"-1\" [disabled]=\"!timeControlsEnabled()\" [attr.aria-label]=\"toggleMeridiemAriaLabel()\" (click)=\"toggleMeridiem()\">\n <ui-icon name=\"chevron-down\" size=\"sm\" />\n </button>\n </div>\n }\n </div>\n }\n\n <!-- Button bar (custom template or default) -->\n @if (showButtonBar() || buttonBarTemplate()) {\n <div class=\"ui-datepicker-buttonbar\">\n @if (buttonBarTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: todayCallback, todayCallback: todayCallback, clearCallback: clearCallback }\"\n />\n } @else {\n <ui-button size=\"small\" level=\"low\" [label]=\"todayLabel()\" (buttonClick)=\"selectToday()\" />\n <ui-button size=\"small\" level=\"low\" [label]=\"clearLabel()\" (buttonClick)=\"clear()\" />\n }\n </div>\n }\n </div>\n</ng-template>\n\n@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"calendarTpl\" />\n} @else {\n <!-- Trigger: readonly composed field. Clicking the field or the icon opens the panel. -->\n <!-- Convenience wrapper: focus and keyboard are carried by the inner ui-input. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div class=\"ui-datepicker-trigger\" (click)=\"open()\" (keydown)=\"onTriggerKeydown($event)\">\n <ui-input\n #trigger\n [label]=\"label()\"\n [helperText]=\"helperText()\"\n [errorText]=\"errorText()\"\n [placeholder]=\"resolvedPlaceholder()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"triggerReadonly()\"\n [invalid]=\"isInvalid()\"\n [name]=\"name() ?? ''\"\n [inputId]=\"resolvedId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [tabindex]=\"tabindex()\"\n [value]=\"displayValue()\"\n [iconRight]=\"triggerIcon()\"\n [iconRightAriaLabel]=\"triggerIconAriaLabel()\"\n ariaHasPopup=\"dialog\"\n [ariaExpanded]=\"panelOpen()\"\n [ariaControls]=\"panelOpen() ? panelId : undefined\"\n (iconRightClick)=\"onIconClick($event)\"\n (valueChange)=\"onTriggerInput($event)\"\n (inputFocus)=\"inputFocus.emit($event)\"\n (inputBlur)=\"onTriggerBlur($event)\"\n />\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin()!\"\n [cdkConnectedOverlayOpen]=\"panelOpen()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions()\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"close(false)\"\n (overlayOutsideClick)=\"close(false)\"\n (detach)=\"close(false)\"\n >\n <ng-container [ngTemplateOutlet]=\"calendarTpl\" />\n </ng-template>\n}\n", styles: [".ui-datepicker-trigger{display:block;cursor:pointer}.ui-datepicker-panel{display:flex;flex-direction:column;gap:var(--units-sm);box-sizing:border-box;width:max-content;max-width:calc(100vw - var(--units-lg));padding:var(--units-sm);border:var(--stroke-default) solid var(--form-high-stroke-default);border-radius:var(--radius-default);background-color:var(--form-high-surface-default);box-shadow:var(--shadow-default-md);font-family:var(--fontfamily-base)}.ui-datepicker-panel._inline{box-shadow:none}.ui-datepicker-header{display:flex;align-items:center;justify-content:space-between;gap:var(--units-sm)}.ui-datepicker-nav{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:var(--size-components-default);height:var(--size-components-default);padding:0;border:none;border-radius:var(--radius-full);background:none;color:var(--informative-defaultlow-content-default);cursor:pointer;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-datepicker-nav:hover{background-color:var(--informative-highlightlow-surface-hover);color:var(--informative-defaultlow-content-hover)}.ui-datepicker-nav:focus-visible{outline:none;box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-datepicker-title{flex:1 1 auto;text-align:center;font-size:var(--size-typography-title-md);font-weight:var(--weight-bold);color:var(--form-high-content-default)}.ui-datepicker-title._button{padding:var(--units-2xs) var(--units-sm);border:none;border-radius:var(--radius-sm);background:none;font-family:var(--fontfamily-base);cursor:pointer;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-datepicker-title._button:hover:not(:disabled){background-color:var(--informative-highlightlow-surface-hover)}.ui-datepicker-title._button:focus-visible{outline:none;box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-datepicker-title._button:disabled{cursor:default}.ui-datepicker-months{display:flex;gap:var(--units-lg)}.ui-datepicker-month{display:flex;flex-direction:column;gap:var(--units-sm);flex:0 0 auto;width:22.5rem}.ui-datepicker-month:not(:first-child){border-left:var(--stroke-default) solid var(--form-high-stroke-default);padding-left:var(--units-lg)}.ui-datepicker-subheader{display:flex;align-items:center;gap:var(--units-sm)}.ui-datepicker-nav-spacer{flex-shrink:0;width:var(--size-components-default);height:var(--size-components-default)}.ui-datepicker-picker{display:grid;gap:var(--units-xs);width:22.5rem}.ui-datepicker-picker._month{grid-template-columns:repeat(3,1fr)}.ui-datepicker-picker._year{grid-template-columns:repeat(2,1fr)}.ui-datepicker-cell{display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-height:var(--size-components-sm);padding:var(--units-sm) var(--units-md);border:var(--stroke-default) solid transparent;border-radius:var(--radius-sm);background-color:var(--actions-low-surface-default);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default);cursor:pointer;transition:background-color var(--transition-default) var(--transition-easeinout),border-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-datepicker-cell:hover:not(:disabled){background-color:var(--actions-low-surface-hover)}.ui-datepicker-cell:active:not(:disabled){background-color:var(--actions-low-surface-pressed)}.ui-datepicker-cell:focus-visible{outline:none;background-color:var(--actions-low-surface-focused);box-shadow:0 0 0 var(--units-2xs) rgb(from var(--actions-high-stroke-focused) r g b/50%)}.ui-datepicker-cell._selected{background-color:var(--actions-high-surface-default);color:var(--actions-high-content-default)}.ui-datepicker-cell._selected:hover:not(:disabled){background-color:var(--actions-high-surface-hover)}.ui-datepicker-cell:disabled{color:var(--form-high-content-disabled);cursor:not-allowed}.ui-datepicker-weekdays,.ui-datepicker-week{display:grid;grid-template-columns:repeat(7,1fr);justify-items:center;align-items:center}.ui-datepicker-weekday{padding:var(--units-xs) 0;font-size:var(--size-typography-text-md);font-weight:var(--weight-bold);color:var(--form-low-content-default);-webkit-user-select:none;user-select:none}.ui-datepicker-grid{display:flex;flex-direction:column;gap:var(--units-xs)}.ui-datepicker-day{position:relative;z-index:0;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:100%;height:var(--size-components-default);padding:0;border:none;background:transparent;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default);cursor:pointer;transition:color var(--transition-default) var(--transition-easeinout)}.ui-datepicker-day:before{content:\"\";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--size-components-default);height:var(--size-components-default);border:var(--stroke-default) solid transparent;border-radius:var(--radius-full);z-index:-1;transition:background-color var(--transition-default) var(--transition-easeinout),border-color var(--transition-default) var(--transition-easeinout),box-shadow var(--transition-default) var(--transition-easeinout)}.ui-datepicker-day:hover:not(:disabled):before{background-color:var(--actions-low-surface-hover)}.ui-datepicker-day:active:not(:disabled):before{background-color:var(--actions-low-surface-pressed)}.ui-datepicker-day:focus-visible{outline:none}.ui-datepicker-day:focus-visible:before{background-color:var(--actions-low-surface-focused);box-shadow:0 0 0 var(--units-2xs) rgb(from var(--actions-high-stroke-focused) r g b/50%)}.ui-datepicker-day._other-month{color:var(--form-low-content-default);opacity:.6}.ui-datepicker-day._today:before{border-color:var(--actions-high-stroke-default)}.ui-datepicker-day._today:hover:not(:disabled):before{border-color:var(--actions-high-stroke-hover)}.ui-datepicker-day._today:focus-visible:before{border-color:var(--actions-high-stroke-focused)}.ui-datepicker-day._selected{color:var(--actions-high-content-default)}.ui-datepicker-day._selected:before{background-color:var(--actions-high-surface-default)}.ui-datepicker-day._selected:hover:not(:disabled){color:var(--actions-high-content-hover)}.ui-datepicker-day._selected:hover:not(:disabled):before{background-color:var(--actions-high-surface-hover)}.ui-datepicker-day._selected:focus-visible{color:var(--actions-high-content-focused)}.ui-datepicker-day._selected:focus-visible:before{background-color:var(--actions-high-surface-focused)}.ui-datepicker-day._in-range,.ui-datepicker-day._range-start,.ui-datepicker-day._range-end{border-top:var(--stroke-default) solid var(--actions-high-stroke-default);border-bottom:var(--stroke-default) solid var(--actions-high-stroke-default)}.ui-datepicker-day._in-range{background-color:var(--informative-highlightlow-surface-hover)}.ui-datepicker-day._range-start{background:linear-gradient(to right,transparent 50%,var(--informative-highlightlow-surface-hover) 50%)}.ui-datepicker-day._range-end{background:linear-gradient(to left,transparent 50%,var(--informative-highlightlow-surface-hover) 50%)}.ui-datepicker-day._range-start._range-end{background:transparent}.ui-datepicker-day:disabled{color:var(--form-high-content-disabled);opacity:.45;cursor:not-allowed}.ui-datepicker-time{display:flex;align-items:center;justify-content:center;gap:var(--units-sm);padding-top:var(--units-sm);border-top:var(--stroke-default) solid var(--form-high-stroke-default)}.ui-datepicker-time:first-child{padding-top:0;border-top:none}.ui-datepicker-time-unit{display:flex;flex-direction:column;align-items:center;gap:var(--units-2xs)}.ui-datepicker-time-value{box-sizing:border-box;display:inline-block;width:3rem;padding:var(--units-2xs) var(--units-sm);border:none;border-radius:var(--radius-sm);background:none;font-family:var(--fontfamily-base);font-size:var(--size-typography-title-md);font-weight:var(--weight-bold);font-variant-numeric:tabular-nums;color:var(--form-high-content-default);text-align:center;cursor:text;appearance:none;transition:background-color var(--transition-default) var(--transition-easeinout),box-shadow var(--transition-default) var(--transition-easeinout)}.ui-datepicker-time-value:read-only{cursor:pointer}.ui-datepicker-time-value:hover:not(:disabled):not([aria-disabled=true]){background-color:var(--informative-highlightlow-surface-hover)}.ui-datepicker-time-value:focus-visible{outline:none;box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-datepicker-time-value:disabled,.ui-datepicker-time-value[aria-disabled=true]{color:var(--form-high-content-disabled);cursor:not-allowed}.ui-datepicker-time-btn{display:flex;align-items:center;justify-content:center;width:var(--size-components-xs);height:var(--size-components-2xs);padding:0;border:none;border-radius:var(--radius-sm);background:none;color:var(--form-low-content-default);cursor:pointer;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-datepicker-time-btn:hover:not(:disabled){background-color:var(--informative-highlightlow-surface-hover);color:var(--form-high-content-hover)}.ui-datepicker-time-btn:disabled{color:var(--form-high-content-disabled);cursor:not-allowed}.ui-datepicker-time-colon{font-size:var(--size-typography-title-md);font-weight:var(--weight-bold);color:var(--form-high-content-default)}.ui-datepicker-buttonbar{display:flex;align-items:center;justify-content:space-between;gap:var(--units-sm);padding-top:var(--units-sm);border-top:var(--stroke-default) solid var(--form-high-stroke-default)}\n"] }]
1497
+ }], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], showIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "showIcon", required: false }] }], iconAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconAriaLabel", required: false }] }], showClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClear", required: false }] }], valueType: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueType", required: true }] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], numberOfMonths: [{ type: i0.Input, args: [{ isSignal: true, alias: "numberOfMonths", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], disabledDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDays", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormat", required: false }] }], allowInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowInput", required: false }] }], parseDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "parseDate", required: false }] }], showTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTime", required: false }] }], timeOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeOnly", required: false }] }], hourFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourFormat", required: false }] }], stepMinute: [{ type: i0.Input, args: [{ isSignal: true, alias: "stepMinute", required: false }] }], editableTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "editableTime", required: false }] }], showButtonBar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showButtonBar", required: false }] }], todayLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "todayLabel", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], panelAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelAriaLabel", required: false }] }], prevAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "prevAriaLabel", required: false }] }], nextAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "nextAriaLabel", required: false }] }], hoursAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "hoursAriaLabel", required: false }] }], minutesAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "minutesAriaLabel", required: false }] }], meridiemAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "meridiemAriaLabel", required: false }] }], incrementHoursAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "incrementHoursAriaLabel", required: false }] }], decrementHoursAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "decrementHoursAriaLabel", required: false }] }], incrementMinutesAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "incrementMinutesAriaLabel", required: false }] }], decrementMinutesAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "decrementMinutesAriaLabel", required: false }] }], toggleMeridiemAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleMeridiemAriaLabel", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }], autoFlip: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFlip", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }], panelStyleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelStyleClass", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], dateSelect: [{ type: i0.Output, args: ["dateSelect"] }], monthChange: [{ type: i0.Output, args: ["monthChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], cleared: [{ type: i0.Output, args: ["cleared"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], dateTemplate: [{ type: i0.ContentChild, args: ['date', { isSignal: true }] }], buttonBarTemplate: [{ type: i0.ContentChild, args: ['buttonbar', { isSignal: true }] }], triggerInput: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], triggerRef: [{ type: i0.ViewChild, args: ['trigger', { ...{ read: ElementRef }, isSignal: true }] }], panelEl: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }] } });
1498
+
1499
+ /*
1500
+ * Public API Surface of ui-kit/ui-datepicker
1501
+ */
1502
+
1503
+ /**
1504
+ * Generated bundle index. Do not edit.
1505
+ */
1506
+
1507
+ export { UiDatepicker };
1508
+ //# sourceMappingURL=4sh-ui-kit-ui-datepicker.mjs.map