@edsis/ui 0.0.2

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 (265) hide show
  1. package/README.md +40 -0
  2. package/accordion/README.md +195 -0
  3. package/alert/README.md +177 -0
  4. package/alert-dialog/README.md +239 -0
  5. package/aspect-ratio/README.md +112 -0
  6. package/avatar/README.md +176 -0
  7. package/badge/README.md +133 -0
  8. package/breadcrumb/README.md +216 -0
  9. package/button/README.md +139 -0
  10. package/button-group/README.md +204 -0
  11. package/calendar/README.md +132 -0
  12. package/card/README.md +220 -0
  13. package/carousel/README.md +276 -0
  14. package/chart/README.md +249 -0
  15. package/checkbox/README.md +149 -0
  16. package/collapsible/README.md +191 -0
  17. package/combobox/README.md +198 -0
  18. package/command/README.md +275 -0
  19. package/composer/README.md +235 -0
  20. package/context-menu/README.md +267 -0
  21. package/date-picker/README.md +177 -0
  22. package/dialog/README.md +237 -0
  23. package/drawer/README.md +145 -0
  24. package/dropdown-menu/README.md +311 -0
  25. package/editor/README.md +136 -0
  26. package/empty/README.md +183 -0
  27. package/fesm2022/edsis-ui-accordion.mjs +174 -0
  28. package/fesm2022/edsis-ui-accordion.mjs.map +1 -0
  29. package/fesm2022/edsis-ui-alert-dialog.mjs +242 -0
  30. package/fesm2022/edsis-ui-alert-dialog.mjs.map +1 -0
  31. package/fesm2022/edsis-ui-alert.mjs +90 -0
  32. package/fesm2022/edsis-ui-alert.mjs.map +1 -0
  33. package/fesm2022/edsis-ui-aspect-ratio.mjs +33 -0
  34. package/fesm2022/edsis-ui-aspect-ratio.mjs.map +1 -0
  35. package/fesm2022/edsis-ui-avatar.mjs +123 -0
  36. package/fesm2022/edsis-ui-avatar.mjs.map +1 -0
  37. package/fesm2022/edsis-ui-badge.mjs +47 -0
  38. package/fesm2022/edsis-ui-badge.mjs.map +1 -0
  39. package/fesm2022/edsis-ui-breadcrumb.mjs +186 -0
  40. package/fesm2022/edsis-ui-breadcrumb.mjs.map +1 -0
  41. package/fesm2022/edsis-ui-button-group.mjs +95 -0
  42. package/fesm2022/edsis-ui-button-group.mjs.map +1 -0
  43. package/fesm2022/edsis-ui-button.mjs +64 -0
  44. package/fesm2022/edsis-ui-button.mjs.map +1 -0
  45. package/fesm2022/edsis-ui-calendar.mjs +78 -0
  46. package/fesm2022/edsis-ui-calendar.mjs.map +1 -0
  47. package/fesm2022/edsis-ui-card.mjs +137 -0
  48. package/fesm2022/edsis-ui-card.mjs.map +1 -0
  49. package/fesm2022/edsis-ui-carousel.mjs +310 -0
  50. package/fesm2022/edsis-ui-carousel.mjs.map +1 -0
  51. package/fesm2022/edsis-ui-chart-area.mjs +6 -0
  52. package/fesm2022/edsis-ui-chart-area.mjs.map +1 -0
  53. package/fesm2022/edsis-ui-chart-bar.mjs +6 -0
  54. package/fesm2022/edsis-ui-chart-bar.mjs.map +1 -0
  55. package/fesm2022/edsis-ui-chart-line.mjs +6 -0
  56. package/fesm2022/edsis-ui-chart-line.mjs.map +1 -0
  57. package/fesm2022/edsis-ui-chart-pie.mjs +6 -0
  58. package/fesm2022/edsis-ui-chart-pie.mjs.map +1 -0
  59. package/fesm2022/edsis-ui-chart-radar.mjs +6 -0
  60. package/fesm2022/edsis-ui-chart-radar.mjs.map +1 -0
  61. package/fesm2022/edsis-ui-chart-radial.mjs +6 -0
  62. package/fesm2022/edsis-ui-chart-radial.mjs.map +1 -0
  63. package/fesm2022/edsis-ui-chart-scatter.mjs +6 -0
  64. package/fesm2022/edsis-ui-chart-scatter.mjs.map +1 -0
  65. package/fesm2022/edsis-ui-chart.mjs +3714 -0
  66. package/fesm2022/edsis-ui-chart.mjs.map +1 -0
  67. package/fesm2022/edsis-ui-checkbox.mjs +104 -0
  68. package/fesm2022/edsis-ui-checkbox.mjs.map +1 -0
  69. package/fesm2022/edsis-ui-collapsible.mjs +116 -0
  70. package/fesm2022/edsis-ui-collapsible.mjs.map +1 -0
  71. package/fesm2022/edsis-ui-combobox.mjs +263 -0
  72. package/fesm2022/edsis-ui-combobox.mjs.map +1 -0
  73. package/fesm2022/edsis-ui-command.mjs +268 -0
  74. package/fesm2022/edsis-ui-command.mjs.map +1 -0
  75. package/fesm2022/edsis-ui-composer.mjs +329 -0
  76. package/fesm2022/edsis-ui-composer.mjs.map +1 -0
  77. package/fesm2022/edsis-ui-context-menu.mjs +100 -0
  78. package/fesm2022/edsis-ui-context-menu.mjs.map +1 -0
  79. package/fesm2022/edsis-ui-date-picker.mjs +155 -0
  80. package/fesm2022/edsis-ui-date-picker.mjs.map +1 -0
  81. package/fesm2022/edsis-ui-dialog.mjs +262 -0
  82. package/fesm2022/edsis-ui-dialog.mjs.map +1 -0
  83. package/fesm2022/edsis-ui-drawer.mjs +6 -0
  84. package/fesm2022/edsis-ui-drawer.mjs.map +1 -0
  85. package/fesm2022/edsis-ui-dropdown-menu.mjs +466 -0
  86. package/fesm2022/edsis-ui-dropdown-menu.mjs.map +1 -0
  87. package/fesm2022/edsis-ui-editor.mjs +692 -0
  88. package/fesm2022/edsis-ui-editor.mjs.map +1 -0
  89. package/fesm2022/edsis-ui-empty.mjs +132 -0
  90. package/fesm2022/edsis-ui-empty.mjs.map +1 -0
  91. package/fesm2022/edsis-ui-form.mjs +334 -0
  92. package/fesm2022/edsis-ui-form.mjs.map +1 -0
  93. package/fesm2022/edsis-ui-hover-card.mjs +284 -0
  94. package/fesm2022/edsis-ui-hover-card.mjs.map +1 -0
  95. package/fesm2022/edsis-ui-input-group.mjs +164 -0
  96. package/fesm2022/edsis-ui-input-group.mjs.map +1 -0
  97. package/fesm2022/edsis-ui-input-otp.mjs +485 -0
  98. package/fesm2022/edsis-ui-input-otp.mjs.map +1 -0
  99. package/fesm2022/edsis-ui-input.mjs +43 -0
  100. package/fesm2022/edsis-ui-input.mjs.map +1 -0
  101. package/fesm2022/edsis-ui-item.mjs +241 -0
  102. package/fesm2022/edsis-ui-item.mjs.map +1 -0
  103. package/fesm2022/edsis-ui-kanban.mjs +289 -0
  104. package/fesm2022/edsis-ui-kanban.mjs.map +1 -0
  105. package/fesm2022/edsis-ui-kbd.mjs +51 -0
  106. package/fesm2022/edsis-ui-kbd.mjs.map +1 -0
  107. package/fesm2022/edsis-ui-label.mjs +30 -0
  108. package/fesm2022/edsis-ui-label.mjs.map +1 -0
  109. package/fesm2022/edsis-ui-menubar.mjs +302 -0
  110. package/fesm2022/edsis-ui-menubar.mjs.map +1 -0
  111. package/fesm2022/edsis-ui-native-select.mjs +61 -0
  112. package/fesm2022/edsis-ui-native-select.mjs.map +1 -0
  113. package/fesm2022/edsis-ui-navigation-menu.mjs +399 -0
  114. package/fesm2022/edsis-ui-navigation-menu.mjs.map +1 -0
  115. package/fesm2022/edsis-ui-pagination.mjs +216 -0
  116. package/fesm2022/edsis-ui-pagination.mjs.map +1 -0
  117. package/fesm2022/edsis-ui-pillbox.mjs +777 -0
  118. package/fesm2022/edsis-ui-pillbox.mjs.map +1 -0
  119. package/fesm2022/edsis-ui-popover.mjs +163 -0
  120. package/fesm2022/edsis-ui-popover.mjs.map +1 -0
  121. package/fesm2022/edsis-ui-progress.mjs +53 -0
  122. package/fesm2022/edsis-ui-progress.mjs.map +1 -0
  123. package/fesm2022/edsis-ui-radio.mjs +111 -0
  124. package/fesm2022/edsis-ui-radio.mjs.map +1 -0
  125. package/fesm2022/edsis-ui-resizable.mjs +454 -0
  126. package/fesm2022/edsis-ui-resizable.mjs.map +1 -0
  127. package/fesm2022/edsis-ui-scroll-area.mjs +48 -0
  128. package/fesm2022/edsis-ui-scroll-area.mjs.map +1 -0
  129. package/fesm2022/edsis-ui-select.mjs +164 -0
  130. package/fesm2022/edsis-ui-select.mjs.map +1 -0
  131. package/fesm2022/edsis-ui-separator.mjs +33 -0
  132. package/fesm2022/edsis-ui-separator.mjs.map +1 -0
  133. package/fesm2022/edsis-ui-sheet.mjs +264 -0
  134. package/fesm2022/edsis-ui-sheet.mjs.map +1 -0
  135. package/fesm2022/edsis-ui-skeleton.mjs +29 -0
  136. package/fesm2022/edsis-ui-skeleton.mjs.map +1 -0
  137. package/fesm2022/edsis-ui-slider.mjs +405 -0
  138. package/fesm2022/edsis-ui-slider.mjs.map +1 -0
  139. package/fesm2022/edsis-ui-spinner.mjs +58 -0
  140. package/fesm2022/edsis-ui-spinner.mjs.map +1 -0
  141. package/fesm2022/edsis-ui-switch.mjs +107 -0
  142. package/fesm2022/edsis-ui-switch.mjs.map +1 -0
  143. package/fesm2022/edsis-ui-table.mjs +139 -0
  144. package/fesm2022/edsis-ui-table.mjs.map +1 -0
  145. package/fesm2022/edsis-ui-tabs.mjs +252 -0
  146. package/fesm2022/edsis-ui-tabs.mjs.map +1 -0
  147. package/fesm2022/edsis-ui-textarea.mjs +37 -0
  148. package/fesm2022/edsis-ui-textarea.mjs.map +1 -0
  149. package/fesm2022/edsis-ui-timeline.mjs +213 -0
  150. package/fesm2022/edsis-ui-timeline.mjs.map +1 -0
  151. package/fesm2022/edsis-ui-toast.mjs +71 -0
  152. package/fesm2022/edsis-ui-toast.mjs.map +1 -0
  153. package/fesm2022/edsis-ui-toggle-group.mjs +269 -0
  154. package/fesm2022/edsis-ui-toggle-group.mjs.map +1 -0
  155. package/fesm2022/edsis-ui-toggle.mjs +76 -0
  156. package/fesm2022/edsis-ui-toggle.mjs.map +1 -0
  157. package/fesm2022/edsis-ui-tooltip.mjs +339 -0
  158. package/fesm2022/edsis-ui-tooltip.mjs.map +1 -0
  159. package/fesm2022/edsis-ui-utils.mjs +13 -0
  160. package/fesm2022/edsis-ui-utils.mjs.map +1 -0
  161. package/fesm2022/edsis-ui.mjs +11 -0
  162. package/fesm2022/edsis-ui.mjs.map +1 -0
  163. package/form/README.md +210 -0
  164. package/hover-card/README.md +146 -0
  165. package/input/README.md +159 -0
  166. package/input-group/README.md +234 -0
  167. package/input-otp/README.md +273 -0
  168. package/item/README.md +247 -0
  169. package/kanban/README.md +81 -0
  170. package/kbd/README.md +139 -0
  171. package/label/README.md +136 -0
  172. package/menubar/README.md +269 -0
  173. package/native-select/README.md +176 -0
  174. package/navigation-menu/README.md +160 -0
  175. package/package.json +310 -0
  176. package/pagination/README.md +144 -0
  177. package/pillbox/README.md +67 -0
  178. package/popover/README.md +43 -0
  179. package/progress/README.md +160 -0
  180. package/radio/README.md +209 -0
  181. package/resizable/README.md +164 -0
  182. package/scroll-area/README.md +143 -0
  183. package/select/README.md +174 -0
  184. package/separator/README.md +170 -0
  185. package/sheet/README.md +183 -0
  186. package/skeleton/README.md +158 -0
  187. package/slider/README.md +207 -0
  188. package/spinner/README.md +160 -0
  189. package/switch/README.md +166 -0
  190. package/table/README.md +291 -0
  191. package/tabs/README.md +214 -0
  192. package/textarea/README.md +154 -0
  193. package/timeline/README.md +94 -0
  194. package/toast/README.md +321 -0
  195. package/toggle/README.md +131 -0
  196. package/toggle-group/README.md +206 -0
  197. package/tooltip/README.md +211 -0
  198. package/types/edsis-ui-accordion.d.ts +51 -0
  199. package/types/edsis-ui-alert-dialog.d.ts +93 -0
  200. package/types/edsis-ui-alert.d.ts +37 -0
  201. package/types/edsis-ui-aspect-ratio.d.ts +12 -0
  202. package/types/edsis-ui-avatar.d.ts +51 -0
  203. package/types/edsis-ui-badge.d.ts +19 -0
  204. package/types/edsis-ui-breadcrumb.d.ts +46 -0
  205. package/types/edsis-ui-button-group.d.ts +26 -0
  206. package/types/edsis-ui-button.d.ts +22 -0
  207. package/types/edsis-ui-calendar.d.ts +33 -0
  208. package/types/edsis-ui-card.d.ts +60 -0
  209. package/types/edsis-ui-carousel.d.ts +86 -0
  210. package/types/edsis-ui-chart-area.d.ts +1 -0
  211. package/types/edsis-ui-chart-bar.d.ts +1 -0
  212. package/types/edsis-ui-chart-line.d.ts +1 -0
  213. package/types/edsis-ui-chart-pie.d.ts +1 -0
  214. package/types/edsis-ui-chart-radar.d.ts +1 -0
  215. package/types/edsis-ui-chart-radial.d.ts +1 -0
  216. package/types/edsis-ui-chart-scatter.d.ts +1 -0
  217. package/types/edsis-ui-chart.d.ts +1094 -0
  218. package/types/edsis-ui-checkbox.d.ts +35 -0
  219. package/types/edsis-ui-collapsible.d.ts +42 -0
  220. package/types/edsis-ui-combobox.d.ts +51 -0
  221. package/types/edsis-ui-command.d.ts +99 -0
  222. package/types/edsis-ui-composer.d.ts +90 -0
  223. package/types/edsis-ui-context-menu.d.ts +35 -0
  224. package/types/edsis-ui-date-picker.d.ts +41 -0
  225. package/types/edsis-ui-dialog.d.ts +87 -0
  226. package/types/edsis-ui-drawer.d.ts +1 -0
  227. package/types/edsis-ui-dropdown-menu.d.ts +136 -0
  228. package/types/edsis-ui-editor.d.ts +123 -0
  229. package/types/edsis-ui-empty.d.ts +50 -0
  230. package/types/edsis-ui-form.d.ts +141 -0
  231. package/types/edsis-ui-hover-card.d.ts +74 -0
  232. package/types/edsis-ui-input-group.d.ts +51 -0
  233. package/types/edsis-ui-input-otp.d.ts +136 -0
  234. package/types/edsis-ui-input.d.ts +16 -0
  235. package/types/edsis-ui-item.d.ts +88 -0
  236. package/types/edsis-ui-kanban.d.ts +70 -0
  237. package/types/edsis-ui-kbd.d.ts +16 -0
  238. package/types/edsis-ui-label.d.ts +11 -0
  239. package/types/edsis-ui-menubar.d.ts +67 -0
  240. package/types/edsis-ui-native-select.d.ts +26 -0
  241. package/types/edsis-ui-navigation-menu.d.ts +96 -0
  242. package/types/edsis-ui-pagination.d.ts +34 -0
  243. package/types/edsis-ui-pillbox.d.ts +157 -0
  244. package/types/edsis-ui-popover.d.ts +43 -0
  245. package/types/edsis-ui-progress.d.ts +17 -0
  246. package/types/edsis-ui-radio.d.ts +40 -0
  247. package/types/edsis-ui-resizable.d.ts +99 -0
  248. package/types/edsis-ui-scroll-area.d.ts +19 -0
  249. package/types/edsis-ui-select.d.ts +57 -0
  250. package/types/edsis-ui-separator.d.ts +14 -0
  251. package/types/edsis-ui-sheet.d.ts +76 -0
  252. package/types/edsis-ui-skeleton.d.ts +10 -0
  253. package/types/edsis-ui-slider.d.ts +74 -0
  254. package/types/edsis-ui-spinner.d.ts +13 -0
  255. package/types/edsis-ui-switch.d.ts +40 -0
  256. package/types/edsis-ui-table.d.ts +52 -0
  257. package/types/edsis-ui-tabs.d.ts +92 -0
  258. package/types/edsis-ui-textarea.d.ts +12 -0
  259. package/types/edsis-ui-timeline.d.ts +63 -0
  260. package/types/edsis-ui-toast.d.ts +38 -0
  261. package/types/edsis-ui-toggle-group.d.ts +89 -0
  262. package/types/edsis-ui-toggle.d.ts +25 -0
  263. package/types/edsis-ui-tooltip.d.ts +89 -0
  264. package/types/edsis-ui-utils.d.ts +5 -0
  265. package/types/edsis-ui.d.ts +2 -0
