@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,685 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, Injector, ViewEncapsulation, afterRenderEffect, booleanAttribute, computed, inject, input, model, output, signal, untracked, viewChild, viewChildren } from "@angular/core";
3
+ import { NgControl } from "@angular/forms";
4
+ import { FormField } from "@angular/forms/signals";
5
+ import { VD_FIELD, vdNgControlState, vdUniqueId } from "@vadem/ui/field";
6
+ import { VdIcon } from "@vadem/ui/icon";
7
+ import { vdTexts } from "@vadem/ui/locale";
8
+ function vdTagKey(tag) {
9
+ return tag.trim().normalize("NFC").toLowerCase();
10
+ }
11
+ function vdNormalizeTags(value) {
12
+ const seen = /* @__PURE__ */ new Set();
13
+ return (value ?? []).filter((tag) => {
14
+ if (typeof tag !== "string") return false;
15
+ const key = vdTagKey(tag);
16
+ if (!key || seen.has(key)) return false;
17
+ seen.add(key);
18
+ return true;
19
+ }).map((tag) => tag.trim().normalize("NFC"));
20
+ }
21
+ function vdAddTag(value, draft) {
22
+ const tag = draft.trim().normalize("NFC");
23
+ if (!tag) return {
24
+ kind: "empty",
25
+ tag
26
+ };
27
+ const tags = vdNormalizeTags(value);
28
+ if (tags.some((item) => vdTagKey(item) === vdTagKey(tag))) return {
29
+ kind: "duplicate",
30
+ tag
31
+ };
32
+ return {
33
+ kind: "added",
34
+ tag,
35
+ value: [...tags, tag]
36
+ };
37
+ }
38
+ var VdTagInput = class VdTagInput {
39
+ value = model([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
40
+ size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
41
+ disabled = input(false, {
42
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
43
+ transform: booleanAttribute
44
+ });
45
+ readonly = input(false, {
46
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
47
+ transform: booleanAttribute
48
+ });
49
+ invalid = input(false, {
50
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
51
+ transform: booleanAttribute
52
+ });
53
+ touched = input(false, {
54
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
55
+ transform: booleanAttribute
56
+ });
57
+ required = input(false, {
58
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
59
+ transform: booleanAttribute
60
+ });
61
+ placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
62
+ ariaLabel = input(void 0, {
63
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
64
+ alias: "aria-label"
65
+ });
66
+ ariaLabelledby = input(void 0, {
67
+ ...ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {},
68
+ alias: "aria-labelledby"
69
+ });
70
+ addLabel = input(...ngDevMode ? [void 0, { debugName: "addLabel" }] : /* istanbul ignore next */ []);
71
+ tagsLabel = input(...ngDevMode ? [void 0, { debugName: "tagsLabel" }] : /* istanbul ignore next */ []);
72
+ removeLabel = input(...ngDevMode ? [void 0, { debugName: "removeLabel" }] : /* istanbul ignore next */ []);
73
+ addedMessage = input(...ngDevMode ? [void 0, { debugName: "addedMessage" }] : /* istanbul ignore next */ []);
74
+ removedMessage = input(...ngDevMode ? [void 0, { debugName: "removedMessage" }] : /* istanbul ignore next */ []);
75
+ duplicateMessage = input(...ngDevMode ? [void 0, { debugName: "duplicateMessage" }] : /* istanbul ignore next */ []);
76
+ t = vdTexts("tagInput", {
77
+ addLabel: this.addLabel,
78
+ tagsLabel: this.tagsLabel,
79
+ removeLabel: this.removeLabel,
80
+ addedMessage: this.addedMessage,
81
+ removedMessage: this.removedMessage,
82
+ duplicateMessage: this.duplicateMessage
83
+ });
84
+ touch = output();
85
+ controlId = vdUniqueId("vd-tags");
86
+ feedbackId = vdUniqueId("vd-tags-feedback");
87
+ tagKey = vdTagKey;
88
+ tags = computed(() => vdNormalizeTags(this.value()), ...ngDevMode ? [{ debugName: "tags" }] : /* istanbul ignore next */ []);
89
+ draft = signal("", ...ngDevMode ? [{ debugName: "draft" }] : /* istanbul ignore next */ []);
90
+ feedback = signal("", ...ngDevMode ? [{ debugName: "feedback" }] : /* istanbul ignore next */ []);
91
+ composing = false;
92
+ pendingFeedback = signal(null, ...ngDevMode ? [{ debugName: "pendingFeedback" }] : /* istanbul ignore next */ []);
93
+ inputRef = viewChild("draftInput", ...ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []);
94
+ removeButtons = viewChildren("removeButton", ...ngDevMode ? [{ debugName: "removeButtons" }] : /* istanbul ignore next */ []);
95
+ hostEl = inject(ElementRef).nativeElement;
96
+ field = inject(VD_FIELD, { optional: true });
97
+ injector = inject(Injector);
98
+ destroyRef = inject(DestroyRef);
99
+ formBound = signal(false, ...ngDevMode ? [{ debugName: "formBound" }] : /* istanbul ignore next */ []);
100
+ ngSource = signal(null, ...ngDevMode ? [{ debugName: "ngSource" }] : /* istanbul ignore next */ []);
101
+ ngState = computed(() => this.ngSource()?.() ?? {
102
+ invalid: false,
103
+ touched: false,
104
+ disabled: false,
105
+ required: false
106
+ }, ...ngDevMode ? [{ debugName: "ngState" }] : /* istanbul ignore next */ []);
107
+ isDisabled = computed(() => this.disabled() || this.ngState().disabled, ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
108
+ locked = computed(() => this.isDisabled() || this.readonly(), ...ngDevMode ? [{ debugName: "locked" }] : /* istanbul ignore next */ []);
109
+ showInvalid = computed(() => this.invalid() && (!this.formBound() || this.touched()) || this.ngState().invalid && this.ngState().touched, ...ngDevMode ? [{ debugName: "showInvalid" }] : /* istanbul ignore next */ []);
110
+ isRequired = computed(() => this.required() || this.ngState().required, ...ngDevMode ? [{ debugName: "isRequired" }] : /* istanbul ignore next */ []);
111
+ descriptionIds = computed(() => [this.field?.describedBy(), this.feedback() ? this.feedbackId : null].filter(Boolean).join(" ") || null, ...ngDevMode ? [{ debugName: "descriptionIds" }] : /* istanbul ignore next */ []);
112
+ lastValue = null;
113
+ constructor() {
114
+ const control = {
115
+ id: signal(this.controlId),
116
+ invalid: this.showInvalid,
117
+ required: this.isRequired,
118
+ disabled: this.isDisabled
119
+ };
120
+ this.field?.register(control);
121
+ this.destroyRef.onDestroy(() => this.field?.unregister(control));
122
+ afterRenderEffect(() => {
123
+ const value = this.value();
124
+ if (value !== this.lastValue) {
125
+ this.lastValue = value;
126
+ untracked(() => this.reset());
127
+ }
128
+ });
129
+ afterRenderEffect(() => {
130
+ const message = this.pendingFeedback();
131
+ if (message !== null) {
132
+ this.pendingFeedback.set(null);
133
+ this.feedback.set(message);
134
+ }
135
+ });
136
+ }
137
+ ngOnInit() {
138
+ const ng = this.injector.get(NgControl, null, {
139
+ self: true,
140
+ optional: true
141
+ });
142
+ this.formBound.set(!!ng || !!this.injector.get(FormField, null, {
143
+ self: true,
144
+ optional: true
145
+ }));
146
+ this.ngSource.set(vdNgControlState(ng, this.destroyRef));
147
+ }
148
+ focus(options) {
149
+ this.inputRef()?.nativeElement.focus(options);
150
+ }
151
+ reset() {
152
+ this.draft.set("");
153
+ const input = this.inputRef()?.nativeElement;
154
+ if (input) input.value = "";
155
+ this.feedback.set("");
156
+ this.pendingFeedback.set(null);
157
+ this.composing = false;
158
+ }
159
+ onInput(event) {
160
+ this.draft.set(event.target.value);
161
+ this.feedback.set("");
162
+ this.pendingFeedback.set(null);
163
+ }
164
+ add() {
165
+ if (this.locked() || this.composing) return;
166
+ const result = vdAddTag(this.tags(), this.draft());
167
+ if (result.kind === "empty") return;
168
+ if (result.kind === "duplicate") this.announce(this.t().duplicateMessage(result.tag));
169
+ else {
170
+ this.commit(result.value);
171
+ this.draft.set("");
172
+ this.announce(this.t().addedMessage(result.tag));
173
+ }
174
+ this.focus();
175
+ }
176
+ remove(tag) {
177
+ if (this.locked() || !this.tags().includes(tag)) return;
178
+ this.commit(this.tags().filter((item) => item !== tag));
179
+ this.focus();
180
+ this.announce(this.t().removedMessage(tag));
181
+ }
182
+ returnToInput(event) {
183
+ event.preventDefault();
184
+ event.stopPropagation();
185
+ this.focus();
186
+ }
187
+ onKeydown(event) {
188
+ if (event.isComposing || this.composing || this.locked() || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
189
+ if (event.key === "Enter") {
190
+ event.preventDefault();
191
+ this.add();
192
+ } else if (event.key === "Backspace" && this.draft() === "") {
193
+ const last = this.removeButtons().at(-1);
194
+ if (last) {
195
+ event.preventDefault();
196
+ last.nativeElement.focus();
197
+ }
198
+ }
199
+ }
200
+ onFocusOut(event) {
201
+ if (event.relatedTarget && this.hostEl.contains(event.relatedTarget)) return;
202
+ this.touch.emit();
203
+ }
204
+ onFieldPointerDown(event) {
205
+ if (!this.isDisabled() && event.target === event.currentTarget) {
206
+ event.preventDefault();
207
+ this.focus();
208
+ }
209
+ }
210
+ commit(value) {
211
+ this.lastValue = value;
212
+ this.value.set(value);
213
+ }
214
+ announce(message) {
215
+ this.feedback.set("");
216
+ this.pendingFeedback.set(message);
217
+ }
218
+ static ɵfac = i0.ɵɵngDeclareFactory({
219
+ minVersion: "12.0.0",
220
+ version: "22.2.1",
221
+ ngImport: i0,
222
+ type: VdTagInput,
223
+ deps: [],
224
+ target: i0.ɵɵFactoryTarget.Component
225
+ });
226
+ static ɵcmp = i0.ɵɵngDeclareComponent({
227
+ minVersion: "17.0.0",
228
+ version: "22.2.1",
229
+ type: VdTagInput,
230
+ isStandalone: true,
231
+ selector: "vd-tag-input",
232
+ inputs: {
233
+ value: {
234
+ classPropertyName: "value",
235
+ publicName: "value",
236
+ isSignal: true,
237
+ isRequired: false,
238
+ transformFunction: null
239
+ },
240
+ size: {
241
+ classPropertyName: "size",
242
+ publicName: "size",
243
+ isSignal: true,
244
+ isRequired: false,
245
+ transformFunction: null
246
+ },
247
+ disabled: {
248
+ classPropertyName: "disabled",
249
+ publicName: "disabled",
250
+ isSignal: true,
251
+ isRequired: false,
252
+ transformFunction: null
253
+ },
254
+ readonly: {
255
+ classPropertyName: "readonly",
256
+ publicName: "readonly",
257
+ isSignal: true,
258
+ isRequired: false,
259
+ transformFunction: null
260
+ },
261
+ invalid: {
262
+ classPropertyName: "invalid",
263
+ publicName: "invalid",
264
+ isSignal: true,
265
+ isRequired: false,
266
+ transformFunction: null
267
+ },
268
+ touched: {
269
+ classPropertyName: "touched",
270
+ publicName: "touched",
271
+ isSignal: true,
272
+ isRequired: false,
273
+ transformFunction: null
274
+ },
275
+ required: {
276
+ classPropertyName: "required",
277
+ publicName: "required",
278
+ isSignal: true,
279
+ isRequired: false,
280
+ transformFunction: null
281
+ },
282
+ placeholder: {
283
+ classPropertyName: "placeholder",
284
+ publicName: "placeholder",
285
+ isSignal: true,
286
+ isRequired: false,
287
+ transformFunction: null
288
+ },
289
+ ariaLabel: {
290
+ classPropertyName: "ariaLabel",
291
+ publicName: "aria-label",
292
+ isSignal: true,
293
+ isRequired: false,
294
+ transformFunction: null
295
+ },
296
+ ariaLabelledby: {
297
+ classPropertyName: "ariaLabelledby",
298
+ publicName: "aria-labelledby",
299
+ isSignal: true,
300
+ isRequired: false,
301
+ transformFunction: null
302
+ },
303
+ addLabel: {
304
+ classPropertyName: "addLabel",
305
+ publicName: "addLabel",
306
+ isSignal: true,
307
+ isRequired: false,
308
+ transformFunction: null
309
+ },
310
+ tagsLabel: {
311
+ classPropertyName: "tagsLabel",
312
+ publicName: "tagsLabel",
313
+ isSignal: true,
314
+ isRequired: false,
315
+ transformFunction: null
316
+ },
317
+ removeLabel: {
318
+ classPropertyName: "removeLabel",
319
+ publicName: "removeLabel",
320
+ isSignal: true,
321
+ isRequired: false,
322
+ transformFunction: null
323
+ },
324
+ addedMessage: {
325
+ classPropertyName: "addedMessage",
326
+ publicName: "addedMessage",
327
+ isSignal: true,
328
+ isRequired: false,
329
+ transformFunction: null
330
+ },
331
+ removedMessage: {
332
+ classPropertyName: "removedMessage",
333
+ publicName: "removedMessage",
334
+ isSignal: true,
335
+ isRequired: false,
336
+ transformFunction: null
337
+ },
338
+ duplicateMessage: {
339
+ classPropertyName: "duplicateMessage",
340
+ publicName: "duplicateMessage",
341
+ isSignal: true,
342
+ isRequired: false,
343
+ transformFunction: null
344
+ }
345
+ },
346
+ outputs: {
347
+ value: "valueChange",
348
+ touch: "touch"
349
+ },
350
+ host: {
351
+ listeners: { "focusout": "onFocusOut($event)" },
352
+ properties: {
353
+ "attr.data-size": "size()",
354
+ "attr.data-invalid": "showInvalid() ? \"\" : null",
355
+ "attr.data-disabled": "isDisabled() ? \"\" : null",
356
+ "attr.data-readonly": "readonly() ? \"\" : null",
357
+ "attr.aria-label": "null",
358
+ "attr.aria-labelledby": "null"
359
+ },
360
+ classAttribute: "vd-tag-input"
361
+ },
362
+ viewQueries: [{
363
+ propertyName: "inputRef",
364
+ first: true,
365
+ predicate: ["draftInput"],
366
+ descendants: true,
367
+ isSignal: true
368
+ }, {
369
+ propertyName: "removeButtons",
370
+ predicate: ["removeButton"],
371
+ descendants: true,
372
+ isSignal: true
373
+ }],
374
+ ngImport: i0,
375
+ template: `
376
+ <div class="vd-input-group vd-tag-input__field" (pointerdown)="onFieldPointerDown($event)">
377
+ @if (tags().length) {
378
+ <ul class="vd-tag-input__tags" role="list" [attr.aria-label]="t().tagsLabel">
379
+ @for (tag of tags(); track tagKey(tag)) {
380
+ <li class="vd-tag-input__tag">
381
+ <span class="vd-tag-input__label">{{ tag }}</span>
382
+ <button
383
+ #removeButton
384
+ class="vd-tag-input__remove"
385
+ type="button"
386
+ [disabled]="locked()"
387
+ [attr.aria-label]="t().removeLabel(tag)"
388
+ (click)="remove(tag)"
389
+ (keydown.escape)="returnToInput($event)"
390
+ >
391
+ <vd-icon name="x" />
392
+ </button>
393
+ </li>
394
+ }
395
+ </ul>
396
+ }
397
+ <input
398
+ #draftInput
399
+ type="text"
400
+ class="vd-input vd-tag-input__input"
401
+ autocomplete="off"
402
+ [id]="controlId"
403
+ [attr.data-size]="size()"
404
+ [value]="draft()"
405
+ [placeholder]="placeholder()"
406
+ [disabled]="isDisabled()"
407
+ [readOnly]="readonly()"
408
+ [attr.data-invalid]="showInvalid() ? '' : null"
409
+ [attr.aria-invalid]="showInvalid() || null"
410
+ [attr.aria-required]="isRequired() || null"
411
+ [attr.aria-describedby]="descriptionIds()"
412
+ [attr.aria-label]="ariaLabel() ?? null"
413
+ [attr.aria-labelledby]="ariaLabelledby() ?? null"
414
+ (input)="onInput($event)"
415
+ (keydown)="onKeydown($event)"
416
+ (compositionstart)="composing = true"
417
+ (compositionend)="composing = false"
418
+ />
419
+ <button
420
+ class="vd-button vd-tag-input__add"
421
+ type="button"
422
+ data-variant="ghost"
423
+ [attr.data-size]="size()"
424
+ [disabled]="locked() || !draft().trim()"
425
+ (click)="add()"
426
+ >
427
+ {{ t().addLabel }}
428
+ </button>
429
+ </div>
430
+ <p
431
+ class="vd-tag-input__feedback"
432
+ [id]="feedbackId"
433
+ role="status"
434
+ aria-atomic="true"
435
+ [textContent]="feedback()"
436
+ ></p>
437
+ `,
438
+ isInline: true,
439
+ dependencies: [{
440
+ kind: "component",
441
+ type: VdIcon,
442
+ selector: "vd-icon",
443
+ inputs: ["name", "label"]
444
+ }],
445
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
446
+ encapsulation: i0.ViewEncapsulation.None
447
+ });
448
+ };
449
+ i0.ɵɵngDeclareClassMetadata({
450
+ minVersion: "12.0.0",
451
+ version: "22.2.1",
452
+ ngImport: i0,
453
+ type: VdTagInput,
454
+ decorators: [{
455
+ type: Component,
456
+ args: [{
457
+ selector: "vd-tag-input",
458
+ imports: [VdIcon],
459
+ template: `
460
+ <div class="vd-input-group vd-tag-input__field" (pointerdown)="onFieldPointerDown($event)">
461
+ @if (tags().length) {
462
+ <ul class="vd-tag-input__tags" role="list" [attr.aria-label]="t().tagsLabel">
463
+ @for (tag of tags(); track tagKey(tag)) {
464
+ <li class="vd-tag-input__tag">
465
+ <span class="vd-tag-input__label">{{ tag }}</span>
466
+ <button
467
+ #removeButton
468
+ class="vd-tag-input__remove"
469
+ type="button"
470
+ [disabled]="locked()"
471
+ [attr.aria-label]="t().removeLabel(tag)"
472
+ (click)="remove(tag)"
473
+ (keydown.escape)="returnToInput($event)"
474
+ >
475
+ <vd-icon name="x" />
476
+ </button>
477
+ </li>
478
+ }
479
+ </ul>
480
+ }
481
+ <input
482
+ #draftInput
483
+ type="text"
484
+ class="vd-input vd-tag-input__input"
485
+ autocomplete="off"
486
+ [id]="controlId"
487
+ [attr.data-size]="size()"
488
+ [value]="draft()"
489
+ [placeholder]="placeholder()"
490
+ [disabled]="isDisabled()"
491
+ [readOnly]="readonly()"
492
+ [attr.data-invalid]="showInvalid() ? '' : null"
493
+ [attr.aria-invalid]="showInvalid() || null"
494
+ [attr.aria-required]="isRequired() || null"
495
+ [attr.aria-describedby]="descriptionIds()"
496
+ [attr.aria-label]="ariaLabel() ?? null"
497
+ [attr.aria-labelledby]="ariaLabelledby() ?? null"
498
+ (input)="onInput($event)"
499
+ (keydown)="onKeydown($event)"
500
+ (compositionstart)="composing = true"
501
+ (compositionend)="composing = false"
502
+ />
503
+ <button
504
+ class="vd-button vd-tag-input__add"
505
+ type="button"
506
+ data-variant="ghost"
507
+ [attr.data-size]="size()"
508
+ [disabled]="locked() || !draft().trim()"
509
+ (click)="add()"
510
+ >
511
+ {{ t().addLabel }}
512
+ </button>
513
+ </div>
514
+ <p
515
+ class="vd-tag-input__feedback"
516
+ [id]="feedbackId"
517
+ role="status"
518
+ aria-atomic="true"
519
+ [textContent]="feedback()"
520
+ ></p>
521
+ `,
522
+ host: {
523
+ class: "vd-tag-input",
524
+ "[attr.data-size]": "size()",
525
+ "[attr.data-invalid]": "showInvalid() ? \"\" : null",
526
+ "[attr.data-disabled]": "isDisabled() ? \"\" : null",
527
+ "[attr.data-readonly]": "readonly() ? \"\" : null",
528
+ "[attr.aria-label]": "null",
529
+ "[attr.aria-labelledby]": "null",
530
+ "(focusout)": "onFocusOut($event)"
531
+ },
532
+ changeDetection: ChangeDetectionStrategy.OnPush,
533
+ encapsulation: ViewEncapsulation.None
534
+ }]
535
+ }],
536
+ ctorParameters: () => [],
537
+ propDecorators: {
538
+ value: [{
539
+ type: i0.Input,
540
+ args: [{
541
+ isSignal: true,
542
+ alias: "value",
543
+ required: false
544
+ }]
545
+ }, {
546
+ type: i0.Output,
547
+ args: ["valueChange"]
548
+ }],
549
+ size: [{
550
+ type: i0.Input,
551
+ args: [{
552
+ isSignal: true,
553
+ alias: "size",
554
+ required: false
555
+ }]
556
+ }],
557
+ disabled: [{
558
+ type: i0.Input,
559
+ args: [{
560
+ isSignal: true,
561
+ alias: "disabled",
562
+ required: false
563
+ }]
564
+ }],
565
+ readonly: [{
566
+ type: i0.Input,
567
+ args: [{
568
+ isSignal: true,
569
+ alias: "readonly",
570
+ required: false
571
+ }]
572
+ }],
573
+ invalid: [{
574
+ type: i0.Input,
575
+ args: [{
576
+ isSignal: true,
577
+ alias: "invalid",
578
+ required: false
579
+ }]
580
+ }],
581
+ touched: [{
582
+ type: i0.Input,
583
+ args: [{
584
+ isSignal: true,
585
+ alias: "touched",
586
+ required: false
587
+ }]
588
+ }],
589
+ required: [{
590
+ type: i0.Input,
591
+ args: [{
592
+ isSignal: true,
593
+ alias: "required",
594
+ required: false
595
+ }]
596
+ }],
597
+ placeholder: [{
598
+ type: i0.Input,
599
+ args: [{
600
+ isSignal: true,
601
+ alias: "placeholder",
602
+ required: false
603
+ }]
604
+ }],
605
+ ariaLabel: [{
606
+ type: i0.Input,
607
+ args: [{
608
+ isSignal: true,
609
+ alias: "aria-label",
610
+ required: false
611
+ }]
612
+ }],
613
+ ariaLabelledby: [{
614
+ type: i0.Input,
615
+ args: [{
616
+ isSignal: true,
617
+ alias: "aria-labelledby",
618
+ required: false
619
+ }]
620
+ }],
621
+ addLabel: [{
622
+ type: i0.Input,
623
+ args: [{
624
+ isSignal: true,
625
+ alias: "addLabel",
626
+ required: false
627
+ }]
628
+ }],
629
+ tagsLabel: [{
630
+ type: i0.Input,
631
+ args: [{
632
+ isSignal: true,
633
+ alias: "tagsLabel",
634
+ required: false
635
+ }]
636
+ }],
637
+ removeLabel: [{
638
+ type: i0.Input,
639
+ args: [{
640
+ isSignal: true,
641
+ alias: "removeLabel",
642
+ required: false
643
+ }]
644
+ }],
645
+ addedMessage: [{
646
+ type: i0.Input,
647
+ args: [{
648
+ isSignal: true,
649
+ alias: "addedMessage",
650
+ required: false
651
+ }]
652
+ }],
653
+ removedMessage: [{
654
+ type: i0.Input,
655
+ args: [{
656
+ isSignal: true,
657
+ alias: "removedMessage",
658
+ required: false
659
+ }]
660
+ }],
661
+ duplicateMessage: [{
662
+ type: i0.Input,
663
+ args: [{
664
+ isSignal: true,
665
+ alias: "duplicateMessage",
666
+ required: false
667
+ }]
668
+ }],
669
+ touch: [{
670
+ type: i0.Output,
671
+ args: ["touch"]
672
+ }],
673
+ inputRef: [{
674
+ type: i0.ViewChild,
675
+ args: ["draftInput", { isSignal: true }]
676
+ }],
677
+ removeButtons: [{
678
+ type: i0.ViewChildren,
679
+ args: ["removeButton", { isSignal: true }]
680
+ }]
681
+ }
682
+ });
683
+ export { VdTagInput };
684
+
685
+ //# sourceMappingURL=vadem-ui-tag-input.mjs.map