@vadem/ui 0.0.0-stage → 0.0.1

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 (289) hide show
  1. package/LICENSE-lucide.txt +43 -0
  2. package/README.md +19 -2
  3. package/fesm2022/vadem-ui-accordion.mjs +139 -0
  4. package/fesm2022/vadem-ui-accordion.mjs.map +1 -0
  5. package/fesm2022/vadem-ui-active-filters.mjs +355 -0
  6. package/fesm2022/vadem-ui-active-filters.mjs.map +1 -0
  7. package/fesm2022/vadem-ui-alert-dialog.mjs +433 -0
  8. package/fesm2022/vadem-ui-alert-dialog.mjs.map +1 -0
  9. package/fesm2022/vadem-ui-alert.mjs +266 -0
  10. package/fesm2022/vadem-ui-alert.mjs.map +1 -0
  11. package/fesm2022/vadem-ui-autocomplete.mjs +715 -0
  12. package/fesm2022/vadem-ui-autocomplete.mjs.map +1 -0
  13. package/fesm2022/vadem-ui-avatar.mjs +219 -0
  14. package/fesm2022/vadem-ui-avatar.mjs.map +1 -0
  15. package/fesm2022/vadem-ui-badge.mjs +86 -0
  16. package/fesm2022/vadem-ui-badge.mjs.map +1 -0
  17. package/fesm2022/vadem-ui-breadcrumbs.mjs +61 -0
  18. package/fesm2022/vadem-ui-breadcrumbs.mjs.map +1 -0
  19. package/fesm2022/vadem-ui-button.mjs +220 -0
  20. package/fesm2022/vadem-ui-button.mjs.map +1 -0
  21. package/fesm2022/vadem-ui-calendar.mjs +1314 -0
  22. package/fesm2022/vadem-ui-calendar.mjs.map +1 -0
  23. package/fesm2022/vadem-ui-card.mjs +271 -0
  24. package/fesm2022/vadem-ui-card.mjs.map +1 -0
  25. package/fesm2022/vadem-ui-character-count.mjs +269 -0
  26. package/fesm2022/vadem-ui-character-count.mjs.map +1 -0
  27. package/fesm2022/vadem-ui-chart.mjs +1984 -0
  28. package/fesm2022/vadem-ui-chart.mjs.map +1 -0
  29. package/fesm2022/vadem-ui-checkbox.mjs +67 -0
  30. package/fesm2022/vadem-ui-checkbox.mjs.map +1 -0
  31. package/fesm2022/vadem-ui-color-picker.mjs +815 -0
  32. package/fesm2022/vadem-ui-color-picker.mjs.map +1 -0
  33. package/fesm2022/vadem-ui-command.mjs +735 -0
  34. package/fesm2022/vadem-ui-command.mjs.map +1 -0
  35. package/fesm2022/vadem-ui-copy-button.mjs +375 -0
  36. package/fesm2022/vadem-ui-copy-button.mjs.map +1 -0
  37. package/fesm2022/vadem-ui-date-range-picker.mjs +1011 -0
  38. package/fesm2022/vadem-ui-date-range-picker.mjs.map +1 -0
  39. package/fesm2022/vadem-ui-description-list.mjs +59 -0
  40. package/fesm2022/vadem-ui-description-list.mjs.map +1 -0
  41. package/fesm2022/vadem-ui-dialog.mjs +587 -0
  42. package/fesm2022/vadem-ui-dialog.mjs.map +1 -0
  43. package/fesm2022/vadem-ui-dropzone.mjs +176 -0
  44. package/fesm2022/vadem-ui-dropzone.mjs.map +1 -0
  45. package/fesm2022/vadem-ui-editable-text.mjs +641 -0
  46. package/fesm2022/vadem-ui-editable-text.mjs.map +1 -0
  47. package/fesm2022/vadem-ui-empty-state.mjs +175 -0
  48. package/fesm2022/vadem-ui-empty-state.mjs.map +1 -0
  49. package/fesm2022/vadem-ui-expandable-text.mjs +244 -0
  50. package/fesm2022/vadem-ui-expandable-text.mjs.map +1 -0
  51. package/fesm2022/vadem-ui-field.mjs +583 -0
  52. package/fesm2022/vadem-ui-field.mjs.map +1 -0
  53. package/fesm2022/vadem-ui-file-preview.mjs +532 -0
  54. package/fesm2022/vadem-ui-file-preview.mjs.map +1 -0
  55. package/fesm2022/vadem-ui-file-size.mjs +83 -0
  56. package/fesm2022/vadem-ui-file-size.mjs.map +1 -0
  57. package/fesm2022/vadem-ui-form-error-summary.mjs +201 -0
  58. package/fesm2022/vadem-ui-form-error-summary.mjs.map +1 -0
  59. package/fesm2022/vadem-ui-icon.mjs +303 -0
  60. package/fesm2022/vadem-ui-icon.mjs.map +1 -0
  61. package/fesm2022/vadem-ui-input.mjs +120 -0
  62. package/fesm2022/vadem-ui-input.mjs.map +1 -0
  63. package/fesm2022/vadem-ui-kbd.mjs +286 -0
  64. package/fesm2022/vadem-ui-kbd.mjs.map +1 -0
  65. package/fesm2022/vadem-ui-keyboard.mjs +105 -0
  66. package/fesm2022/vadem-ui-keyboard.mjs.map +1 -0
  67. package/fesm2022/vadem-ui-locale.mjs +443 -0
  68. package/fesm2022/vadem-ui-locale.mjs.map +1 -0
  69. package/fesm2022/vadem-ui-menu.mjs +637 -0
  70. package/fesm2022/vadem-ui-menu.mjs.map +1 -0
  71. package/fesm2022/vadem-ui-navigation-list.mjs +130 -0
  72. package/fesm2022/vadem-ui-navigation-list.mjs.map +1 -0
  73. package/fesm2022/vadem-ui-number-input.mjs +264 -0
  74. package/fesm2022/vadem-ui-number-input.mjs.map +1 -0
  75. package/fesm2022/vadem-ui-otp-input.mjs +86 -0
  76. package/fesm2022/vadem-ui-otp-input.mjs.map +1 -0
  77. package/fesm2022/vadem-ui-pagination.mjs +353 -0
  78. package/fesm2022/vadem-ui-pagination.mjs.map +1 -0
  79. package/fesm2022/vadem-ui-password-input.mjs +213 -0
  80. package/fesm2022/vadem-ui-password-input.mjs.map +1 -0
  81. package/fesm2022/vadem-ui-popover.mjs +178 -0
  82. package/fesm2022/vadem-ui-popover.mjs.map +1 -0
  83. package/fesm2022/vadem-ui-progress.mjs +331 -0
  84. package/fesm2022/vadem-ui-progress.mjs.map +1 -0
  85. package/fesm2022/vadem-ui-radio.mjs +39 -0
  86. package/fesm2022/vadem-ui-radio.mjs.map +1 -0
  87. package/fesm2022/vadem-ui-range-slider.mjs +561 -0
  88. package/fesm2022/vadem-ui-range-slider.mjs.map +1 -0
  89. package/fesm2022/vadem-ui-rating.mjs +404 -0
  90. package/fesm2022/vadem-ui-rating.mjs.map +1 -0
  91. package/fesm2022/vadem-ui-relative-time.mjs +217 -0
  92. package/fesm2022/vadem-ui-relative-time.mjs.map +1 -0
  93. package/fesm2022/vadem-ui-reorder-list.mjs +601 -0
  94. package/fesm2022/vadem-ui-reorder-list.mjs.map +1 -0
  95. package/fesm2022/vadem-ui-scroll-area.mjs +65 -0
  96. package/fesm2022/vadem-ui-scroll-area.mjs.map +1 -0
  97. package/fesm2022/vadem-ui-search-input.mjs +307 -0
  98. package/fesm2022/vadem-ui-search-input.mjs.map +1 -0
  99. package/fesm2022/vadem-ui-segmented.mjs +297 -0
  100. package/fesm2022/vadem-ui-segmented.mjs.map +1 -0
  101. package/fesm2022/vadem-ui-select.mjs +1462 -0
  102. package/fesm2022/vadem-ui-select.mjs.map +1 -0
  103. package/fesm2022/vadem-ui-sidebar.mjs +493 -0
  104. package/fesm2022/vadem-ui-sidebar.mjs.map +1 -0
  105. package/fesm2022/vadem-ui-skeleton.mjs +106 -0
  106. package/fesm2022/vadem-ui-skeleton.mjs.map +1 -0
  107. package/fesm2022/vadem-ui-slider.mjs +60 -0
  108. package/fesm2022/vadem-ui-slider.mjs.map +1 -0
  109. package/fesm2022/vadem-ui-splitter.mjs +438 -0
  110. package/fesm2022/vadem-ui-splitter.mjs.map +1 -0
  111. package/fesm2022/vadem-ui-stat.mjs +369 -0
  112. package/fesm2022/vadem-ui-stat.mjs.map +1 -0
  113. package/fesm2022/vadem-ui-stepper.mjs +483 -0
  114. package/fesm2022/vadem-ui-stepper.mjs.map +1 -0
  115. package/fesm2022/vadem-ui-switch.mjs +45 -0
  116. package/fesm2022/vadem-ui-switch.mjs.map +1 -0
  117. package/fesm2022/vadem-ui-table.mjs +593 -0
  118. package/fesm2022/vadem-ui-table.mjs.map +1 -0
  119. package/fesm2022/vadem-ui-tabs.mjs +405 -0
  120. package/fesm2022/vadem-ui-tabs.mjs.map +1 -0
  121. package/fesm2022/vadem-ui-tag-input.mjs +685 -0
  122. package/fesm2022/vadem-ui-tag-input.mjs.map +1 -0
  123. package/fesm2022/vadem-ui-text-highlight.mjs +126 -0
  124. package/fesm2022/vadem-ui-text-highlight.mjs.map +1 -0
  125. package/fesm2022/vadem-ui-time-input.mjs +430 -0
  126. package/fesm2022/vadem-ui-time-input.mjs.map +1 -0
  127. package/fesm2022/vadem-ui-timeline.mjs +313 -0
  128. package/fesm2022/vadem-ui-timeline.mjs.map +1 -0
  129. package/fesm2022/vadem-ui-toast.mjs +397 -0
  130. package/fesm2022/vadem-ui-toast.mjs.map +1 -0
  131. package/fesm2022/vadem-ui-toolbar.mjs +396 -0
  132. package/fesm2022/vadem-ui-toolbar.mjs.map +1 -0
  133. package/fesm2022/vadem-ui-tooltip.mjs +218 -0
  134. package/fesm2022/vadem-ui-tooltip.mjs.map +1 -0
  135. package/fesm2022/vadem-ui-tree.mjs +551 -0
  136. package/fesm2022/vadem-ui-tree.mjs.map +1 -0
  137. package/fesm2022/vadem-ui-upload-list.mjs +408 -0
  138. package/fesm2022/vadem-ui-upload-list.mjs.map +1 -0
  139. package/fesm2022/vadem-ui.mjs +4 -0
  140. package/fesm2022/vadem-ui.mjs.map +1 -0
  141. package/fonts/jetbrains-mono/OFL.txt +93 -0
  142. package/fonts/jetbrains-mono/jetbrains-mono-cyrillic.woff2 +0 -0
  143. package/fonts/jetbrains-mono/jetbrains-mono-latin.woff2 +0 -0
  144. package/fonts/manrope/OFL.txt +93 -0
  145. package/fonts/manrope/manrope-cyrillic.woff2 +0 -0
  146. package/fonts/manrope/manrope-latin.woff2 +0 -0
  147. package/package.json +306 -3
  148. package/styles/base.css +160 -0
  149. package/styles/components/accordion.css +130 -0
  150. package/styles/components/active-filters.css +42 -0
  151. package/styles/components/alert-dialog.css +34 -0
  152. package/styles/components/alert.css +159 -0
  153. package/styles/components/autocomplete.css +97 -0
  154. package/styles/components/avatar.css +90 -0
  155. package/styles/components/badge.css +91 -0
  156. package/styles/components/breadcrumbs.css +94 -0
  157. package/styles/components/button.css +174 -0
  158. package/styles/components/calendar.css +186 -0
  159. package/styles/components/card.css +206 -0
  160. package/styles/components/character-count.css +41 -0
  161. package/styles/components/chart.css +308 -0
  162. package/styles/components/checkbox.css +115 -0
  163. package/styles/components/color-picker.css +158 -0
  164. package/styles/components/command.css +175 -0
  165. package/styles/components/copy-button.css +58 -0
  166. package/styles/components/date-range-picker.css +153 -0
  167. package/styles/components/description-list.css +69 -0
  168. package/styles/components/dialog.css +334 -0
  169. package/styles/components/dropzone.css +89 -0
  170. package/styles/components/editable-text.css +58 -0
  171. package/styles/components/empty-state.css +72 -0
  172. package/styles/components/expandable-text.css +24 -0
  173. package/styles/components/field.css +148 -0
  174. package/styles/components/file-preview.css +65 -0
  175. package/styles/components/form-error-summary.css +71 -0
  176. package/styles/components/icon.css +38 -0
  177. package/styles/components/index.css +80 -0
  178. package/styles/components/input.css +171 -0
  179. package/styles/components/kbd.css +42 -0
  180. package/styles/components/menu.css +168 -0
  181. package/styles/components/multi-select.css +156 -0
  182. package/styles/components/navigation-list.css +147 -0
  183. package/styles/components/number-input.css +33 -0
  184. package/styles/components/otp-input.css +26 -0
  185. package/styles/components/pagination.css +127 -0
  186. package/styles/components/password-input.css +20 -0
  187. package/styles/components/popover.css +93 -0
  188. package/styles/components/progress-ring.css +112 -0
  189. package/styles/components/progress.css +162 -0
  190. package/styles/components/radio.css +117 -0
  191. package/styles/components/range-slider.css +158 -0
  192. package/styles/components/rating.css +100 -0
  193. package/styles/components/reorder-list.css +143 -0
  194. package/styles/components/scroll-area.css +39 -0
  195. package/styles/components/search-input.css +25 -0
  196. package/styles/components/segmented.css +136 -0
  197. package/styles/components/select.css +257 -0
  198. package/styles/components/sidebar.css +105 -0
  199. package/styles/components/skeleton.css +83 -0
  200. package/styles/components/slider.css +132 -0
  201. package/styles/components/splitter.css +83 -0
  202. package/styles/components/stat.css +62 -0
  203. package/styles/components/stepper.css +236 -0
  204. package/styles/components/switch.css +107 -0
  205. package/styles/components/table.css +195 -0
  206. package/styles/components/tabs.css +198 -0
  207. package/styles/components/tag-input.css +138 -0
  208. package/styles/components/text-highlight.css +22 -0
  209. package/styles/components/time-input.css +96 -0
  210. package/styles/components/timeline.css +182 -0
  211. package/styles/components/toast.css +146 -0
  212. package/styles/components/toolbar.css +72 -0
  213. package/styles/components/tooltip.css +93 -0
  214. package/styles/components/tree.css +88 -0
  215. package/styles/components/upload-list.css +113 -0
  216. package/styles/fonts.css +67 -0
  217. package/styles/index.css +14 -0
  218. package/styles/reset.css +57 -0
  219. package/styles/tokens/primitives.css +364 -0
  220. package/styles/tokens/semantic.css +233 -0
  221. package/types/vadem-ui-accordion.d.ts +43 -0
  222. package/types/vadem-ui-active-filters.d.ts +73 -0
  223. package/types/vadem-ui-alert-dialog.d.ts +87 -0
  224. package/types/vadem-ui-alert.d.ts +64 -0
  225. package/types/vadem-ui-autocomplete.d.ts +156 -0
  226. package/types/vadem-ui-avatar.d.ts +59 -0
  227. package/types/vadem-ui-badge.d.ts +25 -0
  228. package/types/vadem-ui-breadcrumbs.d.ts +22 -0
  229. package/types/vadem-ui-button.d.ts +52 -0
  230. package/types/vadem-ui-calendar.d.ts +327 -0
  231. package/types/vadem-ui-card.d.ts +58 -0
  232. package/types/vadem-ui-character-count.d.ts +71 -0
  233. package/types/vadem-ui-chart.d.ts +452 -0
  234. package/types/vadem-ui-checkbox.d.ts +20 -0
  235. package/types/vadem-ui-color-picker.d.ts +171 -0
  236. package/types/vadem-ui-command.d.ts +145 -0
  237. package/types/vadem-ui-copy-button.d.ts +90 -0
  238. package/types/vadem-ui-date-range-picker.d.ts +216 -0
  239. package/types/vadem-ui-description-list.d.ts +15 -0
  240. package/types/vadem-ui-dialog.d.ts +174 -0
  241. package/types/vadem-ui-dropzone.d.ts +73 -0
  242. package/types/vadem-ui-editable-text.d.ts +141 -0
  243. package/types/vadem-ui-empty-state.d.ts +34 -0
  244. package/types/vadem-ui-expandable-text.d.ts +52 -0
  245. package/types/vadem-ui-field.d.ts +180 -0
  246. package/types/vadem-ui-file-preview.d.ts +108 -0
  247. package/types/vadem-ui-file-size.d.ts +18 -0
  248. package/types/vadem-ui-form-error-summary.d.ts +46 -0
  249. package/types/vadem-ui-icon.d.ts +152 -0
  250. package/types/vadem-ui-input.d.ts +31 -0
  251. package/types/vadem-ui-kbd.d.ts +66 -0
  252. package/types/vadem-ui-keyboard.d.ts +61 -0
  253. package/types/vadem-ui-locale.d.ts +241 -0
  254. package/types/vadem-ui-menu.d.ts +132 -0
  255. package/types/vadem-ui-navigation-list.d.ts +28 -0
  256. package/types/vadem-ui-number-input.d.ts +39 -0
  257. package/types/vadem-ui-otp-input.d.ts +15 -0
  258. package/types/vadem-ui-pagination.d.ts +96 -0
  259. package/types/vadem-ui-password-input.d.ts +36 -0
  260. package/types/vadem-ui-popover.d.ts +48 -0
  261. package/types/vadem-ui-progress.d.ts +95 -0
  262. package/types/vadem-ui-radio.d.ts +11 -0
  263. package/types/vadem-ui-range-slider.d.ts +136 -0
  264. package/types/vadem-ui-rating.d.ts +95 -0
  265. package/types/vadem-ui-relative-time.d.ts +58 -0
  266. package/types/vadem-ui-reorder-list.d.ts +120 -0
  267. package/types/vadem-ui-scroll-area.d.ts +13 -0
  268. package/types/vadem-ui-search-input.d.ts +58 -0
  269. package/types/vadem-ui-segmented.d.ts +76 -0
  270. package/types/vadem-ui-select.d.ts +303 -0
  271. package/types/vadem-ui-sidebar.d.ts +70 -0
  272. package/types/vadem-ui-skeleton.d.ts +28 -0
  273. package/types/vadem-ui-slider.d.ts +17 -0
  274. package/types/vadem-ui-splitter.d.ts +99 -0
  275. package/types/vadem-ui-stat.d.ts +101 -0
  276. package/types/vadem-ui-stepper.d.ts +108 -0
  277. package/types/vadem-ui-switch.d.ts +10 -0
  278. package/types/vadem-ui-table.d.ts +172 -0
  279. package/types/vadem-ui-tabs.d.ts +101 -0
  280. package/types/vadem-ui-tag-input.d.ts +170 -0
  281. package/types/vadem-ui-text-highlight.d.ts +27 -0
  282. package/types/vadem-ui-time-input.d.ts +47 -0
  283. package/types/vadem-ui-timeline.d.ts +54 -0
  284. package/types/vadem-ui-toast.d.ts +104 -0
  285. package/types/vadem-ui-toolbar.d.ts +80 -0
  286. package/types/vadem-ui-tooltip.d.ts +71 -0
  287. package/types/vadem-ui-tree.d.ts +123 -0
  288. package/types/vadem-ui-upload-list.d.ts +70 -0
  289. package/types/vadem-ui.d.ts +1 -0
