@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,735 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, ViewEncapsulation, afterRenderEffect, booleanAttribute, computed, contentChild, contentChildren, forwardRef, inject, input, model, output, signal, viewChild } from "@angular/core";
3
+ import { vdUniqueId } from "@vadem/ui/field";
4
+ import { VdIcon } from "@vadem/ui/icon";
5
+ import { vdListTarget, vdMatchesQuery } from "@vadem/ui/keyboard";
6
+ import { vdTexts } from "@vadem/ui/locale";
7
+ function vdFilterCommands(items, query) {
8
+ return items.filter((item) => vdMatchesQuery([item.label, ...item.keywords].join(" "), query));
9
+ }
10
+ function vdActiveCommand(items, activeId) {
11
+ return items.find((item) => item.id === activeId && !item.disabled) ?? items.find((item) => !item.disabled) ?? null;
12
+ }
13
+ var VdCommand = class VdCommand {
14
+ query = model("", ...ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []);
15
+ label = input(...ngDevMode ? [void 0, { debugName: "label" }] : /* istanbul ignore next */ []);
16
+ placeholder = input(...ngDevMode ? [void 0, { debugName: "placeholder" }] : /* istanbul ignore next */ []);
17
+ emptyText = input(...ngDevMode ? [void 0, { debugName: "emptyText" }] : /* istanbul ignore next */ []);
18
+ loadingText = input(...ngDevMode ? [void 0, { debugName: "loadingText" }] : /* istanbul ignore next */ []);
19
+ t = vdTexts("command", {
20
+ label: this.label,
21
+ placeholder: this.placeholder,
22
+ emptyText: this.emptyText,
23
+ loadingText: this.loadingText
24
+ });
25
+ disabled = input(false, {
26
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
27
+ transform: booleanAttribute
28
+ });
29
+ loading = input(false, {
30
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
31
+ transform: booleanAttribute
32
+ });
33
+ autofocus = input(false, {
34
+ ...ngDevMode ? { debugName: "autofocus" } : /* istanbul ignore next */ {},
35
+ transform: booleanAttribute
36
+ });
37
+ selected = output();
38
+ dismissed = output();
39
+ expanded = signal(true, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
40
+ focused = signal(false, ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
41
+ listId = vdUniqueId("vd-command-list");
42
+ items = contentChildren(VdCommandItem, {
43
+ ...ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {},
44
+ descendants: true
45
+ });
46
+ initialized = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "initialized" }] : /* istanbul ignore next */ []);
47
+ activeId = signal(null, ...ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []);
48
+ search = viewChild.required("search", ...ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []);
49
+ list = viewChild.required("list", ...ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []);
50
+ records = computed(() => this.items().filter((item) => this.initialized().has(item)).map((item) => ({
51
+ id: item.id,
52
+ label: item.label(),
53
+ keywords: item.keywords(),
54
+ disabled: item.disabled(),
55
+ item
56
+ })), ...ngDevMode ? [{ debugName: "records" }] : /* istanbul ignore next */ []);
57
+ visibleItems = computed(() => vdFilterCommands(this.records(), this.query()), ...ngDevMode ? [{ debugName: "visibleItems" }] : /* istanbul ignore next */ []);
58
+ activeItem = computed(() => {
59
+ if (this.disabled() || this.loading() || !this.expanded()) return null;
60
+ return vdActiveCommand(this.visibleItems(), this.activeId())?.item ?? null;
61
+ }, ...ngDevMode ? [{ debugName: "activeItem" }] : /* istanbul ignore next */ []);
62
+ constructor() {
63
+ afterRenderEffect(() => {
64
+ const active = this.activeItem();
65
+ if (!active || !this.focused()) return;
66
+ const list = this.list().nativeElement;
67
+ const box = list.getBoundingClientRect();
68
+ const item = active.el.getBoundingClientRect();
69
+ if (item.top < box.top) list.scrollTop += item.top - box.top;
70
+ else if (item.bottom > box.bottom) list.scrollTop += item.bottom - box.bottom;
71
+ });
72
+ }
73
+ focus() {
74
+ if (!this.disabled()) this.search().nativeElement.focus();
75
+ }
76
+ register(item) {
77
+ this.initialized.update((items) => /* @__PURE__ */ new Set([...items, item]));
78
+ return () => this.initialized.update((items) => {
79
+ const next = new Set(items);
80
+ next.delete(item);
81
+ return next;
82
+ });
83
+ }
84
+ isVisible(item) {
85
+ return !this.loading() && this.visibleItems().some((record) => record.item === item);
86
+ }
87
+ choose(item) {
88
+ if (this.disabled() || this.loading() || !this.expanded() || item.disabled() || !this.isVisible(item)) return;
89
+ this.activeId.set(item.id);
90
+ this.focus();
91
+ const value = item.value();
92
+ item.selected.emit();
93
+ this.selected.emit(value);
94
+ }
95
+ hover(item, event) {
96
+ if (event.pointerType !== "mouse" || this.disabled() || this.loading() || item.disabled()) return;
97
+ if (this.isVisible(item)) this.activeId.set(item.id);
98
+ }
99
+ onFocus() {
100
+ this.focused.set(true);
101
+ this.expanded.set(true);
102
+ }
103
+ onInput(event) {
104
+ this.query.set(event.target.value);
105
+ this.activeId.set(null);
106
+ this.expanded.set(true);
107
+ }
108
+ onKeydown(event) {
109
+ if (event.isComposing || event.keyCode === 229 || event.defaultPrevented || this.disabled()) return;
110
+ if (event.key === "Escape") {
111
+ event.preventDefault();
112
+ this.expanded.set(false);
113
+ this.dismissed.emit();
114
+ return;
115
+ }
116
+ if (event.key === "Enter") {
117
+ event.preventDefault();
118
+ if (!event.repeat) {
119
+ const active = this.activeItem();
120
+ if (active) this.choose(active);
121
+ }
122
+ return;
123
+ }
124
+ if (event.ctrlKey || event.metaKey || event.altKey || this.loading()) return;
125
+ if (![
126
+ "ArrowDown",
127
+ "ArrowUp",
128
+ "PageDown",
129
+ "PageUp"
130
+ ].includes(event.key)) return;
131
+ event.preventDefault();
132
+ const wasExpanded = this.expanded();
133
+ this.expanded.set(true);
134
+ const records = this.visibleItems();
135
+ const active = wasExpanded ? this.activeItem() : null;
136
+ const index = records.findIndex((record) => record.item === active);
137
+ const next = vdListTarget(event.key, index, records.map((record) => record.disabled), {
138
+ loop: false,
139
+ pageSize: 10
140
+ });
141
+ if (next !== null) this.activeId.set(records[next]?.id ?? null);
142
+ }
143
+ static ɵfac = i0.ɵɵngDeclareFactory({
144
+ minVersion: "12.0.0",
145
+ version: "22.2.1",
146
+ ngImport: i0,
147
+ type: VdCommand,
148
+ deps: [],
149
+ target: i0.ɵɵFactoryTarget.Component
150
+ });
151
+ static ɵcmp = i0.ɵɵngDeclareComponent({
152
+ minVersion: "17.0.0",
153
+ version: "22.2.1",
154
+ type: VdCommand,
155
+ isStandalone: true,
156
+ selector: "vd-command",
157
+ inputs: {
158
+ query: {
159
+ classPropertyName: "query",
160
+ publicName: "query",
161
+ isSignal: true,
162
+ isRequired: false,
163
+ transformFunction: null
164
+ },
165
+ label: {
166
+ classPropertyName: "label",
167
+ publicName: "label",
168
+ isSignal: true,
169
+ isRequired: false,
170
+ transformFunction: null
171
+ },
172
+ placeholder: {
173
+ classPropertyName: "placeholder",
174
+ publicName: "placeholder",
175
+ isSignal: true,
176
+ isRequired: false,
177
+ transformFunction: null
178
+ },
179
+ emptyText: {
180
+ classPropertyName: "emptyText",
181
+ publicName: "emptyText",
182
+ isSignal: true,
183
+ isRequired: false,
184
+ transformFunction: null
185
+ },
186
+ loadingText: {
187
+ classPropertyName: "loadingText",
188
+ publicName: "loadingText",
189
+ isSignal: true,
190
+ isRequired: false,
191
+ transformFunction: null
192
+ },
193
+ disabled: {
194
+ classPropertyName: "disabled",
195
+ publicName: "disabled",
196
+ isSignal: true,
197
+ isRequired: false,
198
+ transformFunction: null
199
+ },
200
+ loading: {
201
+ classPropertyName: "loading",
202
+ publicName: "loading",
203
+ isSignal: true,
204
+ isRequired: false,
205
+ transformFunction: null
206
+ },
207
+ autofocus: {
208
+ classPropertyName: "autofocus",
209
+ publicName: "autofocus",
210
+ isSignal: true,
211
+ isRequired: false,
212
+ transformFunction: null
213
+ }
214
+ },
215
+ outputs: {
216
+ query: "queryChange",
217
+ selected: "selected",
218
+ dismissed: "dismissed"
219
+ },
220
+ host: {
221
+ properties: {
222
+ "attr.data-open": "expanded() ? \"\" : null",
223
+ "attr.data-focused": "focused() ? \"\" : null",
224
+ "attr.data-disabled": "disabled() ? \"\" : null",
225
+ "attr.data-loading": "loading() ? \"\" : null"
226
+ },
227
+ classAttribute: "vd-command"
228
+ },
229
+ queries: [{
230
+ propertyName: "items",
231
+ predicate: VdCommandItem,
232
+ descendants: true,
233
+ isSignal: true
234
+ }],
235
+ viewQueries: [{
236
+ propertyName: "search",
237
+ first: true,
238
+ predicate: ["search"],
239
+ descendants: true,
240
+ isSignal: true
241
+ }, {
242
+ propertyName: "list",
243
+ first: true,
244
+ predicate: ["list"],
245
+ descendants: true,
246
+ isSignal: true
247
+ }],
248
+ ngImport: i0,
249
+ template: `
250
+ <div class="vd-command__search">
251
+ <vd-icon name="search" />
252
+ <!-- Opt-in for modal Dialog initial focus; false for inline use. -->
253
+ <!-- eslint-disable @angular-eslint/template/no-autofocus -->
254
+ <input
255
+ #search
256
+ class="vd-command__input"
257
+ type="text"
258
+ role="combobox"
259
+ aria-autocomplete="list"
260
+ aria-haspopup="listbox"
261
+ autocomplete="off"
262
+ spellcheck="false"
263
+ [value]="query()"
264
+ [placeholder]="t().placeholder"
265
+ [disabled]="disabled()"
266
+ [autofocus]="autofocus()"
267
+ [attr.aria-label]="t().label"
268
+ [attr.aria-expanded]="expanded()"
269
+ [attr.aria-controls]="listId"
270
+ [attr.aria-activedescendant]="focused() && expanded() ? activeItem()?.id : null"
271
+ (input)="onInput($event)"
272
+ (focus)="onFocus()"
273
+ (blur)="focused.set(false)"
274
+ (keydown)="onKeydown($event)"
275
+ />
276
+ <!-- eslint-enable @angular-eslint/template/no-autofocus -->
277
+ </div>
278
+ <div
279
+ #list
280
+ class="vd-command__list"
281
+ role="listbox"
282
+ [id]="listId"
283
+ [attr.aria-label]="t().label"
284
+ [attr.aria-busy]="loading() || null"
285
+ [hidden]="!expanded()"
286
+ >
287
+ <ng-content />
288
+ </div>
289
+ <p class="vd-command__status" role="status" [hidden]="!expanded()">
290
+ @if (loading()) {
291
+ {{ t().loadingText }}
292
+ } @else if (visibleItems().length === 0) {
293
+ {{ t().emptyText }}
294
+ }
295
+ </p>
296
+ `,
297
+ isInline: true,
298
+ dependencies: [{
299
+ kind: "component",
300
+ type: VdIcon,
301
+ selector: "vd-icon",
302
+ inputs: ["name", "label"]
303
+ }],
304
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
305
+ encapsulation: i0.ViewEncapsulation.None
306
+ });
307
+ };
308
+ i0.ɵɵngDeclareClassMetadata({
309
+ minVersion: "12.0.0",
310
+ version: "22.2.1",
311
+ ngImport: i0,
312
+ type: VdCommand,
313
+ decorators: [{
314
+ type: Component,
315
+ args: [{
316
+ selector: "vd-command",
317
+ imports: [VdIcon],
318
+ template: `
319
+ <div class="vd-command__search">
320
+ <vd-icon name="search" />
321
+ <!-- Opt-in for modal Dialog initial focus; false for inline use. -->
322
+ <!-- eslint-disable @angular-eslint/template/no-autofocus -->
323
+ <input
324
+ #search
325
+ class="vd-command__input"
326
+ type="text"
327
+ role="combobox"
328
+ aria-autocomplete="list"
329
+ aria-haspopup="listbox"
330
+ autocomplete="off"
331
+ spellcheck="false"
332
+ [value]="query()"
333
+ [placeholder]="t().placeholder"
334
+ [disabled]="disabled()"
335
+ [autofocus]="autofocus()"
336
+ [attr.aria-label]="t().label"
337
+ [attr.aria-expanded]="expanded()"
338
+ [attr.aria-controls]="listId"
339
+ [attr.aria-activedescendant]="focused() && expanded() ? activeItem()?.id : null"
340
+ (input)="onInput($event)"
341
+ (focus)="onFocus()"
342
+ (blur)="focused.set(false)"
343
+ (keydown)="onKeydown($event)"
344
+ />
345
+ <!-- eslint-enable @angular-eslint/template/no-autofocus -->
346
+ </div>
347
+ <div
348
+ #list
349
+ class="vd-command__list"
350
+ role="listbox"
351
+ [id]="listId"
352
+ [attr.aria-label]="t().label"
353
+ [attr.aria-busy]="loading() || null"
354
+ [hidden]="!expanded()"
355
+ >
356
+ <ng-content />
357
+ </div>
358
+ <p class="vd-command__status" role="status" [hidden]="!expanded()">
359
+ @if (loading()) {
360
+ {{ t().loadingText }}
361
+ } @else if (visibleItems().length === 0) {
362
+ {{ t().emptyText }}
363
+ }
364
+ </p>
365
+ `,
366
+ host: {
367
+ class: "vd-command",
368
+ "[attr.data-open]": "expanded() ? \"\" : null",
369
+ "[attr.data-focused]": "focused() ? \"\" : null",
370
+ "[attr.data-disabled]": "disabled() ? \"\" : null",
371
+ "[attr.data-loading]": "loading() ? \"\" : null"
372
+ },
373
+ changeDetection: ChangeDetectionStrategy.OnPush,
374
+ encapsulation: ViewEncapsulation.None
375
+ }]
376
+ }],
377
+ ctorParameters: () => [],
378
+ propDecorators: {
379
+ query: [{
380
+ type: i0.Input,
381
+ args: [{
382
+ isSignal: true,
383
+ alias: "query",
384
+ required: false
385
+ }]
386
+ }, {
387
+ type: i0.Output,
388
+ args: ["queryChange"]
389
+ }],
390
+ label: [{
391
+ type: i0.Input,
392
+ args: [{
393
+ isSignal: true,
394
+ alias: "label",
395
+ required: false
396
+ }]
397
+ }],
398
+ placeholder: [{
399
+ type: i0.Input,
400
+ args: [{
401
+ isSignal: true,
402
+ alias: "placeholder",
403
+ required: false
404
+ }]
405
+ }],
406
+ emptyText: [{
407
+ type: i0.Input,
408
+ args: [{
409
+ isSignal: true,
410
+ alias: "emptyText",
411
+ required: false
412
+ }]
413
+ }],
414
+ loadingText: [{
415
+ type: i0.Input,
416
+ args: [{
417
+ isSignal: true,
418
+ alias: "loadingText",
419
+ required: false
420
+ }]
421
+ }],
422
+ disabled: [{
423
+ type: i0.Input,
424
+ args: [{
425
+ isSignal: true,
426
+ alias: "disabled",
427
+ required: false
428
+ }]
429
+ }],
430
+ loading: [{
431
+ type: i0.Input,
432
+ args: [{
433
+ isSignal: true,
434
+ alias: "loading",
435
+ required: false
436
+ }]
437
+ }],
438
+ autofocus: [{
439
+ type: i0.Input,
440
+ args: [{
441
+ isSignal: true,
442
+ alias: "autofocus",
443
+ required: false
444
+ }]
445
+ }],
446
+ selected: [{
447
+ type: i0.Output,
448
+ args: ["selected"]
449
+ }],
450
+ dismissed: [{
451
+ type: i0.Output,
452
+ args: ["dismissed"]
453
+ }],
454
+ items: [{
455
+ type: i0.ContentChildren,
456
+ args: [i0.forwardRef(() => VdCommandItem), {
457
+ descendants: true,
458
+ isSignal: true
459
+ }]
460
+ }],
461
+ search: [{
462
+ type: i0.ViewChild,
463
+ args: ["search", { isSignal: true }]
464
+ }],
465
+ list: [{
466
+ type: i0.ViewChild,
467
+ args: ["list", { isSignal: true }]
468
+ }]
469
+ }
470
+ });
471
+ var VdCommandDescription = class VdCommandDescription {
472
+ id = vdUniqueId("vd-command-description");
473
+ static ɵfac = i0.ɵɵngDeclareFactory({
474
+ minVersion: "12.0.0",
475
+ version: "22.2.1",
476
+ ngImport: i0,
477
+ type: VdCommandDescription,
478
+ deps: [],
479
+ target: i0.ɵɵFactoryTarget.Directive
480
+ });
481
+ static ɵdir = i0.ɵɵngDeclareDirective({
482
+ minVersion: "14.0.0",
483
+ version: "22.2.1",
484
+ type: VdCommandDescription,
485
+ isStandalone: true,
486
+ selector: "[vdCommandDescription]",
487
+ host: {
488
+ properties: { "id": "id" },
489
+ classAttribute: "vd-command-item__description"
490
+ },
491
+ ngImport: i0
492
+ });
493
+ };
494
+ i0.ɵɵngDeclareClassMetadata({
495
+ minVersion: "12.0.0",
496
+ version: "22.2.1",
497
+ ngImport: i0,
498
+ type: VdCommandDescription,
499
+ decorators: [{
500
+ type: Directive,
501
+ args: [{
502
+ selector: "[vdCommandDescription]",
503
+ host: {
504
+ class: "vd-command-item__description",
505
+ "[id]": "id"
506
+ }
507
+ }]
508
+ }]
509
+ });
510
+ var VdCommandShortcut = class VdCommandShortcut {
511
+ static ɵfac = i0.ɵɵngDeclareFactory({
512
+ minVersion: "12.0.0",
513
+ version: "22.2.1",
514
+ ngImport: i0,
515
+ type: VdCommandShortcut,
516
+ deps: [],
517
+ target: i0.ɵɵFactoryTarget.Directive
518
+ });
519
+ static ɵdir = i0.ɵɵngDeclareDirective({
520
+ minVersion: "14.0.0",
521
+ version: "22.2.1",
522
+ type: VdCommandShortcut,
523
+ isStandalone: true,
524
+ selector: "[vdCommandShortcut]",
525
+ host: {
526
+ attributes: { "aria-hidden": "true" },
527
+ classAttribute: "vd-command-item__shortcut"
528
+ },
529
+ ngImport: i0
530
+ });
531
+ };
532
+ i0.ɵɵngDeclareClassMetadata({
533
+ minVersion: "12.0.0",
534
+ version: "22.2.1",
535
+ ngImport: i0,
536
+ type: VdCommandShortcut,
537
+ decorators: [{
538
+ type: Directive,
539
+ args: [{
540
+ selector: "[vdCommandShortcut]",
541
+ host: {
542
+ class: "vd-command-item__shortcut",
543
+ "aria-hidden": "true"
544
+ }
545
+ }]
546
+ }]
547
+ });
548
+ var VdCommandItem = class VdCommandItem {
549
+ value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
550
+ label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
551
+ keywords = input([], ...ngDevMode ? [{ debugName: "keywords" }] : /* istanbul ignore next */ []);
552
+ disabled = input(false, {
553
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
554
+ transform: booleanAttribute
555
+ });
556
+ selected = output();
557
+ id = vdUniqueId("vd-command-item");
558
+ el = inject(ElementRef).nativeElement;
559
+ command = inject(forwardRef(() => VdCommand));
560
+ description = contentChild(VdCommandDescription, ...ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []);
561
+ destroyRef = inject(DestroyRef);
562
+ ngOnInit() {
563
+ this.destroyRef.onDestroy(this.command.register(this));
564
+ }
565
+ static ɵfac = i0.ɵɵngDeclareFactory({
566
+ minVersion: "12.0.0",
567
+ version: "22.2.1",
568
+ ngImport: i0,
569
+ type: VdCommandItem,
570
+ deps: [],
571
+ target: i0.ɵɵFactoryTarget.Component
572
+ });
573
+ static ɵcmp = i0.ɵɵngDeclareComponent({
574
+ minVersion: "17.2.0",
575
+ version: "22.2.1",
576
+ type: VdCommandItem,
577
+ isStandalone: true,
578
+ selector: "vd-command-item",
579
+ inputs: {
580
+ value: {
581
+ classPropertyName: "value",
582
+ publicName: "value",
583
+ isSignal: true,
584
+ isRequired: true,
585
+ transformFunction: null
586
+ },
587
+ label: {
588
+ classPropertyName: "label",
589
+ publicName: "label",
590
+ isSignal: true,
591
+ isRequired: true,
592
+ transformFunction: null
593
+ },
594
+ keywords: {
595
+ classPropertyName: "keywords",
596
+ publicName: "keywords",
597
+ isSignal: true,
598
+ isRequired: false,
599
+ transformFunction: null
600
+ },
601
+ disabled: {
602
+ classPropertyName: "disabled",
603
+ publicName: "disabled",
604
+ isSignal: true,
605
+ isRequired: false,
606
+ transformFunction: null
607
+ }
608
+ },
609
+ outputs: { selected: "selected" },
610
+ host: {
611
+ attributes: { "role": "option" },
612
+ listeners: {
613
+ "click": "command.choose(this)",
614
+ "pointermove": "command.hover(this, $event)",
615
+ "pointerdown": "$event.preventDefault()"
616
+ },
617
+ properties: {
618
+ "id": "id",
619
+ "attr.aria-label": "label()",
620
+ "attr.aria-describedby": "description()?.id ?? null",
621
+ "attr.aria-selected": "command.activeItem() === this",
622
+ "attr.aria-disabled": "disabled() || command.disabled() || command.loading() || null",
623
+ "attr.data-active": "command.activeItem() === this ? \"\" : null",
624
+ "hidden": "!command.isVisible(this)"
625
+ },
626
+ classAttribute: "vd-command-item"
627
+ },
628
+ queries: [{
629
+ propertyName: "description",
630
+ first: true,
631
+ predicate: VdCommandDescription,
632
+ descendants: true,
633
+ isSignal: true
634
+ }],
635
+ ngImport: i0,
636
+ template: `
637
+ <ng-content select="[slot=start]" />
638
+ <span class="vd-command-item__content">
639
+ <span class="vd-command-item__label">{{ label() }}</span>
640
+ <ng-content select="[vdCommandDescription]" />
641
+ </span>
642
+ <ng-content select="[vdCommandShortcut]" />
643
+ `,
644
+ isInline: true,
645
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
646
+ encapsulation: i0.ViewEncapsulation.None
647
+ });
648
+ };
649
+ i0.ɵɵngDeclareClassMetadata({
650
+ minVersion: "12.0.0",
651
+ version: "22.2.1",
652
+ ngImport: i0,
653
+ type: VdCommandItem,
654
+ decorators: [{
655
+ type: Component,
656
+ args: [{
657
+ selector: "vd-command-item",
658
+ template: `
659
+ <ng-content select="[slot=start]" />
660
+ <span class="vd-command-item__content">
661
+ <span class="vd-command-item__label">{{ label() }}</span>
662
+ <ng-content select="[vdCommandDescription]" />
663
+ </span>
664
+ <ng-content select="[vdCommandShortcut]" />
665
+ `,
666
+ host: {
667
+ class: "vd-command-item",
668
+ role: "option",
669
+ "[id]": "id",
670
+ "[attr.aria-label]": "label()",
671
+ "[attr.aria-describedby]": "description()?.id ?? null",
672
+ "[attr.aria-selected]": "command.activeItem() === this",
673
+ "[attr.aria-disabled]": "disabled() || command.disabled() || command.loading() || null",
674
+ "[attr.data-active]": "command.activeItem() === this ? \"\" : null",
675
+ "[hidden]": "!command.isVisible(this)",
676
+ "(click)": "command.choose(this)",
677
+ "(pointermove)": "command.hover(this, $event)",
678
+ "(pointerdown)": "$event.preventDefault()"
679
+ },
680
+ changeDetection: ChangeDetectionStrategy.OnPush,
681
+ encapsulation: ViewEncapsulation.None
682
+ }]
683
+ }],
684
+ propDecorators: {
685
+ value: [{
686
+ type: i0.Input,
687
+ args: [{
688
+ isSignal: true,
689
+ alias: "value",
690
+ required: true
691
+ }]
692
+ }],
693
+ label: [{
694
+ type: i0.Input,
695
+ args: [{
696
+ isSignal: true,
697
+ alias: "label",
698
+ required: true
699
+ }]
700
+ }],
701
+ keywords: [{
702
+ type: i0.Input,
703
+ args: [{
704
+ isSignal: true,
705
+ alias: "keywords",
706
+ required: false
707
+ }]
708
+ }],
709
+ disabled: [{
710
+ type: i0.Input,
711
+ args: [{
712
+ isSignal: true,
713
+ alias: "disabled",
714
+ required: false
715
+ }]
716
+ }],
717
+ selected: [{
718
+ type: i0.Output,
719
+ args: ["selected"]
720
+ }],
721
+ description: [{
722
+ type: i0.ContentChild,
723
+ args: [i0.forwardRef(() => VdCommandDescription), { isSignal: true }]
724
+ }]
725
+ }
726
+ });
727
+ const VD_COMMAND = [
728
+ VdCommand,
729
+ VdCommandItem,
730
+ VdCommandDescription,
731
+ VdCommandShortcut
732
+ ];
733
+ export { VD_COMMAND, VdCommand, VdCommandDescription, VdCommandItem, VdCommandShortcut };
734
+
735
+ //# sourceMappingURL=vadem-ui-command.mjs.map