@star-ng/ui 0.0.0-placeholder.0 → 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 (217) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +147 -3
  3. package/fesm2022/star-ng-ui-accordion.mjs +376 -0
  4. package/fesm2022/star-ng-ui-accordion.mjs.map +1 -0
  5. package/fesm2022/star-ng-ui-autocomplete.mjs +782 -0
  6. package/fesm2022/star-ng-ui-autocomplete.mjs.map +1 -0
  7. package/fesm2022/star-ng-ui-avatar.mjs +154 -0
  8. package/fesm2022/star-ng-ui-avatar.mjs.map +1 -0
  9. package/fesm2022/star-ng-ui-badge.mjs +153 -0
  10. package/fesm2022/star-ng-ui-badge.mjs.map +1 -0
  11. package/fesm2022/star-ng-ui-breadcrumb.mjs +199 -0
  12. package/fesm2022/star-ng-ui-breadcrumb.mjs.map +1 -0
  13. package/fesm2022/star-ng-ui-button.mjs +282 -0
  14. package/fesm2022/star-ng-ui-button.mjs.map +1 -0
  15. package/fesm2022/star-ng-ui-card.mjs +112 -0
  16. package/fesm2022/star-ng-ui-card.mjs.map +1 -0
  17. package/fesm2022/star-ng-ui-chart.mjs +1904 -0
  18. package/fesm2022/star-ng-ui-chart.mjs.map +1 -0
  19. package/fesm2022/star-ng-ui-checkbox.mjs +345 -0
  20. package/fesm2022/star-ng-ui-checkbox.mjs.map +1 -0
  21. package/fesm2022/star-ng-ui-core.mjs +392 -0
  22. package/fesm2022/star-ng-ui-core.mjs.map +1 -0
  23. package/fesm2022/star-ng-ui-data-display.mjs +1556 -0
  24. package/fesm2022/star-ng-ui-data-display.mjs.map +1 -0
  25. package/fesm2022/star-ng-ui-date-picker.mjs +2786 -0
  26. package/fesm2022/star-ng-ui-date-picker.mjs.map +1 -0
  27. package/fesm2022/star-ng-ui-dialog.mjs +948 -0
  28. package/fesm2022/star-ng-ui-dialog.mjs.map +1 -0
  29. package/fesm2022/star-ng-ui-drawer.mjs +158 -0
  30. package/fesm2022/star-ng-ui-drawer.mjs.map +1 -0
  31. package/fesm2022/star-ng-ui-editor.mjs +416 -0
  32. package/fesm2022/star-ng-ui-editor.mjs.map +1 -0
  33. package/fesm2022/star-ng-ui-field.mjs +378 -0
  34. package/fesm2022/star-ng-ui-field.mjs.map +1 -0
  35. package/fesm2022/star-ng-ui-file-upload.mjs +762 -0
  36. package/fesm2022/star-ng-ui-file-upload.mjs.map +1 -0
  37. package/fesm2022/star-ng-ui-i18n-de.mjs +179 -0
  38. package/fesm2022/star-ng-ui-i18n-de.mjs.map +1 -0
  39. package/fesm2022/star-ng-ui-i18n-es.mjs +179 -0
  40. package/fesm2022/star-ng-ui-i18n-es.mjs.map +1 -0
  41. package/fesm2022/star-ng-ui-input-group.mjs +188 -0
  42. package/fesm2022/star-ng-ui-input-group.mjs.map +1 -0
  43. package/fesm2022/star-ng-ui-input-mask.mjs +434 -0
  44. package/fesm2022/star-ng-ui-input-mask.mjs.map +1 -0
  45. package/fesm2022/star-ng-ui-input-number.mjs +691 -0
  46. package/fesm2022/star-ng-ui-input-number.mjs.map +1 -0
  47. package/fesm2022/star-ng-ui-input-otp.mjs +343 -0
  48. package/fesm2022/star-ng-ui-input-otp.mjs.map +1 -0
  49. package/fesm2022/star-ng-ui-input-tags.mjs +616 -0
  50. package/fesm2022/star-ng-ui-input-tags.mjs.map +1 -0
  51. package/fesm2022/star-ng-ui-knob.mjs +514 -0
  52. package/fesm2022/star-ng-ui-knob.mjs.map +1 -0
  53. package/fesm2022/star-ng-ui-layout.mjs +608 -0
  54. package/fesm2022/star-ng-ui-layout.mjs.map +1 -0
  55. package/fesm2022/star-ng-ui-listbox.mjs +978 -0
  56. package/fesm2022/star-ng-ui-listbox.mjs.map +1 -0
  57. package/fesm2022/star-ng-ui-media.mjs +833 -0
  58. package/fesm2022/star-ng-ui-media.mjs.map +1 -0
  59. package/fesm2022/star-ng-ui-menu.mjs +1840 -0
  60. package/fesm2022/star-ng-ui-menu.mjs.map +1 -0
  61. package/fesm2022/star-ng-ui-message.mjs +191 -0
  62. package/fesm2022/star-ng-ui-message.mjs.map +1 -0
  63. package/fesm2022/star-ng-ui-paginator.mjs +387 -0
  64. package/fesm2022/star-ng-ui-paginator.mjs.map +1 -0
  65. package/fesm2022/star-ng-ui-panel.mjs +324 -0
  66. package/fesm2022/star-ng-ui-panel.mjs.map +1 -0
  67. package/fesm2022/star-ng-ui-password.mjs +517 -0
  68. package/fesm2022/star-ng-ui-password.mjs.map +1 -0
  69. package/fesm2022/star-ng-ui-popover.mjs +241 -0
  70. package/fesm2022/star-ng-ui-popover.mjs.map +1 -0
  71. package/fesm2022/star-ng-ui-progress-bar.mjs +183 -0
  72. package/fesm2022/star-ng-ui-progress-bar.mjs.map +1 -0
  73. package/fesm2022/star-ng-ui-radio.mjs +411 -0
  74. package/fesm2022/star-ng-ui-radio.mjs.map +1 -0
  75. package/fesm2022/star-ng-ui-rating.mjs +211 -0
  76. package/fesm2022/star-ng-ui-rating.mjs.map +1 -0
  77. package/fesm2022/star-ng-ui-select-button.mjs +613 -0
  78. package/fesm2022/star-ng-ui-select-button.mjs.map +1 -0
  79. package/fesm2022/star-ng-ui-select.mjs +2523 -0
  80. package/fesm2022/star-ng-ui-select.mjs.map +1 -0
  81. package/fesm2022/star-ng-ui-skeleton.mjs +160 -0
  82. package/fesm2022/star-ng-ui-skeleton.mjs.map +1 -0
  83. package/fesm2022/star-ng-ui-slider.mjs +552 -0
  84. package/fesm2022/star-ng-ui-slider.mjs.map +1 -0
  85. package/fesm2022/star-ng-ui-spinner.mjs +148 -0
  86. package/fesm2022/star-ng-ui-spinner.mjs.map +1 -0
  87. package/fesm2022/star-ng-ui-stepper.mjs +360 -0
  88. package/fesm2022/star-ng-ui-stepper.mjs.map +1 -0
  89. package/fesm2022/star-ng-ui-table.mjs +3477 -0
  90. package/fesm2022/star-ng-ui-table.mjs.map +1 -0
  91. package/fesm2022/star-ng-ui-tabs.mjs +464 -0
  92. package/fesm2022/star-ng-ui-tabs.mjs.map +1 -0
  93. package/fesm2022/star-ng-ui-tag.mjs +129 -0
  94. package/fesm2022/star-ng-ui-tag.mjs.map +1 -0
  95. package/fesm2022/star-ng-ui-theme-switch.mjs +105 -0
  96. package/fesm2022/star-ng-ui-theme-switch.mjs.map +1 -0
  97. package/fesm2022/star-ng-ui-theme.mjs +98 -0
  98. package/fesm2022/star-ng-ui-theme.mjs.map +1 -0
  99. package/fesm2022/star-ng-ui-toast.mjs +298 -0
  100. package/fesm2022/star-ng-ui-toast.mjs.map +1 -0
  101. package/fesm2022/star-ng-ui-toggle-switch.mjs +316 -0
  102. package/fesm2022/star-ng-ui-toggle-switch.mjs.map +1 -0
  103. package/fesm2022/star-ng-ui-tooltip.mjs +297 -0
  104. package/fesm2022/star-ng-ui-tooltip.mjs.map +1 -0
  105. package/fesm2022/star-ng-ui-transloco.mjs +40 -0
  106. package/fesm2022/star-ng-ui-transloco.mjs.map +1 -0
  107. package/fesm2022/star-ng-ui-tree.mjs +1446 -0
  108. package/fesm2022/star-ng-ui-tree.mjs.map +1 -0
  109. package/fesm2022/star-ng-ui-utility.mjs +2134 -0
  110. package/fesm2022/star-ng-ui-utility.mjs.map +1 -0
  111. package/fesm2022/star-ng-ui.mjs +51 -0
  112. package/package.json +281 -5
  113. package/styles/_base.scss +70 -0
  114. package/styles/_shared.scss +2 -0
  115. package/styles/_tokens.scss +190 -0
  116. package/styles/controls/_accordion.scss +75 -0
  117. package/styles/controls/_autocomplete.scss +44 -0
  118. package/styles/controls/_avatar.scss +39 -0
  119. package/styles/controls/_breadcrumb.scss +45 -0
  120. package/styles/controls/_button.scss +137 -0
  121. package/styles/controls/_card.scss +38 -0
  122. package/styles/controls/_chart.scss +214 -0
  123. package/styles/controls/_chip.scss +51 -0
  124. package/styles/controls/_choice.scss +153 -0
  125. package/styles/controls/_data-display.scss +118 -0
  126. package/styles/controls/_date-picker.scss +300 -0
  127. package/styles/controls/_dialog.scss +123 -0
  128. package/styles/controls/_drawer.scss +118 -0
  129. package/styles/controls/_editor.scss +74 -0
  130. package/styles/controls/_field.scss +92 -0
  131. package/styles/controls/_file-upload.scss +136 -0
  132. package/styles/controls/_input-group.scss +104 -0
  133. package/styles/controls/_input-mask.scss +46 -0
  134. package/styles/controls/_input-number.scss +125 -0
  135. package/styles/controls/_knob.scss +76 -0
  136. package/styles/controls/_layout.scss +182 -0
  137. package/styles/controls/_listbox.scss +38 -0
  138. package/styles/controls/_media.scss +222 -0
  139. package/styles/controls/_menu.scss +254 -0
  140. package/styles/controls/_message.scss +48 -0
  141. package/styles/controls/_org-chart.scss +128 -0
  142. package/styles/controls/_paginator.scss +59 -0
  143. package/styles/controls/_panel.scss +83 -0
  144. package/styles/controls/_popover.scss +40 -0
  145. package/styles/controls/_progress-bar.scss +74 -0
  146. package/styles/controls/_select-button.scss +61 -0
  147. package/styles/controls/_select.scss +216 -0
  148. package/styles/controls/_skeleton.scss +43 -0
  149. package/styles/controls/_slider.scss +163 -0
  150. package/styles/controls/_spinner.scss +34 -0
  151. package/styles/controls/_stepper.scss +109 -0
  152. package/styles/controls/_table.scss +523 -0
  153. package/styles/controls/_tabs.scss +93 -0
  154. package/styles/controls/_tag.scss +84 -0
  155. package/styles/controls/_toast.scss +141 -0
  156. package/styles/controls/_tooltip.scss +14 -0
  157. package/styles/controls/_tree.scss +113 -0
  158. package/styles/controls/_utility.scss +654 -0
  159. package/styles/star-ng.css +5803 -0
  160. package/styles/star-ng.min.css +1 -0
  161. package/styles/star-ng.scss +50 -0
  162. package/theme/star-theme-first-paint.js +1 -0
  163. package/types/star-ng-ui-accordion.d.ts +82 -0
  164. package/types/star-ng-ui-autocomplete.d.ts +171 -0
  165. package/types/star-ng-ui-avatar.d.ts +43 -0
  166. package/types/star-ng-ui-badge.d.ts +46 -0
  167. package/types/star-ng-ui-breadcrumb.d.ts +39 -0
  168. package/types/star-ng-ui-button.d.ts +79 -0
  169. package/types/star-ng-ui-card.d.ts +29 -0
  170. package/types/star-ng-ui-chart.d.ts +337 -0
  171. package/types/star-ng-ui-checkbox.d.ts +92 -0
  172. package/types/star-ng-ui-core.d.ts +310 -0
  173. package/types/star-ng-ui-data-display.d.ts +339 -0
  174. package/types/star-ng-ui-date-picker.d.ts +701 -0
  175. package/types/star-ng-ui-dialog.d.ts +254 -0
  176. package/types/star-ng-ui-drawer.d.ts +29 -0
  177. package/types/star-ng-ui-editor.d.ts +96 -0
  178. package/types/star-ng-ui-field.d.ts +146 -0
  179. package/types/star-ng-ui-file-upload.d.ts +192 -0
  180. package/types/star-ng-ui-i18n-de.d.ts +7 -0
  181. package/types/star-ng-ui-i18n-es.d.ts +7 -0
  182. package/types/star-ng-ui-input-group.d.ts +58 -0
  183. package/types/star-ng-ui-input-mask.d.ts +126 -0
  184. package/types/star-ng-ui-input-number.d.ts +193 -0
  185. package/types/star-ng-ui-input-otp.d.ts +86 -0
  186. package/types/star-ng-ui-input-tags.d.ts +159 -0
  187. package/types/star-ng-ui-knob.d.ts +121 -0
  188. package/types/star-ng-ui-layout.d.ts +154 -0
  189. package/types/star-ng-ui-listbox.d.ts +197 -0
  190. package/types/star-ng-ui-media.d.ts +161 -0
  191. package/types/star-ng-ui-menu.d.ts +332 -0
  192. package/types/star-ng-ui-message.d.ts +52 -0
  193. package/types/star-ng-ui-paginator.d.ts +85 -0
  194. package/types/star-ng-ui-panel.d.ts +65 -0
  195. package/types/star-ng-ui-password.d.ts +129 -0
  196. package/types/star-ng-ui-popover.d.ts +57 -0
  197. package/types/star-ng-ui-progress-bar.d.ts +49 -0
  198. package/types/star-ng-ui-radio.d.ts +116 -0
  199. package/types/star-ng-ui-rating.d.ts +52 -0
  200. package/types/star-ng-ui-select-button.d.ts +169 -0
  201. package/types/star-ng-ui-select.d.ts +540 -0
  202. package/types/star-ng-ui-skeleton.d.ts +47 -0
  203. package/types/star-ng-ui-slider.d.ts +145 -0
  204. package/types/star-ng-ui-spinner.d.ts +29 -0
  205. package/types/star-ng-ui-stepper.d.ts +89 -0
  206. package/types/star-ng-ui-table.d.ts +829 -0
  207. package/types/star-ng-ui-tabs.d.ts +109 -0
  208. package/types/star-ng-ui-tag.d.ts +35 -0
  209. package/types/star-ng-ui-theme-switch.d.ts +36 -0
  210. package/types/star-ng-ui-theme.d.ts +95 -0
  211. package/types/star-ng-ui-toast.d.ts +84 -0
  212. package/types/star-ng-ui-toggle-switch.d.ts +81 -0
  213. package/types/star-ng-ui-tooltip.d.ts +66 -0
  214. package/types/star-ng-ui-transloco.d.ts +14 -0
  215. package/types/star-ng-ui-tree.d.ts +310 -0
  216. package/types/star-ng-ui-utility.d.ts +533 -0
  217. package/types/star-ng-ui.d.ts +51 -0