@@ -0,0 +1,1314 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, Injector, LOCALE_ID, ViewEncapsulation, afterNextRender, afterRenderEffect, booleanAttribute, computed, forwardRef, inject, input, linkedSignal, model, output, signal, viewChild } from "@angular/core";
3
+ import { vdNgControlState, vdUniqueId } from "@vadem/ui/field";
4
+ import { VdIcon } from "@vadem/ui/icon";
5
+ import { vdTexts } from "@vadem/ui/locale";
6
+ import { NG_VALUE_ACCESSOR, NgControl } from "@angular/forms";
7
+ import { VdButton } from "@vadem/ui/button";
8
+ import { VdInput, VdInputGroup } from "@vadem/ui/input";
9
+ const ISO = /^(\d{4})-(\d{2})-(\d{2})$/;
10
+ function vdParseIso(value) {
11
+ const m = value ? ISO.exec(value) : null;
12
+ if (!m) return null;
13
+ const date = new Date(Date.UTC(+m[1], +m[2] - 1, +m[3]));
14
+ return vdToIso(date) === value ? date : null;
15
+ }
16
+ function vdToIso(date) {
17
+ return date.toISOString().slice(0, 10);
18
+ }
19
+ function vdToday(now = /* @__PURE__ */ new Date()) {
20
+ return vdToIso(new Date(Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())));
21
+ }
22
+ function vdAddDays(iso, days) {
23
+ const d = vdParseIso(iso);
24
+ d.setUTCDate(d.getUTCDate() + days);
25
+ return vdToIso(d);
26
+ }
27
+ function vdAddMonths(iso, months) {
28
+ const d = vdParseIso(iso);
29
+ const day = d.getUTCDate();
30
+ const target = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth() + months, 1));
31
+ const last = new Date(Date.UTC(target.getUTCFullYear(), target.getUTCMonth() + 1, 0)).getUTCDate();
32
+ target.setUTCDate(Math.min(day, last));
33
+ return vdToIso(target);
34
+ }
35
+ function vdWeekday(iso) {
36
+ return vdParseIso(iso).getUTCDay();
37
+ }
38
+ function vdStartOfMonth(iso) {
39
+ return iso.slice(0, 8) + "01";
40
+ }
41
+ function vdClampDate(iso, min, max) {
42
+ if (min && iso < min) return min;
43
+ if (max && iso > max) return max;
44
+ return iso;
45
+ }
46
+ function vdMonthGrid(month, firstDay) {
47
+ const first = vdStartOfMonth(month);
48
+ let cursor = vdAddDays(first, -((vdWeekday(first) - firstDay + 7) % 7));
49
+ const weeks = [];
50
+ for (let w = 0; w < 6; w++) {
51
+ const week = [];
52
+ for (let i = 0; i < 7; i++) {
53
+ week.push({
54
+ date: cursor,
55
+ day: +cursor.slice(8),
56
+ inMonth: cursor.slice(0, 7) === first.slice(0, 7)
57
+ });
58
+ cursor = vdAddDays(cursor, 1);
59
+ }
60
+ weeks.push(week);
61
+ }
62
+ return weeks;
63
+ }
64
+ const SUNDAY_FIRST = /* @__PURE__ */ new Set([
65
+ "US",
66
+ "CA",
67
+ "MX",
68
+ "BR",
69
+ "JP",
70
+ "KR",
71
+ "TW",
72
+ "HK",
73
+ "IL",
74
+ "IN",
75
+ "PH",
76
+ "SA",
77
+ "ZA",
78
+ "AU"
79
+ ]);
80
+ const SATURDAY_FIRST = /* @__PURE__ */ new Set([
81
+ "AE",
82
+ "EG",
83
+ "IR",
84
+ "DZ",
85
+ "IQ",
86
+ "JO",
87
+ "KW",
88
+ "LY",
89
+ "OM",
90
+ "QA",
91
+ "SY"
92
+ ]);
93
+ function vdFirstDayOfWeek(locale) {
94
+ try {
95
+ const loc = new Intl.Locale(locale);
96
+ const info = loc.getWeekInfo?.() ?? loc.weekInfo;
97
+ if (info?.firstDay) return info.firstDay % 7;
98
+ const region = loc.maximize().region ?? "";
99
+ if (SUNDAY_FIRST.has(region)) return 0;
100
+ if (SATURDAY_FIRST.has(region)) return 6;
101
+ } catch {}
102
+ return 1;
103
+ }
104
+ function vdWeekdayNames(locale, firstDay, width = "short") {
105
+ const format = new Intl.DateTimeFormat(locale, {
106
+ weekday: width,
107
+ timeZone: "UTC"
108
+ });
109
+ return Array.from({ length: 7 }, (_, i) => format.format(new Date(Date.UTC(2023, 0, 1 + (firstDay + i) % 7))));
110
+ }
111
+ function vdFormatDate(iso, locale, options) {
112
+ const date = vdParseIso(iso);
113
+ return date ? new Intl.DateTimeFormat(locale, {
114
+ ...options,
115
+ timeZone: "UTC"
116
+ }).format(date) : "";
117
+ }
118
+ function vdDateOrder(locale) {
119
+ return new Intl.DateTimeFormat(locale, {
120
+ day: "2-digit",
121
+ month: "2-digit",
122
+ year: "numeric",
123
+ timeZone: "UTC"
124
+ }).formatToParts(new Date(Date.UTC(2006, 10, 22))).map((p) => p.type).filter((t) => t === "day" || t === "month" || t === "year");
125
+ }
126
+ function vdParseDate(text, locale) {
127
+ const trimmed = text.trim();
128
+ if (!trimmed) return null;
129
+ if (vdParseIso(trimmed)) return trimmed;
130
+ const nums = trimmed.match(/\d+/g);
131
+ if (!nums || nums.length !== 3) return null;
132
+ const order = vdDateOrder(locale);
133
+ const parts = {};
134
+ order.forEach((type, i) => parts[type] = +nums[i]);
135
+ let year = parts["year"];
136
+ if (nums[order.indexOf("year")].length <= 2) year += 2e3;
137
+ const iso = `${String(year).padStart(4, "0")}-${String(parts["month"]).padStart(2, "0")}-${String(parts["day"]).padStart(2, "0")}`;
138
+ return vdParseIso(iso) ? iso : null;
139
+ }
140
+ function vdFormatShort(iso, locale) {
141
+ return vdFormatDate(iso, locale, {
142
+ day: "2-digit",
143
+ month: "2-digit",
144
+ year: "numeric"
145
+ });
146
+ }
147
+ function vdCalendarKey(key, current, options) {
148
+ const back = options.rtl ? "ArrowRight" : "ArrowLeft";
149
+ const forward = options.rtl ? "ArrowLeft" : "ArrowRight";
150
+ switch (key) {
151
+ case back: return vdAddDays(current, -1);
152
+ case forward: return vdAddDays(current, 1);
153
+ case "ArrowUp": return vdAddDays(current, -7);
154
+ case "ArrowDown": return vdAddDays(current, 7);
155
+ case "Home": return vdAddDays(current, -((vdWeekday(current) - options.firstDay + 7) % 7));
156
+ case "End": return vdAddDays(current, 6 - (vdWeekday(current) - options.firstDay + 7) % 7);
157
+ case "PageUp": return vdAddMonths(current, options.shift ? -12 : -1);
158
+ case "PageDown": return vdAddMonths(current, options.shift ? 12 : 1);
159
+ default: return null;
160
+ }
161
+ }
162
+ var VdCalendar = class VdCalendar {
163
+ value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
164
+ selectionMode = input("single", ...ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []);
165
+ rangeStart = input(null, ...ngDevMode ? [{ debugName: "rangeStart" }] : /* istanbul ignore next */ []);
166
+ rangeEnd = input(null, ...ngDevMode ? [{ debugName: "rangeEnd" }] : /* istanbul ignore next */ []);
167
+ dateSelected = output();
168
+ min = input(null, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
169
+ max = input(null, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
170
+ dateDisabled = input(() => false, ...ngDevMode ? [{ debugName: "dateDisabled" }] : /* istanbul ignore next */ []);
171
+ locale = input(inject(LOCALE_ID), ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
172
+ firstDayOfWeek = input(void 0, ...ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []);
173
+ previousLabel = input(...ngDevMode ? [void 0, { debugName: "previousLabel" }] : /* istanbul ignore next */ []);
174
+ nextLabel = input(...ngDevMode ? [void 0, { debugName: "nextLabel" }] : /* istanbul ignore next */ []);
175
+ t = vdTexts("calendar", {
176
+ previousLabel: this.previousLabel,
177
+ nextLabel: this.nextLabel
178
+ });
179
+ today = vdToday();
180
+ titleId = vdUniqueId("vd-calendar-title");
181
+ el = inject(ElementRef).nativeElement;
182
+ initialDate = computed(() => this.nearestAvailable(vdClampDate(this.value() ?? this.rangeStart() ?? this.today, this.min(), this.max())), ...ngDevMode ? [{ debugName: "initialDate" }] : /* istanbul ignore next */ []);
183
+ focused = linkedSignal(() => this.initialDate(), ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
184
+ displayed = linkedSignal(() => this.initialDate(), ...ngDevMode ? [{ debugName: "displayed" }] : /* istanbul ignore next */ []);
185
+ focusRequested = signal(false, ...ngDevMode ? [{ debugName: "focusRequested" }] : /* istanbul ignore next */ []);
186
+ firstDay = computed(() => this.firstDayOfWeek() ?? vdFirstDayOfWeek(this.locale()), ...ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []);
187
+ grid = computed(() => vdMonthGrid(this.displayed(), this.firstDay()), ...ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []);
188
+ weekdays = computed(() => {
189
+ const short = vdWeekdayNames(this.locale(), this.firstDay(), "short");
190
+ return short.some((name) => name.length > 3) ? vdWeekdayNames(this.locale(), this.firstDay(), "narrow") : short;
191
+ }, ...ngDevMode ? [{ debugName: "weekdays" }] : /* istanbul ignore next */ []);
192
+ numbers = computed(() => new Intl.NumberFormat(this.locale()), ...ngDevMode ? [{ debugName: "numbers" }] : /* istanbul ignore next */ []);
193
+ weekdaysLong = computed(() => vdWeekdayNames(this.locale(), this.firstDay(), "long"), ...ngDevMode ? [{ debugName: "weekdaysLong" }] : /* istanbul ignore next */ []);
194
+ title = computed(() => vdFormatDate(this.displayed(), this.locale(), {
195
+ month: "long",
196
+ year: "numeric"
197
+ }), ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
198
+ canGoBack = computed(() => {
199
+ const min = this.min();
200
+ return !min || this.displayed().slice(0, 7) > min.slice(0, 7);
201
+ }, ...ngDevMode ? [{ debugName: "canGoBack" }] : /* istanbul ignore next */ []);
202
+ canGoForward = computed(() => {
203
+ const max = this.max();
204
+ return !max || this.displayed().slice(0, 7) < max.slice(0, 7);
205
+ }, ...ngDevMode ? [{ debugName: "canGoForward" }] : /* istanbul ignore next */ []);
206
+ constructor() {
207
+ afterRenderEffect(() => {
208
+ const date = this.focused();
209
+ if (!this.focusRequested()) return;
210
+ this.focusRequested.set(false);
211
+ this.el.querySelector(`[data-date="${date}"]`)?.focus();
212
+ });
213
+ }
214
+ focus() {
215
+ this.displayed.set(this.focused());
216
+ this.focusRequested.set(true);
217
+ }
218
+ isSelected(date) {
219
+ if (this.selectionMode() === "single") return date === this.value();
220
+ const start = this.rangeStart();
221
+ return !!start && date >= start && date <= (this.rangeEnd() ?? start);
222
+ }
223
+ isDisabled(date) {
224
+ const min = this.min();
225
+ const max = this.max();
226
+ return !!min && date < min || !!max && date > max || this.dateDisabled()(date);
227
+ }
228
+ nearestAvailable(date) {
229
+ if (!this.isDisabled(date)) return date;
230
+ for (let i = 1; i <= 366; i++) {
231
+ const after = vdAddDays(date, i);
232
+ if (!this.isDisabled(after)) return after;
233
+ const before = vdAddDays(date, -i);
234
+ if (!this.isDisabled(before)) return before;
235
+ }
236
+ return date;
237
+ }
238
+ dayLabel(day) {
239
+ return vdFormatDate(day.date, this.locale(), {
240
+ weekday: "long",
241
+ day: "numeric",
242
+ month: "long",
243
+ year: "numeric"
244
+ });
245
+ }
246
+ onDayFocus(date, event) {
247
+ event.target.scrollIntoView?.({
248
+ block: "nearest",
249
+ inline: "nearest"
250
+ });
251
+ if (date === this.focused()) return;
252
+ this.focused.set(date);
253
+ }
254
+ choose(date) {
255
+ if (this.isDisabled(date)) return;
256
+ this.focused.set(date);
257
+ this.displayed.set(date);
258
+ if (this.selectionMode() === "single") this.value.set(date);
259
+ this.dateSelected.emit(date);
260
+ }
261
+ shiftMonth(months) {
262
+ const date = vdClampDate(vdAddMonths(this.displayed(), months), this.min(), this.max());
263
+ this.focused.set(date);
264
+ this.displayed.set(date);
265
+ }
266
+ onKey(event) {
267
+ if (event.key === "Enter" || event.key === " ") {
268
+ event.preventDefault();
269
+ this.choose(this.focused());
270
+ return;
271
+ }
272
+ const rtl = this.el.ownerDocument.defaultView?.getComputedStyle(this.el).direction === "rtl";
273
+ const next = vdCalendarKey(event.key, this.focused(), {
274
+ firstDay: this.firstDay(),
275
+ rtl,
276
+ shift: event.shiftKey
277
+ });
278
+ if (!next) return;
279
+ event.preventDefault();
280
+ this.focused.set(vdClampDate(next, this.min(), this.max()));
281
+ this.displayed.set(this.focused());
282
+ this.focusRequested.set(true);
283
+ }
284
+ static ɵfac = i0.ɵɵngDeclareFactory({
285
+ minVersion: "12.0.0",
286
+ version: "22.2.1",
287
+ ngImport: i0,
288
+ type: VdCalendar,
289
+ deps: [],
290
+ target: i0.ɵɵFactoryTarget.Component
291
+ });
292
+ static ɵcmp = i0.ɵɵngDeclareComponent({
293
+ minVersion: "17.0.0",
294
+ version: "22.2.1",
295
+ type: VdCalendar,
296
+ isStandalone: true,
297
+ selector: "vd-calendar",
298
+ inputs: {
299
+ value: {
300
+ classPropertyName: "value",
301
+ publicName: "value",
302
+ isSignal: true,
303
+ isRequired: false,
304
+ transformFunction: null
305
+ },
306
+ selectionMode: {
307
+ classPropertyName: "selectionMode",
308
+ publicName: "selectionMode",
309
+ isSignal: true,
310
+ isRequired: false,
311
+ transformFunction: null
312
+ },
313
+ rangeStart: {
314
+ classPropertyName: "rangeStart",
315
+ publicName: "rangeStart",
316
+ isSignal: true,
317
+ isRequired: false,
318
+ transformFunction: null
319
+ },
320
+ rangeEnd: {
321
+ classPropertyName: "rangeEnd",
322
+ publicName: "rangeEnd",
323
+ isSignal: true,
324
+ isRequired: false,
325
+ transformFunction: null
326
+ },
327
+ min: {
328
+ classPropertyName: "min",
329
+ publicName: "min",
330
+ isSignal: true,
331
+ isRequired: false,
332
+ transformFunction: null
333
+ },
334
+ max: {
335
+ classPropertyName: "max",
336
+ publicName: "max",
337
+ isSignal: true,
338
+ isRequired: false,
339
+ transformFunction: null
340
+ },
341
+ dateDisabled: {
342
+ classPropertyName: "dateDisabled",
343
+ publicName: "dateDisabled",
344
+ isSignal: true,
345
+ isRequired: false,
346
+ transformFunction: null
347
+ },
348
+ locale: {
349
+ classPropertyName: "locale",
350
+ publicName: "locale",
351
+ isSignal: true,
352
+ isRequired: false,
353
+ transformFunction: null
354
+ },
355
+ firstDayOfWeek: {
356
+ classPropertyName: "firstDayOfWeek",
357
+ publicName: "firstDayOfWeek",
358
+ isSignal: true,
359
+ isRequired: false,
360
+ transformFunction: null
361
+ },
362
+ previousLabel: {
363
+ classPropertyName: "previousLabel",
364
+ publicName: "previousLabel",
365
+ isSignal: true,
366
+ isRequired: false,
367
+ transformFunction: null
368
+ },
369
+ nextLabel: {
370
+ classPropertyName: "nextLabel",
371
+ publicName: "nextLabel",
372
+ isSignal: true,
373
+ isRequired: false,
374
+ transformFunction: null
375
+ }
376
+ },
377
+ outputs: {
378
+ value: "valueChange",
379
+ dateSelected: "dateSelected"
380
+ },
381
+ host: { classAttribute: "vd-calendar" },
382
+ ngImport: i0,
383
+ template: `
384
+ <div class="vd-calendar__header">
385
+ <button
386
+ type="button"
387
+ class="vd-calendar__nav"
388
+ [attr.aria-label]="t().previousLabel"
389
+ [disabled]="!canGoBack()"
390
+ (click)="shiftMonth(-1)"
391
+ >
392
+ <vd-icon name="chevron-left" />
393
+ </button>
394
+ <span class="vd-calendar__title" [id]="titleId" aria-live="polite">{{ title() }}</span>
395
+ <button
396
+ type="button"
397
+ class="vd-calendar__nav"
398
+ [attr.aria-label]="t().nextLabel"
399
+ [disabled]="!canGoForward()"
400
+ (click)="shiftMonth(1)"
401
+ >
402
+ <vd-icon name="chevron-right" />
403
+ </button>
404
+ </div>
405
+ <!-- Keys bubble from the focused cell (roving tabindex); the table only delegates. -->
406
+ <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->
407
+ <table
408
+ class="vd-calendar__grid"
409
+ role="grid"
410
+ [attr.aria-labelledby]="titleId"
411
+ [attr.aria-multiselectable]="selectionMode() === 'range' ? true : null"
412
+ (keydown)="onKey($event)"
413
+ >
414
+ <thead>
415
+ <tr>
416
+ @for (name of weekdays(); track $index) {
417
+ <th scope="col" [attr.abbr]="weekdaysLong()[$index]">{{ name }}</th>
418
+ }
419
+ </tr>
420
+ </thead>
421
+ <tbody>
422
+ @for (week of grid(); track week[0].date) {
423
+ <tr>
424
+ @for (day of week; track day.date) {
425
+ <td
426
+ role="gridcell"
427
+ class="vd-calendar__day"
428
+ [attr.data-date]="day.date"
429
+ [attr.tabindex]="day.date === focused() ? 0 : -1"
430
+ [attr.aria-selected]="isSelected(day.date)"
431
+ [attr.data-range-start]="
432
+ selectionMode() === 'range' && day.date === rangeStart() ? '' : null
433
+ "
434
+ [attr.data-range-end]="
435
+ selectionMode() === 'range' && day.date === rangeEnd() ? '' : null
436
+ "
437
+ [attr.data-in-range]="
438
+ selectionMode() === 'range' && isSelected(day.date) ? '' : null
439
+ "
440
+ [attr.aria-disabled]="isDisabled(day.date) || null"
441
+ [attr.aria-current]="day.date === today ? 'date' : null"
442
+ [attr.aria-label]="dayLabel(day)"
443
+ [attr.data-outside]="day.inMonth ? null : ''"
444
+ (focus)="onDayFocus(day.date, $event)"
445
+ (click)="choose(day.date)"
446
+ >
447
+ {{ numbers().format(day.day) }}
448
+ </td>
449
+ }
450
+ </tr>
451
+ }
452
+ </tbody>
453
+ </table>
454
+ `,
455
+ isInline: true,
456
+ dependencies: [{
457
+ kind: "component",
458
+ type: VdIcon,
459
+ selector: "vd-icon",
460
+ inputs: ["name", "label"]
461
+ }],
462
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
463
+ encapsulation: i0.ViewEncapsulation.None
464
+ });
465
+ };
466
+ i0.ɵɵngDeclareClassMetadata({
467
+ minVersion: "12.0.0",
468
+ version: "22.2.1",
469
+ ngImport: i0,
470
+ type: VdCalendar,
471
+ decorators: [{
472
+ type: Component,
473
+ args: [{
474
+ selector: "vd-calendar",
475
+ imports: [VdIcon],
476
+ template: `
477
+ <div class="vd-calendar__header">
478
+ <button
479
+ type="button"
480
+ class="vd-calendar__nav"
481
+ [attr.aria-label]="t().previousLabel"
482
+ [disabled]="!canGoBack()"
483
+ (click)="shiftMonth(-1)"
484
+ >
485
+ <vd-icon name="chevron-left" />
486
+ </button>
487
+ <span class="vd-calendar__title" [id]="titleId" aria-live="polite">{{ title() }}</span>
488
+ <button
489
+ type="button"
490
+ class="vd-calendar__nav"
491
+ [attr.aria-label]="t().nextLabel"
492
+ [disabled]="!canGoForward()"
493
+ (click)="shiftMonth(1)"
494
+ >
495
+ <vd-icon name="chevron-right" />
496
+ </button>
497
+ </div>
498
+ <!-- Keys bubble from the focused cell (roving tabindex); the table only delegates. -->
499
+ <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->
500
+ <table
501
+ class="vd-calendar__grid"
502
+ role="grid"
503
+ [attr.aria-labelledby]="titleId"
504
+ [attr.aria-multiselectable]="selectionMode() === 'range' ? true : null"
505
+ (keydown)="onKey($event)"
506
+ >
507
+ <thead>
508
+ <tr>
509
+ @for (name of weekdays(); track $index) {
510
+ <th scope="col" [attr.abbr]="weekdaysLong()[$index]">{{ name }}</th>
511
+ }
512
+ </tr>
513
+ </thead>
514
+ <tbody>
515
+ @for (week of grid(); track week[0].date) {
516
+ <tr>
517
+ @for (day of week; track day.date) {
518
+ <td
519
+ role="gridcell"
520
+ class="vd-calendar__day"
521
+ [attr.data-date]="day.date"
522
+ [attr.tabindex]="day.date === focused() ? 0 : -1"
523
+ [attr.aria-selected]="isSelected(day.date)"
524
+ [attr.data-range-start]="
525
+ selectionMode() === 'range' && day.date === rangeStart() ? '' : null
526
+ "
527
+ [attr.data-range-end]="
528
+ selectionMode() === 'range' && day.date === rangeEnd() ? '' : null
529
+ "
530
+ [attr.data-in-range]="
531
+ selectionMode() === 'range' && isSelected(day.date) ? '' : null
532
+ "
533
+ [attr.aria-disabled]="isDisabled(day.date) || null"
534
+ [attr.aria-current]="day.date === today ? 'date' : null"
535
+ [attr.aria-label]="dayLabel(day)"
536
+ [attr.data-outside]="day.inMonth ? null : ''"
537
+ (focus)="onDayFocus(day.date, $event)"
538
+ (click)="choose(day.date)"
539
+ >
540
+ {{ numbers().format(day.day) }}
541
+ </td>
542
+ }
543
+ </tr>
544
+ }
545
+ </tbody>
546
+ </table>
547
+ `,
548
+ host: { class: "vd-calendar" },
549
+ changeDetection: ChangeDetectionStrategy.OnPush,
550
+ encapsulation: ViewEncapsulation.None
551
+ }]
552
+ }],
553
+ ctorParameters: () => [],
554
+ propDecorators: {
555
+ value: [{
556
+ type: i0.Input,
557
+ args: [{
558
+ isSignal: true,
559
+ alias: "value",
560
+ required: false
561
+ }]
562
+ }, {
563
+ type: i0.Output,
564
+ args: ["valueChange"]
565
+ }],
566
+ selectionMode: [{
567
+ type: i0.Input,
568
+ args: [{
569
+ isSignal: true,
570
+ alias: "selectionMode",
571
+ required: false
572
+ }]
573
+ }],
574
+ rangeStart: [{
575
+ type: i0.Input,
576
+ args: [{
577
+ isSignal: true,
578
+ alias: "rangeStart",
579
+ required: false
580
+ }]
581
+ }],
582
+ rangeEnd: [{
583
+ type: i0.Input,
584
+ args: [{
585
+ isSignal: true,
586
+ alias: "rangeEnd",
587
+ required: false
588
+ }]
589
+ }],
590
+ dateSelected: [{
591
+ type: i0.Output,
592
+ args: ["dateSelected"]
593
+ }],
594
+ min: [{
595
+ type: i0.Input,
596
+ args: [{
597
+ isSignal: true,
598
+ alias: "min",
599
+ required: false
600
+ }]
601
+ }],
602
+ max: [{
603
+ type: i0.Input,
604
+ args: [{
605
+ isSignal: true,
606
+ alias: "max",
607
+ required: false
608
+ }]
609
+ }],
610
+ dateDisabled: [{
611
+ type: i0.Input,
612
+ args: [{
613
+ isSignal: true,
614
+ alias: "dateDisabled",
615
+ required: false
616
+ }]
617
+ }],
618
+ locale: [{
619
+ type: i0.Input,
620
+ args: [{
621
+ isSignal: true,
622
+ alias: "locale",
623
+ required: false
624
+ }]
625
+ }],
626
+ firstDayOfWeek: [{
627
+ type: i0.Input,
628
+ args: [{
629
+ isSignal: true,
630
+ alias: "firstDayOfWeek",
631
+ required: false
632
+ }]
633
+ }],
634
+ previousLabel: [{
635
+ type: i0.Input,
636
+ args: [{
637
+ isSignal: true,
638
+ alias: "previousLabel",
639
+ required: false
640
+ }]
641
+ }],
642
+ nextLabel: [{
643
+ type: i0.Input,
644
+ args: [{
645
+ isSignal: true,
646
+ alias: "nextLabel",
647
+ required: false
648
+ }]
649
+ }]
650
+ }
651
+ });
652
+ const NO_NG_STATE = {
653
+ invalid: false,
654
+ touched: false,
655
+ disabled: false,
656
+ required: false
657
+ };
658
+ var VdDatePicker = class VdDatePicker {
659
+ value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
660
+ min = input(null, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
661
+ max = input(null, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
662
+ dateDisabled = input(() => false, ...ngDevMode ? [{ debugName: "dateDisabled" }] : /* istanbul ignore next */ []);
663
+ locale = input(inject(LOCALE_ID), ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
664
+ firstDayOfWeek = input(void 0, ...ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []);
665
+ disabled = input(false, {
666
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
667
+ transform: booleanAttribute
668
+ });
669
+ invalid = input(false, {
670
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
671
+ transform: booleanAttribute
672
+ });
673
+ required = input(false, {
674
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
675
+ transform: booleanAttribute
676
+ });
677
+ placeholder = input(...ngDevMode ? [void 0, { debugName: "placeholder" }] : /* istanbul ignore next */ []);
678
+ ariaLabel = input(void 0, {
679
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
680
+ alias: "aria-label"
681
+ });
682
+ openLabel = input(...ngDevMode ? [void 0, { debugName: "openLabel" }] : /* istanbul ignore next */ []);
683
+ dialogLabel = input(...ngDevMode ? [void 0, { debugName: "dialogLabel" }] : /* istanbul ignore next */ []);
684
+ previousLabel = input(...ngDevMode ? [void 0, { debugName: "previousLabel" }] : /* istanbul ignore next */ []);
685
+ nextLabel = input(...ngDevMode ? [void 0, { debugName: "nextLabel" }] : /* istanbul ignore next */ []);
686
+ t = vdTexts("datePicker", {
687
+ openLabel: this.openLabel,
688
+ dialogLabel: this.dialogLabel,
689
+ previousLabel: this.previousLabel,
690
+ nextLabel: this.nextLabel
691
+ });
692
+ open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
693
+ text = linkedSignal(() => {
694
+ const value = this.value();
695
+ return value ? vdFormatShort(value, this.locale()) : "";
696
+ }, ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
697
+ parseError = signal(false, ...ngDevMode ? [{ debugName: "parseError" }] : /* istanbul ignore next */ []);
698
+ formDisabled = signal(false, ...ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []);
699
+ ngSource = signal(null, ...ngDevMode ? [{ debugName: "ngSource" }] : /* istanbul ignore next */ []);
700
+ ngState = computed(() => this.ngSource()?.() ?? NO_NG_STATE, ...ngDevMode ? [{ debugName: "ngState" }] : /* istanbul ignore next */ []);
701
+ isDisabled = computed(() => this.disabled() || this.formDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
702
+ isRequired = computed(() => this.required() || this.ngState().required, ...ngDevMode ? [{ debugName: "isRequired" }] : /* istanbul ignore next */ []);
703
+ showInvalid = computed(() => this.invalid() || this.parseError() || this.ngState().invalid && this.ngState().touched, ...ngDevMode ? [{ debugName: "showInvalid" }] : /* istanbul ignore next */ []);
704
+ touchedState = computed(() => this.showInvalid() ? true : void 0, ...ngDevMode ? [{ debugName: "touchedState" }] : /* istanbul ignore next */ []);
705
+ placeholderText = computed(() => this.placeholder() ?? vdFormatShort(`${(/* @__PURE__ */ new Date()).getFullYear()}-12-31`, this.locale()), ...ngDevMode ? [{ debugName: "placeholderText" }] : /* istanbul ignore next */ []);
706
+ panel = viewChild.required("panel", ...ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []);
707
+ group = viewChild.required("group", {
708
+ ...ngDevMode ? { debugName: "group" } : /* istanbul ignore next */ {},
709
+ read: ElementRef
710
+ });
711
+ field = viewChild.required("field", ...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
712
+ calendar = viewChild.required(VdCalendar, ...ngDevMode ? [{ debugName: "calendar" }] : /* istanbul ignore next */ []);
713
+ injector = inject(Injector);
714
+ destroyRef = inject(DestroyRef);
715
+ anchorName = `--${vdUniqueId("vd-date-picker")}`;
716
+ openAtPress = null;
717
+ onChange = () => void 0;
718
+ onTouched = () => void 0;
719
+ constructor() {
720
+ afterNextRender(() => {
721
+ const panel = this.panel().nativeElement;
722
+ this.group().nativeElement.style.setProperty("anchor-name", this.anchorName);
723
+ panel.style.setProperty("position-anchor", this.anchorName);
724
+ const onToggle = (event) => {
725
+ const opened = event.newState === "open";
726
+ this.open.set(opened);
727
+ if (opened) this.calendar().focus();
728
+ };
729
+ panel.addEventListener("toggle", onToggle);
730
+ this.destroyRef.onDestroy(() => panel.removeEventListener("toggle", onToggle));
731
+ });
732
+ }
733
+ ngOnInit() {
734
+ const ngControl = this.injector.get(NgControl, null, {
735
+ self: true,
736
+ optional: true
737
+ });
738
+ this.ngSource.set(vdNgControlState(ngControl, this.destroyRef));
739
+ }
740
+ rememberState() {
741
+ this.openAtPress = this.panel().nativeElement.matches(":popover-open");
742
+ }
743
+ toggle() {
744
+ const panel = this.panel().nativeElement;
745
+ const wasOpen = this.openAtPress ?? panel.matches(":popover-open");
746
+ this.openAtPress = null;
747
+ if (wasOpen) {
748
+ if (panel.matches(":popover-open")) panel.hidePopover();
749
+ } else {
750
+ this.commit();
751
+ panel.showPopover({ source: this.field().nativeElement });
752
+ }
753
+ }
754
+ pick(date) {
755
+ this.setValue(date);
756
+ this.panel().nativeElement.hidePopover();
757
+ this.field().nativeElement.focus();
758
+ }
759
+ onType(event) {
760
+ this.text.set(event.target.value);
761
+ this.parseError.set(false);
762
+ }
763
+ onBlur() {
764
+ this.commit();
765
+ this.onTouched();
766
+ }
767
+ commit() {
768
+ const text = this.text().trim();
769
+ if (!text) {
770
+ this.parseError.set(false);
771
+ this.setValue(null);
772
+ return;
773
+ }
774
+ const date = vdParseDate(text, this.locale());
775
+ const calendar = this.calendar();
776
+ if (!date || calendar.isDisabled(date)) {
777
+ this.parseError.set(true);
778
+ return;
779
+ }
780
+ this.parseError.set(false);
781
+ this.setValue(date);
782
+ this.text.set(vdFormatShort(date, this.locale()));
783
+ }
784
+ setValue(date) {
785
+ if (date === this.value()) return;
786
+ this.value.set(date);
787
+ this.onChange(date);
788
+ }
789
+ writeValue(value) {
790
+ this.parseError.set(false);
791
+ this.value.set(value ?? null);
792
+ }
793
+ registerOnChange(fn) {
794
+ this.onChange = fn;
795
+ }
796
+ registerOnTouched(fn) {
797
+ this.onTouched = fn;
798
+ }
799
+ setDisabledState(disabled) {
800
+ this.formDisabled.set(disabled);
801
+ }
802
+ static ɵfac = i0.ɵɵngDeclareFactory({
803
+ minVersion: "12.0.0",
804
+ version: "22.2.1",
805
+ ngImport: i0,
806
+ type: VdDatePicker,
807
+ deps: [],
808
+ target: i0.ɵɵFactoryTarget.Component
809
+ });
810
+ static ɵcmp = i0.ɵɵngDeclareComponent({
811
+ minVersion: "17.2.0",
812
+ version: "22.2.1",
813
+ type: VdDatePicker,
814
+ isStandalone: true,
815
+ selector: "vd-date-picker",
816
+ inputs: {
817
+ value: {
818
+ classPropertyName: "value",
819
+ publicName: "value",
820
+ isSignal: true,
821
+ isRequired: false,
822
+ transformFunction: null
823
+ },
824
+ min: {
825
+ classPropertyName: "min",
826
+ publicName: "min",
827
+ isSignal: true,
828
+ isRequired: false,
829
+ transformFunction: null
830
+ },
831
+ max: {
832
+ classPropertyName: "max",
833
+ publicName: "max",
834
+ isSignal: true,
835
+ isRequired: false,
836
+ transformFunction: null
837
+ },
838
+ dateDisabled: {
839
+ classPropertyName: "dateDisabled",
840
+ publicName: "dateDisabled",
841
+ isSignal: true,
842
+ isRequired: false,
843
+ transformFunction: null
844
+ },
845
+ locale: {
846
+ classPropertyName: "locale",
847
+ publicName: "locale",
848
+ isSignal: true,
849
+ isRequired: false,
850
+ transformFunction: null
851
+ },
852
+ firstDayOfWeek: {
853
+ classPropertyName: "firstDayOfWeek",
854
+ publicName: "firstDayOfWeek",
855
+ isSignal: true,
856
+ isRequired: false,
857
+ transformFunction: null
858
+ },
859
+ disabled: {
860
+ classPropertyName: "disabled",
861
+ publicName: "disabled",
862
+ isSignal: true,
863
+ isRequired: false,
864
+ transformFunction: null
865
+ },
866
+ invalid: {
867
+ classPropertyName: "invalid",
868
+ publicName: "invalid",
869
+ isSignal: true,
870
+ isRequired: false,
871
+ transformFunction: null
872
+ },
873
+ required: {
874
+ classPropertyName: "required",
875
+ publicName: "required",
876
+ isSignal: true,
877
+ isRequired: false,
878
+ transformFunction: null
879
+ },
880
+ placeholder: {
881
+ classPropertyName: "placeholder",
882
+ publicName: "placeholder",
883
+ isSignal: true,
884
+ isRequired: false,
885
+ transformFunction: null
886
+ },
887
+ ariaLabel: {
888
+ classPropertyName: "ariaLabel",
889
+ publicName: "aria-label",
890
+ isSignal: true,
891
+ isRequired: false,
892
+ transformFunction: null
893
+ },
894
+ openLabel: {
895
+ classPropertyName: "openLabel",
896
+ publicName: "openLabel",
897
+ isSignal: true,
898
+ isRequired: false,
899
+ transformFunction: null
900
+ },
901
+ dialogLabel: {
902
+ classPropertyName: "dialogLabel",
903
+ publicName: "dialogLabel",
904
+ isSignal: true,
905
+ isRequired: false,
906
+ transformFunction: null
907
+ },
908
+ previousLabel: {
909
+ classPropertyName: "previousLabel",
910
+ publicName: "previousLabel",
911
+ isSignal: true,
912
+ isRequired: false,
913
+ transformFunction: null
914
+ },
915
+ nextLabel: {
916
+ classPropertyName: "nextLabel",
917
+ publicName: "nextLabel",
918
+ isSignal: true,
919
+ isRequired: false,
920
+ transformFunction: null
921
+ }
922
+ },
923
+ outputs: { value: "valueChange" },
924
+ host: {
925
+ properties: {
926
+ "attr.data-invalid": "showInvalid() ? \"\" : null",
927
+ "attr.aria-label": "null"
928
+ },
929
+ classAttribute: "vd-date-picker"
930
+ },
931
+ providers: [{
932
+ provide: NG_VALUE_ACCESSOR,
933
+ useExisting: forwardRef(() => VdDatePicker),
934
+ multi: true
935
+ }],
936
+ viewQueries: [
937
+ {
938
+ propertyName: "panel",
939
+ first: true,
940
+ predicate: ["panel"],
941
+ descendants: true,
942
+ isSignal: true
943
+ },
944
+ {
945
+ propertyName: "group",
946
+ first: true,
947
+ predicate: ["group"],
948
+ descendants: true,
949
+ read: ElementRef,
950
+ isSignal: true
951
+ },
952
+ {
953
+ propertyName: "field",
954
+ first: true,
955
+ predicate: ["field"],
956
+ descendants: true,
957
+ isSignal: true
958
+ },
959
+ {
960
+ propertyName: "calendar",
961
+ first: true,
962
+ predicate: VdCalendar,
963
+ descendants: true,
964
+ isSignal: true
965
+ }
966
+ ],
967
+ ngImport: i0,
968
+ template: `
969
+ <vd-input-group class="vd-date-picker__group" #group>
970
+ <input
971
+ vdInput
972
+ #field
973
+ type="text"
974
+ inputmode="numeric"
975
+ autocomplete="off"
976
+ [value]="text()"
977
+ [placeholder]="placeholderText()"
978
+ [disabled]="isDisabled()"
979
+ [invalid]="showInvalid()"
980
+ [touched]="touchedState()"
981
+ [required]="isRequired()"
982
+ [attr.aria-label]="ariaLabel() ?? null"
983
+ (input)="onType($event)"
984
+ (keydown.enter)="commit()"
985
+ (blur)="onBlur()"
986
+ />
987
+ <button
988
+ vdButton
989
+ type="button"
990
+ variant="ghost"
991
+ size="sm"
992
+ iconOnly
993
+ slot="end"
994
+ aria-haspopup="dialog"
995
+ [attr.aria-label]="t().openLabel"
996
+ [attr.aria-expanded]="open()"
997
+ [disabled]="isDisabled()"
998
+ (pointerdown)="rememberState()"
999
+ (click)="toggle()"
1000
+ >
1001
+ <vd-icon name="calendar" />
1002
+ </button>
1003
+ </vd-input-group>
1004
+ <div
1005
+ class="vd-popover vd-date-picker__panel"
1006
+ popover="auto"
1007
+ role="dialog"
1008
+ [attr.aria-label]="t().dialogLabel"
1009
+ #panel
1010
+ >
1011
+ <vd-calendar
1012
+ [value]="value()"
1013
+ [min]="min()"
1014
+ [max]="max()"
1015
+ [dateDisabled]="dateDisabled()"
1016
+ [locale]="locale()"
1017
+ [firstDayOfWeek]="firstDayOfWeek()"
1018
+ [previousLabel]="t().previousLabel"
1019
+ [nextLabel]="t().nextLabel"
1020
+ (valueChange)="pick($event)"
1021
+ />
1022
+ </div>
1023
+ `,
1024
+ isInline: true,
1025
+ dependencies: [
1026
+ {
1027
+ kind: "component",
1028
+ type: VdButton,
1029
+ selector: "button[vdButton], a[vdButton]",
1030
+ inputs: [
1031
+ "variant",
1032
+ "size",
1033
+ "disabled",
1034
+ "loading",
1035
+ "iconOnly",
1036
+ "type"
1037
+ ]
1038
+ },
1039
+ {
1040
+ kind: "component",
1041
+ type: VdCalendar,
1042
+ selector: "vd-calendar",
1043
+ inputs: [
1044
+ "value",
1045
+ "selectionMode",
1046
+ "rangeStart",
1047
+ "rangeEnd",
1048
+ "min",
1049
+ "max",
1050
+ "dateDisabled",
1051
+ "locale",
1052
+ "firstDayOfWeek",
1053
+ "previousLabel",
1054
+ "nextLabel"
1055
+ ],
1056
+ outputs: ["valueChange", "dateSelected"]
1057
+ },
1058
+ {
1059
+ kind: "component",
1060
+ type: VdIcon,
1061
+ selector: "vd-icon",
1062
+ inputs: ["name", "label"]
1063
+ },
1064
+ {
1065
+ kind: "directive",
1066
+ type: VdInput,
1067
+ selector: "input[vdInput], textarea[vdInput]",
1068
+ inputs: ["size"]
1069
+ },
1070
+ {
1071
+ kind: "component",
1072
+ type: VdInputGroup,
1073
+ selector: "vd-input-group"
1074
+ }
1075
+ ],
1076
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1077
+ encapsulation: i0.ViewEncapsulation.None
1078
+ });
1079
+ };
1080
+ i0.ɵɵngDeclareClassMetadata({
1081
+ minVersion: "12.0.0",
1082
+ version: "22.2.1",
1083
+ ngImport: i0,
1084
+ type: VdDatePicker,
1085
+ decorators: [{
1086
+ type: Component,
1087
+ args: [{
1088
+ selector: "vd-date-picker",
1089
+ imports: [
1090
+ VdButton,
1091
+ VdCalendar,
1092
+ VdIcon,
1093
+ VdInput,
1094
+ VdInputGroup
1095
+ ],
1096
+ template: `
1097
+ <vd-input-group class="vd-date-picker__group" #group>
1098
+ <input
1099
+ vdInput
1100
+ #field
1101
+ type="text"
1102
+ inputmode="numeric"
1103
+ autocomplete="off"
1104
+ [value]="text()"
1105
+ [placeholder]="placeholderText()"
1106
+ [disabled]="isDisabled()"
1107
+ [invalid]="showInvalid()"
1108
+ [touched]="touchedState()"
1109
+ [required]="isRequired()"
1110
+ [attr.aria-label]="ariaLabel() ?? null"
1111
+ (input)="onType($event)"
1112
+ (keydown.enter)="commit()"
1113
+ (blur)="onBlur()"
1114
+ />
1115
+ <button
1116
+ vdButton
1117
+ type="button"
1118
+ variant="ghost"
1119
+ size="sm"
1120
+ iconOnly
1121
+ slot="end"
1122
+ aria-haspopup="dialog"
1123
+ [attr.aria-label]="t().openLabel"
1124
+ [attr.aria-expanded]="open()"
1125
+ [disabled]="isDisabled()"
1126
+ (pointerdown)="rememberState()"
1127
+ (click)="toggle()"
1128
+ >
1129
+ <vd-icon name="calendar" />
1130
+ </button>
1131
+ </vd-input-group>
1132
+ <div
1133
+ class="vd-popover vd-date-picker__panel"
1134
+ popover="auto"
1135
+ role="dialog"
1136
+ [attr.aria-label]="t().dialogLabel"
1137
+ #panel
1138
+ >
1139
+ <vd-calendar
1140
+ [value]="value()"
1141
+ [min]="min()"
1142
+ [max]="max()"
1143
+ [dateDisabled]="dateDisabled()"
1144
+ [locale]="locale()"
1145
+ [firstDayOfWeek]="firstDayOfWeek()"
1146
+ [previousLabel]="t().previousLabel"
1147
+ [nextLabel]="t().nextLabel"
1148
+ (valueChange)="pick($event)"
1149
+ />
1150
+ </div>
1151
+ `,
1152
+ host: {
1153
+ class: "vd-date-picker",
1154
+ "[attr.data-invalid]": "showInvalid() ? \"\" : null",
1155
+ "[attr.aria-label]": "null"
1156
+ },
1157
+ providers: [{
1158
+ provide: NG_VALUE_ACCESSOR,
1159
+ useExisting: forwardRef(() => VdDatePicker),
1160
+ multi: true
1161
+ }],
1162
+ changeDetection: ChangeDetectionStrategy.OnPush,
1163
+ encapsulation: ViewEncapsulation.None
1164
+ }]
1165
+ }],
1166
+ ctorParameters: () => [],
1167
+ propDecorators: {
1168
+ value: [{
1169
+ type: i0.Input,
1170
+ args: [{
1171
+ isSignal: true,
1172
+ alias: "value",
1173
+ required: false
1174
+ }]
1175
+ }, {
1176
+ type: i0.Output,
1177
+ args: ["valueChange"]
1178
+ }],
1179
+ min: [{
1180
+ type: i0.Input,
1181
+ args: [{
1182
+ isSignal: true,
1183
+ alias: "min",
1184
+ required: false
1185
+ }]
1186
+ }],
1187
+ max: [{
1188
+ type: i0.Input,
1189
+ args: [{
1190
+ isSignal: true,
1191
+ alias: "max",
1192
+ required: false
1193
+ }]
1194
+ }],
1195
+ dateDisabled: [{
1196
+ type: i0.Input,
1197
+ args: [{
1198
+ isSignal: true,
1199
+ alias: "dateDisabled",
1200
+ required: false
1201
+ }]
1202
+ }],
1203
+ locale: [{
1204
+ type: i0.Input,
1205
+ args: [{
1206
+ isSignal: true,
1207
+ alias: "locale",
1208
+ required: false
1209
+ }]
1210
+ }],
1211
+ firstDayOfWeek: [{
1212
+ type: i0.Input,
1213
+ args: [{
1214
+ isSignal: true,
1215
+ alias: "firstDayOfWeek",
1216
+ required: false
1217
+ }]
1218
+ }],
1219
+ disabled: [{
1220
+ type: i0.Input,
1221
+ args: [{
1222
+ isSignal: true,
1223
+ alias: "disabled",
1224
+ required: false
1225
+ }]
1226
+ }],
1227
+ invalid: [{
1228
+ type: i0.Input,
1229
+ args: [{
1230
+ isSignal: true,
1231
+ alias: "invalid",
1232
+ required: false
1233
+ }]
1234
+ }],
1235
+ required: [{
1236
+ type: i0.Input,
1237
+ args: [{
1238
+ isSignal: true,
1239
+ alias: "required",
1240
+ required: false
1241
+ }]
1242
+ }],
1243
+ placeholder: [{
1244
+ type: i0.Input,
1245
+ args: [{
1246
+ isSignal: true,
1247
+ alias: "placeholder",
1248
+ required: false
1249
+ }]
1250
+ }],
1251
+ ariaLabel: [{
1252
+ type: i0.Input,
1253
+ args: [{
1254
+ isSignal: true,
1255
+ alias: "aria-label",
1256
+ required: false
1257
+ }]
1258
+ }],
1259
+ openLabel: [{
1260
+ type: i0.Input,
1261
+ args: [{
1262
+ isSignal: true,
1263
+ alias: "openLabel",
1264
+ required: false
1265
+ }]
1266
+ }],
1267
+ dialogLabel: [{
1268
+ type: i0.Input,
1269
+ args: [{
1270
+ isSignal: true,
1271
+ alias: "dialogLabel",
1272
+ required: false
1273
+ }]
1274
+ }],
1275
+ previousLabel: [{
1276
+ type: i0.Input,
1277
+ args: [{
1278
+ isSignal: true,
1279
+ alias: "previousLabel",
1280
+ required: false
1281
+ }]
1282
+ }],
1283
+ nextLabel: [{
1284
+ type: i0.Input,
1285
+ args: [{
1286
+ isSignal: true,
1287
+ alias: "nextLabel",
1288
+ required: false
1289
+ }]
1290
+ }],
1291
+ panel: [{
1292
+ type: i0.ViewChild,
1293
+ args: ["panel", { isSignal: true }]
1294
+ }],
1295
+ group: [{
1296
+ type: i0.ViewChild,
1297
+ args: ["group", {
1298
+ read: ElementRef,
1299
+ isSignal: true
1300
+ }]
1301
+ }],
1302
+ field: [{
1303
+ type: i0.ViewChild,
1304
+ args: ["field", { isSignal: true }]
1305
+ }],
1306
+ calendar: [{
1307
+ type: i0.ViewChild,
1308
+ args: [i0.forwardRef(() => VdCalendar), { isSignal: true }]
1309
+ }]
1310
+ }
1311
+ });
1312
+ export { VdCalendar, VdDatePicker, vdAddDays, vdAddMonths, vdCalendarKey, vdClampDate, vdDateOrder, vdFirstDayOfWeek, vdFormatDate, vdFormatShort, vdMonthGrid, vdParseDate, vdParseIso, vdToIso, vdToday, vdWeekdayNames };
1313
+
1314
+ //# sourceMappingURL=vadem-ui-calendar.mjs.map