@@ -0,0 +1,777 @@
1
+ import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, TemplateRef, Directive, ElementRef, contentChild, input, booleanAttribute, output, computed, ChangeDetectionStrategy, Component, numberAttribute, DestroyRef, signal, viewChild, contentChildren, forwardRef } from '@angular/core';
4
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import { cn } from '@edsis/ui/utils';
6
+
7
+ class PillboxContext {
8
+ }
9
+ let nextPillboxId = 0;
10
+ const pillboxTriggerSizeClasses = {
11
+ default: 'min-h-10 px-3 py-2 text-sm',
12
+ sm: 'min-h-8 px-2.5 py-1.5 text-xs',
13
+ };
14
+ const pillboxPillSizeClasses = {
15
+ default: 'min-h-6 px-2 text-xs',
16
+ sm: 'min-h-5 px-1.5 text-[0.6875rem]',
17
+ };
18
+ class PillboxSelectedDirective {
19
+ template = inject(TemplateRef);
20
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PillboxSelectedDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
21
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.14", type: PillboxSelectedDirective, isStandalone: true, selector: "ng-template[uiPillboxSelected]", exportAs: ["uiPillboxSelected"], ngImport: i0 });
22
+ }
23
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PillboxSelectedDirective, decorators: [{
24
+ type: Directive,
25
+ args: [{
26
+ selector: 'ng-template[uiPillboxSelected]',
27
+ exportAs: 'uiPillboxSelected',
28
+ }]
29
+ }] });
30
+ class PillboxOptionComponent {
31
+ context = inject(PillboxContext);
32
+ element = inject(ElementRef);
33
+ selectedTemplate = contentChild(PillboxSelectedDirective, ...(ngDevMode ? [{ debugName: "selectedTemplate" }] : /* istanbul ignore next */ []));
34
+ value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
35
+ label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
36
+ selectedLabel = input('', ...(ngDevMode ? [{ debugName: "selectedLabel" }] : /* istanbul ignore next */ []));
37
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
38
+ filterable = input(true, { ...(ngDevMode ? { debugName: "filterable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
39
+ class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
40
+ selectedChange = output();
41
+ selected = computed(() => this.context.optionSelected(this), ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
42
+ visible = computed(() => this.context.optionVisible(this), ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
43
+ classes = computed(() => cn('relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors', 'hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground', 'data-[selected]:bg-accent data-[selected]:text-accent-foreground', 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50', this.class()), ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
44
+ textLabel() {
45
+ return (this.label() || this.element.nativeElement.textContent || String(this.value())).trim();
46
+ }
47
+ pillLabel() {
48
+ return (this.selectedLabel() || this.textLabel()).trim();
49
+ }
50
+ pillTemplate() {
51
+ return this.selectedTemplate()?.template ?? null;
52
+ }
53
+ handleClick(event) {
54
+ this.context.chooseOption(this, event);
55
+ }
56
+ handleKeydown(event) {
57
+ event.preventDefault();
58
+ this.context.chooseOption(this, event);
59
+ }
60
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PillboxOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
61
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: PillboxOptionComponent, isStandalone: true, selector: "ui-pillbox-option, button[ui-pillbox-option]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, selectedLabel: { classPropertyName: "selectedLabel", publicName: "selectedLabel", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange" }, host: { attributes: { "type": "button" }, listeners: { "click": "handleClick($event)", "keydown.enter": "handleKeydown($any($event))", "keydown.space": "handleKeydown($any($event))" }, properties: { "class": "classes()", "attr.data-slot": "\"pillbox-option\"", "attr.data-selected": "selected() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null", "attr.role": "\"option\"", "attr.aria-selected": "selected()", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.tabindex": "disabled() ? -1 : 0", "hidden": "!visible()" } }, queries: [{ propertyName: "selectedTemplate", first: true, predicate: PillboxSelectedDirective, descendants: true, isSignal: true }], ngImport: i0, template: `
62
+ <span class="min-w-0 flex-1 truncate text-left"><ng-content /></span>
63
+ @if (selected()) {
64
+ <svg
65
+ aria-hidden="true"
66
+ class="ml-auto size-4 shrink-0"
67
+ viewBox="0 0 24 24"
68
+ fill="none"
69
+ stroke="currentColor"
70
+ stroke-width="1.75"
71
+ stroke-linecap="round"
72
+ stroke-linejoin="round">
73
+ <path d="M20 6 9 17l-5-5" />
74
+ </svg>
75
+ }
76
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
77
+ }
78
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PillboxOptionComponent, decorators: [{
79
+ type: Component,
80
+ args: [{
81
+ selector: 'ui-pillbox-option, button[ui-pillbox-option]',
82
+ changeDetection: ChangeDetectionStrategy.OnPush,
83
+ host: {
84
+ type: 'button',
85
+ '[class]': 'classes()',
86
+ '[attr.data-slot]': '"pillbox-option"',
87
+ '[attr.data-selected]': 'selected() ? "" : null',
88
+ '[attr.data-disabled]': 'disabled() ? "" : null',
89
+ '[attr.role]': '"option"',
90
+ '[attr.aria-selected]': 'selected()',
91
+ '[attr.aria-disabled]': 'disabled() ? "true" : null',
92
+ '[attr.tabindex]': 'disabled() ? -1 : 0',
93
+ '[hidden]': '!visible()',
94
+ '(click)': 'handleClick($event)',
95
+ '(keydown.enter)': 'handleKeydown($any($event))',
96
+ '(keydown.space)': 'handleKeydown($any($event))',
97
+ },
98
+ template: `
99
+ <span class="min-w-0 flex-1 truncate text-left"><ng-content /></span>
100
+ @if (selected()) {
101
+ <svg
102
+ aria-hidden="true"
103
+ class="ml-auto size-4 shrink-0"
104
+ viewBox="0 0 24 24"
105
+ fill="none"
106
+ stroke="currentColor"
107
+ stroke-width="1.75"
108
+ stroke-linecap="round"
109
+ stroke-linejoin="round">
110
+ <path d="M20 6 9 17l-5-5" />
111
+ </svg>
112
+ }
113
+ `,
114
+ }]
115
+ }], propDecorators: { selectedTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PillboxSelectedDirective), { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], selectedLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedLabel", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], filterable: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterable", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }] } });
116
+ class PillboxOptionCreateComponent {
117
+ context = inject(PillboxContext);
118
+ minLength = input(1, { ...(ngDevMode ? { debugName: "minLength" } : /* istanbul ignore next */ {}), transform: numberAttribute });
119
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
120
+ class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
121
+ selected = output();
122
+ visible = computed(() => this.context.createVisible(this), ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
123
+ classes = computed(() => cn('relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm font-medium text-primary outline-none transition-colors', 'hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground', 'aria-disabled:pointer-events-none aria-disabled:opacity-50', this.class()), ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
124
+ handleClick(event) {
125
+ this.context.chooseCreate(this, event);
126
+ }
127
+ handleKeydown(event) {
128
+ event.preventDefault();
129
+ this.context.chooseCreate(this, event);
130
+ }
131
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PillboxOptionCreateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
132
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.14", type: PillboxOptionCreateComponent, isStandalone: true, selector: "ui-pillbox-option-create, button[ui-pillbox-option-create]", inputs: { minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected" }, host: { attributes: { "type": "button" }, listeners: { "click": "handleClick($event)", "keydown.enter": "handleKeydown($any($event))", "keydown.space": "handleKeydown($any($event))" }, properties: { "class": "classes()", "attr.data-slot": "\"pillbox-option-create\"", "attr.role": "\"option\"", "attr.tabindex": "disabled() ? -1 : 0", "attr.aria-disabled": "disabled() ? \"true\" : null", "hidden": "!visible()" } }, ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
133
+ }
134
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PillboxOptionCreateComponent, decorators: [{
135
+ type: Component,
136
+ args: [{
137
+ selector: 'ui-pillbox-option-create, button[ui-pillbox-option-create]',
138
+ changeDetection: ChangeDetectionStrategy.OnPush,
139
+ host: {
140
+ type: 'button',
141
+ '[class]': 'classes()',
142
+ '[attr.data-slot]': '"pillbox-option-create"',
143
+ '[attr.role]': '"option"',
144
+ '[attr.tabindex]': 'disabled() ? -1 : 0',
145
+ '[attr.aria-disabled]': 'disabled() ? "true" : null',
146
+ '[hidden]': '!visible()',
147
+ '(click)': 'handleClick($event)',
148
+ '(keydown.enter)': 'handleKeydown($any($event))',
149
+ '(keydown.space)': 'handleKeydown($any($event))',
150
+ },
151
+ template: `<ng-content />`,
152
+ }]
153
+ }], propDecorators: { minLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minLength", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], selected: [{ type: i0.Output, args: ["selected"] }] } });
154
+ class PillboxOptionEmptyComponent {
155
+ context = inject(PillboxContext);
156
+ whenLoading = input('', ...(ngDevMode ? [{ debugName: "whenLoading" }] : /* istanbul ignore next */ []));
157
+ class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
158
+ classes = computed(() => cn('px-2 py-6 text-center text-sm text-muted-foreground', this.class()), ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
159
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PillboxOptionEmptyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
160
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: PillboxOptionEmptyComponent, isStandalone: true, selector: "ui-pillbox-option-empty", inputs: { whenLoading: { classPropertyName: "whenLoading", publicName: "whenLoading", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "presentation" }, properties: { "class": "classes()", "attr.data-slot": "\"pillbox-option-empty\"", "hidden": "!context.emptyVisible()" } }, ngImport: i0, template: `
161
+ @if (context.emptyMessage()) {
162
+ {{ context.emptyMessage() }}
163
+ } @else {
164
+ <ng-content />
165
+ }
166
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
167
+ }
168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PillboxOptionEmptyComponent, decorators: [{
169
+ type: Component,
170
+ args: [{
171
+ selector: 'ui-pillbox-option-empty',
172
+ changeDetection: ChangeDetectionStrategy.OnPush,
173
+ host: {
174
+ '[class]': 'classes()',
175
+ '[attr.data-slot]': '"pillbox-option-empty"',
176
+ role: 'presentation',
177
+ '[hidden]': '!context.emptyVisible()',
178
+ },
179
+ template: `
180
+ @if (context.emptyMessage()) {
181
+ {{ context.emptyMessage() }}
182
+ } @else {
183
+ <ng-content />
184
+ }
185
+ `,
186
+ }]
187
+ }], propDecorators: { whenLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "whenLoading", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
188
+ class PillboxComponent extends PillboxContext {
189
+ element = inject(ElementRef);
190
+ document = inject(DOCUMENT);
191
+ destroyRef = inject(DestroyRef);
192
+ id = input(null, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
193
+ placeholder = input('Choose options...', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
194
+ searchPlaceholder = input('Search...', ...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []));
195
+ size = input('default', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
196
+ variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
197
+ multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
198
+ searchable = input(false, { ...(ngDevMode ? { debugName: "searchable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
199
+ filter = input(true, { ...(ngDevMode ? { debugName: "filter" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
200
+ clearable = input(true, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
201
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
202
+ invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
203
+ loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
204
+ emptyText = input('No options found.', ...(ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []));
205
+ loadingText = input('Loading...', ...(ngDevMode ? [{ debugName: "loadingText" }] : /* istanbul ignore next */ []));
206
+ ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
207
+ ariaDescribedby = input(null, { ...(ngDevMode ? { debugName: "ariaDescribedby" } : /* istanbul ignore next */ {}), alias: 'aria-describedby' });
208
+ ariaLabelledby = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
209
+ class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
210
+ valueChange = output();
211
+ searchChange = output();
212
+ create = output();
213
+ openedChange = output();
214
+ query = signal('', ...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
215
+ openState = signal(false, ...(ngDevMode ? [{ debugName: "openState" }] : /* istanbul ignore next */ []));
216
+ selectedValues = signal([], ...(ngDevMode ? [{ debugName: "selectedValues" }] : /* istanbul ignore next */ []));
217
+ disabledFromControl = signal(false, ...(ngDevMode ? [{ debugName: "disabledFromControl" }] : /* istanbul ignore next */ []));
218
+ generatedId = `ui-pillbox-${++nextPillboxId}`;
219
+ trigger = viewChild.required('trigger');
220
+ inlineSearch = viewChild('inlineSearch', ...(ngDevMode ? [{ debugName: "inlineSearch" }] : /* istanbul ignore next */ []));
221
+ panelSearch = viewChild('panelSearch', ...(ngDevMode ? [{ debugName: "panelSearch" }] : /* istanbul ignore next */ []));
222
+ options = contentChildren(PillboxOptionComponent, { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), descendants: true });
223
+ createOptions = contentChildren(PillboxOptionCreateComponent, { ...(ngDevMode ? { debugName: "createOptions" } : /* istanbul ignore next */ {}), descendants: true });
224
+ emptyOptions = contentChildren(PillboxOptionEmptyComponent, { ...(ngDevMode ? { debugName: "emptyOptions" } : /* istanbul ignore next */ {}), descendants: true });
225
+ removeDocumentListener = null;
226
+ onChange = () => { };
227
+ onTouched = () => { };
228
+ panelId = `${this.generatedId}-panel`;
229
+ resolvedId = computed(() => this.id() ?? this.generatedId, ...(ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []));
230
+ disabledState = computed(() => this.disabled() || this.disabledFromControl(), ...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
231
+ classes = computed(() => cn('relative block w-full min-w-0 text-sm text-foreground', this.class()), ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
232
+ triggerClasses = computed(() => cn('flex w-full min-w-0 cursor-default items-center gap-2 rounded-md border border-input bg-background shadow-sm transition-colors', 'focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background', 'hover:bg-accent/20', pillboxTriggerSizeClasses[this.size()], this.invalid() ? 'border-destructive ring-1 ring-destructive' : '', this.disabledState() ? 'pointer-events-none cursor-not-allowed opacity-50' : ''), ...(ngDevMode ? [{ debugName: "triggerClasses" }] : /* istanbul ignore next */ []));
233
+ pillClasses = computed(() => cn('inline-flex max-w-full shrink-0 items-center gap-1 rounded-md border border-border bg-muted font-medium text-muted-foreground', pillboxPillSizeClasses[this.size()]), ...(ngDevMode ? [{ debugName: "pillClasses" }] : /* istanbul ignore next */ []));
234
+ panelClasses = computed(() => cn('absolute left-0 right-0 z-50 mt-1 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md', 'min-w-full'), ...(ngDevMode ? [{ debugName: "panelClasses" }] : /* istanbul ignore next */ []));
235
+ selectedItems = computed(() => this.selectedValues().map((value, index) => {
236
+ const option = this.findOption(value);
237
+ return {
238
+ value,
239
+ label: option?.pillLabel() || String(value),
240
+ template: option?.pillTemplate() ?? null,
241
+ track: this.trackValue(value, index),
242
+ };
243
+ }), ...(ngDevMode ? [{ debugName: "selectedItems" }] : /* istanbul ignore next */ []));
244
+ constructor() {
245
+ super();
246
+ this.destroyRef.onDestroy(() => this.removeOutsideListener());
247
+ }
248
+ optionVisible(option) {
249
+ if (!this.filter() || !option.filterable()) {
250
+ return true;
251
+ }
252
+ const query = this.query().trim().toLowerCase();
253
+ if (!query) {
254
+ return true;
255
+ }
256
+ return option.textLabel().toLowerCase().includes(query);
257
+ }
258
+ optionSelected(option) {
259
+ return this.hasValue(option.value());
260
+ }
261
+ chooseOption(option, event) {
262
+ event.preventDefault();
263
+ event.stopPropagation();
264
+ if (this.disabledState() || option.disabled()) {
265
+ return;
266
+ }
267
+ if (this.multiple()) {
268
+ const value = option.value();
269
+ this.selectedValues.update((values) => values.some((entry) => this.sameValue(entry, value))
270
+ ? values.filter((entry) => !this.sameValue(entry, value))
271
+ : [...values, value]);
272
+ }
273
+ else {
274
+ this.selectedValues.set([option.value()]);
275
+ this.close();
276
+ }
277
+ option.selectedChange.emit(option.value());
278
+ this.query.set('');
279
+ this.emitValue();
280
+ }
281
+ createVisible(option) {
282
+ const query = this.query().trim();
283
+ if (option.disabled() || query.length < option.minLength()) {
284
+ return false;
285
+ }
286
+ return !this.options().some((entry) => entry.textLabel().trim().toLowerCase() === query.toLowerCase());
287
+ }
288
+ chooseCreate(option, event) {
289
+ event.preventDefault();
290
+ event.stopPropagation();
291
+ const query = this.query().trim();
292
+ if (this.disabledState() || option.disabled() || !this.createVisible(option)) {
293
+ return;
294
+ }
295
+ option.selected.emit(query);
296
+ this.create.emit(query);
297
+ }
298
+ emptyVisible() {
299
+ return this.options().length > 0 && !this.hasVisibleOptions() && !this.hasVisibleCreateOption();
300
+ }
301
+ emptyMessage() {
302
+ const customEmptyOption = this.emptyOptions()[0];
303
+ if (this.loading()) {
304
+ return customEmptyOption?.whenLoading() || this.loadingText();
305
+ }
306
+ return customEmptyOption ? '' : this.emptyText();
307
+ }
308
+ handleTriggerClick() {
309
+ this.open();
310
+ }
311
+ handleTriggerKeydown(event) {
312
+ if (this.disabledState()) {
313
+ return;
314
+ }
315
+ event.preventDefault();
316
+ this.open();
317
+ }
318
+ handleSearchInput(event) {
319
+ const inputElement = event.target;
320
+ this.query.set(inputElement.value);
321
+ this.searchChange.emit(inputElement.value);
322
+ this.open();
323
+ }
324
+ handleInlineBackspace(event) {
325
+ if (event.target.value.length > 0 || this.selectedValues().length === 0) {
326
+ return;
327
+ }
328
+ event.preventDefault();
329
+ this.selectedValues.update((values) => values.slice(0, -1));
330
+ this.emitValue();
331
+ }
332
+ clearSearch(event) {
333
+ event.preventDefault();
334
+ event.stopPropagation();
335
+ this.query.set('');
336
+ this.searchChange.emit('');
337
+ this.focusSearchInput();
338
+ }
339
+ clear(event) {
340
+ event.preventDefault();
341
+ event.stopPropagation();
342
+ this.selectedValues.set([]);
343
+ this.emitValue();
344
+ }
345
+ removeSelected(value, event) {
346
+ event.preventDefault();
347
+ event.stopPropagation();
348
+ this.selectedValues.update((values) => values.filter((entry) => !this.sameValue(entry, value)));
349
+ this.emitValue();
350
+ }
351
+ open() {
352
+ if (this.disabledState() || this.openState()) {
353
+ return;
354
+ }
355
+ this.openState.set(true);
356
+ this.openedChange.emit(true);
357
+ queueMicrotask(() => {
358
+ this.focusSearchInput();
359
+ this.bindOutsideListener();
360
+ });
361
+ }
362
+ close() {
363
+ if (!this.openState()) {
364
+ return;
365
+ }
366
+ this.openState.set(false);
367
+ this.openedChange.emit(false);
368
+ this.removeOutsideListener();
369
+ this.onTouched();
370
+ }
371
+ focus() {
372
+ this.trigger().nativeElement.focus();
373
+ }
374
+ writeValue(value) {
375
+ if (this.multiple()) {
376
+ this.selectedValues.set(Array.isArray(value) ? value : []);
377
+ return;
378
+ }
379
+ this.selectedValues.set(value === null || value === undefined ? [] : [value]);
380
+ }
381
+ registerOnChange(fn) {
382
+ this.onChange = fn;
383
+ }
384
+ registerOnTouched(fn) {
385
+ this.onTouched = fn;
386
+ }
387
+ setDisabledState(disabled) {
388
+ this.disabledFromControl.set(disabled);
389
+ }
390
+ emitValue() {
391
+ const nextValue = this.multiple() ? [...this.selectedValues()] : (this.selectedValues()[0] ?? null);
392
+ this.onChange(nextValue);
393
+ this.valueChange.emit(nextValue);
394
+ }
395
+ hasValue(value) {
396
+ return this.selectedValues().some((entry) => this.sameValue(entry, value));
397
+ }
398
+ findOption(value) {
399
+ return this.options().find((option) => this.sameValue(option.value(), value));
400
+ }
401
+ hasVisibleOptions() {
402
+ return this.options().some((option) => this.optionVisible(option));
403
+ }
404
+ hasVisibleCreateOption() {
405
+ return this.createOptions().some((option) => this.createVisible(option));
406
+ }
407
+ sameValue(left, right) {
408
+ return Object.is(left, right);
409
+ }
410
+ trackValue(value, index) {
411
+ return typeof value === 'object' && value !== null ? index : value;
412
+ }
413
+ focusSearchInput() {
414
+ const searchInput = this.variant() === 'combobox' ? this.inlineSearch()?.nativeElement : this.panelSearch()?.nativeElement;
415
+ searchInput?.focus();
416
+ }
417
+ bindOutsideListener() {
418
+ this.removeOutsideListener();
419
+ const listener = (event) => {
420
+ if (!this.element.nativeElement.contains(event.target)) {
421
+ this.close();
422
+ }
423
+ };
424
+ this.document.addEventListener('pointerdown', listener, true);
425
+ this.removeDocumentListener = () => this.document.removeEventListener('pointerdown', listener, true);
426
+ }
427
+ removeOutsideListener() {
428
+ this.removeDocumentListener?.();
429
+ this.removeDocumentListener = null;
430
+ }
431
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PillboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
432
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: PillboxComponent, isStandalone: true, selector: "ui-pillbox", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: true, isRequired: false, transformFunction: null }, loadingText: { classPropertyName: "loadingText", publicName: "loadingText", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", searchChange: "searchChange", create: "create", openedChange: "openedChange" }, host: { properties: { "class": "classes()", "attr.data-slot": "\"pillbox\"", "attr.data-open": "openState() ? \"\" : null", "attr.data-size": "size()", "attr.data-variant": "variant()" } }, providers: [
433
+ { provide: PillboxContext, useExisting: forwardRef(() => PillboxComponent) },
434
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => PillboxComponent), multi: true },
435
+ ], queries: [{ propertyName: "options", predicate: PillboxOptionComponent, descendants: true, isSignal: true }, { propertyName: "createOptions", predicate: PillboxOptionCreateComponent, descendants: true, isSignal: true }, { propertyName: "emptyOptions", predicate: PillboxOptionEmptyComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "inlineSearch", first: true, predicate: ["inlineSearch"], descendants: true, isSignal: true }, { propertyName: "panelSearch", first: true, predicate: ["panelSearch"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
436
+ <div
437
+ #trigger
438
+ [attr.id]="resolvedId()"
439
+ role="combobox"
440
+ aria-haspopup="listbox"
441
+ [attr.aria-expanded]="openState()"
442
+ [attr.aria-controls]="openState() ? panelId : null"
443
+ [attr.aria-label]="ariaLabel()"
444
+ [attr.aria-labelledby]="ariaLabelledby()"
445
+ [attr.aria-describedby]="ariaDescribedby()"
446
+ [attr.aria-invalid]="invalid() ? 'true' : null"
447
+ [attr.aria-disabled]="disabledState() ? 'true' : null"
448
+ [attr.tabindex]="disabledState() ? -1 : 0"
449
+ [class]="triggerClasses()"
450
+ (click)="handleTriggerClick()"
451
+ (keydown.enter)="handleTriggerKeydown($any($event))"
452
+ (keydown.space)="handleTriggerKeydown($any($event))"
453
+ (keydown.arrowDown)="handleTriggerKeydown($any($event))"
454
+ (keydown.escape)="close()">
455
+ <div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5">
456
+ @if (selectedItems().length > 0) {
457
+ @for (item of selectedItems(); track item.track) {
458
+ <span [class]="pillClasses()">
459
+ @if (item.template; as template) {
460
+ <span class="inline-flex min-w-0 max-w-40 items-center gap-1 truncate">
461
+ <ng-container *ngTemplateOutlet="template" />
462
+ </span>
463
+ } @else {
464
+ <span class="max-w-40 truncate">{{ item.label }}</span>
465
+ }
466
+ <button
467
+ type="button"
468
+ class="-mr-1 inline-flex size-4 items-center justify-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
469
+ [attr.aria-label]="'Remove ' + item.label"
470
+ [disabled]="disabledState() || null"
471
+ (click)="removeSelected(item.value, $event)">
472
+ <svg
473
+ aria-hidden="true"
474
+ class="size-3"
475
+ viewBox="0 0 24 24"
476
+ fill="none"
477
+ stroke="currentColor"
478
+ stroke-width="2"
479
+ stroke-linecap="round"
480
+ stroke-linejoin="round">
481
+ <path d="M18 6 6 18" />
482
+ <path d="m6 6 12 12" />
483
+ </svg>
484
+ </button>
485
+ </span>
486
+ }
487
+ }
488
+
489
+ @if (variant() === 'combobox') {
490
+ <input
491
+ #inlineSearch
492
+ class="min-w-28 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed"
493
+ [placeholder]="selectedItems().length === 0 ? placeholder() : ''"
494
+ [value]="query()"
495
+ [disabled]="disabledState() || null"
496
+ (click)="$event.stopPropagation(); open()"
497
+ (focus)="open()"
498
+ (input)="handleSearchInput($event)"
499
+ (keydown.backspace)="handleInlineBackspace($any($event))"
500
+ (keydown.escape)="close()" />
501
+ } @else if (selectedItems().length === 0) {
502
+ <span class="truncate text-muted-foreground">{{ placeholder() }}</span>
503
+ }
504
+ </div>
505
+
506
+ @if (clearable() && selectedItems().length > 0 && !disabledState()) {
507
+ <button
508
+ type="button"
509
+ class="inline-flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
510
+ aria-label="Clear selected options"
511
+ (click)="clear($event)">
512
+ <svg
513
+ aria-hidden="true"
514
+ class="size-3.5"
515
+ viewBox="0 0 24 24"
516
+ fill="none"
517
+ stroke="currentColor"
518
+ stroke-width="2"
519
+ stroke-linecap="round"
520
+ stroke-linejoin="round">
521
+ <path d="M18 6 6 18" />
522
+ <path d="m6 6 12 12" />
523
+ </svg>
524
+ </button>
525
+ }
526
+
527
+ <svg
528
+ aria-hidden="true"
529
+ class="size-4 shrink-0 text-muted-foreground transition-transform"
530
+ [class.rotate-180]="openState()"
531
+ viewBox="0 0 24 24"
532
+ fill="none"
533
+ stroke="currentColor"
534
+ stroke-width="1.75"
535
+ stroke-linecap="round"
536
+ stroke-linejoin="round">
537
+ <path d="m6 9 6 6 6-6" />
538
+ </svg>
539
+ </div>
540
+
541
+ <div [attr.id]="panelId" [class]="panelClasses()" [hidden]="!openState()" role="listbox">
542
+ @if (searchable() && variant() !== 'combobox') {
543
+ <div class="border-b border-border p-2">
544
+ <div class="flex items-center gap-2 rounded-md border border-input bg-background px-2">
545
+ <svg
546
+ aria-hidden="true"
547
+ class="size-4 shrink-0 text-muted-foreground"
548
+ viewBox="0 0 24 24"
549
+ fill="none"
550
+ stroke="currentColor"
551
+ stroke-width="1.75"
552
+ stroke-linecap="round"
553
+ stroke-linejoin="round">
554
+ <circle cx="11" cy="11" r="8" />
555
+ <path d="m21 21-4.35-4.35" />
556
+ </svg>
557
+ <input
558
+ #panelSearch
559
+ class="h-9 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
560
+ [placeholder]="searchPlaceholder()"
561
+ [value]="query()"
562
+ (input)="handleSearchInput($event)"
563
+ (keydown.escape)="close()" />
564
+ @if (query().length > 0) {
565
+ <button
566
+ type="button"
567
+ class="inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground"
568
+ aria-label="Clear search"
569
+ (click)="clearSearch($event)">
570
+ <svg
571
+ aria-hidden="true"
572
+ class="size-3.5"
573
+ viewBox="0 0 24 24"
574
+ fill="none"
575
+ stroke="currentColor"
576
+ stroke-width="2"
577
+ stroke-linecap="round"
578
+ stroke-linejoin="round">
579
+ <path d="M18 6 6 18" />
580
+ <path d="m6 6 12 12" />
581
+ </svg>
582
+ </button>
583
+ }
584
+ </div>
585
+ </div>
586
+ }
587
+
588
+ <div class="max-h-72 overflow-y-auto p-1">
589
+ <ng-content />
590
+ </div>
591
+ </div>
592
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
593
+ }
594
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PillboxComponent, decorators: [{
595
+ type: Component,
596
+ args: [{
597
+ selector: 'ui-pillbox',
598
+ changeDetection: ChangeDetectionStrategy.OnPush,
599
+ imports: [NgTemplateOutlet],
600
+ providers: [
601
+ { provide: PillboxContext, useExisting: forwardRef(() => PillboxComponent) },
602
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => PillboxComponent), multi: true },
603
+ ],
604
+ host: {
605
+ '[class]': 'classes()',
606
+ '[attr.data-slot]': '"pillbox"',
607
+ '[attr.data-open]': 'openState() ? "" : null',
608
+ '[attr.data-size]': 'size()',
609
+ '[attr.data-variant]': 'variant()',
610
+ },
611
+ template: `
612
+ <div
613
+ #trigger
614
+ [attr.id]="resolvedId()"
615
+ role="combobox"
616
+ aria-haspopup="listbox"
617
+ [attr.aria-expanded]="openState()"
618
+ [attr.aria-controls]="openState() ? panelId : null"
619
+ [attr.aria-label]="ariaLabel()"
620
+ [attr.aria-labelledby]="ariaLabelledby()"
621
+ [attr.aria-describedby]="ariaDescribedby()"
622
+ [attr.aria-invalid]="invalid() ? 'true' : null"
623
+ [attr.aria-disabled]="disabledState() ? 'true' : null"
624
+ [attr.tabindex]="disabledState() ? -1 : 0"
625
+ [class]="triggerClasses()"
626
+ (click)="handleTriggerClick()"
627
+ (keydown.enter)="handleTriggerKeydown($any($event))"
628
+ (keydown.space)="handleTriggerKeydown($any($event))"
629
+ (keydown.arrowDown)="handleTriggerKeydown($any($event))"
630
+ (keydown.escape)="close()">
631
+ <div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5">
632
+ @if (selectedItems().length > 0) {
633
+ @for (item of selectedItems(); track item.track) {
634
+ <span [class]="pillClasses()">
635
+ @if (item.template; as template) {
636
+ <span class="inline-flex min-w-0 max-w-40 items-center gap-1 truncate">
637
+ <ng-container *ngTemplateOutlet="template" />
638
+ </span>
639
+ } @else {
640
+ <span class="max-w-40 truncate">{{ item.label }}</span>
641
+ }
642
+ <button
643
+ type="button"
644
+ class="-mr-1 inline-flex size-4 items-center justify-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
645
+ [attr.aria-label]="'Remove ' + item.label"
646
+ [disabled]="disabledState() || null"
647
+ (click)="removeSelected(item.value, $event)">
648
+ <svg
649
+ aria-hidden="true"
650
+ class="size-3"
651
+ viewBox="0 0 24 24"
652
+ fill="none"
653
+ stroke="currentColor"
654
+ stroke-width="2"
655
+ stroke-linecap="round"
656
+ stroke-linejoin="round">
657
+ <path d="M18 6 6 18" />
658
+ <path d="m6 6 12 12" />
659
+ </svg>
660
+ </button>
661
+ </span>
662
+ }
663
+ }
664
+
665
+ @if (variant() === 'combobox') {
666
+ <input
667
+ #inlineSearch
668
+ class="min-w-28 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed"
669
+ [placeholder]="selectedItems().length === 0 ? placeholder() : ''"
670
+ [value]="query()"
671
+ [disabled]="disabledState() || null"
672
+ (click)="$event.stopPropagation(); open()"
673
+ (focus)="open()"
674
+ (input)="handleSearchInput($event)"
675
+ (keydown.backspace)="handleInlineBackspace($any($event))"
676
+ (keydown.escape)="close()" />
677
+ } @else if (selectedItems().length === 0) {
678
+ <span class="truncate text-muted-foreground">{{ placeholder() }}</span>
679
+ }
680
+ </div>
681
+
682
+ @if (clearable() && selectedItems().length > 0 && !disabledState()) {
683
+ <button
684
+ type="button"
685
+ class="inline-flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
686
+ aria-label="Clear selected options"
687
+ (click)="clear($event)">
688
+ <svg
689
+ aria-hidden="true"
690
+ class="size-3.5"
691
+ viewBox="0 0 24 24"
692
+ fill="none"
693
+ stroke="currentColor"
694
+ stroke-width="2"
695
+ stroke-linecap="round"
696
+ stroke-linejoin="round">
697
+ <path d="M18 6 6 18" />
698
+ <path d="m6 6 12 12" />
699
+ </svg>
700
+ </button>
701
+ }
702
+
703
+ <svg
704
+ aria-hidden="true"
705
+ class="size-4 shrink-0 text-muted-foreground transition-transform"
706
+ [class.rotate-180]="openState()"
707
+ viewBox="0 0 24 24"
708
+ fill="none"
709
+ stroke="currentColor"
710
+ stroke-width="1.75"
711
+ stroke-linecap="round"
712
+ stroke-linejoin="round">
713
+ <path d="m6 9 6 6 6-6" />
714
+ </svg>
715
+ </div>
716
+
717
+ <div [attr.id]="panelId" [class]="panelClasses()" [hidden]="!openState()" role="listbox">
718
+ @if (searchable() && variant() !== 'combobox') {
719
+ <div class="border-b border-border p-2">
720
+ <div class="flex items-center gap-2 rounded-md border border-input bg-background px-2">
721
+ <svg
722
+ aria-hidden="true"
723
+ class="size-4 shrink-0 text-muted-foreground"
724
+ viewBox="0 0 24 24"
725
+ fill="none"
726
+ stroke="currentColor"
727
+ stroke-width="1.75"
728
+ stroke-linecap="round"
729
+ stroke-linejoin="round">
730
+ <circle cx="11" cy="11" r="8" />
731
+ <path d="m21 21-4.35-4.35" />
732
+ </svg>
733
+ <input
734
+ #panelSearch
735
+ class="h-9 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
736
+ [placeholder]="searchPlaceholder()"
737
+ [value]="query()"
738
+ (input)="handleSearchInput($event)"
739
+ (keydown.escape)="close()" />
740
+ @if (query().length > 0) {
741
+ <button
742
+ type="button"
743
+ class="inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground"
744
+ aria-label="Clear search"
745
+ (click)="clearSearch($event)">
746
+ <svg
747
+ aria-hidden="true"
748
+ class="size-3.5"
749
+ viewBox="0 0 24 24"
750
+ fill="none"
751
+ stroke="currentColor"
752
+ stroke-width="2"
753
+ stroke-linecap="round"
754
+ stroke-linejoin="round">
755
+ <path d="M18 6 6 18" />
756
+ <path d="m6 6 12 12" />
757
+ </svg>
758
+ </button>
759
+ }
760
+ </div>
761
+ </div>
762
+ }
763
+
764
+ <div class="max-h-72 overflow-y-auto p-1">
765
+ <ng-content />
766
+ </div>
767
+ </div>
768
+ `,
769
+ }]
770
+ }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], emptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyText", required: false }] }], loadingText: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingText", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], searchChange: [{ type: i0.Output, args: ["searchChange"] }], create: [{ type: i0.Output, args: ["create"] }], openedChange: [{ type: i0.Output, args: ["openedChange"] }], trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], inlineSearch: [{ type: i0.ViewChild, args: ['inlineSearch', { isSignal: true }] }], panelSearch: [{ type: i0.ViewChild, args: ['panelSearch', { isSignal: true }] }], options: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PillboxOptionComponent), { ...{ descendants: true }, isSignal: true }] }], createOptions: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PillboxOptionCreateComponent), { ...{ descendants: true }, isSignal: true }] }], emptyOptions: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PillboxOptionEmptyComponent), { ...{ descendants: true }, isSignal: true }] }] } });
771
+
772
+ /**
773
+ * Generated bundle index. Do not edit.
774
+ */
775
+
776
+ export { PillboxComponent, PillboxOptionComponent, PillboxOptionCreateComponent, PillboxOptionEmptyComponent, PillboxSelectedDirective };
777
+ //# sourceMappingURL=edsis-ui-pillbox.mjs.map