@@ -0,0 +1,2786 @@
1
+ import { _IdGenerator } from "@angular/cdk/a11y";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, Directive, ElementRef, Injector, afterNextRender, booleanAttribute, computed, inject, input, linkedSignal, model, output, signal, viewChild } from "@angular/core";
4
+ import { STAR_UI_TEXT, StarDirectionService, starInlineKey } from "@star-ng/ui/core";
5
+ import { CdkConnectedOverlay, CdkOverlayOrigin } from "@angular/cdk/overlay";
6
+ function startOfDay(date) {
7
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
8
+ }
9
+ function addDays(date, days) {
10
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);
11
+ }
12
+ function addMonths(date, months) {
13
+ const target = new Date(date.getFullYear(), date.getMonth() + months, 1);
14
+ const lastDay = new Date(target.getFullYear(), target.getMonth() + 1, 0).getDate();
15
+ return new Date(target.getFullYear(), target.getMonth(), Math.min(date.getDate(), lastDay));
16
+ }
17
+ function sameDay(a, b) {
18
+ return !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
19
+ }
20
+ function sameMonth(a, b) {
21
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
22
+ }
23
+ function compareDays(a, b) {
24
+ return startOfDay(a).getTime() - startOfDay(b).getTime();
25
+ }
26
+ function isoDay(date) {
27
+ const pad = (n) => String(n).padStart(2, "0");
28
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
29
+ }
30
+ function localeFirstDay(locale) {
31
+ try {
32
+ const intlLocale = new Intl.Locale(locale ?? (typeof navigator === "undefined" ? "en-US" : navigator.language));
33
+ const info = intlLocale.getWeekInfo?.() ?? intlLocale.weekInfo;
34
+ return info ? info.firstDay % 7 : 1;
35
+ } catch {
36
+ return 1;
37
+ }
38
+ }
39
+ function monthGrid(month, firstDay) {
40
+ const first = new Date(month.getFullYear(), month.getMonth(), 1);
41
+ const start = addDays(first, -((first.getDay() - firstDay + 7) % 7));
42
+ return Array.from({ length: 6 }, (_, week) => Array.from({ length: 7 }, (_, day) => addDays(start, week * 7 + day)));
43
+ }
44
+ const DEFAULT_DATE_FORMAT = {
45
+ year: "numeric",
46
+ month: "2-digit",
47
+ day: "2-digit"
48
+ };
49
+ function formatDate(date, locale, options) {
50
+ return date ? new Intl.DateTimeFormat(locale, options).format(date) : "";
51
+ }
52
+ function formatHint(locale) {
53
+ return new Intl.DateTimeFormat(locale, DEFAULT_DATE_FORMAT).formatToParts(new Date(2026, 10, 22)).map((part) => part.type === "day" ? "dd" : part.type === "month" ? "mm" : part.type === "year" ? "yyyy" : part.value).join("");
54
+ }
55
+ function parseDate(text, locale) {
56
+ const value = text.trim();
57
+ if (!value) return null;
58
+ const iso = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(value);
59
+ const numbers = iso ? [
60
+ iso[1],
61
+ iso[2],
62
+ iso[3]
63
+ ].map(Number) : value.split(/\D+/).filter(Boolean).map(Number);
64
+ if (numbers.length !== 3) return null;
65
+ let year;
66
+ let month;
67
+ let day;
68
+ if (iso) [year, month, day] = numbers;
69
+ else {
70
+ const order = new Intl.DateTimeFormat(locale, DEFAULT_DATE_FORMAT).formatToParts(new Date(2026, 10, 22)).map((part) => part.type).filter((type) => type === "day" || type === "month" || type === "year");
71
+ const read = (type) => numbers[order.indexOf(type)];
72
+ year = read("year");
73
+ month = read("month");
74
+ day = read("day");
75
+ if (year < 100) year += 2e3;
76
+ }
77
+ const date = new Date(year, month - 1, day);
78
+ return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day ? date : null;
79
+ }
80
+ function isoWeek(date) {
81
+ const day = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
82
+ day.setUTCDate(day.getUTCDate() + 4 - (day.getUTCDay() || 7));
83
+ const yearStart = Date.UTC(day.getUTCFullYear(), 0, 1);
84
+ return Math.ceil(((day.getTime() - yearStart) / 864e5 + 1) / 7);
85
+ }
86
+ var StarCalendar = class StarCalendar {
87
+ text = inject(STAR_UI_TEXT);
88
+ host = inject(ElementRef);
89
+ injector = inject(Injector);
90
+ titleId = inject(_IdGenerator).getId("star-calendar-title-");
91
+ sameDay = sameDay;
92
+ mode = input("single", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
93
+ selected = input(null, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
94
+ selectedDates = input([], ...ngDevMode ? [{ debugName: "selectedDates" }] : /* istanbul ignore next */ []);
95
+ granularity = input("day", ...ngDevMode ? [{ debugName: "granularity" }] : /* istanbul ignore next */ []);
96
+ numberOfMonths = input(1, ...ngDevMode ? [{ debugName: "numberOfMonths" }] : /* istanbul ignore next */ []);
97
+ showWeek = input(false, {
98
+ ...ngDevMode ? { debugName: "showWeek" } : /* istanbul ignore next */ {},
99
+ transform: booleanAttribute
100
+ });
101
+ range = input(null, ...ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []);
102
+ minDate = input(null, ...ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []);
103
+ maxDate = input(null, ...ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []);
104
+ disabledDates = input([], ...ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []);
105
+ disabledDays = input([], ...ngDevMode ? [{ debugName: "disabledDays" }] : /* istanbul ignore next */ []);
106
+ dateDisabled = input(null, ...ngDevMode ? [{ debugName: "dateDisabled" }] : /* istanbul ignore next */ []);
107
+ firstDayOfWeek = input(null, ...ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []);
108
+ locale = input(void 0, ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
109
+ dateSelect = output();
110
+ view = linkedSignal(() => this.granularity(), ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
111
+ hover = signal(null, ...ngDevMode ? [{ debugName: "hover" }] : /* istanbul ignore next */ []);
112
+ today = startOfDay(/* @__PURE__ */ new Date());
113
+ anchor = computed(() => {
114
+ const range = this.range();
115
+ return this.selected() ?? range?.end ?? range?.start ?? this.selectedDates().at(-1) ?? this.today;
116
+ }, ...ngDevMode ? [{ debugName: "anchor" }] : /* istanbul ignore next */ []);
117
+ focused = linkedSignal(() => startOfDay(this.anchor()), ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
118
+ firstDay = computed(() => this.firstDayOfWeek() ?? localeFirstDay(this.locale()), ...ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []);
119
+ monthName = computed(() => new Intl.DateTimeFormat(this.locale(), { month: "long" }).format(this.focused()), ...ngDevMode ? [{ debugName: "monthName" }] : /* istanbul ignore next */ []);
120
+ monthLabel = computed(() => new Intl.DateTimeFormat(this.locale(), {
121
+ month: "long",
122
+ year: "numeric"
123
+ }).format(this.focused()), ...ngDevMode ? [{ debugName: "monthLabel" }] : /* istanbul ignore next */ []);
124
+ weekdays = computed(() => {
125
+ const short = new Intl.DateTimeFormat(this.locale(), { weekday: "short" });
126
+ const long = new Intl.DateTimeFormat(this.locale(), { weekday: "long" });
127
+ return Array.from({ length: 7 }, (_, i) => {
128
+ const date = new Date(2026, 10, 1 + (this.firstDay() + i) % 7);
129
+ return {
130
+ short: short.format(date),
131
+ long: long.format(date)
132
+ };
133
+ });
134
+ }, ...ngDevMode ? [{ debugName: "weekdays" }] : /* istanbul ignore next */ []);
135
+ monthCount = computed(() => Math.max(1, Math.floor(this.numberOfMonths())), ...ngDevMode ? [{ debugName: "monthCount" }] : /* istanbul ignore next */ []);
136
+ viewStart = linkedSignal({
137
+ ...ngDevMode ? { debugName: "viewStart" } : /* istanbul ignore next */ {},
138
+ source: () => ({
139
+ focused: this.focused(),
140
+ count: this.monthCount()
141
+ }),
142
+ computation: ({ focused, count }, previous) => {
143
+ const month = new Date(focused.getFullYear(), focused.getMonth(), 1);
144
+ if (!previous) return month;
145
+ const start = previous.value;
146
+ const offset = (month.getFullYear() - start.getFullYear()) * 12 + month.getMonth() - start.getMonth();
147
+ if (offset >= 0 && offset < count) return start;
148
+ return offset < 0 ? month : addMonths(month, -(count - 1));
149
+ }
150
+ });
151
+ grids = computed(() => {
152
+ const fullLabel = new Intl.DateTimeFormat(this.locale(), { dateStyle: "full" });
153
+ const monthLabel = new Intl.DateTimeFormat(this.locale(), {
154
+ month: "long",
155
+ year: "numeric"
156
+ });
157
+ const many = this.monthCount() > 1;
158
+ return Array.from({ length: this.monthCount() }, (_, index) => {
159
+ const month = addMonths(this.viewStart(), index);
160
+ return {
161
+ key: isoDay(month),
162
+ label: monthLabel.format(month),
163
+ weeks: monthGrid(month, this.firstDay()).map((week) => ({
164
+ number: isoWeek(week.find((day) => day.getDay() === 4) ?? week[0]),
165
+ days: week.map((date) => {
166
+ const outside = !sameMonth(date, month);
167
+ return {
168
+ date,
169
+ key: isoDay(date),
170
+ label: fullLabel.format(date),
171
+ outside,
172
+ blank: many && outside,
173
+ today: sameDay(date, this.today),
174
+ disabled: this.isDisabled(date)
175
+ };
176
+ })
177
+ })).filter((week) => !many || week.days.some((day) => !day.blank))
178
+ };
179
+ });
180
+ }, ...ngDevMode ? [{ debugName: "grids" }] : /* istanbul ignore next */ []);
181
+ months = computed(() => {
182
+ const format = new Intl.DateTimeFormat(this.locale(), { month: "short" });
183
+ return Array.from({ length: 12 }, (_, i) => format.format(new Date(2026, i, 1)));
184
+ }, ...ngDevMode ? [{ debugName: "months" }] : /* istanbul ignore next */ []);
185
+ years = computed(() => {
186
+ const year = this.focused().getFullYear();
187
+ const start = year - (year % 12 + 12) % 12;
188
+ return Array.from({ length: 12 }, (_, i) => start + i);
189
+ }, ...ngDevMode ? [{ debugName: "years" }] : /* istanbul ignore next */ []);
190
+ isDisabled(date) {
191
+ const min = this.minDate();
192
+ const max = this.maxDate();
193
+ if (min && compareDays(date, min) < 0) return true;
194
+ if (max && compareDays(date, max) > 0) return true;
195
+ if (this.disabledDays().includes(date.getDay())) return true;
196
+ if (this.disabledDates().some((disabled) => sameDay(disabled, date))) return true;
197
+ return this.dateDisabled()?.(date) ?? false;
198
+ }
199
+ isSelected(date) {
200
+ if (this.mode() === "single") return sameDay(date, this.selected());
201
+ if (this.mode() === "multiple") return this.selectedDates().some((day) => sameDay(day, date));
202
+ const range = this.range();
203
+ return sameDay(date, range?.start) || sameDay(date, range?.end);
204
+ }
205
+ inRange(date) {
206
+ if (this.mode() !== "range") return false;
207
+ const range = this.range();
208
+ const start = range?.start;
209
+ const end = range?.end ?? (start ? this.hover() : null);
210
+ if (!start || !end) return false;
211
+ const [from, to] = compareDays(start, end) <= 0 ? [start, end] : [end, start];
212
+ return compareDays(date, from) >= 0 && compareDays(date, to) <= 0;
213
+ }
214
+ isRangeEdge(date, edge) {
215
+ if (!this.inRange(date)) return false;
216
+ const range = this.range();
217
+ const a = range?.start;
218
+ const b = range?.end ?? this.hover();
219
+ if (!a || !b) return false;
220
+ const [from, to] = compareDays(a, b) <= 0 ? [a, b] : [b, a];
221
+ return sameDay(date, edge === "start" ? from : to);
222
+ }
223
+ choose(date) {
224
+ if (this.isDisabled(date)) return;
225
+ this.focused.set(date);
226
+ this.dateSelect.emit(date);
227
+ }
228
+ focusActive() {
229
+ afterNextRender(() => {
230
+ const root = this.host.nativeElement;
231
+ (this.view() === "day" ? root.querySelector(`[data-date="${isoDay(this.focused())}"]`) : root.querySelector(".star-calendar__pick[tabindex=\"0\"]"))?.focus();
232
+ }, { injector: this.injector });
233
+ }
234
+ page(step) {
235
+ const current = this.focused();
236
+ if (this.view() === "day") this.focused.set(addMonths(current, step));
237
+ else if (this.view() === "month") this.focused.set(addMonths(current, step * 12));
238
+ else this.focused.set(addMonths(current, step * 144));
239
+ }
240
+ onDayKeydown(event) {
241
+ const current = this.focused();
242
+ const weekStart = (current.getDay() - this.firstDay() + 7) % 7;
243
+ const key = starInlineKey(event);
244
+ const moves = {
245
+ ArrowLeft: () => addDays(current, -1),
246
+ ArrowRight: () => addDays(current, 1),
247
+ ArrowUp: () => addDays(current, -7),
248
+ ArrowDown: () => addDays(current, 7),
249
+ Home: () => addDays(current, -weekStart),
250
+ End: () => addDays(current, 6 - weekStart),
251
+ PageUp: () => addMonths(current, event.shiftKey ? -12 : -1),
252
+ PageDown: () => addMonths(current, event.shiftKey ? 12 : 1)
253
+ };
254
+ if (event.key === "Enter" || event.key === " ") {
255
+ event.preventDefault();
256
+ this.choose(current);
257
+ return;
258
+ }
259
+ const move = moves[key];
260
+ if (!move) return;
261
+ event.preventDefault();
262
+ this.focused.set(move());
263
+ this.focusActive();
264
+ }
265
+ onPickerKeydown(event, kind) {
266
+ const step = {
267
+ ArrowLeft: -1,
268
+ ArrowRight: 1,
269
+ ArrowUp: -3,
270
+ ArrowDown: 3
271
+ }[starInlineKey(event)];
272
+ if (step === void 0) return;
273
+ event.preventDefault();
274
+ this.focused.set(addMonths(this.focused(), kind === "month" ? step : step * 12));
275
+ this.focusActive();
276
+ }
277
+ pickMonth(month) {
278
+ const current = this.focused();
279
+ this.focused.set(addMonths(current, month - current.getMonth()));
280
+ if (this.granularity() === "month") {
281
+ this.dateSelect.emit(new Date(current.getFullYear(), month, 1));
282
+ return;
283
+ }
284
+ this.view.set("day");
285
+ this.focusActive();
286
+ }
287
+ pickYear(year) {
288
+ const current = this.focused();
289
+ this.focused.set(addMonths(current, (year - current.getFullYear()) * 12));
290
+ if (this.granularity() === "year") {
291
+ this.dateSelect.emit(new Date(year, 0, 1));
292
+ return;
293
+ }
294
+ this.view.set("month");
295
+ this.focusActive();
296
+ }
297
+ monthDisabled(month) {
298
+ const year = this.focused().getFullYear();
299
+ const first = new Date(year, month, 1);
300
+ const last = new Date(year, month + 1, 0);
301
+ const min = this.minDate();
302
+ const max = this.maxDate();
303
+ return !!min && compareDays(last, min) < 0 || !!max && compareDays(first, max) > 0;
304
+ }
305
+ yearDisabled(year) {
306
+ const min = this.minDate();
307
+ const max = this.maxDate();
308
+ return !!min && year < min.getFullYear() || !!max && year > max.getFullYear();
309
+ }
310
+ static ɵfac = i0.ɵɵngDeclareFactory({
311
+ minVersion: "12.0.0",
312
+ version: "22.2.6",
313
+ ngImport: i0,
314
+ type: StarCalendar,
315
+ deps: [],
316
+ target: i0.ɵɵFactoryTarget.Component
317
+ });
318
+ static ɵcmp = i0.ɵɵngDeclareComponent({
319
+ minVersion: "17.0.0",
320
+ version: "22.2.6",
321
+ type: StarCalendar,
322
+ isStandalone: true,
323
+ selector: "star-calendar",
324
+ inputs: {
325
+ mode: {
326
+ classPropertyName: "mode",
327
+ publicName: "mode",
328
+ isSignal: true,
329
+ isRequired: false,
330
+ transformFunction: null
331
+ },
332
+ selected: {
333
+ classPropertyName: "selected",
334
+ publicName: "selected",
335
+ isSignal: true,
336
+ isRequired: false,
337
+ transformFunction: null
338
+ },
339
+ selectedDates: {
340
+ classPropertyName: "selectedDates",
341
+ publicName: "selectedDates",
342
+ isSignal: true,
343
+ isRequired: false,
344
+ transformFunction: null
345
+ },
346
+ granularity: {
347
+ classPropertyName: "granularity",
348
+ publicName: "granularity",
349
+ isSignal: true,
350
+ isRequired: false,
351
+ transformFunction: null
352
+ },
353
+ numberOfMonths: {
354
+ classPropertyName: "numberOfMonths",
355
+ publicName: "numberOfMonths",
356
+ isSignal: true,
357
+ isRequired: false,
358
+ transformFunction: null
359
+ },
360
+ showWeek: {
361
+ classPropertyName: "showWeek",
362
+ publicName: "showWeek",
363
+ isSignal: true,
364
+ isRequired: false,
365
+ transformFunction: null
366
+ },
367
+ range: {
368
+ classPropertyName: "range",
369
+ publicName: "range",
370
+ isSignal: true,
371
+ isRequired: false,
372
+ transformFunction: null
373
+ },
374
+ minDate: {
375
+ classPropertyName: "minDate",
376
+ publicName: "minDate",
377
+ isSignal: true,
378
+ isRequired: false,
379
+ transformFunction: null
380
+ },
381
+ maxDate: {
382
+ classPropertyName: "maxDate",
383
+ publicName: "maxDate",
384
+ isSignal: true,
385
+ isRequired: false,
386
+ transformFunction: null
387
+ },
388
+ disabledDates: {
389
+ classPropertyName: "disabledDates",
390
+ publicName: "disabledDates",
391
+ isSignal: true,
392
+ isRequired: false,
393
+ transformFunction: null
394
+ },
395
+ disabledDays: {
396
+ classPropertyName: "disabledDays",
397
+ publicName: "disabledDays",
398
+ isSignal: true,
399
+ isRequired: false,
400
+ transformFunction: null
401
+ },
402
+ dateDisabled: {
403
+ classPropertyName: "dateDisabled",
404
+ publicName: "dateDisabled",
405
+ isSignal: true,
406
+ isRequired: false,
407
+ transformFunction: null
408
+ },
409
+ firstDayOfWeek: {
410
+ classPropertyName: "firstDayOfWeek",
411
+ publicName: "firstDayOfWeek",
412
+ isSignal: true,
413
+ isRequired: false,
414
+ transformFunction: null
415
+ },
416
+ locale: {
417
+ classPropertyName: "locale",
418
+ publicName: "locale",
419
+ isSignal: true,
420
+ isRequired: false,
421
+ transformFunction: null
422
+ }
423
+ },
424
+ outputs: { dateSelect: "dateSelect" },
425
+ host: { classAttribute: "star-calendar" },
426
+ ngImport: i0,
427
+ template: `
428
+ <div class="star-calendar__header">
429
+ <button
430
+ type="button"
431
+ class="star-calendar__nav"
432
+ [attr.aria-label]="view() === 'year' ? text.previousYears : text.previousMonth"
433
+ (click)="page(-1)"
434
+ >
435
+ <i class="ph-bold ph-caret-left star-icon-mirror" aria-hidden="true"></i>
436
+ </button>
437
+ <h2 class="star-calendar__title" [id]="titleId" aria-live="polite">
438
+ @if (view() === 'day') {
439
+ <button
440
+ type="button"
441
+ class="star-calendar__title-btn"
442
+ [attr.aria-label]="text.chooseMonth + ', ' + monthLabel()"
443
+ (click)="view.set('month')"
444
+ >
445
+ {{ monthName() }}
446
+ </button>
447
+ }
448
+ @if (view() !== 'year' && granularity() !== 'year') {
449
+ <button
450
+ type="button"
451
+ class="star-calendar__title-btn"
452
+ [attr.aria-label]="text.chooseYear + ', ' + focused().getFullYear()"
453
+ (click)="view.set('year')"
454
+ >
455
+ {{ focused().getFullYear() }}
456
+ </button>
457
+ } @else {
458
+ <span class="star-calendar__title-text">{{ years()[0] }} – {{ years()[11] }}</span>
459
+ }
460
+ </h2>
461
+ <button
462
+ type="button"
463
+ class="star-calendar__nav"
464
+ [attr.aria-label]="view() === 'year' ? text.nextYears : text.nextMonth"
465
+ (click)="page(1)"
466
+ >
467
+ <i class="ph-bold ph-caret-right star-icon-mirror" aria-hidden="true"></i>
468
+ </button>
469
+ </div>
470
+
471
+ @switch (view()) {
472
+ @case ('day') {
473
+ <div class="star-calendar__months" [class.star-calendar__months--many]="monthCount() > 1">
474
+ @for (grid of grids(); track $index) {
475
+ <!-- Grid keyboard is delegated from the focused day buttons (roving tabindex). -->
476
+ <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->
477
+ <table
478
+ class="star-calendar__grid"
479
+ role="grid"
480
+ [attr.aria-labelledby]="monthCount() > 1 ? null : titleId"
481
+ [attr.aria-label]="monthCount() > 1 ? grid.label : null"
482
+ (keydown)="onDayKeydown($event)"
483
+ >
484
+ @if (monthCount() > 1) {
485
+ <caption class="star-calendar__caption">
486
+ {{
487
+ grid.label
488
+ }}
489
+ </caption>
490
+ }
491
+ <thead>
492
+ <tr>
493
+ @if (showWeek()) {
494
+ <th scope="col" class="star-calendar__week" [attr.abbr]="text.weekNumber">
495
+ {{ text.weekShort }}
496
+ </th>
497
+ }
498
+ @for (day of weekdays(); track day.short) {
499
+ <th scope="col" [attr.abbr]="day.long">{{ day.short }}</th>
500
+ }
501
+ </tr>
502
+ </thead>
503
+ <tbody>
504
+ @for (week of grid.weeks; track $index) {
505
+ <tr>
506
+ @if (showWeek()) {
507
+ <th scope="row" class="star-calendar__week">{{ week.number }}</th>
508
+ }
509
+ @for (cell of week.days; track cell.key) {
510
+ @if (cell.blank) {
511
+ <td role="gridcell"></td>
512
+ } @else {
513
+ <td
514
+ role="gridcell"
515
+ [attr.aria-selected]="isSelected(cell.date)"
516
+ [class.star-calendar__cell--range]="inRange(cell.date)"
517
+ [class.star-calendar__cell--range-start]="isRangeEdge(cell.date, 'start')"
518
+ [class.star-calendar__cell--range-end]="isRangeEdge(cell.date, 'end')"
519
+ >
520
+ <button
521
+ type="button"
522
+ class="star-calendar__day"
523
+ [attr.data-date]="cell.key"
524
+ [class.star-calendar__day--outside]="cell.outside"
525
+ [class.star-calendar__day--today]="cell.today"
526
+ [class.star-calendar__day--selected]="isSelected(cell.date)"
527
+ [attr.tabindex]="sameDay(cell.date, focused()) ? 0 : -1"
528
+ [attr.aria-label]="cell.label"
529
+ [attr.aria-current]="cell.today ? 'date' : null"
530
+ [attr.aria-disabled]="cell.disabled || null"
531
+ (click)="choose(cell.date)"
532
+ (mouseenter)="hover.set(cell.date)"
533
+ (focus)="focused.set(cell.date)"
534
+ >
535
+ {{ cell.date.getDate() }}
536
+ </button>
537
+ </td>
538
+ }
539
+ }
540
+ </tr>
541
+ }
542
+ </tbody>
543
+ </table>
544
+ }
545
+ </div>
546
+ }
547
+ @case ('month') {
548
+ <div
549
+ class="star-calendar__picker"
550
+ role="group"
551
+ [attr.aria-label]="text.chooseMonth"
552
+ (keydown)="onPickerKeydown($event, 'month')"
553
+ >
554
+ @for (month of months(); track $index; let i = $index) {
555
+ <button
556
+ type="button"
557
+ class="star-calendar__pick"
558
+ [attr.data-pick]="i"
559
+ [class.star-calendar__pick--selected]="i === focused().getMonth()"
560
+ [attr.tabindex]="i === focused().getMonth() ? 0 : -1"
561
+ [attr.aria-pressed]="i === focused().getMonth()"
562
+ [disabled]="monthDisabled(i)"
563
+ (click)="pickMonth(i)"
564
+ >
565
+ {{ month }}
566
+ </button>
567
+ }
568
+ </div>
569
+ }
570
+ @case ('year') {
571
+ <div
572
+ class="star-calendar__picker"
573
+ role="group"
574
+ [attr.aria-label]="text.chooseYear"
575
+ (keydown)="onPickerKeydown($event, 'year')"
576
+ >
577
+ @for (year of years(); track year) {
578
+ <button
579
+ type="button"
580
+ class="star-calendar__pick"
581
+ [attr.data-pick]="year"
582
+ [class.star-calendar__pick--selected]="year === focused().getFullYear()"
583
+ [attr.tabindex]="year === focused().getFullYear() ? 0 : -1"
584
+ [attr.aria-pressed]="year === focused().getFullYear()"
585
+ [disabled]="yearDisabled(year)"
586
+ (click)="pickYear(year)"
587
+ >
588
+ {{ year }}
589
+ </button>
590
+ }
591
+ </div>
592
+ }
593
+ }
594
+ `,
595
+ isInline: true,
596
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
597
+ });
598
+ };
599
+ i0.ɵɵngDeclareClassMetadata({
600
+ minVersion: "12.0.0",
601
+ version: "22.2.6",
602
+ ngImport: i0,
603
+ type: StarCalendar,
604
+ decorators: [{
605
+ type: Component,
606
+ args: [{
607
+ selector: "star-calendar",
608
+ changeDetection: ChangeDetectionStrategy.OnPush,
609
+ host: { class: "star-calendar" },
610
+ template: `
611
+ <div class="star-calendar__header">
612
+ <button
613
+ type="button"
614
+ class="star-calendar__nav"
615
+ [attr.aria-label]="view() === 'year' ? text.previousYears : text.previousMonth"
616
+ (click)="page(-1)"
617
+ >
618
+ <i class="ph-bold ph-caret-left star-icon-mirror" aria-hidden="true"></i>
619
+ </button>
620
+ <h2 class="star-calendar__title" [id]="titleId" aria-live="polite">
621
+ @if (view() === 'day') {
622
+ <button
623
+ type="button"
624
+ class="star-calendar__title-btn"
625
+ [attr.aria-label]="text.chooseMonth + ', ' + monthLabel()"
626
+ (click)="view.set('month')"
627
+ >
628
+ {{ monthName() }}
629
+ </button>
630
+ }
631
+ @if (view() !== 'year' && granularity() !== 'year') {
632
+ <button
633
+ type="button"
634
+ class="star-calendar__title-btn"
635
+ [attr.aria-label]="text.chooseYear + ', ' + focused().getFullYear()"
636
+ (click)="view.set('year')"
637
+ >
638
+ {{ focused().getFullYear() }}
639
+ </button>
640
+ } @else {
641
+ <span class="star-calendar__title-text">{{ years()[0] }} – {{ years()[11] }}</span>
642
+ }
643
+ </h2>
644
+ <button
645
+ type="button"
646
+ class="star-calendar__nav"
647
+ [attr.aria-label]="view() === 'year' ? text.nextYears : text.nextMonth"
648
+ (click)="page(1)"
649
+ >
650
+ <i class="ph-bold ph-caret-right star-icon-mirror" aria-hidden="true"></i>
651
+ </button>
652
+ </div>
653
+
654
+ @switch (view()) {
655
+ @case ('day') {
656
+ <div class="star-calendar__months" [class.star-calendar__months--many]="monthCount() > 1">
657
+ @for (grid of grids(); track $index) {
658
+ <!-- Grid keyboard is delegated from the focused day buttons (roving tabindex). -->
659
+ <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->
660
+ <table
661
+ class="star-calendar__grid"
662
+ role="grid"
663
+ [attr.aria-labelledby]="monthCount() > 1 ? null : titleId"
664
+ [attr.aria-label]="monthCount() > 1 ? grid.label : null"
665
+ (keydown)="onDayKeydown($event)"
666
+ >
667
+ @if (monthCount() > 1) {
668
+ <caption class="star-calendar__caption">
669
+ {{
670
+ grid.label
671
+ }}
672
+ </caption>
673
+ }
674
+ <thead>
675
+ <tr>
676
+ @if (showWeek()) {
677
+ <th scope="col" class="star-calendar__week" [attr.abbr]="text.weekNumber">
678
+ {{ text.weekShort }}
679
+ </th>
680
+ }
681
+ @for (day of weekdays(); track day.short) {
682
+ <th scope="col" [attr.abbr]="day.long">{{ day.short }}</th>
683
+ }
684
+ </tr>
685
+ </thead>
686
+ <tbody>
687
+ @for (week of grid.weeks; track $index) {
688
+ <tr>
689
+ @if (showWeek()) {
690
+ <th scope="row" class="star-calendar__week">{{ week.number }}</th>
691
+ }
692
+ @for (cell of week.days; track cell.key) {
693
+ @if (cell.blank) {
694
+ <td role="gridcell"></td>
695
+ } @else {
696
+ <td
697
+ role="gridcell"
698
+ [attr.aria-selected]="isSelected(cell.date)"
699
+ [class.star-calendar__cell--range]="inRange(cell.date)"
700
+ [class.star-calendar__cell--range-start]="isRangeEdge(cell.date, 'start')"
701
+ [class.star-calendar__cell--range-end]="isRangeEdge(cell.date, 'end')"
702
+ >
703
+ <button
704
+ type="button"
705
+ class="star-calendar__day"
706
+ [attr.data-date]="cell.key"
707
+ [class.star-calendar__day--outside]="cell.outside"
708
+ [class.star-calendar__day--today]="cell.today"
709
+ [class.star-calendar__day--selected]="isSelected(cell.date)"
710
+ [attr.tabindex]="sameDay(cell.date, focused()) ? 0 : -1"
711
+ [attr.aria-label]="cell.label"
712
+ [attr.aria-current]="cell.today ? 'date' : null"
713
+ [attr.aria-disabled]="cell.disabled || null"
714
+ (click)="choose(cell.date)"
715
+ (mouseenter)="hover.set(cell.date)"
716
+ (focus)="focused.set(cell.date)"
717
+ >
718
+ {{ cell.date.getDate() }}
719
+ </button>
720
+ </td>
721
+ }
722
+ }
723
+ </tr>
724
+ }
725
+ </tbody>
726
+ </table>
727
+ }
728
+ </div>
729
+ }
730
+ @case ('month') {
731
+ <div
732
+ class="star-calendar__picker"
733
+ role="group"
734
+ [attr.aria-label]="text.chooseMonth"
735
+ (keydown)="onPickerKeydown($event, 'month')"
736
+ >
737
+ @for (month of months(); track $index; let i = $index) {
738
+ <button
739
+ type="button"
740
+ class="star-calendar__pick"
741
+ [attr.data-pick]="i"
742
+ [class.star-calendar__pick--selected]="i === focused().getMonth()"
743
+ [attr.tabindex]="i === focused().getMonth() ? 0 : -1"
744
+ [attr.aria-pressed]="i === focused().getMonth()"
745
+ [disabled]="monthDisabled(i)"
746
+ (click)="pickMonth(i)"
747
+ >
748
+ {{ month }}
749
+ </button>
750
+ }
751
+ </div>
752
+ }
753
+ @case ('year') {
754
+ <div
755
+ class="star-calendar__picker"
756
+ role="group"
757
+ [attr.aria-label]="text.chooseYear"
758
+ (keydown)="onPickerKeydown($event, 'year')"
759
+ >
760
+ @for (year of years(); track year) {
761
+ <button
762
+ type="button"
763
+ class="star-calendar__pick"
764
+ [attr.data-pick]="year"
765
+ [class.star-calendar__pick--selected]="year === focused().getFullYear()"
766
+ [attr.tabindex]="year === focused().getFullYear() ? 0 : -1"
767
+ [attr.aria-pressed]="year === focused().getFullYear()"
768
+ [disabled]="yearDisabled(year)"
769
+ (click)="pickYear(year)"
770
+ >
771
+ {{ year }}
772
+ </button>
773
+ }
774
+ </div>
775
+ }
776
+ }
777
+ `
778
+ }]
779
+ }],
780
+ propDecorators: {
781
+ mode: [{
782
+ type: i0.Input,
783
+ args: [{
784
+ isSignal: true,
785
+ alias: "mode",
786
+ required: false
787
+ }]
788
+ }],
789
+ selected: [{
790
+ type: i0.Input,
791
+ args: [{
792
+ isSignal: true,
793
+ alias: "selected",
794
+ required: false
795
+ }]
796
+ }],
797
+ selectedDates: [{
798
+ type: i0.Input,
799
+ args: [{
800
+ isSignal: true,
801
+ alias: "selectedDates",
802
+ required: false
803
+ }]
804
+ }],
805
+ granularity: [{
806
+ type: i0.Input,
807
+ args: [{
808
+ isSignal: true,
809
+ alias: "granularity",
810
+ required: false
811
+ }]
812
+ }],
813
+ numberOfMonths: [{
814
+ type: i0.Input,
815
+ args: [{
816
+ isSignal: true,
817
+ alias: "numberOfMonths",
818
+ required: false
819
+ }]
820
+ }],
821
+ showWeek: [{
822
+ type: i0.Input,
823
+ args: [{
824
+ isSignal: true,
825
+ alias: "showWeek",
826
+ required: false
827
+ }]
828
+ }],
829
+ range: [{
830
+ type: i0.Input,
831
+ args: [{
832
+ isSignal: true,
833
+ alias: "range",
834
+ required: false
835
+ }]
836
+ }],
837
+ minDate: [{
838
+ type: i0.Input,
839
+ args: [{
840
+ isSignal: true,
841
+ alias: "minDate",
842
+ required: false
843
+ }]
844
+ }],
845
+ maxDate: [{
846
+ type: i0.Input,
847
+ args: [{
848
+ isSignal: true,
849
+ alias: "maxDate",
850
+ required: false
851
+ }]
852
+ }],
853
+ disabledDates: [{
854
+ type: i0.Input,
855
+ args: [{
856
+ isSignal: true,
857
+ alias: "disabledDates",
858
+ required: false
859
+ }]
860
+ }],
861
+ disabledDays: [{
862
+ type: i0.Input,
863
+ args: [{
864
+ isSignal: true,
865
+ alias: "disabledDays",
866
+ required: false
867
+ }]
868
+ }],
869
+ dateDisabled: [{
870
+ type: i0.Input,
871
+ args: [{
872
+ isSignal: true,
873
+ alias: "dateDisabled",
874
+ required: false
875
+ }]
876
+ }],
877
+ firstDayOfWeek: [{
878
+ type: i0.Input,
879
+ args: [{
880
+ isSignal: true,
881
+ alias: "firstDayOfWeek",
882
+ required: false
883
+ }]
884
+ }],
885
+ locale: [{
886
+ type: i0.Input,
887
+ args: [{
888
+ isSignal: true,
889
+ alias: "locale",
890
+ required: false
891
+ }]
892
+ }],
893
+ dateSelect: [{
894
+ type: i0.Output,
895
+ args: ["dateSelect"]
896
+ }]
897
+ }
898
+ });
899
+ const TIME_FORMAT = {
900
+ hour: "2-digit",
901
+ minute: "2-digit",
902
+ hourCycle: "h23"
903
+ };
904
+ function atTime(date, hours, minutes) {
905
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), hours, minutes);
906
+ }
907
+ const PANEL_POSITIONS = [
908
+ {
909
+ originX: "start",
910
+ originY: "bottom",
911
+ overlayX: "start",
912
+ overlayY: "top",
913
+ offsetY: 6
914
+ },
915
+ {
916
+ originX: "start",
917
+ originY: "top",
918
+ overlayX: "start",
919
+ overlayY: "bottom",
920
+ offsetY: -6
921
+ },
922
+ {
923
+ originX: "end",
924
+ originY: "bottom",
925
+ overlayX: "end",
926
+ overlayY: "top",
927
+ offsetY: 6
928
+ }
929
+ ];
930
+ var StarDateInputBase = class StarDateInputBase {
931
+ directionSync = inject(StarDirectionService);
932
+ text = inject(STAR_UI_TEXT);
933
+ ids = inject(_IdGenerator);
934
+ placeholder = input(null, ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
935
+ minDate = input(null, ...ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []);
936
+ maxDate = input(null, ...ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []);
937
+ disabledDates = input([], ...ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []);
938
+ disabledDays = input([], ...ngDevMode ? [{ debugName: "disabledDays" }] : /* istanbul ignore next */ []);
939
+ dateDisabled = input(null, ...ngDevMode ? [{ debugName: "dateDisabled" }] : /* istanbul ignore next */ []);
940
+ firstDayOfWeek = input(null, ...ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []);
941
+ locale = input(void 0, ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
942
+ dateFormat = input(DEFAULT_DATE_FORMAT, ...ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []);
943
+ numberOfMonths = input(1, ...ngDevMode ? [{ debugName: "numberOfMonths" }] : /* istanbul ignore next */ []);
944
+ showWeek = input(false, {
945
+ ...ngDevMode ? { debugName: "showWeek" } : /* istanbul ignore next */ {},
946
+ transform: booleanAttribute
947
+ });
948
+ hourFormat = input("24", ...ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []);
949
+ showButtonBar = input(false, {
950
+ ...ngDevMode ? { debugName: "showButtonBar" } : /* istanbul ignore next */ {},
951
+ transform: booleanAttribute
952
+ });
953
+ showClear = input(false, {
954
+ ...ngDevMode ? { debugName: "showClear" } : /* istanbul ignore next */ {},
955
+ transform: booleanAttribute
956
+ });
957
+ readonlyInput = input(false, {
958
+ ...ngDevMode ? { debugName: "readonlyInput" } : /* istanbul ignore next */ {},
959
+ transform: booleanAttribute
960
+ });
961
+ size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
962
+ ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
963
+ inputId = input(this.ids.getId("star-date-"), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
964
+ disabled = input(false, {
965
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
966
+ transform: booleanAttribute
967
+ });
968
+ readonly = input(false, {
969
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
970
+ transform: booleanAttribute
971
+ });
972
+ required = input(false, {
973
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
974
+ transform: booleanAttribute
975
+ });
976
+ invalid = input(false, {
977
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
978
+ transform: booleanAttribute
979
+ });
980
+ touched = input(false, {
981
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
982
+ transform: booleanAttribute
983
+ });
984
+ name = input("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
985
+ touch = output();
986
+ opened = output();
987
+ closed = output();
988
+ positions = PANEL_POSITIONS;
989
+ panelId = this.ids.getId("star-date-panel-");
990
+ open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
991
+ showInvalid = computed(() => this.invalid() && this.touched(), ...ngDevMode ? [{ debugName: "showInvalid" }] : /* istanbul ignore next */ []);
992
+ interactive = computed(() => !this.disabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "interactive" }] : /* istanbul ignore next */ []);
993
+ hint = computed(() => this.placeholder() ?? formatHint(this.locale()), ...ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []);
994
+ timeEnabled = () => false;
995
+ timeStep = () => 60;
996
+ timeFields() {
997
+ return [];
998
+ }
999
+ calendarDates = () => [];
1000
+ granularity = () => "day";
1001
+ input = viewChild.required("input", ...ngDevMode ? [{ debugName: "input" }] : /* istanbul ignore next */ []);
1002
+ control = viewChild.required("control", ...ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []);
1003
+ calendar = viewChild(StarCalendar, ...ngDevMode ? [{ debugName: "calendar" }] : /* istanbul ignore next */ []);
1004
+ typed = linkedSignal(() => this.displayText(), ...ngDevMode ? [{ debugName: "typed" }] : /* istanbul ignore next */ []);
1005
+ format(date) {
1006
+ return formatDate(date, this.locale(), this.dateFormat());
1007
+ }
1008
+ allowed(date) {
1009
+ const min = this.minDate();
1010
+ const max = this.maxDate();
1011
+ return (!min || compareDays(date, min) >= 0) && (!max || compareDays(date, max) <= 0) && !this.disabledDays().includes(date.getDay()) && !this.disabledDates().some((d) => sameDay(d, date)) && !this.dateDisabled()?.(date);
1012
+ }
1013
+ openPanel() {
1014
+ if (!this.interactive() || this.open()) return;
1015
+ this.open.set(true);
1016
+ this.opened.emit();
1017
+ }
1018
+ closePanel(focusInput = true) {
1019
+ if (!this.open()) return;
1020
+ this.open.set(false);
1021
+ if (focusInput) this.input().nativeElement.focus();
1022
+ this.closed.emit();
1023
+ }
1024
+ togglePanel() {
1025
+ if (this.open()) this.closePanel();
1026
+ else this.openPanel();
1027
+ }
1028
+ onAttached() {
1029
+ this.calendar()?.focusActive();
1030
+ }
1031
+ onOutsideClick(event) {
1032
+ if (this.control().nativeElement.contains(event.target)) return;
1033
+ this.closePanel(false);
1034
+ this.touch.emit();
1035
+ }
1036
+ commitTyped() {
1037
+ const text = this.typed();
1038
+ if (text === this.displayText()) return;
1039
+ const parsed = text.trim() ? this.parseText(text) : this.emptyValue();
1040
+ if (parsed === void 0) this.revertText();
1041
+ else this.value.set(parsed);
1042
+ }
1043
+ revertText() {
1044
+ const text = this.displayText();
1045
+ this.typed.set(text);
1046
+ this.input().nativeElement.value = text;
1047
+ }
1048
+ onInputBlur() {
1049
+ this.commitTyped();
1050
+ if (!this.open()) this.touch.emit();
1051
+ }
1052
+ onInputKeydown(event) {
1053
+ if (event.key === "ArrowDown" && (event.altKey || !this.open())) {
1054
+ event.preventDefault();
1055
+ this.openPanel();
1056
+ } else if (event.key === "Enter") this.commitTyped();
1057
+ else if (event.key === "Escape" && this.open()) {
1058
+ event.preventDefault();
1059
+ this.closePanel();
1060
+ }
1061
+ }
1062
+ onPanelKeydown(event) {
1063
+ if (event.key === "Escape") {
1064
+ event.preventDefault();
1065
+ event.stopPropagation();
1066
+ this.closePanel();
1067
+ }
1068
+ }
1069
+ today() {
1070
+ this.pickToday(startOfDay(/* @__PURE__ */ new Date()));
1071
+ }
1072
+ clear() {
1073
+ this.value.set(this.emptyValue());
1074
+ this.closePanel();
1075
+ }
1076
+ focus(options) {
1077
+ this.input().nativeElement.focus(options);
1078
+ }
1079
+ parseOne(text) {
1080
+ const date = parseDate(text, this.locale());
1081
+ return date && this.allowed(date) ? date : void 0;
1082
+ }
1083
+ parseDateTime(text, hours, minutes) {
1084
+ const match = /^(.*?)[,\s]+(\d{1,2})[:.](\d{2})\s*([ap])\.?\s?m?\.?$|^(.*?)[,\s]+(\d{1,2})[:.](\d{2})$/i.exec(text.trim());
1085
+ const date = this.parseOne(match ? match[1] ?? match[5] : text);
1086
+ if (!date) return void 0;
1087
+ if (!match) return atTime(date, hours, minutes);
1088
+ let h = Number(match[2] ?? match[6]);
1089
+ const m = Number(match[3] ?? match[7]);
1090
+ const meridiem = match[4]?.toLowerCase();
1091
+ if (meridiem) {
1092
+ if (h < 1 || h > 12) return void 0;
1093
+ h = h % 12 + (meridiem === "p" ? 12 : 0);
1094
+ }
1095
+ return h > 23 || m > 59 ? void 0 : atTime(date, h, m);
1096
+ }
1097
+ clampTime(date) {
1098
+ const min = this.minDate();
1099
+ const max = this.maxDate();
1100
+ if (min && date.getTime() < min.getTime()) return new Date(min);
1101
+ if (max && date.getTime() > max.getTime()) return new Date(max);
1102
+ return date;
1103
+ }
1104
+ timeHint() {
1105
+ return this.hourFormat() === "12" ? " hh:mm am" : " hh:mm";
1106
+ }
1107
+ formatDateTime(date) {
1108
+ return formatDate(date, this.locale(), {
1109
+ ...this.dateFormat(),
1110
+ ...TIME_FORMAT,
1111
+ hourCycle: this.hourFormat() === "12" ? "h12" : "h23"
1112
+ });
1113
+ }
1114
+ static ɵfac = i0.ɵɵngDeclareFactory({
1115
+ minVersion: "12.0.0",
1116
+ version: "22.2.6",
1117
+ ngImport: i0,
1118
+ type: StarDateInputBase,
1119
+ deps: [],
1120
+ target: i0.ɵɵFactoryTarget.Directive
1121
+ });
1122
+ static ɵdir = i0.ɵɵngDeclareDirective({
1123
+ minVersion: "17.2.0",
1124
+ version: "22.2.6",
1125
+ type: StarDateInputBase,
1126
+ isStandalone: true,
1127
+ inputs: {
1128
+ placeholder: {
1129
+ classPropertyName: "placeholder",
1130
+ publicName: "placeholder",
1131
+ isSignal: true,
1132
+ isRequired: false,
1133
+ transformFunction: null
1134
+ },
1135
+ minDate: {
1136
+ classPropertyName: "minDate",
1137
+ publicName: "minDate",
1138
+ isSignal: true,
1139
+ isRequired: false,
1140
+ transformFunction: null
1141
+ },
1142
+ maxDate: {
1143
+ classPropertyName: "maxDate",
1144
+ publicName: "maxDate",
1145
+ isSignal: true,
1146
+ isRequired: false,
1147
+ transformFunction: null
1148
+ },
1149
+ disabledDates: {
1150
+ classPropertyName: "disabledDates",
1151
+ publicName: "disabledDates",
1152
+ isSignal: true,
1153
+ isRequired: false,
1154
+ transformFunction: null
1155
+ },
1156
+ disabledDays: {
1157
+ classPropertyName: "disabledDays",
1158
+ publicName: "disabledDays",
1159
+ isSignal: true,
1160
+ isRequired: false,
1161
+ transformFunction: null
1162
+ },
1163
+ dateDisabled: {
1164
+ classPropertyName: "dateDisabled",
1165
+ publicName: "dateDisabled",
1166
+ isSignal: true,
1167
+ isRequired: false,
1168
+ transformFunction: null
1169
+ },
1170
+ firstDayOfWeek: {
1171
+ classPropertyName: "firstDayOfWeek",
1172
+ publicName: "firstDayOfWeek",
1173
+ isSignal: true,
1174
+ isRequired: false,
1175
+ transformFunction: null
1176
+ },
1177
+ locale: {
1178
+ classPropertyName: "locale",
1179
+ publicName: "locale",
1180
+ isSignal: true,
1181
+ isRequired: false,
1182
+ transformFunction: null
1183
+ },
1184
+ dateFormat: {
1185
+ classPropertyName: "dateFormat",
1186
+ publicName: "dateFormat",
1187
+ isSignal: true,
1188
+ isRequired: false,
1189
+ transformFunction: null
1190
+ },
1191
+ numberOfMonths: {
1192
+ classPropertyName: "numberOfMonths",
1193
+ publicName: "numberOfMonths",
1194
+ isSignal: true,
1195
+ isRequired: false,
1196
+ transformFunction: null
1197
+ },
1198
+ showWeek: {
1199
+ classPropertyName: "showWeek",
1200
+ publicName: "showWeek",
1201
+ isSignal: true,
1202
+ isRequired: false,
1203
+ transformFunction: null
1204
+ },
1205
+ hourFormat: {
1206
+ classPropertyName: "hourFormat",
1207
+ publicName: "hourFormat",
1208
+ isSignal: true,
1209
+ isRequired: false,
1210
+ transformFunction: null
1211
+ },
1212
+ showButtonBar: {
1213
+ classPropertyName: "showButtonBar",
1214
+ publicName: "showButtonBar",
1215
+ isSignal: true,
1216
+ isRequired: false,
1217
+ transformFunction: null
1218
+ },
1219
+ showClear: {
1220
+ classPropertyName: "showClear",
1221
+ publicName: "showClear",
1222
+ isSignal: true,
1223
+ isRequired: false,
1224
+ transformFunction: null
1225
+ },
1226
+ readonlyInput: {
1227
+ classPropertyName: "readonlyInput",
1228
+ publicName: "readonlyInput",
1229
+ isSignal: true,
1230
+ isRequired: false,
1231
+ transformFunction: null
1232
+ },
1233
+ size: {
1234
+ classPropertyName: "size",
1235
+ publicName: "size",
1236
+ isSignal: true,
1237
+ isRequired: false,
1238
+ transformFunction: null
1239
+ },
1240
+ ariaLabel: {
1241
+ classPropertyName: "ariaLabel",
1242
+ publicName: "ariaLabel",
1243
+ isSignal: true,
1244
+ isRequired: false,
1245
+ transformFunction: null
1246
+ },
1247
+ inputId: {
1248
+ classPropertyName: "inputId",
1249
+ publicName: "inputId",
1250
+ isSignal: true,
1251
+ isRequired: false,
1252
+ transformFunction: null
1253
+ },
1254
+ disabled: {
1255
+ classPropertyName: "disabled",
1256
+ publicName: "disabled",
1257
+ isSignal: true,
1258
+ isRequired: false,
1259
+ transformFunction: null
1260
+ },
1261
+ readonly: {
1262
+ classPropertyName: "readonly",
1263
+ publicName: "readonly",
1264
+ isSignal: true,
1265
+ isRequired: false,
1266
+ transformFunction: null
1267
+ },
1268
+ required: {
1269
+ classPropertyName: "required",
1270
+ publicName: "required",
1271
+ isSignal: true,
1272
+ isRequired: false,
1273
+ transformFunction: null
1274
+ },
1275
+ invalid: {
1276
+ classPropertyName: "invalid",
1277
+ publicName: "invalid",
1278
+ isSignal: true,
1279
+ isRequired: false,
1280
+ transformFunction: null
1281
+ },
1282
+ touched: {
1283
+ classPropertyName: "touched",
1284
+ publicName: "touched",
1285
+ isSignal: true,
1286
+ isRequired: false,
1287
+ transformFunction: null
1288
+ },
1289
+ name: {
1290
+ classPropertyName: "name",
1291
+ publicName: "name",
1292
+ isSignal: true,
1293
+ isRequired: false,
1294
+ transformFunction: null
1295
+ }
1296
+ },
1297
+ outputs: {
1298
+ touch: "touch",
1299
+ opened: "opened",
1300
+ closed: "closed"
1301
+ },
1302
+ viewQueries: [
1303
+ {
1304
+ propertyName: "input",
1305
+ first: true,
1306
+ predicate: ["input"],
1307
+ descendants: true,
1308
+ isSignal: true
1309
+ },
1310
+ {
1311
+ propertyName: "control",
1312
+ first: true,
1313
+ predicate: ["control"],
1314
+ descendants: true,
1315
+ isSignal: true
1316
+ },
1317
+ {
1318
+ propertyName: "calendar",
1319
+ first: true,
1320
+ predicate: StarCalendar,
1321
+ descendants: true,
1322
+ isSignal: true
1323
+ }
1324
+ ],
1325
+ ngImport: i0
1326
+ });
1327
+ };
1328
+ i0.ɵɵngDeclareClassMetadata({
1329
+ minVersion: "12.0.0",
1330
+ version: "22.2.6",
1331
+ ngImport: i0,
1332
+ type: StarDateInputBase,
1333
+ decorators: [{ type: Directive }],
1334
+ propDecorators: {
1335
+ placeholder: [{
1336
+ type: i0.Input,
1337
+ args: [{
1338
+ isSignal: true,
1339
+ alias: "placeholder",
1340
+ required: false
1341
+ }]
1342
+ }],
1343
+ minDate: [{
1344
+ type: i0.Input,
1345
+ args: [{
1346
+ isSignal: true,
1347
+ alias: "minDate",
1348
+ required: false
1349
+ }]
1350
+ }],
1351
+ maxDate: [{
1352
+ type: i0.Input,
1353
+ args: [{
1354
+ isSignal: true,
1355
+ alias: "maxDate",
1356
+ required: false
1357
+ }]
1358
+ }],
1359
+ disabledDates: [{
1360
+ type: i0.Input,
1361
+ args: [{
1362
+ isSignal: true,
1363
+ alias: "disabledDates",
1364
+ required: false
1365
+ }]
1366
+ }],
1367
+ disabledDays: [{
1368
+ type: i0.Input,
1369
+ args: [{
1370
+ isSignal: true,
1371
+ alias: "disabledDays",
1372
+ required: false
1373
+ }]
1374
+ }],
1375
+ dateDisabled: [{
1376
+ type: i0.Input,
1377
+ args: [{
1378
+ isSignal: true,
1379
+ alias: "dateDisabled",
1380
+ required: false
1381
+ }]
1382
+ }],
1383
+ firstDayOfWeek: [{
1384
+ type: i0.Input,
1385
+ args: [{
1386
+ isSignal: true,
1387
+ alias: "firstDayOfWeek",
1388
+ required: false
1389
+ }]
1390
+ }],
1391
+ locale: [{
1392
+ type: i0.Input,
1393
+ args: [{
1394
+ isSignal: true,
1395
+ alias: "locale",
1396
+ required: false
1397
+ }]
1398
+ }],
1399
+ dateFormat: [{
1400
+ type: i0.Input,
1401
+ args: [{
1402
+ isSignal: true,
1403
+ alias: "dateFormat",
1404
+ required: false
1405
+ }]
1406
+ }],
1407
+ numberOfMonths: [{
1408
+ type: i0.Input,
1409
+ args: [{
1410
+ isSignal: true,
1411
+ alias: "numberOfMonths",
1412
+ required: false
1413
+ }]
1414
+ }],
1415
+ showWeek: [{
1416
+ type: i0.Input,
1417
+ args: [{
1418
+ isSignal: true,
1419
+ alias: "showWeek",
1420
+ required: false
1421
+ }]
1422
+ }],
1423
+ hourFormat: [{
1424
+ type: i0.Input,
1425
+ args: [{
1426
+ isSignal: true,
1427
+ alias: "hourFormat",
1428
+ required: false
1429
+ }]
1430
+ }],
1431
+ showButtonBar: [{
1432
+ type: i0.Input,
1433
+ args: [{
1434
+ isSignal: true,
1435
+ alias: "showButtonBar",
1436
+ required: false
1437
+ }]
1438
+ }],
1439
+ showClear: [{
1440
+ type: i0.Input,
1441
+ args: [{
1442
+ isSignal: true,
1443
+ alias: "showClear",
1444
+ required: false
1445
+ }]
1446
+ }],
1447
+ readonlyInput: [{
1448
+ type: i0.Input,
1449
+ args: [{
1450
+ isSignal: true,
1451
+ alias: "readonlyInput",
1452
+ required: false
1453
+ }]
1454
+ }],
1455
+ size: [{
1456
+ type: i0.Input,
1457
+ args: [{
1458
+ isSignal: true,
1459
+ alias: "size",
1460
+ required: false
1461
+ }]
1462
+ }],
1463
+ ariaLabel: [{
1464
+ type: i0.Input,
1465
+ args: [{
1466
+ isSignal: true,
1467
+ alias: "ariaLabel",
1468
+ required: false
1469
+ }]
1470
+ }],
1471
+ inputId: [{
1472
+ type: i0.Input,
1473
+ args: [{
1474
+ isSignal: true,
1475
+ alias: "inputId",
1476
+ required: false
1477
+ }]
1478
+ }],
1479
+ disabled: [{
1480
+ type: i0.Input,
1481
+ args: [{
1482
+ isSignal: true,
1483
+ alias: "disabled",
1484
+ required: false
1485
+ }]
1486
+ }],
1487
+ readonly: [{
1488
+ type: i0.Input,
1489
+ args: [{
1490
+ isSignal: true,
1491
+ alias: "readonly",
1492
+ required: false
1493
+ }]
1494
+ }],
1495
+ required: [{
1496
+ type: i0.Input,
1497
+ args: [{
1498
+ isSignal: true,
1499
+ alias: "required",
1500
+ required: false
1501
+ }]
1502
+ }],
1503
+ invalid: [{
1504
+ type: i0.Input,
1505
+ args: [{
1506
+ isSignal: true,
1507
+ alias: "invalid",
1508
+ required: false
1509
+ }]
1510
+ }],
1511
+ touched: [{
1512
+ type: i0.Input,
1513
+ args: [{
1514
+ isSignal: true,
1515
+ alias: "touched",
1516
+ required: false
1517
+ }]
1518
+ }],
1519
+ name: [{
1520
+ type: i0.Input,
1521
+ args: [{
1522
+ isSignal: true,
1523
+ alias: "name",
1524
+ required: false
1525
+ }]
1526
+ }],
1527
+ touch: [{
1528
+ type: i0.Output,
1529
+ args: ["touch"]
1530
+ }],
1531
+ opened: [{
1532
+ type: i0.Output,
1533
+ args: ["opened"]
1534
+ }],
1535
+ closed: [{
1536
+ type: i0.Output,
1537
+ args: ["closed"]
1538
+ }],
1539
+ input: [{
1540
+ type: i0.ViewChild,
1541
+ args: ["input", { isSignal: true }]
1542
+ }],
1543
+ control: [{
1544
+ type: i0.ViewChild,
1545
+ args: ["control", { isSignal: true }]
1546
+ }],
1547
+ calendar: [{
1548
+ type: i0.ViewChild,
1549
+ args: [i0.forwardRef(() => StarCalendar), { isSignal: true }]
1550
+ }]
1551
+ }
1552
+ });
1553
+ function timeOf(date) {
1554
+ const pad = (part) => String(part).padStart(2, "0");
1555
+ return date ? `${pad(date.getHours())}:${pad(date.getMinutes())}` : "";
1556
+ }
1557
+ function withTime(date, time) {
1558
+ const match = /^(\d{2}):(\d{2})/.exec(time);
1559
+ return date && match ? atTime(date, Number(match[1]), Number(match[2])) : null;
1560
+ }
1561
+ const TEMPLATE = `
1562
+ <div #control class="star-date__control" cdkOverlayOrigin #origin="cdkOverlayOrigin">
1563
+ <input
1564
+ #input
1565
+ type="text"
1566
+ class="star-date__input"
1567
+ autocomplete="off"
1568
+ inputmode="numeric"
1569
+ aria-haspopup="dialog"
1570
+ [id]="inputId()"
1571
+ [attr.name]="name() || null"
1572
+ [value]="typed()"
1573
+ [attr.placeholder]="hint()"
1574
+ [disabled]="disabled()"
1575
+ [readOnly]="readonly() || readonlyInput()"
1576
+ [required]="required()"
1577
+ [attr.aria-label]="ariaLabel()"
1578
+ [attr.aria-controls]="open() ? panelId : null"
1579
+ [attr.aria-invalid]="showInvalid() || null"
1580
+ (input)="typed.set(input.value)"
1581
+ (click)="readonlyInput() && togglePanel()"
1582
+ (keydown)="onInputKeydown($event)"
1583
+ (blur)="onInputBlur()"
1584
+ />
1585
+ @if (showClear() && hasValue() && interactive()) {
1586
+ <button type="button" class="star-select__icon-btn" [attr.aria-label]="text.clear" (click)="clear()">
1587
+ <i class="ph-bold ph-x" aria-hidden="true"></i>
1588
+ </button>
1589
+ }
1590
+ <button
1591
+ type="button"
1592
+ class="star-date__toggle"
1593
+ [disabled]="!interactive()"
1594
+ aria-haspopup="dialog"
1595
+ [attr.aria-label]="text.chooseDate"
1596
+ [attr.aria-expanded]="open()"
1597
+ [attr.aria-controls]="open() ? panelId : null"
1598
+ (click)="togglePanel()"
1599
+ >
1600
+ <i class="ph-bold ph-calendar-blank" aria-hidden="true"></i>
1601
+ </button>
1602
+ </div>
1603
+
1604
+ <ng-template
1605
+ cdkConnectedOverlay
1606
+ cdkConnectedOverlayUsePopover="inline"
1607
+ [cdkConnectedOverlayOrigin]="origin"
1608
+ [cdkConnectedOverlayOpen]="open()"
1609
+ [cdkConnectedOverlayPositions]="positions"
1610
+ (attach)="onAttached()"
1611
+ (detach)="closePanel(false)"
1612
+ (overlayOutsideClick)="onOutsideClick($event)"
1613
+ >
1614
+ <div
1615
+ class="star-panel star-date__panel"
1616
+ role="dialog"
1617
+ [id]="panelId"
1618
+ [attr.aria-label]="text.chooseDate"
1619
+ (keydown)="onPanelKeydown($event)"
1620
+ >
1621
+ <star-calendar
1622
+ [mode]="mode"
1623
+ [selected]="calendarSelected()"
1624
+ [range]="calendarRange()"
1625
+ [selectedDates]="calendarDates()"
1626
+ [granularity]="granularity()"
1627
+ [numberOfMonths]="numberOfMonths()"
1628
+ [showWeek]="showWeek()"
1629
+ [minDate]="minDate()"
1630
+ [maxDate]="maxDate()"
1631
+ [disabledDates]="disabledDates()"
1632
+ [disabledDays]="disabledDays()"
1633
+ [dateDisabled]="dateDisabled()"
1634
+ [firstDayOfWeek]="firstDayOfWeek()"
1635
+ [locale]="locale()"
1636
+ (dateSelect)="onDateSelect($event)"
1637
+ />
1638
+ @if (timeEnabled()) {
1639
+ <div class="star-date__time">
1640
+ @for (field of timeFields(); track field.label) {
1641
+ <label class="star-date__time-label">
1642
+ {{ field.label }}
1643
+ <input
1644
+ type="time"
1645
+ class="star-input star-input--sm"
1646
+ [value]="field.value"
1647
+ [step]="timeStep()"
1648
+ [disabled]="!field.value"
1649
+ (change)="field.set($any($event.target).value)"
1650
+ />
1651
+ </label>
1652
+ }
1653
+ <button type="button" class="star-btn star-btn--primary star-btn--sm" (click)="closePanel()">{{ text.done }}</button>
1654
+ </div>
1655
+ }
1656
+ @if (showButtonBar()) {
1657
+ <div class="star-date__bar">
1658
+ <button type="button" class="star-btn star-btn--ghost star-btn--sm" (click)="today()">{{ text.today }}</button>
1659
+ <button type="button" class="star-btn star-btn--ghost star-btn--sm" (click)="clear()">{{ text.clear }}</button>
1660
+ </div>
1661
+ }
1662
+ </div>
1663
+ </ng-template>
1664
+ `;
1665
+ const HOST = {
1666
+ class: "star-date",
1667
+ "[class.star-date--open]": "open()",
1668
+ "[class.star-date--disabled]": "disabled()",
1669
+ "[class.star-date--invalid]": "showInvalid()",
1670
+ "[class.star-date--sm]": "size() === 'sm'"
1671
+ };
1672
+ var StarDatePicker = class StarDatePicker extends StarDateInputBase {
1673
+ value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
1674
+ showTime = input(false, {
1675
+ ...ngDevMode ? { debugName: "showTime" } : /* istanbul ignore next */ {},
1676
+ transform: booleanAttribute
1677
+ });
1678
+ stepMinute = input(1, ...ngDevMode ? [{ debugName: "stepMinute" }] : /* istanbul ignore next */ []);
1679
+ view = input("day", ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
1680
+ dateSelect = output();
1681
+ mode = "single";
1682
+ timeEnabled = () => this.showTime() && this.view() === "day";
1683
+ timeStep = () => Math.max(1, this.stepMinute()) * 60;
1684
+ granularity = this.view;
1685
+ hint = computed(() => {
1686
+ if (this.placeholder()) return this.placeholder();
1687
+ if (this.view() === "month") return "mm/yyyy";
1688
+ if (this.view() === "year") return "yyyy";
1689
+ return formatHint(this.locale()) + (this.showTime() ? this.timeHint() : "");
1690
+ }, ...ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []);
1691
+ displayText = () => {
1692
+ const value = this.value();
1693
+ if (!value) return "";
1694
+ if (this.view() === "year") return String(value.getFullYear());
1695
+ if (this.view() === "month") return `${String(value.getMonth() + 1).padStart(2, "0")}/${value.getFullYear()}`;
1696
+ return this.timeEnabled() ? this.formatDateTime(value) : this.format(value);
1697
+ };
1698
+ hasValue = computed(() => this.value() !== null, ...ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []);
1699
+ calendarSelected = this.value;
1700
+ calendarRange = signal(null, ...ngDevMode ? [{ debugName: "calendarRange" }] : /* istanbul ignore next */ []);
1701
+ parseText(text) {
1702
+ if (this.view() !== "day") return this.parsePeriod(text.trim());
1703
+ if (!this.timeEnabled()) return this.parseOne(text);
1704
+ const current = this.value();
1705
+ const date = this.parseDateTime(text, current?.getHours() ?? 0, current?.getMinutes() ?? 0);
1706
+ return date && this.clampTime(date).getTime() === date.getTime() ? date : void 0;
1707
+ }
1708
+ parsePeriod(text) {
1709
+ const year = /^(\d{4})$/.exec(text);
1710
+ const month = /^(\d{1,2})[/.\- ](\d{4})$/.exec(text);
1711
+ const iso = /^(\d{4})-(\d{1,2})$/.exec(text);
1712
+ let date = null;
1713
+ if (this.view() === "year" && year) date = new Date(Number(year[1]), 0, 1);
1714
+ else if (this.view() === "month" && month) date = new Date(Number(month[2]), Number(month[1]) - 1, 1);
1715
+ else if (this.view() === "month" && iso) date = new Date(Number(iso[1]), Number(iso[2]) - 1, 1);
1716
+ if (!date || date.getMonth() > 11 || Number.isNaN(date.getTime())) return void 0;
1717
+ if (month && (Number(month[1]) < 1 || Number(month[1]) > 12)) return void 0;
1718
+ if (iso && (Number(iso[2]) < 1 || Number(iso[2]) > 12)) return void 0;
1719
+ return this.periodAllowed(date) ? date : void 0;
1720
+ }
1721
+ periodAllowed(first) {
1722
+ const last = this.view() === "year" ? new Date(first.getFullYear(), 11, 31) : new Date(first.getFullYear(), first.getMonth() + 1, 0);
1723
+ const min = this.minDate();
1724
+ const max = this.maxDate();
1725
+ return (!min || compareDays(last, min) >= 0) && (!max || compareDays(first, max) <= 0);
1726
+ }
1727
+ emptyValue() {
1728
+ return null;
1729
+ }
1730
+ pickToday(today) {
1731
+ if (this.view() === "month") return this.onDateSelect(new Date(today.getFullYear(), today.getMonth(), 1));
1732
+ if (this.view() === "year") return this.onDateSelect(new Date(today.getFullYear(), 0, 1));
1733
+ if (!this.allowed(today)) return;
1734
+ if (!this.timeEnabled()) return this.onDateSelect(today);
1735
+ this.setValue(this.atCurrentTime(today));
1736
+ }
1737
+ onDateSelect(date) {
1738
+ if (!this.timeEnabled()) {
1739
+ this.setValue(date);
1740
+ this.closePanel();
1741
+ return;
1742
+ }
1743
+ const current = this.value();
1744
+ this.setValue(current ? atTime(date, current.getHours(), current.getMinutes()) : this.atCurrentTime(date));
1745
+ }
1746
+ timeFields() {
1747
+ return [{
1748
+ label: this.text.time,
1749
+ value: timeOf(this.value()),
1750
+ set: (time) => {
1751
+ const next = withTime(this.value(), time);
1752
+ if (next) this.setValue(next);
1753
+ }
1754
+ }];
1755
+ }
1756
+ atCurrentTime(date) {
1757
+ const now = /* @__PURE__ */ new Date();
1758
+ const step = Math.max(1, this.stepMinute());
1759
+ return atTime(date, now.getHours(), now.getMinutes() - now.getMinutes() % step);
1760
+ }
1761
+ setValue(date) {
1762
+ const next = this.timeEnabled() ? this.clampTime(date) : date;
1763
+ this.value.set(next);
1764
+ this.dateSelect.emit(next);
1765
+ }
1766
+ static ɵfac = i0.ɵɵngDeclareFactory({
1767
+ minVersion: "12.0.0",
1768
+ version: "22.2.6",
1769
+ ngImport: i0,
1770
+ type: StarDatePicker,
1771
+ deps: null,
1772
+ target: i0.ɵɵFactoryTarget.Component
1773
+ });
1774
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1775
+ minVersion: "17.0.0",
1776
+ version: "22.2.6",
1777
+ type: StarDatePicker,
1778
+ isStandalone: true,
1779
+ selector: "star-date-picker",
1780
+ inputs: {
1781
+ value: {
1782
+ classPropertyName: "value",
1783
+ publicName: "value",
1784
+ isSignal: true,
1785
+ isRequired: false,
1786
+ transformFunction: null
1787
+ },
1788
+ showTime: {
1789
+ classPropertyName: "showTime",
1790
+ publicName: "showTime",
1791
+ isSignal: true,
1792
+ isRequired: false,
1793
+ transformFunction: null
1794
+ },
1795
+ stepMinute: {
1796
+ classPropertyName: "stepMinute",
1797
+ publicName: "stepMinute",
1798
+ isSignal: true,
1799
+ isRequired: false,
1800
+ transformFunction: null
1801
+ },
1802
+ view: {
1803
+ classPropertyName: "view",
1804
+ publicName: "view",
1805
+ isSignal: true,
1806
+ isRequired: false,
1807
+ transformFunction: null
1808
+ }
1809
+ },
1810
+ outputs: {
1811
+ value: "valueChange",
1812
+ dateSelect: "dateSelect"
1813
+ },
1814
+ host: {
1815
+ properties: {
1816
+ "class.star-date--open": "open()",
1817
+ "class.star-date--disabled": "disabled()",
1818
+ "class.star-date--invalid": "showInvalid()",
1819
+ "class.star-date--sm": "size() === 'sm'"
1820
+ },
1821
+ classAttribute: "star-date"
1822
+ },
1823
+ usesInheritance: true,
1824
+ ngImport: i0,
1825
+ template: "\n <div #control class=\"star-date__control\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #input\n type=\"text\"\n class=\"star-date__input\"\n autocomplete=\"off\"\n inputmode=\"numeric\"\n aria-haspopup=\"dialog\"\n [id]=\"inputId()\"\n [attr.name]=\"name() || null\"\n [value]=\"typed()\"\n [attr.placeholder]=\"hint()\"\n [disabled]=\"disabled()\"\n [readOnly]=\"readonly() || readonlyInput()\"\n [required]=\"required()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-controls]=\"open() ? panelId : null\"\n [attr.aria-invalid]=\"showInvalid() || null\"\n (input)=\"typed.set(input.value)\"\n (click)=\"readonlyInput() && togglePanel()\"\n (keydown)=\"onInputKeydown($event)\"\n (blur)=\"onInputBlur()\"\n />\n @if (showClear() && hasValue() && interactive()) {\n <button type=\"button\" class=\"star-select__icon-btn\" [attr.aria-label]=\"text.clear\" (click)=\"clear()\">\n <i class=\"ph-bold ph-x\" aria-hidden=\"true\"></i>\n </button>\n }\n <button\n type=\"button\"\n class=\"star-date__toggle\"\n [disabled]=\"!interactive()\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"text.chooseDate\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? panelId : null\"\n (click)=\"togglePanel()\"\n >\n <i class=\"ph-bold ph-calendar-blank\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayUsePopover=\"inline\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (attach)=\"onAttached()\"\n (detach)=\"closePanel(false)\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n >\n <div\n class=\"star-panel star-date__panel\"\n role=\"dialog\"\n [id]=\"panelId\"\n [attr.aria-label]=\"text.chooseDate\"\n (keydown)=\"onPanelKeydown($event)\"\n >\n <star-calendar\n [mode]=\"mode\"\n [selected]=\"calendarSelected()\"\n [range]=\"calendarRange()\"\n [selectedDates]=\"calendarDates()\"\n [granularity]=\"granularity()\"\n [numberOfMonths]=\"numberOfMonths()\"\n [showWeek]=\"showWeek()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [disabledDays]=\"disabledDays()\"\n [dateDisabled]=\"dateDisabled()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n (dateSelect)=\"onDateSelect($event)\"\n />\n @if (timeEnabled()) {\n <div class=\"star-date__time\">\n @for (field of timeFields(); track field.label) {\n <label class=\"star-date__time-label\">\n {{ field.label }}\n <input\n type=\"time\"\n class=\"star-input star-input--sm\"\n [value]=\"field.value\"\n [step]=\"timeStep()\"\n [disabled]=\"!field.value\"\n (change)=\"field.set($any($event.target).value)\"\n />\n </label>\n }\n <button type=\"button\" class=\"star-btn star-btn--primary star-btn--sm\" (click)=\"closePanel()\">{{ text.done }}</button>\n </div>\n }\n @if (showButtonBar()) {\n <div class=\"star-date__bar\">\n <button type=\"button\" class=\"star-btn star-btn--ghost star-btn--sm\" (click)=\"today()\">{{ text.today }}</button>\n <button type=\"button\" class=\"star-btn star-btn--ghost star-btn--sm\" (click)=\"clear()\">{{ text.clear }}</button>\n </div>\n }\n </div>\n </ng-template>\n",
1826
+ isInline: true,
1827
+ dependencies: [
1828
+ {
1829
+ kind: "directive",
1830
+ type: CdkConnectedOverlay,
1831
+ selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
1832
+ inputs: [
1833
+ "cdkConnectedOverlayOrigin",
1834
+ "cdkConnectedOverlayPositions",
1835
+ "cdkConnectedOverlayPositionStrategy",
1836
+ "cdkConnectedOverlayOffsetX",
1837
+ "cdkConnectedOverlayOffsetY",
1838
+ "cdkConnectedOverlayWidth",
1839
+ "cdkConnectedOverlayHeight",
1840
+ "cdkConnectedOverlayMinWidth",
1841
+ "cdkConnectedOverlayMinHeight",
1842
+ "cdkConnectedOverlayBackdropClass",
1843
+ "cdkConnectedOverlayPanelClass",
1844
+ "cdkConnectedOverlayViewportMargin",
1845
+ "cdkConnectedOverlayScrollStrategy",
1846
+ "cdkConnectedOverlayOpen",
1847
+ "cdkConnectedOverlayDisableClose",
1848
+ "cdkConnectedOverlayTransformOriginOn",
1849
+ "cdkConnectedOverlayHasBackdrop",
1850
+ "cdkConnectedOverlayLockPosition",
1851
+ "cdkConnectedOverlayFlexibleDimensions",
1852
+ "cdkConnectedOverlayGrowAfterOpen",
1853
+ "cdkConnectedOverlayPush",
1854
+ "cdkConnectedOverlayDisposeOnNavigation",
1855
+ "cdkConnectedOverlayUsePopover",
1856
+ "cdkConnectedOverlayMatchWidth",
1857
+ "cdkConnectedOverlay"
1858
+ ],
1859
+ outputs: [
1860
+ "backdropClick",
1861
+ "positionChange",
1862
+ "attach",
1863
+ "detach",
1864
+ "overlayKeydown",
1865
+ "overlayOutsideClick"
1866
+ ],
1867
+ exportAs: ["cdkConnectedOverlay"]
1868
+ },
1869
+ {
1870
+ kind: "directive",
1871
+ type: CdkOverlayOrigin,
1872
+ selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
1873
+ exportAs: ["cdkOverlayOrigin"]
1874
+ },
1875
+ {
1876
+ kind: "component",
1877
+ type: StarCalendar,
1878
+ selector: "star-calendar",
1879
+ inputs: [
1880
+ "mode",
1881
+ "selected",
1882
+ "selectedDates",
1883
+ "granularity",
1884
+ "numberOfMonths",
1885
+ "showWeek",
1886
+ "range",
1887
+ "minDate",
1888
+ "maxDate",
1889
+ "disabledDates",
1890
+ "disabledDays",
1891
+ "dateDisabled",
1892
+ "firstDayOfWeek",
1893
+ "locale"
1894
+ ],
1895
+ outputs: ["dateSelect"]
1896
+ }
1897
+ ],
1898
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1899
+ });
1900
+ };
1901
+ i0.ɵɵngDeclareClassMetadata({
1902
+ minVersion: "12.0.0",
1903
+ version: "22.2.6",
1904
+ ngImport: i0,
1905
+ type: StarDatePicker,
1906
+ decorators: [{
1907
+ type: Component,
1908
+ args: [{
1909
+ selector: "star-date-picker",
1910
+ imports: [
1911
+ CdkConnectedOverlay,
1912
+ CdkOverlayOrigin,
1913
+ StarCalendar
1914
+ ],
1915
+ changeDetection: ChangeDetectionStrategy.OnPush,
1916
+ host: HOST,
1917
+ template: TEMPLATE
1918
+ }]
1919
+ }],
1920
+ propDecorators: {
1921
+ value: [{
1922
+ type: i0.Input,
1923
+ args: [{
1924
+ isSignal: true,
1925
+ alias: "value",
1926
+ required: false
1927
+ }]
1928
+ }, {
1929
+ type: i0.Output,
1930
+ args: ["valueChange"]
1931
+ }],
1932
+ showTime: [{
1933
+ type: i0.Input,
1934
+ args: [{
1935
+ isSignal: true,
1936
+ alias: "showTime",
1937
+ required: false
1938
+ }]
1939
+ }],
1940
+ stepMinute: [{
1941
+ type: i0.Input,
1942
+ args: [{
1943
+ isSignal: true,
1944
+ alias: "stepMinute",
1945
+ required: false
1946
+ }]
1947
+ }],
1948
+ view: [{
1949
+ type: i0.Input,
1950
+ args: [{
1951
+ isSignal: true,
1952
+ alias: "view",
1953
+ required: false
1954
+ }]
1955
+ }],
1956
+ dateSelect: [{
1957
+ type: i0.Output,
1958
+ args: ["dateSelect"]
1959
+ }]
1960
+ }
1961
+ });
1962
+ var StarDateRangePicker = class StarDateRangePicker extends StarDateInputBase {
1963
+ value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
1964
+ showTime = input(false, {
1965
+ ...ngDevMode ? { debugName: "showTime" } : /* istanbul ignore next */ {},
1966
+ transform: booleanAttribute
1967
+ });
1968
+ stepMinute = input(1, ...ngDevMode ? [{ debugName: "stepMinute" }] : /* istanbul ignore next */ []);
1969
+ rangeSelect = output();
1970
+ mode = "range";
1971
+ timeEnabled = this.showTime;
1972
+ timeStep = () => Math.max(1, this.stepMinute()) * 60;
1973
+ hint = computed(() => this.placeholder() ?? formatHint(this.locale()) + (this.showTime() ? this.timeHint() : ""), ...ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []);
1974
+ show = (date) => this.showTime() ? this.formatDateTime(date) : this.format(date);
1975
+ timeFields() {
1976
+ const range = this.value();
1977
+ const update = (edge) => (time) => {
1978
+ const current = this.value();
1979
+ const next = withTime(current?.[edge], time);
1980
+ if (!current?.start || !next) return;
1981
+ const changed = {
1982
+ ...current,
1983
+ [edge]: this.clampTime(next)
1984
+ };
1985
+ if (changed.end && changed.start && changed.end.getTime() < changed.start.getTime()) return;
1986
+ this.value.set(changed);
1987
+ if (changed.end) this.rangeSelect.emit(changed);
1988
+ };
1989
+ return [{
1990
+ label: this.text.startTime,
1991
+ value: timeOf(range?.start),
1992
+ set: update("start")
1993
+ }, {
1994
+ label: this.text.endTime,
1995
+ value: timeOf(range?.end),
1996
+ set: update("end")
1997
+ }];
1998
+ }
1999
+ hasValue = computed(() => !!this.value()?.start, ...ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []);
2000
+ calendarSelected = signal(null, ...ngDevMode ? [{ debugName: "calendarSelected" }] : /* istanbul ignore next */ []);
2001
+ calendarRange = this.value;
2002
+ displayText = () => {
2003
+ const range = this.value();
2004
+ if (!range?.start) return "";
2005
+ return range.end ? `${this.show(range.start)} – ${this.show(range.end)}` : `${this.show(range.start)} – `;
2006
+ };
2007
+ parseText(text) {
2008
+ const parts = text.split(/\s+[–—-]\s*|\s+to\s+/i).filter((part) => part.trim());
2009
+ if (parts.length !== 2) return void 0;
2010
+ if (this.showTime()) {
2011
+ const from = this.parseDateTime(parts[0], 0, 0);
2012
+ const to = this.parseDateTime(parts[1], 23, 59);
2013
+ if (!from || !to) return void 0;
2014
+ return from.getTime() <= to.getTime() ? {
2015
+ start: from,
2016
+ end: to
2017
+ } : {
2018
+ start: to,
2019
+ end: from
2020
+ };
2021
+ }
2022
+ const start = this.parseOne(parts[0]);
2023
+ const end = this.parseOne(parts[1]);
2024
+ if (!start || !end) return void 0;
2025
+ return compareDays(start, end) <= 0 ? {
2026
+ start,
2027
+ end
2028
+ } : {
2029
+ start: end,
2030
+ end: start
2031
+ };
2032
+ }
2033
+ emptyValue() {
2034
+ return null;
2035
+ }
2036
+ pickToday(today) {
2037
+ if (!this.allowed(today)) return;
2038
+ if (this.showTime()) {
2039
+ this.value.set({
2040
+ start: this.clampTime(atTime(today, 0, 0)),
2041
+ end: this.clampTime(atTime(today, 23, 59))
2042
+ });
2043
+ return;
2044
+ }
2045
+ this.value.set({
2046
+ start: today,
2047
+ end: today
2048
+ });
2049
+ this.closePanel();
2050
+ }
2051
+ onDateSelect(date) {
2052
+ const range = this.value();
2053
+ if (!range?.start || range.end) {
2054
+ this.value.set({
2055
+ start: this.showTime() ? this.clampTime(atTime(date, 0, 0)) : date,
2056
+ end: null
2057
+ });
2058
+ return;
2059
+ }
2060
+ const [first, last] = compareDays(date, range.start) < 0 ? [date, range.start] : [range.start, date];
2061
+ const next = this.showTime() ? {
2062
+ start: this.clampTime(atTime(first, 0, 0)),
2063
+ end: this.clampTime(atTime(last, 23, 59))
2064
+ } : {
2065
+ start: first,
2066
+ end: last
2067
+ };
2068
+ this.value.set(next);
2069
+ this.rangeSelect.emit(next);
2070
+ if (!this.showTime()) this.closePanel();
2071
+ }
2072
+ static ɵfac = i0.ɵɵngDeclareFactory({
2073
+ minVersion: "12.0.0",
2074
+ version: "22.2.6",
2075
+ ngImport: i0,
2076
+ type: StarDateRangePicker,
2077
+ deps: null,
2078
+ target: i0.ɵɵFactoryTarget.Component
2079
+ });
2080
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2081
+ minVersion: "17.0.0",
2082
+ version: "22.2.6",
2083
+ type: StarDateRangePicker,
2084
+ isStandalone: true,
2085
+ selector: "star-date-range-picker",
2086
+ inputs: {
2087
+ value: {
2088
+ classPropertyName: "value",
2089
+ publicName: "value",
2090
+ isSignal: true,
2091
+ isRequired: false,
2092
+ transformFunction: null
2093
+ },
2094
+ showTime: {
2095
+ classPropertyName: "showTime",
2096
+ publicName: "showTime",
2097
+ isSignal: true,
2098
+ isRequired: false,
2099
+ transformFunction: null
2100
+ },
2101
+ stepMinute: {
2102
+ classPropertyName: "stepMinute",
2103
+ publicName: "stepMinute",
2104
+ isSignal: true,
2105
+ isRequired: false,
2106
+ transformFunction: null
2107
+ }
2108
+ },
2109
+ outputs: {
2110
+ value: "valueChange",
2111
+ rangeSelect: "rangeSelect"
2112
+ },
2113
+ host: {
2114
+ properties: {
2115
+ "class.star-date--open": "open()",
2116
+ "class.star-date--disabled": "disabled()",
2117
+ "class.star-date--invalid": "showInvalid()",
2118
+ "class.star-date--sm": "size() === 'sm'"
2119
+ },
2120
+ classAttribute: "star-date star-date--range"
2121
+ },
2122
+ usesInheritance: true,
2123
+ ngImport: i0,
2124
+ template: "\n <div #control class=\"star-date__control\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #input\n type=\"text\"\n class=\"star-date__input\"\n autocomplete=\"off\"\n inputmode=\"numeric\"\n aria-haspopup=\"dialog\"\n [id]=\"inputId()\"\n [attr.name]=\"name() || null\"\n [value]=\"typed()\"\n [attr.placeholder]=\"hint()\"\n [disabled]=\"disabled()\"\n [readOnly]=\"readonly() || readonlyInput()\"\n [required]=\"required()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-controls]=\"open() ? panelId : null\"\n [attr.aria-invalid]=\"showInvalid() || null\"\n (input)=\"typed.set(input.value)\"\n (click)=\"readonlyInput() && togglePanel()\"\n (keydown)=\"onInputKeydown($event)\"\n (blur)=\"onInputBlur()\"\n />\n @if (showClear() && hasValue() && interactive()) {\n <button type=\"button\" class=\"star-select__icon-btn\" [attr.aria-label]=\"text.clear\" (click)=\"clear()\">\n <i class=\"ph-bold ph-x\" aria-hidden=\"true\"></i>\n </button>\n }\n <button\n type=\"button\"\n class=\"star-date__toggle\"\n [disabled]=\"!interactive()\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"text.chooseDate\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? panelId : null\"\n (click)=\"togglePanel()\"\n >\n <i class=\"ph-bold ph-calendar-blank\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayUsePopover=\"inline\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (attach)=\"onAttached()\"\n (detach)=\"closePanel(false)\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n >\n <div\n class=\"star-panel star-date__panel\"\n role=\"dialog\"\n [id]=\"panelId\"\n [attr.aria-label]=\"text.chooseDate\"\n (keydown)=\"onPanelKeydown($event)\"\n >\n <star-calendar\n [mode]=\"mode\"\n [selected]=\"calendarSelected()\"\n [range]=\"calendarRange()\"\n [selectedDates]=\"calendarDates()\"\n [granularity]=\"granularity()\"\n [numberOfMonths]=\"numberOfMonths()\"\n [showWeek]=\"showWeek()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [disabledDays]=\"disabledDays()\"\n [dateDisabled]=\"dateDisabled()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n (dateSelect)=\"onDateSelect($event)\"\n />\n @if (timeEnabled()) {\n <div class=\"star-date__time\">\n @for (field of timeFields(); track field.label) {\n <label class=\"star-date__time-label\">\n {{ field.label }}\n <input\n type=\"time\"\n class=\"star-input star-input--sm\"\n [value]=\"field.value\"\n [step]=\"timeStep()\"\n [disabled]=\"!field.value\"\n (change)=\"field.set($any($event.target).value)\"\n />\n </label>\n }\n <button type=\"button\" class=\"star-btn star-btn--primary star-btn--sm\" (click)=\"closePanel()\">{{ text.done }}</button>\n </div>\n }\n @if (showButtonBar()) {\n <div class=\"star-date__bar\">\n <button type=\"button\" class=\"star-btn star-btn--ghost star-btn--sm\" (click)=\"today()\">{{ text.today }}</button>\n <button type=\"button\" class=\"star-btn star-btn--ghost star-btn--sm\" (click)=\"clear()\">{{ text.clear }}</button>\n </div>\n }\n </div>\n </ng-template>\n",
2125
+ isInline: true,
2126
+ dependencies: [
2127
+ {
2128
+ kind: "directive",
2129
+ type: CdkConnectedOverlay,
2130
+ selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
2131
+ inputs: [
2132
+ "cdkConnectedOverlayOrigin",
2133
+ "cdkConnectedOverlayPositions",
2134
+ "cdkConnectedOverlayPositionStrategy",
2135
+ "cdkConnectedOverlayOffsetX",
2136
+ "cdkConnectedOverlayOffsetY",
2137
+ "cdkConnectedOverlayWidth",
2138
+ "cdkConnectedOverlayHeight",
2139
+ "cdkConnectedOverlayMinWidth",
2140
+ "cdkConnectedOverlayMinHeight",
2141
+ "cdkConnectedOverlayBackdropClass",
2142
+ "cdkConnectedOverlayPanelClass",
2143
+ "cdkConnectedOverlayViewportMargin",
2144
+ "cdkConnectedOverlayScrollStrategy",
2145
+ "cdkConnectedOverlayOpen",
2146
+ "cdkConnectedOverlayDisableClose",
2147
+ "cdkConnectedOverlayTransformOriginOn",
2148
+ "cdkConnectedOverlayHasBackdrop",
2149
+ "cdkConnectedOverlayLockPosition",
2150
+ "cdkConnectedOverlayFlexibleDimensions",
2151
+ "cdkConnectedOverlayGrowAfterOpen",
2152
+ "cdkConnectedOverlayPush",
2153
+ "cdkConnectedOverlayDisposeOnNavigation",
2154
+ "cdkConnectedOverlayUsePopover",
2155
+ "cdkConnectedOverlayMatchWidth",
2156
+ "cdkConnectedOverlay"
2157
+ ],
2158
+ outputs: [
2159
+ "backdropClick",
2160
+ "positionChange",
2161
+ "attach",
2162
+ "detach",
2163
+ "overlayKeydown",
2164
+ "overlayOutsideClick"
2165
+ ],
2166
+ exportAs: ["cdkConnectedOverlay"]
2167
+ },
2168
+ {
2169
+ kind: "directive",
2170
+ type: CdkOverlayOrigin,
2171
+ selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
2172
+ exportAs: ["cdkOverlayOrigin"]
2173
+ },
2174
+ {
2175
+ kind: "component",
2176
+ type: StarCalendar,
2177
+ selector: "star-calendar",
2178
+ inputs: [
2179
+ "mode",
2180
+ "selected",
2181
+ "selectedDates",
2182
+ "granularity",
2183
+ "numberOfMonths",
2184
+ "showWeek",
2185
+ "range",
2186
+ "minDate",
2187
+ "maxDate",
2188
+ "disabledDates",
2189
+ "disabledDays",
2190
+ "dateDisabled",
2191
+ "firstDayOfWeek",
2192
+ "locale"
2193
+ ],
2194
+ outputs: ["dateSelect"]
2195
+ }
2196
+ ],
2197
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2198
+ });
2199
+ };
2200
+ i0.ɵɵngDeclareClassMetadata({
2201
+ minVersion: "12.0.0",
2202
+ version: "22.2.6",
2203
+ ngImport: i0,
2204
+ type: StarDateRangePicker,
2205
+ decorators: [{
2206
+ type: Component,
2207
+ args: [{
2208
+ selector: "star-date-range-picker",
2209
+ imports: [
2210
+ CdkConnectedOverlay,
2211
+ CdkOverlayOrigin,
2212
+ StarCalendar
2213
+ ],
2214
+ changeDetection: ChangeDetectionStrategy.OnPush,
2215
+ host: {
2216
+ ...HOST,
2217
+ class: "star-date star-date--range"
2218
+ },
2219
+ template: TEMPLATE
2220
+ }]
2221
+ }],
2222
+ propDecorators: {
2223
+ value: [{
2224
+ type: i0.Input,
2225
+ args: [{
2226
+ isSignal: true,
2227
+ alias: "value",
2228
+ required: false
2229
+ }]
2230
+ }, {
2231
+ type: i0.Output,
2232
+ args: ["valueChange"]
2233
+ }],
2234
+ showTime: [{
2235
+ type: i0.Input,
2236
+ args: [{
2237
+ isSignal: true,
2238
+ alias: "showTime",
2239
+ required: false
2240
+ }]
2241
+ }],
2242
+ stepMinute: [{
2243
+ type: i0.Input,
2244
+ args: [{
2245
+ isSignal: true,
2246
+ alias: "stepMinute",
2247
+ required: false
2248
+ }]
2249
+ }],
2250
+ rangeSelect: [{
2251
+ type: i0.Output,
2252
+ args: ["rangeSelect"]
2253
+ }]
2254
+ }
2255
+ });
2256
+ var StarMultiDatePicker = class StarMultiDatePicker extends StarDateInputBase {
2257
+ value = model([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
2258
+ maxDates = input(0, ...ngDevMode ? [{ debugName: "maxDates" }] : /* istanbul ignore next */ []);
2259
+ mode = "multiple";
2260
+ hasValue = computed(() => this.value().length > 0, ...ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []);
2261
+ calendarSelected = signal(null, ...ngDevMode ? [{ debugName: "calendarSelected" }] : /* istanbul ignore next */ []);
2262
+ calendarRange = signal(null, ...ngDevMode ? [{ debugName: "calendarRange" }] : /* istanbul ignore next */ []);
2263
+ calendarDates = this.value;
2264
+ displayText = () => this.value().map((date) => this.format(date)).join(", ");
2265
+ parseText(text) {
2266
+ const dates = [];
2267
+ for (const part of text.split(/\s*[,;]\s*/).filter((item) => item.trim())) {
2268
+ const date = this.parseOne(part);
2269
+ if (!date) return void 0;
2270
+ if (!dates.some((day) => sameDay(day, date))) dates.push(date);
2271
+ }
2272
+ if (this.maxDates() > 0 && dates.length > this.maxDates()) return void 0;
2273
+ return dates.sort((a, b) => a.getTime() - b.getTime());
2274
+ }
2275
+ emptyValue() {
2276
+ return [];
2277
+ }
2278
+ pickToday(today) {
2279
+ if (this.allowed(today) && !this.value().some((day) => sameDay(day, today))) this.onDateSelect(today);
2280
+ }
2281
+ onDateSelect(date) {
2282
+ const days = this.value();
2283
+ if (days.some((day) => sameDay(day, date))) this.value.set(days.filter((day) => !sameDay(day, date)));
2284
+ else if (this.maxDates() <= 0 || days.length < this.maxDates()) this.value.set([...days, date].sort((a, b) => a.getTime() - b.getTime()));
2285
+ }
2286
+ static ɵfac = i0.ɵɵngDeclareFactory({
2287
+ minVersion: "12.0.0",
2288
+ version: "22.2.6",
2289
+ ngImport: i0,
2290
+ type: StarMultiDatePicker,
2291
+ deps: null,
2292
+ target: i0.ɵɵFactoryTarget.Component
2293
+ });
2294
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2295
+ minVersion: "17.0.0",
2296
+ version: "22.2.6",
2297
+ type: StarMultiDatePicker,
2298
+ isStandalone: true,
2299
+ selector: "star-multi-date-picker",
2300
+ inputs: {
2301
+ value: {
2302
+ classPropertyName: "value",
2303
+ publicName: "value",
2304
+ isSignal: true,
2305
+ isRequired: false,
2306
+ transformFunction: null
2307
+ },
2308
+ maxDates: {
2309
+ classPropertyName: "maxDates",
2310
+ publicName: "maxDates",
2311
+ isSignal: true,
2312
+ isRequired: false,
2313
+ transformFunction: null
2314
+ }
2315
+ },
2316
+ outputs: { value: "valueChange" },
2317
+ host: {
2318
+ properties: {
2319
+ "class.star-date--open": "open()",
2320
+ "class.star-date--disabled": "disabled()",
2321
+ "class.star-date--invalid": "showInvalid()",
2322
+ "class.star-date--sm": "size() === 'sm'"
2323
+ },
2324
+ classAttribute: "star-date star-date--multiple"
2325
+ },
2326
+ usesInheritance: true,
2327
+ ngImport: i0,
2328
+ template: "\n <div #control class=\"star-date__control\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #input\n type=\"text\"\n class=\"star-date__input\"\n autocomplete=\"off\"\n inputmode=\"numeric\"\n aria-haspopup=\"dialog\"\n [id]=\"inputId()\"\n [attr.name]=\"name() || null\"\n [value]=\"typed()\"\n [attr.placeholder]=\"hint()\"\n [disabled]=\"disabled()\"\n [readOnly]=\"readonly() || readonlyInput()\"\n [required]=\"required()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-controls]=\"open() ? panelId : null\"\n [attr.aria-invalid]=\"showInvalid() || null\"\n (input)=\"typed.set(input.value)\"\n (click)=\"readonlyInput() && togglePanel()\"\n (keydown)=\"onInputKeydown($event)\"\n (blur)=\"onInputBlur()\"\n />\n @if (showClear() && hasValue() && interactive()) {\n <button type=\"button\" class=\"star-select__icon-btn\" [attr.aria-label]=\"text.clear\" (click)=\"clear()\">\n <i class=\"ph-bold ph-x\" aria-hidden=\"true\"></i>\n </button>\n }\n <button\n type=\"button\"\n class=\"star-date__toggle\"\n [disabled]=\"!interactive()\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"text.chooseDate\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? panelId : null\"\n (click)=\"togglePanel()\"\n >\n <i class=\"ph-bold ph-calendar-blank\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayUsePopover=\"inline\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (attach)=\"onAttached()\"\n (detach)=\"closePanel(false)\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n >\n <div\n class=\"star-panel star-date__panel\"\n role=\"dialog\"\n [id]=\"panelId\"\n [attr.aria-label]=\"text.chooseDate\"\n (keydown)=\"onPanelKeydown($event)\"\n >\n <star-calendar\n [mode]=\"mode\"\n [selected]=\"calendarSelected()\"\n [range]=\"calendarRange()\"\n [selectedDates]=\"calendarDates()\"\n [granularity]=\"granularity()\"\n [numberOfMonths]=\"numberOfMonths()\"\n [showWeek]=\"showWeek()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [disabledDays]=\"disabledDays()\"\n [dateDisabled]=\"dateDisabled()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n (dateSelect)=\"onDateSelect($event)\"\n />\n @if (timeEnabled()) {\n <div class=\"star-date__time\">\n @for (field of timeFields(); track field.label) {\n <label class=\"star-date__time-label\">\n {{ field.label }}\n <input\n type=\"time\"\n class=\"star-input star-input--sm\"\n [value]=\"field.value\"\n [step]=\"timeStep()\"\n [disabled]=\"!field.value\"\n (change)=\"field.set($any($event.target).value)\"\n />\n </label>\n }\n <button type=\"button\" class=\"star-btn star-btn--primary star-btn--sm\" (click)=\"closePanel()\">{{ text.done }}</button>\n </div>\n }\n @if (showButtonBar()) {\n <div class=\"star-date__bar\">\n <button type=\"button\" class=\"star-btn star-btn--ghost star-btn--sm\" (click)=\"today()\">{{ text.today }}</button>\n <button type=\"button\" class=\"star-btn star-btn--ghost star-btn--sm\" (click)=\"clear()\">{{ text.clear }}</button>\n </div>\n }\n </div>\n </ng-template>\n",
2329
+ isInline: true,
2330
+ dependencies: [
2331
+ {
2332
+ kind: "directive",
2333
+ type: CdkConnectedOverlay,
2334
+ selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
2335
+ inputs: [
2336
+ "cdkConnectedOverlayOrigin",
2337
+ "cdkConnectedOverlayPositions",
2338
+ "cdkConnectedOverlayPositionStrategy",
2339
+ "cdkConnectedOverlayOffsetX",
2340
+ "cdkConnectedOverlayOffsetY",
2341
+ "cdkConnectedOverlayWidth",
2342
+ "cdkConnectedOverlayHeight",
2343
+ "cdkConnectedOverlayMinWidth",
2344
+ "cdkConnectedOverlayMinHeight",
2345
+ "cdkConnectedOverlayBackdropClass",
2346
+ "cdkConnectedOverlayPanelClass",
2347
+ "cdkConnectedOverlayViewportMargin",
2348
+ "cdkConnectedOverlayScrollStrategy",
2349
+ "cdkConnectedOverlayOpen",
2350
+ "cdkConnectedOverlayDisableClose",
2351
+ "cdkConnectedOverlayTransformOriginOn",
2352
+ "cdkConnectedOverlayHasBackdrop",
2353
+ "cdkConnectedOverlayLockPosition",
2354
+ "cdkConnectedOverlayFlexibleDimensions",
2355
+ "cdkConnectedOverlayGrowAfterOpen",
2356
+ "cdkConnectedOverlayPush",
2357
+ "cdkConnectedOverlayDisposeOnNavigation",
2358
+ "cdkConnectedOverlayUsePopover",
2359
+ "cdkConnectedOverlayMatchWidth",
2360
+ "cdkConnectedOverlay"
2361
+ ],
2362
+ outputs: [
2363
+ "backdropClick",
2364
+ "positionChange",
2365
+ "attach",
2366
+ "detach",
2367
+ "overlayKeydown",
2368
+ "overlayOutsideClick"
2369
+ ],
2370
+ exportAs: ["cdkConnectedOverlay"]
2371
+ },
2372
+ {
2373
+ kind: "directive",
2374
+ type: CdkOverlayOrigin,
2375
+ selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
2376
+ exportAs: ["cdkOverlayOrigin"]
2377
+ },
2378
+ {
2379
+ kind: "component",
2380
+ type: StarCalendar,
2381
+ selector: "star-calendar",
2382
+ inputs: [
2383
+ "mode",
2384
+ "selected",
2385
+ "selectedDates",
2386
+ "granularity",
2387
+ "numberOfMonths",
2388
+ "showWeek",
2389
+ "range",
2390
+ "minDate",
2391
+ "maxDate",
2392
+ "disabledDates",
2393
+ "disabledDays",
2394
+ "dateDisabled",
2395
+ "firstDayOfWeek",
2396
+ "locale"
2397
+ ],
2398
+ outputs: ["dateSelect"]
2399
+ }
2400
+ ],
2401
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2402
+ });
2403
+ };
2404
+ i0.ɵɵngDeclareClassMetadata({
2405
+ minVersion: "12.0.0",
2406
+ version: "22.2.6",
2407
+ ngImport: i0,
2408
+ type: StarMultiDatePicker,
2409
+ decorators: [{
2410
+ type: Component,
2411
+ args: [{
2412
+ selector: "star-multi-date-picker",
2413
+ imports: [
2414
+ CdkConnectedOverlay,
2415
+ CdkOverlayOrigin,
2416
+ StarCalendar
2417
+ ],
2418
+ changeDetection: ChangeDetectionStrategy.OnPush,
2419
+ host: {
2420
+ ...HOST,
2421
+ class: "star-date star-date--multiple"
2422
+ },
2423
+ template: TEMPLATE
2424
+ }]
2425
+ }],
2426
+ propDecorators: {
2427
+ value: [{
2428
+ type: i0.Input,
2429
+ args: [{
2430
+ isSignal: true,
2431
+ alias: "value",
2432
+ required: false
2433
+ }]
2434
+ }, {
2435
+ type: i0.Output,
2436
+ args: ["valueChange"]
2437
+ }],
2438
+ maxDates: [{
2439
+ type: i0.Input,
2440
+ args: [{
2441
+ isSignal: true,
2442
+ alias: "maxDates",
2443
+ required: false
2444
+ }]
2445
+ }]
2446
+ }
2447
+ });
2448
+ var StarTimePicker = class StarTimePicker {
2449
+ value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
2450
+ min = input(void 0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
2451
+ max = input(void 0, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
2452
+ stepMinute = input(1, ...ngDevMode ? [{ debugName: "stepMinute" }] : /* istanbul ignore next */ []);
2453
+ size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
2454
+ ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
2455
+ inputId = input(inject(_IdGenerator).getId("star-time-"), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
2456
+ name = input("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
2457
+ disabled = input(false, {
2458
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
2459
+ transform: booleanAttribute
2460
+ });
2461
+ readonly = input(false, {
2462
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
2463
+ transform: booleanAttribute
2464
+ });
2465
+ required = input(false, {
2466
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
2467
+ transform: booleanAttribute
2468
+ });
2469
+ invalid = input(false, {
2470
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
2471
+ transform: booleanAttribute
2472
+ });
2473
+ touched = input(false, {
2474
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
2475
+ transform: booleanAttribute
2476
+ });
2477
+ touch = output();
2478
+ step = computed(() => Math.max(1, this.stepMinute()) * 60, ...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
2479
+ input = viewChild.required("input", ...ngDevMode ? [{ debugName: "input" }] : /* istanbul ignore next */ []);
2480
+ onChange(text) {
2481
+ const match = /^(\d{2}):(\d{2})/.exec(text);
2482
+ this.value.set(match ? `${match[1]}:${match[2]}` : null);
2483
+ }
2484
+ focus(options) {
2485
+ this.input().nativeElement.focus(options);
2486
+ }
2487
+ static ɵfac = i0.ɵɵngDeclareFactory({
2488
+ minVersion: "12.0.0",
2489
+ version: "22.2.6",
2490
+ ngImport: i0,
2491
+ type: StarTimePicker,
2492
+ deps: [],
2493
+ target: i0.ɵɵFactoryTarget.Component
2494
+ });
2495
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2496
+ minVersion: "17.2.0",
2497
+ version: "22.2.6",
2498
+ type: StarTimePicker,
2499
+ isStandalone: true,
2500
+ selector: "star-time-picker",
2501
+ inputs: {
2502
+ value: {
2503
+ classPropertyName: "value",
2504
+ publicName: "value",
2505
+ isSignal: true,
2506
+ isRequired: false,
2507
+ transformFunction: null
2508
+ },
2509
+ min: {
2510
+ classPropertyName: "min",
2511
+ publicName: "min",
2512
+ isSignal: true,
2513
+ isRequired: false,
2514
+ transformFunction: null
2515
+ },
2516
+ max: {
2517
+ classPropertyName: "max",
2518
+ publicName: "max",
2519
+ isSignal: true,
2520
+ isRequired: false,
2521
+ transformFunction: null
2522
+ },
2523
+ stepMinute: {
2524
+ classPropertyName: "stepMinute",
2525
+ publicName: "stepMinute",
2526
+ isSignal: true,
2527
+ isRequired: false,
2528
+ transformFunction: null
2529
+ },
2530
+ size: {
2531
+ classPropertyName: "size",
2532
+ publicName: "size",
2533
+ isSignal: true,
2534
+ isRequired: false,
2535
+ transformFunction: null
2536
+ },
2537
+ ariaLabel: {
2538
+ classPropertyName: "ariaLabel",
2539
+ publicName: "ariaLabel",
2540
+ isSignal: true,
2541
+ isRequired: false,
2542
+ transformFunction: null
2543
+ },
2544
+ inputId: {
2545
+ classPropertyName: "inputId",
2546
+ publicName: "inputId",
2547
+ isSignal: true,
2548
+ isRequired: false,
2549
+ transformFunction: null
2550
+ },
2551
+ name: {
2552
+ classPropertyName: "name",
2553
+ publicName: "name",
2554
+ isSignal: true,
2555
+ isRequired: false,
2556
+ transformFunction: null
2557
+ },
2558
+ disabled: {
2559
+ classPropertyName: "disabled",
2560
+ publicName: "disabled",
2561
+ isSignal: true,
2562
+ isRequired: false,
2563
+ transformFunction: null
2564
+ },
2565
+ readonly: {
2566
+ classPropertyName: "readonly",
2567
+ publicName: "readonly",
2568
+ isSignal: true,
2569
+ isRequired: false,
2570
+ transformFunction: null
2571
+ },
2572
+ required: {
2573
+ classPropertyName: "required",
2574
+ publicName: "required",
2575
+ isSignal: true,
2576
+ isRequired: false,
2577
+ transformFunction: null
2578
+ },
2579
+ invalid: {
2580
+ classPropertyName: "invalid",
2581
+ publicName: "invalid",
2582
+ isSignal: true,
2583
+ isRequired: false,
2584
+ transformFunction: null
2585
+ },
2586
+ touched: {
2587
+ classPropertyName: "touched",
2588
+ publicName: "touched",
2589
+ isSignal: true,
2590
+ isRequired: false,
2591
+ transformFunction: null
2592
+ }
2593
+ },
2594
+ outputs: {
2595
+ value: "valueChange",
2596
+ touch: "touch"
2597
+ },
2598
+ host: { classAttribute: "star-time" },
2599
+ viewQueries: [{
2600
+ propertyName: "input",
2601
+ first: true,
2602
+ predicate: ["input"],
2603
+ descendants: true,
2604
+ isSignal: true
2605
+ }],
2606
+ ngImport: i0,
2607
+ template: `
2608
+ <input
2609
+ #input
2610
+ type="time"
2611
+ class="star-input"
2612
+ [class.star-input--sm]="size() === 'sm'"
2613
+ [id]="inputId()"
2614
+ [attr.name]="name() || null"
2615
+ [value]="value() ?? ''"
2616
+ [attr.min]="min() ?? null"
2617
+ [attr.max]="max() ?? null"
2618
+ [step]="step()"
2619
+ [disabled]="disabled()"
2620
+ [readOnly]="readonly()"
2621
+ [required]="required()"
2622
+ [attr.aria-label]="ariaLabel()"
2623
+ [attr.aria-invalid]="(invalid() && touched()) || null"
2624
+ (change)="onChange(input.value)"
2625
+ (blur)="touch.emit()"
2626
+ />
2627
+ `,
2628
+ isInline: true,
2629
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2630
+ });
2631
+ };
2632
+ i0.ɵɵngDeclareClassMetadata({
2633
+ minVersion: "12.0.0",
2634
+ version: "22.2.6",
2635
+ ngImport: i0,
2636
+ type: StarTimePicker,
2637
+ decorators: [{
2638
+ type: Component,
2639
+ args: [{
2640
+ selector: "star-time-picker",
2641
+ changeDetection: ChangeDetectionStrategy.OnPush,
2642
+ host: { class: "star-time" },
2643
+ template: `
2644
+ <input
2645
+ #input
2646
+ type="time"
2647
+ class="star-input"
2648
+ [class.star-input--sm]="size() === 'sm'"
2649
+ [id]="inputId()"
2650
+ [attr.name]="name() || null"
2651
+ [value]="value() ?? ''"
2652
+ [attr.min]="min() ?? null"
2653
+ [attr.max]="max() ?? null"
2654
+ [step]="step()"
2655
+ [disabled]="disabled()"
2656
+ [readOnly]="readonly()"
2657
+ [required]="required()"
2658
+ [attr.aria-label]="ariaLabel()"
2659
+ [attr.aria-invalid]="(invalid() && touched()) || null"
2660
+ (change)="onChange(input.value)"
2661
+ (blur)="touch.emit()"
2662
+ />
2663
+ `
2664
+ }]
2665
+ }],
2666
+ propDecorators: {
2667
+ value: [{
2668
+ type: i0.Input,
2669
+ args: [{
2670
+ isSignal: true,
2671
+ alias: "value",
2672
+ required: false
2673
+ }]
2674
+ }, {
2675
+ type: i0.Output,
2676
+ args: ["valueChange"]
2677
+ }],
2678
+ min: [{
2679
+ type: i0.Input,
2680
+ args: [{
2681
+ isSignal: true,
2682
+ alias: "min",
2683
+ required: false
2684
+ }]
2685
+ }],
2686
+ max: [{
2687
+ type: i0.Input,
2688
+ args: [{
2689
+ isSignal: true,
2690
+ alias: "max",
2691
+ required: false
2692
+ }]
2693
+ }],
2694
+ stepMinute: [{
2695
+ type: i0.Input,
2696
+ args: [{
2697
+ isSignal: true,
2698
+ alias: "stepMinute",
2699
+ required: false
2700
+ }]
2701
+ }],
2702
+ size: [{
2703
+ type: i0.Input,
2704
+ args: [{
2705
+ isSignal: true,
2706
+ alias: "size",
2707
+ required: false
2708
+ }]
2709
+ }],
2710
+ ariaLabel: [{
2711
+ type: i0.Input,
2712
+ args: [{
2713
+ isSignal: true,
2714
+ alias: "ariaLabel",
2715
+ required: false
2716
+ }]
2717
+ }],
2718
+ inputId: [{
2719
+ type: i0.Input,
2720
+ args: [{
2721
+ isSignal: true,
2722
+ alias: "inputId",
2723
+ required: false
2724
+ }]
2725
+ }],
2726
+ name: [{
2727
+ type: i0.Input,
2728
+ args: [{
2729
+ isSignal: true,
2730
+ alias: "name",
2731
+ required: false
2732
+ }]
2733
+ }],
2734
+ disabled: [{
2735
+ type: i0.Input,
2736
+ args: [{
2737
+ isSignal: true,
2738
+ alias: "disabled",
2739
+ required: false
2740
+ }]
2741
+ }],
2742
+ readonly: [{
2743
+ type: i0.Input,
2744
+ args: [{
2745
+ isSignal: true,
2746
+ alias: "readonly",
2747
+ required: false
2748
+ }]
2749
+ }],
2750
+ required: [{
2751
+ type: i0.Input,
2752
+ args: [{
2753
+ isSignal: true,
2754
+ alias: "required",
2755
+ required: false
2756
+ }]
2757
+ }],
2758
+ invalid: [{
2759
+ type: i0.Input,
2760
+ args: [{
2761
+ isSignal: true,
2762
+ alias: "invalid",
2763
+ required: false
2764
+ }]
2765
+ }],
2766
+ touched: [{
2767
+ type: i0.Input,
2768
+ args: [{
2769
+ isSignal: true,
2770
+ alias: "touched",
2771
+ required: false
2772
+ }]
2773
+ }],
2774
+ touch: [{
2775
+ type: i0.Output,
2776
+ args: ["touch"]
2777
+ }],
2778
+ input: [{
2779
+ type: i0.ViewChild,
2780
+ args: ["input", { isSignal: true }]
2781
+ }]
2782
+ }
2783
+ });
2784
+ export { DEFAULT_DATE_FORMAT, StarCalendar, StarDateInputBase, StarDatePicker, StarDateRangePicker, StarMultiDatePicker, StarTimePicker, addDays, addMonths, compareDays, formatDate, formatHint, isoDay, isoWeek, localeFirstDay, monthGrid, parseDate, sameDay, sameMonth, startOfDay };
2785
+
2786
+ //# sourceMappingURL=star-ng-ui-date-picker.mjs.map